Skip to content

Commit e61cc72

Browse files
committed
v1.1.5
1 parent f919df5 commit e61cc72

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Github](https://img.shields.io/github/followers/iGoogle-ink?label=Follow&style=social)](https://github.com/iGoogle-ink)
66
[![Github](https://img.shields.io/github/forks/go-pay/wechat-sdk?label=Fork&style=social)](https://github.com/go-pay/wechat-sdk/fork)
77

8-
[![Golang](https://img.shields.io/badge/golang-1.18-brightgreen.svg)](https://golang.google.cn)
8+
[![Golang](https://img.shields.io/badge/golang-1.21-brightgreen.svg)](https://golang.google.cn)
99
[![GoDoc](https://img.shields.io/badge/doc-pkg.go.dev-informational.svg)](https://pkg.go.dev/github.com/go-pay/wechat-sdk)
1010
[![Go](https://github.com/go-pay/wechat-sdk/actions/workflows/go.yml/badge.svg)](https://github.com/go-pay/wechat-sdk/actions/workflows/go.yml)
1111
[![GitHub Release](https://img.shields.io/github/v/release/go-pay/wechat-sdk)](https://github.com/go-pay/wechat-sdk/releases)
@@ -26,11 +26,11 @@ go get -u github.com/go-pay/wechat-sdk
2626
```go
2727
import (
2828
"github.com/go-pay/wechat-sdk"
29-
"github.com/go-pay/wechat-sdk/pkg/xlog"
29+
"github.com/go-pay/xlog"
3030
)
3131

3232
func main() {
33-
xlog.Info("Wechat-SDK Version: ", wechat.Version)
33+
xlog.Warn("Wechat-SDK Version: ", wechat.Version)
3434
}
3535
```
3636

@@ -78,4 +78,4 @@ QQ群:
7878
> [GoLand](https://www.jetbrains.com/go/?from=gopay) A Go IDE with extended support for JavaScript, TypeScript, and databases。
7979
>
8080
特别感谢 [JetBrains](https://www.jetbrains.com/?from=gopay) 为开源项目提供免费的 [GoLand](https://www.jetbrains.com/go/?from=gopay) 等 IDE 的授权
81-
[<img src=".github/jetbrains-variant-3.png" width="200"/>](https://www.jetbrains.com/?from=gopay)
81+
[<img src=".github/jetbrains-variant-3.png" width="200"/>](https://www.jetbrains.com/?from=gopay)

pkg/util/convert.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package util
22

33
import (
44
"math"
5-
"reflect"
65
"strconv"
76
"strings"
87
"unsafe"
@@ -92,9 +91,5 @@ func BinaryToDecimal(bit string) (num int) {
9291

9392
// BytesToString 0 拷贝转换 slice byte 为 string
9493
func BytesToString(b []byte) (s string) {
95-
_bptr := (*reflect.SliceHeader)(unsafe.Pointer(&b))
96-
_sptr := (*reflect.StringHeader)(unsafe.Pointer(&s))
97-
_sptr.Data = _bptr.Data
98-
_sptr.Len = _bptr.Len
99-
return s
94+
return *(*string)(unsafe.Pointer(&b))
10095
}

pkg/xhttp/client.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"errors"
1010
"fmt"
1111
"io"
12-
"io/ioutil"
1312
"mime/multipart"
1413
"net/http"
1514
"net/url"
@@ -304,7 +303,7 @@ func (c *Client) EndBytes(ctx context.Context) (res *http.Response, bs []byte, e
304303
return err
305304
}
306305
defer res.Body.Close()
307-
bs, err = ioutil.ReadAll(io.LimitReader(res.Body, int64(5<<20))) // default 5MB change the size you want
306+
bs, err = io.ReadAll(io.LimitReader(res.Body, int64(5<<20))) // default 5MB change the size you want
308307
if err != nil {
309308
return err
310309
}

pkg/xhttp/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package xhttp
22

33
import (
44
"context"
5-
"io/ioutil"
5+
"os"
66
"testing"
77
"time"
88

@@ -40,7 +40,7 @@ func TestHttpGet(t *testing.T) {
4040
}
4141

4242
func TestHttpUploadFile(t *testing.T) {
43-
fileContent, err := ioutil.ReadFile("../../logo.png")
43+
fileContent, err := os.ReadFile("../../logo.png")
4444
if err != nil {
4545
xlog.Error(err)
4646
return

0 commit comments

Comments
 (0)