From 2b71f26c99614b73df6aaf4203e4fe64c2d7fc96 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 5 Dec 2023 16:14:19 +0100 Subject: [PATCH] all: fix go generate (needs protolegacy build tag for weak fields) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to this change, one could either use go generate or ./test.bash -regenerate to re-generate the files — but only the latter way would work. With this change, we make ./test.bash -regenerate call go generate so that the two ways cannot diverge again. Change-Id: I940df66ebc6a4200847cf751929b3611309b67bc Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/547256 Reviewed-by: Lasse Folger LUCI-TryBot-Result: Go LUCI --- integration_test.go | 4 ++-- internal/cmd/generate-protos/main.go | 2 +- internal/cmd/generate-types/main.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_test.go b/integration_test.go index 453257a1..85357b10 100644 --- a/integration_test.go +++ b/integration_test.go @@ -367,8 +367,8 @@ func downloadArchive(check func(error), dstPath, srcURL, skipPrefix, wantSHA256 func mustHandleFlags(t *testing.T) { if *regenerate { t.Run("Generate", func(t *testing.T) { - fmt.Print(mustRunCommand(t, "go", "run", "-tags", "protolegacy", "./internal/cmd/generate-types", "-execute")) - fmt.Print(mustRunCommand(t, "go", "run", "-tags", "protolegacy", "./internal/cmd/generate-protos", "-execute")) + fmt.Print(mustRunCommand(t, "go", "generate", "./internal/cmd/generate-types")) + fmt.Print(mustRunCommand(t, "go", "generate", "./internal/cmd/generate-protos")) files := strings.Split(strings.TrimSpace(mustRunCommand(t, "git", "ls-files", "*.go")), "\n") mustRunCommand(t, append([]string{"gofmt", "-w"}, files...)...) }) diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go index c52843f9..861aa72b 100644 --- a/internal/cmd/generate-protos/main.go +++ b/internal/cmd/generate-protos/main.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate go run . -execute +//go:generate go run -tags protolegacy . -execute package main diff --git a/internal/cmd/generate-types/main.go b/internal/cmd/generate-types/main.go index c525067c..53f3721b 100644 --- a/internal/cmd/generate-types/main.go +++ b/internal/cmd/generate-types/main.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate go run . -execute +//go:generate go run -tags protolegacy . -execute package main