Skip to content

Commit dd833d1

Browse files
Doozersmoul
andauthored
fix: lint (#438)
* fix(lint): up-to-date lint Signed-off-by: ismael FALL <[email protected]> * fix(lint): update go version ci tests Signed-off-by: ismael FALL <[email protected]> * fix(lint): update go version ci tests on all os Signed-off-by: ismael FALL <[email protected]> * chore: update .github/workflows/ci.yml Signed-off-by: ismael FALL <[email protected]> Co-authored-by: Manfred Touron <[email protected]>
1 parent aa4a5fb commit dd833d1

File tree

16 files changed

+28
-35
lines changed

16 files changed

+28
-35
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
uses: golangci/golangci-lint-action@v2
2424
with:
2525
args: --timeout=10m
26-
version: v1.28
26+
version: v1.49
2727
github-token: ${{ secrets.GITHUB_TOKEN }}
2828
tests-on-windows:
2929
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
3030
runs-on: windows-latest
3131
strategy:
3232
matrix:
3333
golang:
34-
- 1.15.x
34+
- 1.18.x
3535
steps:
3636
- uses: actions/checkout@v2
3737
- name: Install Go
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
matrix:
4949
golang:
50-
- 1.15.x
50+
- 1.18.x
5151
steps:
5252
- uses: actions/checkout@v2
5353
- name: Install Go
@@ -68,8 +68,8 @@ jobs:
6868
strategy:
6969
matrix:
7070
golang:
71-
- 1.14.x
72-
- 1.15.x
71+
- 1.18.x
72+
- 1.19.x
7373
steps:
7474
- uses: actions/checkout@v2
7575
- name: Install Go

go.mod

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/cmd/yolo/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func yolo(args []string) error {
170170
}
171171

172172
if artifactsCachePath != "" {
173-
if err := os.MkdirAll(artifactsCachePath, 0755); err != nil {
173+
if err := os.MkdirAll(artifactsCachePath, 0o755); err != nil {
174174
return err
175175
}
176176
}

go/pkg/yolopb/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func (b *Build) PrepareOutput(salt string) error {
2525

2626
// AddSignedURLs adds new fields containing URLs with a signature
2727
func (a *Artifact) AddSignedURLs(key string) error {
28-
2928
var err error
3029
a.DLArtifactSignedURL, err = signature.GetSignedURL("GET", "/api/artifact-dl/"+a.ID, "", key)
3130
if err != nil {

go/pkg/yolopb/util.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import (
55
"strings"
66
)
77

8-
var (
9-
signedOffByLine = regexp.MustCompile(`Signed-off-by: (.*)`)
10-
)
8+
var signedOffByLine = regexp.MustCompile(`Signed-off-by: (.*)`)
119

1210
func cleanupCommitMessage(msg string) string {
1311
if msg == "" {

go/pkg/yolostore/store.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
)
1010

1111
type Store interface {
12-
1312
// artifacts store
1413
GetArtifactByID(id string) (*yolopb.Artifact, error)
1514
GetAllArtifactsWithoutBundleID() ([]*yolopb.Artifact, error)

go/pkg/yolosvc/api_dev_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ func TestServiceDevDumpObjects(t *testing.T) {
120120

121121
assert.Equal(t, expectedDownloads, resp.Downloads)
122122
assert.Equal(t, expectedBatch, resp.Batch)
123-
124123
}
125124

126125
func TestServiceDevDumpObjects_withPreloading(t *testing.T) {
@@ -244,5 +243,4 @@ func TestServiceDevDumpObjects_withPreloading(t *testing.T) {
244243

245244
assert.Equal(t, expectedDownloads, resp.Downloads)
246245
assert.Equal(t, expectedBatch, resp.Batch)
247-
248246
}

go/pkg/yolosvc/api_download.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"context"
77
"fmt"
88
"io"
9-
"io/ioutil"
109
"net/http"
1110
"net/url"
1211
"os"
@@ -26,7 +25,6 @@ import (
2625
)
2726

2827
func (svc *service) ArtifactDownloader(w http.ResponseWriter, r *http.Request) {
29-
3028
id := chi.URLParam(r, "artifactID")
3129

3230
artifact, err := svc.store.GetArtifactByID(id)
@@ -200,7 +198,7 @@ func (svc *service) signAndStreamIPA(artifact yolopb.Artifact, w io.Writer) erro
200198
// sign ipa
201199
var signed string
202200
{
203-
tempdir, err := ioutil.TempDir("", "yolo")
201+
tempdir, err := os.MkdirTemp("", "yolo")
204202
if err != nil {
205203
return err
206204
}
@@ -209,7 +207,7 @@ func (svc *service) signAndStreamIPA(artifact yolopb.Artifact, w io.Writer) erro
209207
// write unsigned-file to tempdir
210208
unsigned := filepath.Join(tempdir, "unsigned.ipa")
211209
signed = filepath.Join(tempdir, "signed.ipa")
212-
f, err := os.OpenFile(unsigned, os.O_RDWR|os.O_CREATE, 0755)
210+
f, err := os.OpenFile(unsigned, os.O_RDWR|os.O_CREATE, 0o755)
213211
if err != nil {
214212
return err
215213
}
@@ -308,7 +306,7 @@ func (svc *service) artifactDownloadFromProvider(artifact *yolopb.Artifact, w io
308306
return fmt.Errorf("failed to download artifact: %w", err)
309307
}
310308
defer resp.Body.Close()
311-
zipContent, err = ioutil.ReadAll(resp.Body)
309+
zipContent, err = io.ReadAll(resp.Body)
312310
if err != nil {
313311
return fmt.Errorf("failed to download artifact stream: %w", err)
314312
}

go/pkg/yolosvc/api_plist.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"berty.tech/yolo/v2/go/pkg/plistgen"
1010
"github.com/go-chi/chi"
1111
"github.com/stretchr/signature"
12+
"golang.org/x/text/cases"
13+
"golang.org/x/text/language"
1214
"google.golang.org/grpc/codes"
1315
)
1416

@@ -36,9 +38,10 @@ func (svc *service) PlistGenerator(w http.ResponseWriter, r *http.Request) {
3638
url = "/api/artifact-dl/" + id
3739
)
3840
if artifact.HasBuild != nil && artifact.HasBuild.HasProject != nil {
39-
title = strings.Title(artifact.HasBuild.HasProject.Name)
41+
c := cases.Title(language.Und)
42+
title = c.String(artifact.HasBuild.HasProject.Name)
4043
if artifact.HasBuild.HasProject.HasOwner != nil {
41-
subtitle = strings.Title(artifact.HasBuild.HasProject.HasOwner.Name)
44+
subtitle = c.String(artifact.HasBuild.HasProject.HasOwner.Name)
4245
}
4346
}
4447
pkgURL, err := signature.GetSignedURL("GET", url, "", svc.authSalt)

go/pkg/yolosvc/driver_bintray.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type BintrayWorkerOpts struct {
2323
func (svc *service) BintrayWorker(ctx context.Context, opts BintrayWorkerOpts) error {
2424
opts.applyDefaults()
2525

26-
var logger = opts.Logger.Named("btry")
26+
logger := opts.Logger.Named("btry")
2727

2828
for iteration := 0; ; iteration++ {
2929
logger.Debug("bintray: refresh", zap.Int("iteration", iteration))

0 commit comments

Comments
 (0)