burrowers/garble

Caching of go list output breaks dependency resolution

lu4p opened this issue · 7 comments

mvdan commented

Can you share steps to reproduce and a bit more detail?

lu4p commented

Sure to reproduce:

git clone https://github.com/lu4p/ToRat.git
cd ./ToRat 
sudo docker build . -t torat
mvdan commented

Ah, the problem is likely the -tags flag, since we don't propagate that to go list. See the TODO in https://github.com/mvdan/garble/blob/c51e08ef37cbe5ac995c3c73a88c2a19b5ee2605/main.go#L299-L302.

I can probably take a look today or tomorrow. For now, use a slightly older version of garble.

lu4p commented
Step 15/19 : RUN cd ./cmd/client && garble -literals -seed=random build -tags "tor" -o /dist/client/client_linux && upx /dist/client/client_linux
 ---> Running in 15d60126df9e
go list error: exit status 1: can't load package: package /dist/client/client_linux: cannot find package

/dist/client/client_linux is somehow interpreted as a package

zwass commented

I am running into the same issue with builds before d0e0147.

With builds after d0e0147, I get the following:

GOPRIVATE=<redacted> GOOS=darwin GOARCH=386 ./garble build -o main -tags foobar -ldflags -X <redacted>.clientID=foobar  <redacted>
go list error: exit status 1: go: finding module for package -X <redacted>.clientID=foobar
can't load package: package <redacted> is not in GOROOT (/usr/local/Cellar/go/1.14.4/libexec/src/<redacted>)
can't load package: package -tags is not in GOROOT (/usr/local/Cellar/go/1.14.4/libexec/src/-tags)
can't load package: package foobar is not in GOROOT (/usr/local/Cellar/go/1.14.4/libexec/src/foobar)
can't load package: package -ldflags is not in GOROOT (/usr/local/Cellar/go/1.14.4/libexec/src/-ldflags)
can't load package: package -X <redacted>.clientID=foobar : malformed module path "-X <redacted>.clientID=foobar ": leading dash

(Which seems to be the same issue @lu4p is having with the new changes?)

zwass commented

For now I'm able to get the fix I needed for #89 by reverting the related commits in master: https://github.com/zwass/garble/tree/fixes

mvdan commented

Sorry that this has turned into such a shitshow. I'll take a look tomorrow again.