next -> main #46
@@ -2,3 +2,7 @@
|
|||||||
# excluding a self-contained Go source here drops it from the lint silently.
|
# excluding a self-contained Go source here drops it from the lint silently.
|
||||||
# Never exclude Go sources, go.mod/go.sum or .golangci.yml.
|
# Never exclude Go sources, go.mod/go.sum or .golangci.yml.
|
||||||
.git
|
.git
|
||||||
|
|
||||||
|
# Generated artifacts only; `make build` puts a multi-megabyte binary here
|
||||||
|
# and it would otherwise be shipped into the build context.
|
||||||
|
/build/
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
*.log
|
*.log
|
||||||
*.out
|
*.out
|
||||||
*.test
|
*.test
|
||||||
|
/build/
|
||||||
/rogue
|
/rogue
|
||||||
|
|||||||
31
Makefile
31
Makefile
@@ -10,11 +10,38 @@ GO_PKGS := ./...
|
|||||||
MD_FILES := $(shell git ls-files '*.md')
|
MD_FILES := $(shell git ls-files '*.md')
|
||||||
PRETTIER := prettier --tab-width 4 --prose-wrap always
|
PRETTIER := prettier --tab-width 4 --prose-wrap always
|
||||||
|
|
||||||
.PHONY: check fmt fmt-check lint test
|
# Every generated artifact goes here, and the whole directory is
|
||||||
|
# git-ignored. Targets that write outside it can commit their output.
|
||||||
|
BUILD_DIR := build
|
||||||
|
BIN := $(BUILD_DIR)/rogue
|
||||||
|
COVERPROF := $(BUILD_DIR)/coverage.out
|
||||||
|
COVERHTML := $(BUILD_DIR)/coverage.html
|
||||||
|
|
||||||
# Format, lint, and test — the full local pre-commit gate.
|
.PHONY: build check cover cover-html fmt fmt-check lint test
|
||||||
|
|
||||||
|
# Format, lint, and test — the full local pre-commit gate. Keep this list
|
||||||
|
# to targets that write nothing into the working tree.
|
||||||
check: fmt-check lint test
|
check: fmt-check lint test
|
||||||
|
|
||||||
|
# Build the executable into $(BUILD_DIR). `go build -o` does not create the
|
||||||
|
# parent directory.
|
||||||
|
build:
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
go build -o $(BIN) ./cmd/rogue
|
||||||
|
|
||||||
|
# Per-function coverage, for finding which functions are untested. The
|
||||||
|
# percentage `make test` prints is a per-package total and cannot answer
|
||||||
|
# that. Writes files, so it stays out of `check`.
|
||||||
|
cover:
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
go test -timeout 30s -coverprofile=$(COVERPROF) $(GO_PKGS)
|
||||||
|
go tool cover -func=$(COVERPROF)
|
||||||
|
|
||||||
|
# Render the same profile as annotated source.
|
||||||
|
cover-html: cover
|
||||||
|
go tool cover -html=$(COVERPROF) -o $(COVERHTML)
|
||||||
|
@echo "wrote $(COVERHTML)"
|
||||||
|
|
||||||
# Format Go and Markdown in place.
|
# Format Go and Markdown in place.
|
||||||
fmt:
|
fmt:
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -21,19 +21,19 @@ original program structure and the design of this port.
|
|||||||
Requires Go 1.25 or later and a terminal at least 80x24.
|
Requires Go 1.25 or later and a terminal at least 80x24.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go build ./cmd/rogue
|
make build
|
||||||
./rogue
|
./build/rogue
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Restore a saved game
|
# Restore a saved game
|
||||||
./rogue ~/rogue.save
|
./build/rogue ~/rogue.save
|
||||||
|
|
||||||
# View high scores
|
# View high scores
|
||||||
./rogue -s
|
./build/rogue -s
|
||||||
|
|
||||||
# Test the death screen (demo mode)
|
# Test the death screen (demo mode)
|
||||||
./rogue -d
|
./build/rogue -d
|
||||||
```
|
```
|
||||||
|
|
||||||
## In-game commands
|
## In-game commands
|
||||||
@@ -57,7 +57,7 @@ Press `?` in game for the full list.
|
|||||||
export ROGUEOPTS="name=YourName,terse,jump,fruit=mango"
|
export ROGUEOPTS="name=YourName,terse,jump,fruit=mango"
|
||||||
|
|
||||||
# Wizard (debug) mode, with a reproducible dungeon
|
# Wizard (debug) mode, with a reproducible dungeon
|
||||||
ROGUE_WIZARD=1 SEED=12345 ./rogue
|
ROGUE_WIZARD=1 SEED=12345 ./build/rogue
|
||||||
```
|
```
|
||||||
|
|
||||||
The scoreboard is kept in `~/.rogue.scores`. Save files are Go gob snapshots
|
The scoreboard is kept in `~/.rogue.scores`. Save files are Go gob snapshots
|
||||||
@@ -80,9 +80,11 @@ For development, the `Makefile` wraps the toolchain: `make fmt` (gofmt +
|
|||||||
prettier), `make lint` (`script/lint`, which runs golangci-lint inside the
|
prettier), `make lint` (`script/lint`, which runs golangci-lint inside the
|
||||||
pinned container built from `Dockerfile.lint` — it is never installed on the
|
pinned container built from `Dockerfile.lint` — it is never installed on the
|
||||||
host, so docker is required), `make test` (the suite, under the race detector
|
host, so docker is required), `make test` (the suite, under the race detector
|
||||||
with coverage and a timeout), and `make check` (all three). Use the targets
|
with coverage and a timeout), `make check` (all three), `make build` (the
|
||||||
rather than invoking `go test` directly — they carry the flags the project
|
executable), and `make cover` / `make cover-html` (per-function coverage, and
|
||||||
relies on.
|
the same profile as annotated source at `build/coverage.html`). Everything they
|
||||||
|
generate lands in the git-ignored `build/`. Use the targets rather than the
|
||||||
|
toolchain directly — they carry the flags the project relies on.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
20
TODO.md
20
TODO.md
@@ -35,6 +35,26 @@ is finished.
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
|
- 2026-08-10 `make cover` added (https://git.eeqj.de/sneak/rgoue/issues/17).
|
||||||
|
`make cover` writes `build/coverage.out` and prints the per-function report;
|
||||||
|
`make cover-html` renders the same profile to `build/coverage.html`. The
|
||||||
|
per-package percentage `make test` prints cannot say _which_ function is
|
||||||
|
untested, which is how the coverage gaps closed so far had to be found — by
|
||||||
|
grepping test files for identifiers.
|
||||||
|
|
||||||
|
Neither target is in `check`, and neither may be added to it: both write
|
||||||
|
files, and `make check` must not modify the working tree.
|
||||||
|
|
||||||
|
- 2026-08-10 `make build` added (https://git.eeqj.de/sneak/rgoue/issues/19). The
|
||||||
|
executable is built to `build/rogue`; `README.md` no longer contains a raw
|
||||||
|
`go` invocation anywhere. `build` is in neither `check` nor `test` —
|
||||||
|
`make check` stays `fmt-check lint test` and still writes nothing into the
|
||||||
|
working tree.
|
||||||
|
|
||||||
|
Generated artifacts now all live under `build/`, which `.gitignore` covers
|
||||||
|
as a whole. Anything written outside it is committable, so a target that
|
||||||
|
puts its output elsewhere reintroduces the stray-artifact problem.
|
||||||
|
|
||||||
- 2026-08-10 Linting moved into a container
|
- 2026-08-10 Linting moved into a container
|
||||||
(https://git.eeqj.de/sneak/rgoue/issues/41). `golangci-lint` is no longer
|
(https://git.eeqj.de/sneak/rgoue/issues/41). `golangci-lint` is no longer
|
||||||
invoked on the host anywhere in the repo: `Dockerfile.lint` pins
|
invoked on the host anywhere in the repo: `Dockerfile.lint` pins
|
||||||
|
|||||||
Reference in New Issue
Block a user