+++ /dev/null
-// true
-
-// Copyright 2012 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.
-
-package main
-
-// can't use local path with -u, use -I. instead
-import "pkg" // ERROR "import unsafe package"
-
-func main() {
- print(pkg.Float32bits(1.0))
-}
+++ /dev/null
-// $G $D/pkg.go && pack grc pkg.a pkg.$A 2> /dev/null && rm pkg.$A && errchk $G -I . -u $D/main.go
-// rm -f pkg.a
-
-// Copyright 2012 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.
-
-package ignored
+++ /dev/null
-// true
-
-// Copyright 2012 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.
-
-// a package that uses unsafe on the inside but not in it's api
-
-package pkg
-
-import "unsafe"
-
-// this should be inlinable
-func Float32bits(f float32) uint32 {
- return *(*uint32)(unsafe.Pointer(&f))
-}
\ No newline at end of file
+++ /dev/null
-// $G $D/pkg.go && pack grcS pkg.a pkg.$A 2> /dev/null && rm pkg.$A && $G -I . -u $D/main.go
-// rm -f pkg.a
-
-// Copyright 2012 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.
-
-package ignored
--- /dev/null
+// errorcheck -u -+
+
+// Copyright 2018 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.
+
+// Check that we cannot import a package that uses "unsafe" internally
+// when -u is supplied.
+
+package main
+
+import "syscall" // ERROR "import unsafe package"
+
+func main() {
+ print(syscall.Environ())
+}
--- /dev/null
+// errorcheck -u -+
+
+// Copyright 2018 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.
+
+// Check that we cannot import the "unsafe" package when -u is supplied.
+
+package a
+
+import "unsafe" // ERROR "import package unsafe"
+
+func Float32bits(f float32) uint32 {
+ return *(*uint32)(unsafe.Pointer(&f))
+}