Reputation: 47729
What the title said. I'm getting an error:
fmt.Println not used
The line mentioned is the last line of my source file. I'm not using the fmt
package in that file, but I did recently.
This happens when I try to build the package or run tests.
EDIT:
If I go clean myproject
the project I still get the same response.
I ran just go clean
and now have:
# myproject
<epoch>: fmt.Println not used
EDIT for the benefit of Cat Plus Plus, here's a source file triggering the error:
types2.go
package mypackage
import (
)
to run:
go build mypackage
# mypackage
./types2.go:4: fmt.Println not used
Yes you read that right.
Upvotes: 2
Views: 520
Reputation: 47729
The answer was that I had the expression fmt.Println
in a file somewhere. The compiler told me that the error was occurring in incorrect file(s). More info in this blog post.
http://blog.afandian.com/2012/07/strange-error-in-go-fmt-println-not-used/
Upvotes: 2
Reputation: 28385
I suspect you're not compiling what you think you're compiling. What does your GOPATH look like? Remember the go command just goes by GOPATH to find packages and doesn't care about your current directory. Also, go build doesn't "run" or even install packages and Go clean isn't like make clean--it really does something else.
Upvotes: 1