Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

导入captcha时报错 #905

Open
clingfei opened this issue Jan 25, 2021 · 1 comment
Open

导入captcha时报错 #905

clingfei opened this issue Jan 25, 2021 · 1 comment

Comments

@clingfei
Copy link

import(
"crypto/md5"
"fmt"
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/core/validation"
beego "github.com/beego/beego/v2/server/web"
"log"
"github.com/astaxie/beego/cache"
captcha2 "github.com/astaxie/beego/utils/captcha"

func init() {
// use beego cache system store the captcha data
store := cache.NewMemoryCache()
cpt = captcha2.NewWithFilter("/captcha/", store)
}

会出现以下错误:
./Netdisk flag redefined: graceful
panic: ./Netdisk flag redefined: graceful

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc000172660, 0xee0f40, 0x14d5188, 0xdaa5ef, 0x8, 0xdc1691, 0x21)
/usr/lib/go-1.13/src/flag/flag.go:848 +0x4ae
flag.BoolVar(...)
/usr/lib/go-1.13/src/flag/flag.go:627

似乎是因为在flag.go和grace.go中重复定义了flag变量,但这两个变量是依赖包中所定义的,请问应当如何解决?

@flycash
Copy link
Collaborator

flycash commented Jan 27, 2021

你不能使用"github.com/astaxie/beego/cache"。你应该用"github.com/beego/beego/server/web/filter/cacha"。大概是在这个位置。
你这里是v1.x和v2.x混用,会有很多问题。我建议你直接删掉github.com/astaxie/beego依赖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants