thempatel commented on a change in pull request #16961: URL: https://github.com/apache/beam/pull/16961#discussion_r830357685
########## File path: sdks/go/scripts/genmodel.sh ########## @@ -0,0 +1,81 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +if [[ -z "$(which protoc)" ]]; then + echo "protoc not found on path" + exit 1 +fi + +SCRIPT_DIR="$( realpath "$( dirname "${BASH_SOURCE[0]}" )" )" +if [[ -z $SCRIPT_DIR ]]; then + echo "unable to resolve path to script" + exit 1 +fi + +PROJECT_ROOT="$(realpath "$(dirname $SCRIPT_DIR)/../..")" +if [[ -z "$PROJECT_ROOT" ]]; then + echo "unable to resolve path to project root" + exit 1 +fi + +if [[ -z "$(which go)" ]]; then + echo "go runtime missing" + exit 1 +fi + +if [[ -z "$GOPATH" ]]; then + export GOPATH="$(go env GOPATH)" Review comment: I need help making a decision on this one, it looks like `protoc-gen-go-grpc` is released separately from https://github.com/grpc/grpc-go despite being in the same repository. When performing `go install google.golang.org/grpc/cmd/protoc-gen-go-grpc` without a version number, i.e. relying on what's in the go.mod file, the downloaded version is `v1.1.0`. ```sh "$(go env GOPATH)/bin/protoc-gen-go-grpc" --version protoc-gen-go-grpc 1.1.0 ``` and the resulting generated files lose the version and path info: ```diff // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.1.0 -// - protoc v3.19.4 -// source: org/apache/beam/model/pipeline/v1/beam_runner_api.proto ``` if I add a dedicated version number to the go.mod file, like so: ```diff google.golang.org/api v0.45.0 google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f google.golang.org/grpc v1.39.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect google.golang.org/protobuf v1.27.1 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/linkedin/goavro.v1 v1.0.5 // indirect ``` then the version numbers come back. Same result if I replace the version number in go.mod with `ebf6a4b`. The question is, how do we want to handle the difference in release versions for this? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
