mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 07:36:37 +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,14 +4,13 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/contracts"
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/contracts"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/idgen"
|
||||
"Wavelet/pkg/logger"
|
||||
"Wavelet/pkg/util"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -18,10 +21,7 @@ import (
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"Wavelet/pkg/idgen"
|
||||
"Wavelet/pkg/logger"
|
||||
otel_trace "Wavelet/pkg/trace"
|
||||
"Wavelet/pkg/util"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -76,8 +76,10 @@ func ValidateAndNormalizePayload(asynqTaskType string, payload []byte) ([]byte,
|
||||
// contextKey 用于 context 存取 taskID
|
||||
type contextKey string
|
||||
|
||||
const taskIDKey contextKey = "task_execution_task_id"
|
||||
const traceEnvelopeVersion = 1
|
||||
const (
|
||||
taskIDKey contextKey = "task_execution_task_id"
|
||||
traceEnvelopeVersion = 1
|
||||
)
|
||||
|
||||
type traceEnvelope struct {
|
||||
WaveletTraceEnvelope bool `json:"_wavelet_trace_envelope"`
|
||||
@@ -489,7 +491,7 @@ func handleSuccessfulTask(ctx context.Context, execution *TaskExecution, t *asyn
|
||||
}
|
||||
|
||||
// generateTaskID 生成任务 ID
|
||||
func generateTaskID(taskType string, triggeredBy string) string {
|
||||
func generateTaskID(taskType, triggeredBy string) string {
|
||||
return fmt.Sprintf("%s_%s_%d", triggeredBy, taskType, idgen.NextUint64ID())
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/testhelper"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -19,8 +20,6 @@ import (
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"Wavelet/pkg/testhelper"
|
||||
)
|
||||
|
||||
type mockDBService struct {
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"Wavelet/core/extpoints"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// TaskParam 任务参数定义
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/contracts"
|
||||
"context"
|
||||
"embed"
|
||||
"errors"
|
||||
@@ -14,9 +16,6 @@ import (
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"Wavelet/core"
|
||||
"Wavelet/core/contracts"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -345,7 +344,7 @@ func (s *taskServiceImpl) GetTaskMeta(taskType string) (contracts.TaskMetaDTO, b
|
||||
}, true
|
||||
}
|
||||
|
||||
func (s *taskServiceImpl) ListExecutions(ctx context.Context, taskType string, status string, page, pageSize int) ([]contracts.TaskExecutionDTO, int64, error) {
|
||||
func (s *taskServiceImpl) ListExecutions(ctx context.Context, taskType, status string, page, pageSize int) ([]contracts.TaskExecutionDTO, int64, error) {
|
||||
db := getDB(ctx)
|
||||
if db == nil {
|
||||
return nil, 0, errors.New("db not initialized")
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/idgen"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -11,8 +12,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"Wavelet/pkg/idgen"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -54,7 +53,7 @@ func getTaskExecutionByTaskID(ctx context.Context, taskID string) (*TaskExecutio
|
||||
return &execution, nil
|
||||
}
|
||||
|
||||
func appendTaskExecutionLog(ctx context.Context, taskID string, logLine string) error {
|
||||
func appendTaskExecutionLog(ctx context.Context, taskID, logLine string) error {
|
||||
rdb := getRedisClient()
|
||||
if rdb == nil {
|
||||
return errors.New("redis client is not initialized")
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/config"
|
||||
"sync"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/redis/go-redis/v9/maintnotifications"
|
||||
|
||||
"Wavelet/pkg/config"
|
||||
)
|
||||
|
||||
type redisClientConnOpt struct {
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/config"
|
||||
"testing"
|
||||
|
||||
"github.com/redis/go-redis/v9/maintnotifications"
|
||||
|
||||
"Wavelet/pkg/config"
|
||||
)
|
||||
|
||||
func TestMaintNotificationsConfig(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user