Go version
go version go1.22.0 darwin/arm64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/hajimehoshi/Library/Caches/go-build'
GOENV='/Users/hajimehoshi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/hajimehoshi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/hajimehoshi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
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/cj/73zbb35j0qx5t4b6rnqq0__h0000gn/T/go-build2140543503=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
Run this:
package main
import "fmt"
func main() {
s := 1
a := 2.0 << s
b := 2.0<<s + s<<3.0
fmt.Println(a, b)
}
What did you see happen?
./main.go:7:7: invalid operation: shifted operand 2.0 (type float64) must be integer
What did you expect to see?
Both are errors, or both are correct. (I hope both are correct). Actually this program worked:
package main
import "fmt"
func main() {
s := 1
b := 2.0<<s + s<<3.0
fmt.Println(b)
}
Go version
go version go1.22.0 darwin/arm64
Output of
go envin your module/workspace:What did you do?
Run this:
What did you see happen?
What did you expect to see?
Both are errors, or both are correct. (I hope both are correct). Actually this program worked: