What version of Go are you using (go version)?
⚡ root@k8s /home/ubuntu go version
go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yep, upgrade the golang to version 1.11 and build the software.
What operating system and processor architecture are you using (go env)?
⚡ root@k8s /home/ubuntu go env
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/paasdata/gopath"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build147710718=/tmp/go-build -gno-record-gcc-switches"
What did you do?
- For example, let's build hyperkube (kubernetes v1.11.1) with go1.10.3
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 go version
go version go1.10.3 linux/amd64
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 make hyperkube
+++ [0827 14:21:57] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/deepcopy-gen
+++ [0827 14:22:08] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/defaulter-gen
+++ [0827 14:22:16] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/conversion-gen
+++ [0827 14:22:24] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/openapi-gen
+++ [0827 14:22:35] Building go targets for linux/amd64:
./vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0827 14:22:37] Building go targets for linux/amd64:
cmd/hyperkube
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1
- Check the generated binary files, the hyperkube is 217M
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 ll -h _output/local/bin/linux/amd64
total 255M
-rwxr-xr-x 1 root root 7.4M Aug 27 14:22 conversion-gen
-rwxr-xr-x 1 root root 7.4M Aug 27 14:21 deepcopy-gen
-rwxr-xr-x 1 root root 7.4M Aug 27 14:22 defaulter-gen
-rwxr-xr-x 1 root root 2.8M Aug 27 14:22 go-bindata
-rwxr-xr-x 1 root root 217M Aug 27 14:26 hyperkube
-rwxr-xr-x 1 root root 14M Aug 27 14:22 openapi-gen
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1
- Change the golang to 1.11, build hyperkube (kubernetes v1.11.1) again
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 make clean
+++ [0827 14:33:26] Verifying Prerequisites....
+++ [0827 14:33:26] Removing _output directory
Removing pkg/generated/openapi/zz_generated.openapi.go ..
Removing test/e2e/generated/bindata.go ..
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 rm -rf /usr/local/go
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 ln -s /usr/local/go1.10.3 /usr/local/go
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 go version
go version go1.10.3 linux/amd64
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 go version
go version go1.11 linux/amd64
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 make hyperkube
+++ [0827 14:33:53] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/deepcopy-gen
+++ [0827 14:34:05] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/defaulter-gen
+++ [0827 14:34:12] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/conversion-gen
+++ [0827 14:34:21] Building go targets for linux/amd64:
./vendor/k8s.io/code-generator/cmd/openapi-gen
+++ [0827 14:34:32] Building go targets for linux/amd64:
./vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0827 14:34:34] Building go targets for linux/amd64:
cmd/hyperkube
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1
- Check the new files, the hyperkube increased to 275M, the size increased 26.7% compared to versions 1.10.3
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1 ll -h _output/local/bin/linux/amd64
total 313M
-rwxr-xr-x 1 root root 7.4M Aug 27 14:34 conversion-gen
-rwxr-xr-x 1 root root 7.4M Aug 27 14:33 deepcopy-gen
-rwxr-xr-x 1 root root 7.3M Aug 27 14:34 defaulter-gen
-rwxr-xr-x 1 root root 2.7M Aug 27 14:34 go-bindata
-rwxr-xr-x 1 root root 275M Aug 27 14:37 hyperkube
-rwxr-xr-x 1 root root 13M Aug 27 14:34 openapi-gen
⚡ root@k8s /paasdata/gopath/src/k8s.io/kubernetes-1.11.1
What did you expect to see?
The compiler version upgrade has little effect on the size of the generated binary.
What did you see instead?
The size increased 26.7% compared to 1.10.x versions.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yep, upgrade the golang to version 1.11 and build the software.
What operating system and processor architecture are you using (
go env)?What did you do?
What did you expect to see?
The compiler version upgrade has little effect on the size of the generated binary.
What did you see instead?
The size increased 26.7% compared to 1.10.x versions.