Vendor folder being ignored inside alpine docker container, gopath is set and files are there

Hi, somewhat of a followup from my last post about building Go in jenkins. Now we’ve got a decent workflow set up, I’m running into Go tool issues!

I’ve searched quite a lot for this issue but every answer points to “project must be in $GOPATH for vendor/ to work” which doesn’t apply to me because $GOPATH is set correctly - I can’t find any other causes or solutions so hopefully some of you forum gophers can help!

So we use private dependencies at my company and the solution to CI docker builds was to vendor everything - seems logical! Except I’m getting a very odd gotool output that’s acknowledging the fact that the vendor folder exists but seems to be blind to the vendored dependency existing.

Here’s some annotated output from Jenkins, I’ve resorted to adding a bunch of ls pwd and stat commands to attempt to debug the issue.

Image is FROM golang:1.8.0-alpine

pwd				/go/src/<company>/<repo>
stat			  File: /go/src/<company>/<repo>/vendor/<some user>/<some dependency>
				  Size: 4096      	Blocks: 8          IO Block: 4096   directory
				Device: 46h/70d	Inode: 1211        Links: 2
				Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
				Access: 2017-07-28 09:01:26.000000000
				Modify: 2017-07-25 14:49:56.000000000
				Change: 2017-07-28 09:01:26.000000000

go env GOPATH	/go
echo $GOPATH	/go
make test		DEBUG=1 go test -v
				main.go:11:2: cannot find package "<some user>/<some dependency>" in any of:
					/go/src/<company>/<repo>/vendor/<some user>/<some dependency> (vendor tree)
					/usr/local/go/src/<some user>/<some dependency> (from $GOROOT)
					/go/src/<some user>/<some dependency> (from $GOPATH)

First I pwd the working dir, my project. It’s in the correct place, $GOPATH/src (/go is $GOPATH in golang-alpine)
I stat the vendored dependency, it’s there!
Print out go env and $GOPATH, everything looks fine, my project is in the gopath.
yet the go test (and go build, or any other go command) says it can’t find the dependency and it even prints out the exact same path that I stat'd.

What’s up here? It builds fine outside of the container so I’m guessing it’s something docker related…

Thanks in advance!

That folder is empty, it has only 2 links

Ah didn’t see that, must be a govendor bug…
I resolved the issue eventually by deleting everything and re-running govendor init

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.