Skip to content

Move gomods example to the go tool directive - #127

Merged
dmarkham merged 1 commit into
masterfrom
example-go-tool
Oct 3, 2026
Merged

dmarkham merged 1 commit into
masterfrom
example-go-tool

Conversation

@dmarkham

@dmarkham dmarkham commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

The examples/gomods module still declared go 1.12 and its README told readers to go get -u enumer, generate, then go mod tidy to remove it again. Since enumer now requires Go 1.25, the example pins enumer with a tool directive instead. go generate works on a fresh clone and go mod tidy keeps the dependency.

Changes

  • examples/gomods/go.mod: go 1.25.0, tool github.com/dmarkham/enumer, matching go.sum
  • examples/gomods/main.go: //go:generate go tool enumer -type=Pill -json
  • examples/gomods/README.md: rewritten steps
  • README.md: states the Go 1.25 floor, leads the install section with the tool directive, and points at the example as a runnable module set up that way

Verification

In the example directory: go mod tidy is stable, go generate writes pill_enumer.go, go run . prints the expected three lines, and deleting the generated file and regenerating works again.

The example still used go 1.12 and told readers to go get -u enumer,
generate, then go mod tidy to drop it again. With Go 1.25 required
anyway, pin enumer with a tool directive so go generate works on a
fresh clone and tidy keeps the dependency.

- examples/gomods/go.mod: go 1.25, tool github.com/dmarkham/enumer
- examples/gomods/main.go: go:generate go tool enumer
- examples/gomods/README.md: new steps
- README.md: state the Go 1.25 floor and lead the install section
  with the tool directive, pointing at the example
- README.md: remove the retired Go Report Card badge
@dmarkham
dmarkham merged commit fc61129 into master Oct 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant