docker-compose.yml
version: '3'
services:
test:
image: golang:${GO_VERSION:-1.22}
working_dir: /source
command: go test -coverprofile c.out -v ./...
volumes:
- .:/source
- $GOPATH/pkg/mod/cache:/go/pkg/mod/cache
generate:
image: golang:1.22
working_dir: /source
command: >
sh -c "go install golang.org/x/tools/cmd/stringer;
go generate;
echo \"Address data and strings generated.\""
volumes:
- .:/source
- $GOPATH/pkg/mod/cache:/go/pkg/mod/cache