Skip to content

Instantly share code, notes, and snippets.

@mvndaai
Last active July 23, 2025 18:46
Show Gist options
  • Save mvndaai/2f78868904e8c83381203abc5b2b8f40 to your computer and use it in GitHub Desktop.
Save mvndaai/2f78868904e8c83381203abc5b2b8f40 to your computer and use it in GitHub Desktop.
Bash commends
## This is just commands I find useful that I would like to keep
# Build and start go project
go build . && PORT=80 ./${PWD##*/}
# Open Go coverage in a website
go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out && go tool cover -html=coverage.out
## Put in ~/.zshrc
# Add go bins to path to run things addded by go install
export PATH=${PATH}:`go env GOPATH`/bin
# Allow go get to find private repos
export GOPRIVATE=github.com/<user/group>/*
### Aliases
alias gcover="go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out && go tool cover -html=coverage.out"
alias main_branch="git branch --remotes --list '*/HEAD' | cut -f3 -d/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment