Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:1broseidon Ketch Go Toolchain

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Build
Last Updated 2026-10-27 00:00 GMT

Overview

Cross-platform Go 1.26 build environment with CGO_ENABLED=0, producing static binaries for darwin/linux/windows on amd64 and arm64.

Description

This environment is the build and development context for the ketch CLI. It is a pure-Go toolchain: CGO_ENABLED=0 is enforced by `goreleaser` and by the project's quality standards, so every release binary is statically linked and cross-compiles to every target OS/arch without a C toolchain. The `go.mod` declares `go 1.26.9`. There is no CUDA, no native GPU, and no system C library dependency — the only "hardware" requirement is a machine that can run the Go compiler.

The same toolchain builds the npm-distributed binary (the `npm/build.mjs` per-platform packager downloads the goreleaser artifact for the host platform) and the `curl|sh` installer. Development additionally needs `golangci-lint` (gocyclo max 15) and `git` for the pre-commit hooks.

Usage

Use this environment for any build, test, lint, or release workflow against the ketch repository. It is the mandatory prerequisite for the goreleaser cross-compile step, the CI lint+test job, and the pre-commit hook. A developer running `go test ./...` or `make lint` needs only this environment; no browser, no API keys, and no cache database are required to build or run the unit tests.

System Requirements

Category Requirement Notes
OS Linux / macOS / Windows Cross-compile targets; dev host can be any of them
Hardware Any CPU amd64 or arm64; no GPU, no minimum RAM beyond the Go compiler's needs
Disk ~200 MB Go module cache + build artifacts

Dependencies

System Packages

  • `go` = 1.26.9 (declared in `go.mod`)
  • `git` (for version stamping via ldflags and pre-commit hooks)
  • `golangci-lint` (gocyclo max 15; enforced by `make lint` and CI)

Go Modules (direct, from go.mod)

  • `github.com/spf13/cobra` v1.10.2
  • `github.com/go-rod/rod` v0.116.2
  • `github.com/modelcontextprotocol/go-sdk` v1.5.0
  • `go.etcd.io/bbolt` v1.4.3
  • `github.com/PuerkitoBio/goquery` v1.12.0
  • `github.com/JohannesKaufmann/html-to-markdown/v2` v2.5.0
  • `github.com/google/jsonschema-go` v0.4.2
  • `github.com/ledongthuc/pdf` v0.0.0-20250511090121
  • `golang.org/x/net` v0.61.0
  • `codeberg.org/readeck/go-readability/v2` v2.1.1

Build Flag

  • `CGO_ENABLED=0` — mandatory for cross-compilation; set in `.goreleaser.yaml`

Credentials

No credentials are required to build, test, or lint. Release publishing uses GitHub secrets (`GITHUB_TOKEN`, `WINGET_TOKEN`) handled by the release workflow, not the build environment.

Quick Install

# Go toolchain (adjust for your OS package manager)
# Requires Go >= 1.26.9
go version

# Lint tool
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# Build the binary (pure Go, no CGO)
CGO_ENABLED=0 go build -o ketch .

# Run the full test suite
go test ./...

# Lint (gocyclo max 15, enforced in CI and pre-commit)
make lint

Code Evidence

Go version directive from `go.mod:3`:

module github.com/1broseidon/ketch

go 1.26.9

CGO-disabled build posture from `.goreleaser.yaml:9-17`:

builds:
  - id: ketch
    main: .
    binary: ketch
    env:
      - CGO_ENABLED=0
    goos:
      - darwin
      - linux
      - windows
    goarch:
      - amd64
      - arm64

Quality standard from `CLAUDE.md`:

- golangci-lint run must pass (gocyclo max 15)
- go test ./... must pass
- CGO_ENABLED=0 — pure Go, cross-compile everywhere

Common Errors

Error Message Cause Solution
`go: command not found` Go not installed Install Go 1.26.9+ from go.dev or your package manager
`build fails: C compiler "gcc" not found` CGO enabled by a cgo-tagged dependency Set `CGO_ENABLED=0`; all deps must be pure Go
`golangci-lint: command not found` Linter not installed `go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest`
`gocyclo: function ... is too complex` Cyclomatic complexity > 15 Refactor the function; the limit is hard in CI

Compatibility Notes

  • CGO_ENABLED=0 is mandatory: a cgo dependency would break cross-compilation to OS/arch pairs without a matching C toolchain. All dependencies are pure Go.
  • Windows builds are cross-compiled from Linux/macOS without a Windows toolchain; the archive format is `zip` (overridden in goreleaser) for winget compatibility.
  • arm64 is a first-class target (Apple Silicon, Linux arm64); no separate build matrix is needed because CGO is off.
  • The `go 1.26.9` directive in `go.mod` is a minimum; newer Go toolchains build the module.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment