-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[TEST] Switch to go modules #3308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,3 @@ | |
| .gitignore | ||
| appveyor.yml | ||
| build | ||
| /vndr.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ jobs: | |
| target: | ||
| - lint | ||
| - shellcheck | ||
| - validate-vendor | ||
| steps: | ||
| - | ||
| name: Checkout | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,3 @@ cli/winresources/rsrc_*.syso | |
| /docs/yaml/gen/ | ||
| coverage.txt | ||
| profile.out | ||
| /vndr.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # syntax=docker/dockerfile:1.3 | ||
|
|
||
| FROM koalaman/shellcheck-alpine:v0.7.1 AS shellcheck | ||
| WORKDIR /go/src/github.com/docker/cli | ||
| WORKDIR /src | ||
| RUN --mount=type=bind,target=. \ | ||
| set -eo pipefail; \ | ||
| find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # syntax=docker/dockerfile:1.3-labs | ||
|
|
||
| ARG GO_VERSION=1.16.8 | ||
|
|
||
| FROM golang:${GO_VERSION}-alpine AS base | ||
| RUN apk add --no-cache git rsync | ||
| WORKDIR /src | ||
|
|
||
| FROM base AS vendored | ||
| RUN --mount=target=/context \ | ||
| --mount=target=.,type=tmpfs \ | ||
| --mount=target=/go/pkg/mod,type=cache <<EOT | ||
| set -e | ||
| rsync -a /context/. . | ||
| go mod tidy | ||
| go mod vendor | ||
| mkdir /out | ||
| cp -r go.mod go.sum vendor /out | ||
| EOT | ||
|
|
||
| FROM scratch AS update | ||
| COPY --from=vendored /out /out | ||
|
|
||
| FROM vendored AS validate | ||
| RUN --mount=target=/context \ | ||
| --mount=target=.,type=tmpfs <<EOT | ||
| set -e | ||
| rsync -a /context/. . | ||
| git add -A | ||
| rm -rf vendor | ||
| cp -rf /out/* . | ||
| diff=$(git status --porcelain -- go.mod go.sum vendor) | ||
| if [ -n "$diff" ]; then | ||
| echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make -f docker.Makefile vendor"' | ||
| echo $diff | ||
| exit 1 | ||
| fi | ||
| EOT | ||
|
|
||
| FROM psampaz/go-mod-outdated:v0.8.0 AS go-mod-outdated | ||
| FROM base AS outdated | ||
| ARG TIMESTAMP | ||
| RUN --mount=target=.,ro \ | ||
| --mount=target=/go/pkg/mod,type=cache \ | ||
| --mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \ | ||
| go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| module github.com/docker/cli | ||
|
|
||
| go 1.16 | ||
|
|
||
| require ( | ||
| github.com/Microsoft/go-winio v0.4.19 // indirect | ||
| github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect | ||
| github.com/containerd/console v1.0.2 | ||
| github.com/containerd/containerd v1.5.5 | ||
| github.com/coreos/etcd v3.3.25+incompatible // indirect | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.1 | ||
| github.com/creack/pty v1.1.11 | ||
| github.com/docker/compose-on-kubernetes v0.5.0-test1 | ||
| github.com/docker/distribution v2.7.1+incompatible | ||
| github.com/docker/docker v20.10.7+incompatible | ||
| github.com/docker/docker-credential-helpers v0.6.4 | ||
| github.com/docker/go-connections v0.4.0 | ||
| github.com/docker/go-units v0.4.0 | ||
| github.com/docker/swarmkit v1.12.1-0.20210726173615-3629f50980f6 | ||
| github.com/fvbommel/sortorder v1.0.2 | ||
| github.com/gogo/protobuf v1.3.2 | ||
| github.com/golang/protobuf v1.5.2 // indirect | ||
| github.com/google/go-cmp v0.5.5 | ||
| github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 | ||
| github.com/imdario/mergo v0.3.11 | ||
| github.com/mitchellh/mapstructure v1.3.2 | ||
| github.com/moby/buildkit v0.8.2-0.20210615162540-9f254e18360a | ||
| github.com/moby/sys/signal v0.5.0 | ||
| github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 | ||
| github.com/morikuni/aec v1.0.0 | ||
| github.com/opencontainers/go-digest v1.0.0 | ||
| github.com/opencontainers/image-spec v1.0.1 | ||
| github.com/pkg/errors v0.9.1 | ||
| github.com/sirupsen/logrus v1.8.1 | ||
| github.com/spf13/cobra v1.1.3 | ||
| github.com/spf13/pflag v1.0.5 | ||
| github.com/theupdateframework/notary v0.6.1 | ||
| github.com/tonistiigi/fsutil v0.0.0-20210609172227-d72af97c0eaf | ||
| github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d | ||
| github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect | ||
| github.com/xeipuuv/gojsonschema v1.2.0 | ||
| golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect | ||
| golang.org/x/sync v0.0.0-20210220032951-036812b2e83c | ||
| golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf | ||
| golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 | ||
| golang.org/x/text v0.3.4 | ||
| google.golang.org/appengine v1.6.5 // indirect | ||
| google.golang.org/grpc v1.38.0 // indirect | ||
| gopkg.in/yaml.v2 v2.4.0 | ||
| gotest.tools/v3 v3.0.3 | ||
| k8s.io/api v0.20.6 | ||
| k8s.io/apimachinery v0.20.6 | ||
| k8s.io/client-go v0.20.6 | ||
| k8s.io/klog v1.0.1-0.20200310124935-4ad0115ba9e4 // indirect | ||
| ) | ||
|
|
||
| replace ( | ||
| cloud.google.com/go => cloud.google.com/go v0.44.3 | ||
| github.com/docker/distribution => github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible | ||
| github.com/docker/docker => github.com/docker/docker v20.10.3-0.20210811141259-343665850e3a+incompatible // master ; v21.xx-dev | ||
| github.com/docker/go => github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. | ||
| github.com/evanphx/json-patch => gopkg.in/evanphx/json-patch.v4 v4.1.0 | ||
| github.com/gogo/googleapis => github.com/gogo/googleapis v1.3.2 | ||
| github.com/google/go-cmp => github.com/google/go-cmp v0.2.0 | ||
| github.com/google/gofuzz => github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf | ||
| github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.2.0 | ||
| github.com/imdario/mergo => github.com/imdario/mergo v0.3.8 | ||
| github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 | ||
| github.com/json-iterator/go => github.com/json-iterator/go v1.1.10 | ||
| github.com/moby/buildkit => github.com/moby/buildkit v0.8.2-0.20210615162540-9f254e18360a // master ; v0.9.0-dev | ||
| github.com/moby/sys/mount => github.com/moby/sys/mount v0.2.0 | ||
| github.com/moby/sys/mountinfo => github.com/moby/sys/mountinfo v0.4.1 | ||
| github.com/moby/sys/signal => github.com/moby/sys/signal v0.5.0 | ||
| github.com/moby/sys/symlink => github.com/moby/sys/symlink v0.1.0 | ||
| github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.6.0 | ||
| github.com/prometheus/client_model => github.com/prometheus/client_model v0.2.0 | ||
| github.com/prometheus/common => github.com/prometheus/common v0.9.1 | ||
| github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.11 | ||
| github.com/theupdateframework/notary => github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a | ||
| golang.org/x/term => golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 | ||
| golang.org/x/text => golang.org/x/text v0.3.3 | ||
| gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.2.8 | ||
| gotest.tools/v3 => gotest.tools/v3 v3.0.2 | ||
| k8s.io/api => k8s.io/api v0.16.9 | ||
| k8s.io/apimachinery => k8s.io/apimachinery v0.16.9 | ||
| k8s.io/client-go => k8s.io/client-go v0.16.9 | ||
| k8s.io/klog => k8s.io/klog v1.0.1-0.20200310124935-4ad0115ba9e4 // v1.0.0-2-g4ad0115 pending v1.0.1 release to fix https://github.com/docker/cli/issues/2420 | ||
| k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20190918143330-0270cf2f1c1d | ||
| k8s.io/utils => k8s.io/utils v0.0.0-20190923111123-69764acb6e8e | ||
| sigs.k8s.io/yaml => sigs.k8s.io/yaml v1.1.0 | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the tricky bit.
Using go modules for this repository itself is generally not problematic, but but for anyone using the cli as a dependency, things are more complicated.
The module is named
github.com/docker/cli, but Go will refuse to use it under that name if there's ago.mod, because the current version is v20.10.x, so it will require the packages to be renamed togithub.com/docker/cli/v20.That "works" if we release once a year, but if we would do multiple releases, it will be complicated. Tags on this repository are for the binary releases, which use CalVer, not SemVer, but "sometimes" the format is "compatible" (any release done in October, November or December, because then the second digit will start with a
1. However, that would putv21.10.0andv21.11.0both to begithub.com/docker/cli/v21, and with ago.mod, you add the promise that it's SemVer, so no breaking changes allowed in between.Releases before October each year would also not be picked up by go modules (the v22.01.0 version string is not in the correct format for SemVer, so will be ignored).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed, if we follow our versioning practice (CalVer), it's unfortunately not affordable.