Go Makefile
MAIN_FILE=cmd/cmd-name/main.go
BINARY_NAME=main
BINARY_FOLDER=bin
TEST_COVERAGE_FILE=coverage.out
build: build_linux build_windows
build_linux:
GOARCH=amd64 GOOS=linux go build -o ${BINARY_FOLDER}/${BINARY_NAME}-linux ${MAIN_FILE}
build_windows:
GOARCH=amd64 GOOS=windows go build -o ${BINARY_FOLDER}/${BINARY_NAME}-windows ${MAIN_FILE}
clean:
go clean
rm ${BINARY_FOLDER}/${BINARY_NAME}-linux
rm ${BINARY_FOLDER}/${BINARY_NAME}-windows
rm ${TEST_COVERAGE_FILE}
run:
go run ${MAIN_FILE}
test:
go test -race ./...
test_coverage:
go test ./... -coverprofile=${TEST_COVERAGE_FILE}
format:
go fmt ./...
tidy:
go mod tidy
vet:
go vet ./...
why:
go mod why -m $(module)
ready: tidy format test vet
Genreal Aliases
# For listing folders
alias l="ls -al"
# To open vscode from any folder
alias e="code"
# open and edit my bashrc file in vscode
alias ebash="e ~/.bashrc"
# Apply my bashrc changes to current bash session
alias sbash="source ~/.bashrc
Kubernetes Aliases
# Kubectl: simple alias to the kubectl command
alias k="kubectl"
# KubectlGetPods: get all the pods for the current namespace
alias kgp="k get pods"
# KubectlSearchPods: find a specific pod. example: "ksp promethius"
alias ksp="kgp | grep"
# KubectlGetDeployment: get all the deployments
alias kgd="k get deployments"
# KubectlSearchDeployment: find a specific deployment. example: "ksd promethius"
alias ksd="kgd | grep"
# KubectlGetNamespaces: get all the namepsaces
alias kgn="k get namespaces"
# KubectlSearchNamespaces: find a specific namespace. example: "ksn system"
alias ksn="kgn | grep"
# KubectlGetConfigmap: get all of the configmaps
alias kgcm="k get cm"
# KubectlSearchConfigmap: find a specific configmaps. Example: "kscm promethius"
alias kscm="kgcm | grep"
# KubectlGetServies: Get all the services for the current namespace
alias kgs="k get services"
# KubectlSearchServices: Find a specific service. Example: "kss promethius"
alias kss="kgs | grep"
# KubectlEditService: Edit a service: Example: "kes promethius"
alias kes="k edit services"
# KubectlGetVirtualservices: Gets all of the virtualservices
alias kgvs="k get virtualservices"
# KubectlSearchVirtualservices: find a specific virtualservice
alias ksvs="kgvs | grep"
# KubectlEditVirtualservice: Edit a specific virtual service
alias kevs="k edit virtualservices"
Kubernetes Functions
# KubectlCluster: set the cluster context
kc() {
k config use-context kubelet-cluster.$1
}
#KubectlNamespace: set the namespaces globally
kn() {
k config set-context --current --namespace=$1
}
Kubernetes Variable
Use Vscode when editing kubernetes files
export EDITOR='code --wait'
Maven Aliases
# MavenInstall: doing a clean install
alias mi="clear && mvn clean install"
# MavenInstallSkip: do a clean install but skip tests
alias mis="clear && mvn clean install -DskipTests"
# MavenReleaseTest: Do a test/dryrun release to insure everything is functional.
alias mrelt="mvn release:clean release:prepare -DpushChanges=false -DdryRun=true"
# MavelRelease: run the maven release procedures
alias mrel="mvn release:clean release:prepare -DpushChanges=false"