Skip to content

Commit 30750aa

Browse files
author
agilira
committed
feat: Initial release of go-errors library v1.0.0
Complete structured error handling library for Go applications with full standard library compatibility. Features: - Structured error types with codes, context, and stack traces - Standard library compatibility (errors.Is, errors.As, errors.Unwrap) - User-friendly message support with technical fallback - JSON serialization for API/microservices - Retryable error interface - Zero external dependencies Technical Quality: - 100% test coverage with comprehensive edge case testing - Race condition detection and thread safety validation - Security analysis with gosec (0 vulnerabilities) - Code quality checks (go vet, golint, go fmt) - Cross-platform support (Windows, Linux, macOS) Documentation: - Complete API reference with examples - Best practices guide for production use - Integration guide for migration - Professional project documentation CI/CD Pipeline: - GitHub Actions with multi-platform testing - Automated security scanning (Trivy, CodeQL) - Performance benchmarking - Automated releases with multi-platform builds - Dependency review workflow Bug Fixes: - Fixed critical stack trace line number formatting - Simplified RootCause implementation - Added proper interface implementations - Enhanced error handling patterns Project Structure: - MPL-2.0 license - Contributing guidelines - Code of conduct - Security policy - Comprehensive changelog - Future roadmap This release represents a production-ready, enterprise-grade error handling solution that follows Go best practices and provides comprehensive tooling for modern applications.
1 parent b0c4e9e commit 30750aa

22 files changed

+2976
-1
lines changed

