chore: misc go 1.27 tweaks (#39069)

Follow-up to https://github.com/go-gitea/gitea/pull/39068, which
disabled `modernize` entirely.

- re-enable `modernize`, with only the new `embedlit` rule disabled. It
flattens embedded struct literals across ~145 files, and orphans imports
in 6 of them that the fixer does not remove
- apply the rest of the suite: `errors.AsType`, `reflect.TypeAssert`,
`strings.Cut`, and dropping the legacy import comment
- use the new stdlib `uuid` package, `github.com/google/uuid` becomes
indirect
- use `strings.CutLast` in place of manual `LastIndex` slicing in label
scopes, email domains and the diff tree list
- take the header lint skip dirs from the `go.mod` `ignore` directive
and skip dot-directories, instead of hardcoding the list

Assisted-by: Claude Code:claude-opus-5
This commit is contained in:
silverwind
2026-08-24 20:26:10 +02:00
committed by GitHub
parent 59a43c8733
commit 32728fc581
32 changed files with 83 additions and 72 deletions
+1 -1
View File
@@ -8,6 +8,7 @@ import (
"encoding/gob"
"net/http"
"sync"
"uuid"
"gitea.dev/models/auth"
"gitea.dev/models/db"
@@ -15,7 +16,6 @@ import (
"gitea.dev/modules/optional"
"gitea.dev/modules/setting"
"github.com/google/uuid"
"github.com/gorilla/sessions"
"github.com/markbates/goth/gothic"
)
@@ -7,14 +7,13 @@ import (
"context"
"fmt"
"strings"
"uuid"
"gitea.dev/models/auth"
user_model "gitea.dev/models/user"
"gitea.dev/modules/auth/pam"
"gitea.dev/modules/optional"
"gitea.dev/modules/setting"
"github.com/google/uuid"
)
// Authenticate queries if login/password is valid against the PAM,