Skip to content

Commit e8bf254

Browse files
authored
Merge pull request kubernetes#76724 from xichengliudui/constant-block-kubectl
Use constant blocks to define constants in pkg/kubectl
2 parents c58864d + 119400a commit e8bf254

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

pkg/kubectl/cmd/apply/apply_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ const (
100100
dirName = "../../../../test/fixtures/pkg/kubectl/cmd/apply/testdir"
101101
filenameRCJSON = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc.json"
102102

103-
filenameWidgetClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-clientside.yaml"
104-
filenameWidgetServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-serverside.yaml"
103+
filenameWidgetClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-clientside.yaml"
104+
filenameWidgetServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-serverside.yaml"
105+
filenameDeployObjServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-serverside.yaml"
106+
filenameDeployObjClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-clientside.yaml"
105107
)
106108

107109
func readConfigMapList(t *testing.T, filename string) [][]byte {
@@ -870,11 +872,6 @@ func testApplyMultipleObjects(t *testing.T, asList bool) {
870872
}
871873
}
872874

873-
const (
874-
filenameDeployObjServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-serverside.yaml"
875-
filenameDeployObjClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-clientside.yaml"
876-
)
877-
878875
func readDeploymentFromFile(t *testing.T, file string) []byte {
879876
raw := readBytesFromFile(t, file)
880877
obj := &appsv1.Deployment{}

pkg/kubectl/cmd/set/set_serviceaccount_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ import (
4141
"k8s.io/kubernetes/pkg/kubectl/scheme"
4242
)
4343

44-
const serviceAccount = "serviceaccount1"
45-
const serviceAccountMissingErrString = "serviceaccount is required"
46-
const resourceMissingErrString = `You must provide one or more resources by argument or filename.
44+
const (
45+
serviceAccount = "serviceaccount1"
46+
serviceAccountMissingErrString = "serviceaccount is required"
47+
resourceMissingErrString = `You must provide one or more resources by argument or filename.
4748
Example resource specifications include:
4849
'-f rsrc.yaml'
4950
'--filename=rsrc.json'
5051
'<resource> <name>'
5152
'<resource>'`
53+
)
5254

5355
func TestSetServiceAccountLocal(t *testing.T) {
5456
inputs := []struct {

pkg/kubectl/explain/model_printer.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import (
2121
"k8s.io/kube-openapi/pkg/util/proto"
2222
)
2323

24-
// fieldIndentLevel is the level of indentation for fields.
25-
const fieldIndentLevel = 3
26-
27-
// descriptionIndentLevel is the level of indentation for the
28-
// description.
29-
const descriptionIndentLevel = 5
24+
const (
25+
// fieldIndentLevel is the level of indentation for fields.
26+
fieldIndentLevel = 3
27+
// descriptionIndentLevel is the level of indentation for the
28+
// description.
29+
descriptionIndentLevel = 5
30+
)
3031

3132
// modelPrinter prints a schema in Writer. Its "Builder" will decide if
3233
// it's recursive or not.

0 commit comments

Comments
 (0)