summaryrefslogtreecommitdiffhomepage
path: root/modules.go
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2023-02-22 13:39:40 -0500
committerGitHub <[email protected]>2023-02-22 11:39:40 -0700
commit79de6df93d0404790c3bfecfefa9e1458ffcff75 (patch)
treeb4056129957e9faaeecebe6e01f3a4101130d862 /modules.go
parent8bc05e598da0068358a2876c45f92f2c77455341 (diff)
downloadcaddy-79de6df93d0404790c3bfecfefa9e1458ffcff75.tar.gz
caddy-79de6df93d0404790c3bfecfefa9e1458ffcff75.zip
cmd: Strict unmarshal for validate (#5383)
Diffstat (limited to 'modules.go')
-rw-r--r--modules.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules.go b/modules.go
index e83bc747e..470c25e37 100644
--- a/modules.go
+++ b/modules.go
@@ -333,11 +333,11 @@ func ParseStructTag(tag string) (map[string]string, error) {
return results, nil
}
-// strictUnmarshalJSON is like json.Unmarshal but returns an error
+// StrictUnmarshalJSON is like json.Unmarshal but returns an error
// if any of the fields are unrecognized. Useful when decoding
// module configurations, where you want to be more sure they're
// correct.
-func strictUnmarshalJSON(data []byte, v any) error {
+func StrictUnmarshalJSON(data []byte, v any) error {
dec := json.NewDecoder(bytes.NewReader(data))
dec.DisallowUnknownFields()
return dec.Decode(v)