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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user