github.com/cockroachdb/tools@v0.0.0-20230222021103-a6d27438930d/cmd/stringer/testdata/cgo.go (about)

     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  // Import "C" shouldn't be imported.
     6  
     7  package main
     8  
     9  /*
    10  #define HELLO 1
    11  */
    12  import "C"
    13  
    14  import "fmt"
    15  
    16  type Cgo uint32
    17  
    18  const (
    19  	// MustScanSubDirs indicates that events were coalesced hierarchically.
    20  	MustScanSubDirs Cgo = 1 << iota
    21  )
    22  
    23  func main() {
    24  	_ = C.HELLO
    25  	ck(MustScanSubDirs, "MustScanSubDirs")
    26  }
    27  
    28  func ck(day Cgo, str string) {
    29  	if fmt.Sprint(day) != str {
    30  		panic("cgo.go: " + str)
    31  	}
    32  }