feat: add version flag and Makefile for release builds
- Add -version flag to show build version - Add Makefile with build targets: - make build-release: optimized build with version - make build-all: cross-compile for Linux/macOS - make run/test/clean: dev commands - Update documentation with build commands - Version is embedded via ldflags during build Usage: make build-release # Build with version ./bin/qfs -version # Show version Version format: v0.2.5-1-gfa0f5e3 (tag-commits-hash) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
21
README.md
21
README.md
@@ -97,9 +97,24 @@ go run ./cmd/importer
|
||||
# Development
|
||||
go run ./cmd/qfs
|
||||
|
||||
# Production
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/qfs ./cmd/qfs
|
||||
./bin/qfs
|
||||
# Production (with Makefile - recommended)
|
||||
make build-release # Builds with version info
|
||||
./bin/qfs -version # Check version
|
||||
|
||||
# Production (manual)
|
||||
VERSION=$(git describe --tags --always --dirty)
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=$VERSION" -o bin/qfs ./cmd/qfs
|
||||
./bin/qfs -version
|
||||
```
|
||||
|
||||
**Makefile команды:**
|
||||
```bash
|
||||
make build-release # Оптимизированная сборка с версией
|
||||
make build-all # Сборка для всех платформ (Linux, macOS)
|
||||
make run # Запуск dev сервера
|
||||
make test # Запуск тестов
|
||||
make clean # Очистка bin/
|
||||
make help # Показать все команды
|
||||
```
|
||||
|
||||
Приложение будет доступно по адресу: http://localhost:8080
|
||||
|
||||
Reference in New Issue
Block a user