mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-27 17:43:46 +00: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:
@@ -83,7 +83,7 @@ func parseArtifactItemPath(ctx *ArtifactContext) (string, string, bool) {
|
||||
// it's formatted as {artifact_name}/{artfict_path_in_runner}
|
||||
// runner in host mode on Windows, itemPath is joined by Windows slash '\'
|
||||
itemPath := util.PathJoinRelX(ctx.Req.URL.Query().Get("itemPath"))
|
||||
artifactName := strings.Split(itemPath, "/")[0]
|
||||
artifactName, _, _ := strings.Cut(itemPath, "/")
|
||||
artifactPath := strings.TrimPrefix(itemPath, artifactName+"/")
|
||||
if !validateArtifactHash(ctx, artifactName) {
|
||||
return "", "", false
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"slices"
|
||||
"uuid"
|
||||
|
||||
runnerv1 "gitea.dev/actionslib/runner/v1"
|
||||
"gitea.dev/actionslib/runner/v1/runnerv1connect"
|
||||
@@ -20,7 +21,6 @@ import (
|
||||
actions_service "gitea.dev/services/actions"
|
||||
|
||||
"connectrpc.com/connect"
|
||||
gouuid "github.com/google/uuid"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@@ -74,7 +74,7 @@ func (s *Service) Register(
|
||||
// create new runner
|
||||
name := util.EllipsisDisplayString(req.Msg.Name, 255)
|
||||
runner := &actions_model.ActionRunner{
|
||||
UUID: gouuid.New().String(),
|
||||
UUID: uuid.New().String(),
|
||||
Name: name,
|
||||
OwnerID: runnerToken.OwnerID,
|
||||
RepoID: runnerToken.RepoID,
|
||||
|
||||
@@ -598,8 +598,7 @@ func PutManifest(ctx *context.Context) {
|
||||
|
||||
digest, err := processManifest(ctx, mci, buf)
|
||||
if err != nil {
|
||||
var namedError *namedError
|
||||
if errors.As(err, &namedError) {
|
||||
if namedError, ok := errors.AsType[*namedError](err); ok {
|
||||
apiErrorDefined(ctx, namedError)
|
||||
} else if errors.Is(err, container_model.ErrContainerBlobNotExist) {
|
||||
apiErrorDefined(ctx, errBlobUnknown)
|
||||
|
||||
Reference in New Issue
Block a user