chore: make use of go1.26 features (#12369)

Allows us to make use of Go features introduced in v1.26.

I require a feature from v1.26 for a PR I want to make later.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12369
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
Gusted
2026-05-01 22:51:48 +02:00
committed by Gusted
parent c1dc213c9b
commit 07a6b6ce82
17 changed files with 66 additions and 100 deletions
+1 -1
View File
@@ -562,7 +562,7 @@ func (r *artifactV4Routes) downloadArtifact(ctx *ArtifactContext) {
return
}
common.ServeContentByReadSeeker(ctx.Base, artifactName, util.ToPointer(artifact.UpdatedUnix.AsTime()), file)
common.ServeContentByReadSeeker(ctx.Base, artifactName, new(artifact.UpdatedUnix.AsTime()), file)
}
func (r *artifactV4Routes) deleteArtifact(ctx *ArtifactContext) {
+1 -2
View File
@@ -103,8 +103,7 @@ func OIDCRoutes(prefix string) *web.Route {
// and inspecting the names of the json struct tags
rt := reflect.TypeFor[actions_service.IDTokenCustomClaims]()
for i := 0; i < rt.NumField(); i++ {
f := rt.Field(i)
for f := range rt.Fields() {
v := strings.Split(f.Tag.Get("json"), ",")[0]
if v == "" || v == "-" {
continue
+1 -2
View File
@@ -13,7 +13,6 @@ import (
"forgejo.org/modules/log"
"forgejo.org/modules/setting"
"forgejo.org/modules/storage"
"forgejo.org/modules/util"
"forgejo.org/routers/common"
"forgejo.org/services/attachment"
"forgejo.org/services/context"
@@ -154,7 +153,7 @@ func ServeAttachment(ctx *context.Context, uuid string) {
}
defer fr.Close()
common.ServeContentByReadSeeker(ctx.Base, attach.Name, util.ToPointer(attach.CreatedUnix.AsTime()), fr)
common.ServeContentByReadSeeker(ctx.Base, attach.Name, new(attach.CreatedUnix.AsTime()), fr)
}
// GetAttachment serve attachments