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
+1 -1
View File
@@ -215,7 +215,7 @@ func VerifyChallengeSolutions(token string, solutions []int, secret []byte, expe
}
tokenFnv := fnv1a(token)
for i := 0; i < payload.Count; i++ {
for i := range payload.Count {
idxStr := strconv.Itoa(i + 1)
saltSeed := fnv1aResume(tokenFnv, idxStr)
targetSeed := fnv1aResume(saltSeed, "d")
+2 -2
View File
@@ -13,7 +13,7 @@ import (
//nolint:mnd // FNV-1a 算法位移常量
func fnv1a(str string) uint32 {
var hash uint32 = 2166136261
for i := 0; i < len(str); i++ {
for i := range len(str) {
hash ^= uint32(str[i])
hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)
}
@@ -25,7 +25,7 @@ func fnv1a(str string) uint32 {
//nolint:mnd // FNV-1a 算法位移常量
func fnv1aResume(state uint32, str string) uint32 {
h := state
for i := 0; i < len(str); i++ {
for i := range len(str) {
h ^= uint32(str[i])
h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24)
}
+2 -2
View File
@@ -47,7 +47,7 @@ func (r *LogRingBuffer) Write(p []byte) (int, error) {
data := string(p)
start := 0
for i := 0; i < len(data); i++ {
for i := range len(data) {
if data[i] == '\n' {
line := data[start:i]
start = i + 1
@@ -114,7 +114,7 @@ func (r *LogRingBuffer) Query(cursor int, limit int) ([]LogEntry, bool) {
// 将 ring buffer 中的有效条目按顺序收集
ordered := make([]LogEntry, 0, r.count)
for i := 0; i < r.count; i++ {
for i := range r.count {
pos := (oldestPos + i) % r.cap
ordered = append(ordered, r.entries[pos])
}
+3 -3
View File
@@ -4,7 +4,7 @@ import "strconv"
func compareVersionNumbers(left, right VersionInfo) int {
maxLen := max(len(right.Numbers), len(left.Numbers))
for index := 0; index < maxLen; index++ {
for index := range maxLen {
leftValue := 0
rightValue := 0
if index < len(left.Numbers) {
@@ -35,7 +35,7 @@ func compareGitDescribeDistance(left, right VersionInfo) int {
func compareGitDescribeTails(left, right VersionInfo) int {
maxLen := max(len(right.GitDescribeTail), len(left.GitDescribeTail))
for index := 0; index < maxLen; index++ {
for index := range maxLen {
if index >= len(left.GitDescribeTail) {
return -1
}
@@ -64,7 +64,7 @@ func comparePrereleaseIdentifiers(left, right VersionInfo) int {
}
maxLen := max(len(right.Prerelease), len(left.Prerelease))
for index := 0; index < maxLen; index++ {
for index := range maxLen {
if index >= len(left.Prerelease) {
return -1
}