-
-
Save leonmwandiringa/2bf9fd8d78a8ac2ce264ea72bf954d8e to your computer and use it in GitHub Desktop.
Set GOPATH, GOBIN, and PATH in current directory
This file contains hidden or 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/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