Skip to content

Commit

Permalink
switch to go 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Feb 20, 2023
1 parent 61bd207 commit 3939fc2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 34 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/ci.yml
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: set up go 1.17
uses: actions/setup-go@v2
- name: set up go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: "1.20"
id: go

- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: build and test
run: |
Expand All @@ -30,25 +30,27 @@ jobs:
TZ: "America/Chicago"
GOFLAGS: "-mod=vendor"

- name: install golangci-lint and goveralls
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

- name: install goveralls
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.45.0
GO111MODULE=off go get -u -v github.com/mattn/goveralls
- name: run linters
run: $GITHUB_WORKSPACE/golangci-lint run --out-format=github-actions

- name: submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
Expand Down
8 changes: 4 additions & 4 deletions .golangci.yml
Expand Up @@ -35,15 +35,12 @@ linters:
- govet
- unconvert
- megacheck
- structcheck
- unused
- gas
- misspell
- unparam
- varcheck
- deadcode
- typecheck
- ineffassign
- varcheck
- stylecheck
- gochecknoinits
- exportloopref
Expand All @@ -65,4 +62,7 @@ issues:
- text: "weak cryptographic primitive"
linters:
- gosec
- text: "package-comments: should have a package comment"
linters:
- revive
exclude-use-default: false
2 changes: 1 addition & 1 deletion app/api/server.go
Expand Up @@ -186,7 +186,7 @@ func (s *Server) getFeedCtrl(w http.ResponseWriter, r *http.Request) {
// add ts suffix to titles
switch s.Conf.Feeds[feedName].ExtendDateTitle {
case "yyyyddmm":
items[i].Title = fmt.Sprintf("%s (%s)", itm.Title, itm.DT.Format("2006-02-01"))
items[i].Title = fmt.Sprintf("%s (%s)", itm.Title, itm.DT.Format("2006-02-01")) // nolint
case "yyyymmdd":
items[i].Title = fmt.Sprintf("%s (%s)", itm.Title, itm.DT.Format("2006-01-02"))
}
Expand Down
18 changes: 9 additions & 9 deletions app/api/server_test.go
Expand Up @@ -31,7 +31,7 @@ func TestServer_Run(t *testing.T) {
time.Sleep(time.Millisecond * 100)
resp, err := http.Get(fmt.Sprintf("http://localhost:%d/ping", port))
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
require.Equal(t, http.StatusOK, resp.StatusCode)
t.Logf("%+v", resp.Header)
assert.Equal(t, "1.0", resp.Header.Get("App-Version"))
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestServer_getFeedCtrl(t *testing.T) {

resp, err := ts.Client().Get(ts.URL + "/rss/feed1")
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)

respBody, err := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestServer_getFeedCtrlExtendDateTitle(t *testing.T) {

resp, err := ts.Client().Get(ts.URL + "/rss/feed1")
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)

respBody, err := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -252,7 +252,7 @@ func TestServer_getFeedCtrlFeedImage(t *testing.T) {

resp, err := ts.Client().Get(ts.URL + "/rss/feed1")
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)

respBody, err := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestServer_regenerateRSSCtrl(t *testing.T) {
req.SetBasicAuth("admin", "bad")
resp, err := ts.Client().Do(req)
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusForbidden, resp.StatusCode)
}

Expand All @@ -307,7 +307,7 @@ func TestServer_regenerateRSSCtrl(t *testing.T) {
req.SetBasicAuth("admin", "123456")
resp, err := ts.Client().Do(req)
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)
}

Expand Down Expand Up @@ -346,7 +346,7 @@ func TestServer_removeEntryCtrl(t *testing.T) {
req.SetBasicAuth("admin", "bad")
resp, err := ts.Client().Do(req)
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusForbidden, resp.StatusCode)
}

Expand All @@ -356,7 +356,7 @@ func TestServer_removeEntryCtrl(t *testing.T) {
req.SetBasicAuth("admin", "123456")
resp, err := ts.Client().Do(req)
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)
}

Expand Down Expand Up @@ -395,7 +395,7 @@ func TestServer_configCtrl(t *testing.T) {

resp, err := ts.Client().Get(ts.URL + "/config")
require.NoError(t, err)
defer resp.Body.Close()
defer resp.Body.Close() // nolint
assert.Equal(t, http.StatusOK, resp.StatusCode)

respBody, err := io.ReadAll(resp.Body)
Expand Down
4 changes: 2 additions & 2 deletions app/config/config.go
Expand Up @@ -2,7 +2,7 @@
package config

import (
"io/ioutil"
"os"
"regexp"
"time"

Expand Down Expand Up @@ -94,7 +94,7 @@ type YTChannel struct {
// Load config from file
func Load(fname string) (res *Conf, err error) {
res = &Conf{}
data, err := ioutil.ReadFile(fname) // nolint
data, err := os.ReadFile(fname) // nolint
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion app/proc/telegram.go
Expand Up @@ -106,7 +106,7 @@ func (client TelegramClient) sendAudio(channelID string, item feed.Item) (*tb.Me
if err != nil {
return nil, err
}
defer httpBody.Close()
defer httpBody.Close() // nolint

// download audio to the temp file
tmpFile, err := os.CreateTemp(os.TempDir(), "feed-master-*.mp3")
Expand Down
2 changes: 1 addition & 1 deletion app/youtube/feed/feed.go
Expand Up @@ -47,7 +47,7 @@ func (c *Feed) Get(ctx context.Context, id string, feedType Type) ([]Entry, erro
if err != nil {
return nil, errors.Wrapf(err, "failed to get channel %s", id)
}
defer resp.Body.Close()
defer resp.Body.Close() // nolint
if resp.StatusCode != http.StatusOK {
return nil, errors.Errorf("failed to get %s: %s", id, resp.Status)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
@@ -1,6 +1,6 @@
module github.com/umputun/feed-master

go 1.17
go 1.20

require (
github.com/ChimeraCoder/anaconda v2.0.0+incompatible
Expand Down
5 changes: 0 additions & 5 deletions go.sum
Expand Up @@ -137,7 +137,6 @@ github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLC
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand All @@ -152,7 +151,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -177,13 +175,10 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down

0 comments on commit 3939fc2

Please sign in to comment.