Skip to content

Commit ca16e02

Browse files
committed
Enable linter 'wsl'
This is a highly controversial linter, but it generally has a positive effect on code readability.
1 parent 4544829 commit ca16e02

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ linters:
1414
- typecheck
1515
- unused
1616
- whitespace
17+
- wsl
1718

1819
linters-settings:
1920
goimports:

testingpg/testingpg.go

+8
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ func newPostgres(t TestingT) *Postgres {
4848
urlStr := os.Getenv("TESTING_DB_URL")
4949
if urlStr == "" {
5050
urlStr = "postgresql://postgres:postgres@localhost:32260/postgres?sslmode=disable"
51+
5152
const format = "env TESTING_DB_URL is empty, used default value: %s"
53+
5254
t.Logf(format, urlStr)
5355
}
5456

@@ -125,16 +127,20 @@ func newUniqueHumanReadableDatabaseName(t TestingT) string {
125127
maxHumanReadableLenBytes := maxIdentifierLengthBytes - len(uid)
126128

127129
lastSymbolIsHyphen := false
130+
128131
for _, r := range t.Name() {
129132
if unicode.IsLetter(r) || unicode.IsNumber(r) {
130133
output.WriteRune(r)
134+
131135
lastSymbolIsHyphen = false
132136
} else {
133137
if !lastSymbolIsHyphen {
134138
output.WriteRune('-')
135139
}
140+
136141
lastSymbolIsHyphen = true
137142
}
143+
138144
if output.Len() >= maxHumanReadableLenBytes {
139145
break
140146
}
@@ -157,7 +163,9 @@ func genUnique8BytesID(t TestingT) string {
157163
func replaceDBName(t TestingT, dataSourceURL, dbname string) string {
158164
r, err := url.Parse(dataSourceURL)
159165
require.NoError(t, err)
166+
160167
r.Path = dbname
168+
161169
return r.String()
162170
}
163171

user_repository.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ func (r *UserRepository) ReadUser(ctx context.Context, userID uuid.UUID) (User,
2626
user := User{}
2727

2828
row := r.db.QueryRow(ctx, sql, userID)
29+
2930
err := row.Scan(&user.ID, &user.Username, &user.CreatedAt)
3031
if err != nil {
3132
const format = "failed selection of User from database: %v"
33+
3234
return User{}, fmt.Errorf(format, err)
3335
}
3436

user_repository_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestUserRepository_CreateUser(t *testing.T) {
2020
if testing.Short() {
2121
t.Skip("skipping test in short mode")
2222
}
23+
2324
t.Parallel()
2425

2526
newFullyFiledUser := func() rootpkg.User {

0 commit comments

Comments
 (0)