From 02532e6f4d2c1db792feab9f8e282fea992c5c6c Mon Sep 17 00:00:00 2001 From: Weilin Shi <934587911@qq.com> Date: Wed, 25 Aug 2021 15:21:16 +0800 Subject: [PATCH] fix old code style --- captcha.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/captcha.go b/captcha.go index 56b3de4..9e87595 100644 --- a/captcha.go +++ b/captcha.go @@ -2,7 +2,6 @@ package captcha import ( - "bytes" _ "embed" // embed font "image" "image/color" @@ -119,12 +118,12 @@ func LoadFont(fontData []byte) error { // LoadFontFromReader load an external font from an io.Reader interface. func LoadFontFromReader(reader io.Reader) error { - var buf bytes.Buffer - if _, err := io.Copy(&buf, reader); err != nil { + b, err := io.ReadAll(reader) + if err != nil { return err } - return LoadFont(buf.Bytes()) + return LoadFont(b) } // New creates a new captcha.