- name: Install go versions
  shell: source ~/.bashrc && goenv install {{ item.version }}
  with_items: '{{ go_versions }}'

- name: Set go version to {{ item.version }}
  shell: source ~/.bashrc && goenv global {{ item.version }}
  with_items: '{{ go_versions }}'
  when: '{{ item.global | default(False) }}'

- name: Install go packages
  command: go get {{ item }}
  with_items: '{{ go_packages }}'

- name: Install go versions
  shell: source ~/.bashrc && goenv install {{ item.version }}
  with_items: '{{ go_versions }}'

- name: Set go version to {{ item.version }}
  shell: source ~/.bashrc && goenv global {{ item.version }}
  with_items: '{{ go_versions }}'
  when: '{{ item.global | default(False) }}'

- name: Install go packages
  shell: source ~/.bashrc && go get {{ item }}
  with_items: '{{ go_packages }}'

Set GOPATH via source .bashrc
fix: Set GOPATH via source .bashrc
