Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Upgrade dependencies #35384

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

Merged
techknowlogick merged 9 commits into go-gitea:main from lunny:lunny/upgrade_dependencies
Sep 3, 2025
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
2 changes: 1 addition & 1 deletion Makefile
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/air-verse/air@v1
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.12
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
Expand Down
29 changes: 27 additions & 2 deletions assets/go-licenses.json
View file Open in desktop

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contrib/backport/backport.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"strconv"
"strings"

"github.com/google/go-github/v71/github"
"github.com/google/go-github/v74/github"
"github.com/urfave/cli/v3"
"gopkg.in/yaml.v3"
)
Expand Down
175 changes: 91 additions & 84 deletions go.mod
View file Open in desktop

Large diffs are not rendered by default.

372 changes: 190 additions & 182 deletions go.sum
View file Open in desktop

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions modules/indexer/issues/meilisearch/meilisearch.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
indexer_internal "code.gitea.io/gitea/modules/indexer/internal"
inner_meilisearch "code.gitea.io/gitea/modules/indexer/internal/meilisearch"
"code.gitea.io/gitea/modules/indexer/issues/internal"
"code.gitea.io/gitea/modules/json"

"github.com/meilisearch/meilisearch-go"
)
Expand Down Expand Up @@ -106,7 +107,8 @@ func (b *Indexer) Index(_ context.Context, issues ...*internal.IndexerData) erro
return nil
}
for _, issue := range issues {
_, err := b.inner.Client.Index(b.inner.VersionedIndexName()).AddDocuments(issue)
// use default primary key which should be "id"
_, err := b.inner.Client.Index(b.inner.VersionedIndexName()).AddDocuments(issue, nil)
if err != nil {
return err
}
Expand Down Expand Up @@ -299,18 +301,13 @@ func doubleQuoteKeyword(k string) string {
func convertHits(searchRes *meilisearch.SearchResponse) ([]internal.Match, error) {
hits := make([]internal.Match, 0, len(searchRes.Hits))
for _, hit := range searchRes.Hits {
hit, ok := hit.(map[string]any)
if !ok {
return nil, ErrMalformedResponse
}

issueID, ok := hit["id"].(float64)
if !ok {
var issueID int64
if err := json.Unmarshal(hit["id"], &issueID); err != nil {
return nil, ErrMalformedResponse
}

hits = append(hits, internal.Match{
ID: int64(issueID),
ID: issueID,
})
}
return hits, nil
Expand Down
47 changes: 30 additions & 17 deletions modules/indexer/issues/meilisearch/meilisearch_test.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"code.gitea.io/gitea/modules/indexer/issues/internal"
"code.gitea.io/gitea/modules/indexer/issues/internal/tests"
"code.gitea.io/gitea/modules/json"

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

func TestConvertHits(t *testing.T) {
convert := func(d any) []byte {
b, _ := json.Marshal(d)
return b
}

_, err := convertHits(&meilisearch.SearchResponse{
Hits: []any{"aa", "bb", "cc", "dd"},
Hits: []meilisearch.Hit{
{
"aa": convert(1),
"bb": convert(2),
"cc": convert(3),
"dd": convert(4),
},
},
})
assert.ErrorIs(t, err, ErrMalformedResponse)

validResponse := &meilisearch.SearchResponse{
Hits: []any{
map[string]any{
"id": float64(11),
"title": "a title",
"content": "issue body with no match",
"comments": []any{"hey whats up?", "I'm currently bowling", "nice"},
Hits: []meilisearch.Hit{
{
"id": convert(float64(11)),
"title": convert("a title"),
"content": convert("issue body with no match"),
"comments": convert([]any{"hey whats up?", "I'm currently bowling", "nice"}),
},
map[string]any{
"id": float64(22),
"title": "Bowling as title",
"content": "",
"comments": []any{},
{
"id": convert(float64(22)),
"title": convert("Bowling as title"),
"content": convert(""),
"comments": convert([]any{}),
},
map[string]any{
"id": float64(33),
"title": "Bowl-ing as fuzzy match",
"content": "",
"comments": []any{},
{
"id": convert(float64(33)),
"title": convert("Bowl-ing as fuzzy match"),
"content": convert(""),
"comments": convert([]any{}),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion services/migrations/error.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package migrations
import (
"errors"

"github.com/google/go-github/v71/github"
"github.com/google/go-github/v74/github"
)

// ErrRepoNotCreated returns the error that repository not created
Expand Down
2 changes: 1 addition & 1 deletion services/migrations/github.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/structs"

"github.com/google/go-github/v71/github"
"github.com/google/go-github/v74/github"
"golang.org/x/oauth2"
)

Expand Down
12 changes: 3 additions & 9 deletions services/migrations/gitlab.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (f *GitlabDownloaderFactory) New(ctx context.Context, opts base.MigrateOpti

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

return NewGitlabDownloader(ctx, baseURL, repoNameSpace, opts.AuthUsername, opts.AuthPassword, opts.AuthToken)
return NewGitlabDownloader(ctx, baseURL, repoNameSpace, opts.AuthToken)
}

// GitServiceType returns the type of git service
Expand Down Expand Up @@ -93,14 +93,8 @@ type GitlabDownloader struct {
//
// Use either a username/password, personal token entered into the username field, or anonymous/public access
// Note: Public access only allows very basic access
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, token string) (*GitlabDownloader, error) {
gitlabClient, err := gitlab.NewClient(token, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
// Only use basic auth if token is blank and password is NOT
// Basic auth will fail with empty strings, but empty token will allow anonymous public API usage
if token == "" && password != "" {
gitlabClient, err = gitlab.NewBasicAuthClient(username, password, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
}

if err != nil {
log.Trace("Error logging into gitlab: %v", err)
return nil, err
Expand Down Expand Up @@ -206,7 +200,7 @@ func (g *GitlabDownloader) GetTopics(ctx context.Context) ([]string, error) {
if err != nil {
return nil, err
}
return gr.TagList, err
return gr.Topics, err
}

// GetMilestones returns milestones
Expand Down
2 changes: 1 addition & 1 deletion services/migrations/gitlab_test.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
t.Skipf("Can't access test repo, skipping %s", t.Name())
}
ctx := t.Context()
downloader, err := NewGitlabDownloader(ctx, "https://gitlab.com", "gitea/test_repo", "", "", gitlabPersonalAccessToken)
downloader, err := NewGitlabDownloader(ctx, "https://gitlab.com", "gitea/test_repo", gitlabPersonalAccessToken)
if err != nil {
t.Fatalf("NewGitlabDownloader is nil: %v", err)
}
Expand Down

AltStyle によって変換されたページ (->オリジナル) /