chore(lint): unify formatting on golangci-lint fmt (gofumpt), uncap issue reporting, fix gofumpt drift

- make format 现在与 code-check 使用同一格式化器(golangci-lint fmt),消除 goimports -local 与 gofumpt 的格式拉锯
- .golangci.yml 关闭默认 50/3 截断,完整上报所有问题(只增强不弱化)
- 全库 gofumpt 规范化(203 files, 纯格式无行为变更)
This commit is contained in:
ryan
2026-08-28 16:31:53 +08:00
parent 078ad9b2f3
commit 528240026d
204 changed files with 572 additions and 718 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ const (
headerSize = 8 // 8 bytes metadata prefix for expiration UnixNano timestamp
defaultMaxSizeMB = 100
defaultTTLMinutes = 60
cacheDirPerm = 0750
cacheDirPerm = 0o750
// DefaultExpiration applies the cache-wide default TTL.
DefaultExpiration time.Duration = 0
@@ -284,7 +284,7 @@ func (c *Cache) Status() Status {
}
// UpdatePolicy dynamically updates policies.
func (c *Cache) UpdatePolicy(maxSizeMB int64, ttlMinutes int64, lruEnabled bool) {
func (c *Cache) UpdatePolicy(maxSizeMB, ttlMinutes int64, lruEnabled bool) {
c.mu.Lock()
defer c.mu.Unlock()
+5 -5
View File
@@ -31,7 +31,7 @@ type CacheItem struct {
// Loader is an interface that the cache client must implement to handle database retrieval.
type Loader interface {
LoadAll(ctx context.Context, configType string) ([]CacheItem, error)
LoadOne(ctx context.Context, configType string, key string) (CacheItem, error)
LoadOne(ctx context.Context, configType, key string) (CacheItem, error)
}
type cacheEntry struct {
@@ -59,7 +59,7 @@ func getWriteLock(configType string) *sync.Mutex {
// Get retrieves a cache item from the local cache store, checking for expiration.
// Reads are completely lock-free because maps stored in Otter are immutable.
func Get(configType string, key string) (CacheItem, bool) {
func Get(configType, key string) (CacheItem, bool) {
m, ok := managerCache.GetIfPresent(configType)
if !ok {
return CacheItem{}, false
@@ -80,7 +80,7 @@ func Get(configType string, key string) (CacheItem, bool) {
return entry.item, true
}
func deleteKeyIfExpired(configType string, key string, expireAt time.Time) {
func deleteKeyIfExpired(configType, key string, expireAt time.Time) {
lock := getWriteLock(configType)
lock.Lock()
defer lock.Unlock()
@@ -138,7 +138,7 @@ func Set(item CacheItem) {
// Delete removes a single item from the local cache store.
// Writes are protected by a fine-grained lock per configType.
func Delete(configType string, key string) {
func Delete(configType, key string) {
lock := getWriteLock(configType)
lock.Lock()
defer lock.Unlock()
@@ -196,7 +196,7 @@ func GetTypeItems(configType string) []CacheItem {
}
// Refresh reloads configuration cache from database via the Loader.
func Refresh(ctx context.Context, configType string, key string, loader Loader) error {
func Refresh(ctx context.Context, configType, key string, loader Loader) error {
if configType == "" {
return errors.New("type is required")
}