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

Can't compile build in go/src/ from outside the package directory #592

Closed
kedanX opened this issue Oct 2, 2022 · 2 comments
Closed

Can't compile build in go/src/ from outside the package directory #592

kedanX opened this issue Oct 2, 2022 · 2 comments
Labels
needs info Requires extra information to be solved

Comments

@kedanX
Copy link

kedanX commented Oct 2, 2022

What version of Garble and Go are you using?

$ garble version v0.7.2

$ go version go1.19 windows/amd64

What environment are you running Garble on?

go env Output
$ go env set GO111MODULE=on
set GOARCH=wasm
set GOBIN=
set GOCACHE=C:\Users\Daniel\AppData\Local\go-build
set GOENV=C:\Users\Daniel\AppData\Roaming\go\env
set GOEXE=
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Daniel\Desktop\go-workspace\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=js
set GOPATH=C:\Users\Daniel\Desktop\go-workspace
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19
set GCCGO=gccgo
set GOWASM=
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Program Files\Go\src\kard\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\Daniel\AppData\Local\Temp\go-build4175388778=/tmp/go-build -gno-record-gcc-switches

What did you do?

Ran the command set GOOS=js&& set GOARCH=wasm&& garble build -o C:\Users\Daniel\Desktop\go-workspace\src\sandbox\other\wasm\assets\json.wasm kard to compile the package kard in go/src/ to json.wasm in the specified folder.

What did you expect to see?

A compiled json.wasm in the assets folder. The same command using go build works as it should (set GOOS=js&& set GOARCH=wasm&& go build -o C:\Users\Daniel\Desktop\go-workspace\src\sandbox\other\wasm\assets\json.wasm kard)

Running the garble command within the directory itself functions as it should, however, as I'm using a compile daemon which means I need to compile the build from elsewhere, the above is necessary to be called outside of the package directory (like how it works with go build)

What did you see instead?

GOGARBLE="bot,bot_test" does not match any packages to be built

@mvdan
Copy link
Member

mvdan commented Oct 2, 2022

See the README; GOGARBLE defaults to the current moduel path. You should try changing it to what you really want it to be, or something more agressive like GOGARBLE=*.

@mvdan mvdan added the needs info Requires extra information to be solved label Oct 3, 2022
@mvdan
Copy link
Member

mvdan commented Oct 6, 2022

I'm going to guess that my answer above is enough. In the future, we'll move to a GOGARBLE default that is the same no matter what your current directory is, so that should be less confusing as well. See #594.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Requires extra information to be solved
Development

No branches or pull requests

2 participants