...

Source file src/cmd/cgo/internal/testnocgo/nocgo.go

Documentation: cmd/cgo/internal/testnocgo

     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  
     5  // Test that -static works when not using cgo.  This test is in
     6  // misc/cgo to take advantage of the testing framework support for
     7  // when -static is expected to work.
     8  
     9  package nocgo
    10  
    11  func NoCgo() int {
    12  	c := make(chan int)
    13  
    14  	// The test is run with external linking, which means that
    15  	// goroutines will be created via the runtime/cgo package.
    16  	// Make sure that works.
    17  	go func() {
    18  		c <- 42
    19  	}()
    20  
    21  	return <-c
    22  }
    23  

View as plain text