Skip to content

Commit a346a8c

Browse files
bump to use go 1.22 (go-gitea#29119)
1 parent 155269f commit a346a8c

File tree

13 files changed

+54
-54
lines changed

13 files changed

+54
-54
lines changed

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Gitea DevContainer",
3-
"image": "mcr.microsoft.com/devcontainers/go:1.21-bullseye",
3+
"image": "mcr.microsoft.com/devcontainers/go:1.22-bullseye",
44
"features": {
55
// installs nodejs into container
66
"ghcr.io/devcontainers/features/node:1": {

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.21-alpine3.19 AS build-env
2+
FROM docker.io/library/golang:1.22-alpine3.19 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}

Dockerfile.rootless

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.21-alpine3.19 AS build-env
2+
FROM docker.io/library/golang:1.22-alpine3.19 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ SHASUM ?= shasum -a 256
2323
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
2424
COMMA := ,
2525

26-
XGO_VERSION := go-1.21.x
26+
XGO_VERSION := go-1.22.x
2727

2828
AIR_PACKAGE ?= github.com/cosmtrek/[email protected]
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]

models/issues/issue_xref.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ func neuterCrossReferences(ctx context.Context, issueID, commentID int64) error
4646
for i, c := range active {
4747
ids[i] = c.ID
4848
}
49-
return neuterCrossReferencesIds(ctx, ids)
49+
return neuterCrossReferencesIDs(ctx, ids)
5050
}
5151

