VS Code/ Languages: add golang
This commit is contained in:
parent
388f15988a
commit
502ab9f1f2
|
@ -26,6 +26,8 @@ For a GUI/ Desktop machine, you can enable to install and configure VS Code:
|
|||
- `user_vscode`: Boolean to install and set the basic configuration of VS Code
|
||||
- `user_lang_cpp`: Boolean to install C/C++ dev tools and configure VS Code
|
||||
- `user_lang_python`: Boolean to install Python dev tools and configure VS Code
|
||||
- `user_lang_golang`: Boolean to install Golang dev tools and configure VS Code
|
||||
The `user_lang_*` switches will also install the language onyl, if `user_vscode` is set to false.
|
||||
|
||||
|
||||
Dependencies
|
||||
|
|
|
@ -11,3 +11,5 @@ usersetup_gitconfig: true
|
|||
user_vscode: false
|
||||
user_lang_cpp: false
|
||||
user_lang_python: false
|
||||
user_lang_golang: false
|
||||
user_lang_golang_gopath: "{{ ansible_user_dir }}/Development/go"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
- name: vscode - C/C++ - Install developer tools
|
||||
package:
|
||||
name: "{{ packages }}"
|
||||
state: latest
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- clang-format
|
||||
|
@ -33,3 +33,16 @@
|
|||
|
||||
# VS Code - Python Development Tools
|
||||
# all done in vscode.yml
|
||||
|
||||
|
||||
# VS Code - Golang Development Tools
|
||||
- name: vscode - Golang
|
||||
block:
|
||||
- name: vscode - Golang - Install developer tools
|
||||
package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- go
|
||||
when: user_lang_golang == true
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
- name: vscode - C/C++ - Install developer tools
|
||||
homebrew:
|
||||
name: "{{ packages }}"
|
||||
state: latest
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- clang-format
|
||||
|
@ -33,3 +33,16 @@
|
|||
|
||||
# VS Code - Python Development Tools
|
||||
# all done in vscode.yml
|
||||
|
||||
|
||||
# VS Code - Golang Development Tools
|
||||
- name: vscode - Golang
|
||||
block:
|
||||
- name: vscode - Golang - Install developer tools
|
||||
homebrew:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- go
|
||||
when: user_lang_golang == true
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
become: yes
|
||||
package:
|
||||
name: "{{ packages }}"
|
||||
state: latest
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- clang-format
|
||||
|
@ -35,3 +35,17 @@
|
|||
|
||||
# VS Code - Python Development Tools
|
||||
# all done in vscode.yml
|
||||
|
||||
|
||||
# VS Code - Golang Development Tools
|
||||
- name: vscode - Golang
|
||||
block:
|
||||
- name: vscode - Golang - Install developer tools
|
||||
become: yes
|
||||
apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
packages:
|
||||
- golang
|
||||
when: user_lang_golang == true
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
# - user_vscode: Boolean, if vscode should be installed and configured
|
||||
# - user_lang_cpp: Boolean for C and C++
|
||||
# - user_lang_python: Boolean for Python
|
||||
# - user_lang_golang: Boolean for Golang
|
||||
# - user_lang_golang_gopath: Go workspace directory
|
||||
|
||||
|
||||
- name: vscode - Install and configure VS Code
|
||||
|
@ -44,12 +46,12 @@
|
|||
|
||||
|
||||
# VS Code - Python Development Tools
|
||||
- name: vscode - Python - Install python dev packages
|
||||
pip:
|
||||
name:
|
||||
- autopep8
|
||||
- pylint
|
||||
executable: /usr/local/bin/pip3
|
||||
- name: vscode - Python - Install python dev packages
|
||||
pip:
|
||||
name:
|
||||
- autopep8
|
||||
- pylint
|
||||
executable: /usr/local/bin/pip3
|
||||
when: user_lang_python == true
|
||||
- name: vscode - Python
|
||||
block:
|
||||
|
@ -58,3 +60,40 @@
|
|||
PATH=/usr/local/bin:$PATH
|
||||
code --install-extension ms-python.python
|
||||
when: user_vscode == true and user_lang_python == true
|
||||
|
||||
|
||||
# VC Code - Golang Development Tools
|
||||
# https://golang.org/doc/install
|
||||
- name: vscode - Golang - Setup Environment
|
||||
block:
|
||||
- name: vscode - Golang - Create workspace directory
|
||||
file:
|
||||
path: "{{ user_lang_golang_gopath }}"
|
||||
state: directory
|
||||
- name: vscode - Golang - Create zshrc-host
|
||||
file:
|
||||
path: "{{ ansible_user_dir}}/.zshrc-host"
|
||||
state: touch
|
||||
- name: vscode - Golang - Add GOPATH
|
||||
lineinfile:
|
||||
path: "{{ ansible_user_dir}}/.zshrc-host"
|
||||
line: "export GOPATH={{ user_lang_golang_gopath }}"
|
||||
state: present
|
||||
backup: yes
|
||||
- name: vscode - Golang - Add go bin to PATH
|
||||
lineinfile:
|
||||
path: "{{ ansible_user_dir}}/.zshrc-host"
|
||||
line: "export PATH=$PATH:{{ user_lang_golang_gopath }}/bin"
|
||||
state: present
|
||||
backup: yes
|
||||
# TODO: make this resilient agains changes
|
||||
# and group all golang stuff in one section inside zshrc-host
|
||||
when: user_lang_golang == true
|
||||
|
||||
- name: vscode - Golang
|
||||
block:
|
||||
- name: vscode - Golang - Configure VS Code
|
||||
shell: |
|
||||
PATH=/usr/local/bin:$PATH
|
||||
code --install-extension ms-vscode.go
|
||||
when: user_vscode == true and user_lang_golang == true
|
||||
|
|
Loading…
Reference in a new issue