Skip to content

Commit

Permalink
✨ upgrade and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lawzava committed Oct 9, 2023
1 parent d9a8464 commit 8dec855
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -19,4 +19,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.50.0
version: v1.54.2
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ linters:
disable:
- gci # conflicts with gofumpt
- goimports # conflicts with gofumpt
- depguard

run:
timeout: 5m
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module mynews

go 1.19
go 1.21
2 changes: 1 addition & 1 deletion internal/pkg/broadcast/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""}},
},
},
}
Expand Down
10 changes: 8 additions & 2 deletions internal/pkg/config/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand All @@ -168,8 +172,10 @@ func createSampleFile(filePath string) error {
StorageFilePath: "",
Elements: []fileStructureElement{
{
BroadcastType: "stdout",
Sources: sources,
BroadcastType: "stdout",
Sources: sources,
TelegramBotAPIToken: "",
TelegramChatID: "",
},
},
LegacyBroadcastType: "",
Expand Down
1 change: 0 additions & 1 deletion internal/pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8dec855

Please sign in to comment.