---
title: "Go Security"
description: "> This file extends the common security rule with Go specific content."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/golang-security
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:24:59.717Z
license: CC-BY-4.0
attribution: "Go Security — Claudary (https://claudary.paisolsolutions.com/skills/golang-security)"
---

# Go Security
> This file extends the common security rule with Go specific content.

## Overview

---
description: "Go security extending common rules"
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
alwaysApply: false
---
# Go Security

> This file extends the common security rule 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()
```

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/golang-security) · https://claudary.paisolsolutions.com
