|
| 1 | +--- |
| 2 | +- name: Download Golang binary distribution |
| 3 | + get_url: |
| 4 | + url=https://storage.googleapis.com/golang/{{ go_archive_file }} |
| 5 | + dest={{ home }}/{{ go_archive_file }} |
| 6 | +- name: Create ~/opt folder |
| 7 | + file: |
| 8 | + path={{ home }}/opt |
| 9 | + state=directory |
| 10 | +- name: Unpack the Go binary distribution |
| 11 | + unarchive: |
| 12 | + copy=no |
| 13 | + src={{ home }}/{{ go_archive_file }} |
| 14 | + dest={{ home }}/opt |
| 15 | + creates={{ home }}/opt/go |
| 16 | +- name: Add go path settings in .bashrc |
| 17 | + lineinfile: dest={{ home }}/.bashrc line="{{ item }}" insertafter=EOF |
| 18 | + with_items: |
| 19 | + - 'export GOROOT={{ go_root }}' |
| 20 | + - 'export GOPATH={{ go_path }}' |
| 21 | + - 'export PATH={{ go_root }}/bin:$PATH' |
| 22 | + - 'export PATH={{ go_path }}/bin:$PATH' |
| 23 | + |
| 24 | +- name: Add go path settings in .zshrc |
| 25 | + lineinfile: dest={{ home }}/.zshrc line="{{ item }}" insertafter=EOF |
| 26 | + with_items: |
| 27 | + - 'export GOROOT={{ go_root }}' |
| 28 | + - 'export GOPATH={{ go_path }}' |
| 29 | + - 'export PATH={{ go_root }}/bin:$PATH' |
| 30 | + - 'export PATH={{ go_path }}/bin:$PATH' |
| 31 | + |
| 32 | +- name: Create go code folder |
| 33 | + file: |
| 34 | + dest={{ go_path }}/src/github.com |
| 35 | + state=directory |
| 36 | + recurse=yes |
| 37 | + owner=vagrant |
| 38 | + group=vagrant |
| 39 | +- name: Install some nice go packages |
| 40 | + command: > |
| 41 | + go get {{ item }} |
| 42 | + environment: |
| 43 | + GOPATH: "{{ go_path }}" |
| 44 | + GOROOT: "{{ go_root }}" |
| 45 | + PATH: "{{ go_root }}/bin:{{ go_path }}/bin:/usr/bin:/bin" |
| 46 | + with_items: |
| 47 | + - golang.org/x/tools/cmd/oracle |
| 48 | + - github.com/nsf/gocode |
| 49 | + - github.com/tools/godep |
| 50 | + - github.com/rogpeppe/godef |
| 51 | + - github.com/jstemmer/gotags |
| 52 | + - golang.org/x/tools/cmd/goimports |
| 53 | + - bitbucket.org/gotamer/gowatch |
| 54 | + - bitbucket.org/liamstask/goose/cmd/goose |
0 commit comments