File tree Expand file tree Collapse file tree 5 files changed +31
-21
lines changed
Expand file tree Collapse file tree 5 files changed +31
-21
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ set -eu
77if ! command -v " $GO_MD2MAN " > /dev/null; then
88 (
99 set -x
10- go build -mod=vendor -modfile=vendor.mod - o ./build/tools/go-md2man ./vendor/github.com/cpuguy83/go-md2man/v2
10+ go build -mod=vendor -o ./build/tools/go-md2man ./vendor/github.com/cpuguy83/go-md2man/v2
1111 )
1212 GO_MD2MAN=$( realpath ./build/tools/go-md2man)
1313fi
1414
1515mkdir -p man/man1
1616(
1717 set -x
18- go run -mod=vendor -modfile=vendor.mod - tags manpages ./man/generate.go --source " ./man/src" --target " ./man/man1"
18+ go run -mod=vendor -tags manpages ./man/generate.go --source " ./man/src" --target " ./man/man1"
1919)
2020
2121(
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/[email protected] '" 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 [ -L " $link " ] && [ " $( readlink " $link " ) " = " $target " ]; then
21+ # symlink already present; we're done
22+ return
23+ fi
24+
25+ if [ -e " $link " ]; then
26+ echo " $( basename " $0 " ) : WARN: $link exists but is not the expected symlink!" >&2
27+ echo " $( basename " $0 " ) : WARN: Using your version instead of our generated version -- this may misbehave!" >&2
28+ return
29+ fi
30+
2331 set -x
32+ ln -s " $target " " $link "
33+ cleanup_paths+=( " $link " )
34+ }
2435
25- tee " ${ROOTDIR} /go.mod" >&2 << - EOF
26- module github.com/docker/cli
36+ create_symlink " vendor.mod " " ${ROOTDIR} /go.mod"
37+ create_symlink " vendor.sum " " ${ROOTDIR} /go.sum "
2738
28- go 1.23.0
29- EOF
30- trap ' rm -f "${ROOTDIR}/go.mod"' EXIT
39+ if [ " ${# cleanup_paths[@]} " -gt 0 ]; then
40+ trap ' rm -f "${cleanup_paths[@]}"' EXIT
3141fi
3242
3343GO111MODULE=on GOTOOLCHAIN=local " $@ "
You can’t perform that action at this time.
0 commit comments