Skip to content

Commit aeda417

Browse files
authored
Merge pull request #620 from monopole/reduceSizeOfEmptyFieldMarkers
Reduce size of missing field markers.
2 parents 3e47a2c + d40f52e commit aeda417

File tree

6 files changed

+39
-39
lines changed

6 files changed

+39
-39
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
apiVersion: v1
22
data:
3-
altGreeting: Good Morning from default namespace!
3+
altGreeting: Good Morning from non-default namespace!
44
enableRisky: "false"
55
kind: ConfigMap
66
metadata:
7-
name: the-map-4959m5tm6c
7+
name: the-non-default-namespace-map-b6h49k7mt8
8+
namespace: non-default
89
---
910
apiVersion: v1
1011
data:
11-
altGreeting: Good Morning from non-default namespace!
12+
altGreeting: Good Morning from default namespace!
1213
enableRisky: "false"
1314
kind: ConfigMap
1415
metadata:
15-
name: the-non-default-namespace-map-b6h49k7mt8
16-
namespace: non-default
16+
name: the-map-4959m5tm6c
1717
---
1818
apiVersion: v1
1919
data:
2020
password.txt: dmVyeSRlY3JldA==
2121
kind: Secret
2222
metadata:
23-
name: the-secret-cfbmct72tb
23+
name: the-non-default-namespace-secret-255294gd9d
24+
namespace: non-default
2425
type: Opaque
2526
---
2627
apiVersion: v1
2728
data:
2829
password.txt: dmVyeSRlY3JldA==
2930
kind: Secret
3031
metadata:
31-
name: the-non-default-namespace-secret-255294gd9d
32-
namespace: non-default
32+
name: the-secret-cfbmct72tb
3333
type: Opaque
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
description: multibases with name reference
22
args: []
33
filename: testdata/testcase-multibases-conflict/combined
4-
expectedError: Multiple matches for name noGroup_v1_ServiceAccount
4+
expectedError: Multiple matches for name ~G_v1_ServiceAccount

pkg/gvk/gvk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func FromKind(k string) Gvk {
3636
}
3737

3838
const (
39-
noGroup = "noGroup"
40-
noVersion = "noVersion"
41-
noKind = "noKind"
39+
noGroup = "~G"
40+
noVersion = "~V"
41+
noKind = "~K"
4242
separator = "_"
4343
)
4444

pkg/gvk/gvk_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ var stringTests = []struct {
7575
x Gvk
7676
s string
7777
}{
78-
{Gvk{}, "noGroup_noVersion_noKind"},
79-
{Gvk{Kind: "k"}, "noGroup_noVersion_k"},
80-
{Gvk{Version: "v"}, "noGroup_v_noKind"},
81-
{Gvk{Version: "v", Kind: "k"}, "noGroup_v_k"},
82-
{Gvk{Group: "g"}, "g_noVersion_noKind"},
83-
{Gvk{Group: "g", Kind: "k"}, "g_noVersion_k"},
84-
{Gvk{Group: "g", Version: "v"}, "g_v_noKind"},
78+
{Gvk{}, "~G_~V_~K"},
79+
{Gvk{Kind: "k"}, "~G_~V_k"},
80+
{Gvk{Version: "v"}, "~G_v_~K"},
81+
{Gvk{Version: "v", Kind: "k"}, "~G_v_k"},
82+
{Gvk{Group: "g"}, "g_~V_~K"},
83+
{Gvk{Group: "g", Kind: "k"}, "g_~V_k"},
84+
{Gvk{Group: "g", Version: "v"}, "g_v_~K"},
8585
{Gvk{Group: "g", Version: "v", Kind: "k"}, "g_v_k"},
8686
}
8787

pkg/resid/resid.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ func NewResIdKindOnly(k string, n string) ResId {
7474
}
7575

7676
const (
77-
noNamespace = "noNamespace"
78-
noPrefix = "noPrefix"
79-
noName = "noName"
80-
noSuffix = "noSuffix"
77+
noNamespace = "~X"
78+
noPrefix = "~P"
79+
noName = "~N"
80+
noSuffix = "~S"
8181
separator = "|"
8282
)
8383

pkg/resid/resid_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ var stringTests = []struct {
1515
"g_v_k|ns|p|nm|s"},
1616
{ResId{gvKind: gvk.Gvk{Version: "v", Kind: "k"},
1717
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
18-
"noGroup_v_k|ns|p|nm|s"},
18+
"~G_v_k|ns|p|nm|s"},
1919
{ResId{gvKind: gvk.Gvk{Kind: "k"},
2020
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
21-
"noGroup_noVersion_k|ns|p|nm|s"},
21+
"~G_~V_k|ns|p|nm|s"},
2222
{ResId{gvKind: gvk.Gvk{},
2323
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
24-
"noGroup_noVersion_noKind|ns|p|nm|s"},
24+
"~G_~V_~K|ns|p|nm|s"},
2525
{ResId{gvKind: gvk.Gvk{},
2626
name: "nm", prefix: "p", suffix: "s"},
27-
"noGroup_noVersion_noKind|noNamespace|p|nm|s"},
27+
"~G_~V_~K|~X|p|nm|s"},
2828
{ResId{gvKind: gvk.Gvk{},
2929
name: "nm", suffix: "s"},
30-
"noGroup_noVersion_noKind|noNamespace|noPrefix|nm|s"},
30+
"~G_~V_~K|~X|~P|nm|s"},
3131
{ResId{gvKind: gvk.Gvk{},
3232
suffix: "s"},
33-
"noGroup_noVersion_noKind|noNamespace|noPrefix|noName|s"},
33+
"~G_~V_~K|~X|~P|~N|s"},
3434
{ResId{gvKind: gvk.Gvk{}},
35-
"noGroup_noVersion_noKind|noNamespace|noPrefix|noName|noSuffix"},
35+
"~G_~V_~K|~X|~P|~N|~S"},
3636
{ResId{},
37-
"noGroup_noVersion_noKind|noNamespace|noPrefix|noName|noSuffix"},
37+
"~G_~V_~K|~X|~P|~N|~S"},
3838
}
3939

4040
func TestString(t *testing.T) {
@@ -54,26 +54,26 @@ var gvknStringTests = []struct {
5454
"g_v_k|nm"},
5555
{ResId{gvKind: gvk.Gvk{Version: "v", Kind: "k"},
5656
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
57-
"noGroup_v_k|nm"},
57+
"~G_v_k|nm"},
5858
{ResId{gvKind: gvk.Gvk{Kind: "k"},
5959
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
60-
"noGroup_noVersion_k|nm"},
60+
"~G_~V_k|nm"},
6161
{ResId{gvKind: gvk.Gvk{},
6262
name: "nm", prefix: "p", suffix: "s", namespace: "ns"},
63-
"noGroup_noVersion_noKind|nm"},
63+
"~G_~V_~K|nm"},
6464
{ResId{gvKind: gvk.Gvk{},
6565
name: "nm", prefix: "p", suffix: "s"},
66-
"noGroup_noVersion_noKind|nm"},
66+
"~G_~V_~K|nm"},
6767
{ResId{gvKind: gvk.Gvk{},
6868
name: "nm", suffix: "s"},
69-
"noGroup_noVersion_noKind|nm"},
69+
"~G_~V_~K|nm"},
7070
{ResId{gvKind: gvk.Gvk{},
7171
suffix: "s"},
72-
"noGroup_noVersion_noKind|"},
72+
"~G_~V_~K|"},
7373
{ResId{gvKind: gvk.Gvk{}},
74-
"noGroup_noVersion_noKind|"},
74+
"~G_~V_~K|"},
7575
{ResId{},
76-
"noGroup_noVersion_noKind|"},
76+
"~G_~V_~K|"},
7777
}
7878

7979
func TestGvknString(t *testing.T) {

0 commit comments

Comments
 (0)