Open
Description
Go version
tip
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/home/johan/.cache/go-build'
GOENV='/home/johan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/johan/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/johan/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/johan/src/tip/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/johan/src/tip/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='devel go1.24-24fd1a043d Tue Aug 20 23:11:53 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/johan/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/home/johan/src/tip/go/test/wasmexport/go.mod'
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 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2688758080=/tmp/go-build -gno-record-gcc-switches'
What did you do?
I created a package that exported two identical symbols (in the same package) using the go:wasmexport compiler directive.
package main
//go:wasmexport A
func A() int64 {
return 10
}
//go:wasmexport A
func B() int64 {
return 10
}
func main() {
}
What did you see happen?
I saw a compiler error:
$ GOARCH=wasm GOOS=wasip1 go build -buildmode=c-shared -o x.wasm main.go
main.go:5:2: <autogenerated>:1: symbol A redeclared
<unknown line number>: other declaration of symbol A
What did you expect to see?
The error message should be able to point to the line number of both symbols:
$ GOARCH=wasm GOOS=wasip1 go build -buildmode=c-shared -o x.wasm main.go
main.go:5:2: <autogenerated>:1: symbol A redeclared
main.go:10:2: other declaration of symbol A
It is also notable that main.go:5
is the location of the return, not the compiler directive.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo