We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
reproduce on darwin with go1.11 darwin/amd64, go1.11 linux/amd64 and go1.11.1 darwin/amd64
go1.11 darwin/amd64
go1.11 linux/amd64
go1.11.1 darwin/amd64
The bug does NOT reproduce with go1.9.7 darwin/amd64 nor go1.10.4 darwin/amd64
go1.9.7 darwin/amd64
go1.10.4 darwin/amd64
Yes
go env
GOARCH="amd64" GOBIN="" GOCACHE="/Users/greenhorse/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/greenhorse/Project/go" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.11.1/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l6/9928hprx3yxcpv22q12s28bw0000gn/T/go-build692282058=/tmp/go-build -gno-record-gcc-switches -fno-common"
package main func main() { var len int len("azerty") }
I shadow len and then try to use it as a function.
The error doesn't happened on the playground. https://play.golang.org/p/ixHH7fbdpHO
main.go:5:5: cannot call non-function len (type int)
# github.com/somehere/mypackage panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x177c96e] goroutine 1 [running]: cmd/compile/internal/gc.typecheck1(0xc000340180, 0x1, 0xc000340080) /usr/local/Cellar/go/1.11.1/libexec/src/cmd/compile/internal/gc/typecheck.go:1270 +0x3ece cmd/compile/internal/gc.typecheck(0xc000340180, 0x1, 0xc000340080) /usr/local/Cellar/go/1.11.1/libexec/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad cmd/compile/internal/gc.typecheckslice(0xc000334220, 0x3, 0x4, 0x1) /usr/local/Cellar/go/1.11.1/libexec/src/cmd/compile/internal/gc/typecheck.go:68 +0x50 cmd/compile/internal/gc.Main(0x18c1300) /usr/local/Cellar/go/1.11.1/libexec/src/cmd/compile/internal/gc/main.go:518 +0x2059 main.main() /usr/local/Cellar/go/1.11.1/libexec/src/cmd/compile/main.go:51 +0x96
The text was updated successfully, but these errors were encountered:
Dup of #27356. Fixed in tip. Will be backported.
Thanks for reporting.
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?reproduce on darwin with
go1.11 darwin/amd64
,go1.11 linux/amd64
andgo1.11.1 darwin/amd64
The bug does NOT reproduce with
go1.9.7 darwin/amd64
norgo1.10.4 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
I shadow len and then try to use it as a function.
The error doesn't happened on the playground.
https://play.golang.org/p/ixHH7fbdpHO
What did you expect to see?
main.go:5:5: cannot call non-function len (type int)
What did you see instead?
The text was updated successfully, but these errors were encountered: