Skip to content

Commit

Permalink
Update broken package
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 authored and trap-renovate[bot] committed May 8, 2024
1 parent 6d0f8f9 commit 8369db2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/disintegration/imaging v1.6.2
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a
github.com/elastic/go-elasticsearch/v8 v8.13.1
github.com/fivenp/go-identicon v0.0.0-20180326215656-a5b7d5ff972d
github.com/gavv/httpexpect/v2 v2.16.0
github.com/go-audio/audio v1.0.0
github.com/go-audio/wav v1.1.0
Expand All @@ -37,6 +36,7 @@ require (
github.com/labstack/echo/v4 v4.12.0
github.com/leandro-lugaresi/hub v1.1.1
github.com/lthibault/jitterbug/v2 v2.2.2
github.com/motoki317/go-identicon v0.0.1
github.com/motoki317/go-waveform v0.0.3
github.com/motoki317/sc v1.8.1
github.com/ncw/swift/v2 v2.0.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fivenp/go-identicon v0.0.0-20170128000056-5c327fb4e74a h1:nlaSiFY1VxmQqmmlHEVx5iUYTi2/1Q4utuuA1RxoHfk=
github.com/fivenp/go-identicon v0.0.0-20170128000056-5c327fb4e74a/go.mod h1:OP6goBndFDJFLA3iLwBZRqDKVvFJL7fsYaPa5HnIR0M=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
Expand Down Expand Up @@ -308,6 +306,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/motoki317/go-identicon v0.0.1 h1:PF14Gwx6Qu+fqR9KTMvmKzJCzV3WOwzpisgVxsJjihM=
github.com/motoki317/go-identicon v0.0.1/go.mod h1:c4MUzyFQAOv/N7KYiPjWHK5CkMR0PhxEpSrWGwCY+qs=
github.com/motoki317/go-waveform v0.0.3 h1:6efPqPi1VXRtFCIVworPclxzh0ysP2k9+5CwnEv56bg=
github.com/motoki317/go-waveform v0.0.3/go.mod h1:qvnSTo335eMOHcawLX9By5yNC+FQ1FFCHe5HkisfUTo=
github.com/motoki317/sc v1.8.1 h1:2WcCDvuqwbthjEXey/AMoOsTbsXsyh3b6NTpTzJON7g=
Expand Down
10 changes: 7 additions & 3 deletions service/file/manager_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package file
import (
"bytes"
"errors"
"github.com/stretchr/testify/require"
"image/png"
"io"
"testing"
Expand Down Expand Up @@ -96,7 +97,8 @@ func TestManagerImpl_Save(t *testing.T) {

data := []byte("test text file")
hash := "7e6d5d7ae4965bfecc6d818f76eb832b"
thumb := imaging2.GenerateIcon("test")
thumb, err := imaging2.GenerateIcon("test")
require.NoError(t, err)
args := SaveArgs{
FileName: "dummy.png",
FileSize: int64(len(data)),
Expand Down Expand Up @@ -160,7 +162,8 @@ func TestManagerImpl_Save(t *testing.T) {

data := []byte("test text file")
hash := "7e6d5d7ae4965bfecc6d818f76eb832b"
thumb := imaging2.GenerateIcon("test")
thumb, err := imaging2.GenerateIcon("test")
require.NoError(t, err)
args := SaveArgs{
FileName: "dummy.png",
FileSize: int64(len(data)),
Expand Down Expand Up @@ -226,7 +229,8 @@ func TestManagerImpl_Save(t *testing.T) {

data := []byte("test text file")
hash := "7e6d5d7ae4965bfecc6d818f76eb832b"
thumb := imaging2.GenerateIcon("test")
thumb, err := imaging2.GenerateIcon("test")
require.NoError(t, err)
args := SaveArgs{
FileName: "dummy.png",
FileSize: int64(len(data)),
Expand Down
5 changes: 4 additions & 1 deletion service/file/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import (
// 成功した場合、そのファイルのUUIDとnilを返します。
func GenerateIconFile(m Manager, salt string) (uuid.UUID, error) {
var img bytes.Buffer
icon := imaging.GenerateIcon(salt)
icon, err := imaging.GenerateIcon(salt)
if err != nil {
return uuid.Nil, err
}

if err := png.Encode(&img, icon); err != nil {
return uuid.Nil, err
Expand Down
8 changes: 4 additions & 4 deletions utils/imaging/icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package imaging
import (
"image"

"github.com/fivenp/go-identicon"
"github.com/motoki317/go-identicon"
)

const iconSize = 256

var iconSettings = qidenticon.DefaultSettings()
var iconSettings = identicon.DefaultSettings()

// GenerateIcon アイコン画像を生成します
func GenerateIcon(salt string) image.Image {
return qidenticon.Render(qidenticon.Code(salt), iconSize, iconSettings)
func GenerateIcon(salt string) (image.Image, error) {
return identicon.Render(identicon.Code(salt), iconSize, iconSettings)
}
10 changes: 7 additions & 3 deletions utils/imaging/icon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestGenerateIcon(t *testing.T) {
t.Parallel()

assert := assert.New(t)

icon1 := GenerateIcon("a")
icon2 := GenerateIcon("b")
icon3 := GenerateIcon("b")
icon1, err := GenerateIcon("a")
require.NoError(t, err)
icon2, err := GenerateIcon("b")
require.NoError(t, err)
icon3, err := GenerateIcon("b")
require.NoError(t, err)

if assert.NotNil(icon1) && assert.NotNil(icon2) && assert.NotNil(icon3) {
assert.NotEqual(icon1, icon2)
Expand Down

0 comments on commit 8369db2

Please sign in to comment.