67 lines
1.1 KiB
Markdown
67 lines
1.1 KiB
Markdown
---
|
|
description: Standard Go development commands for this project
|
|
globs: "**/*.go"
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Go Development Commands
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# Run all tests
|
|
go test ./...
|
|
|
|
# Run tests in a specific package
|
|
go test ./internal/checkin/...
|
|
|
|
# Run a single test by name
|
|
go test ./internal/checkin/... -run TestCheckOut
|
|
|
|
# Run tests with verbose output
|
|
go test -v ./...
|
|
|
|
# Run tests with race detector
|
|
go test -race ./...
|
|
```
|
|
|
|
## Formatting and Linting
|
|
|
|
```bash
|
|
# Format all Go files
|
|
gofmt -w .
|
|
|
|
# Organize imports (group stdlib, external, internal)
|
|
goimports -w .
|
|
|
|
# Vet for common mistakes
|
|
go vet ./...
|
|
```
|
|
|
|
## Code Generation
|
|
|
|
```bash
|
|
# Regenerate sqlc query code after editing internal/store/queries/*.sql
|
|
task sqlc
|
|
|
|
# Regenerate proto/gRPC code after editing .proto files
|
|
task generate
|
|
```
|
|
|
|
## Building
|
|
|
|
```bash
|
|
# Compile all packages (catches errors without producing binaries)
|
|
go build ./...
|
|
|
|
# Tidy module dependencies after adding/removing imports
|
|
go mod tidy
|
|
```
|
|
|
|
## After any code change
|
|
|
|
1. `gofmt -w .`
|
|
2. `goimports -w .` (if imports changed)
|
|
3. `go vet ./...`
|
|
4. `go test ./...`
|