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:
Mikhail Chusavitin
2026-02-03 10:57:22 +03:00
parent fa0f5e321d
commit 0bdd163728
4 changed files with 129 additions and 6 deletions

View File

@@ -34,11 +34,21 @@ const (
localDBPath = "./data/settings.db"
)
// Version is set via ldflags during build
var Version = "dev"
func main() {
configPath := flag.String("config", "config.yaml", "path to config file (optional, for server settings)")
migrate := flag.Bool("migrate", false, "run database migrations")
version := flag.Bool("version", false, "show version information")
flag.Parse()
// Show version if requested
if *version {
fmt.Printf("qfs version %s\n", Version)
os.Exit(0)
}
// Initialize local SQLite database (always used)
local, err := localdb.New(localDBPath)
if err != nil {