Closed
Description
What version of Go are you using (go version
)?
go version go1.9rc1 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bradleyf/go"
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-build365274238=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
package main
import "fmt"
func main() {
n, err := fmt.Print(1)
}
Run this program with go build
What did you expect to see?
./main.go:6:2: n declared and not used
./main.go:6:5: err declared and not used
Note the column numbers.
What did you see instead?
./main.go:6:22: n declared and not used
./main.go:6:22: err declared and not used
Column 22 for the above program is the argument to the fmt.Print
function. There's nothing wrong with the argument, the problem is with the returned arguments.
It appears this may be a known issue, mentioned in 2a5cf48 but it's not clear whether this is the same issue.
At the very least, when the editor is highlighting the argument but the error is elsewhere on the same line, it's confusing.