diff --git a/.latest-versions.yml b/.latest-versions.yml index b8f6649..ba8671d 100644 --- a/.latest-versions.yml +++ b/.latest-versions.yml @@ -17,6 +17,8 @@ github_packages: win32yank: latest git_fuzzy: latest nvm: latest + terraform: latest + terragrunt: latest tpm: latest pes: latest p10k: latest diff --git a/README.md b/README.md index c2907bb..d1eacbb 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Please read below README carefully and go through the scripts to see whats going * [Other software](#other-software) * [Languages](#languages) * [Python](#python) + * [Go](#go) * [Ruby](#ruby) * [JAVA/groovy](#java/groovy) * [Node](#node) @@ -211,6 +212,10 @@ Also, there is [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) a For usage examples see [Usages.md](./Usages.md) +### Go + +Automatic installation of Go is done using [`GVM`](https://github.com/moovweb/gvm) - Go Version Manager. By default `go1.20.4` gets installed (at the time of writing). See [`Usages.md`](./Usages.md) for details. + #### Ruby For Ruby management, there is [Ruby Version Manager (RVM)](https://rvm.io/) installed. See available Ruby's with `rvm list`, use particular with `rvm use `. There are some gems already preinstalled on Rubys available here (like `neovim` gem, or if Puppet is being installed, it installs `puppet` and `puppet-lint` gems). diff --git a/TODO.md b/TODO.md index b55c3af..a733285 100644 --- a/TODO.md +++ b/TODO.md @@ -1,14 +1,14 @@ # TODO - [ ] fix(playbooks): Analyze shell commands and add missing changed_when/failed_when directives -- [ ] fix(puppet): Go to definition sometimes does not load -- [ ] feat(go): Install GVM (Go Version Manager) and default GO. - [ ] feat(neovim): Add Vimux keymaps (Telescope?), document usage. - [ ] feat(neovim): Integrate DirDiff with Nvim Tree, introduce simple shortcuts/marks for diffing two directories. - [ ] feat(AWS): AWS cli installation/setup - [ ] docs(gita): Describe `gita` usage and example +- [x] feat(go): Install GVM (Go Version Manager) and default GO. - [x] fix(vim): Markdown treesitter / LSP not working. Add/replace better plugins. - [x] fix(ansible): Use the same version in `prepare-ubuntu.sh` which is set in vars.yml +- -[ ] fix(puppet): Go to definition sometimes does not load-: this is tracked in [puppet-editor-services issue #337](https://github.com/puppetlabs/puppet-editor-services/issues/337) - [x] feat(python): add and use `pyenv`, `pipenv`, use latest Python+Ansible - [x] feat(kubernetes): install docker, kubectl, k9s, kind - [x] feat(neovim): Install neovim-ruby-host for all rubies diff --git a/Usages.md b/Usages.md index b0f208c..f69c162 100644 --- a/Usages.md +++ b/Usages.md @@ -25,6 +25,7 @@ This document describes all the tools and features which I find useful for every * [LazyGit](#lazygit) * [Languages](#languages) * [Python](#python) + * [Go](#go) * [Ruby](#ruby) * [Java/Gradle/Groovy](#java/gradle/groovy) * [Tmux](#tmux) @@ -284,6 +285,27 @@ To change running version: - to change default: `pyenv global ` - to change version whenever you are in current directory, use `pyenv local ` +#### Go + +Automatic installation of Go is done using [`GVM`](https://github.com/moovweb/gvm) - Go Version Manager. By default `go1.20.4` gets installed (at the time of writing). + +You can install more Go versions either manually (`gvm install `) or you can add/set your prefered version(s) in `ansible/vars/overrides.yml` (and run the automation): + +```yaml +go_versions: + - go1.20.4 +go_default: go1.20.4 +``` + +Note that `go_default` value must be in `go_versions` :) + +- list installed Go versions: `gvm list` +- list all available Go versions: `gvm listall` +- install: `gvm install ` +- uninstall: `gvm uninstall ` +- switch to different version: `gvm use ` +- switch and set default: `gvm use --default` + #### Ruby Ruby is managed through [`rvm`](https://github.com/rvm/rvm) (Ruby enVironment Manager). By default, fairly recent version of Ruby is installed (check with `rvm list`). diff --git a/ansible/roles/software/tasks/gvm.yml b/ansible/roles/software/tasks/gvm.yml new file mode 100644 index 0000000..d4634d7 --- /dev/null +++ b/ansible/roles/software/tasks/gvm.yml @@ -0,0 +1,28 @@ +# Install GVM (Go Version Manager) +# Source: https://github.com/moovweb/gvm +--- +- name: "[GVM] Install/update GVM" + ansible.builtin.shell: | + set -e -o pipefail + bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) + register: gvm_install + args: + creates: "{{ ansible_env.HOME }}/.gvm" + executable: /bin/bash + +- name: "[GVM] Show GVM install/update info" + ansible.builtin.debug: + msg: "{{ gvm_install.stdout | default('No output was passed from GVM install command') }}" + +- name: "[Go] Install Go versions" + ansible.builtin.command: "gvm install {{ goversion }} -B" + args: + creates: "{{ ansible_env.HOME}}/.gvm/environments/{{ goversion }}" + loop: "{{ go_versions }}" + loop_control: + loop_var: goversion + +- name: "[Go] Set default to {{ go_default }}" + ansible.builtin.shell: ". {{ ansible_env.HOME }}/.gvm/scripts/gvm; gvm use {{ go_default }} --default" + args: + executable: /bin/bash diff --git a/ansible/roles/software/tasks/main.yml b/ansible/roles/software/tasks/main.yml index 5971b1d..e165092 100644 --- a/ansible/roles/software/tasks/main.yml +++ b/ansible/roles/software/tasks/main.yml @@ -384,6 +384,20 @@ - versions - rust +# GVM +- name: "[Software] Install Go Version Manager" + ansible.builtin.include_tasks: + file: gvm.yml + apply: + tags: + - software + - gvm + when: "'gvm' not in software_tasks_exclude" + tags: + - software + - versions + - gvm + # Ansible PIP - name: "[Software] Install Ansible" ansible.builtin.include_tasks: diff --git a/ansible/roles/software/vars/main.yml b/ansible/roles/software/vars/main.yml index e2f1e32..24ac45c 100644 --- a/ansible/roles/software/vars/main.yml +++ b/ansible/roles/software/vars/main.yml @@ -30,6 +30,12 @@ default_apt_packages: - apt-transport-https # Required for Azure CLI - lsb-release # Required for Azure CLI - gnupg # Required for Azure CLI + - make # Required for GVM + - binutils # Required for GVM + - bison # Required for GVM + - build-essential # Required for GVM + - mercurial # Required for GVM + # Specific versions for software (github) # Fixed versions should be set without `v` prefix (e.g: 1.4.3) github_packages: @@ -170,3 +176,8 @@ sdkman_flush_caches_after: [] # Link SDKMAN installed packages # Reference: https://linux.die.net/man/8/update-alternatives sdkman_update_alternatives: [] + +# Go versions installed with GVM +go_versions: + - go1.20.4 +go_default: go1.20.4