You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The approach I am using right now is having a config_unix.go and config_windows.go which have the respective build tags. This solution is very brittle and repetitive as I need to make sure the two config type definitions are always in sync.
Is this scenario something that package envconfig supports or could support? Is there a better approach for solving my problem using conditional compilation?
The text was updated successfully, but these errors were encountered:
If I was you I'd just have one single config struct and set that default value elsewhere. For example you could prepopulate that value before calling Process and if it's set in the config it simply gets overwritten.
I am building an application that supports Unix-like OSes and Windows. In my configuration definition I am storing certain file paths like:
This default obviously won't work on Windows where I would need to have something like:
The approach I am using right now is having a
config_unix.go
andconfig_windows.go
which have the respective build tags. This solution is very brittle and repetitive as I need to make sure the two config type definitions are always in sync.Is this scenario something that package envconfig supports or could support? Is there a better approach for solving my problem using conditional compilation?
The text was updated successfully, but these errors were encountered: