build: fix generation when vendoring dependencies (#22089)

pull/22122/head
Daniel Moran 2021-08-06 15:06:36 -04:00 committed by GitHub
parent 8282fbac77
commit 22c6b78c62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View File

@ -382,6 +382,12 @@ jobs:
name: Check flag generation
command: ./scripts/ci/lint/flags.bash
- run: make checkgenerate
- run:
name: Check generation when vendoring deps
command: |
go mod vendor
make checkgenerate
rm -rf vendor
- run: make vet
- run: make checkfmt
- run: go install honnef.co/go/tools/cmd/staticcheck

View File

@ -1,4 +1,4 @@
//Package wire is used to serialize a trace.
package wire
//go:generate sh -c "protoc -I$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) -I. --gogofaster_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types:. binary.proto"
//go:generate sh -c "protoc -I$(../../../scripts/gogo-path.sh) -I. --gogofaster_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types:. binary.proto"

13
scripts/gogo-path.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd)
declare -r ROOT_DIR=$(dirname ${SCRIPT_DIR})
declare -r GOGO_PATH=github.com/gogo/protobuf
if [ -d "${ROOT_DIR}/vendor" ]; then
echo "${ROOT_DIR}/vendor/${GOGO_PATH}"
else
go list -f '{{ .Dir }}' -m ${GOGO_PATH}
fi

View File

@ -1,3 +1,3 @@
package datatypes
//go:generate sh -c "protoc -I$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) -I. --plugin ../../../scripts/protoc-gen-gogofaster --gogofaster_out=Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc:. storage_common.proto predicate.proto"
//go:generate sh -c "protoc -I$(../../../scripts/gogo-path.sh) -I. --plugin ../../../scripts/protoc-gen-gogofaster --gogofaster_out=Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc:. storage_common.proto predicate.proto"

View File

@ -1,3 +1,3 @@
package storage
//go:generate sh -c "protoc -I$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) -I. --gogofaster_out=. source.proto"
//go:generate sh -c "protoc -I$(../../../scripts/gogo-path.sh) -I. --gogofaster_out=. source.proto"