From 3c87c57d969dad4d600e2df73cb4ce1e9dcbd7f4 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 25 Nov 2016 16:37:04 +0800 Subject: [PATCH] golint fixed for modules/avatar --- models/user.go | 2 +- modules/avatar/avatar.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/models/user.go b/models/user.go index e8c5c91680..6c0223e6ee 100644 --- a/models/user.go +++ b/models/user.go @@ -355,7 +355,7 @@ func (u *User) UploadAvatar(data []byte) error { return fmt.Errorf("Decode: %v", err) } - m := resize.Resize(avatar.AVATAR_SIZE, avatar.AVATAR_SIZE, img, resize.NearestNeighbor) + m := resize.Resize(avatar.AvatarSize, avatar.AvatarSize, img, resize.NearestNeighbor) sess := x.NewSession() defer sessionRelease(sess) diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go index a8c3826d15..f426978b32 100644 --- a/modules/avatar/avatar.go +++ b/modules/avatar/avatar.go @@ -14,9 +14,10 @@ import ( "github.com/issue9/identicon" ) -const AVATAR_SIZE = 290 +// AvatarSize returns avatar's size +const AvatarSize = 290 -// RandomImage generates and returns a random avatar image unique to input data +// RandomImageSize generates and returns a random avatar image unique to input data // in custom size (height and width). func RandomImageSize(size int, data []byte) (image.Image, error) { randExtent := len(palette.WebSafe) - 32 @@ -39,5 +40,5 @@ func RandomImageSize(size int, data []byte) (image.Image, error) { // RandomImage generates and returns a random avatar image unique to input data // in default size (height and width). func RandomImage(data []byte) (image.Image, error) { - return RandomImageSize(AVATAR_SIZE, data) + return RandomImageSize(AvatarSize, data) }