Files
everything-claude-code/.kiro/steering/golang-patterns.md
Himanshu Sharma bacc585b87 Add Kiro steering files, hooks, and scripts (#812)
Co-authored-by: Sungmin Hong <hsungmin@amazon.com>
2026-03-22 21:55:47 -07:00

966 B

inclusion, fileMatchPattern, description
inclusion fileMatchPattern description
fileMatch *.go Go-specific patterns including functional options, small interfaces, and dependency injection

Go Patterns

This file extends the common patterns with Go specific content.

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
}

Small Interfaces

Define interfaces where they are used, not where they are implemented.

Dependency Injection

Use constructor functions to inject dependencies:

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

Reference

See skill: golang-patterns for comprehensive Go patterns including concurrency, error handling, and package organization.