// searches for a branch or tag named "go1". If no such version exists it
// retrieves the most recent version of the package.
//
-// Unless vendoring support is disabled (see 'go help gopath'),
-// when go get checks out or updates a Git repository,
+// When go get checks out or updates a Git repository,
// it also updates any git submodules referenced by the repository.
//
// Get never checks out or updates code stored in vendor directories.
// let package authors make sure the custom import path is used and not a
// direct path to the underlying code hosting site.
//
-// If vendoring is enabled (see 'go help gopath'), then import path checking is
-// disabled for code found within vendor trees. This makes it possible to copy
-// code into alternate locations in vendor trees without needing to update import
-// comments.
+// Import path checking is disabled for code found within vendor trees.
+// This makes it possible to copy code into alternate locations in vendor trees
+// without needing to update import comments.
//
// See https://golang.org/s/go14customimport for details.
//
searches for a branch or tag named "go1". If no such version exists it
retrieves the most recent version of the package.
-Unless vendoring support is disabled (see 'go help gopath'),
-when go get checks out or updates a Git repository,
+When go get checks out or updates a Git repository,
it also updates any git submodules referenced by the repository.
Get never checks out or updates code stored in vendor directories.
return filepath.Join(tg.tempdir, name)
}
+// mustExist fails if path does not exist.
+func (tg *testgoData) mustExist(path string) {
+ if _, err := os.Stat(path); err != nil {
+ if os.IsNotExist(err) {
+ tg.t.Fatalf("%s does not exist but should", path)
+ }
+ tg.t.Fatalf("%s stat failed: %v", path, err)
+ }
+}
+
// mustNotExist fails if path exists.
func (tg *testgoData) mustNotExist(path string) {
if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) {
let package authors make sure the custom import path is used and not a
direct path to the underlying code hosting site.
-If vendoring is enabled (see 'go help gopath'), then import path checking is
-disabled for code found within vendor trees. This makes it possible to copy
-code into alternate locations in vendor trees without needing to update import
-comments.
+Import path checking is disabled for code found within vendor trees.
+This makes it possible to copy code into alternate locations in vendor trees
+without needing to update import comments.
See https://golang.org/s/go14customimport for details.
`,
// The parent of dir must exist; dir must not.
func (v *vcsCmd) create(dir, repo string) error {
for _, cmd := range v.createCmd {
- if strings.Contains(cmd, "submodule") {
- continue
- }
if err := v.run(".", cmd, "dir", dir, "repo", repo); err != nil {
return err
}
// download downloads any new changes for the repo in dir.
func (v *vcsCmd) download(dir string) error {
for _, cmd := range v.downloadCmd {
- if strings.Contains(cmd, "submodule") {
- continue
- }
if err := v.run(dir, cmd); err != nil {
return err
}
if tag == "" && v.tagSyncDefault != nil {
for _, cmd := range v.tagSyncDefault {
- if strings.Contains(cmd, "submodule") {
- continue
- }
if err := v.run(dir, cmd); err != nil {
return err
}
}
for _, cmd := range v.tagSyncCmd {
- if strings.Contains(cmd, "submodule") {
- continue
- }
if err := v.run(dir, cmd, "tag", tag); err != nil {
return err
}
tg.setenv("GOPATH", tg.path("."))
tg.run("get", "-d", "github.com/rsc/go-get-issue-12612")
tg.run("get", "-u", "-d", "github.com/rsc/go-get-issue-12612")
+ tg.mustExist(tg.path("src/github.com/rsc/go-get-issue-12612/vendor/golang.org/x/crypto/.git"))
}
func TestVendorCache(t *testing.T) {