Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

918 B
Raw Blame

paths: - "/*.go" - "/go.mod" - "**/go.sum"

Patrones de Go

Este archivo extiende common/patterns.md con contenido específico de Go.

Functional Options

type Option func(*Server)

func WithPort(port int) Option {
    return func(s *Server) { s.port = port }
}

func NewServer(opts ...Option) *Server {
    s := &Server{port: 8080}
    for _, opt := range opts {
        opt(s)
    }
    return s
}

Interfaces Pequeñas

Definir las interfaces donde se usan, no donde se implementan.

Inyección de Dependencias

Usar funciones constructor para inyectar dependencias:

func NewUserService(repo UserRepository, logger Logger) *UserService {
    return &UserService{repo: repo, logger: logger}
}

Referencia

Ver skill: golang-patterns para patrones completos de Go incluyendo concurrencia, manejo de errores y organización de paquetes.