Skip to content

Commit ef901e4

Browse files
authored
Merge pull request #8 from to-lz1/update_go_to_1_19_1
update go 1.19.1
2 parents e92f605 + 1ca1d1a commit ef901e4

16 files changed

Lines changed: 59 additions & 58 deletions

File tree

.github/workflows/client-js-test.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/cache@v2
11+
- uses: actions/checkout@v3
12+
- uses: actions/cache@v3
1313
with:
1414
path: client/js/node_modules
1515
key: ${{ runner.os }}-clinet-js-modules-${{ hashFiles('client/js/yarn.lock') }}
@@ -27,16 +27,16 @@ jobs:
2727

2828
runs-on: ubuntu-latest
2929
env:
30-
go-version: 1.18.3
30+
go-version: 1.19.1
3131

3232
steps:
33-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v3
3434

35-
- uses: actions/setup-go@v2
35+
- uses: actions/setup-go@v3
3636
with:
3737
go-version: ${{ env.go-version }}
3838

39-
- uses: actions/cache@v2
39+
- uses: actions/cache@v3
4040
with:
4141
path: client/js/node_modules
4242
key: ${{ runner.os }}-clinet-js-modules-${{ hashFiles('client/js/yarn.lock') }}
@@ -56,7 +56,7 @@ jobs:
5656
5757
pushd client/js
5858
DSPS_BASE_URL="http://localhost:3000/" yarn test:ci
59-
- uses: actions/upload-artifact@v2
59+
- uses: actions/upload-artifact@v3
6060
with:
6161
name: coverage
6262
path: client/js/coverage

.github/workflows/release-tag.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
- name: Setup Go
1414
uses: actions/setup-go@v3
1515
with:
16-
go-version: 1.18.3
16+
go-version: 1.19.1
1717
- name: Run GoReleaser
18-
uses: goreleaser/goreleaser-action@v2
18+
uses: goreleaser/goreleaser-action@v3
1919
with:
2020
version: latest
2121
workdir: server
@@ -32,7 +32,7 @@ jobs:
3232
# version=$(echo "${{github.ref}}" | sed 's/^refs\/tags\/v//')
3333
# echo "::set-output name=version::$version"
3434
# - name: Checkout
35-
# uses: actions/checkout@v2
35+
# uses: actions/checkout@v3
3636
# - uses: actions/setup-node@v1
3737
# with:
3838
# node-version: '12.x'

.github/workflows/server-test.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77

88
runs-on: ubuntu-latest
99
env:
10-
go-version: 1.18.3
10+
go-version: 1.19.1
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
# Note: golangci/golangci-lint-action caches. Should not use actions/cache@v2 otherwise result in so many "File exists"
15-
- uses: actions/setup-go@v2
13+
- uses: actions/checkout@v3
14+
# Note: golangci/golangci-lint-action caches. Should not use actions/cache@v3 otherwise result in so many "File exists"
15+
- uses: actions/setup-go@v3
1616
with:
1717
go-version: ${{ env.go-version }}
1818
- name: generate
@@ -24,7 +24,7 @@ jobs:
2424
- name: golangci-lint
2525
uses: golangci/golangci-lint-action@v3
2626
with:
27-
version: v1.46.2
27+
version: v1.49.0
2828
working-directory: server
2929
skip-pkg-cache: true
3030
- name: Other Lint
@@ -42,7 +42,7 @@ jobs:
4242
name: Server test
4343

4444
runs-on: ubuntu-latest
45-
container: golang:1.18.3-bullseye
45+
container: golang:1.19.1-bullseye
4646
services:
4747
redis:
4848
image: redis:6.0.9
@@ -55,14 +55,14 @@ jobs:
5555
--health-retries 10
5656
5757
steps:
58-
- uses: actions/checkout@v2
59-
- uses: actions/cache@v2
58+
- uses: actions/checkout@v3
59+
- uses: actions/cache@v3
6060
with:
6161
path: /go/pkg/mod # Not ~/go/pkg/mod because "container" is active.
6262
key: ${{ runner.os }}-server-gomod-${{ hashFiles('server/go.sum') }}
6363
restore-keys: |
6464
${{ runner.os }}-server-gomod-
65-
- uses: actions/setup-go@v2
65+
- uses: actions/setup-go@v3
6666
with:
6767
go-version: ${{ matrix.go-version }}
6868
- name: Test
@@ -78,7 +78,7 @@ jobs:
7878
run: |
7979
curl -s https://codecov.io/bash > codecov.sh
8080
bash codecov.sh
81-
- uses: actions/upload-artifact@v2
81+
- uses: actions/upload-artifact@v3
8282
with:
8383
name: coverage.html
8484
path: server/coverage.html
@@ -88,16 +88,16 @@ jobs:
8888

