Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiOnishi1129 committed Mar 31, 2024
1 parent 45f5108 commit 47e0786
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
13 changes: 13 additions & 0 deletions batch-service/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0.8
linters:
enable:
- govet
- unused
# - gocritic
- staticcheck
- stylecheck
- errcheck
5 changes: 5 additions & 0 deletions batch-service/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
empty:
echo "empty"

lint:
golangci-lint run ./...
5 changes: 3 additions & 2 deletions batch-service/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ func main() {
return
}
defer func(client *firestore.Client) {
err := client.Close()
err = client.Close()
if err != nil {

log.Fatalf("Failed to close client: %v", err)
return
}
}(client)

Expand Down
5 changes: 5 additions & 0 deletions batch-service/cmd/usecase/article.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ func (au *ArticleUsecase) CreateArticles(ctx context.Context, client *firestore.
for _, p := range platforms {
var wg sync.WaitGroup
rss, err := GetRSS(p.RssURL)
if err != nil {
log.Printf("【error get rss】: %s", p.Name)
continue
}
articles, err := au.ar.GetArticlesByPlatform(ctx, p.ID)
if err != nil {
log.Printf("【error get articles by platform】: %s", p.Name)
continue
}
if err != nil {
Expand Down
21 changes: 10 additions & 11 deletions batch-service/cmd/usecase/rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package usecase
import (
"fmt"
"github.com/Songmu/go-httpdate"
goose "github.com/advancedlogic/GoOse"
"github.com/mmcdole/gofeed"
"github.com/otiai10/opengraph"
)
Expand Down Expand Up @@ -63,13 +62,13 @@ func getOGPImage(url string) (string, error) {
return "", nil
}

func getMetaData(url string) (faviconURL, ogpImageURL string, err error) {
g := goose.New()
article, err := g.ExtractFromURL(url)
if err != nil {
return "", "", err
}
faviconURL = article.MetaFavicon
ogpImageURL = article.TopImage
return faviconURL, ogpImageURL, nil
}
//func getMetaData(url string) (faviconURL, ogpImageURL string, err error) {
// g := goose.New()
// article, err := g.ExtractFromURL(url)
// if err != nil {
// return "", "", err
// }
// faviconURL = article.MetaFavicon
// ogpImageURL = article.TopImage
// return faviconURL, ogpImageURL, nil
//}
3 changes: 2 additions & 1 deletion batch-service/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func main() {
defer func(client *firestore.Client) {
err := client.Close()
if err != nil {

log.Fatalf("Failed to close client: %v", err)
return
}
}(client)

Expand Down

0 comments on commit 47e0786

Please sign in to comment.