Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining lint errors #578

Merged
merged 1 commit into from
May 30, 2023
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
5 changes: 2 additions & 3 deletions cmd/thriftbreak/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package main
import (
"bytes"
"io"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -90,7 +89,7 @@ func TestThriftBreakIntegration(t *testing.T) {
tmpDir := t.TempDir()
breaktest.CreateRepoAndCommit(t, tmpDir, from, to, remove)

f, err := ioutil.TempFile(tmpDir, "stdout")
f, err := os.CreateTemp(tmpDir, "stdout")
require.NoError(t, err, "create temporary file")
defer func(oldStdout *os.File) {
assert.NoError(t, f.Close())
Expand All @@ -103,7 +102,7 @@ func TestThriftBreakIntegration(t *testing.T) {
require.Error(t, err, "expected an error with Thrift backwards incompatible changes")
assert.EqualError(t, err, "found 5 issues")

stderr, err := ioutil.ReadFile(f.Name())
stderr, err := os.ReadFile(f.Name())
require.NoError(t, err)

out := string(stderr)
Expand Down
4 changes: 3 additions & 1 deletion gen/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
"unicode/utf8"

"go.uber.org/thriftrw/compile"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)

// isAllCaps checks if a string contains all capital letters only. Non-letters
Expand Down Expand Up @@ -63,7 +65,7 @@ func pascalCase(allowAllCaps bool, words ...string) string {
if isAllCaps(chunk) && !allowAllCaps {
// A single ALLCAPS word does not count as SCREAMING_SNAKE_CASE.
// There must be at least one underscore.
words[i] = strings.Title(strings.ToLower(chunk))
words[i] = cases.Title(language.English).String(strings.ToLower(chunk))
continue
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
go.uber.org/multierr v1.1.0
go.uber.org/zap v1.9.1
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
golang.org/x/text v0.7.0
golang.org/x/tools v0.4.1-0.20221208213631-3f74d914ae6d
honnef.co/go/tools v0.4.3
)
Expand Down