Skip to content

Commit

Permalink
chore: 更新 assert 至 v4
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Feb 28, 2024
1 parent faebd88 commit 32da43a
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 219 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go: ['1.17.x', '1.20.x']
go: ['1.17.x', '1.22.x']

steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go
Expand Down
4 changes: 3 additions & 1 deletion bench_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2015-2024 caixw
//
// SPDX-License-Identifier: MIT

package identicon
Expand All @@ -7,7 +9,7 @@ import (
"testing"
"time"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

func BenchmarkMake(b *testing.B) {
Expand Down
36 changes: 20 additions & 16 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2015-2024 caixw
//
// SPDX-License-Identifier: MIT

// Package identicon 一个基于 hash 值生成随机图像的包
Expand All @@ -12,13 +14,15 @@
// style1
//
// 在 style1 中,把图像分成以下九个部分:
// -------------
// | 1 | 2 | 3 |
// -------------
// | 4 | 5 | 6 |
// -------------
// | 7 | 8 | 9 |
// -------------
//
// -------------
// | 1 | 2 | 3 |
// -------------
// | 4 | 5 | 6 |
// -------------
// | 7 | 8 | 9 |
// -------------
//
// 其中 1、3、9、7 为不同角度(依次增加 90 度)的同一张图片,
// 2、6、8、4 也是如此,这样可以保持图像是对称的,比较美观。
// 5 则单独使用一张图片。
Expand All @@ -28,16 +32,16 @@
// 将用户内容计算出 32 位的 hash 值,以 4 bit 为一行,
// 值为 1 表示有前景色,为 0 表示没有背景色,同时镜像到右边。
//
// // 根据用户访问的 IP ,为其生成一张头像
// img := identicon.Make(Style2, 128, color.NRGBA{},color.NRGBA{}, []byte("192.168.1.1"))
// fi, _ := os.Create("/tmp/u1.png")
// png.Encode(fi, img)
// fi.Close()
// // 根据用户访问的 IP ,为其生成一张头像
// img := identicon.Make(Style2, 128, color.NRGBA{},color.NRGBA{}, []byte("192.168.1.1"))
// fi, _ := os.Create("/tmp/u1.png")
// png.Encode(fi, img)
// fi.Close()
//
// // 或者
// ii := identicon.New(Style1, 128, color.NRGBA{}, color.NRGBA{}, color.NRGBA{})
// img := ii.Make([]byte("192.168.1.1"))
// img = ii.Make([]byte("192.168.1.2"))
// // 或者
// ii := identicon.New(Style1, 128, color.NRGBA{}, color.NRGBA{}, color.NRGBA{})
// img := ii.Make([]byte("192.168.1.1"))
// img = ii.Make([]byte("192.168.1.2"))
//
// NOTE: go test 会在当前目录的 testdata 文件夹下产生大量的随机图片。
// 要运行测试,必须保证该文件夹是存在的,且有相应的写入权限。
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/issue9/identicon/v2

require github.com/issue9/assert/v3 v3.0.4
require github.com/issue9/assert/v4 v4.1.1

go 1.17
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/issue9/assert/v3 v3.0.4 h1:WsYZQ6PQmM/pGFrbkn5GIXjWeVZHv+wcl2829UTX1Qc=
github.com/issue9/assert/v3 v3.0.4/go.mod h1:yft/uaskRpwQTyBT3n1zRl91SR1wNlO4fLZHzOa4bdM=
github.com/issue9/assert/v4 v4.1.1 h1:OhPE8SB8n/qZCNGLQa+6MQtr/B3oON0JAVj68k8jJlc=
github.com/issue9/assert/v4 v4.1.1/go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4=
2 changes: 2 additions & 0 deletions identicon.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2015-2024 caixw
//
// SPDX-License-Identifier: MIT

package identicon
Expand Down
4 changes: 3 additions & 1 deletion identicon_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2015-2024 caixw
//
// SPDX-License-Identifier: MIT

package identicon
Expand All @@ -11,7 +13,7 @@ import (
"testing"
"time"

"github.com/issue9/assert/v3"
"github.com/issue9/assert/v4"
)

var (
Expand Down
Loading

0 comments on commit 32da43a

Please sign in to comment.