To work with Go’s expected directory structure, a symlink is placed to your project’s directory at /home/ubuntu/.go_project/src/github.com/<USER>/<REPO_NAME> (this happens at dependencies stage, unless that section is overridden).
I have no overriding in the dependencies phase. In fact, I don’t have any settings at all for the dependencies phase, and it doesn’t seem to perform a go get & go build as documented either.
When I ssh into the machine it doesn’t have a .go_project folder at all. ~/.go_workspace does exist though…
I’m not sure if this was you that opened this Pull Request but we’re aware and I’ll be looking into this. I’m not sure if anything changed or not but I’ll make sure the Go Doc is accurate.
Thanks for the follow up. So, I took a look at it looks like for CircleCI’s inference to pick up a Go project, it checks for the existence of a least one .go in the root of the project. It doesn’t necessarily have to be main.go. From here I’d suggest two options:
Place a .go file in the root, could be anything, hopefully something useful.
Copy the commands from the Go doc and place them in the override sections.
Ok, option #1 (adding an empty .go file in the root) does trigger the project and setup the GOPATH correctly.
Option #2, is why I created this and titled it “Golang not working as documented”. The Setting up Go environment step during the dependencies phase is a black box and the little bit of info in the documentation doesn’t indicate what is needed for overriding.
so…
since my projects needs to override the dependencies stage (and modify the go get), the other aspects of this black box need more definition.
The circle.yml equivalent of CircleCI's Inference is the following:
dependencies:
override:
# './...' is a relative pattern which means all subdirectories
- go get -t -d -v ./...
- go build -v
but then later in the doc it states,
a symlink is placed to your project's directory at /home/ubuntu/.go_project/src/github.com/<USER>/<REPO_NAME> (this happens at dependencies stage, unless that section is overridden).
that would imply, what exactly??? something like this:
dependencies:
override:
- ln -s . ${HOME}/.go_project/src/github.com/<USER>/<REPO_NAME>
- go get -t -d -v ./...
- go build -v