Skip to content

Commit c0547e7

Browse files
authored
Fixes to protobuf compile script (#37683)
* Fix lack of protoc-gen-go-grpc This appears to have been removed in https://github.com/hashicorp/terraform/pull/29492/files#diff-0329966ed7ce7286cfaf91161ac003af419cc566dd6420bb07670f9e4a389c81 accidentally following linting? * Fix Args to include all arguments The docs say "Args holds command line arguments, including the command as Args[0]." * Add TODO for swapping to non-deprecated repo for protoc-gen-go
1 parent 8ed2f39 commit c0547e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/protobuf-compile/protobuf-compile.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const protocVersion = "3.15.6"
3333
// in Go modules our version selection for these comes from our top-level
3434
// go.mod, as with all other Go dependencies. If you want to switch to a newer
3535
// version of either tool then you can upgrade their modules in the usual way.
36+
//
37+
// TODO: Swap to using google.golang.org/protobuf/cmd/protoc-gen-go
3638
const protocGenGoPackage = "github.com/golang/protobuf/protoc-gen-go"
3739
const protocGenGoGrpcPackage = "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
3840

@@ -144,7 +146,7 @@ func main() {
144146
if err != nil {
145147
log.Fatal(err)
146148
}
147-
_, err = buildProtocGenGoGrpc(workDir)
149+
protocGenGoGrpcExec, err := buildProtocGenGoGrpc(workDir)
148150
if err != nil {
149151
log.Fatal(err)
150152
}
@@ -157,7 +159,7 @@ func main() {
157159
if err != nil {
158160
log.Fatal(err)
159161
}
160-
protocGenGoGrpcExec, err := filepath.Abs(protocGenGoExec)
162+
protocGenGoGrpcExec, err = filepath.Abs(protocGenGoGrpcExec)
161163
if err != nil {
162164
log.Fatal(err)
163165
}
@@ -175,7 +177,7 @@ func main() {
175177

176178
cmd := &exec.Cmd{
177179
Path: cmdLine[0],
178-
Args: cmdLine[1:],
180+
Args: cmdLine,
179181
Dir: step.WorkDir,
180182
Env: os.Environ(),
181183
Stdout: os.Stdout,

0 commit comments

Comments
 (0)