aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddyconfig/configadapters.go
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2022-08-02 16:39:09 -0400
committerGitHub <[email protected]>2022-08-02 16:39:09 -0400
commit141872ed80d6323505e7543628c259fdae8506d3 (patch)
tree53581cddf2fcce189c3a55019194b64b0cd3af13 /caddyconfig/configadapters.go
parentdb1aa5b5bc174e5a5df39a277f737b304e1e2350 (diff)
downloadcaddy-141872ed80d6323505e7543628c259fdae8506d3.tar.gz
caddy-141872ed80d6323505e7543628c259fdae8506d3.zip
chore: Bump up to Go 1.19, minimum 1.18 (#4925)
Diffstat (limited to 'caddyconfig/configadapters.go')
-rw-r--r--caddyconfig/configadapters.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/caddyconfig/configadapters.go b/caddyconfig/configadapters.go
index ccac5f880..0ca3c3af1 100644
--- a/caddyconfig/configadapters.go
+++ b/caddyconfig/configadapters.go
@@ -24,7 +24,7 @@ import (
// Adapter is a type which can adapt a configuration to Caddy JSON.
// It returns the results and any warnings, or an error.
type Adapter interface {
- Adapt(body []byte, options map[string]interface{}) ([]byte, []Warning, error)
+ Adapt(body []byte, options map[string]any) ([]byte, []Warning, error)
}
// Warning represents a warning or notice related to conversion.
@@ -48,7 +48,7 @@ func (w Warning) String() string {
// are converted to warnings. This is convenient when filling config
// structs that require a json.RawMessage, without having to worry
// about errors.
-func JSON(val interface{}, warnings *[]Warning) json.RawMessage {
+func JSON(val any, warnings *[]Warning) json.RawMessage {
b, err := json.Marshal(val)
if err != nil {
if warnings != nil {
@@ -64,9 +64,9 @@ func JSON(val interface{}, warnings *[]Warning) json.RawMessage {
// for encoding module values where the module name has to be described within
// the object by a certain key; for example, `"handler": "file_server"` for a
// file server HTTP handler (fieldName="handler" and fieldVal="file_server").
-// The val parameter must encode into a map[string]interface{} (i.e. it must be
+// The val parameter must encode into a map[string]any (i.e. it must be
// a struct or map). Any errors are converted into warnings.
-func JSONModuleObject(val interface{}, fieldName, fieldVal string, warnings *[]Warning) json.RawMessage {
+func JSONModuleObject(val any, fieldName, fieldVal string, warnings *[]Warning) json.RawMessage {
// encode to a JSON object first
enc, err := json.Marshal(val)
if err != nil {
@@ -77,7 +77,7 @@ func JSONModuleObject(val interface{}, fieldName, fieldVal string, warnings *[]W
}
// then decode the object
- var tmp map[string]interface{}
+ var tmp map[string]any
err = json.Unmarshal(enc, &tmp)
if err != nil {
if warnings != nil {