diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4a2461..35ee982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: - name: Setup Go for use with actions uses: actions/setup-go@v2 with: - go-version: 1.19 + go-version: 1.21 - uses: actions/checkout@v2 @@ -19,4 +19,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.50.0 \ No newline at end of file + version: v1.54.2 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f54fe47..e1b49fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.19.x + go-version: 1.21.x - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.golangci.yml b/.golangci.yml index b027af7..aacfd7a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -36,6 +36,7 @@ linters: disable: - gci # conflicts with gofumpt - goimports # conflicts with gofumpt + - depguard run: timeout: 5m diff --git a/Dockerfile b/Dockerfile index d38ef59..9bdd772 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Compile app binary -FROM golang:1.19.2-alpine3.16 as build-env +FROM golang:1.21.2 as build-env WORKDIR /build diff --git a/go.mod b/go.mod index 5f901df..d3e3d7a 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module mynews -go 1.19 +go 1.21 diff --git a/internal/pkg/broadcast/telegram.go b/internal/pkg/broadcast/telegram.go index 556dc93..cda33fb 100644 --- a/internal/pkg/broadcast/telegram.go +++ b/internal/pkg/broadcast/telegram.go @@ -70,7 +70,7 @@ func (t Telegram) Send(message Story) error { ), ReplyMarkup: replyMarkup{ InlineKeyboard: [][]inlineKeyboard{ - {{Text: "Read", URL: message.URL}}, + {{Text: "Read", URL: message.URL, SwitchInlineQuery: ""}}, }, }, } diff --git a/internal/pkg/config/file.go b/internal/pkg/config/file.go index 0e33674..92a2ab8 100644 --- a/internal/pkg/config/file.go +++ b/internal/pkg/config/file.go @@ -153,10 +153,14 @@ func createSampleFile(filePath string) error { IgnoreStoriesBefore: time.Date(2020, 4, 20, 0, 0, 0, 0, time.UTC).Format(time.RFC3339), MustIncludeAnyOf: []string{"linux", "golang", "musk"}, MustExcludeAnyOf: []string{"windows", "trump", "apple"}, + StatusPage: false, }, { URL: "https://hnrss.org/newest.atom", IgnoreStoriesBefore: time.Hour.String(), + MustIncludeAnyOf: nil, + MustExcludeAnyOf: nil, + StatusPage: false, }, } @@ -168,8 +172,10 @@ func createSampleFile(filePath string) error { StorageFilePath: "", Elements: []fileStructureElement{ { - BroadcastType: "stdout", - Sources: sources, + BroadcastType: "stdout", + Sources: sources, + TelegramBotAPIToken: "", + TelegramChatID: "", }, }, LegacyBroadcastType: "", diff --git a/internal/pkg/logger/logger.go b/internal/pkg/logger/logger.go index 3324aa7..6129ca9 100644 --- a/internal/pkg/logger/logger.go +++ b/internal/pkg/logger/logger.go @@ -39,7 +39,6 @@ func (l Log) Fatal(msg string, err error) { l.print(Error, msg, err) } -//nolint:forbidigo // allow in library func (l Log) print(logLevel Level, msg ...interface{}) { if logLevel < l.logLevel { return diff --git a/internal/pkg/storage/storage_test.go b/internal/pkg/storage/storage_test.go index 886e706..7e4aca8 100644 --- a/internal/pkg/storage/storage_test.go +++ b/internal/pkg/storage/storage_test.go @@ -14,10 +14,10 @@ func TestStorage(t *testing.T) { store := storage.New() - rand.Seed(time.Now().Unix()) + rGen := rand.New(rand.NewSource(time.Now().Unix())) for i := 0; i < 1000; i++ { - randomKey := fmt.Sprint(rand.Int()) + randomKey := fmt.Sprint(rGen.Int()) exists, err := store.KeyExists("", randomKey) if err != nil { @@ -50,10 +50,10 @@ func TestStorageCleanup(t *testing.T) { store := storage.New() - rand.Seed(time.Now().Unix()) + rGen := rand.New(rand.NewSource(time.Now().Unix())) for i := 0; i < 1000; i++ { - randomKey := fmt.Sprint(rand.Int()) + randomKey := fmt.Sprint(rGen.Int()) cleanupBefore := time.Now() diff --git a/snapcraft.yaml b/snapcraft.yaml index 346b023..dbd2d27 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1,5 +1,5 @@ name: mynews -version: '1.6.0' +version: '1.7.0' summary: Personalized news feed parser & broadcast description: Easily specify your RSS/Atom sources and broadcast preferences to get personalized news feed. base: core22