ok=false
fi
+TEST go get works with vanity wildcards
+d=$(mktemp -d -t testgoXXX)
+export GOPATH=$d
+if ! ./testgo get -u rsc.io/pdf/...; then
+ ok=false
+elif [ ! -x $d/bin/pdfpasswd ]; then
+ echo did not build rsc.io/pdf/pdfpasswd
+ ok=false
+fi
+unset GOPATH
+rm -rf $d
+
# clean up
if $started; then stop; fi
rm -rf testdata/bin testdata/bin1
func repoRootForImportPath(importPath string) (*repoRoot, error) {
rr, err := repoRootForImportPathStatic(importPath, "")
if err == errUnknownSite {
- rr, err = repoRootForImportDynamic(importPath)
+ // If there are wildcards, look up the thing before the wildcard,
+ // hoping it applies to the wildcarded parts too.
+ // This makes 'go get rsc.io/pdf/...' work in a fresh GOPATH.
+ lookup := strings.TrimSuffix(importPath, "/...")
+ if i := strings.Index(lookup, "/.../"); i >= 0 {
+ lookup = lookup[:i]
+ }
+ rr, err = repoRootForImportDynamic(lookup)
// repoRootForImportDynamic returns error detail
// that is irrelevant if the user didn't intend to use a