# list commands
default:
    just --list

# build the library
build:
    go build ./...

# format source files
fmt:
    go fmt ./...

# check formatting
fmt-check:
    test -z "$(gofmt -l .)"

# vet source files
vet:
    go vet ./...

# tidy go modules
tidy:
    go mod tidy

# cut a new release version
bump *args:
    ./scripts/bump.sh {{ args }}

# set up the dev environment
up:
    docker compose up -d --wait

# tear down the dev environment
down:
    docker compose down

# check the dev environment status
ps:
    docker compose ps -a

# run tests in the dev environment
test *args="./...":
    docker compose exec test go test {{ args }}

raceargs := '-race -gcflags "all=-d=checkptr=0"'

# run race tests in the dev environment
test-race *args="./...":
    docker compose exec test go test {{ raceargs }} {{ args }}

# run ci tests in a one-shot environment
test-ci *args="./...":
    docker compose run --rm test go test {{ raceargs }} {{ args }}

# run all checks
ci: fmt-check vet test-ci

# regenerate test fixtures
fixtures:
    go run ./cmd/gen-fixtures
