Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ inject.FastInvoker = (*captchaInvoker)(nil)
// `func(flamego.Context, session.Session)`.
type captchaInvoker func(flamego.Context, session.Session)

func (invoke captchaInvoker) Invoke(args []interface{}) ([]reflect.Value, error) {
func (invoke captchaInvoker) Invoke(args []any) ([]reflect.Value, error) {
invoke(args[0].(flamego.Context), args[1].(session.Session))
return nil, nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/captchautil/captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Noise(complex Complexity) Option {
density = 8
}
maxSize := (img.height * img.width) / density
for i := 0; i < maxSize; i++ {
for range maxSize {
rw := r.Intn(img.width)
rh := r.Intn(img.height)
img.nrgba.Set(rw, rh, randomColor())
Expand Down Expand Up @@ -114,7 +114,7 @@ func TextNoise(complex Complexity) Option {
c.SetHinting(font.HintingFull)
rawFontSize := float64(img.height) / (1 + float64(r.Intn(7))/float64(10))

for i := 0; i < maxSize; i++ {
for range maxSize {
text, err := RandomText(1)
if err != nil {
return errors.Wrap(err, "TextNoise: get random text")
Expand Down Expand Up @@ -231,7 +231,7 @@ func Curve() Option {
}

py := float64(0)
for px := 0; px < end; px++ {
for px := range end {
if w != 0 {
py = float64(a)*math.Sin(w*float64(px)+f) + b + (float64(img.width) / float64(5))
i := img.height / 5
Expand Down
2 changes: 1 addition & 1 deletion internal/captchautil/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func RandomText(n int) (string, error) {

buffer := make([]byte, n)
max := big.NewInt(int64(len(alphanum)))
for i := 0; i < n; i++ {
for i := range n {
index, err := randomInt(max)
if err != nil {
return "", err
Expand Down
Loading