Using own packages in Go project

go

#1

I’ve split up my Go project in several packages (github.com/haarts/getme). When testing I usually do just go test ./... and getting all the dependencies with go get ./.... All that works great locally. (You can try by cloning the project, it’s OS.)

Now I haven’t been able to get CircleCI working for this project. I’m unsure how to configure it but I’ve used in the dependencies section (not circle.yml yet): go get -d -u ./.... But this seems to stumble over my own packages:

package _/home/ubuntu/getme/cmd/crosscheck: unrecognized import path "_/home/ubuntu/getme/cmd/crosscheck"
package _/home/ubuntu/getme/cmd/getme: unrecognized import path "_/home/ubuntu/getme/cmd/getme"
...

Importing all the dependencies explicitly with a list of go get github.com/extern/package yields:

go install: no install location for directory /home/ubuntu/getme/cmd/crosscheck outside GOPATH
...

I’m a bit at a loss. This seems the most trivial project to set up? No databases, no external services.


#2

Hi,

You never linked your project. Can you provide a link so I can check it out and investigate?


#3

Should I link my CircleCI project then? The Github project is in the post. (/me looks) Ah the CircleCI project is public too of course: https://circleci.com/gh/haarts/getme


#4

Running go get github.com/haarts/getme on my local machine is giving me an error:

package github.com/haarts/getme: no buildable Go source files in /home/felicianotech/Repositories/go/src/github.com/haarts/getme


#5

Very true. Due to the layout of the project you’ll need to do go get github.com/haarts/getme/....


#6

Hey,

Did you ever figure this out? Your project isn’t in a typical layout at the GitHub repo itself, at the root level isn’t a Go package. This is what CircleCI’s Inference, the bits that make assumptions about your project, expect. All you have to do is provide the commands you want us to run in your circle.yml file and you should be set.


#7

I haven’t. As I mentioned I’ve tried the ‘dependency section’ in CircleCI which I believe to be a tool to achieve the same thing as a circle.yml file. Perhaps I’m mistaken.
I just don’t know where I should put go test ./.... Either in the tool or circle.yml. Seemed trivial enough.


#8

Having the same issue here https://circleci.com/gh/tendermint/tendermint/tree/feature%2Fimprove-circleci-setup :frowning:


#9

Hello @melekes,

It looks like your last couple builds on that branch are passing.

Were you able to resolve the issue yourself? If so, could you please share it here.

Best,
Zak


#10

Sure. I wasn’t able to get this working with go get -d ./.... So I switched to glide (package manager), which stores all the dependencies inside ./vendor directory.


#11