Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ linters:
- RepositoriesSearchResult.Repositories
- RepositoriesSearchResult.Total
- RepositoryVulnerabilityAlert.GitHubSecurityAdvisoryID
- SCIMDisplayReference.Ref
- SecretScanningAlertLocationDetails.Startline # TODO: StartLine
- SecretScanningPatternOverride.Bypassrate # TODO: BypassRate
- StarredRepository.Repository # TODO: Repo
Expand Down
2 changes: 2 additions & 0 deletions tools/jsonfieldname/jsonfieldname.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ func checkGoFieldName(structName, goFieldName, jsonTagName string, tokenPos toke
}

func splitJSONTag(jsonTagName string) []string {
jsonTagName = strings.TrimPrefix(jsonTagName, "$")

if strings.Contains(jsonTagName, "_") {
return strings.Split(jsonTagName, "_")
}
Expand Down
1 change: 1 addition & 0 deletions tools/jsonfieldname/testdata/src/has-warnings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ type Example struct {
Id string `json:"id,omitempty"` // want `change Go field name "Id" to "ID" for JSON tag "id" in struct "Example"`
strings string `json:"strings,omitempty"` // want `change Go field name "strings" to "Strings" for JSON tag "strings" in struct "Example"`
camelcaseexample *int `json:"camelCaseExample,omitempty"` // want `change Go field name "camelcaseexample" to "CamelCaseExample" for JSON tag "camelCaseExample" in struct "Example"`
DollarRef string `json:"$ref"` // want `change Go field name "DollarRef" to "Ref" for JSON tag "\$ref" in struct "Example"`
}
1 change: 1 addition & 0 deletions tools/jsonfieldname/testdata/src/no-warnings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ type Example struct {
GithubThing string `json:"github_thing"` // Should not be flagged
ID string `json:"id,omitempty"` // Should not be flagged
Strings string `json:"strings,omitempty"` // Should not be flagged
Ref string `json:"$ref,omitempty"` // Should not be flagged
}
Loading