From 0513cb08b66b83f42b171db3006bb417ab6927cd Mon Sep 17 00:00:00 2001 From: David Symonds Date: Mon, 13 Oct 2014 08:44:37 +1100 Subject: [PATCH] go.tools/imports: Permit fix_test.go to work pre-Go 1.4. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/156980043 --- imports/fix_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/imports/fix_test.go b/imports/fix_test.go index 173f9d62..9382a19e 100644 --- a/imports/fix_test.go +++ b/imports/fix_test.go @@ -727,7 +727,13 @@ func TestFindImportGoPath(t *testing.T) { stdlib = nil // Test against imaginary bits/bytes package in std lib - bytesDir := filepath.Join(goroot, "src", "bits", "bytes") + bytesDir := filepath.Join(goroot, "src", "pkg", "bits", "bytes") + for _, tag := range build.Default.ReleaseTags { + // Go 1.4 rearranged the GOROOT tree to remove the "pkg" path component. + if tag == "go1.4" { + bytesDir = filepath.Join(goroot, "src", "bits", "bytes") + } + } if err := os.MkdirAll(bytesDir, 0755); err != nil { t.Fatal(err) }