mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-16 01:43:24 +09:00
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:
@@ -84,12 +84,10 @@ func transformDiffTreeForWeb(renderedIconPool *fileicon.RenderedIconPool, diffTr
|
||||
dirNodes := map[string]*WebDiffFileItem{"": &dft.TreeRoot}
|
||||
addItem := func(item *WebDiffFileItem) {
|
||||
var parentPath string
|
||||
pos := strings.LastIndexByte(item.FullName, '/')
|
||||
if pos == -1 {
|
||||
item.DisplayName = item.FullName
|
||||
if dir, name, found := strings.CutLast(item.FullName, "/"); found {
|
||||
parentPath, item.DisplayName = dir, name
|
||||
} else {
|
||||
parentPath = item.FullName[:pos]
|
||||
item.DisplayName = item.FullName[pos+1:]
|
||||
item.DisplayName = item.FullName
|
||||
}
|
||||
parentNode, parentExists := dirNodes[parentPath]
|
||||
if !parentExists {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"uuid"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
org_model "gitea.dev/models/organization"
|
||||
@@ -35,8 +36,6 @@ import (
|
||||
"gitea.dev/services/forms"
|
||||
packages_service "gitea.dev/services/packages"
|
||||
container_service "gitea.dev/services/packages/container"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user