mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-19 20:12:25 +08:00
26
.github/workflows/go.yml
vendored
26
.github/workflows/go.yml
vendored
@@ -7,8 +7,21 @@ on:
|
|||||||
branches: [ master,release-* ]
|
branches: [ master,release-* ]
|
||||||
|
|
||||||
jobs:
|
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:
|
build:
|
||||||
name: Build
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
@@ -21,20 +34,11 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 11211:11211
|
- 11211:11211
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13
|
go-version: ^1.13
|
||||||
id: go
|
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
|
- name: Test
|
||||||
run: go test -v -race ./...
|
run: go test -v -race ./...
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ linters:
|
|||||||
- errcheck
|
- errcheck
|
||||||
- funlen
|
- funlen
|
||||||
- goconst
|
- goconst
|
||||||
- gocritic
|
# - gocritic
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
|
|||||||
12
util/http.go
12
util/http.go
@@ -52,9 +52,9 @@ func PostJSON(uri string, obj interface{}) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u003c"), []byte("<"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003c"), []byte("<"))
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u003e"), []byte(">"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003e"), []byte(">"))
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u0026"), []byte("&"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u0026"), []byte("&"))
|
||||||
body := bytes.NewBuffer(jsonData)
|
body := bytes.NewBuffer(jsonData)
|
||||||
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -75,9 +75,9 @@ func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, e
|
|||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u003c"), []byte("<"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003c"), []byte("<"))
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u003e"), []byte(">"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u003e"), []byte(">"))
|
||||||
jsonData = bytes.Replace(jsonData, []byte("\\u0026"), []byte("&"), -1)
|
jsonData = bytes.ReplaceAll(jsonData, []byte("\\u0026"), []byte("&"))
|
||||||
|
|
||||||
body := bytes.NewBuffer(jsonData)
|
body := bytes.NewBuffer(jsonData)
|
||||||
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
||||||
|
|||||||
Reference in New Issue
Block a user