Build Skill
Use this skill when building binaries, running the app, or preparing docs artifacts.
Primary build command
- •Preferred build command (skip Swagger regeneration):
- •
make build DOCS=false
- •
- •This compiles
src/main.gointobin/onepixelfor current OS/arch.
Make targets and behavior
Defined in /home/runner/work/onepixel_backend/onepixel_backend/Makefile:
- •
docs:- •runs
swag init --pd -g server/server.go -d src --md src/docs -o src/docs - •regenerates files in
src/docs
- •runs
- •
build:- •builds one binary with detected/current
GOOS/GOARCH
- •builds one binary with detected/current
- •
build_all:- •produces linux/darwin/windows artifacts under
bin/
- •produces linux/darwin/windows artifacts under
- •
run:- •depends on
build, then executes./bin/onepixel
- •depends on
- •
clean:- •
go cleanand removesbin/*
- •
DOCS=false clears build dependency on docs; use it for faster/local CI-safe builds.
Prerequisites
- •Go toolchain compatible with
go.mod(Go 1.22 target). - •Optional (only if generating docs):
- •
swagCLI (go install github.com/swaggo/swag/cmd/swag@latest)
- •
- •Optional local dev hot-reload:
- •
air(go install github.com/air-verse/air@latest)
- •
Build verification checklist
- •From repo root, run
make build DOCS=false. - •Confirm binary exists at
bin/onepixel. - •If API annotations changed, regenerate docs (
make docs) and verifysrc/docs/*updates are intentional.
Local runtime options
- •
make runfor binary run flow. - •
airfor hot-reload using.air.toml. - •
docker-compose upfor containerized stack (app + postgres + clickhouse + metabase).
Common pitfalls
- •Running plain
makeexecutes first target (docs), which requiresswag. - •Host-based routing needs correct env values (
ADMIN_SITE_HOST,MAIN_SITE_HOST) to hit expected app path.