From 4a4f627509c4fe2c0ebfce5bad76259d96795750 Mon Sep 17 00:00:00 2001 From: Federico Guerinoni <41150432+guerinoni@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:39:32 +0100 Subject: [PATCH] chore: maintenance stuff (#161) --- .github/workflows/ci.yaml | 8 +++----- .github/workflows/lint.yaml | 15 ++++++++------- .github/workflows/reviewdog.yaml | 9 ++++----- Makefile | 3 ++- go.mod | 2 +- go.sum | 6 ++++++ pkg/cmd/chat/file/file_test.go | 5 ++--- pkg/cmd/chat/message/message_test.go | 3 +-- 8 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eb5bc27..cf3000a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,12 +14,10 @@ jobs: name: 👷 Test & Build runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 with: - go-version: "1.19" - - - uses: actions/checkout@v2 + go-version-file: 'go.mod' - name: Test env: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ccc66ec..b7370e5 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,17 +12,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 + uses: actions/checkout@v4 - name: Commit message linter - uses: wagoid/commitlint-github-action@v4 + uses: wagoid/commitlint-github-action@v5 - - name: Setup Go - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version-file: 'go.mod' - name: Tidy run: go mod tidy -v && git diff --no-patch --exit-code || { git status; echo 'Unchecked diff, did you forget go mod tidy again?' ; false ; }; + + - name: Linters + run: make lint + diff --git a/.github/workflows/reviewdog.yaml b/.github/workflows/reviewdog.yaml index d7eabcb..255573f 100644 --- a/.github/workflows/reviewdog.yaml +++ b/.github/workflows/reviewdog.yaml @@ -11,20 +11,19 @@ jobs: name: 🐶 Reviewdog runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: reviewdog/action-setup@v1 with: reviewdog_version: latest - - name: Setup Go - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version-file: 'go.mod' - name: Install golangci-lint run: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 - name: Reviewdog env: diff --git a/Makefile b/Makefile index 22b0c6a..d9b1d48 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ NAME = stream-cli -GOLANGCI_VERSION = 1.49.0 +GOLANGCI_VERSION = 1.55.2 GOLANGCI = .bin/golangci/$(GOLANGCI_VERSION)/golangci-lint $(GOLANGCI): @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION) @@ -17,5 +17,6 @@ $(NAME): build: @go build ./cmd/$(NAME) +.PHONY: test test: @go test -v ./... diff --git a/go.mod b/go.mod index b1b337c..1677c79 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/GetStream/stream-cli -go 1.19 +go 1.22 require ( github.com/AlecAivazis/survey/v2 v2.3.4 diff --git a/go.sum b/go.sum index 3e3a23e..f11ddd2 100644 --- a/go.sum +++ b/go.sum @@ -71,6 +71,7 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= @@ -118,6 +119,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -156,9 +158,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -195,6 +199,7 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= @@ -426,6 +431,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= diff --git a/pkg/cmd/chat/file/file_test.go b/pkg/cmd/chat/file/file_test.go index bb4404f..d6616c0 100644 --- a/pkg/cmd/chat/file/file_test.go +++ b/pkg/cmd/chat/file/file_test.go @@ -4,7 +4,6 @@ import ( "bytes" "image" "image/png" - "io/ioutil" "os" "strings" "testing" @@ -19,7 +18,7 @@ func TestFileUploadAndDelete(t *testing.T) { ch := test.InitChannel(t) u := test.CreateUser() - tmpfile, err := ioutil.TempFile("", "*.txt") + tmpfile, err := os.CreateTemp("", "*.txt") require.NoError(t, err) err = os.WriteFile(tmpfile.Name(), []byte("hello\nworld\n"), 0o644) @@ -52,7 +51,7 @@ func TestImageUploadAndDelete(t *testing.T) { ch := test.InitChannel(t) u := test.CreateUser() - tmpfile, err := ioutil.TempFile("", "*.png") + tmpfile, err := os.CreateTemp("", "*.png") require.NoError(t, err) m := image.NewRGBA(image.Rect(0, 0, 1, 1)) diff --git a/pkg/cmd/chat/message/message_test.go b/pkg/cmd/chat/message/message_test.go index f01b859..bf1c514 100644 --- a/pkg/cmd/chat/message/message_test.go +++ b/pkg/cmd/chat/message/message_test.go @@ -2,7 +2,6 @@ package message import ( "bytes" - "io/ioutil" "os" "testing" @@ -31,7 +30,7 @@ func TestSendMessageWithFileAttachment(t *testing.T) { ch := test.InitChannel(t) u := test.CreateUser() - tmpfile, err := ioutil.TempFile("", "*.txt") + tmpfile, err := os.CreateTemp("", "*.txt") require.NoError(t, err) err = os.WriteFile(tmpfile.Name(), []byte("hello\nworld\n"), 0o644)