go/gcimporter15: remove support for Go1.5
Change-Id: I183090131a675237be42cc005719554399704f8d
Reviewed-on: https://go-review.googlesource.com/32541
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/go/gcimporter15/bimport.go b/go/gcimporter15/bimport.go
index 03037a5..9bd9eb7 100644
--- a/go/gcimporter15/bimport.go
+++ b/go/gcimporter15/bimport.go
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.5
+// +build go1.6
-// This file is a copy of $GOROOT/src/go/internal/gcimporter/bimport.go, tagged for go1.5.
+// This file is a copy of $GOROOT/src/go/internal/gcimporter/bimport.go, tagged for go1.6.
package gcimporter
diff --git a/go/gcimporter15/exportdata.go b/go/gcimporter15/exportdata.go
index 988a45b..b4b89d6 100644
--- a/go/gcimporter15/exportdata.go
+++ b/go/gcimporter15/exportdata.go
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.5
+// +build go1.6
-// This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go, tagged for go1.5.
+// This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go, tagged for go1.6.
// This file implements FindExportData.
diff --git a/go/gcimporter15/gcimporter.go b/go/gcimporter15/gcimporter.go
index 4f445f7..a0f9dfd 100644
--- a/go/gcimporter15/gcimporter.go
+++ b/go/gcimporter15/gcimporter.go
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.5
+// +build go1.6
-// This file is a copy of $GOROOT/src/go/internal/gcimporter/gcimporter.go, tagged for go1.5,
+// This file is a copy of $GOROOT/src/go/internal/gcimporter/gcimporter.go, tagged for go1.6,
// and minimally adjusted to make it build.
// Package gcimporter15 provides various functions for reading
@@ -399,7 +399,7 @@
// package exists already and we have an expected package name;
// make sure names match or set package name if necessary
if pname := pkg.Name(); pname == "" {
- setName(pkg, name)
+ pkg.SetName(name)
} else if pname != name {
p.errorf("%s package name mismatch: %s (given) vs %s (expected)", id, pname, name)
}
diff --git a/go/gcimporter15/gcimporter_test.go b/go/gcimporter15/gcimporter_test.go
index 7241215..4e8f18b 100644
--- a/go/gcimporter15/gcimporter_test.go
+++ b/go/gcimporter15/gcimporter_test.go
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build go1.5
+// +build go1.6
-// This file is a copy of $GOROOT/src/go/internal/gcimporter/gcimporter_test.go, tagged for go1.5,
+// This file is a copy of $GOROOT/src/go/internal/gcimporter/gcimporter_test.go, tagged for go1.6,
// and minimally adjusted to make it build with code from (std lib) internal/testenv copied.
package gcimporter
diff --git a/go/gcimporter15/setname15.go b/go/gcimporter15/setname15.go
deleted file mode 100644
index 8f78f54..0000000
--- a/go/gcimporter15/setname15.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.5,!go1.6
-
-package gcimporter
-
-import (
- "go/types"
- "unsafe"
-)
-
-func setName(pkg *types.Package, name string) {
- (*types_Package)(unsafe.Pointer(pkg)).name = name
-}
-
-// The underlying type of types_Package is identical to
-// the underlying type of types.Package. We use it with
-// package unsafe to set the name field since 1.5 does
-// not have the Package.SetName method.
-// TestSetName verifies that the layout with respect to
-// the name field is correct.
-type types_Package struct {
- path string
- name string
- scope *types.Scope
- complete bool
- imports []*types.Package
- fake bool
-}
diff --git a/go/gcimporter15/setname16.go b/go/gcimporter15/setname16.go
deleted file mode 100644
index d318e7c..0000000
--- a/go/gcimporter15/setname16.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.6
-
-package gcimporter
-
-import "go/types"
-
-func setName(pkg *types.Package, name string) {
- pkg.SetName(name)
-}
diff --git a/go/gcimporter15/setname_test.go b/go/gcimporter15/setname_test.go
deleted file mode 100644
index a8a33f7..0000000
--- a/go/gcimporter15/setname_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.5
-
-package gcimporter
-
-import (
- "go/types"
- "testing"
-)
-
-func TestSetName(t *testing.T) {
- pkg := types.NewPackage("path", "foo")
- scope := pkg.Scope()
-
- // verify setName
- setName(pkg, "bar")
- if name := pkg.Name(); name != "bar" {
- t.Fatalf(`got package name %q; want "bar"`, name)
- }
-
- // verify no other fields are changed
- if pkg.Path() != "path" || pkg.Scope() != scope || pkg.Complete() || pkg.Imports() != nil {
- t.Fatalf("setName changed other fields")
- }
-}