diff --git a/cmd/gorename/cgo_test.go b/cmd/gorename/cgo_test.go new file mode 100644 index 0000000000..fd07553fc6 --- /dev/null +++ b/cmd/gorename/cgo_test.go @@ -0,0 +1,11 @@ +// Copyright 2017 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 cgo + +package main_test + +func init() { + haveCGO = true +} diff --git a/cmd/gorename/gorename_test.go b/cmd/gorename/gorename_test.go index e598b342e3..20dbd9e123 100644 --- a/cmd/gorename/gorename_test.go +++ b/cmd/gorename/gorename_test.go @@ -1,3 +1,7 @@ +// Copyright 2017 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_test import ( @@ -12,6 +16,8 @@ import ( "testing" ) +var haveCGO bool + type test struct { offset, from, to string // specify the arguments fileSpecified bool // true if the offset or from args specify a specific file @@ -23,6 +29,10 @@ type test struct { // Test that renaming that would modify cgo files will produce an error and not modify the file. func TestGeneratedFiles(t *testing.T) { + if !haveCGO { + t.Skipf("skipping test: no cgo") + } + tmp, bin, cleanup := buildGorename(t) defer cleanup()