Move config file default path to os.UserConfigDir()#229
Merged
kordianbruck merged 3 commits intomasterfrom Apr 11, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/schachmat/wego/sessions/5248c0c9-512b-40a6-8353-fc1205c9a659 Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Move config file default path to os.UserConfigDir
Move config file default path to os.UserConfigDir()
Apr 11, 2026
…-file-to-user-config-dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Config defaulted to
$HOME/.wegorcon all platforms, ignoring XDG and OS-native config directories.Description
Adds
resolveConfigPath()inmain.gothat resolves the config path with the following priority:$WEGORC— explicit override, unchanged behavioros.UserConfigDir()/wego/wegorc— XDG on Linux (~/.config/wego/wegorc),~/Library/Application Support/wego/wegorcon macOS,%AppData%\wego\wegorcon Windows — used if it already exists$HOME/.wegorc— legacy fallback for backward compatibility, used if it existsos.UserConfigDir()/wego/wegorc— new install default; parent directory isMkdirAll'd automaticallySince
ingodetermines its path via the$WEGORCenv var, the resolved path is injected viaos.Setenv("WEGORC", configPath)before callingingo.Parse("wego").Updated man page strings and
README.mdto reflect the new resolution order.Steps for Testing
wego; confirm config is created at$XDG_CONFIG_HOME/wego/wegorc(e.g.~/.config/wego/wegorcon Linux).~/.wegorc; runwegoand confirm it is picked up without moving the file.WEGORC=/tmp/test.rcand runwego; confirm that path is used.~/.config/wego/wegorcalongside a~/.wegorc; confirm the XDG path takes precedence.Screenshots
N/A — CLI tool, no UI changes.