golang-build
Cross-platform build script for Go projects using a build.go file at the repository root.
Skill by samber
Chalk Labs
Need help deploying golang-build?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/paulohgodinho-golang-build
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-build
Tools it pre-approves 9
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
ReadEditWriteGlobGrepBash(go:*)Bash(golangci-lint:*)Bash(git:*)Agent
What's inside
- Skill name
golang-build- Description
- Cross-platform build script for Go projects using a build.go file at the repository root. Use when building the project, setting up cross-compilation, running go build for multiple targets, or asking about CGO_ENABLED, build flags, target platforms (linux/amd64, windows/amd64, darwin/arm64), or how to automate builds without a Makefile. Also triggers when the user mentions build.go, go run build.go, or cross-compiling Go binaries.
- License
- MIT
- Compatibility
- Designed for Claude Code or similar AI coding agents, and for projects using Golang.
- Allowed tools
- Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent
- Metadata
- author: samber · version: 1.0
- Instructions
- 91 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (2)
- SKILL.md
- build.go · assets/
SKILL.md (first lines)
**Persona:** Go build engineer — reproducible, static, cross-compiled binaries with zero external tooling.
# Go Build
## The build.go Convention
Every Go project should have a `build.go` file at the **root of the repository** (not inside `cmd/`). This file is a plain Go program that cross-compiles the project for all target platforms. It requires no external tools — only the Go toolchain.
Run it with:
```sh
go run build.go
```
The template is provided in [assets/build.go](assets/build.go). Copy it to the root of the project and adapt it to the project's needs.
## Default Configuration
The default `build.go` ships with the following settings:
| Setting | Default | Reason |
| --- | --- | --- |
| `CGO_ENABLED` | `0` | Produces fully static binaries; required for cross-compilation without a C cross-compiler |
| `linux/amd64` | ✅ | Standard server target |
| `windows/amd64` | ✅ | Standard Windows desktop/server target |
| `darwin/arm64` | ✅ | Apple Silicon Mac target |
## Customising the Build Script
All knobs are at the top of `build.go`:
### Change the Binary Name
```go
const (
BinaryName = "myapp" // ← rename to match the project
C_GO_ENABLED = 0
)
```
### Add or Remove Target Platforms
```go
var platforms = []struct {
OS string
Arch string
}{
{"linux", "amd64"},
{"windows", "amd64"},
{"darwin", "arm64"},
// {"darwin", "amd64"}, // Intel Mac
// {"linux", "arm64"}, // ARM server / Raspberry Pi
}
```
### Add Build Flags
Uncomment or add entries in `buildOptions`:
```go
var buildOptions = []string{
"-o", BinaryName,
// "-v", // verbose output
// "-trimpath", // remove local file paths from binary
// "-ldflags", "-s -w", // strip debug symbols (smaller binary)
// "-ldflags", "-X main.version=1.2.3", // embed version string
}
```
### Enable CGO
Only enable CGO if the project requires C bindings (e.g., sqlite3, certain crypto libs). Cross-compilation with CGO requires a C cross-compiler per target platform.
```go
const C_GO_ENABLED = 1 // requires C toolchain for each target
```
## Common Mistakes
| Mistake | Fix |
| --- | --- |
| Placing `build.go` inside `cmd/` | Keep it at the repository root — it builds the whole project |
| Using `CGO_ENABLED=1` without a cross-compiler | Either disable CGO or install the correct C toolchain for each target |
| Hardcoding the output path without platform suffix | When building for multiple platforms simultaneously, append `_OS_ARCH` to `BinaryName` to avoid overwriting |
| Forgetting `-trimpath` for release builds | Release binaries should not embed developer machine paths |
## Related Skills
- → See [golang-project-layout](../golang-project-layout/SKILL.md) for where build.go fits in the overall project structureFrom paulohgodinho/skills, MIT.
More from paulohgodinho/skills
- 0.414score
golang-project-layout
samber
Provides a guide for setting up Golang project layouts and workspaces.
SkillDFreshness: DClaude Code +9 - 0.414score
golang-code-style
samber
Golang code style, formatting and conventions.
SkillDFreshness: DClaude Code +9 - 0.414score
golang-dependency-injection
samber
Comprehensive guide for dependency injection (DI) in Golang.
SkillDFreshness: DClaude Code - 0.414score
golang-design-patterns
samber
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown…
SkillDFreshness: DClaude Code +9 - 0.414score
golang-naming
samber
Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters…
SkillDFreshness: DClaude Code +9 - 0.410score
golang-lint
samber
Provides linting best practices and golangci-lint configuration for Go projects.
SkillDFreshness: DClaude Code +9 - 0.409score
golang-structs-interfaces
samber
Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via…
SkillDFreshness: DClaude Code +9 - 0.409score
golang-cli
samber
Golang CLI application development.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 4, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0
- License
- MIT
- Repository
- github.com/paulohgodinho/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from samber
- 0.563score
golang-design-patterns
samber
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-performance
samber
Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-security
samber
Security best practices and vulnerability prevention for Golang.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-testing
samber
Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-documentation
samber
Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and…
SkillBFreshness: B★ 2Claude Code - 0.534score
golang-concurrency
samber
Golang concurrency patterns.
SkillCFreshness: C★ 5Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get golang-build running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
golang-build skill. Agent Mart. https://agentmart.dev/skills/paulohgodinho-golang-build (last updated 2026-10-24)