Here are the essential commands for running and analyzing Go test cases:
go test -v -cover ./...
Runs all tests recursively with verbose output and displays coverage in terminal.
go test -race .
Executes test cases with race condition detection in the current directory.
go test -race -v .
Same as above but with verbose output for detailed test execution information.
go test -coverprofile=coverage.out
Generates a coverage profile file (coverage.out
) for detailed analysis.
go tool cover -html=coverage.out
Creates an interactive HTML report from the coverage profile, allowing visual exploration of test coverage in your browser.
This repository contains the following implementations:
- Producer Consumer Pattern
- A classic concurrent programming pattern implementation in Go
- Dining Philosophers Problem
- An implementation of Dijkstra's famous dining philosophers problem demonstrating deadlock prevention
- Sleeping Barber Problem
- A synchronization problem that demonstrates resource management and scheduling in concurrent programming