Coder Social home page Coder Social logo

ansible-golang's Introduction

markosamuli.golang

GitHub release License pre-commit

Branch Status
master Build Status
develop Build Status

Ansible role to install Go programming language and development environment on Ubuntu and macOS.

Used for setting up my workstations in the following playbooks:

Go version

This role will install the Go version 1.15 from your package manager:

The role expects the package manager to provide minimum Go version 1.13.

Configuration

To change Go version to 1.12:

golang_version: "1.12"

Configure GOPATH for Go projects:

golang_path: "go"

The path is relative to the current user home directory, for example golang_path: "Projects/go" will become ~/Projects/go.

Update GOPATH and PATH in .bashrc and .zshrc:

golang_init_shell: true

You should disable golang_init_shell if you're managing your shell scripts using .dotfiles and don't want to mess up them.

To use Go modules with GO111MODULES=auto:

golang_modules: true

Development tools

The following development tools are installed:

  • golint is a linter for Go source code
  • goimports is a tool for updating your Go import lines
  • errcheck is a program for checking for unchecked errors in go programs
  • go-callvis is a development tool to help visualize call graph of a Go program using interactive view
  • gopkgs is a tool that provides list of available Go packages that can be imported
  • Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface
  • guru is a tool for answering questions about Go source code
  • staticcheck is a linter for Go source code

To add or remove installed packages, update the list in golang_packages:

golang_packages:
  - name: github.com/kisielk/errcheck
  - name: github.com/TrueFurby/go-callvis
  - name: golang.org/x/lint
  - name: golang.org/x/tools/cmd/goimports
  - name: golang.org/x/tools/cmd/stringer
  - name: golang.org/x/tools/cmd/guru
  - name: honnef.co/go/tools/cmd/staticcheck
  - name: github.com/uudashr/gopkgs@v2

Above packages will be installed with GO111MODULES=on set.

Make sure Git is installed if installing packages or the role will fail.

Install Git hooks

Install pre-commit, pre-push and commit-msg Git hooks:

make install-git-hooks

Coding style

Install pre-commit hooks and validate coding style:

make lint

Run tests

Run tests in Ubuntu and Debian using Docker:

make test

License

MIT

Author Information

ansible-golang's People

Contributors

markosamuli avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

danhatesnumbers

ansible-golang's Issues

Role doesn't work on Pengwin

TASK [markosamuli.golang : Include OS-specific variables] **********************************************************************************************************************
fatal: [localhost]: FAILED! => {"ansible_facts": {}, "ansible_included_var_files": [], "changed": false, "message": "Could not find or access 'Pengwin.yml'\nSearched in:\n\t/c/
Users/marko/Projects/github.com/markosamuli/linux-machine/playbooks/roles/markosamuli.golang/vars/Pengwin.yml\n\t/c/Users/marko/Projects/github.com/markosamuli/linux-machine/pl
aybooks/roles/markosamuli.golang/Pengwin.yml\n\t/c/Users/marko/Projects/github.com/markosamuli/linux-machine/playbooks/roles/markosamuli.golang/tasks/vars/Pengwin.yml\n\t/c/Use
rs/marko/Projects/github.com/markosamuli/linux-machine/playbooks/roles/markosamuli.golang/tasks/Pengwin.yml\n\t/c/Users/marko/Projects/github.com/markosamuli/linux-machine/play
books/vars/Pengwin.yml\n\t/c/Users/marko/Projects/github.com/markosamuli/linux-machine/playbooks/Pengwin.yml on the Ansible Controller.\nIf you are using a module and expect th
e file to exist on the remote, see the remote_src option"}
❯ cat /etc/os-release
PRETTY_NAME="Pengwin" 
NAME="Pengwin"
ID=debian
HOME_URL="https://github.com/whitewaterfoundry/Pengwin"
SUPPORT_URL="https://github.com/whitewaterfoundry/Pengwin"
BUG_REPORT_URL="https://github.com/whitewaterfoundry/Pengwin"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.