Skip to content
New issue

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

cmd/go: error while trying to overwrite a built binary #25774

Closed
agnivade opened this issue Jun 7, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@agnivade
Copy link
Member

commented Jun 7, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version devel +33f1768 Thu Jun 7 01:19:13 2018 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/agniva/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/agniva/play/go"
GORACE=""
GOROOT="/home/agniva/play/gosource/go"
GOTMPDIR=""
GOTOOLDIR="/home/agniva/play/gosource/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
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"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build730496659=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build any wasm binary with js/wasm env vars. Then build the same binary again.

GOOS=js GOARCH=wasm gotip build -o binary file.go
Update code.
Then again - GOOS=js GOARCH=wasm gotip build -o binary file.go

What did you expect to see?

Binary builds fine. Overwrites existing binary. Just like it happens for normal builds for other platforms.

What did you see instead?

go build command-line-arguments: build output "binary" already exists and is not an object file

This is annoying during the dev cycle, because now I have to delete the binary every time I need to re-build.

I think we just need to add the wasm magic header in the objectMagic slice in cmd/go/internal/work/exec.go .

Can send a CL if this sounds good.

@agnivade agnivade added this to the Go1.11 milestone Jun 7, 2018

@agnivade

This comment has been minimized.

Copy link
Member Author

commented Jun 7, 2018

/cc @neelance

@neelance

This comment has been minimized.

Copy link
Member

commented Jun 7, 2018

I think we just need to add the wasm magic header in the objectMagic slice in cmd/go/internal/work/exec.go .

Sounds good.

@agnivade agnivade added the NeedsFix label Jun 7, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Jun 7, 2018

Change https://golang.org/cl/116915 mentions this issue: cmd/go/internal: add wasm magic header

@gopherbot gopherbot closed this in 156bbe2 Jun 7, 2018

@ALTree ALTree changed the title [wasm]cmd/go: error while trying to overwrite a built binary cmd/go: error while trying to overwrite a built binary Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.