chore: add agentic tooling, cleanup

This commit is contained in:
Flo
2026-03-30 12:59:23 +02:00
parent 7645402347
commit ebb42dbad7
40 changed files with 2066 additions and 2 deletions

44
.crosslink/rules/go.md Normal file
View File

@@ -0,0 +1,44 @@
### Go Best Practices
#### Code Style
- Use `gofmt` for formatting
- Use `golint` and `go vet` for linting
- Follow effective Go guidelines
- Keep functions short and focused
#### Error Handling
```go
// GOOD: Check and handle errors
func readConfig(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("reading config: %w", err)
}
var config Config
if err := json.Unmarshal(data, &config); err != nil {
return nil, fmt.Errorf("parsing config: %w", err)
}
return &config, nil
}
// BAD: Ignoring errors
func readConfig(path string) *Config {
data, _ := os.ReadFile(path) // Don't ignore errors
var config Config
json.Unmarshal(data, &config)
return &config
}
```
#### Concurrency
- Use channels for communication between goroutines
- Use `sync.WaitGroup` for waiting on multiple goroutines
- Use `context.Context` for cancellation and timeouts
- Avoid shared mutable state; prefer message passing
#### Security
- Use `html/template` for HTML output (auto-escaping)
- Use parameterized queries for SQL
- Validate all input at API boundaries
- Use `crypto/rand` for secure random numbers