8989
runs-on: ubuntu-latest
9090
env:
91-
go-version: 1.18.3
91+
go-version: 1.19.1
9292

9393
steps:
94-
- uses: actions/checkout@v2
95-
# Note: golangci/golangci-lint-action caches. Should not use actions/cache@v2 otherwise result in so many "File exists"
96-
- uses: actions/setup-go@v2
94+
- uses: actions/checkout@v3
95+
# Note: golangci/golangci-lint-action caches. Should not use actions/cache@v3 otherwise result in so many "File exists"
96+
- uses: actions/setup-go@v3
9797
with:
9898
go-version: ${{ env.go-version }}
9999
- name: build
100-
uses: goreleaser/goreleaser-action@v2
100+
uses: goreleaser/goreleaser-action@v3
101101
with:
102102
version: latest
103103
workdir: server

server/.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ run:
55

66
issues:
77
exclude-use-default: false
8+
exclude:
9+
# https://golangci-lint.run/usage/false-positives/#exc0015
10+
- "should have a package comment"
811

912
linters:
1013
enable:

server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.18.3
1+
FROM golang:1.19.1
22
ARG DSPS_VERSION_ID=""
33
WORKDIR /go/src/github.com/dsps/server
44
COPY . .

server/config/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"os"
109
"strconv"
1110
"strings"
@@ -57,9 +56,9 @@ func LoadConfigFile(ctx context.Context, configFile string, configOverrides Over
5756
case "":
5857
yamlBytes = []byte("")
5958
case "-":
60-
yamlBytes, err = ioutil.ReadAll(os.Stdin)
59+
yamlBytes, err = io.ReadAll(os.Stdin)
6160
default:
62-
yamlBytes, err = ioutil.ReadFile(configFile) //nolint:gosec // Disables G304: Potential file inclusion via variable
61+
yamlBytes, err = os.ReadFile(configFile) //nolint:gosec // Disables G304: Potential file inclusion via variable
6362
}
6463
if err != nil {
6564
return ServerConfig{}, err

server/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/m3dev/dsps/server
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
cloud.google.com/go v0.74.0 // indirect

server/http/middleware/logger_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"net/http/httptest"
1010
"testing"
@@ -132,7 +132,7 @@ func TestPanicHandling(t *testing.T) {
132132
logger.WithTestLogger(t, nil, func(lc *logger.LogCapture) {
133133
res := DoHTTPRequest(t, "GET", server.URL+"/panic-after-200", ``)
134134
assert.Equal(t, 200, res.StatusCode) // After response sent.
135-
body, err := ioutil.ReadAll(res.Body)
135+
body, err := io.ReadAll(res.Body)
136136
assert.NoError(t, err)
137137
assert.Equal(t, `{"hi":"hello"}`+"\n", string(body))
138138
assert.NoError(t, res.Body.Close())

server/http/router/request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package router
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net/http"
66
)
77

@@ -14,7 +14,7 @@ type Request struct {
1414
func (req Request) ReadBody() ([]byte, error) {
1515
// > The Server will close the request body. The ServeHTTP Handler does not need to.
1616
// https://golang.org/pkg/net/http/#ResponseWriter
17-
return ioutil.ReadAll(req.Body)
17+
return io.ReadAll(req.Body)
1818
}
1919

2020
// GetQueryParam returns URL query parameter or ""

server/http/testing/http_response.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package testing
22

33
import (
44
"encoding/json"
5-
"io/ioutil"
5+
"io"
66
"net/http"
77
"testing"
88

@@ -52,7 +52,7 @@ func BodyJSONMapOfRes(t *testing.T, res *http.Response) map[string]interface{} {
5252
func BodyJSONOfRes(t *testing.T, res *http.Response, body interface{}) {
5353
assert.Regexp(t, "application/json(;|$)", res.Header.Get("Content-Type"))
5454

55-
raw, err := ioutil.ReadAll(res.Body)
55+
raw, err := io.ReadAll(res.Body)
5656
assert.NoError(t, err)
5757
assert.NoError(t, res.Body.Close())
5858
assert.NoError(t, json.Unmarshal(raw, body), "failed to parse response JSON: %s", string(raw))

0 commit comments

Comments
 (0)