File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,15 +8,15 @@ if ! command -v "$GO_MD2MAN" > /dev/null; then
88 (
99 set -x
1010 # note: this installs all tools defined in go.mod/vendor.mod
11- GOBIN=" $( pwd) /build/tools" go install -mod=vendor -modfile=vendor.mod tool
11+ GOBIN=" $( pwd) /build/tools" go install -mod=vendor tool
1212 )
1313 GO_MD2MAN=" $( pwd) /build/tools/go-md2man"
1414fi
1515
1616mkdir -p man/man1
1717(
1818 set -x
19- go run -mod=vendor -modfile=vendor.mod - tags manpages ./man/generate.go --source " ./man/src" --target " ./man/man1"
19+ go run -mod=vendor -tags manpages ./man/generate.go --source " ./man/src" --target " ./man/man1"
2020)
2121
2222(
Original file line number Diff line number Diff line change 44
55(
66 set -x
7- go run -mod=vendor -modfile=vendor.mod - tags docsgen ./docs/generate/generate.go --formats md --source " ./docs/reference/commandline" --target " ./docs/reference/commandline"
7+ go run -mod=vendor -tags docsgen ./docs/generate/generate.go --formats md --source " ./docs/reference/commandline" --target " ./docs/reference/commandline"
88)
99
1010# remove generated help.md file
Original file line number Diff line number Diff line change 44
55mkdir -p docs/yaml
66set -x
7- go run -mod=vendor -modfile=vendor.mod - tags docsgen ./docs/generate/generate.go --formats yaml --source " ./docs/reference/commandline" --target " ./docs/yaml"
7+ go run -mod=vendor -tags docsgen ./docs/generate/generate.go --formats yaml --source " ./docs/reference/commandline" --target " ./docs/yaml"
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ if [ -z "$TYP" ]; then
1414fi
1515
1616update () {
17- (set -x ; go mod tidy -modfile=vendor.mod ; go mod vendor -modfile=vendor.mod )
17+ (set -x ; go mod tidy; go mod vendor)
1818}
1919
2020validate () {
@@ -31,7 +31,7 @@ outdated() {
3131 echo " go-mod-outdated not found. Install with 'go install github.com/psampaz/go-mod-outdated@v0.8.0'"
3232 exit 1
3333 fi
34- (set -x ; go list -mod=vendor -mod= readonly -modfile=vendor.mod -u -m -json all | go-mod-outdated -update -direct)
34+ (set -x ; go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct)
3535}
3636
3737case $TYP in
Original file line number Diff line number Diff line change 66# when the command is finished. This script should be dropped when this
77# repository is a proper Go module with a permanent go.mod.
88
9- set -e
9+ set -euo pipefail
1010
1111SCRIPTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
1212ROOTDIR=" $( cd " ${SCRIPTDIR} /.." && pwd) "
1313
14- if test -e " ${ROOTDIR} /go.mod" ; then
15- {
16- scriptname=$( basename " $0 " )
17- cat >&2 << - EOF
18- $scriptname : WARN: go.mod exists in the repository root!
19- $scriptname : WARN: Using your go.mod instead of our generated version -- this may misbehave!
20- EOF
21- } >&2
22- else
14+ cleanup_paths=()
15+
16+ create_symlink () {
17+ local target=" $1 "
18+ local link=" $2 "
19+
20+ if [ -e " $link " ]; then
21+ # see https://superuser.com/a/196698
22+ if ! [ " $link " -ef " ${ROOTDIR} /${target} " ]; then
23+ echo " $( basename " $0 " ) : WARN: $link exists but is not the expected symlink!" >&2
24+ echo " $( basename " $0 " ) : WARN: Using your version instead of our generated version -- this may misbehave!" >&2
25+ fi
26+ return
27+ fi
28+
2329 set -x
30+ ln -s " $target " " $link "
31+ cleanup_paths+=( " $link " )
32+ }
2433
25- tee " ${ROOTDIR} /go.mod" >&2 << - EOF
26- module github.com/docker/cli
34+ create_symlink " vendor.mod " " ${ROOTDIR} /go.mod"
35+ create_symlink " vendor.sum " " ${ROOTDIR} /go.sum "
2736
28- go 1.25.0
29- EOF
30- trap ' rm -f "${ROOTDIR}/go.mod"' EXIT
37+ if [ " ${# cleanup_paths[@]} " -gt 0 ]; then
38+ trap ' rm -f "${cleanup_paths[@]}"' EXIT
3139fi
3240
3341GO111MODULE=on GOTOOLCHAIN=local " $@ "
You can’t perform that action at this time.
0 commit comments