You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
/*
struct A {
int flag;
};
*/
import "C"
//go:generate stringer -type Flag
type Flag int
const (
FlagSet Flag = 1
)
func main() {
var flag = FlagSet
A := C.struct_A{
flag: C.int(flag),
}
_ = A
}
What did you expect to see?
I expect go generate to run without error.
What did you see instead?
stringer: checking package: stringercgo.go:18:6: flag declared but not used
stringercgo.go:10: running "stringer": exit status 1
System details
go version go1.8.1 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/joe/gop"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build547335153=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version go1.8.1 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.8.1 X:framepointer
uname -sr: Linux 4.8.0-49-generic
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu7) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
The text was updated successfully, but these errors were encountered:
bradfitz
changed the title
cmd/go/stringer: "declared but not used" even though variable is used
x/tools/cmd/stringer: "declared but not used" even though variable is used
May 13, 2017
What did you do?
Run
go generate
on the following program:What did you expect to see?
I expect
go generate
to run without error.What did you see instead?
System details
The text was updated successfully, but these errors were encountered: