Skip to content

Commit

Permalink
v1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Aug 2, 2024
1 parent f919df5 commit e61cc72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Github](https://img.shields.io/github/followers/iGoogle-ink?label=Follow&style=social)](https://github.com/iGoogle-ink)
[![Github](https://img.shields.io/github/forks/go-pay/wechat-sdk?label=Fork&style=social)](https://github.com/go-pay/wechat-sdk/fork)

[![Golang](https://img.shields.io/badge/golang-1.18-brightgreen.svg)](https://golang.google.cn)
[![Golang](https://img.shields.io/badge/golang-1.21-brightgreen.svg)](https://golang.google.cn)
[![GoDoc](https://img.shields.io/badge/doc-pkg.go.dev-informational.svg)](https://pkg.go.dev/github.com/go-pay/wechat-sdk)
[![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)
[![GitHub Release](https://img.shields.io/github/v/release/go-pay/wechat-sdk)](https://github.com/go-pay/wechat-sdk/releases)
Expand All @@ -26,11 +26,11 @@ go get -u github.com/go-pay/wechat-sdk
```go
import (
"github.com/go-pay/wechat-sdk"
"github.com/go-pay/wechat-sdk/pkg/xlog"
"github.com/go-pay/xlog"
)

func main() {
xlog.Info("Wechat-SDK Version: ", wechat.Version)
xlog.Warn("Wechat-SDK Version: ", wechat.Version)
}
```

Expand Down Expand Up @@ -78,4 +78,4 @@ QQ群:
> [GoLand](https://www.jetbrains.com/go/?from=gopay) A Go IDE with extended support for JavaScript, TypeScript, and databases。
>
特别感谢 [JetBrains](https://www.jetbrains.com/?from=gopay) 为开源项目提供免费的 [GoLand](https://www.jetbrains.com/go/?from=gopay) 等 IDE 的授权
[<img src=".github/jetbrains-variant-3.png" width="200"/>](https://www.jetbrains.com/?from=gopay)
[<img src=".github/jetbrains-variant-3.png" width="200"/>](https://www.jetbrains.com/?from=gopay)
7 changes: 1 addition & 6 deletions pkg/util/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package util

import (
"math"
"reflect"
"strconv"
"strings"
"unsafe"
Expand Down Expand Up @@ -92,9 +91,5 @@ func BinaryToDecimal(bit string) (num int) {

// BytesToString 0 拷贝转换 slice byte 为 string
func BytesToString(b []byte) (s string) {
_bptr := (*reflect.SliceHeader)(unsafe.Pointer(&b))
_sptr := (*reflect.StringHeader)(unsafe.Pointer(&s))
_sptr.Data = _bptr.Data
_sptr.Len = _bptr.Len
return s
return *(*string)(unsafe.Pointer(&b))
}
3 changes: 1 addition & 2 deletions pkg/xhttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
Expand Down Expand Up @@ -304,7 +303,7 @@ func (c *Client) EndBytes(ctx context.Context) (res *http.Response, bs []byte, e
return err
}
defer res.Body.Close()
bs, err = ioutil.ReadAll(io.LimitReader(res.Body, int64(5<<20))) // default 5MB change the size you want
bs, err = io.ReadAll(io.LimitReader(res.Body, int64(5<<20))) // default 5MB change the size you want
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/xhttp/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package xhttp

import (
"context"
"io/ioutil"
"os"
"testing"
"time"

Expand Down Expand Up @@ -40,7 +40,7 @@ func TestHttpGet(t *testing.T) {
}

func TestHttpUploadFile(t *testing.T) {
fileContent, err := ioutil.ReadFile("../../logo.png")
fileContent, err := os.ReadFile("../../logo.png")
if err != nil {
xlog.Error(err)
return
Expand Down

0 comments on commit e61cc72

Please sign in to comment.