Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiOnishi1129 committed Jun 21, 2024
1 parent 913efa5 commit 0104918
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 1 addition & 5 deletions batch-service/infrastructure/supabase/repository/article.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ func (ar *ArticleRepository) GetArticles(ctx context.Context, dto domain.GetArti
if err != nil {
return nil, err
}
articles := make([]*entity.Article, len(aRows))
for i, a := range aRows {
articles[i] = a
}
return articles, nil
return aRows, nil
}

// func (ar *ArticleRepository) GetArticles(ctx context.Context, dto domain.GetArticlesInputDTO) ([]domain.Article, error) {
Expand Down
18 changes: 12 additions & 6 deletions batch-service/internal/crawler/article_contents_crawler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package crawler

import (
"context"
"database/sql"
"testing"
"time"

Expand Down Expand Up @@ -240,7 +241,7 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {

if tt.recordPlatform != nil {
for _, v := range tt.recordPlatform {
err := v.Insert(ctx, db, boil.Infer())
err = v.Insert(ctx, db, boil.Infer())
if err != nil {
t.Fatalf("Failed to insert record: %s", err)
}
Expand All @@ -249,7 +250,7 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {

if tt.recordCategories != nil {
for _, v := range tt.recordCategories {
err := v.Insert(ctx, db, boil.Infer())
err = v.Insert(ctx, db, boil.Infer())
if err != nil {
t.Fatalf("Failed to insert record: %s", err)
}
Expand All @@ -258,7 +259,7 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {

if tt.recordFeeds != nil {
for _, v := range tt.recordFeeds {
err := v.Insert(ctx, db, boil.Infer())
err = v.Insert(ctx, db, boil.Infer())
if err != nil {
t.Fatalf("Failed to insert record: %s", err)
}
Expand All @@ -267,7 +268,7 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {

if tt.recordArticles != nil {
for _, v := range tt.recordArticles {
err := v.Insert(ctx, db, boil.Infer())
err = v.Insert(ctx, db, boil.Infer())
if err != nil {
t.Fatalf("Failed to insert record: %s", err)
}
Expand All @@ -276,7 +277,7 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {

if tt.recordFeedArticleRelations != nil {
for _, v := range tt.recordFeedArticleRelations {
err := v.Insert(ctx, db, boil.Infer())
err = v.Insert(ctx, db, boil.Infer())
if err != nil {
t.Fatalf("Failed to insert record: %s", err)
}
Expand All @@ -287,7 +288,12 @@ func Test_Internal_ArticleContentsCrawler(t *testing.T) {
if err != nil {
t.Fatalf("Failed to begin transaction: %s", err)
}
defer tx.Rollback()
defer func(tx *sql.Tx) {
err = tx.Rollback()
if err != nil {
t.Fatalf("Failed to rollback transaction: %s", err)
}
}(tx)

res, err := ArticleContentsCrawler(ctx, tx, tt.feed, tt.rss, tt.isEng)
if err != nil {
Expand Down

0 comments on commit 0104918

Please sign in to comment.