Initial: Claude config with agents, skills, commands, rules and scripts
This commit is contained in:
34
rules/golang/security.md
Normal file
34
rules/golang/security.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
paths:
|
||||
- "**/*.go"
|
||||
- "**/go.mod"
|
||||
- "**/go.sum"
|
||||
---
|
||||
# Go Security
|
||||
|
||||
> This file extends [common/security.md](../common/security.md) with Go specific content.
|
||||
|
||||
## Secret Management
|
||||
|
||||
```go
|
||||
apiKey := os.Getenv("OPENAI_API_KEY")
|
||||
if apiKey == "" {
|
||||
log.Fatal("OPENAI_API_KEY not configured")
|
||||
}
|
||||
```
|
||||
|
||||
## Security Scanning
|
||||
|
||||
- Use **gosec** for static security analysis:
|
||||
```bash
|
||||
gosec ./...
|
||||
```
|
||||
|
||||
## Context & Timeouts
|
||||
|
||||
Always use `context.Context` for timeout control:
|
||||
|
||||
```go
|
||||
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancel()
|
||||
```
|
||||
Reference in New Issue
Block a user