diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a468a0a..cbf85f4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,6 +18,14 @@ before: - go install github.com/tc-hib/go-winres@latest - go generate ./... +gomod: + proxy: true + +report_sizes: true + +metadata: + mod_timestamp: "{{ .CommitTimestamp }}" + builds: - id: yutu binary: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" @@ -45,10 +53,11 @@ builds: - -X {{ .Env.MODULE_PATH }}/cmd.CommitDate={{ .CommitDate }} - -X {{ .Env.MODULE_PATH }}/cmd.Os={{ .Os }} - -X {{ .Env.MODULE_PATH }}/cmd.Arch={{ .Arch }} + mod_timestamp: "{{ .CommitTimestamp }}" archives: - - format: binary - builds: + - formats: [ 'binary' ] + ids: - yutu name_template: "{{ .Binary }}" diff --git a/pkg/activity/activity.go b/pkg/activity/activity.go index edb56a6..ed15cde 100644 --- a/pkg/activity/activity.go +++ b/pkg/activity/activity.go @@ -3,6 +3,7 @@ package activity import ( "errors" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -127,8 +128,10 @@ func WithHome(home *bool) Option { func WithMaxResults(maxResults int64) Option { return func(a *activity) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } a.MaxResults = maxResults } diff --git a/pkg/activity/activity_test.go b/pkg/activity/activity_test.go index 6ad6755..3355d30 100644 --- a/pkg/activity/activity_test.go +++ b/pkg/activity/activity_test.go @@ -1,6 +1,7 @@ package activity import ( + "math" "reflect" "testing" @@ -84,7 +85,7 @@ func TestNewActivity(t *testing.T) { }, }, want: &activity{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/channel/channel.go b/pkg/channel/channel.go index 0203622..1b67576 100644 --- a/pkg/channel/channel.go +++ b/pkg/channel/channel.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -218,8 +219,10 @@ func WithChannelManagedByMe(managedByMe *bool) Option { func WithMaxResults(maxResults int64) Option { return func(c *channel) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } c.MaxResults = maxResults } diff --git a/pkg/channel/channel_test.go b/pkg/channel/channel_test.go index 60b2231..03bc062 100644 --- a/pkg/channel/channel_test.go +++ b/pkg/channel/channel_test.go @@ -1,6 +1,7 @@ package channel import ( + "math" "reflect" "testing" @@ -105,7 +106,7 @@ func TestNewChannel(t *testing.T) { }, }, want: &channel{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/comment/comment.go b/pkg/comment/comment.go index 3708b64..812cbbd 100644 --- a/pkg/comment/comment.go +++ b/pkg/comment/comment.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -281,8 +282,10 @@ func WithChannelId(channelId string) Option { func WithMaxResults(maxResults int64) Option { return func(c *comment) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } c.MaxResults = maxResults } diff --git a/pkg/comment/comment_test.go b/pkg/comment/comment_test.go index 60788b7..f0fc6b1 100644 --- a/pkg/comment/comment_test.go +++ b/pkg/comment/comment_test.go @@ -1,6 +1,7 @@ package comment import ( + "math" "reflect" "testing" @@ -94,7 +95,7 @@ func TestNewComment(t *testing.T) { }, }, want: &comment{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/commentThread/commentThread.go b/pkg/commentThread/commentThread.go index 228e304..1e9d5af 100644 --- a/pkg/commentThread/commentThread.go +++ b/pkg/commentThread/commentThread.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -190,8 +191,10 @@ func WithIDs(ids []string) Option { func WithMaxResults(maxResults int64) Option { return func(c *commentThread) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } c.MaxResults = maxResults } diff --git a/pkg/commentThread/commentThread_test.go b/pkg/commentThread/commentThread_test.go index 2505fc8..c436c14 100644 --- a/pkg/commentThread/commentThread_test.go +++ b/pkg/commentThread/commentThread_test.go @@ -1,6 +1,7 @@ package commentThread import ( + "math" "reflect" "testing" @@ -64,7 +65,7 @@ func TestNewCommentThread(t *testing.T) { }, }, want: &commentThread{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/member/member.go b/pkg/member/member.go index 179ef34..b99dafc 100644 --- a/pkg/member/member.go +++ b/pkg/member/member.go @@ -3,6 +3,7 @@ package member import ( "errors" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -107,8 +108,10 @@ func WithHasAccessToLevel(level string) Option { func WithMaxResults(maxResults int64) Option { return func(m *member) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } m.MaxResults = maxResults } diff --git a/pkg/member/member_test.go b/pkg/member/member_test.go index 171ede1..6eadc6c 100644 --- a/pkg/member/member_test.go +++ b/pkg/member/member_test.go @@ -1,6 +1,7 @@ package member import ( + "math" "reflect" "testing" @@ -50,7 +51,7 @@ func TestNewMember(t *testing.T) { }, }, want: &member{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/playlist/playlist.go b/pkg/playlist/playlist.go index 0889abb..4ea077e 100644 --- a/pkg/playlist/playlist.go +++ b/pkg/playlist/playlist.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -253,8 +254,10 @@ func WithHl(hl string) Option { func WithMaxResults(maxResults int64) Option { return func(p *playlist) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } p.MaxResults = maxResults } diff --git a/pkg/playlist/playlist_test.go b/pkg/playlist/playlist_test.go index daf75bf..02b23ff 100644 --- a/pkg/playlist/playlist_test.go +++ b/pkg/playlist/playlist_test.go @@ -1,6 +1,7 @@ package playlist import ( + "math" "reflect" "testing" @@ -89,7 +90,7 @@ func TestNewPlaylist(t *testing.T) { }, }, want: &playlist{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/playlistImage/playlistImage.go b/pkg/playlistImage/playlistImage.go index bd2d505..602867d 100644 --- a/pkg/playlistImage/playlistImage.go +++ b/pkg/playlistImage/playlistImage.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -267,8 +268,10 @@ func WithParent(parent string) Option { func WithMaxResults(maxResults int64) Option { return func(pi *playlistImage) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } pi.MaxResults = maxResults } diff --git a/pkg/playlistImage/playlistImage_test.go b/pkg/playlistImage/playlistImage_test.go index 2d50aec..4a7c032 100644 --- a/pkg/playlistImage/playlistImage_test.go +++ b/pkg/playlistImage/playlistImage_test.go @@ -1,6 +1,7 @@ package playlistImage import ( + "math" "reflect" "testing" @@ -62,7 +63,7 @@ func TestNewPlaylistImage(t *testing.T) { }, }, want: &playlistImage{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/playlistItem/playlistItem.go b/pkg/playlistItem/playlistItem.go index 1e2a79f..79b97fd 100644 --- a/pkg/playlistItem/playlistItem.go +++ b/pkg/playlistItem/playlistItem.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -310,8 +311,10 @@ func WithPrivacy(privacy string) Option { func WithMaxResults(maxResults int64) Option { return func(p *playlistItem) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } p.MaxResults = maxResults } diff --git a/pkg/playlistItem/playlistItem_test.go b/pkg/playlistItem/playlistItem_test.go index 3a33b10..fcb507b 100644 --- a/pkg/playlistItem/playlistItem_test.go +++ b/pkg/playlistItem/playlistItem_test.go @@ -1,6 +1,7 @@ package playlistItem import ( + "math" "reflect" "testing" @@ -68,7 +69,7 @@ func TestNewPlaylistItem(t *testing.T) { }, }, want: &playlistItem{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/search/search.go b/pkg/search/search.go index 1744875..86278e8 100644 --- a/pkg/search/search.go +++ b/pkg/search/search.go @@ -3,6 +3,7 @@ package search import ( "errors" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -283,8 +284,10 @@ func WithLocationRadius(locationRadius string) Option { func WithMaxResults(maxResults int64) Option { return func(s *search) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } s.MaxResults = maxResults } diff --git a/pkg/search/search_test.go b/pkg/search/search_test.go index b211b3c..10fd486 100644 --- a/pkg/search/search_test.go +++ b/pkg/search/search_test.go @@ -1,6 +1,7 @@ package search import ( + "math" "reflect" "testing" @@ -133,7 +134,7 @@ func TestNewSearch(t *testing.T) { }, }, want: &search{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/subscription/subscription.go b/pkg/subscription/subscription.go index 3813d57..a7681f8 100644 --- a/pkg/subscription/subscription.go +++ b/pkg/subscription/subscription.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -211,8 +212,10 @@ func WithForChannelId(forChannelId string) Option { func WithMaxResults(maxResults int64) Option { return func(s *subscription) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } s.MaxResults = maxResults } diff --git a/pkg/subscription/subscription_test.go b/pkg/subscription/subscription_test.go index d219a37..1766541 100644 --- a/pkg/subscription/subscription_test.go +++ b/pkg/subscription/subscription_test.go @@ -1,6 +1,7 @@ package subscription import ( + "math" "reflect" "testing" @@ -101,7 +102,7 @@ func TestNewSubscription(t *testing.T) { }, }, want: &subscription{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/superChatEvent/superChatEvent.go b/pkg/superChatEvent/superChatEvent.go index 57a759e..4f7a0f8 100644 --- a/pkg/superChatEvent/superChatEvent.go +++ b/pkg/superChatEvent/superChatEvent.go @@ -3,6 +3,7 @@ package superChatEvent import ( "errors" "io" + "math" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" @@ -93,8 +94,10 @@ func WithHl(hl string) Option { func WithMaxResults(maxResults int64) Option { return func(s *superChatEvent) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } s.MaxResults = maxResults } diff --git a/pkg/superChatEvent/superChatEvent_test.go b/pkg/superChatEvent/superChatEvent_test.go index a4c2e11..ad68173 100644 --- a/pkg/superChatEvent/superChatEvent_test.go +++ b/pkg/superChatEvent/superChatEvent_test.go @@ -1,6 +1,7 @@ package superChatEvent import ( + "math" "reflect" "testing" @@ -46,7 +47,7 @@ func TestNewSuperChatEvent(t *testing.T) { }, }, want: &superChatEvent{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, { diff --git a/pkg/vars.go b/pkg/vars.go index c29bbcd..1afc93a 100644 --- a/pkg/vars.go +++ b/pkg/vars.go @@ -12,6 +12,7 @@ const ( SilentUsage = "json, yaml, or silent" JPUsage = "JSONPath expression to filter the output" JsonMIME = "application/json" + PerPage = 20 ) var ( diff --git a/pkg/video/video.go b/pkg/video/video.go index 034d617..56a7266 100644 --- a/pkg/video/video.go +++ b/pkg/video/video.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "slices" "github.com/eat-pray-ai/yutu/pkg" @@ -592,8 +593,10 @@ func WithMaxWidth(maxWidth int64) Option { func WithMaxResults(maxResults int64) Option { return func(v *video) { - if maxResults <= 0 { + if maxResults < 0 { maxResults = 1 + } else if maxResults == 0 { + maxResults = math.MaxInt64 } v.MaxResults = maxResults } diff --git a/pkg/video/video_test.go b/pkg/video/video_test.go index 347d82f..c201765 100644 --- a/pkg/video/video_test.go +++ b/pkg/video/video_test.go @@ -1,6 +1,7 @@ package video import ( + "math" "reflect" "testing" @@ -154,7 +155,7 @@ func TestNewVideo(t *testing.T) { }, }, want: &video{ - MaxResults: 1, + MaxResults: math.MaxInt64, }, }, {