Skip to content

Commit 686a348

Browse files
committed
fix linting
1 parent 61a0ceb commit 686a348

File tree

9 files changed

+18
-10
lines changed

9 files changed

+18
-10
lines changed

bin/.golangci-lint-1.54.2.pkg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hermit

bin/golangci-lint

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.golangci-lint-1.54.2.pkg

cmd/autoquery/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
76
"log"
87
"os"
98
"path/filepath"
@@ -65,7 +64,7 @@ Example:
6564
}
6665
}
6766
for dest, sqlc := range files {
68-
err = ioutil.WriteFile(dest, sqlc.Bytes(), 0600)
67+
err = os.WriteFile(dest, sqlc.Bytes(), 0600)
6968
kctx.FatalIfErrorf(err)
7069
}
7170
}

database/migrations.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Migrate(ctx context.Context, dsn string) error {
2222
}
2323
defer conn.Close()
2424

25-
goose.SetDialect("sqlite3")
25+
_ = goose.SetDialect("sqlite3")
2626
goose.SetBaseFS(Migrations)
2727
goose.SetLogger(goose.NopLogger())
2828
err = goose.Up(conn, "schema")

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/sirupsen/logrus v1.9.3
1414
golang.org/x/oauth2 v0.12.0
1515
golang.org/x/sync v0.3.0
16+
golang.org/x/text v0.13.0
1617
golang.org/x/tools v0.13.0
1718
)
1819

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
5858
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5959
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6060
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
61+
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
62+
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
6163
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
6264
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
6365
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=

utils/config/config.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77

88
"github.com/alecthomas/errors"
99
"github.com/alecthomas/kong"
10+
"golang.org/x/text/cases"
11+
"golang.org/x/text/language"
1012
)
1113

1214
func CreateLoader(r io.Reader) (kong.Resolver, error) {
@@ -28,12 +30,13 @@ func CreateLoader(r io.Reader) (kong.Resolver, error) {
2830
}
2931

3032
func flatten(config map[string]interface{}) map[string]interface{} {
33+
caser := cases.Title(language.English)
3134
flat := map[string]interface{}{}
3235
for k, v := range config {
3336
switch v := v.(type) {
3437
case map[string]interface{}:
3538
for k2, v2 := range flatten(v) {
36-
flat[camelCase(k)+strings.Title(camelCase(k2))] = v2
39+
flat[camelCase(k)+caser.String(camelCase(k2))] = v2
3740
}
3841
default:
3942
flat[k] = v
@@ -43,6 +46,7 @@ func flatten(config map[string]interface{}) map[string]interface{} {
4346
}
4447

4548
func camelCase(s string) string {
46-
out := strings.ReplaceAll(strings.Title(strings.ReplaceAll(s, "-", " ")), " ", "")
49+
caser := cases.Title(language.English)
50+
out := strings.ReplaceAll(caser.String(strings.ReplaceAll(s, "-", " ")), " ", "")
4751
return strings.ToLower(out[:1]) + out[1:]
4852
}

workers/2-animate/worker.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func New(
7474
SET animate_attempt_ts = UNIXEPOCH()
7575
WHERE id = ?;
7676
*/
77-
db.UpdateDonationAnimateAttemptTs(ctx, row.ID)
77+
_ = db.UpdateDonationAnimateAttemptTs(ctx, row.ID)
7878
continue
7979
}
8080

@@ -87,15 +87,15 @@ func New(
8787
donable_ts = UNIXEPOCH()
8888
WHERE id = ?;
8989
*/
90-
db.UpdateDonationDonableAnimateTs(ctx, row.ID)
90+
_ = db.UpdateDonationDonableAnimateTs(ctx, row.ID)
9191
} else {
9292
/* autoquery name: UpdateDonationAnimateTs :exec
9393
9494
UPDATE donations
9595
SET animate_ts = UNIXEPOCH()
9696
WHERE id = ?;
9797
*/
98-
db.UpdateDonationAnimateTs(ctx, row.ID)
98+
_ = db.UpdateDonationAnimateTs(ctx, row.ID)
9999
}
100100
}
101101

workers/3-donate/worker.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func New(
9595
SET donate_attempt_ts = UNIXEPOCH()
9696
WHERE id = ?;
9797
*/
98-
db.UpdateDonationDonateAttemptTs(ctx, row.ID)
98+
_ = db.UpdateDonationDonateAttemptTs(ctx, row.ID)
9999
continue
100100
}
101101

@@ -105,7 +105,7 @@ func New(
105105
SET donate_ts = UNIXEPOCH()
106106
WHERE id = ?;
107107
*/
108-
db.UpdateDonationDonateTs(ctx, row.ID)
108+
_ = db.UpdateDonationDonateTs(ctx, row.ID)
109109
}
110110

111111
return nil

0 commit comments

Comments
 (0)