Go 1.11 includes a fix to os/user to be working in a static binary
(fixing https://github.com/golang/go/issues/23265). The fix requires
`osusergo` build tag to be set for static binaries, which is what
this commit adds (also for containerd).
[v2: sort build tags alphabetically]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
| ... | ... |
@@ -145,7 +145,7 @@ LDFLAGS_STATIC='' |
| 145 | 145 |
EXTLDFLAGS_STATIC='-static' |
| 146 | 146 |
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build |
| 147 | 147 |
# with options like -race. |
| 148 |
-ORIG_BUILDFLAGS=( -tags "autogen netgo static_build $DOCKER_BUILDTAGS" -installsuffix netgo ) |
|
| 148 |
+ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo ) |
|
| 149 | 149 |
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here |
| 150 | 150 |
|
| 151 | 151 |
# When $DOCKER_INCREMENTAL_BINARY is set in the environment, enable incremental |
| ... | ... |
@@ -5,6 +5,7 @@ set -e |
| 5 | 5 |
export IAMSTATIC='false' |
| 6 | 6 |
export LDFLAGS_STATIC_DOCKER='' |
| 7 | 7 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
|
| 8 |
+ export BUILDFLAGS=( "${BUILDFLAGS[@]/osusergo /}" ) # ditto for osusergo
|
|
| 8 | 9 |
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
|
| 9 | 10 |
source "${MAKEDIR}/.binary"
|
| 10 | 11 |
) |