|
| 1 | +# scip-go Development Guide |
| 2 | + |
| 3 | +## Commands |
| 4 | + |
| 5 | +- **Build**: `go build ./cmd/scip-go` |
| 6 | +- **Test all**: `go test ./...` |
| 7 | +- **Test single package**: `go test ./internal/index` |
| 8 | +- **Update snapshots**: `go test ./internal/index -update-snapshots` |
| 9 | +- **Install**: `go install ./cmd/scip-go` |
| 10 | +- **Version check**: `go version` (uses Go 1.24.3) |
| 11 | + |
| 12 | +## Testing |
| 13 | + |
| 14 | +- **Snapshot testing**: Primary testing method using |
| 15 | + `internal/testdata/snapshots` directory with `internal/index/scip_test.go` as |
| 16 | + the test runner |
| 17 | +- **Test data**: Located in `internal/testdata/` with test cases as |
| 18 | + subdirectories |
| 19 | +- **Update snapshots**: Run with `-update-snapshots` flag to regenerate expected |
| 20 | + outputs |
| 21 | +- **Filter tests**: Use `-filter <name>` to run specific test cases |
| 22 | + |
| 23 | +## Architecture |
| 24 | + |
| 25 | +SCIP (Source Code Intelligence Protocol) indexer for Go. Main entry point is |
| 26 | +`cmd/scip-go/main.go`. Key packages: `internal/index` (core indexing), |
| 27 | +`internal/loader` (package loading), `internal/visitors` (AST traversal), |
| 28 | +`internal/document` (SCIP document generation). |
| 29 | + |
| 30 | +## Code Style |
| 31 | + |
| 32 | +- Package naming: lowercase, single word preferred (e.g., `index`, `loader`, |
| 33 | + `symbols`) |
| 34 | +- Imports: grouped by std library, third-party, then internal packages with |
| 35 | + blank lines |
| 36 | +- Test files: use `package_test` convention for black-box testing |
| 37 | +- Embed files: use `//go:embed` for version.txt and similar resources |
| 38 | +- Error handling: return explicit errors, no panics in library code |
| 39 | +- Logging: use `charmbracelet/log` for structured logging |
0 commit comments