File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898if [ " $CGO_ENABLED " = " 1" ] && [ " $GO_LINKMODE " = " static" ] && [ " $( go env GOOS) " = " linux" ]; then
9999 GO_LDFLAGS=" $GO_LDFLAGS -linkmode external -extldflags -static"
100100fi
101+
102+ # We only import google.golang.org/grpc as an indirect dependency, and
103+ # do not make gRPC connections.
104+ #
105+ # grpcnotrace avoids importing golang.org/x/net/trace, which in turn enables
106+ # dead code elimination, which can reduce binary size when tracing is not needed.
107+ #
108+ # see https://github.com/grpc/grpc-go/blob/v1.81.1/trace_notrace.go#L23-L25
109+ GO_BUILDTAGS=" $GO_BUILDTAGS grpcnotrace"
110+
101111if [ " $CGO_ENABLED " = " 1" ] && [ " $GO_LINKMODE " = " static" ]; then
102112 # compiling statically with CGO enabled requires osusergo and netgo to be set.
103113 GO_BUILDTAGS=" $GO_BUILDTAGS osusergo netgo"
You can’t perform that action at this time.
0 commit comments