Skip to content

Commit

Permalink
refactor: use gojson to marshal config for SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Jun 26, 2023
1 parent 23d7cdb commit 2501474
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/bombsimon/logrusr/v2 v2.0.1
github.com/deepmap/oapi-codegen v1.13.0
github.com/go-logr/logr v1.2.4
github.com/goccy/go-json v0.10.2
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/jpillora/backoff v1.0.0
Expand Down Expand Up @@ -60,7 +61,6 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/go-containerregistry v0.13.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/dataplane/deckgen/deckgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package deckgen

import (
"crypto/sha256"
"encoding/json"
"fmt"

gojson "github.com/goccy/go-json"
"github.com/kong/deck/file"
"github.com/kong/go-kong/kong"
)

// GenerateSHA generates a SHA256 checksum of targetContent, with the purpose
// of change detection.
func GenerateSHA(targetContent *file.Content) ([]byte, error) {
jsonConfig, err := json.Marshal(targetContent)
jsonConfig, err := gojson.Marshal(targetContent)
if err != nil {
return nil, fmt.Errorf("marshaling Kong declarative configuration to JSON: %w", err)
}
Expand Down

0 comments on commit 2501474

Please sign in to comment.