Go moduleを使ったCircleCIのconfig.yml
3214 ワード
環境
- AWS Cloud9 (シンガポールリージョンのEC2上で動作)
- Amazon Linux2
- zsh
Go 1.11より go mod が使えるようになる
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
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
Author And Source
この問題について(Go moduleを使ったCircleCIのconfig.yml), 我々は、より多くの情報をここで見つけました https://qiita.com/tanden/items/2134c2650f18406b1a1d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .