Skip to content

Commit 0742025

Browse files
authored
Merge pull request #1190 from justinsb/dont_rewrite_shared_vars
Avoid rewriting template values, mark them as const
2 parents 28fb4c5 + 7b632b2 commit 0742025

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+75
-74
lines changed

pkg/scaffold/project/authproxyrole.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (r *AuthProxyRole) GetInput() (input.Input, error) {
3838
return r.Input, nil
3939
}
4040

41-
var proxyRoleTemplate = `apiVersion: rbac.authorization.k8s.io/v1
41+
const proxyRoleTemplate = `apiVersion: rbac.authorization.k8s.io/v1
4242
kind: ClusterRole
4343
metadata:
4444
name: proxy-role

pkg/scaffold/project/authproxyrolebinding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (r *AuthProxyRoleBinding) GetInput() (input.Input, error) {
3838
return r.Input, nil
3939
}
4040

41-
var proxyRoleBindinggTemplate = `apiVersion: rbac.authorization.k8s.io/v1
41+
const proxyRoleBindinggTemplate = `apiVersion: rbac.authorization.k8s.io/v1
4242
kind: ClusterRoleBinding
4343
metadata:
4444
name: proxy-rolebinding

pkg/scaffold/project/boilerplate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (c *Boilerplate) GetInput() (input.Input, error) {
6565
return c.Input, nil
6666
}
6767

68-
var apache = `/*
68+
const apache = `/*
6969
{{ if .Owner }}Copyright {{ .Year }} {{ .Owner }}.
7070
{{ end }}
7171
Licensed under the Apache License, Version 2.0 (the "License");
@@ -81,6 +81,6 @@ See the License for the specific language governing permissions and
8181
limitations under the License.
8282
*/`
8383

84-
var none = `/*
84+
const none = `/*
8585
{{ if .Owner }}Copyright {{ .Year }} {{ .Owner }}{{ end }}.
8686
*/`

pkg/scaffold/project/gitignore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (c *GitIgnore) GetInput() (input.Input, error) {
3636
return c.Input, nil
3737
}
3838

39-
var gitignoreTemplate = `
39+
const gitignoreTemplate = `
4040
# Binaries for programs and plugins
4141
*.exe
4242
*.exe~

pkg/scaffold/project/gopkg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const DefaultGopkgUserContent = `required = [
134134
135135
`
136136

137-
var depTemplate = `{{ .UserContent }}
137+
const depTemplate = `{{ .UserContent }}
138138
# STANZAS BELOW ARE GENERATED AND MAY BE WRITTEN - DO NOT MODIFY BELOW THIS LINE.
139139
140140
{{ range $element := .Stanzas -}}

pkg/scaffold/project/kustomize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (c *Kustomize) GetInput() (input.Input, error) {
5151
return c.Input, nil
5252
}
5353

54-
var kustomizeTemplate = `# Adds namespace to all resources.
54+
const kustomizeTemplate = `# Adds namespace to all resources.
5555
namespace: {{.Prefix}}-system
5656
5757
# Value of this field is prepended to the

pkg/scaffold/project/kustomize_manager_base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ func (c *KustomizeManager) GetInput() (input.Input, error) {
3939
return c.Input, nil
4040
}
4141

42-
var kustomizeManagerTemplate = `resources:
42+
const kustomizeManagerTemplate = `resources:
4343
- manager.yaml
4444
`

pkg/scaffold/project/kustomize_rbac_base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (c *KustomizeRBAC) GetInput() (input.Input, error) {
3939
return c.Input, nil
4040
}
4141

42-
var kustomizeRBACTemplate = `resources:
42+
const kustomizeRBACTemplate = `resources:
4343
- rbac_role.yaml
4444
- rbac_role_binding.yaml
4545
# Comment the following 3 lines if you want to disable

pkg/scaffold/project/makefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (c *Makefile) GetInput() (input.Input, error) {
4848
return c.Input, nil
4949
}
5050

51-
var makefileTemplate = `
51+
const makefileTemplate = `
5252
# Image URL to use all building/pushing image targets
5353
IMG ?= {{ .Image }}
5454

pkg/scaffold/v1/authproxyservice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (r *AuthProxyService) GetInput() (input.Input, error) {
3838
return r.Input, nil
3939
}
4040

41-
var AuthProxyServiceTemplate = `apiVersion: v1
41+
const AuthProxyServiceTemplate = `apiVersion: v1
4242
kind: Service
4343
metadata:
4444
annotations:

0 commit comments

Comments
 (0)