Conversation
|
gofmt demands horizontal alignment? That's... insane. |
| defaultConfigPath := filepath.Join(userConfigDir, "go-librespot", "config.yaml") | ||
| f.StringVar(&cfg.ConfigPath, "config", defaultConfigPath, "the configuration file") | ||
|
|
||
| userCacheDir, err := os.UserCacheDir() |
There was a problem hiding this comment.
I think this should be XDG_STATE_HOME rather than XDG_CACHE_HOME. Eventually there'll be proper cache too.
There was a problem hiding this comment.
That would be ideal, yes, but os pkg does not yet support it.
| // backwards compatibility for config_dir flag | ||
| func aliasNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName { | ||
| switch name { | ||
| case "config_dir": | ||
| name = "cache" | ||
| break | ||
| } | ||
| return flag.NormalizedName(name) | ||
| } |
There was a problem hiding this comment.
I think it would be clearer to explictely keep the config_dir option, for backward compatibility.
There was a problem hiding this comment.
If I keep it should it follow UserConfigDir or UserCacheDir semantics?
If the former then we have a breaking change for existing deployments of go-librespot.
Either way I take your point - I'll find a way to make it more explicit.
There was a problem hiding this comment.
Making use of pflag.MarkDeprecated? (And then unhiding the flag, because pflag autohides it)
$ go run ./cmd/daemon -help
--cache string the cache directory (default "/var/cache/go-librespot")
--config string the configuration file (default "/etc/go-librespot/config.yaml")
--config_dir string old config directory (default "/var/cache/go-librespot") (DEPRECATED: has been renamed --cache)
It doesn't improve things, IMO.
Given go-librespot is pre v1.0 I'd much rather see config_dir dropped with prejudice. Not having underscores in flags is an added bonus.
3f0db8a to
2527809
Compare
|
Im all for standards. I agree with the parameter naming too.. yeah I like.
configuration in /etc unless overridden etc etc..
…On Mon, 15 Sept 2025, 18:21 markferry, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In cmd/daemon/main.go
<#205 (comment)>
:
> +// backwards compatibility for config_dir flag
+func aliasNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName {
+ switch name {
+ case "config_dir":
+ name = "cache"
+ break
+ }
+ return flag.NormalizedName(name)
+}
@guidcruncher <https://github.com/guidcruncher>, your view?
—
Reply to this email directly, view it on GitHub
<#205 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BLPK5EFKE24YQSF6NRZB7Q33S3YRXAVCNFSM6AAAAACGIMEOPGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTEMRVGYYTCNZVGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
2527809 to
d05da5e
Compare
d05da5e to
96f73c7
Compare
43ff4a2 to
4fdedb1
Compare
Default state dir moves from os.UserConfigDir to os.UserCacheDir
4fdedb1 to
76b117b
Compare
|
Sorry for leaving this hanging, but I am not fully sold on having the directory be |
Fixes #201
This moves state files from
os.UserConfigDirtoos.UserCacheDirby default.The config file remains in the original location.
add --config flag
os.UserConfigDir()add --cache flag
config_dirflag tocacheos.UserCacheDir()config_dirTo use the old behaviour:
go run ./cmd/daemon --cache $XDG_CONFIG_HOME/go-librespot