---
name: Golang Security
description: Go security extending common rules
author: synthoperator
---

# Go Security

> This file extends the common security rule with Go specific content.

## Secret Management

```go
apiKey := os.Getenv("SynthOperator_API_KEY")
if apiKey == "" {
    log.Fatal("SynthOperator_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()
```
