-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use cgr.dev for base img make the const accessible #904
use cgr.dev for base img make the const accessible #904
Conversation
6ddf8d7
to
8871b8c
Compare
943907a
to
63b2f4e
Compare
489ba6a
to
b23ec59
Compare
da1e840
to
c228eef
Compare
c228eef
to
0e0fc16
Compare
// DefaultBaseImage returns the default base image to use | ||
func DefaultBaseImage() (ref string, err error) { | ||
if !viper.IsSet("defaultBaseImage") { | ||
return "", errors.New("'defaultBaseImage' is not set") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this some more, I think we might want to add a call to SetDefault
somewhere in here. If some external code calls DefaultBaseImage
without previously calling LoadConfig
, then defaultBaseImage
will be unset, and the user shouldn't get an error; they should get the const default.
This logic also applies to having this code consider KO_CONFIG_PATH
when it's called; if someone calls this without first calling LoadConfig
, they won't get the value configured in their config file, they'll get an error.
// If the base image is set in the config, use that. | ||
if baseImage := v.GetString("defaultBaseImage"); baseImage != configDefaultBaseImage { | ||
// to ensure to set the base image from the config file if it differs from the default | ||
viper.SetDefault("defaultBaseImage", baseImage) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have any effect? This seems to be saying, "if the value of defaultBaseImage
is not the const default, then set the default value of defaultBaseImage
to that value", but that's where we got the value from in the first place.
0e0fc16
to
4324ff5
Compare
Signed-off-by: Batuhan Apaydın <[email protected]>
4324ff5
to
fb94345
Compare
This Pull Request is stale because it has been open for 90 days with |
Signed-off-by: Batuhan Apaydın [email protected]
According to the comment here