diff --git a/.github/workflows/.windows.yml b/.github/workflows/.windows.yml index d33152ce11..dddd588ade 100644 --- a/.github/workflows/.windows.yml +++ b/.github/workflows/.windows.yml @@ -439,7 +439,6 @@ jobs: .\hack\make.ps1 -TestIntegration env: DOCKER_HOST: npipe:////./pipe/docker_engine - GO111MODULE: "off" TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker - name: Test integration-cli @@ -448,7 +447,6 @@ jobs: .\hack\make.ps1 -TestIntegrationCli env: DOCKER_HOST: npipe:////./pipe/docker_engine - GO111MODULE: "off" TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker INTEGRATION_TESTRUN: ${{ matrix.test }} - diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3b7b43259b..b38982b2c2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,15 +46,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 2 - # CodeQL 2.16.4's auto-build added support for multi-module repositories, - # and is trying to be smart by searching for modules in every directory, - # including vendor directories. If no module is found, it's creating one - # which is ... not what we want, so let's give it a "go.mod". - # see: https://github.com/docker/cli/pull/4944#issuecomment-2002034698 - - name: Create go.mod - run: | - ln -s vendor.mod go.mod - ln -s vendor.sum go.sum - name: Update Go uses: actions/setup-go@v5 with: diff --git a/Dockerfile b/Dockerfile index 112127c30b..53d8cde86a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,7 +64,6 @@ COPY --from=xx / / RUN go telemetry off && [ "$(go telemetry)" = "off" ] || { echo "Failed to disable Go telemetry"; exit 1; } RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache RUN apt-get update && apt-get install --no-install-recommends -y file -ENV GO111MODULE=off ENV GOTOOLCHAIN=local FROM base AS criu @@ -95,6 +94,7 @@ RUN git fetch -q --depth 1 origin "${GO_SWAGGER_COMMIT}" && git checkout -q FETC FROM base AS swagger WORKDIR /go/src/github.com/go-swagger/go-swagger ARG TARGETPLATFORM +ENV GO111MODULE=off RUN --mount=from=swagger-src,src=/usr/src/swagger,rw \ --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \ --mount=type=cache,target=/go/pkg/mod \ @@ -145,7 +145,7 @@ RUN --mount=from=delve-src,src=/usr/src/delve,rw \ --mount=type=cache,target=/root/.cache/go-build,id=delve-build-$TARGETPLATFORM \ --mount=type=cache,target=/go/pkg/mod <&2 - exit 1 -else - echo 'PASS: No go.mod found in repository root!' -fi diff --git a/hack/vendor.sh b/hack/vendor.sh index 7272eee136..c6123eab5f 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -10,24 +10,24 @@ SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" tidy() ( set -x - "${SCRIPTDIR}"/with-go-mod.sh go mod tidy -modfile vendor.mod + go mod tidy ) vendor() ( set -x - "${SCRIPTDIR}"/with-go-mod.sh go mod vendor -modfile vendor.mod + go mod vendor ) replace() ( set -x - "${SCRIPTDIR}"/with-go-mod.sh go mod edit -modfile vendor.mod -replace=github.com/moby/moby/api=./api -replace=github.com/moby/moby/client=./client - "${SCRIPTDIR}"/with-go-mod.sh go mod edit -modfile client/go.mod -replace=github.com/moby/moby/api=../api + go mod edit -replace=github.com/moby/moby/api=./api -replace=github.com/moby/moby/client=./client + go mod edit -modfile client/go.mod -replace=github.com/moby/moby/api=../api ) dropreplace() ( set -x - "${SCRIPTDIR}"/with-go-mod.sh go mod edit -modfile vendor.mod -dropreplace=github.com/moby/moby/api -dropreplace=github.com/moby/moby/client - "${SCRIPTDIR}"/with-go-mod.sh go mod edit -modfile client/go.mod -dropreplace=github.com/moby/moby/api + go mod edit -dropreplace=github.com/moby/moby/api -dropreplace=github.com/moby/moby/client + go mod edit -modfile client/go.mod -dropreplace=github.com/moby/moby/api ) help() { diff --git a/hack/with-go-mod.sh b/hack/with-go-mod.sh deleted file mode 100755 index 845855ee9c..0000000000 --- a/hack/with-go-mod.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# -# This script is used to coerce certain commands which rely on the presence of -# a go.mod into working with our repository. It works by creating a fake -# go.mod, running a specified command (passed via arguments), and removing it -# when the command is finished. This script should be dropped when this -# repository is a proper Go module with a permanent go.mod. - -set -e - -SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -ROOTDIR="$(cd "${SCRIPTDIR}/.." && pwd)" - -if test -e "${ROOTDIR}/go.mod"; then - { - scriptname=$(basename "$0") - cat >&2 <<- EOF - $scriptname: WARN: go.mod exists in the repository root! - $scriptname: WARN: Using your go.mod instead of our generated version -- this may misbehave! - EOF - } >&2 -else - set -x - - tee "${ROOTDIR}/go.mod" >&2 <<- EOF - module github.com/docker/docker - - go 1.23.0 - EOF - trap 'rm -f "${ROOTDIR}/go.mod"' EXIT -fi - -GO111MODULE=on GOTOOLCHAIN=local "$@"