Skip to content

Commit d1e7eb0

Browse files
committed
Fix lint
1 parent 6bf55ae commit d1e7eb0

File tree

7 files changed

+54
-34
lines changed

7 files changed

+54
-34
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected]
32-
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected].12
32+
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected].15
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ require (
2828
github.com/PuerkitoBio/goquery v1.10.3
2929
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0
3030
github.com/alecthomas/chroma/v2 v2.20.0
31-
github.com/aws/aws-sdk-go-v2/credentials v1.18.9
32-
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.1
31+
github.com/aws/aws-sdk-go-v2/credentials v1.18.10
32+
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.2
3333
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
3434
github.com/blevesearch/bleve/v2 v2.5.3
3535
github.com/bohde/codel v0.2.0
@@ -146,9 +146,9 @@ require (
146146
github.com/andybalholm/brotli v1.2.0 // indirect
147147
github.com/andybalholm/cascadia v1.3.3 // indirect
148148
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
149-
github.com/aws/aws-sdk-go-v2 v1.38.2 // indirect
150-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.5 // indirect
151-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.5 // indirect
149+
github.com/aws/aws-sdk-go-v2 v1.38.3 // indirect
150+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.6 // indirect
151+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.6 // indirect
152152
github.com/aws/smithy-go v1.23.0 // indirect
153153
github.com/aymerick/douceur v0.2.0 // indirect
154154
github.com/beorn7/perks v1.0.1 // indirect

go.sum

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,24 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
101101
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
102102
github.com/aws/aws-sdk-go-v2 v1.38.2 h1:QUkLO1aTW0yqW95pVzZS0LGFanL71hJ0a49w4TJLMyM=
103103
github.com/aws/aws-sdk-go-v2 v1.38.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY=
104+
github.com/aws/aws-sdk-go-v2 v1.38.3 h1:B6cV4oxnMs45fql4yRH+/Po/YU+597zgWqvDpYMturk=
105+
github.com/aws/aws-sdk-go-v2 v1.38.3/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY=
104106
github.com/aws/aws-sdk-go-v2/credentials v1.18.9 h1:zKrnPtmO7j2FpMqudayjCzNxyO8KtPQGCIzqEosKQbg=
105107
github.com/aws/aws-sdk-go-v2/credentials v1.18.9/go.mod h1:gAotjkj0roLrwvBxECN1Q8ILfkVsw3Ntph6FP1LnZ8Q=
108+
github.com/aws/aws-sdk-go-v2/credentials v1.18.10 h1:xdJnXCouCx8Y0NncgoptztUocIYLKeQxrCgN6x9sdhg=
109+
github.com/aws/aws-sdk-go-v2/credentials v1.18.10/go.mod h1:7tQk08ntj914F/5i9jC4+2HQTAuJirq7m1vZVIhEkWs=
106110
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.5 h1:d45S2DqHZOkHu0uLUW92VdBoT5v0hh3EyR+DzMEh3ag=
107111
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.5/go.mod h1:G6e/dR2c2huh6JmIo9SXysjuLuDDGWMeYGibfW2ZrXg=
112+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.6 h1:uF68eJA6+S9iVr9WgX1NaRGyQ/6MdIyc4JNUo6TN1FA=
113+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.6/go.mod h1:qlPeVZCGPiobx8wb1ft0GHT5l+dc6ldnwInDFaMvC7Y=
108114
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.5 h1:ENhnQOV3SxWHplOqNN1f+uuCNf9n4Y/PKpl6b1WRP0Q=
109115
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.5/go.mod h1:csQLMI+odbC0/J+UecSTztG70Dc4aTCOu4GyPNDNpVo=
116+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.6 h1:pa1DEC6JoI0zduhZePp3zmhWvk/xxm4NB8Hy/Tlsgos=
117+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.6/go.mod h1:gxEjPebnhWGJoaDdtDkA0JX46VRg1wcTHYe63OfX5pE=
110118
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.1 h1:zqrLMYxiBhTcApxEmmD0MkFssRjK/yn8qrPFyZgHe90=
111119
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.1/go.mod h1:MdO/rN8DiJUtWlY5XCoOjHaAAY/AvxQ5L4rFRUhe3NU=
120+
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.2 h1:qIySgaSYDLcInLpY0e7HPCi+AVeD/LTsl9EL1b692oA=
121+
github.com/aws/aws-sdk-go-v2/service/codecommit v1.32.2/go.mod h1:SobWM1535Mn1WuThoIVLiLa/C1rRbxbbq5PZW2QFCIM=
112122
github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE=
113123
github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
114124
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
@@ -216,6 +226,7 @@ github.com/couchbase/gomemcached v0.3.3/go.mod h1:pISAjweI42vljCumsJIo7CVhqIMIIP
216226
github.com/couchbase/goutils v0.1.2 h1:gWr8B6XNWPIhfalHNog3qQKfGiYyh4K4VhO3P2o9BCs=
217227
github.com/couchbase/goutils v0.1.2/go.mod h1:h89Ek/tiOxxqjz30nPPlwZdQbdB8BwgnuBxeoUe/ViE=
218228
github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs=
229+
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
219230
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
220231
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
221232
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -633,6 +644,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
633644
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
634645
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
635646
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
647+
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
648+
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
636649
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
637650
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
638651
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=

modules/indexer/issues/meilisearch/meilisearch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package meilisearch
55

66
import (
77
"context"
8-
"encoding/json"
98
"errors"
109
"fmt"
1110
"strconv"
@@ -15,6 +14,7 @@ import (
1514
indexer_internal "code.gitea.io/gitea/modules/indexer/internal"
1615
inner_meilisearch "code.gitea.io/gitea/modules/indexer/internal/meilisearch"
1716
"code.gitea.io/gitea/modules/indexer/issues/internal"
17+
"code.gitea.io/gitea/modules/json"
1818

1919
"github.com/meilisearch/meilisearch-go"
2020
)

modules/indexer/issues/meilisearch/meilisearch_test.go

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"code.gitea.io/gitea/modules/indexer/issues/internal"
1414
"code.gitea.io/gitea/modules/indexer/issues/internal/tests"
15+
"code.gitea.io/gitea/modules/json"
1516

1617
"github.com/meilisearch/meilisearch-go"
1718
"github.com/stretchr/testify/assert"
@@ -45,30 +46,42 @@ func TestMeilisearchIndexer(t *testing.T) {
4546
}
4647

4748
func TestConvertHits(t *testing.T) {
49+
convert := func(d any) []byte {
50+
b, _ := json.Marshal(d)
51+
return b
52+
}
53+
4854
_, err := convertHits(&meilisearch.SearchResponse{
49-
Hits: []any{"aa", "bb", "cc", "dd"},
55+
Hits: []meilisearch.Hit{
56+
{
57+
"aa": convert(1),
58+
"bb": convert(2),
59+
"cc": convert(3),
60+
"dd": convert(4),
61+
},
62+
},
5063
})
5164
assert.ErrorIs(t, err, ErrMalformedResponse)
5265

5366
validResponse := &meilisearch.SearchResponse{
54-
Hits: []any{
55-
map[string]any{
56-
"id": float64(11),
57-
"title": "a title",
58-
"content": "issue body with no match",
59-
"comments": []any{"hey whats up?", "I'm currently bowling", "nice"},
67+
Hits: []meilisearch.Hit{
68+
{
69+
"id": convert(float64(11)),
70+
"title": convert("a title"),
71+
"content": convert("issue body with no match"),
72+
"comments": convert([]any{"hey whats up?", "I'm currently bowling", "nice"}),
6073
},
61-
map[string]any{
62-
"id": float64(22),
63-
"title": "Bowling as title",
64-
"content": "",
65-
"comments": []any{},
74+
{
75+
"id": convert(float64(22)),
76+
"title": convert("Bowling as title"),
77+
"content": convert(""),
78+
"comments": convert([]any{}),
6679
},
67-
map[string]any{
68-
"id": float64(33),
69-
"title": "Bowl-ing as fuzzy match",
70-
"content": "",
71-
"comments": []any{},
80+
{
81+
"id": convert(float64(33)),
82+
"title": convert("Bowl-ing as fuzzy match"),
83+
"content": convert(""),
84+
"comments": convert([]any{}),
7285
},
7386
},
7487
}

services/migrations/gitlab.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (f *GitlabDownloaderFactory) New(ctx context.Context, opts base.MigrateOpti
5050

5151
log.Trace("Create gitlab downloader. BaseURL: %s RepoName: %s", baseURL, repoNameSpace)
5252

53-
return NewGitlabDownloader(ctx, baseURL, repoNameSpace, opts.AuthUsername, opts.AuthPassword, opts.AuthToken)
53+
return NewGitlabDownloader(ctx, baseURL, repoNameSpace, opts.AuthToken)
5454
}
5555

5656
// GitServiceType returns the type of git service
@@ -93,14 +93,8 @@ type GitlabDownloader struct {
9393
//
9494
// Use either a username/password, personal token entered into the username field, or anonymous/public access
9595
// Note: Public access only allows very basic access
96-
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
96+
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, token string) (*GitlabDownloader, error) {
9797
gitlabClient, err := gitlab.NewClient(token, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
98-
// Only use basic auth if token is blank and password is NOT
99-
// Basic auth will fail with empty strings, but empty token will allow anonymous public API usage
100-
if token == "" && password != "" {
101-
gitlabClient, err = gitlab.NewBasicAuthClient(username, password, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
102-
}
103-
10498
if err != nil {
10599
log.Trace("Error logging into gitlab: %v", err)
106100
return nil, err
@@ -206,7 +200,7 @@ func (g *GitlabDownloader) GetTopics(ctx context.Context) ([]string, error) {
206200
if err != nil {
207201
return nil, err
208202
}
209-
return gr.TagList, err
203+
return gr.Topics, err
210204
}
211205

212206
// GetMilestones returns milestones

services/migrations/gitlab_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
3131
t.Skipf("Can't access test repo, skipping %s", t.Name())
3232
}
3333
ctx := t.Context()
34-
downloader, err := NewGitlabDownloader(ctx, "https://gitlab.com", "gitea/test_repo", "", "", gitlabPersonalAccessToken)
34+
downloader, err := NewGitlabDownloader(ctx, "https://gitlab.com", "gitea/test_repo", gitlabPersonalAccessToken)
3535
if err != nil {
3636
t.Fatalf("NewGitlabDownloader is nil: %v", err)
3737
}

0 commit comments

Comments
 (0)