Skip to content

Commit

Permalink
Run "stringer" using "go run"
Browse files Browse the repository at this point in the history
In the modern Go Modules-based toolchain we can avoid the need to globally
install this tool first by running it this way. As a bonus, the toolchain
will also install the version of the module we have specified in go.mod,
thereby locking us in to a particular version until we intentionally
upgrade.

The other third-party generator tools we use here aren't written in Go and
so we can't do the same for those right now, but maybe we'll find a nicer
way to handle those later too.
  • Loading branch information
apparentlymart authored and jbardin committed Oct 24, 2023
1 parent 341ffa4 commit d23a20a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hclsyntax/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ package hclsyntax
//go:generate gofmt -w scan_tokens.go
//go:generate ragel -Z scan_string_lit.rl
//go:generate gofmt -w scan_string_lit.go
//go:generate stringer -type TokenType -output token_type_string.go
//go:generate go run golang.org/x/tools/cmd/stringer -type TokenType -output token_type_string.go
2 changes: 1 addition & 1 deletion json/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/hcl/v2"
)

//go:generate stringer -type tokenType scanner.go
//go:generate go run golang.org/x/tools/cmd/stringer -type tokenType scanner.go
type tokenType rune

const (
Expand Down

0 comments on commit d23a20a

Please sign in to comment.