Skip to content

Commit

Permalink
Merge pull request #32 from asecurityteam/fix-deps-linting
Browse files Browse the repository at this point in the history
use cases.Title instead of strings.Title
  • Loading branch information
aslape authored Apr 27, 2023
2 parents 59ad7bc + 042d928 commit c5717cf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions messageparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"reflect"
"strconv"
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"
)

// Consts
Expand Down Expand Up @@ -744,9 +747,9 @@ func formatKey(key string) string {
for _, removal := range removals {
key = strings.ReplaceAll(key, removal, "")
}
// TODO: The strings.Title method is being deprecated and should be updated. cases.Title should be used instead.
// There is an issue when you try to use cases.Title that it will parse "EventDescription" as "Eventdescription" which breaks the tests.
return strings.Title(key) // nolint:go-lint,staticcheck

caser := cases.Title(language.English, cases.NoLower)
return caser.String(key)
}

// addUnexpectedKeyValue adds fields that do not currently exist in our Go struct into the UnexpectedFields map
Expand Down

0 comments on commit c5717cf

Please sign in to comment.