Repository navigation
Tags
Tags
fix(tools): ensure tool management functions correctly across multipl… ( #608) * fix(tools): ensure tool management functions correctly across multiple directories and isolate test environments * fix(tools): refactor updateTool to use toolspkg.InstallTools for better binary management
feat(cache): add --current flag to cache clean command for scoped cle… ( #606) * feat(cache): add --current flag to cache clean command for scoped cleaning test(cache): add end-to-end tests for architecture-suffixed cache cleaning fix(cache): update cache directory structure to reflect new layout * refactor: replace hardcoded paths with config methods for improved maintainability * fix(cache): ensure custom GOCACHE_DIR is considered in cache status and clean commands
fix(update): request elevation instead of failing on unwritable insta… …ll dirs (#601) * fix(update): request elevation instead of failing on unwritable install dirs `goenv update` aborted with "cannot update binary" whenever the install directory was not user-writable, leaving the user to re-run the whole thing under sudo. The permission check was also asking the wrong question. It opened the binary O_WRONLY, but replacement is a rename in the parent directory, so directory write access is what decides it. That made the check both too strict (a read-only binary in a writable directory is replaceable) and wrong on Linux, where opening the running executable for writing returns ETXTBSY. canReplaceBinary now probes the directory with a real file, which also covers read-only mounts and ACLs. When the directory is not writable, only the install step is escalated: - The download, checksum verification and archive extraction all run as the invoking user, staged in a 0700 temp directory. An unverified release is never executed with elevated privileges, and root only reads a file this process created in a directory it owns. - Unix runs `install -m 0755` to a temporary name in the destination directory followed by `mv -f`, so an interrupted install cannot leave a truncated executable on PATH. Stdin is inherited for the password prompt. - Windows launches the existing update batch script through `Start-Process -Verb RunAs`, since a non-elevated process has no sudo to exec into. The script and staged binary stay in the private temp directory. Escalation is never implicit: it requires both a TTY and an explicit confirmation, so a scripted or CI invocation gets the manual instructions rather than an unattended write to a system directory. --no-elevate opts out entirely. Package-manager installs are refused rather than escalated. Overwriting a Homebrew keg leaves `brew list --versions goenv` describing a version that is no longer installed and the next `brew upgrade` silently reverts the update, so Homebrew, Nix, Scoop, Chocolatey and asdf paths are detected and answered with the right upgrade command. * test(update): fix the elevation tests on Windows Three failures on the Windows runner, only one of which was about permission semantics. TestCanReplaceBinary/read-only_directory: os.Chmod on Windows only toggles FILE_ATTRIBUTE_READONLY, which says nothing about creating entries inside a directory, so the unwritable case cannot be staged there. Skip that subtest only — the other three exercise canReplaceBinary just as well on Windows, and the function is platform-agnostic by design: it probes with a real file, so an ACL-protected directory fails it for real. TestElevationInstructions: not a permissions problem. filepath.Dir cleans to the host separator, so "/usr/local/bin/goenv" became "\usr\local\bin" and the assertion missed. Skipping it would have dropped coverage of the Windows branch, which is the branch that matters on Windows, so assert against the expected text per platform instead. TestUpdateCommand_WritePermissionError: a duplicate of TestCanReplaceBinary introduced when the file-mode check was replaced. Removed rather than skipped.
fix(update): stop burning GitHub API quota on every update check (#599) * fix(update): stop burning GitHub API quota on every update check The ETag cache was write-only: the release payload itself was never stored, so a 304 response became a hard error and every check had to spend a rate limit unit on a full request. Unauthenticated users get 60 requests/hour per IP, so `goenv update` failed with "GitHub API rate limit exceeded". - Cache the release list next to its ETag and serve it on 304, so repeat checks are conditional requests that don't count against the rate limit. - Fall back to the cached list when the API is rate limited or unreachable instead of failing outright. - Add a last-resort lookup via releases.atom, which is served by github.com rather than the REST API and so has no API rate limit. Tags are filtered by the running binary's major version to keep the assetless v2 line out of the result (issue #582). - Drop per_page from 50 to 10; still well past any run of assetless v2 releases, with a much smaller payload. - Point the rate limit error at GITHUB_TOKEN. Extracts fetchReleases/rateLimitReset/retryDelay/cacheReleases so the retry and rate limit paths are testable. * chore(deps): tidy modules and ignore local issue cache
chore: update v3 GitHub Actions to use latest versions of actions (#596) * chore: update GitHub Actions to use latest versions of actions * fix: ensure cleanup recommendations align with installation markers and add regression tests * fix: improve GOROOT advice for better user guidance and VS Code integration * fix: improve VS Code integration by deprecating environment variable mode and enhancing prompts - Deprecated the use of environment variables in VS Code settings, which the Go extension ignores. - Updated prompts in `goenv use` and `goenv local` to prevent silent overwrites of `.vscode/settings.json` when stdin is non-interactive. - Added tests to ensure that the deprecated flags are correctly marked and that settings are not modified without explicit consent. - Enhanced documentation to clarify the new workflow for VS Code integration and the implications of the deprecation. * feat: add 'fix-extension' command for VS Code integration and implement e2e tests
PreviousNext