nocgo.go 574 B

12345678910111213141516171819202122
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Test that -static works when not using cgo. This test is in
  5. // misc/cgo to take advantage of the testing framework support for
  6. // when -static is expected to work.
  7. package nocgo
  8. func NoCgo() int {
  9. c := make(chan int)
  10. // The test is run with external linking, which means that
  11. // goroutines will be created via the runtime/cgo package.
  12. // Make sure that works.
  13. go func() {
  14. c <- 42
  15. }()
  16. return <-c
  17. }