diff --git a/main.go b/cmd/main.go similarity index 97% rename from main.go rename to cmd/main.go index 89b1b66..fca34cc 100644 --- a/main.go +++ b/cmd/main.go @@ -1,7 +1,7 @@ package main import ( - "CatsOfMastodonBotGo/helpers" + "CatsOfMastodonBotGo/internal/helpers" "context" "log" "os" @@ -21,6 +21,7 @@ func main() { if instance == "" { instance = "https://haminoa.net" } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() err, posts := helpers.GetPosts(ctx, tag, instance) @@ -40,7 +41,6 @@ func main() { var existingAccountIds = helpers.GetExistingAccountIds(db) var newPosts = helpers.GetNewPosts(existingPostIds, posts) var newAccounts = helpers.GetNewAccounts(existingAccountIds, newPosts) - log.Println("Number of existing posts: ", len(existingPostIds)) log.Println("Number of existing accounts: ", len(existingAccountIds)) diff --git a/helpers/dbHelpers.go b/internal/helpers/dbHelpers.go similarity index 97% rename from helpers/dbHelpers.go rename to internal/helpers/dbHelpers.go index be9ac2b..f227831 100644 --- a/helpers/dbHelpers.go +++ b/internal/helpers/dbHelpers.go @@ -1,7 +1,7 @@ package helpers import ( - "CatsOfMastodonBotGo/models" + "CatsOfMastodonBotGo/internal/models" "gorm.io/gorm" ) diff --git a/helpers/postHelpers.go b/internal/helpers/postHelpers.go similarity index 96% rename from helpers/postHelpers.go rename to internal/helpers/postHelpers.go index 2166f1d..635c6d5 100644 --- a/helpers/postHelpers.go +++ b/internal/helpers/postHelpers.go @@ -1,7 +1,7 @@ package helpers import ( - "CatsOfMastodonBotGo/models" + "CatsOfMastodonBotGo/internal/models" "context" "encoding/json" "fmt" diff --git a/models/account.go b/internal/models/account.go similarity index 100% rename from models/account.go rename to internal/models/account.go diff --git a/models/mediaAttachment.go b/internal/models/mediaAttachment.go similarity index 100% rename from models/mediaAttachment.go rename to internal/models/mediaAttachment.go diff --git a/models/post.go b/internal/models/post.go similarity index 100% rename from models/post.go rename to internal/models/post.go