mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 07:06:36 +08:00
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:
@@ -4,6 +4,8 @@
|
||||
package core_test
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/extpoints"
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
@@ -13,9 +15,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/extpoints"
|
||||
)
|
||||
|
||||
// appMockDriver is a test driver tracking its start/stop lifecycle.
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"Wavelet/core/extpoints"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"Wavelet/core/extpoints"
|
||||
)
|
||||
|
||||
// Context is the central micro-kernel service bus and runtime lifecycle container.
|
||||
@@ -103,7 +102,7 @@ func (c *Context) GoContext() context.Context {
|
||||
}
|
||||
|
||||
// Set stores an arbitrary key-value pair in this Context's local storage.
|
||||
func (c *Context) Set(key any, val any) {
|
||||
func (c *Context) Set(key, val any) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
if c.values == nil {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package core_test
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -14,8 +15,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"Wavelet/core"
|
||||
)
|
||||
|
||||
// Sample services for testing
|
||||
|
||||
@@ -68,6 +68,6 @@ type TaskService interface {
|
||||
ValidatePayload(taskType string, payload []byte) ([]byte, error)
|
||||
ReloadScheduler() error
|
||||
AppendLog(ctx context.Context, format string, args ...any)
|
||||
ListExecutions(ctx context.Context, taskType string, status string, page, pageSize int) ([]TaskExecutionDTO, int64, error)
|
||||
ListExecutions(ctx context.Context, taskType, status string, page, pageSize int) ([]TaskExecutionDTO, int64, error)
|
||||
GetExecution(ctx context.Context, id uint64) (*TaskExecutionDTO, error)
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@ import (
|
||||
|
||||
const maxHandlerParams = 2
|
||||
|
||||
var ctxInterfaceType = reflect.TypeFor[context.Context]()
|
||||
var errInterfaceType = reflect.TypeFor[error]()
|
||||
var (
|
||||
ctxInterfaceType = reflect.TypeFor[context.Context]()
|
||||
errInterfaceType = reflect.TypeFor[error]()
|
||||
)
|
||||
|
||||
type eventListener struct {
|
||||
id uint64
|
||||
@@ -213,7 +215,6 @@ func (b *EventBus) Emit(ctx context.Context, topic string, payload any) error {
|
||||
}
|
||||
return resErr
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package core_test
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -13,8 +14,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"Wavelet/core"
|
||||
)
|
||||
|
||||
type UserRegisteredEvent struct {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
package extpoints_test
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/extpoints"
|
||||
"context"
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
@@ -11,9 +13,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/extpoints"
|
||||
)
|
||||
|
||||
func TestRouterExtension(t *testing.T) {
|
||||
|
||||
@@ -21,7 +21,7 @@ type RouteDefinition struct {
|
||||
type RouterExtension interface {
|
||||
Use(middlewares ...any)
|
||||
Group(prefix string, middlewares ...any) RouterExtension
|
||||
Handle(method string, path string, handlers ...any) RouteDefinition
|
||||
Handle(method, path string, handlers ...any) RouteDefinition
|
||||
GET(path string, handlers ...any) RouteDefinition
|
||||
POST(path string, handlers ...any) RouteDefinition
|
||||
PUT(path string, handlers ...any) RouteDefinition
|
||||
|
||||
@@ -28,8 +28,8 @@ func WithScheduleOption(key string, val any) ScheduleOption {
|
||||
|
||||
// ScheduleExtension defines the interface for registering and querying cron/scheduled tasks.
|
||||
type ScheduleExtension interface {
|
||||
Register(spec string, taskType string, payload any, opts ...ScheduleOption)
|
||||
RegisterCron(spec string, taskType string, payload any, opts ...ScheduleOption)
|
||||
Register(spec, taskType string, payload any, opts ...ScheduleOption)
|
||||
RegisterCron(spec, taskType string, payload any, opts ...ScheduleOption)
|
||||
Schedules() []ScheduleDefinition
|
||||
Get(taskType string) (ScheduleDefinition, bool)
|
||||
Unregister(taskType string) bool
|
||||
@@ -50,7 +50,7 @@ func NewScheduleRegistry() *ScheduleRegistry {
|
||||
}
|
||||
|
||||
// Register adds a schedule definition.
|
||||
func (s *ScheduleRegistry) Register(spec string, taskType string, payload any, opts ...ScheduleOption) {
|
||||
func (s *ScheduleRegistry) Register(spec, taskType string, payload any, opts ...ScheduleOption) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
@@ -82,7 +82,7 @@ func (s *ScheduleRegistry) Register(spec string, taskType string, payload any, o
|
||||
}
|
||||
|
||||
// RegisterCron is an alias for Register.
|
||||
func (s *ScheduleRegistry) RegisterCron(spec string, taskType string, payload any, opts ...ScheduleOption) {
|
||||
func (s *ScheduleRegistry) RegisterCron(spec, taskType string, payload any, opts ...ScheduleOption) {
|
||||
s.Register(spec, taskType, payload, opts...)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
package core_test
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"context"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"Wavelet/core"
|
||||
)
|
||||
|
||||
type MockServiceA interface {
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s *scopedRouterExtension) Group(prefix string, middlewares ...any) extpoin
|
||||
return newScopedRouterExtension(s.ctx, subGroup)
|
||||
}
|
||||
|
||||
func (s *scopedRouterExtension) Handle(method string, path string, handlers ...any) extpoints.RouteDefinition {
|
||||
func (s *scopedRouterExtension) Handle(method, path string, handlers ...any) extpoints.RouteDefinition {
|
||||
rd := s.underlying.Handle(method, path, handlers...)
|
||||
routeID := rd.ID
|
||||
s.ctx.OnDispose(func() error {
|
||||
@@ -141,7 +141,7 @@ func newScopedScheduleExtension(ctx *Context, underlying extpoints.ScheduleExten
|
||||
}
|
||||
}
|
||||
|
||||
func (s *scopedScheduleExtension) Register(spec string, taskType string, payload any, opts ...extpoints.ScheduleOption) {
|
||||
func (s *scopedScheduleExtension) Register(spec, taskType string, payload any, opts ...extpoints.ScheduleOption) {
|
||||
s.underlying.Register(spec, taskType, payload, opts...)
|
||||
s.ctx.OnDispose(func() error {
|
||||
s.underlying.Unregister(taskType)
|
||||
@@ -149,7 +149,7 @@ func (s *scopedScheduleExtension) Register(spec string, taskType string, payload
|
||||
})
|
||||
}
|
||||
|
||||
func (s *scopedScheduleExtension) RegisterCron(spec string, taskType string, payload any, opts ...extpoints.ScheduleOption) {
|
||||
func (s *scopedScheduleExtension) RegisterCron(spec, taskType string, payload any, opts ...extpoints.ScheduleOption) {
|
||||
s.Register(spec, taskType, payload, opts...)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"Wavelet/core/extpoints"
|
||||
"context"
|
||||
"errors"
|
||||
"reflect"
|
||||
|
||||
"Wavelet/core/extpoints"
|
||||
)
|
||||
|
||||
// Standard sentinel errors returned by core operations.
|
||||
|
||||
Reference in New Issue
Block a user