From d23a20ac41349e5f1cc7b60e76d1408069db498b Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Thu, 9 Jun 2022 14:52:04 -0700 Subject: [PATCH] Run "stringer" using "go run" 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. --- hclsyntax/generate.go | 2 +- json/scanner.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hclsyntax/generate.go b/hclsyntax/generate.go index 383ec6b8..66486074 100644 --- a/hclsyntax/generate.go +++ b/hclsyntax/generate.go @@ -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 diff --git a/json/scanner.go b/json/scanner.go index cae84859..a5e21305 100644 --- a/json/scanner.go +++ b/json/scanner.go @@ -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 (