> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/open-source/use-harness-open-source/pipelines-1/samples/go.md).

# Go

This guide covers configuring continuous integration pipelines for Go projects that use Go Modules.

## Build and Test <a href="#build-and-test" id="build-and-test"></a>

In the below example we demonstrate a pipeline that executes `go test` and `go build` commands. These commands are executed inside the golang Docker container, downloaded at runtime from DockerHub.

```yaml
kind: pipeline
spec:
  stages:
  - type: ci
    spec:
      steps:
      - name: test
        type: run
        spec:
          container: golang
          script: |
            go build
            go test
```

## Test Multiple Versions <a href="#test-multiple-versions" id="test-multiple-versions"></a>

You can configure multiple, containerized steps to test against multiple versions of Go.

```yaml
kind: pipeline
spec:
  stages:
  - type: ci
    spec:
      steps:
      - name: test 1.20
        type: run
        spec:
          container: golang:1.20
          script: |
            go build
            go test

      - name: test 1.21
        type: run
        spec:
          container: golang:1.21
          script: |
            go build
            go test
```

Please note that you can use any Docker image in your pipeline from any Docker registry. You can use the official golang [images](https://hub.docker.com/r/_/golang/), or your can bring your own.
