Getting Started: Go

go
getting-started
cci2-doc

#1

Documentation for this topic is now available on our documentation site: https://circleci.com/docs/2.0/language-go/


#2

I’m trying to use executorType: machine with Go due to an issue with volume mounting with the executorType: docker. When I try to set my workDir to /go/src/github.com/projectorg/projectid I get this error:

mkdir: cannot create directory ‘/go’: Permission denied

This worked on the executorType: docker, so are the permissions different when using the executorType: machine? Would you happen to have any examples of Go used on executorType: machine?


#3

That does seem odd. Can you check the permissions on /go? Is it created first? As root, you should not run into any permission errors.

Perhaps you can try throwing a sudo in there?


#4

Here’s the YAML format I’m using:

executorType: machine
stages:
  build:
    parallel: 2
    workDir: /go/src/github.com/projectorg/projectid
    steps:
      - type: shell
        name: Initialize working directory
        pwd: /
        command: |
          sudo mkdir -p /go/src/github.com/projectorg/projectid
      - type: checkout```

When this gets to the checkout stage I receive this error:

```Cloning into '.'...
/go/src/github.com/projectorg/projectid/.git: Permission denied
Exited with code 1```

Is there any way I can get the step `type: checkout` to run in sudo?

#5

Can you put the checkout step first?


#6

#7