fix old code style
This commit is contained in:
parent
ba2a083ab6
commit
02532e6f4d
|
@ -2,7 +2,6 @@
|
||||||
package captcha
|
package captcha
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
_ "embed" // embed font
|
_ "embed" // embed font
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
@ -119,12 +118,12 @@ func LoadFont(fontData []byte) error {
|
||||||
|
|
||||||
// LoadFontFromReader load an external font from an io.Reader interface.
|
// LoadFontFromReader load an external font from an io.Reader interface.
|
||||||
func LoadFontFromReader(reader io.Reader) error {
|
func LoadFontFromReader(reader io.Reader) error {
|
||||||
var buf bytes.Buffer
|
b, err := io.ReadAll(reader)
|
||||||
if _, err := io.Copy(&buf, reader); err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoadFont(buf.Bytes())
|
return LoadFont(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new captcha.
|
// New creates a new captcha.
|
||||||
|
|
Reference in New Issue