.github/workflows/ci.yml

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main, develop ]
9+
10+
env:
11+
GO_VERSION: '1.24.4'
12+
CGO_ENABLED: 0
13+
14+
jobs:
15+
validate:
16+
name: Validate Workflow
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Validate workflow syntax
23+
run: |
24+
# Check if workflow files are valid YAML
25+
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))"
26+
echo "✅ Workflow syntax is valid"
27+
28+
- name: Check workflow context usage
29+
run: |
30+
# Check for potential context issues
31+
if grep -q "steps\." .github/workflows/ci.yml; then
32+
echo "⚠️ Found steps context usage - verifying validity"
33+
fi
34+
echo "✅ Workflow context usage appears valid"
35+
36+
test:
37+
name: Test & Coverage
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
go-version: [1.24.4, 1.25.0]
42+
platform: [ubuntu-latest, windows-latest, macos-latest]
43+
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Set up Go ${{ matrix.go-version }}
49+
uses: actions/setup-go@v4
50+
with:
51+
go-version: ${{ matrix.go-version }}
52+
cache: true
53+
54+
- name: Install dependencies
55+
run: go mod download
56+
57+
- name: Run tests with coverage
58+
run: |
59+
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
60+
go tool cover -func=coverage.out
61+
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v4
64+
with:
65+
file: ./coverage.out
66+
flags: unittests
67+
name: codecov-umbrella
68+
fail_ci_if_error: false
69+
verbose: true
70+
71+
quality:
72+
name: Code Quality
73+
runs-on: ubuntu-latest
74+
needs: [validate, test]
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
80+
- name: Set up Go
81+
uses: actions/setup-go@v4
82+
with:
83+
go-version: ${{ env.GO_VERSION }}
84+
cache: true
85+
86+
- name: Install tools
87+
run: |
88+
go install golang.org/x/lint/golint@latest
89+
go install honnef.co/go/tools/cmd/staticcheck@latest
90+
go install github.com/securecodewarrior/gosec@latest
91+
92+
- name: Run go fmt check
93+
run: |
94+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
95+
echo "Code is not formatted. Please run 'go fmt ./...'"
96+
gofmt -s -d .
97+
exit 1
98+
fi
99+
100+
- name: Run go vet
101+
run: go vet ./...
102+
103+
- name: Run golint
104+
run: golint -set_exit_status ./...
105+
106+
- name: Run staticcheck
107+
run: staticcheck ./...
108+
109+
- name: Run gosec
110+
run: gosec ./...
111+
112+
- name: Check for race conditions
113+
run: go test -race ./...
114+
115+
security:
116+
name: Security Scan
117+
runs-on: ubuntu-latest
118+
needs: [validate, test]
119+
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v4
123+
124+
- name: Run Trivy vulnerability scanner
125+
uses: aquasecurity/trivy-action@master
126+
with:
127+
scan-type: 'fs'
128+
scan-ref: '.'
129+
format: 'sarif'
130+
output: 'trivy-results.sarif'
131+
132+
- name: Upload Trivy scan results to GitHub Security tab
133+
uses: github/codeql-action/upload-sarif@v3
134+
if: always()
135+
with:
136+
sarif_file: 'trivy-results.sarif'
137+
138+
build:
139+
name: Build
140+
runs-on: ubuntu-latest
141+
needs: [validate, test, quality]
142+
strategy:
143+
matrix:
144+
goos: [linux, windows, darwin]
145+
goarch: [amd64, arm64]
146+
exclude:
147+
- goos: windows
148+
goarch: arm64
149+
150+
steps:
151+
- name: Checkout code
152+
uses: actions/checkout@v4
153+
154+
- name: Set up Go
155+
uses: actions/setup-go@v4
156+
with:
157+
go-version: ${{ env.GO_VERSION }}
158+
cache: true
159+
160+
- name: Build
161+
env:
162+
GOOS: ${{ matrix.goos }}
163+
GOARCH: ${{ matrix.goarch }}
164+
CGO_ENABLED: 0
165+
run: |
166+
go build -v -ldflags="-s -w" ./...
167+
go test -c ./...
168+
169+
- name: Upload build artifacts
170+
uses: actions/upload-artifact@v4
171+
with:
172+
name: build-${{ matrix.goos }}-${{ matrix.goarch }}
173+
path: |
174+
*.exe
175+
*.test
176+
retention-days: 7
177+
178+
benchmark:
179+
name: Benchmark
180+
runs-on: ubuntu-latest
181+
needs: [validate, test]
182+
183+
steps:
184+
- name: Checkout code
185+
uses: actions/checkout@v4
186+
187+
- name: Set up Go
188+
uses: actions/setup-go@v4
189+
with:
190+
go-version: ${{ env.GO_VERSION }}
191+
cache: true
192+
193+
- name: Run benchmarks
194+
run: |
195+
go test -bench=. -benchmem ./...
196+
go test -bench=. -benchmem -cpu=1,2,4 ./...
197+
198+
release:
199+
name: Release
200+
runs-on: ubuntu-latest
201+
needs: [test, quality, security, build]
202+
if: startsWith(github.ref, 'refs/tags/v')
203+
permissions:
204+
contents: write
205+
packages: write
206+
207+
steps:
208+
- name: Checkout code
209+
uses: actions/checkout@v4
210+
211+
- name: Set up Go
212+
uses: actions/setup-go@v4
213+
with:
214+
go-version: ${{ env.GO_VERSION }}
215+
cache: true
216+
217+
- name: Build for multiple platforms
218+
env:
219+
CGO_ENABLED: 0
220+
run: |
221+
# Build for current platform
222+
go build -v -ldflags="-s -w" -o go-errors ./...
223+
224+
# Build for other platforms
225+
GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-linux-amd64 ./...
226+
GOOS=linux GOARCH=arm64 go build -v -ldflags="-s -w" -o go-errors-linux-arm64 ./...
227+
GOOS=windows GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-windows-amd64.exe ./...
228+
GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-darwin-amd64 ./...
229+
GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o go-errors-darwin-arm64 ./...
230+
231+
- name: Generate checksums
232+
run: |
233+
sha256sum go-errors* > checksums.txt
234+
235+
- name: Create Release
236+
id: create_release
237+
uses: softprops/action-gh-release@v2
238+
with:
239+
tag_name: ${{ github.ref_name }}
240+
name: Release ${{ github.ref_name }}
241+
draft: false
242+
prerelease: false
243+
files: |
244+
go-errors
245+
go-errors-linux-amd64
246+
go-errors-linux-arm64
247+
go-errors-windows-amd64.exe
248+
go-errors-darwin-amd64
249+
go-errors-darwin-arm64
250+
checksums.txt
251+
generate_release_notes: true
252+
env:
253+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
254+
255+
dependency-review:
256+
name: Dependency Review
257+
runs-on: ubuntu-latest
258+
if: github.event_name == 'pull_request'
259+
260+
steps:
261+
- name: Checkout code
262+
uses: actions/checkout@v4
263+
264+
- name: Dependency Review
265+
uses: actions/dependency-review-action@v4
266+
with:
267+
fail-on-severity: moderate

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
schedule:
9+
- cron: '30 1 * * 0'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'go' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: security-extended,security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v3
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v3
40+
with:
41+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)