aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser/lowercase_camel_json.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <[email protected]>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /parser/lowercase_camel_json.go
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
downloadhugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.tar.gz
hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.zip
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'parser/lowercase_camel_json.go')
-rw-r--r--parser/lowercase_camel_json.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/parser/lowercase_camel_json.go b/parser/lowercase_camel_json.go
index 6994d1215..fb283a1c4 100644
--- a/parser/lowercase_camel_json.go
+++ b/parser/lowercase_camel_json.go
@@ -22,8 +22,10 @@ import (
)
// Regexp definitions
-var keyMatchRegex = regexp.MustCompile(`\"(\w+)\":`)
-var wordBarrierRegex = regexp.MustCompile(`(\w)([A-Z])`)
+var (
+ keyMatchRegex = regexp.MustCompile(`\"(\w+)\":`)
+ wordBarrierRegex = regexp.MustCompile(`(\w)([A-Z])`)
+)
// Code adapted from https://gist.github.com/piersy/b9934790a8892db1a603820c0c23e4a7
type LowerCaseCamelJSONMarshaller struct {
@@ -36,7 +38,6 @@ func (c LowerCaseCamelJSONMarshaller) MarshalJSON() ([]byte, error) {
converted := keyMatchRegex.ReplaceAllFunc(
marshalled,
func(match []byte) []byte {
-
// Attributes on the form XML, JSON etc.
if bytes.Equal(match, bytes.ToUpper(match)) {
return bytes.ToLower(match)