Skip to content

Commit

Permalink
Ignore lint errors for strings.Title in test code
Browse files Browse the repository at this point in the history
strings.Title is broken for certain types of unicode string, however
in this test code we are only ever using on single word ASCII strings
where it works fine. We don't want to take another dependency to fix
(x/text) which is the recommended fix, so we will just ignore the lint
errors since they are false positives here.
  • Loading branch information
ncw committed Aug 29, 2024
1 parent d2de41c commit 883590e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions swifttest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func fatalf(code int, codeStr string, errf string, a ...interface{}) {
func (m metadata) setMetadata(a *action, resource string) {
for key, values := range a.req.Header {
key = http.CanonicalHeaderKey(key)
//nolint:staticcheck // strings.Title is broken in a way this test code doesn't care about
if metaHeaders[key] || strings.HasPrefix(key, "X-"+strings.Title(resource)+"-Meta-") {
if values[0] != "" || resource == "object" {
m.meta[key] = values
Expand Down Expand Up @@ -457,6 +458,7 @@ func (r containerResource) put(a *action) interface{} {

if strings.HasPrefix(ks[1], "meta.") {
meta := strings.TrimLeft(ks[1], "meta.")
//nolint:staticcheck // strings.Title is broken in a way that this test code doesn't care about
obj.meta["X-Object-Meta-"+strings.Title(meta)] = []string{v}
}
}
Expand Down

0 comments on commit 883590e

Please sign in to comment.