1
0
mirror of https://github.com/alexellis/arkade.git synced 2022-05-07 18:22:49 +03:00

Extract local variable

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2021-05-21 16:45:26 +01:00
parent c4ed12c93c
commit 9819cb6932

View File

@@ -179,6 +179,7 @@ IngressController`,
license, _ := command.Flags().GetString("license")
licenseFile, _ := command.Flags().GetString("license-file")
fileFlagChanged := command.Flags().Changed("license-file")
noLicenseErr := fmt.Errorf("--license or --license-file is required for inlets PRO")
if len(license) == 0 {
@@ -187,9 +188,10 @@ IngressController`,
res, err := ioutil.ReadFile(licenseFile)
if err != nil {
if command.Flags().Changed("license-file") == false {
if fileFlagChanged == false {
return noLicenseErr
}
return fmt.Errorf("unable to open license file: %s", err.Error())
}
license = strings.TrimSpace(string(res))