1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

update golangci (#349)

* update golangci
This commit is contained in:
silenceper
2020-11-26 12:25:57 +08:00
committed by GitHub
parent 185baa5d12
commit c0da806e03
9 changed files with 38 additions and 34 deletions

View File

@@ -7,8 +7,21 @@ on:
branches: [ master,release-* ]
jobs:
golangci:
strategy:
matrix:
go-version: [1.15.x]
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
build:
name: Build
name: Test
runs-on: ubuntu-latest
services:
redis:
@@ -21,20 +34,11 @@ jobs:
ports:
- 11211:11211
steps:
- uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.26
- name: Test
run: go test -v -race ./...

View File

@@ -11,7 +11,7 @@ linters:
- errcheck
- funlen
- goconst
- gocritic
# - gocritic
- gocyclo
- gofmt
- goimports

View File

@@ -52,9 +52,9 @@ func PostJSON(uri string, obj interface{}) ([]byte, error) {
if err != nil {
return nil, err
}
jsonData = bytes.Replace(jsonData, []byte("\\u003c"), []byte("<"), -1)
jsonData = bytes.Replace(jsonData, []byte("\\u003e"), []byte(">"), -1)
jsonData = bytes.Replace(jsonData, []byte("\\u0026"), []byte("&"), -1)
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003c"), []byte("<"))
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003e"), []byte(">"))
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u0026"), []byte("&"))
body := bytes.NewBuffer(jsonData)
response, err := http.Post(uri, "application/json;charset=utf-8", body)
if err != nil {
@@ -75,9 +75,9 @@ func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, e
return nil, "", err
}
jsonData = bytes.Replace(jsonData, []byte("\\u003c"), []byte("<"), -1)
jsonData = bytes.Replace(jsonData, []byte("\\u003e"), []byte(">"), -1)
jsonData = bytes.Replace(jsonData, []byte("\\u0026"), []byte("&"), -1)
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003c"), []byte("<"))
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003e"), []byte(">"))
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u0026"), []byte("&"))
body := bytes.NewBuffer(jsonData)
response, err := http.Post(uri, "application/json;charset=utf-8", body)