Create a GO development environment with [Mac OS Big Sur]

I had to use GO, so I created an environment with Mac OS Big Sur.

Contents

--Installing goenv --go installation

install goenv

Initially, I would like to install with brew install goenv, I installed it with Git because the version was old.

% git clone https://github.com/syndbg/goenv.git ~/.goenv

Since the shell uses zsh, we set environment variables.

% echo 'export GOENV_ROOT="$HOME/.goenv"' >> ~/.zshrc
% echo 'export PATH="$GOENV_ROOT/bin:$PATH"' >> ~/.zshrc
% echo 'eval "$(goenv init -)"' >> ~/.zshrc

Restart the shell for the environment variables to take effect.

% exec $SHELL

Check the version of goenv.

% goenv -v
goenv 2.0.0beta11

install go

Check the version of go that can be installed.

% goenv install -l
Available versions:
  1.2.2
  1.3.0
    :
  1.15.4
  1.15.5
  1.15.6
  1.16beta1

Install go by specifying the version.

% goenv install 1.15.6

Since the shell uses zsh, we set environment variables.

% echo 'export PATH="$GOROOT/bin/$PATH"' >> ~/.zshrc 
% echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.zshrc 
% exec $SHELL

At this point, the following settings should have been added to ~/.zshrc.

export GOENV_ROOT="$HOME/.goenv"
export PATH="$GOENV_ROOT/bin:$PATH"
eval "$(goenv init -)"
export PATH="$GOROOT/bin/$PATH"
export PATH="$PATH:$GOPATH/bin"

Specify the version of GO to use.

% goenv global 1.15.6

Check the GO version.

% go version
go version go1.15.6 darwin/amd64

I want to specify the location of the project arbitrarily, so set Go Modules. First, check the Go Modules settings.

% go env GO111MODULE

If it is set, on will be displayed, but it will not be displayed, so set it.

% go env -w GO111MODULE=on
% go env GO111MODULE
on

Now that the GO environment has been created, Let's proceed with go mod init <project name>.

Recommended Posts

Create a GO development environment with [Mac OS Big Sur]
Create a development environment for Go + MySQL + nginx with Docker (docker-compose)
[Note] How to create a Mac development environment
Create a python development environment with vagrant + ansible + fabric
Build a Python development environment on Mac OS X
Create a Python development environment on OS X Lion
Create a Python development environment in 10 minutes (Mac OS X + Visual Studio Code)
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
Create a Python environment on Mac (2017/4)
Create a virtual environment with Python!
Create a simple Python development environment with VSCode & Docker Desktop
Create a simple Python development environment with VS Code and Docker
Mac OS X Mavericks 10.9.5 Development environment construction
Easily build a development environment with Laragon
Create a python environment on your Mac
[Python] Create a virtual environment with Anaconda
Create a virtual environment with Python_Mac version
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
I tried to build a Mac Python development environment with pythonz + direnv
Build a C language development environment with a container
Go (Echo) Go Modules × Build development environment with Docker
Create a virtual environment with conda in Python
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Build a Python development environment on your Mac
Build a Django development environment with Doker Toolbox
[Note] How to create a Ruby development environment
Mac OS X Mountain Lion 10.8.5 Development environment construction
Create a Python virtual development environment on Windows
Get a quick Python development environment with Poetry
Create a Python environment
Build a Django development environment using pyenv-virtualenv on Mac
Build a local development environment for Laravel6.X on Mac
Repairing a broken development environment with mavericks migration (Note)
Create a virtual environment with Anaconda installed via Pyenv
Build a machine learning Python environment on Mac OS
Create a comfortable Python 3 (Anaconda) development environment on windows
code-server Online environment (2) Create a virtual network with Boto3
Build a machine learning application development environment with Python
How to build a development environment for TensorFlow (1.0.0) (Mac)
Building a Python environment for programming beginners (Mac OS)
Create a Japanese OCR environment with Anaconda (tesseract + pyocr)
Build a development environment with Poetry Django Docker Pycharm
Set up a Python development environment with Sublime Text 2
Create a django environment with docker-compose (MariaDB + Nginx + uWSGI)
Create a machine learning environment from scratch with Winsows 10
Steps to quickly create a deep learning environment on Mac with TensorFlow and OpenCV
Create an environment with virtualenv
Build a Django development environment with Docker! (Docker-compose / Django / postgreSQL / nginx)
Set up a Python development environment with Visual Studio Code
[Memo] Build a development environment for Django + Nuxt.js with Docker
Create a homepage with django
I want to set up a GUI development environment with Python or Golang on Mac
Prepare Python development environment with Mac + Windows + VisualStudio Code (Windows version)
[Django] Build a Django container (Docker) development environment quickly with PyCharm
Prepare Python development environment with Mac + Windows + VisualStudio Code (Mac version)
Build a comfortable development environment with VSCode x Remote Development x Pipenv
Get a clean Python development environment with pyenv + pipx + Poetry
How to build a python2.7 series development environment with Vagrant