Skip to content

Commit

Permalink
all: fix go generate (needs protolegacy build tag for weak fields)
Browse files Browse the repository at this point in the history
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 <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
stapelberg committed Dec 5, 2023
1 parent 704136e commit 2b71f26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)...)
})
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/generate-protos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/generate-types/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2b71f26

Please sign in to comment.