golang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust, readable, and maintainable Go code. Use when writing, reviewing, or refactoring Go (APIs, packages, errors, interfaces, concurrency, code style), choosing a dispatch or plugin mechanism, or building low-level/offensive Go wi
v2026.11.13-21cd5683 instalaciones+3 en 7 días39 EstrellasMITsincronizado hace 10 horas
Instalar
¿Aún no tienes la CLI de NotHoly? Instálala primero.
$ curl -fsSL https://notholy.com/install.sh | sh$ notholy skills install aeondave/golang-patternsEscribe en ~/.notholy/skills después de comprobar la firma y el SHA-256.
FirmaFirmado, ed25519
Paquete13b96c40…83d344dd
13b96c40d986…a61e83d344dd14 archivos · 29.4 KBEscaneoBajo1 hallazgo
- Enlaces a dominios externos
Fuentegithub.com/AeonDave/malskill/tree/main/coding/golang-patterns@21cd568
Esta entrada todavía no está escrita en tu idioma, así que aparece en English.
En esta página
This skill focuses on idiomatic Go design and code review guidance.
If your task is primarily measurement/profiling/optimization, use golang-performance.
When to activate
- Writing new Go code (packages, APIs, services)
- Reviewing PRs for idioms, readability, and maintainability
- Refactoring for cleaner error handling and smaller interfaces
- Designing concurrency flows with cancellation and backpressure
- Choosing a dispatch/plugin mechanism, adding modules to a compiled binary, or building low-level/offensive Go tooling
Core principles (high signal)
- gofmt is non-negotiable. Style debates end at
gofmt. - Prefer clarity: small functions, early returns, explicit control flow.
- Make the zero value useful.
- Keep interfaces small; define them where they’re consumed.
- Handle errors explicitly; wrap with context; avoid
panicfor control flow. - Concurrency should be bounded and cancellable; avoid goroutine leaks.
Outcome expectations
- Public APIs are small, explicit, and boring to maintain.
- Error handling is consistent and machine-checkable with
errors.Is/errors.AsType. - Concurrency flows always have cancellation and backpressure.
- Tooling baseline (
gofmt, tests, vet/race) is easy to run in CI.
Recommended workflow
- Define package boundary + API contracts (inputs, outputs, errors) first.
- Implement with small functions and explicit control flow.
- Add context propagation and cancellation checks on blocking operations.
- Run formatting/tests/vet/race before review.
- Review for leaks, hidden globals, and interface over-abstraction.
Quick review checklist
- Naming: MixedCaps for exported, no underscores, packages short and lower-case
- Errors:
fmt.Errorf("context: %w", err),errors.Is/errors.AsType(Go 1.26+) used correctly - Context:
ctxis first param; cancellation propagates; nocontext.Contextstored in structs - Interfaces: accept interfaces, return concrete types; no “kitchen-sink” interfaces
- Concurrency: goroutines have a stop condition; channels are closed by senders; backpressure exists
- Tooling:
go test ./...,go test -race ./...,go vet ./...
Common anti-patterns to reject
- Storing
context.Contextin structs - Unbounded goroutine fan-out in request paths
- Catch-all interfaces like
Doer,Manager,Servicewithout clear boundary - Returning wrapped errors without enough domain context
- Package-level mutable state hidden behind helper functions
Resources
Load on demand (progressive disclosure):
references/effective-go.md— distilled Effective Go + Code Review Comments pointersreferences/language.md— load when using loop-var/range-over-func semantics,new(expr), self-referential constraints, generic methods, embedded-field keys, or 1.27 type inferencereferences/json-v2.md— load when adding or migrating JSON (encoding/jsonvsencoding/json/v2,omitzero, stricter defaults)references/errors.md— wrapping, sentinel vs typed errors,errors.AsType, validation, retryable errorsreferences/interfaces.md— interface placement, design patterns, optional behavior, generic-method vs interface-method rulereferences/concurrency.md— cancellation, errgroup, leaks, worker pools, backpressure, timer-channel semanticsreferences/api-and-structs.md— receiver rules, functional options, embedding, ServeMux patternsreferences/package-layout.md— project layout, package naming, dependency injectionreferences/tooling.md— gofmt/goimports, vet,go fix, language version via thegodirectivereferences/security-review.md— use when auditing Go for security bugs: untrusted input, panics/DoS, TLS defaults, secrets, supply chain (govulncheck,gosec)references/unsafe-cgo.md— use forunsafe.Pointerrules,syscall/x/sys, cgo boundaries, and static/cross-compiled offensive-tooling buildsreferences/dispatch-and-plugins.md— use when choosingdyninterfaces vs enum dispatch, building registries and command dispatchers, or adding modules to a compiled binary (plugin,hashicorp/go-plugin,wazero/extism,yaegi,selfupdate,tableflip)references/offensive-lowlevel.md— use for RE-resistance, symbol/metadata stripping,garble/GoReSym, string obfuscation, syscall dispatch strategy, and in-memory execution
Archivos de esta versión
references/1367.0 KB
- api-and-structs.md1.8 KB
- concurrency.md4.3 KB
- dispatch-and-plugins.md11.1 KB
- effective-go.md3.9 KB
- errors.md3.0 KB
- interfaces.md1.9 KB
- json-v2.md3.9 KB
- language.md5.6 KB
- offensive-lowlevel.md11.1 KB
- package-layout.md814 B
- security-review.md8.7 KB
- tooling.md2.3 KB
- unsafe-cgo.md8.6 KB
- SKILL.md5.0 KB
Permisos
| Permiso | Declarado | Hallado en el escaneo |
|---|---|---|
| Lee archivos | No | No |
| Escribe archivos | Sí | Sí |
| Ejecuta comandos de shell | Sí | Sí |
| Usa la red | Sí | Sí |
| Usa conectores | No | No |
| Controla un navegador | No | No |
Hallazgos del escaneo
Revisado el 13 nov 2026
- InfoEnlace · Enlaces a dominios externos
Un escaneo limpio baja el riesgo, pero no prueba que el paquete sea seguro. Lee lo que instalas.
| Versión | Publicada | Commit | SHA-256 | Firma | Cambio de permisos |
|---|---|---|---|---|---|
| v2026.11.13-21cd568 | 13 nov 2026 | 21cd568 | 13b96c40 | Firmada | – |
Más de AeonDave
Todo de este publicadorMás en APIs, SaaS e identidad
Ver la categoría- testing-for-sensitive-data-exposuremukul975/testing-for-sensitive-data-exposure5
- performing-jwt-none-algorithm-attackmukul975/performing-jwt-none-algorithm-attack5
- sharp-edgestrailofbits/sharp-edges4
- hydraaeondave/hydra4
- implementing-google-workspace-admin-securitymukul975/implementing-google-workspace-admin-security4
- implementing-api-security-posture-managementmukul975/implementing-api-security-posture-management4
Pregunta todo lo que tu alcance permite.
Crea la cuenta, añade créditos y haz la primera pregunta en el chat o en la terminal.
- 1/3
Crea la cuenta
Individual o empresa. Puedes pasar a empresa después sin perder saldo ni claves.
IndividualEmpresa - 2/3
Añade créditos
Con tarjeta. Pagas por token, sin suscripción.
$5.00recarga mínima - 3/3
Pregunta
En el chat, o instala el CLI y ejecuta notholy login en tu terminal.
$ notholy login