Skip to content

Commit adf1b59

Browse files
committed
feat: upgrade to go-tool v2
1 parent 45d96d2 commit adf1b59

File tree

16 files changed

+35
-35
lines changed

16 files changed

+35
-35
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tidy:
99

1010
fmt:
1111
@find . -name '*.go' -not -path "./vendor/*" | xargs gofumpt -w -extra
12-
@find . -name '*.go' -not -path "./vendor/*" | xargs -n 1 -t goimports-reviser -rm-unused -set-alias -company-prefixes "github.com/sliveryou" -project-name "github.com/sliveryou/go-tool"
12+
@find . -name '*.go' -not -path "./vendor/*" | xargs -n 1 -t goimports-reviser -rm-unused -set-alias -company-prefixes "github.com/sliveryou" -project-name "github.com/sliveryou/go-tool/v2"
1313
@find . -name '*.sh' -not -path "./vendor/*" | xargs shfmt -w -s -i 2 -ci -bn -sr
1414

1515
lint:

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# go-tool
1+
# go-tool v2
22

33
[![Github License](https://img.shields.io/github/license/sliveryou/go-tool.svg?style=flat)](https://github.com/sliveryou/go-tool/blob/master/LICENSE)
4-
[![Go Doc](https://godoc.org/github.com/sliveryou/go-tool?status.svg)](https://pkg.go.dev/github.com/sliveryou/go-tool)
5-
[![Go Report](https://goreportcard.com/badge/github.com/sliveryou/go-tool)](https://goreportcard.com/report/github.com/sliveryou/go-tool)
4+
[![Go Doc](https://godoc.org/github.com/sliveryou/go-tool/v2?status.svg)](https://pkg.go.dev/github.com/sliveryou/go-tool/v2)
5+
[![Go Report](https://goreportcard.com/badge/github.com/sliveryou/go-tool/v2)](https://goreportcard.com/report/github.com/sliveryou/go-tool/v2)
66
[![Github Latest Release](https://img.shields.io/github/release/sliveryou/go-tool.svg?style=flat)](https://github.com/sliveryou/go-tool/releases/latest)
77
[![Github Latest Tag](https://img.shields.io/github/tag/sliveryou/go-tool.svg?style=flat)](https://github.com/sliveryou/go-tool/tags)
88
[![Github Stars](https://img.shields.io/github/stars/sliveryou/go-tool.svg?style=flat)](https://github.com/sliveryou/go-tool/stargazers)
@@ -29,7 +29,7 @@ go 常用工具函数集合
2929

3030
```go
3131
import (
32-
"github.com/sliveryou/go-tool/cipher"
32+
"github.com/sliveryou/go-tool/v2/cipher"
3333
)
3434

3535
type Cipher
@@ -38,7 +38,7 @@ type Cipher
3838

3939
// aes
4040
import (
41-
"github.com/sliveryou/go-tool/cipher/aes"
41+
"github.com/sliveryou/go-tool/v2/cipher/aes"
4242
)
4343

4444
func AesCbcDecrypt(key, iv, src []byte) ([]byte, error)
@@ -54,7 +54,7 @@ type AesCbc
5454

5555
// pkcs
5656
import (
57-
"github.com/sliveryou/go-tool/cipher/pkcs"
57+
"github.com/sliveryou/go-tool/v2/cipher/pkcs"
5858
)
5959

6060
func PKCS5Padding(cipherText []byte) []byte
@@ -67,7 +67,7 @@ func PKCS7Trimming(encrypt []byte) ([]byte, error)
6767

6868
```go
6969
import (
70-
"github.com/sliveryou/go-tool/convert"
70+
"github.com/sliveryou/go-tool/v2/convert"
7171
)
7272

7373
func BinToDec(bin string) int64
@@ -106,7 +106,7 @@ func Uint64ToBytes(i uint64) []byte
106106

107107
```go
108108
import (
109-
"github.com/sliveryou/go-tool/filex"
109+
"github.com/sliveryou/go-tool/v2/filex"
110110
)
111111

112112
func AbsPath(filePath string) (string, error)
@@ -138,7 +138,7 @@ func Write(fileName string, data []byte, perm ...os.FileMode) error
138138
```go
139139
// encoding/base58
140140
import (
141-
"github.com/sliveryou/go-tool/id-generator/encoding/base58"
141+
"github.com/sliveryou/go-tool/v2/id-generator/encoding/base58"
142142
)
143143

144144
func StdSource() string
@@ -150,7 +150,7 @@ type Encoder
150150

151151
// encoding/base62
152152
import (
153-
"github.com/sliveryou/go-tool/id-generator/encoding/base62"
153+
"github.com/sliveryou/go-tool/v2/id-generator/encoding/base62"
154154
)
155155

156156
func StdSource() string
@@ -162,7 +162,7 @@ type Encoder
162162

163163
// snowflake
164164
import (
165-
"github.com/sliveryou/go-tool/id-generator/snowflake"
165+
"github.com/sliveryou/go-tool/v2/id-generator/snowflake"
166166
)
167167

168168
func NodeId(nodeId int64) func() (int64, error)
@@ -174,7 +174,7 @@ type Snowflake
174174

175175
// uuid
176176
import (
177-
"github.com/sliveryou/go-tool/id-generator/uuid"
177+
"github.com/sliveryou/go-tool/v2/id-generator/uuid"
178178
)
179179
func NextV1() string
180180
func NextV4() string
@@ -185,7 +185,7 @@ func Parse(input string) (uuid.UUID, error)
185185

186186
```go
187187
import (
188-
"github.com/sliveryou/go-tool/mathx"
188+
"github.com/sliveryou/go-tool/v2/mathx"
189189
)
190190

191191
func AbsFloat(num float64) float64
@@ -247,7 +247,7 @@ func SumInt64(nums ...int64) int64
247247

248248
```go
249249
import (
250-
"github.com/sliveryou/go-tool/mathg"
250+
"github.com/sliveryou/go-tool/v2/mathg"
251251
)
252252

253253
func Abs[T constraints.Signed | constraints.Float](n T) T
@@ -270,7 +270,7 @@ func Sum[T constraints.Ordered](nums ...T) T
270270

271271
```go
272272
import (
273-
"github.com/sliveryou/go-tool/randx"
273+
"github.com/sliveryou/go-tool/v2/randx"
274274
)
275275

276276
func NewNumber(length int) string
@@ -284,7 +284,7 @@ func StdSource() string
284284

285285
```go
286286
import (
287-
"github.com/sliveryou/go-tool/slicex"
287+
"github.com/sliveryou/go-tool/v2/slicex"
288288
)
289289

290290
func Contain(slice, value interface{}) (index int)
@@ -419,7 +419,7 @@ func UniqueStrings(slice []string) []string
419419

420420
```go
421421
import (
422-
"github.com/sliveryou/go-tool/sliceg"
422+
"github.com/sliveryou/go-tool/v2/sliceg"
423423
)
424424

425425
func Contain[T comparable](s []T, v T) bool
@@ -442,7 +442,7 @@ func Unique[T comparable](s []T) []T
442442

443443
```go
444444
import (
445-
"github.com/sliveryou/go-tool/timex"
445+
"github.com/sliveryou/go-tool/v2/timex"
446446
)
447447

448448
func Date(t time.Time, location ...*time.Location) string
@@ -495,7 +495,7 @@ func UnixTodayRange(location ...*time.Location) (int64, int64)
495495

496496
```go
497497
import (
498-
"github.com/sliveryou/go-tool/validator"
498+
"github.com/sliveryou/go-tool/v2/validator"
499499
)
500500

501501
func ParseErr(err error) string

cipher/aes/aescbc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"encoding/hex"
88
"fmt"
99

10-
"github.com/sliveryou/go-tool/cipher/pkcs"
10+
"github.com/sliveryou/go-tool/v2/cipher/pkcs"
1111
)
1212

1313
// There aescbc add pkcs7Padding to be same as php's aescbc

cipher/cipher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package cipher
44
// Now it support aescbc
55
// Plan to support aesecb rsa
66
import (
7-
"github.com/sliveryou/go-tool/cipher/aes"
7+
"github.com/sliveryou/go-tool/v2/cipher/aes"
88
)
99

1010
// If you want convert encrypted content to appoint format

filex/filex_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"github.com/stretchr/testify/assert"
1111

12-
"github.com/sliveryou/go-tool/mathx"
12+
"github.com/sliveryou/go-tool/v2/mathx"
1313
)
1414

1515
func TestMain(m *testing.M) {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/sliveryou/go-tool
1+
module github.com/sliveryou/go-tool/v2
22

33
go 1.18
44

id-generator/snowflake/snowflake_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77

88
"github.com/stretchr/testify/assert"
99

10-
"github.com/sliveryou/go-tool/id-generator/encoding/base58"
11-
"github.com/sliveryou/go-tool/id-generator/encoding/base62"
10+
"github.com/sliveryou/go-tool/v2/id-generator/encoding/base58"
11+
"github.com/sliveryou/go-tool/v2/id-generator/encoding/base62"
1212
)
1313

1414
func TestNewSnowflake(t *testing.T) {

id-generator/uuid/uuid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"log"
55
"strings"
66

7-
uuid "github.com/sliveryou/go-tool/id-generator/uuid/satori"
7+
uuid "github.com/sliveryou/go-tool/v2/id-generator/uuid/satori"
88
)
99

1010
// NextV1 generates v1 uuid.

mathx/mathx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/shopspring/decimal"
1010

11-
"github.com/sliveryou/go-tool/convert"
11+
"github.com/sliveryou/go-tool/v2/convert"
1212
)
1313

1414
// math package constants.

slicex/contain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package slicex
33
import (
44
"reflect"
55

6-
"github.com/sliveryou/go-tool/mathx"
6+
"github.com/sliveryou/go-tool/v2/mathx"
77
)
88

99
const (

0 commit comments

Comments
 (0)