Skip to content

Commit

Permalink
fix: ensure gengodep uses vendor dir if present
Browse files Browse the repository at this point in the history
In a previous PR, initialization of the `srcdir` varible was removed
from `makeit/gengodep`. However, the `gengodep` script was still using
`srcdir` when checking for a `${srcdir}/vendor/modules.txt`.

sylabs@48e7fab

As a result, the vendor dir is never found, and `go` was run with
`-mod=readonly`, which would lead to downloads.

Since go 1.14 the presence of a vendor dir infers `-mod=vendor`
automatically, so we can just remove the handling here.

Fixes sylabs#461
  • Loading branch information
dtrudg committed Dec 7, 2021
1 parent 3bc89d9 commit 52693f2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions makeit/gengodep
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ shift 4
# get propagated down to go list.
export GOPROXY

if test -e "${srcdir}/vendor/modules.txt" ; then
mod_mode=vendor
else
mod_mode=readonly
fi

template='{{ with $d := . }}{{ if not $d.Standard }}{{ range $d.GoFiles }}{{ printf "%s/%s\n" $d.Dir . }}{{ end }}{{ range $d.CgoFiles }}{{ printf "%s/%s\n" $d.Dir . }}{{ end }}{{ end }}{{ end }}'

godeps=`${go} list -mod=${mod_mode} -deps -f "${template}" -tags "${gotags}" "$@" | sort -u`
godeps=`${go} list -deps -f "${template}" -tags "${gotags}" "$@" | sort -u`

for m in ${godeps}; do
echo "$var += $m" >> ${depfile}
Expand Down

0 comments on commit 52693f2

Please sign in to comment.