Last active
January 21, 2022 06:22
-
-
Save ilovejs/0883f2a775847ec871252dbfe6a95b23 to your computer and use it in GitHub Desktop.
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
# workspace | |
export GOPATH=$HOME/go # mkdir that one | |
export GOROOT=/usr/local/go # native src | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | |
export GO111MODULE=on | |
# use the network to update the named packages and dependencies | |
# gou https://github.com/hashicorp/nomad | |
function go-update() { | |
local in="$1" | |
go get -u -v "${in:8:${#in}-1}" | |
} | |
# go-get https://github.com/hashicorp/nomad | |
# easy paste from browser | |
function go-get() { | |
local in="$1" | |
go get -v "${in:8:${#in}-1}" | |
} | |
function go-run-env(){ | |
export $(egrep -v '^#' .env | xargs) | |
echo ".env parsed" | |
go run main.go | |
} | |
// switch nexus proxy or default public one | |
function go-pub() { | |
if [[ "$GONOPROXY" = "none" ]]; then | |
GOPROXY=https://nexus.xxxxxxxxxxxxxxxxxxxxxx.io/repository/gonexus.dev/ | |
GOPRIVATE=github.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/prefixxxxxxxxxx-* | |
GONOPROXY=$GOPROXY # not download from priv (default) | |
echo "turn on private"; | |
else | |
GOPROXY=none | |
GOPRIVATE=none | |
GONOPROXY=none | |
go env -w GOPRIVATE="" | |
go env -w GOPROXY="" | |
echo "turn off private" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment