Skip to content

Commit 5f19b02

Browse files
dhaiducekopenshift-merge-bot[bot]
authored andcommitted
fix: allow the --lint arg to override the env
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
1 parent 5022d57 commit 5f19b02

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cmd/template-resolver/utils/resolver_client.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ type TemplateResolver struct {
2525
}
2626

2727
func (t *TemplateResolver) GetCmd() *cobra.Command {
28-
envVarLint := "TEMPLATE_RESOLVER_LINT"
29-
3028
// templateResolverCmd represents the template-resolver command
3129
templateResolverCmd := &cobra.Command{
3230
Use: `template-resolver [flags] [file|-]
@@ -100,20 +98,18 @@ func (t *TemplateResolver) GetCmd() *cobra.Command {
10098
"Handle the input directly as a Go template, skipping any surrounding policy field validations.",
10199
)
102100

101+
envVarLint := "TEMPLATE_RESOLVER_LINT"
102+
lint := os.Getenv(envVarLint) == "true"
103+
103104
templateResolverCmd.Flags().BoolVar(
104105
&t.Lint,
105106
"lint",
106-
false,
107+
lint,
107108
fmt.Sprintf(
108109
"(Tech Preview) Lint the template string for issues (Alternatively, set the environment variable %s=true).",
109110
envVarLint),
110111
)
111112

112-
lint := os.Getenv(envVarLint)
113-
if lint == "true" {
114-
t.Lint = true
115-
}
116-
117113
return templateResolverCmd
118114
}
119115

0 commit comments

Comments
 (0)