AgentStack
SKILL verified MIT Self-run

Go Formatting

skill-caraya-agent-skills-go-formatting · by caraya

Go formatting skill for gofmt, goimports, and IDE configuration. Trigger phrases: format Go, gofmt, goimports, code style, linting, format on save, golangci-lint.

No reviews yet
0 installs
4 views
0.0% view→install

Install

$ agentstack add skill-caraya-agent-skills-go-formatting

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Go Formatting? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Go Formatting

Use When

  • Setting up or validating code formatting for Go projects.
  • Configuring gofmt, goimports, and linters.
  • Integrating formatting into IDE or pre-commit hooks.

Standard Formatters

  1. gofmt (built-in)
  • Go's standard formatter; enforced by convention.
  • No configuration needed; opinionated about style.
  • Run: gofmt -w . to format in place.
  1. goimports (import management)
  • Extends gofmt to organize imports and add missing dependencies.
  • Removes unused imports automatically.
  • Install: go install golang.org/x/tools/cmd/goimports@latest.
  • Run: goimports -w . to format and organize imports.
  1. golangci-lint (comprehensive linting)
  • Aggregates multiple linters; catches style and logical issues.
  • Can auto-fix many issues with --fix flag.
  • Install: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest.

Configuration

.golangci.yml (golangci-lint):

linters:
  enable:
    - gofmt
    - goimports
    - vet
    - errcheck
    - staticcheck
    - unused

linters-settings:
  gofmt:
    simplify: true

VS Code .vscode/settings.json:

{
  "[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.fixAll": true
    },
    "editor.defaultFormatter": "golang.go"
  },
  "go.formatOnSave": true,
  "go.formatTool": "goimports",
  "go.lintOnSave": "package",
  "go.lintTool": "golangci-lint"
}

Checklist

  1. Consistency
  • gofmt baseline is applied (Go convention).
  • goimports is used to manage imports.
  • golangci-lint is configured and shared with team.
  1. IDE integration
  • Format-on-save is enabled in VS Code.
  • Go extension is installed and active.
  1. Pre-commit hooks
  • Use pre-commit framework or git hooks to run gofmt and goimports.
  • Prevents unformatted code from entering the repository.
  1. Import organization
  • goimports automatically removes unused imports.
  • Imports are grouped: stdlib, third-party, local.

Formatting Rules

  • Indentation: Tabs (Go standard, not spaces).
  • Line width: No hard limit; keep readable (convention is ~80 chars for exported docs).
  • Naming: camelCase for functions and variables, PascalCase for exported symbols.
  • Brackets: Opening bracket stays on same line as declaration (Go convention).

Common Commands

  • Format: gofmt -w ..
  • Format and organize imports: goimports -w ..
  • Check formatting: gofmt -d . (shows diffs without changing files).
  • Lint: golangci-lint run ./....
  • Lint and fix: golangci-lint run --fix ./....

Output Requirements

When setting up or validating formatting, provide:

  • Formatter versions and configuration.
  • IDE integration status.
  • Pre-commit hook setup summary.
  • Any conflicts or inconsistencies found.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.