Skip to main content

go-data

Use this skill when working with Go slices, maps, integers, strings, range loops, or defer in loops to avoid common data type and control flow pitfalls.

소스 정보

저장소
xrplf/xrpl-go
최근 소스 활동
2026년 5월 8일 14:17
감지된 SKILL.md 언어
영어
스타
23
포크
24

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
26 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
go-data
description
Use this skill when working with Go slices, maps, integers, strings, range loops, or defer in loops to avoid common data type and control flow pitfalls.
# Go Data Types & Control Flow Correct patterns for Go's built-in data types (slices, maps, integers), control structures (range loops, break, defer), and string handling (runes, UTF-8, conversions). ## When to Use This Skill - Working with slices and maps (initialization, capacity, memory leaks) - Iterating with range loops (variable capture, pointer reuse) - Handling integers (overflow, octal literals, floating point) - Manipulating strings (runes, trim, substring leaks) - Using defer inside loops ## How It Works 1. Identifies data type and control flow anti-patterns 2. Explains subtle Go semantics (nil vs empty slice, range variable reuse) 3. Shows correct implementations with working examples 4. Categorized by impact level ## Categories Covered 1. **Data Types** — slices, maps, integers, floating point, nil/empty slice 2. **Control Structures** — range loops, defer in loops, break, map iteration 3. **Strings** — runes, UTF-8, trim functions, substring memory leaks ## Present Results to User When identifying issues: ``` ❌ Found: Range loop variable captured by closure 📍 Location: handlers/batch.go:34 ⚠️ Impact: HIGH - All goroutines reference same variable ✅ Fix: Copy loop variable before passing to goroutine [Show incorrect code] [Show correct code] [Explain why the fix matters] ``` ## Troubleshooting **Nil vs empty slice confusion:** - Both have length 0, but nil slice marshals to `null` in JSON; empty slice marshals to `[]` - Use `var s []T` for nil slice, `s := []T{}` or `make([]T, 0)` for empty
GitHub에서 보기