LoginSignup
4
1

More than 5 years have passed since last update.

Go moduleを使ったCircleCIのconfig.yml

Posted at

環境

  • AWS Cloud9 (シンガポールリージョンのEC2上で動作)
  • Amazon Linux2
  • zsh

Go 1.11より go mod が使えるようになる

go modとは

.circleci/config.yml


version: 2
jobs:
  build:
    working_directory: /go/src/github.com/teixy/

    docker:
      - image: circleci/golang:1.11.5
        environment:
          GO111MODULE: "on"

    steps:
      - checkout

      - restore_cache:
          name: Restore go modules cache
          keys:
              - v1-mod-{{ .Branch }}-{{ checksum "go/go.mod" }}

      - run:
          name: Vendoring
          command: go mod download

      - save_cache:
          name: Save go modules cache
          key: v1-mod-{{ .Branch }}-{{ checksum "go/go.mod" }}
          paths:
              - ~/go/pkg/mod/cache

      - run:
          name: Build go binary
          command: |
              go build -v -o go/main go/main.go

workflows:
    version: 2
    build:
      jobs:
        - build

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1