This repository is template repository for golang developper in Saisho labo.
- Push
use this template
button in this repository. - Rename variables for your application. Here's the startup script.
(
export APPLICATION=your-application-name
export USER=your-user-name
export REPOSITORY=$USER/$APPLICATION
grep -l 'hello' Dockerfile .github/workflows/*.yaml | xargs sed -i.bak -e "s/hello/$APPLICATION/g"
grep -l 'sai-lab/go-template' * | xargs sed -i.bak -e "s@sai-lab/go-template@$REPOSITORY@g"
mv cmd/hello cmd/$APPLICATION
)
- Get your token for Github Packages.
User > Settings > Developper Settins > Personal access tokens > Generate new token
Checkwrite:packages
anddelete:packages
after click Generate token. - Copy your token and paste the token set your repository secret variables (name: CR_PAT).
Access Your Repository > Settings > Secrets > New Secrets
docker build -t ghcr.io/your-user-name/your-application-name .
docker run ghcr.io/your-user-name/your-application-name
make build
- Lint (
go vet
,golangci-lint
) - Unit Tests
- Publish library documents
- Build and push container image to
ghcr.io
- Vulnerability scanning in container image
Analysis your code staticly when each push.
tools
go vet
golangci-lint
Your application documents is generated by GitHub actions when your application released (ref: http://pkg.go.dev).
Build and push container image when you tagged a commit.
Container image tag format is ghcr.io/{{ owner }}/{{ application }}:{{ version }}
.
Scan Container image when each commits. If vulnerabilities are found, send alert message to your PR.
Put your application license.