1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:16:11 -07:00
go/cmd/stringer/testdata/cgo.go
Nathan John Youngman 806f1dbf43 tools/cmd/stringer: fake import C.
Avoid error "could not import C (can't find import: C)"
Fixes golang/go#9169.

LGTM=adonovan, r
R=golang-codereviews, adonovan, r
CC=golang-codereviews
https://golang.org/cl/184730043
2014-11-27 15:36:14 +11:00

33 lines
555 B
Go

// Copyright 2014 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.
// Import "C" shouldn't be imported.
package main
/*
#define HELLO 1
*/
import "C"
import "fmt"
type Cgo uint32
const (
// MustScanSubDirs indicates that events were coalesced hierarchically.
MustScanSubDirs Cgo = 1 << iota
)
func main() {
_ = C.HELLO
ck(MustScanSubDirs, "MustScanSubDirs")
}
func ck(day Cgo, str string) {
if fmt.Sprint(day) != str {
panic("cgo.go: " + str)
}
}