mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-12 14:16:41 +02:00
Backport #37162 by @silverwind When running `golangci-lint` without `GOEXPERIMENT=jsonv2`, a lint error `import 'encoding/json' is not allowed` is seen. All other files in the module that import `encodings/json` have `//nolint` already, so add it. --- This PR was written with the help of Claude Opus 4.6 Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
26 lines
513 B
Go
26 lines
513 B
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build !goexperiment.jsonv2
|
|
|
|
package json
|
|
|
|
import (
|
|
"encoding/json" //nolint:depguard // this package wraps it
|
|
"io"
|
|
)
|
|
|
|
func getDefaultJSONHandler() Interface {
|
|
return jsonGoccy{}
|
|
}
|
|
|
|
func MarshalKeepOptionalEmpty(v any) ([]byte, error) {
|
|
return DefaultJSONHandler.Marshal(v)
|
|
}
|
|
|
|
func NewDecoderCaseInsensitive(reader io.Reader) Decoder {
|
|
return DefaultJSONHandler.NewDecoder(reader)
|
|
}
|
|
|
|
type Value = json.RawMessage
|