소스 정보
- 저장소
- pluginagentmarketplace/custom-plugin-go
- 최근 소스 활동
- 2025년 12월 30일 12:44
- 감지된 SKILL.md 언어
- 영어
- 스타
- 4
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-go --skill go-testing명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | go-testing |
| description | Go testing practices - unit tests, benchmarks, mocks, coverage |
| sasmp_version | 1.3.0 |
| bonded_agent | 05-go-testing |
| bond_type | PRIMARY_BOND |
Comprehensive testing strategies for Go applications.
Master Go testing including table-driven tests, benchmarks, mocking, fuzzing, and achieving high code coverage.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| test_type | string | yes | - | Type: "unit", "integration", "benchmark", "fuzz" |
| coverage_min | int | no | 80 | Minimum coverage percentage |
| mock_lib | string | no | "testify" | Mock library: "testify", "gomock" |
func TestParseURL(t *testing.T) {
tests := []struct {
name string
input string
want *URL
wantErr bool
}{
{
name: "valid http",
input: "http://example.com/path",
want: &URL{Scheme: "http", Host: "example.com", Path: "/path"},
},
{
name: "empty string",
input: "",
wantErr: true,
},
{
name: "invalid scheme",
input: "ftp://example.com",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := ParseURL(tt.input)
if tt.wantErr {
require.Error(t, err)
return
}
require.NoError(t, err)
assert.Equal(t, tt.want, got)
})
}
}
type MockStore struct {
mock.Mock
}
func (m *MockStore) Get(ctx context.Context, key string) (string, error) {
args := m.Called(ctx, key)
return args.String(0), args.Error(1)
}
func TestService_GetValue(t *testing.T) {
store := new(MockStore)
store.On("Get", mock.Anything, "key1").Return("value1", nil)
svc := NewService(store)
val, err := svc.GetValue(context.Background(), "key1")
require.NoError(t, err)
assert.Equal(t, "value1", val)
store.AssertExpectations(t)
}
func BenchmarkSort(b *testing.B) {
data := generateData(10000)
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
sorted := make([]int, len(data))
copy(sorted, data)
Sort(sorted)
}
}
func BenchmarkSort_Parallel(b *testing.B) {
data := generateData(10000)
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
sorted := make([]int, len(data))
copy(sorted, data)
Sort(sorted)
}
})
}
func FuzzJSON(f *testing.F) {
f.Add([]byte(`{"name": "test"}`))
f.Add([]byte(`{}`))
f.Add([]byte(`[]`))
f.Fuzz(func(t *testing.T, data []byte) {
var v interface{}
if err := json.Unmarshal(data, &v); err != nil {
return // invalid input, skip
}
// Re-marshal should work
_, err := json.Marshal(v)
if err != nil {
t.Errorf("Marshal failed: %v", err)
}
})
}
# Run all tests
go test ./...
# Verbose with race detection
go test -v -race ./...
# Coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Benchmark
go test -bench=. -benchmem ./...
# Fuzz for 30 seconds
go test -fuzz=FuzzJSON -fuzztime=30s ./...
| Symptom | Cause | Fix |
|---|---|---|
| Flaky test | Race condition | Add -race flag |
| Test timeout | Deadlock | Check goroutines |
| Mock not called | Wrong signature | Verify interface |
Skill("go-testing")