Add comment filter for config

This commit is contained in:
世界
2022-09-07 22:55:57 +08:00
parent ac539ace70
commit 87bc292296
2 changed files with 129 additions and 1 deletions

View File

@@ -20,7 +20,7 @@ type _Options struct {
type Options _Options
func (o *Options) UnmarshalJSON(content []byte) error {
decoder := json.NewDecoder(bytes.NewReader(content))
decoder := json.NewDecoder(json.NewCommentFilter(bytes.NewReader(content)))
decoder.DisallowUnknownFields()
err := decoder.Decode((*_Options)(o))
if err == nil {