Skip to content

Commit b1ac611

Browse files
authored
Merge pull request #1 from BaseMax/copilot/build-go-error-report-tool
[WIP] Build tool for structured error reports collection
2 parents 1e2bc70 + 597ecb8 commit b1ac611

File tree

23 files changed

+2865
-1
lines changed

23 files changed

+2865
-1
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, copilot/* ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: ['1.21', '1.22', '1.23']
16+
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
26+
- name: Cache Go modules
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
33+
34+
- name: Download dependencies
35+
run: go mod download
36+
37+
- name: Verify dependencies
38+
run: go mod verify
39+
40+
- name: Run tests
41+
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
42+
43+
- name: Upload coverage
44+
uses: codecov/codecov-action@v3
45+
with:
46+
file: ./coverage.txt
47+
flags: unittests
48+
name: codecov-umbrella
49+
50+
build:
51+
name: Build
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Check out code
56+
uses: actions/checkout@v4
57+
58+
- name: Set up Go
59+
uses: actions/setup-go@v5
60+
with:
61+
go-version: '1.23'
62+
63+
- name: Build
64+
run: go build -v -o errorvault ./cmd/errorvault
65+
66+
- name: Upload artifact
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: errorvault
70+
path: errorvault
71+
72+
lint:
73+
name: Lint
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Check out code
78+
uses: actions/checkout@v4
79+
80+
- name: Set up Go
81+
uses: actions/setup-go@v5
82+
with:
83+
go-version: '1.23'
84+
85+
- name: Run golangci-lint
86+
uses: golangci/golangci-lint-action@v3
87+
with:
88+
version: latest
89+
args: --timeout=5m

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Binaries
2+
errorvault
3+
*.exe
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary
9+
*.test
10+
11+
# Output of the go coverage tool
12+
*.out
13+
14+
# Dependency directories
15+
vendor/
16+
17+
# Go workspace file
18+
go.work
19+
20+
# IDE
21+
.idea/
22+
.vscode/
23+
*.swp
24+
*.swo
25+
*~
26+
27+
# OS
28+
.DS_Store
29+
Thumbs.db
30+
31+
# Application data
32+
*.db
33+
*.db-journal
34+
.errorvault/

.golangci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
linters:
2+
enable:
3+
- gofmt
4+
- govet
5+
- staticcheck
6+
- errcheck
7+
- gosimple
8+
- ineffassign
9+
- unused
10+
11+
linters-settings:
12+
govet:
13+
check-shadowing: true
14+
errcheck:
15+
check-blank: true
16+
17+
issues:
18+
exclude-rules:
19+
- path: _test\.go
20+
linters:
21+
- errcheck

CONTRIBUTING.md

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# Contributing to Error Vault
2+
3+
Thank you for your interest in contributing to Error Vault! This document provides guidelines and instructions for contributing.
4+
5+
## Code of Conduct
6+
7+
Be respectful and constructive in all interactions with the project and community.
8+
9+
## How to Contribute
10+
11+
### Reporting Bugs
12+
13+
1. Check if the bug has already been reported in the Issues section
14+
2. If not, create a new issue with:
15+
- Clear title and description
16+
- Steps to reproduce
17+
- Expected vs actual behavior
18+
- Environment details (OS, Go version, etc.)
19+
20+
### Suggesting Features
21+
22+
1. Check if the feature has already been suggested
23+
2. Create a new issue with:
24+
- Clear description of the feature
25+
- Use cases and benefits
26+
- Possible implementation approach
27+
28+
### Contributing Code
29+
30+
1. Fork the repository
31+
2. Create a new branch for your feature/fix:
32+
```bash
33+
git checkout -b feature/my-feature
34+
```
35+
3. Make your changes following our coding standards
36+
4. Write or update tests
37+
5. Ensure all tests pass:
38+
```bash
39+
make test
40+
```
41+
6. Format your code:
42+
```bash
43+
make fmt
44+
```
45+
7. Run linter:
46+
```bash
47+
make vet
48+
```
49+
8. Commit your changes with clear messages
50+
9. Push to your fork
51+
10. Create a Pull Request
52+
53+
## Development Setup
54+
55+
### Prerequisites
56+
57+
- Go 1.21 or later
58+
- SQLite3
59+
- Make (optional but recommended)
60+
61+
### Getting Started
62+
63+
```bash
64+
# Clone your fork
65+
git clone https://github.com/YOUR_USERNAME/go-error-vault.git
66+
cd go-error-vault
67+
68+
# Download dependencies
69+
go mod download
70+
71+
# Build
72+
make build
73+
74+
# Run tests
75+
make test
76+
77+
# Run locally
78+
./errorvault server
79+
```
80+
81+
## Project Structure
82+
83+
```
84+
go-error-vault/
85+
├── cmd/errorvault/ # CLI application
86+
├── pkg/ # Public packages
87+
│ ├── api/ # HTTP server
88+
│ ├── collector/ # File collection
89+
│ ├── models/ # Data models
90+
│ └── storage/ # Database layer
91+
├── internal/ # Private packages
92+
│ └── config/ # Configuration
93+
├── examples/ # Integration examples
94+
└── web/ # Web UI assets
95+
```
96+
97+
## Coding Standards
98+
99+
### Go Code Style
100+
101+
- Follow standard Go conventions
102+
- Use `gofmt` for formatting
103+
- Use meaningful variable and function names
104+
- Add comments for exported functions and types
105+
- Keep functions small and focused
106+
- Handle errors explicitly
107+
108+
### Testing
109+
110+
- Write unit tests for new functionality
111+
- Maintain or improve code coverage
112+
- Use table-driven tests where appropriate
113+
- Mock external dependencies
114+
115+
Example test:
116+
117+
```go
118+
func TestFeature(t *testing.T) {
119+
tests := []struct {
120+
name string
121+
input string
122+
want string
123+
wantErr bool
124+
}{
125+
// Test cases
126+
}
127+
128+
for _, tt := range tests {
129+
t.Run(tt.name, func(t *testing.T) {
130+
// Test implementation
131+
})
132+
}
133+
}
134+
```
135+
136+
### Commit Messages
137+
138+
- Use present tense ("Add feature" not "Added feature")
139+
- Keep first line under 72 characters
140+
- Add detailed description for complex changes
141+
- Reference issues when applicable
142+
143+
Example:
144+
```
145+
Add error filtering by date range
146+
147+
- Add date range parameters to storage queries
148+
- Update API endpoints to accept date filters
149+
- Add tests for date filtering
150+
151+
Fixes #123
152+
```
153+
154+
## Pull Request Process
155+
156+
1. Update documentation if needed
157+
2. Add tests for new features
158+
3. Ensure all tests pass
159+
4. Update CHANGELOG.md (if exists)
160+
5. Request review from maintainers
161+
162+
### PR Checklist
163+
164+
- [ ] Code follows project style
165+
- [ ] Tests added/updated
166+
- [ ] Tests pass
167+
- [ ] Documentation updated
168+
- [ ] Commit messages are clear
169+
- [ ] No merge conflicts
170+
171+
## Building and Testing
172+
173+
### Building
174+
175+
```bash
176+
# Standard build
177+
make build
178+
179+
# Optimized build
180+
make build-optimized
181+
182+
# Install system-wide
183+
make install
184+
```
185+
186+
### Testing
187+
188+
```bash
189+
# Run all tests
190+
make test
191+
192+
# Run with coverage
193+
make test-cover
194+
195+
# Run specific package tests
196+
go test ./pkg/storage -v
197+
```
198+
199+
### Code Quality
200+
201+
```bash
202+
# Format code
203+
make fmt
204+
205+
# Run vet
206+
make vet
207+
208+
# Clean build artifacts
209+
make clean
210+
```
211+
212+
## Documentation
213+
214+
- Update README.md for user-facing changes
215+
- Update code comments for API changes
216+
- Add examples for new features
217+
- Keep documentation clear and concise
218+
219+
## Questions?
220+
221+
Feel free to:
222+
- Open an issue for questions
223+
- Check existing issues and discussions
224+
- Reach out to maintainers
225+
226+
## License
227+
228+
By contributing, you agree that your contributions will be licensed under the GPL-3.0 License.

0 commit comments

Comments
 (0)