Closed jmalloc closed 2 years ago
https://github.com/make-files/makefiles/blob/v1/pkg/protobuf/v2/Makefile#L75
This line might be the culprit? It's including the options for both go
and go-grpc
. Though I actually can't reproduce this on my machine yet.
Line 75 in this file is a comment line, is this the line you're referring to?
Sorry, I should have used a permalink. Try https://github.com/make-files/makefiles/blob/f872c5bd730fed3efba2428e6cfeb3a415caf708/pkg/protobuf/v2/Makefile#L96
This stackoverflow suggests that the input file is included at least twice in the command. I assume that input file would be api.proto
in the original case. However, I cannot understand how would api.proto
be repeated at least twice. Honestly I don't think (and this stackoverflow issue suggests the same) that this is due to duplication (if any) of the import paths.
No worries. Thanks for looking. I might have to get Nate to see if he can reproduce on his machine with a new repo.
That said, should both those arg files be included there?
For this particular target, yes. As this target compiles *_grpc.pb.go
files, it needs to include options both from artifacts/protobuf/args/go
and artifacts/protobuf/args/go-grpc
.
If we look at the target that generates artifacts/protobuf/args/go-grpc
we can see that it adds only three options there and all three are grpc-specific. All import paths and main golang options are placed in artifacts/protobuf/args/go
❯ make --debug
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
File `test' does not exist.
Target `test' is double-colon and has no prerequisites.
Must remake target `test'.
Successfully remade target file `test'.
File `test' does not exist.
Prerequisite `artifacts/protobuf/bin/run-protoc' is newer than target `api.pb.go'.
Must remake target `api.pb.go'.
/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/run-protoc \
$(cat artifacts/protobuf/args/common artifacts/protobuf/args/go) \
/Users/nate/Developer/nomad-sdk-ios-api/./*.proto
+ PATH=/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin:/Users/nate/Developer/nomad-sdk-ios-api/.makefiles/lib/core/bin:/opt/homebrew/opt/kubernetes-cli@1.22/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/nate/.fig/bin:/Users/nate/.local/bin
+ /Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/protoc --proto_path=/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/../include --go_opt=module=github.com/betsecure/nomad-sdk-ios-api --go_out=:. --proto_path=github.com/betsecure/nomad-sdk-ios-api=/Users/nate/Developer/nomad-sdk-ios-api --proto_path=cloud.google.com/go=/Users/nate/go/pkg/mod/cloud.google.com/go@v0.34.0 --proto_path=github.com/census-instrumentation/opencensus-proto=/Users/nate/go/pkg/mod/github.com/census-instrumentation/opencensus-proto@v0.2.1 --proto_path=github.com/envoyproxy/protoc-gen-validate=/Users/nate/go/pkg/mod/github.com/envoyproxy/protoc-gen-validate@v0.1.0 --proto_path=github.com/golang/protobuf=/Users/nate/go/pkg/mod/github.com/golang/protobuf@v1.5.2 --proto_path=github.com/grpc-ecosystem/grpc-gateway=/Users/nate/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.16.0 --proto_path=github.com/prometheus/client_model=/Users/nate/go/pkg/mod/github.com/prometheus/client_model@v0.0.0-20190812154241-14fe0d1b01d4 --proto_path=google.golang.org/appengine=/Users/nate/go/pkg/mod/google.golang.org/appengine@v1.4.0 --proto_path=google.golang.org/grpc=/Users/nate/go/pkg/mod/google.golang.org/grpc@v1.47.0 --proto_path=google.golang.org/protobuf=/Users/nate/go/pkg/mod/google.golang.org/protobuf@v1.28.0 /Users/nate/Developer/nomad-sdk-ios-api/./api.proto
Successfully remade target file `api.pb.go'.
Prerequisite `api.proto' is newer than target `api_grpc.pb.go'.
Prerequisite `artifacts/protobuf/bin/go.mod' is newer than target `api_grpc.pb.go'.
Prerequisite `artifacts/protobuf/bin/run-protoc' is newer than target `api_grpc.pb.go'.
Prerequisite `artifacts/protobuf/args/go' is newer than target `api_grpc.pb.go'.
Prerequisite `artifacts/protobuf/args/go-grpc' is newer than target `api_grpc.pb.go'.
Must remake target `api_grpc.pb.go'.
/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/run-protoc \
$(cat artifacts/protobuf/args/common artifacts/protobuf/args/go artifacts/protobuf/args/go-grpc) \
/Users/nate/Developer/nomad-sdk-ios-api/./*.proto
+ PATH=/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin:/Users/nate/Developer/nomad-sdk-ios-api/.makefiles/lib/core/bin:/opt/homebrew/opt/kubernetes-cli@1.22/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/nate/.fig/bin:/Users/nate/.local/bin
+ /Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/protoc --proto_path=/Users/nate/Developer/nomad-sdk-ios-api/artifacts/protobuf/bin/../include --go_opt=module=github.com/betsecure/nomad-sdk-ios-api --go_out=:. --proto_path=github.com/betsecure/nomad-sdk-ios-api=/Users/nate/Developer/nomad-sdk-ios-api --proto_path=cloud.google.com/go=/Users/nate/go/pkg/mod/cloud.google.com/go@v0.34.0 --proto_path=github.com/census-instrumentation/opencensus-proto=/Users/nate/go/pkg/mod/github.com/census-instrumentation/opencensus-proto@v0.2.1 --proto_path=github.com/envoyproxy/protoc-gen-validate=/Users/nate/go/pkg/mod/github.com/envoyproxy/protoc-gen-validate@v0.1.0 --proto_path=github.com/golang/protobuf=/Users/nate/go/pkg/mod/github.com/golang/protobuf@v1.5.2 --proto_path=github.com/grpc-ecosystem/grpc-gateway=/Users/nate/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.16.0 --proto_path=github.com/prometheus/client_model=/Users/nate/go/pkg/mod/github.com/prometheus/client_model@v0.0.0-20190812154241-14fe0d1b01d4 --proto_path=google.golang.org/appengine=/Users/nate/go/pkg/mod/google.golang.org/appengine@v1.4.0 --proto_path=google.golang.org/grpc=/Users/nate/go/pkg/mod/google.golang.org/grpc@v1.47.0 --proto_path=google.golang.org/protobuf=/Users/nate/go/pkg/mod/google.golang.org/protobuf@v1.28.0 --go-grpc_opt=module=github.com/betsecure/nomad-sdk-ios-api --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false --go-grpc_opt=module=github.com/betsecure/nomad-sdk-ios-api --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false /Users/nate/Developer/nomad-sdk-ios-api/./api.proto
api_grpc.pb.go: Tried to write the same file twice.
make: *** [api_grpc.pb.go] Error 1
Closing for now as we were unable to reproduce it after pulling new makefiles.
Likely solved in 92d9b29
/cc @danilvpetrov, @natesmith-bsecure