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 -3
View File
@@ -4,13 +4,12 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/logger"
"context"
"encoding/json"
"github.com/gin-gonic/gin"
"Wavelet/core/contracts"
"Wavelet/pkg/logger"
)
// LogForAudit 将登录鉴权审计日志写入 Logger
@@ -4,14 +4,13 @@
package auth
import (
"Wavelet/core/contracts"
"context"
"errors"
"fmt"
"strconv"
"strings"
"Wavelet/core/contracts"
"github.com/coreos/go-oidc/v3/oidc"
"golang.org/x/oauth2"
)
@@ -128,7 +127,7 @@ func containsScope(scopes []string, scope string) bool {
return false
}
func buildOAuthUserInfo(ctx context.Context, source *AuthSource, code string, nonce string, redirectURL string) (*contracts.OAuthUserInfoDTO, error) {
func buildOAuthUserInfo(ctx context.Context, source *AuthSource, code, nonce, redirectURL string) (*contracts.OAuthUserInfoDTO, error) {
authConfig, verifier, err := buildOAuthConfig(ctx, source, redirectURL)
if err != nil {
return nil, err
+2 -3
View File
@@ -4,12 +4,11 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/cache/ram"
"context"
"fmt"
"time"
"Wavelet/core/contracts"
"Wavelet/pkg/cache/ram"
)
const (
+3 -4
View File
@@ -4,14 +4,13 @@
package auth_test
import (
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/plugins/domain/auth"
"context"
"encoding/json"
"testing"
"time"
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/plugins/domain/auth"
)
type mockCacheService struct {
+5 -7
View File
@@ -4,6 +4,11 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/idgen"
"Wavelet/pkg/logger"
"Wavelet/pkg/response"
"Wavelet/pkg/util"
"context"
"errors"
"fmt"
@@ -12,18 +17,11 @@ import (
"strings"
"time"
"Wavelet/core/contracts"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"gorm.io/gorm"
"Wavelet/pkg/idgen"
"Wavelet/pkg/logger"
"Wavelet/pkg/response"
"Wavelet/pkg/util"
)
// GetLoginSources 获取可用登录源列表
+4 -5
View File
@@ -4,17 +4,16 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/response"
"Wavelet/pkg/trace"
"Wavelet/pkg/util"
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"github.com/gin-gonic/gin"
"Wavelet/core/contracts"
"Wavelet/pkg/response"
"Wavelet/pkg/trace"
"Wavelet/pkg/util"
)
func hashToken(token string) string {
+1 -2
View File
@@ -4,14 +4,13 @@
package auth
import (
"Wavelet/core/contracts"
"encoding/json"
"errors"
"regexp"
"strconv"
"strings"
"time"
"Wavelet/core/contracts"
)
var authSourceNamePattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$`)
+3 -4
View File
@@ -5,13 +5,12 @@
package auth
import (
"context"
"embed"
"reflect"
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/core/extpoints"
"context"
"embed"
"reflect"
)
//go:embed migrations/*/*.sql
+4 -4
View File
@@ -4,6 +4,9 @@
package auth_test
import (
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/plugins/domain/auth"
"context"
"crypto/sha256"
"encoding/hex"
@@ -15,10 +18,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
"Wavelet/core"
"Wavelet/core/contracts"
"Wavelet/plugins/domain/auth"
)
type mockDBService struct {
@@ -84,6 +83,7 @@ func (m *mockProvider) Name() string { return "custom" }
func (m *mockProvider) GetAuthURL(state string) string {
return "https://custom.com/auth?state=" + state
}
func (m *mockProvider) ExchangeCode(ctx context.Context, code string) (*contracts.OAuthUserInfoDTO, error) {
return &contracts.OAuthUserInfoDTO{
ID: 555,
+3 -4
View File
@@ -4,13 +4,12 @@
package auth
import (
"Wavelet/core"
"Wavelet/core/contracts"
"context"
"sync"
"gorm.io/gorm"
"Wavelet/core"
"Wavelet/core/contracts"
)
var (
@@ -120,6 +119,6 @@ func ListExternalAccountsByUserID(ctx context.Context, userID uint64) ([]Externa
}
// UnbindExternalAccount 解绑外部账号
func UnbindExternalAccount(ctx context.Context, id uint64, userID uint64) error {
func UnbindExternalAccount(ctx context.Context, id, userID uint64) error {
return getDB(ctx).Where("id = ? AND user_id = ?", id, userID).Delete(&ExternalAccount{}).Error
}
+2 -3
View File
@@ -4,14 +4,13 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/util"
"context"
"errors"
"sync"
"github.com/gin-gonic/gin"
"Wavelet/core/contracts"
"Wavelet/pkg/util"
)
type authServiceImpl struct{}
+2 -3
View File
@@ -4,6 +4,8 @@
package auth
import (
"Wavelet/core/contracts"
"Wavelet/pkg/config"
"context"
"crypto/sha256"
"encoding/hex"
@@ -15,9 +17,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
gsessions "github.com/gorilla/sessions"
"Wavelet/core/contracts"
"Wavelet/pkg/config"
)
// GetSessionOptions 根据配置构建 Session 选项