github.com/argoproj/argo-cd/v2@v2.10.9/hack/installers/install-codegen-go-tools.sh (about) 1 #!/bin/bash 2 set -eux -o pipefail 3 4 SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P )" 5 6 # This script installs all our golang-based codegen utility CLIs necessary for codegen. 7 # Some dependencies are vendored in go.mod (ones which are actually imported in our codebase). 8 # Other dependencies are only used as a CLI and do not need vendoring in go.mod (doing so adds 9 # unecessary dependencies to go.mod). We want to maintain a single source of truth for versioning 10 # our binaries (either go.mod or go install <pkg>@<version>), so we use two techniques to install 11 # our CLIs: 12 # 1. For CLIs which are NOT vendored in go.mod, we can run `go install <pkg>@<version>` with an explicit version 13 # 2. For packages which we *do* vendor in go.mod, we determine version from go.mod followed by `go install` with that version 14 go_mod_install() { 15 module=$(go list -f '{{.Module}}' $1 | awk '{print $1}') 16 module_version=$(go list -m $module | awk '{print $NF}' | head -1) 17 go install $1@$module_version 18 } 19 20 # All binaries are compiled into the argo-cd/dist directory, which is added to the PATH during codegen 21 export GOBIN="${SRCROOT}/dist" 22 mkdir -p $GOBIN 23 24 # protoc-gen-go* is used to generate <service>.pb.go from .proto files 25 # go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 26 #go_mod_install github.com/gogo/protobuf/protoc-gen-gogo 27 go_mod_install github.com/gogo/protobuf/protoc-gen-gogofast 28 29 # protoc-gen-grpc-gateway is used to build <service>.pb.gw.go files from from .proto files 30 go_mod_install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway 31 32 # # protoc-gen-swagger is used to build swagger.json 33 go_mod_install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger 34 35 # k8s tools to codegen .proto files, client libraries, and helpers from types.go 36 go_mod_install k8s.io/code-generator/cmd/go-to-protobuf 37 go_mod_install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo 38 go_mod_install k8s.io/code-generator/cmd/client-gen 39 go_mod_install k8s.io/code-generator/cmd/deepcopy-gen 40 go_mod_install k8s.io/code-generator/cmd/defaulter-gen 41 go_mod_install k8s.io/code-generator/cmd/informer-gen 42 go_mod_install k8s.io/code-generator/cmd/lister-gen 43 44 # We still install openapi-gen from go.mod since upstream does not utilize release tags 45 go_mod_install k8s.io/kube-openapi/cmd/openapi-gen 46 47 # controller-gen is run by ./hack/gen-crd-spec to generate the CRDs 48 go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 49 50 # swagger cli is used to generate swagger docs 51 go install github.com/go-swagger/go-swagger/cmd/swagger@v0.28.0 52 53 # goimports is used to auto-format generated code 54 go install golang.org/x/tools/cmd/goimports@v0.1.8