intrange 3→0 + modernize 5→3:for i:=0;i<len/N;i++ → range len/N(8 处);time.Time 字段 omitempty→omitzero(wire 输出一致);SplitSeq;min() 简化。刻意保留 lark.go omitzero(会改变 wire 行为)。

Result: {"status":"keep","total_issues":33,"golint_canonicalheader":0,"golint_errname":1,"golint_errorlint":12,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":32,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":45}
This commit is contained in:
ryan
2026-08-16 17:47:09 +08:00
parent ce28f63659
commit 288b74d104
9 changed files with 16 additions and 18 deletions
+4 -7
View File
@@ -100,7 +100,7 @@ type Release struct {
Name string `json:"name,omitempty"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
PublishedAt time.Time `json:"published_at,omitempty"`
PublishedAt time.Time `json:"published_at,omitzero"`
}
// Asset contains the immutable target metadata returned by a resolve call.
@@ -109,7 +109,7 @@ type Asset struct {
Name string `json:"asset_name"`
State string `json:"state"`
Size int64 `json:"size"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
Digest string `json:"digest,omitempty"`
}
@@ -533,7 +533,7 @@ func validTag(tag string) bool {
strings.HasPrefix(tag, "/") || strings.HasSuffix(tag, "/") || strings.HasSuffix(tag, ".") {
return false
}
for _, component := range strings.Split(tag, "/") {
for component := range strings.SplitSeq(tag, "/") {
if component == "" || strings.HasPrefix(component, ".") || strings.HasSuffix(component, ".lock") {
return false
}
@@ -635,10 +635,7 @@ func verifyDeclaredDigest(declaredDigest string, checksum string) error {
}
func safeAssetNames(assets []Asset) []string {
count := len(assets)
if count > maxAssetErrorNames {
count = maxAssetErrorNames
}
count := min(len(assets), maxAssetErrorNames)
names := make([]string, 0, count)
for _, asset := range assets[:count] {
name := safeText(asset.Name, maxSafeAssetNameLen)