Fix: vfox upgrade unable to detect current version#556
Conversation
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
vfox upgrade unable to detect current version
|
@copilot The version number has been correctly set in the |
The version is correctly set on the root command in In urfave/cli/v3, the The fix uses Alternatively, we could use Commit: 1e6405b |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where the vfox upgrade command was unable to detect the current version, displaying only v instead of the actual version like v0.9.1. The issue was caused by the upgrade subcommand attempting to access the version from cmd.Version, which is only populated on the root application command in urfave/cli/v3.
- Fixed version detection by using
internal.RuntimeVersioninstead ofcmd.Version
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 21.27% 21.27%
=======================================
Files 71 71
Lines 5842 5842
=======================================
Hits 1243 1243
Misses 4502 4502
Partials 97 97 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem
When running
vfox upgrade, the command fails to detect the current version, displaying onlyvinstead ofv0.9.1:This issue occurs on Windows with version 0.9.1 and affects the upgrade command's ability to compare versions properly.
Root Cause
The
upgradeCmdfunction incmd/commands/upgrade.gowas attempting to access the version fromcmd.Version, wherecmdis the upgrade subcommand's*cli.Commandstruct. However, in the urfave/cli/v3 framework:Versionfield is only populated on the root application commandVersionfield from their parentcmd.Versionreturns an empty string for the upgrade subcommandSolution
Changed line 119 in
cmd/commands/upgrade.goto useinternal.RuntimeVersiondirectly:This ensures the current version is always correctly retrieved from the centralized version constant defined in
internal/version.go, which is the same source used to set the version on the root command.Testing
internal.RuntimeVersionis used throughout the codebaseAfter this fix,
vfox upgradewill correctly display:Fixes: Issue describing
vfox upgradecannot detect current versionWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://version-fox.github.io:443/vfox-plugins/index.json/tmp/go-build811042808/b363/http.test -test.testlogfile=/tmp/go-build811042808/b363/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true(http block)version-fox.github.io/tmp/go-build811042808/b363/http.test -test.testlogfile=/tmp/go-build811042808/b363/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #554
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.