fix: CI lint/test fixes — gofmt, errcheck, handler test args
This commit is contained in:
@@ -161,6 +161,7 @@ func newTestGatewayHandler(t *testing.T, group *service.Group, accounts []*servi
|
|||||||
nil, // digestStore
|
nil, // digestStore
|
||||||
nil, // settingService
|
nil, // settingService
|
||||||
nil, // tlsFPProfileService
|
nil, // tlsFPProfileService
|
||||||
|
nil, // channelService
|
||||||
)
|
)
|
||||||
|
|
||||||
// RunModeSimple:跳过计费检查,避免引入 repo/cache 依赖。
|
// RunModeSimple:跳过计费检查,避免引入 repo/cache 依赖。
|
||||||
|
|||||||
@@ -2224,7 +2224,7 @@ func (s *stubSoraClientForHandler) GetVideoTask(_ context.Context, _ *service.Ac
|
|||||||
func newMinimalGatewayService(accountRepo service.AccountRepository) *service.GatewayService {
|
func newMinimalGatewayService(accountRepo service.AccountRepository) *service.GatewayService {
|
||||||
return service.NewGatewayService(
|
return service.NewGatewayService(
|
||||||
accountRepo, nil, nil, nil, nil, nil, nil, nil, nil,
|
accountRepo, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ func TestSoraGatewayHandler_ChatCompletions(t *testing.T) {
|
|||||||
nil, // digestStore
|
nil, // digestStore
|
||||||
nil, // settingService
|
nil, // settingService
|
||||||
nil, // tlsFPProfileService
|
nil, // tlsFPProfileService
|
||||||
|
nil, // channelService
|
||||||
)
|
)
|
||||||
|
|
||||||
soraClient := &stubSoraClient{imageURLs: []string{"https://example.com/a.png"}}
|
soraClient := &stubSoraClient{imageURLs: []string{"https://example.com/a.png"}}
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ func (r *channelRepository) List(ctx context.Context, params pagination.Paginati
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("query channels: %w", err)
|
return nil, nil, fmt.Errorf("query channels: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
var channels []service.Channel
|
var channels []service.Channel
|
||||||
var channelIDs []int64
|
var channelIDs []int64
|
||||||
@@ -240,7 +240,7 @@ func (r *channelRepository) ListAll(ctx context.Context) ([]service.Channel, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("query all channels: %w", err)
|
return nil, fmt.Errorf("query all channels: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
var channels []service.Channel
|
var channels []service.Channel
|
||||||
var channelIDs []int64
|
var channelIDs []int64
|
||||||
@@ -292,7 +292,7 @@ func (r *channelRepository) batchLoadGroupIDs(ctx context.Context, channelIDs []
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("batch load group ids: %w", err)
|
return nil, fmt.Errorf("batch load group ids: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
groupMap := make(map[int64][]int64, len(channelIDs))
|
groupMap := make(map[int64][]int64, len(channelIDs))
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
@@ -333,7 +333,7 @@ func (r *channelRepository) GetGroupIDs(ctx context.Context, channelID int64) ([
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("get group ids: %w", err)
|
return nil, fmt.Errorf("get group ids: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
var ids []int64
|
var ids []int64
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
@@ -375,7 +375,7 @@ func (r *channelRepository) GetGroupsInOtherChannels(ctx context.Context, channe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("get groups in other channels: %w", err)
|
return nil, fmt.Errorf("get groups in other channels: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
var conflicting []int64
|
var conflicting []int64
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func (r *channelRepository) ListModelPricing(ctx context.Context, channelID int6
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("list model pricing: %w", err)
|
return nil, fmt.Errorf("list model pricing: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
result, pricingIDs, err := scanModelPricingRows(rows)
|
result, pricingIDs, err := scanModelPricingRows(rows)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -97,7 +97,7 @@ func (r *channelRepository) batchLoadModelPricing(ctx context.Context, channelID
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("batch load model pricing: %w", err)
|
return nil, fmt.Errorf("batch load model pricing: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
allPricing, allPricingIDs, err := scanModelPricingRows(rows)
|
allPricing, allPricingIDs, err := scanModelPricingRows(rows)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -139,7 +139,7 @@ func (r *channelRepository) batchLoadIntervals(ctx context.Context, pricingIDs [
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("batch load intervals: %w", err)
|
return nil, fmt.Errorf("batch load intervals: %w", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer func() { _ = rows.Close() }()
|
||||||
|
|
||||||
intervalMap := make(map[int64][]service.PricingInterval, len(pricingIDs))
|
intervalMap := make(map[int64][]service.PricingInterval, len(pricingIDs))
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|||||||
Reference in New Issue
Block a user