From 206f0bb9f8f95933bfe670a8066c87686cdd1abe Mon Sep 17 00:00:00 2001 From: Osamu TONOMORI Date: Thu, 18 Feb 2021 14:59:57 +0900 Subject: [PATCH] Update go version and golangci-lint version --- .github/workflows/actions.yml | 6 +++--- .golangci.yml | 11 ++++++----- kenall_test.go | 37 ++++------------------------------- 3 files changed, 13 insertions(+), 41 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 8dee967..a6c1edd 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -18,13 +18,13 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.36.0 + version: v1.37.0 test: name: Test runs-on: ubuntu-18.04 strategy: matrix: - go: [ '1.14.x', '1.15.x' ] + go: [ '1.15.x', '1.16.x' ] steps: - name: Check out code uses: actions/checkout@v2 @@ -33,7 +33,7 @@ jobs: with: go-version: ${{ matrix.go }} - name: Test Go Code - run: go test -v -race -covermode=atomic -coverprofile=coverage.txt ./... + run: go test -race -covermode=atomic -coverprofile=coverage.txt ./... env: KENALL_AUTHORIZATION_TOKEN: ${{ secrets.KENALL_AUTHORIZATION_TOKEN }} - name: Upload coverage to Codecov diff --git a/.golangci.yml b/.golangci.yml index 41d9da1..8b57b95 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,15 +8,16 @@ linters-settings: linters: enable-all: true - disable: - - wsl issues: exclude-rules: - path: _test\.go + text: "does not use range value in test Run" linters: - - lll - - funlen - paralleltest - - forbidigo + - path: _test\.go + linters: + - lll - goerr113 + - exhaustivestruct + - cyclop diff --git a/kenall_test.go b/kenall_test.go index 231d653..3bd671f 100644 --- a/kenall_test.go +++ b/kenall_test.go @@ -33,6 +33,7 @@ func TestNewClient(t *testing.T) { for name, c := range cases { c := c + t.Run(name, func(t *testing.T) { t.Parallel() @@ -90,6 +91,7 @@ func TestClient_GetAddress(t *testing.T) { for name, c := range cases { c := c + t.Run(name, func(t *testing.T) { t.Parallel() @@ -126,6 +128,7 @@ func TestVersion_UnmarshalJSON(t *testing.T) { for name, c := range cases { c := c + t.Run(name, func(t *testing.T) { t.Parallel() @@ -163,39 +166,7 @@ func ExampleClient_GetAddress() { func runTestingServer(t *testing.T) *httptest.Server { t.Helper() - const data = `{ - "version": "2020-11-30", - "data": [ - { - "jisx0402": "13101", - "old_code": "100", - "postal_code": "1008105", - "prefecture_kana": "", - "city_kana": "", - "town_kana": "", - "town_kana_raw": "", - "prefecture": "東京都", - "city": "千代田区", - "town": "大手町", - "koaza": "", - "kyoto_street": "", - "building": "", - "floor": "", - "town_partial": false, - "town_addressed_koaza": false, - "town_chome": false, - "town_multi": false, - "town_raw": "大手町", - "corporation": { - "name": "チッソ 株式会社", - "name_kana": "チツソ カブシキガイシヤ", - "block_lot": "2丁目2-1(新大手町ビル)", - "post_office": "銀座", - "code_type": 0 - } - } - ] -}` + const data = `{"version":"2020-11-30","data":[{"jisx0402":"13101","old_code":"100","postal_code":"1008105","prefecture_kana":"","city_kana":"","town_kana":"","town_kana_raw":"","prefecture":"東京都","city":"千代田区","town":"大手町","koaza":"","kyoto_street":"","building":"","floor":"","town_partial":false,"town_addressed_koaza":false,"town_chome":false,"town_multi":false,"town_raw":"大手町","corporation":{"name":"チッソ 株式会社","name_kana":"チツソ カブシキガイシヤ","block_lot":"2丁目2-1(新大手町ビル)","post_office":"銀座","code_type":0}}]}` return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { token := strings.Fields(r.Header.Get("Authorization"))