Template for a Go HTTP service with the basics and a pipeline from forgejo/ci-components (draft)
Find a file
Sander van Thillo b46d3992e2
All checks were successful
CI / vulnerabilities (push) Successful in 12s
CI / image (push) Successful in 13s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 23s
ci: put the complete pipeline in the repository
The pipeline was a call to a reusable workflow with many inputs. It is now a readable workflow that a team can copy and change. It uses only the actions checkout and ko-build of forgejo/ci-components.
2026-11-13 21:15:34 +01:00
.forgejo ci: put the complete pipeline in the repository 2026-11-13 21:15:34 +01:00
cmd/server feat: draft of the Go template 2026-11-13 20:59:26 +01:00
.dockerignore feat: draft of the Go template 2026-11-13 20:59:26 +01:00
.editorconfig feat: draft of the Go template 2026-11-13 20:59:26 +01:00
.gitignore feat: draft of the Go template 2026-11-13 20:59:26 +01:00
.golangci.yml feat: draft of the Go template 2026-11-13 20:59:26 +01:00
go.mod feat: draft of the Go template 2026-11-13 20:59:26 +01:00
README.md ci: put the complete pipeline in the repository 2026-11-13 21:15:34 +01:00
renovate.json ci: put the complete pipeline in the repository 2026-11-13 21:15:34 +01:00

$REPO_OWNER/$REPO_NAME

$REPO_DESCRIPTION

A Go HTTP service, made from the template forgejo/template-go.

Start

The template has its own module path. Give the module the path of this repository once:

go mod edit -module code.digitaledienst.overheid.nl/$REPO_OWNER/$REPO_NAME

Then build, test and run:

go test ./...
go run ./cmd/server        # listens on :8080; set ADDR to change it
curl localhost:8080/healthz

Pipeline

.forgejo/workflows/ci.yml is the complete pipeline. Copy it and change it as you need. It uses two actions of forgejo/ci-components: checkout and ko-build.

Event What happens
Pull request golangci-lint, go vet, go test -race and govulncheck in parallel, then the image is built without a push
Push to main The same, and the image is pushed as <short sha>-main-<run number>
Tag vX.Y.Z Also the image X.Y.Z

The image is code.digitaledienst.overheid.nl/$REPO_OWNER/$REPO_NAME. It is built with ko, from ./cmd/server, without a Dockerfile, and has an SBOM. The push uses the organisation secrets REGISTRY_USER and REGISTRY_TOKEN. Ask a site administrator if your organisation does not have them.

Files

File Purpose
.editorconfig Tabs for Go, 2 spaces for the rest
.gitignore, .dockerignore Build and test output, local configuration
.golangci.yml The linters
renovate.json The shared Renovate presets, and the tags of the actions of forgejo/ci-components