52-
func neuterCrossReferencesIds(ctx context.Context, ids []int64) error {
52+
func neuterCrossReferencesIDs(ctx context.Context, ids []int64) error {
5353
_, err := db.GetEngine(ctx).In("id", ids).Cols("`ref_action`").Update(&Comment{RefAction: references.XRefActionNeutered})
5454
return err
5555
}
@@ -100,7 +100,7 @@ func (issue *Issue) createCrossReferences(stdCtx context.Context, ctx *crossRefe
100100
}
101101
}
102102
if len(ids) > 0 {
103-
if err = neuterCrossReferencesIds(stdCtx, ids); err != nil {
103+
if err = neuterCrossReferencesIDs(stdCtx, ids); err != nil {
104104
return err
105105
}
106106
}

models/issues/review_list.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ type ReviewList []*Review
1818

1919
// LoadReviewers loads reviewers
2020
func (reviews ReviewList) LoadReviewers(ctx context.Context) error {
21-
reviewerIds := make([]int64, len(reviews))
21+
reviewerIDs := make([]int64, len(reviews))
2222
for i := 0; i < len(reviews); i++ {
23-
reviewerIds[i] = reviews[i].ReviewerID
23+
reviewerIDs[i] = reviews[i].ReviewerID
2424
}
25-
reviewers, err := user_model.GetPossibleUserByIDs(ctx, reviewerIds)
25+
reviewers, err := user_model.GetPossibleUserByIDs(ctx, reviewerIDs)
2626
if err != nil {
2727
return err
2828
}
@@ -38,12 +38,12 @@ func (reviews ReviewList) LoadReviewers(ctx context.Context) error {
3838
}
3939

4040
func (reviews ReviewList) LoadIssues(ctx context.Context) error {
41-
issueIds := container.Set[int64]{}
41+
issueIDs := container.Set[int64]{}
4242
for i := 0; i < len(reviews); i++ {
43-
issueIds.Add(reviews[i].IssueID)
43+
issueIDs.Add(reviews[i].IssueID)
4444
}
4545

46-
issues, err := GetIssuesByIDs(ctx, issueIds.Values())
46+
issues, err := GetIssuesByIDs(ctx, issueIDs.Values())
4747
if err != nil {
4848
return err
4949
}

modules/git/log_name_status.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ func (g *LogNameStatusRepoParser) Next(treepath string, paths2ids map[string]int
143143
}
144144

145145
// Our "line" must look like: <commitid> SP (<parent> SP) * NUL
146-
commitIds := string(g.next)
146+
commitIDs := string(g.next)
147147
if g.buffull {
148148
more, err := g.rd.ReadString('\x00')
149149
if err != nil {
150150
return nil, err
151151
}
152-
commitIds += more
152+
commitIDs += more
153153
}
154-
commitIds = commitIds[:len(commitIds)-1]
155-
splitIds := strings.Split(commitIds, " ")
156-
ret.CommitID = splitIds[0]
157-
if len(splitIds) > 1 {
158-
ret.ParentIDs = splitIds[1:]
154+
commitIDs = commitIDs[:len(commitIDs)-1]
155+
splitIDs := strings.Split(commitIDs, " ")
156+
ret.CommitID = splitIDs[0]
157+
if len(splitIDs) > 1 {
158+
ret.ParentIDs = splitIDs[1:]
159159
}
160160

161161
// now read the next "line"

modules/repository/generate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type GiteaTemplate struct {
9494
}
9595

9696
// Globs parses the .gitea/template globs or returns them if they were already parsed
97-
func (gt GiteaTemplate) Globs() []glob.Glob {
97+
func (gt *GiteaTemplate) Globs() []glob.Glob {
9898
if gt.globs != nil {
9999
return gt.globs
100100
}

routers/web/org/projects.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,16 @@ func ViewProject(ctx *context.Context) {
377377
linkedPrsMap := make(map[int64][]*issues_model.Issue)
378378
for _, issuesList := range issuesMap {
379379
for _, issue := range issuesList {
380-
var referencedIds []int64
380+
var referencedIDs []int64
381381
for _, comment := range issue.Comments {
382382
if comment.RefIssueID != 0 && comment.RefIsPull {
383-
referencedIds = append(referencedIds, comment.RefIssueID)
383+
referencedIDs = append(referencedIDs, comment.RefIssueID)
384384
}
385385
}
386386

387-
if len(referencedIds) > 0 {
387+
if len(referencedIDs) > 0 {
388388
if linkedPrs, err := issues_model.Issues(ctx, &issues_model.IssuesOptions{
389-
IssueIDs: referencedIds,
389+
IssueIDs: referencedIDs,
390390
IsPull: util.OptionalBoolTrue,
391391
}); err == nil {
392392
linkedPrsMap[issue.ID] = linkedPrs

routers/web/repo/projects.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,16 @@ func ViewProject(ctx *context.Context) {
339339
linkedPrsMap := make(map[int64][]*issues_model.Issue)
340340
for _, issuesList := range issuesMap {
341341
for _, issue := range issuesList {
342-
var referencedIds []int64
342+
var referencedIDs []int64
343343
for _, comment := range issue.Comments {
344344
if comment.RefIssueID != 0 && comment.RefIsPull {
345-
referencedIds = append(referencedIds, comment.RefIssueID)
345+
referencedIDs = append(referencedIDs, comment.RefIssueID)
346346
}
347347
}
348348

349-
if len(referencedIds) > 0 {
349+
if len(referencedIDs) > 0 {
350350
if linkedPrs, err := issues_model.Issues(ctx, &issues_model.IssuesOptions{
351-
IssueIDs: referencedIds,
351+
IssueIDs: referencedIDs,
352352
IsPull: util.OptionalBoolTrue,
353353
}); err == nil {
354354
linkedPrsMap[issue.ID] = linkedPrs

routers/web/user/home.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,17 @@ func Milestones(ctx *context.Context) {
296296
}
297297
}
298298

299-
showRepoIds := make(container.Set[int64], len(showRepos))
299+
showRepoIDs := make(container.Set[int64], len(showRepos))
300300
for _, repo := range showRepos {
301301
if repo.ID > 0 {
302-
showRepoIds.Add(repo.ID)
302+
showRepoIDs.Add(repo.ID)
303303
}
304304
}
305305
if len(repoIDs) == 0 {
306-
repoIDs = showRepoIds.Values()
306+
repoIDs = showRepoIDs.Values()
307307
}
308308
repoIDs = slices.DeleteFunc(repoIDs, func(v int64) bool {
309-
return !showRepoIds.Contains(v)
309+
return !showRepoIDs.Contains(v)
310310
})
311311

312312
var pagerCount int

services/repository/create_test.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import (
2121
func TestIncludesAllRepositoriesTeams(t *testing.T) {
2222
assert.NoError(t, unittest.PrepareTestDatabase())
2323

24-
testTeamRepositories := func(teamID int64, repoIds []int64) {
24+
testTeamRepositories := func(teamID int64, repoIDs []int64) {
2525
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID})
2626
assert.NoError(t, team.LoadRepositories(db.DefaultContext), "%s: GetRepositories", team.Name)
2727
assert.Len(t, team.Repos, team.NumRepos, "%s: len repo", team.Name)
28-
assert.Len(t, team.Repos, len(repoIds), "%s: repo count", team.Name)
29-
for i, rid := range repoIds {
28+
assert.Len(t, team.Repos, len(repoIDs), "%s: repo count", team.Name)
29+
for i, rid := range repoIDs {
3030
if rid > 0 {
3131
assert.True(t, HasRepository(db.DefaultContext, team, rid), "%s: HasRepository(%d) %d", rid, i)
3232
}
@@ -52,12 +52,12 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
5252
assert.True(t, ownerTeam.IncludesAllRepositories, "Owner team includes all repositories")
5353

5454
// Create repos.
55-
repoIds := make([]int64, 0)
55+
repoIDs := make([]int64, 0)
5656
for i := 0; i < 3; i++ {
5757
r, err := CreateRepositoryDirectly(db.DefaultContext, user, org.AsUser(), CreateRepoOptions{Name: fmt.Sprintf("repo-%d", i)})
5858
assert.NoError(t, err, "CreateRepository %d", i)
5959
if r != nil {
60-
repoIds = append(repoIds, r.ID)
60+
repoIDs = append(repoIDs, r.ID)
6161
}
6262
}
6363
// Get fresh copy of Owner team after creating repos.
@@ -93,10 +93,10 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
9393
},
9494
}
9595
teamRepos := [][]int64{
96-
repoIds,
97-
repoIds,
96+
repoIDs,
97+
repoIDs,
9898
{},
99-
repoIds,
99+
repoIDs,
100100
{},
101101
}
102102
for i, team := range teams {
@@ -109,7 +109,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
109109
// Update teams and check repositories.
110110
teams[3].IncludesAllRepositories = false
111111
teams[4].IncludesAllRepositories = true
112-
teamRepos[4] = repoIds
112+
teamRepos[4] = repoIDs
113113
for i, team := range teams {
114114
assert.NoError(t, models.UpdateTeam(db.DefaultContext, team, false, true), "%s: UpdateTeam", team.Name)
115115
testTeamRepositories(team.ID, teamRepos[i])
@@ -119,27 +119,27 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
119119
r, err := CreateRepositoryDirectly(db.DefaultContext, user, org.AsUser(), CreateRepoOptions{Name: "repo-last"})
120120
assert.NoError(t, err, "CreateRepository last")
121121
if r != nil {
122-
repoIds = append(repoIds, r.ID)
122+
repoIDs = append(repoIDs, r.ID)
123123
}
124-
teamRepos[0] = repoIds
125-
teamRepos[1] = repoIds
126-
teamRepos[4] = repoIds
124+
teamRepos[0] = repoIDs
125+
teamRepos[1] = repoIDs
126+
teamRepos[4] = repoIDs
127127
for i, team := range teams {
128128
testTeamRepositories(team.ID, teamRepos[i])
129129
}
130130

131131
// Remove repo and check teams repositories.
132-
assert.NoError(t, DeleteRepositoryDirectly(db.DefaultContext, user, repoIds[0]), "DeleteRepository")
133-
teamRepos[0] = repoIds[1:]
134-
teamRepos[1] = repoIds[1:]
135-
teamRepos[3] = repoIds[1:3]
136-
teamRepos[4] = repoIds[1:]
132+
assert.NoError(t, DeleteRepositoryDirectly(db.DefaultContext, user, repoIDs[0]), "DeleteRepository")
133+
teamRepos[0] = repoIDs[1:]
134+
teamRepos[1] = repoIDs[1:]
135+
teamRepos[3] = repoIDs[1:3]
136+
teamRepos[4] = repoIDs[1:]
137137
for i, team := range teams {
138138
testTeamRepositories(team.ID, teamRepos[i])
139139
}
140140

141141
// Wipe created items.
142-
for i, rid := range repoIds {
142+
for i, rid := range repoIDs {
143143
if i > 0 { // first repo already deleted.
144144
assert.NoError(t, DeleteRepositoryDirectly(db.DefaultContext, user, rid), "DeleteRepository %d", i)
145145
}

snap/snapcraft.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ parts:
4444
source: .
4545
stage-packages: [ git, sqlite3, openssh-client ]
4646
build-packages: [ git, libpam0g-dev, libsqlite3-dev, build-essential]
47-
build-snaps: [ go/1.21/stable, node/18/stable ]
47+
build-snaps: [ go/1.22/stable, node/20/stable ]
4848
build-environment:
4949
- LDFLAGS: ""
5050
override-pull: |

0 commit comments

Comments
 (0)