gopher-labs

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 1 Imported by: 0

README

gopher-labs

ci Go Reference

My Golang laboratory experiments ⏳

labs

myargo
# lists argo-cd applications
go run labs.go myargo list

# submits argo workflow
go run labs.go myargo submit
myaws
make local-up

curl http://localhost:4566/health | jq

# verify hooks
curl -s localhost:4566/_localstack/init | jq .

# create (see entrypoint folder)
docker exec -it go-dev aws --endpoint-url=http://localstack:4566 sqs create-queue \
  --queue-name go-sqs-example

# list
docker exec -it go-dev aws --endpoint-url=http://localstack:4566 sqs list-queues
docker exec -it go-localstack awslocal sqs list-queues

# produce
docker exec -it go-dev aws --endpoint-url=http://localstack:4566 sqs send-message \
  --queue-url http://localstack:4566/000000000000/go-sqs-example \
  --message-body "hello"

# consume
docker exec -it go-dev aws --endpoint-url=http://localstack:4566 sqs receive-message \
  --queue-url http://localstack:4566/000000000000/go-sqs-example

go run labs.go myaws --name sqs-write
go run labs.go myaws --name sqs-read
myconcurrency
# uses goroutine and channels
go run labs.go myconcurrency
myconfig
# prints config examples
go run labs.go myconfig
mydocker
go run labs.go mydocker --name [list|run|attach]
myhttp
docker run -p 8080:80 kennethreitz/httpbin

go run labs.go myhttp --name [client|server]
mykube
# local cluster
minikube start --driver=docker --embed-certs
minikube delete --all

go run labs.go mykube --name [list|exec]

# setup portforward example
# minikube kubectl -- apply -f ./data/install-alpine-xfce-vnc.yaml
go run labs.go mykube --name create

# vncviewer localhost:5900
# http://localhost:6080
go run labs.go mykube --name portforward

# pre-download to solve issue: ErrImagePull (120 seconds timeout)
minikube image load edgelevel/alpine-xfce-vnc:web-0.6.0
mylog
# zap logging examples
go run labs.go mylog
myschema
# json and yaml schema validation
go run labs.go myschema
myspinner
go run labs.go myspinner
myssh
# start server
go run labs.go myssh server

# test
nc 127.0.0.1 2222

# connect with openssh
ssh-keygen -f ~/.ssh/known_hosts -R "[localhost]:2222"
ssh -o StrictHostKeyChecking=no foo@localhost -p 2222

# connect with client
go run labs.go myssh client
version
# git version
go run \
  -ldflags="-X github.com/niqdev/gopher-labs/internal.Version=$(git rev-parse HEAD)" \
  labs.go version

Resources

Development

Install

# ubuntu
sudo snap install --classic go

# macos
brew install go

# update version
go mod edit -go 1.21

Setup

# init project (first time)
go mod init github.com/niqdev/gopher-labs

# update dependencies
go mod tidy

# install dependencies (examples)
go get github.com/argoproj/argo-cd/v2
go get github.com/argoproj/argo-workflows/v3
go get -u github.com/hashicorp/go-retryablehttp
go get github.com/onsi/ginkgo/v2
go get github.com/onsi/gomega/...
go get github.com/aws/aws-sdk-go-v2
go get github.com/aws/aws-sdk-go-v2/config
go get github.com/aws/aws-sdk-go-v2/service/sqs
go mod vendor

# run
go run labs.go

# list recipes
just

# build
just build
./build/labs

# test
just test

Publish

git tag vX.Y.Z
git push origin --tags

# refresh index
GOPROXY=proxy.golang.org go list -m github.com/niqdev/gopher-labs@vX.Y.Z

# install
go get github.com/niqdev/gopher-labs

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL