Skip to content

Commit 0ef1e62

Browse files
committed
update golden files
1 parent 30268a6 commit 0ef1e62

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

cli/clibase/values.go

+22
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ func (i *Validator[T]) Type() string {
5959
return i.Value.Type()
6060
}
6161

62+
func (u *Validator[T]) MarshalYAML() (interface{}, error) {
63+
m, ok := any(u.Value).(yaml.Marshaler)
64+
if !ok {
65+
return u.Value, nil
66+
}
67+
return m.MarshalYAML()
68+
}
69+
70+
func (u *Validator[T]) UnmarshalYAML(n *yaml.Node) error {
71+
return n.Decode(u.Value)
72+
}
73+
74+
func (u *Validator[T]) MarshalJSON() ([]byte, error) {
75+
return json.Marshal(u.Value)
76+
}
77+
78+
func (u *Validator[T]) UnmarshalJSON(b []byte) error {
79+
return json.Unmarshal(b, u.Value)
80+
}
81+
82+
func (*Validator[T]) IsValidator() {}
83+
6284
// values.go contains a standard set of value types that can be used as
6385
// Option Values.
6486

cli/clibase/yaml.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,17 @@ func (optSet *OptionSet) MarshalYAML() (any, error) {
7474
Value: opt.YAML,
7575
HeadComment: comment,
7676
}
77+
78+
_, isValidator := opt.Value.(interface{ IsValidator() })
79+
7780
var valueNode yaml.Node
7881
if opt.Value == nil {
7982
valueNode = yaml.Node{
8083
Kind: yaml.ScalarNode,
8184
Value: "null",
8285
}
83-
} else if m, ok := opt.Value.(yaml.Marshaler); ok {
86+
} else if m, ok := opt.Value.(yaml.Marshaler); ok && !isValidator {
87+
// Validators do a wrap, and should be handled by the else statement.
8488
v, err := m.MarshalYAML()
8589
if err != nil {
8690
return nil, xerrors.Errorf(

cli/testdata/coder_server_--help.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ NETWORKING OPTIONS:
167167
--secure-auth-cookie bool, $CODER_SECURE_AUTH_COOKIE
168168
Controls if the 'Secure' property is set on browser session cookies.
169169

170-
--wildcard-access-url url, $CODER_WILDCARD_ACCESS_URL
170+
--wildcard-access-url string, $CODER_WILDCARD_ACCESS_URL
171171
Specifies the wildcard hostname to use for workspace applications in
172172
the form "*.example.com".
173173

cli/testdata/server-config.yaml.golden

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ networking:
44
accessURL:
55
# Specifies the wildcard hostname to use for workspace applications in the form
66
# "*.example.com".
7-
# (default: <unset>, type: url)
8-
wildcardAccessURL:
7+
# (default: <unset>, type: string)
8+
wildcardAccessURL: ""
99
# Specifies the custom docs URL.
1010
# (default: <unset>, type: url)
1111
docsURL:

enterprise/cli/testdata/coder_server_--help.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ NETWORKING OPTIONS:
168168
--secure-auth-cookie bool, $CODER_SECURE_AUTH_COOKIE
169169
Controls if the 'Secure' property is set on browser session cookies.
170170

171-
--wildcard-access-url url, $CODER_WILDCARD_ACCESS_URL
171+
--wildcard-access-url string, $CODER_WILDCARD_ACCESS_URL
172172
Specifies the wildcard hostname to use for workspace applications in
173173
the form "*.example.com".
174174

0 commit comments

Comments
 (0)