LoginSignup
7
8

More than 5 years have passed since last update.

CircleCIでgithubに置かれた依存Goプロジェクトの特定ブランチをビルドする

Posted at

Goプロジェクトをビルドする場合、依存するプロジェクトを go get しておくわけなんですが、GOプロジェクトの場合 master ブランチを取得してきます。
普通はこれで問題ないんですが、自分用にフォークして変更したものを go get したい場合これでは困ります。
そこで検索したところ、以下の情報を見つけました。

あとは CircleCI 上で GOPATH が分かればできそうです。
ssh でログインしたところ GOPATH は ~/.go_workspace だったので、以下のようにしてあげたところ目的のブランチをビルドできました。

circle.yml
machine:
  timezone:
    Asia/Tokyo
test:
  override:
    - exit 0
deployment:
  release:
    branch: master
    commands:
      - go get github.com/toruuetani/ghr
      - cd ~/.go_workspace/src/github.com/toruuetani/ghr
      - git checkout feature-add-commitish-support
      - go install
      - ...
7
8
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
7
8