Thirty-seven entries in the root, most of them .go files. The assets had to come along: //go:embed cannot reach outside its own directory, so templates/, static/ and migrations/ live beside the code that embeds them, and testdata/ beside the test that reads it. storage/ stays put — runtime data, not source. go build now needs -o. Without it the output would be named after the package directory and collide with src/ itself.
27 lines
722 B
Makefile
27 lines
722 B
Makefile
# One command before committing: make
|
|
#
|
|
# gofmt is first because a formatting failure is the cheapest to fix, and it is the only check that
|
|
# needs a wrapper — gofmt reports offending files on stdout and still exits 0.
|
|
.POSIX:
|
|
.PHONY: check fmt vet test build run
|
|
|
|
check: fmt vet test
|
|
|
|
fmt:
|
|
@out=$$(gofmt -l .); test -z "$$out" || { echo "not gofmt'd:"; echo "$$out"; exit 1; }
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
# -o is required, not stylistic: the package lives in ./src, and without it `go build` would try to
|
|
# write a binary named "src" over the directory.
|
|
build:
|
|
go build -o levyraati26-go ./src
|
|
|
|
# Templates and migrations are embedded, so seeing a change means rebuilding.
|
|
run: build
|
|
./levyraati26-go
|