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

open github.com/nats-io/nats.go: no such file or directory. exit status 2 #539

Closed
ChaunceyShannon opened this issue May 16, 2022 · 3 comments · Fixed by #540
Closed

open github.com/nats-io/nats.go: no such file or directory. exit status 2 #539

ChaunceyShannon opened this issue May 16, 2022 · 3 comments · Fixed by #540
Labels
bug Something isn't working
Milestone

Comments

@ChaunceyShannon
Copy link

ChaunceyShannon commented May 16, 2022

What version of Garble and Go are you using?

$ garble version

v0.6.0

$ go version

go version go1.18 linux/amd64

What environment are you running Garble on?

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/tmp/project/go.mod"
GOWORK=""
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-build1432992590=/tmp/go-build -gno-record-gcc-switches"

What did you do?

What did you expect to see?

Success build

What did you see instead?


$ garble build .  
# github.com/nats-io/nats.go
open github.com/nats-io/nats.go: no such file or directory
exit status 2
@mvdan
Copy link
Member

mvdan commented May 16, 2022

Where did you run that command from? A clone of the repository? At what version?

@mvdan mvdan added the needs info Requires extra information to be solved label May 16, 2022
@ChaunceyShannon
Copy link
Author

ChaunceyShannon commented May 16, 2022

just import a big library: github.com/ChaunceyShannon/golanglibs

╭─user@laptop  ~/tmp/gotest1  
╰─$ ls
go.mod  go.sum  main.go
╭─user@laptop  ~/tmp/gotest1  
╰─$ garble build .      
# github.com/nats-io/nats.go
open github.com/nats-io/nats.go: no such file or directory
exit status 2
╭─user@laptop  ~/tmp/gotest1  
╰─$ cat main.go
package main

import (
	. "github.com/ChaunceyShannon/golanglibs"
)

func main() {
	Print("hello world!")
}
╭─user@laptop  ~/tmp/gotest1  
╰─$ go run .      
"hello world!"
╭─user@laptop  ~/tmp/gotest1  
╰─$ go build .
╭─user@laptop  ~/tmp/gotest1  
╰─$ ./gotest1              
"hello world!"
╭─user@laptop  ~/tmp/gotest1  
╰─$ 

@mvdan mvdan added bug Something isn't working and removed needs info Requires extra information to be solved labels May 16, 2022
mvdan added a commit to mvdan/garble-fork that referenced this issue May 17, 2022
When splitFlagsFromFiles saw "-p foo/bar.go",
it thought that was the first Go file, when in fact it's not.
We didn't notice because such import paths are pretty rare,
but they do exist, like github.com/nats-io/nats.go.

Before the fix, the added test case fails as expected:

	> garble build -tags buildtag
	[stderr]
	# test/main/goextension.go
	open test/main/goextension.go: no such file or directory

We could go through the trouble of teaching splitFlagsFromFiles about
all of the flags understood by the compiler and linker, but that feels
like far more code than the small alternative we went with.
And I'm pretty sure the alternative will work pretty reliably for now.

Fixes burrowers#539.
@mvdan
Copy link
Member

mvdan commented May 17, 2022

Thanks for the details! I believe the fix is #540, if you want to give it a try.

@lu4p lu4p closed this as completed in #540 May 18, 2022
lu4p pushed a commit that referenced this issue May 18, 2022
When splitFlagsFromFiles saw "-p foo/bar.go",
it thought that was the first Go file, when in fact it's not.
We didn't notice because such import paths are pretty rare,
but they do exist, like github.com/nats-io/nats.go.

Before the fix, the added test case fails as expected:

	> garble build -tags buildtag
	[stderr]
	# test/main/goextension.go
	open test/main/goextension.go: no such file or directory

We could go through the trouble of teaching splitFlagsFromFiles about
all of the flags understood by the compiler and linker, but that feels
like far more code than the small alternative we went with.
And I'm pretty sure the alternative will work pretty reliably for now.

Fixes #539.
@mvdan mvdan added this to the v0.6.0 milestone May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants