alvaroloes / enumer

A Go tool to auto generate methods for your enums
Other
480 stars 111 forks source link

Failure w/ go 1.12.1 #42

Closed sgtsquiggs closed 5 years ago

sgtsquiggs commented 5 years ago

Not using modules!

enumer: checking package: loglevel_enumer.go:6:2: could not import fmt (type-checking package "fmt" failed (/golangdev/go/src/fmt/print.go:9:2: could not import internal/fmtsort (type-checking package "internal/fmtsort" failed (/golangdev/go/src/internal/fmtsort/sort.go:12:2: could not import reflect (type-checking package "reflect" failed (/golangdev/go/src/reflect/type.go:19:2: could not import runtime (type-checking package "runtime" failed /golangdev/go/src/runtime/mem_linux.go:21:6: sysAlloc redeclared in this block))))))))
.gopath~/src/github.com/influxdata/telegraf/plugins/parsers/sefofmt/loglevel.go:1: running "enumer": exit status 1

I see the same error when using stringer, so perhaps this error is upstream.

sgtsquiggs commented 5 years ago

was unrelated to enumer/stringer.

scraymondjr commented 5 years ago

What was the solution to this issue? Am seeing this now.

dmarkham commented 5 years ago

It might have been related to the gopath's and go mods. see #36 ? That has not been merged in yet here. Feel free to try my fork that is a little more actively maintained.

36 was merged in here.

https://github.com/dmarkham/enumer

scraymondjr commented 5 years ago

Thanks, @dmarkham. I actually got my use case to work by moving my type to its own file and having enumer only process that specific file //go:generate enumer -type=Pill -json . $GOFILE.