Merge origin/main: resolve conflicts in CLI surface, --prune, helpers
- Adopt origin's SnapshotPurgeOptions naming and PurgeSnapshotsWithOptions method, but extend with Names []string (repeatable --snapshot flag) and Quiet bool for use by --prune. - Adopt origin's parseSnapshotName helper. - Fold the duplicate post-backup prune block into one runPostBackupPrune call that filters retention to the snapshot names just backed up. - Keep the shallow-verify timestamp parsing fix and the dead deep-verify branch removal; use origin's printVerifyHeader/verifyManifestBlobsExist helper extraction. - Drop top-level vaultik purge and verify (duplicates of snapshot purge and snapshot verify). - Drop the resurrected daemon block from info.go (config fields no longer exist). - Combine Makefile targets: gofmt -l for fmt-check, -race for tests, release/release-snapshot/docker/hooks/deps/test-coverage all included.
This commit is contained in:
30
Makefile
30
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: all check test lint fmt fmt-check build clean deps test-coverage test-integration local install release release-snapshot
|
||||
.PHONY: all check test lint fmt fmt-check build clean deps test-coverage test-integration local install release release-snapshot docker hooks
|
||||
|
||||
# Version number
|
||||
VERSION := 1.0.0-rc.1
|
||||
@@ -18,20 +18,11 @@ check: lint fmt-check test
|
||||
|
||||
# Run tests only.
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
@if ! go test -v -timeout 10s ./... 2>&1; then \
|
||||
echo ""; \
|
||||
echo "TEST FAILURES DETECTED"; \
|
||||
echo "Run 'go test -v ./internal/database' to see database test details"; \
|
||||
exit 1; \
|
||||
fi
|
||||
go test -race -timeout 30s ./...
|
||||
|
||||
# Check if code is formatted.
|
||||
# Check if code is formatted (read-only).
|
||||
fmt-check:
|
||||
@if [ -n "$$(go fmt ./...)" ]; then \
|
||||
echo "Error: Code is not formatted. Run 'make fmt' to fix."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
|
||||
|
||||
# Format code.
|
||||
fmt:
|
||||
@@ -39,7 +30,7 @@ fmt:
|
||||
|
||||
# Run linter only.
|
||||
lint:
|
||||
golangci-lint run
|
||||
golangci-lint run ./...
|
||||
|
||||
# Build binary.
|
||||
vaultik: internal/*/*.go cmd/vaultik/*.go
|
||||
@@ -78,3 +69,14 @@ release:
|
||||
# Dry-run a release build without publishing or tagging.
|
||||
release-snapshot:
|
||||
goreleaser release --clean --snapshot
|
||||
|
||||
# Build Docker image.
|
||||
docker:
|
||||
docker build -t vaultik .
|
||||
|
||||
# Install pre-commit hook.
|
||||
hooks:
|
||||
@printf '#!/bin/sh\nset -e\n' > .git/hooks/pre-commit
|
||||
@printf 'go mod tidy\ngo fmt ./...\ngit diff --exit-code -- go.mod go.sum || { echo "go mod tidy changed files; please stage and retry"; exit 1; }\n' >> .git/hooks/pre-commit
|
||||
@printf 'make check\n' >> .git/hooks/pre-commit
|
||||
@chmod +x .git/hooks/pre-commit
|
||||
|
||||
Reference in New Issue
Block a user