Closed
Description
Go version
go version go1.22.3 darwin/arm64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/arif.zaman/Library/Caches/go-build'
GOENV='/Users/arif.zaman/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/arif.zaman/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/arif.zaman/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/ls/dl28z1951xz3ykqz1yl2_dkm0000gp/T/go-build184522062=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
Here is the complete program (5 lines):
package main
func main() {
var x float64
for x = range(100) {}
_ = x
}
What did you see happen?
This was the ouput
# command-line-arguments
<unknown line number>: internal compiler error: unexpected type: <nil> (<nil>)
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
What did you expect to see?
An error explaining that you can not use a float64
type as a for loop variable in a range loop.
This totally unhelpful error took me a long time to isolate, without any line number information.