Skip to content


Export GO variables to install go modules locally


Export GOPATH to directory environment to install GO modules locally to the directory environment if not defined by the user in .envrc.ini. Also created pkg, src and bin. Make every binary already installed in the GOPATH acessible from the command line by creating a symlinks to .direnv/bin/ for each of them.

Parameters in .envrc.ini are:

Name Description
GOPATH (optional) Absolute path to the go directory, default is .direnv/tmp/go



Absolute path where the go directory will be created. Default is set to ${DIRENV_ROOT}/.direnv/tmp/go. User can use path contraction like ~, ${HOME} or ${DIRENV_ROOT}

.envrc.ini example

Corresponding entry in .envrc.ini.template are:

# Go management module
# ------------------------------------------------------------------------------
# Update GOPATH to install go modules locally
# Specify the path to the go directory

Last update: April 23, 2021
Back to top