Skip to content

Commit

Permalink
Audit shell exports; Adjust logic for task inclusion; Fix up logic fo…
Browse files Browse the repository at this point in the history
…r MacOS; Change goroot and gopath.

Signed-off-by: Karl Hepworth <karl.hepworth@gmail.com>
  • Loading branch information
fubarhouse committed Sep 18, 2017
1 parent 8e89d90 commit cad0fd6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
16 changes: 8 additions & 8 deletions tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
- name: "Go-Lang | Define shell exports"
set_fact:
shell_exports:
- regex: "export GOROOT"
lineinfile: "export GOROOT={{ GOROOT }}"
- regex: "export GOPATH"
lineinfile: "export GOPATH={{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}"
lineinfile: "export PATH=$PATH:{{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}/bin"
lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin"
- regex: "export GOROOT"
lineinfile: "export GOROOT={{ GOROOT }}"
- regex: "export GOPATH"
lineinfile: "export GOPATH={{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}"
lineinfile: "export PATH=$PATH:{{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}/bin"
lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin"
when: shell_exports is not defined

- name: "Go-Lang | Detect configured shell profiles"
Expand Down
24 changes: 12 additions & 12 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
- name: "Go-Lang | Define shell exports"
set_fact:
shell_exports:
- regex: "export GOROOT"
lineinfile: "export GOROOT={{ GOROOT }}"
- regex: "export GOPATH"
lineinfile: "export GOPATH={{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}"
lineinfile: "export PATH=$PATH:{{ GOPATH }}"
- regex: "PATH:{{ GOPATH }}/bin"
lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin"
- regex: "export GOROOT"
lineinfile: "export GOROOT={{ GOROOT }}"
- regex: "export GOPATH"
lineinfile: "export GOPATH={{ GOPATH }}"
- regex: "PATH:{{ GOROOT }}/bin"
lineinfile: "export PATH=$PATH:{{ GOROOT }}/bin"
- regex: "PATH:{{ GOPATH }}/bin"
lineinfile: "export PATH=$PATH:{{ GOPATH }}/bin"
when: shell_exports is not defined

- name: "Go-Lang | Include bootstrap tasks"
Expand All @@ -18,19 +18,19 @@
- install_go_bootstrap|bool == true
- go_binary_bootstrap.stat.exists|bool == false
- GOROOT_BOOTSTRAP is defined
- 'go_version_string not in current_go_version'
- expected_go_version_output|string not in current_go_version.stdout|default('')

- name: "Go-Lang | Include source build tasks"
include: install-git.yml
when:
- build_go_from_source|bool == true
- 'go_version_string not in current_go_version'
- expected_go_version_output|string not in current_go_version.stdout|default('')

- name: "Go-Lang | Include distro install tasks"
include: install-distro.yml
when:
- build_go_from_source|bool == false
- 'go_version_string not in current_go_version'
- expected_go_version_output|string not in current_go_version.stdout|default('')

- name: "Go-Lang | Detect configured shell profiles"
stat:
Expand Down Expand Up @@ -63,7 +63,7 @@
GOROOT: "{{ GOROOT }}"
GOPATH: "{{ GOPATH }}"
register: go_version_output
failed_when: 'go_version_string not in go_version_output.stdout'
failed_when: go_version_string not in go_version_output.stdout
changed_when: false

- name: "Go-Lang | Restart shell"
Expand Down
8 changes: 7 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
when: go_install.0 is defined

- name: "Include tasks for setting Go permissions"
include: perm.yml
include: perm.yml

- debug:
msg: "{{ expected_go_version_output }}"

- debug:
msg: "{{ current_go_version.stdout }}"
2 changes: 1 addition & 1 deletion tasks/tasks-Darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: "Go-Lang | Define GOARCH"
set_fact:
GOARCH: "arm64"
GOARCH: "amd64"
when: GOARCH is not defined

- name: "Go-Lang | Define GOOS"
Expand Down
6 changes: 3 additions & 3 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
build_go_from_source: true
install_go_bootstrap: true
go_temporary_dir: /home/travis/temp
GOROOT: /home/travis/go_travis_test
GOPATH: /home/travis/go_path
GOROOT_BOOTSTRAP: /home/travis/go_travis_test_go1.4
GOROOT: /home/travis/goroot1.9
GOPATH: /home/travis/gopath
GOROOT_BOOTSTRAP: /home/travis/goroot1.4

pre_tasks:
- file:
Expand Down

0 comments on commit cad0fd6

Please sign in to comment.