Skip to content

Commit

Permalink
Merge pull request #45929 from neersighted/with-go-mod_ROOTDIR
Browse files Browse the repository at this point in the history
hack: use Git-free ROOTDIR
  • Loading branch information
thaJeztah authored Jul 19, 2023
2 parents 203c683 + a972dbd commit 6b2ee07
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hack/generate-authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOTDIR="$(git -C "$SCRIPTDIR" rev-parse --show-toplevel)"
ROOTDIR="$(cd "${SCRIPTDIR}/.." && pwd)"

set -x

Expand Down
10 changes: 1 addition & 9 deletions hack/make/.binary
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,11 @@ source "${MAKEDIR}/.go-autogen"
fi
fi

# This is a workaround to have buildinfo with deps embedded in the binary. We
# need to create a go.mod file before building with -modfile=vendor.mod,
# otherwise it fails with: "-modfile cannot be used to set the module root directory."
if [ ! -f "go.mod" ]; then
printf '%s\n\n%s' 'module github.com/docker/docker' 'go 1.19' > "go.mod"
trap 'rm -f go.mod' EXIT
fi

echo "Building $([ "$DOCKER_STATIC" = "1" ] && echo "static" || echo "dynamic") $DEST/$BINARY_FULLNAME ($PLATFORM_NAME)..."
if [ -n "$DOCKER_DEBUG" ]; then
set -x
fi
GO111MODULE=on go build -mod=vendor -modfile=vendor.mod -o "$DEST/$BINARY_FULLNAME" "${BUILDFLAGS[@]}" -ldflags "$LDFLAGS $LDFLAGS_STATIC $DOCKER_LDFLAGS" ${GO_PACKAGE}
./hack/with-go-mod.sh go build -mod=vendor -modfile=vendor.mod -o "$DEST/$BINARY_FULLNAME" "${BUILDFLAGS[@]}" -ldflags "$LDFLAGS $LDFLAGS_STATIC $DOCKER_LDFLAGS" "$GO_PACKAGE"
)

echo "Created binary: $DEST/$BINARY_FULLNAME"
2 changes: 1 addition & 1 deletion hack/validate/no-module
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Check that no one is trying to commit a go.mod.

SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOTDIR="$(git -C "$SCRIPTDIR" rev-parse --show-toplevel)"
ROOTDIR="$(cd "${SCRIPTDIR}/../.." && pwd)"

if test -e "${ROOTDIR}/go.mod"; then
{
Expand Down
2 changes: 1 addition & 1 deletion hack/with-go-mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set -e

SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOTDIR="$(git -C "$SCRIPTDIR" rev-parse --show-toplevel)"
ROOTDIR="$(cd "${SCRIPTDIR}/.." && pwd)"

if test -e "${ROOTDIR}/go.mod"; then
{
Expand Down

0 comments on commit 6b2ee07

Please sign in to comment.