Skip to content

Commit 6edc989

Browse files
committed
build static binaries with -tags osusergo
When building a static binary, the osusergo build-tag should be used so that a pure go implementation of the `os/user` package is used. relates to: - golang/go#23265 os/user: add build tags to select cgo-vs-go implementation, like net package - golang/go@62f0127 - golang/go#24787 os/user: LookupId panics on Linux+glibc static build - golang/go#26492 cmd/go: build: add -static flag - golang/go#12058 cmd/go: #cgo pkg-config: add conditional --static flag to pkg-config Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 146d29c commit 6edc989

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

scripts/build/binary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ source ./scripts/build/.variables
99

1010
echo "Building statically linked $TARGET"
1111
export CGO_ENABLED=0
12-
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
12+
go build -tags osusergo -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
1313

1414
ln -sf "$(basename "${TARGET}")" build/docker

scripts/build/plugins

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ for p in cli-plugins/examples/* "$@" ; do
1717

1818
echo "Building statically linked $TARGET"
1919
export CGO_ENABLED=0
20-
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "github.com/docker/cli/${p}"
20+
go build -tags osusergo -o "${TARGET}" --ldflags "${LDFLAGS}" "github.com/docker/cli/${p}"
2121
done

scripts/docs/generate-man.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir -p ./man/man1
77
go install ./vendor/github.com/cpuguy83/go-md2man
88

99
# Generate man pages from cobra commands
10-
go build -o /tmp/gen-manpages github.com/docker/cli/man
10+
go build -tags osusergo -o /tmp/gen-manpages github.com/docker/cli/man
1111
/tmp/gen-manpages --root "$(pwd)" --target "$(pwd)/man/man1"
1212

1313
# Generate legacy pages from markdown

scripts/docs/generate-yaml.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set -eu -o pipefail
44

55
mkdir -p docs/yaml/gen
66

7-
go build -o build/yaml-docs-generator github.com/docker/cli/docs/yaml
7+
go build -tags osusergo -o build/yaml-docs-generator github.com/docker/cli/docs/yaml
88
build/yaml-docs-generator --root "$(pwd)" --target "$(pwd)/docs/yaml/gen"

0 commit comments

Comments
 (0)