Any idea how can I fix the error below? I have a go generator (stringer) which I try to run but it keeps reporting that it can't find a package import although the package is definitely imported.
stringer: checking package: main.go:13:3: could not import example.io/api/util (can't find import: example.io/api/util)
main.go:33: running "stringer": exit status 1
From this thread :
Seems to be a silly thing: 4 part import are usually subpackages and these must be " installed " before you can use them. I ran the following on the command line to resolve my problem:
So try first:
go install <yourpackage>
Ad see if go generate works after that.
Make sure to use the latest go 1.4.2 and to update your stringer as well:
go get -u golang.org/x/tools/cmd/stringer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.