Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log/slog"
"os"
"path/filepath"
"runtime/debug"

tea "github.com/charmbracelet/bubbletea"
"github.com/maniac-en/req/internal/backend/collections"
Expand Down Expand Up @@ -38,6 +39,18 @@ var (

var Version = "dev"

func getVersion() string {
// Try to get version from build info (works with go install)
if info, ok := debug.ReadBuildInfo(); ok {
if info.Main.Version != "" && info.Main.Version != "(devel)" {
return info.Main.Version
}
}

// Fall back to injected version (release builds)
return Version
}

func initPaths() error {
// setup paths using OS-appropriate cache directory
userHomeDir, err := os.UserHomeDir()
Expand Down Expand Up @@ -141,7 +154,7 @@ func main() {
endpointsManager,
httpManager,
historyManager,
Version,
getVersion(),
)

// populate dummy data for demo
Expand Down
Loading