-
-
Save NirantK/7f83f57e83552c3dba45e40cbf944c9f to your computer and use it in GitHub Desktop.
Set GOPATH, GOBIN, and PATH in current directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Sets the GOPATH and GOBIN to the current directory. | |
# Adds GOBIN to the PATH. | |
# | |
# Usage: | |
# 1. Put this script somewhere on your PATH. | |
# 2. Enter directory of a golang project (contains src, pkg, bin) | |
# 3. Execute: . gopath | |
# | |
export GOPATH="`pwd`" | |
echo "GOPATH set to: ${GOPATH}" | |
export GOBIN="$GOPATH/go/bin" | |
echo "GOBIN set to: ${GOBIN}" | |
export PATH="${PATH}:${GOBIN}" | |
echo "Added GOBIN to PATH for the current session" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment