fubarhouse.golang

Ansible Role: Go

Build Status stability-stable Ansible Galaxy MIT licensed

  • Installs the Google Go programming language.
  • Automatic installation settings.
  • You can manually set up installation settings.
  • Installs from a configurable source.
  • Optionally cleans your $GOPATH whenever you want.
  • Installs additional packages using go get and/or go install.

Requirements

None.

Role Variables

Installation configuration

go_custom_mirror: https://storage.googleapis.com/golang

Basic configuration

go_version: 1.10beta2
GOPATH: /home/vagrant/go
GOROOT: /usr/local/go
GOPROXY: https://proxy.golang.org

Optional configuration

GO111MODULE: "on" # Should be a string. Use "on" or "off" instead of boolean values.
GOOS: darwin
GOARCH: amd64
go_checksum: sha256:82628a1a42d7ad88b100d0c4c9c0282a7e008e4eb73876bed4bd61ac4ee11b46

Building from source

Golang Bootstrap Workspace

GOROOT_BOOTSTRAP: /home/vagrant/go1.4

Indicate if the build should be from source.

build_go_from_source: false

Indicate if Bootstrap needs installation.

install_go_bootstrap: false

Script used when building from source

go_build_script: make.bash

To install go get binaries/projects, add them to go_get with any desired module settings. If no module value is specified, the installation will use the default GO111MODULE value.

Default configuration without modules setting:

go_get:
- name: golint
  url: github.com/golang/lint/golint

Configuration with modules disabled:

go_get:
- name: dvm
  url: github.com/fubarhouse/dvm
  modules: false

Configuration with modules enabled:

go_get:
- name: gopm
  url: github.com/gpmgo/gopm
  modules: true

You can also manually clone and get specific package versions without downloading dependencies.

This is needed to install specific software versions written in Go, as currently there is no alternative provided by the language.

It's recommended to run this playbook multiple times until it succeeds and to use go_reget with this feature, or to avoid this feature unless absolutely necessary.

go_install:
  # repo is the git clone URL, ssh or https.
- repo: https://github.com/fubarhouse/dvm.git
  # dest is the namespace
  dest: github.com/fubarhouse/dvm
  # version refers to a tag or branch.
  version: 2.2.5
  package: github.com/fubarhouse/dvm

To ensure all packages are removed before running the play, you can use the go_reget variable:

go_reget: true

To modify the absolute path of shell profiles to configure, use golang_shell_profile.

If you do not define golang_shell_profile, this feature will be ignored.

golang_shell_profile: /root/.bash_profile

To clean up an installation completely before running the role:

go_install_clean: true

To prevent cleanup from removing GOPATH:

go_install_clean_full: false

Setting permissions

Note: If you set insufficient permissions, the playbook will treat the following play as a new installation because it won't be able to determine the installed version. To set the permissions of the codebase, you can specify:

mode_codebase: 0755

To set the permissions of the workspace, use:

mode_workspace: 0755

Dependencies

None.

Example Playbook

- hosts: localhost
  roles:
    - fubarhouse.golang

Installation

  • Install using ansible-galaxy install fubarhouse.golang
  • Add this role to your playbook.
  • Change the above variables as desired.

License

MIT / BSD

Author Information

This role was created in 2016 by Karl Hepworth.

The image of Go's mascot was created by Takuya Ueda. Licensed under the Creative Commons 3.0 Attribution license. This image has been resized but is otherwise unchanged.

Informazioni sul progetto

Installs the Go programming language from distribution, or build from source, and install desired packages to your Golang workspace!

Installa
ansible-galaxy install fubarhouse.golang
Licenza
mit
Download
38.8k
Proprietario
Lover of all things open source and computers - both hardware and software. My opinions are my own.