Skip to content

Commit

Permalink
Merge pull request #3490 from thaJeztah/fix_osusergo
Browse files Browse the repository at this point in the history
scripts/build: make sure osusergo is set for static with CGO enabled
  • Loading branch information
thaJeztah authored Mar 26, 2022
2 parents a23dc4f + e20572d commit 0b266ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/build/.variables
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ fi
if [ "$CGO_ENABLED" = "1" ] && [ "$GO_LINKMODE" = "static" ] && [ "$(go env GOOS)" = "linux" ]; then
LDFLAGS="$LDFLAGS -extldflags -static"
fi
if [ "$CGO_ENABLED" = "1" ] && [ "$GO_LINKMODE" = "static" ]; then
# compiling statically with CGO enabled requires osusergo to be set.
GO_BUILDTAGS="$GO_BUILDTAGS osusergo"
fi
if [ -n "$GO_STRIP" ]; then
LDFLAGS="$LDFLAGS -s"
fi
Expand Down

0 comments on commit 0b266ba

Please sign in to comment.