无法安装gin-gonic:c.engine.AppEngine未定义(类型*Engine没有字段或方法AppEngine)

huangapple go评论80阅读模式
英文:

Can't install gin-gonic: c.engine.AppEngine undefined (type *Engine has no field or method AppEngine)

问题

我无法为我的 Golang 项目安装 gin-gonic。我尝试重新安装 Go,重置 bash 文件,删除并重新创建项目文件夹,并在 Google 上搜索错误关键字,但没有找到任何解决方法。

以下是我的终端消息:

$ go get -u github.com/gin-gonic/gin
# github.com/gin-gonic/gin
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\context.go:735:13: c.engine.AppEngine undefined (type *Engine has no field or method AppEngine)
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:154:3: unknown field 'UseRawPath' in struct literal of type Engine
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:156:3: unknown field 'UnescapePathValues' in struct literal of type Engine
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:508:11: engine.UseRawPath undefined (type *Engine has no field or method UseRawPath)
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:510:20: engine.UnescapePathValues undefined (type *Engine has no field or method UnescapePathValues)
英文:

I can't install gin-gonic for my golang project. I tried reinstalling go, resetting the bash files, delete and recreate the project folder, and searched the error as keyword on google, but found nothing

Here are my terminal messages:

$ go get -u github.com/gin-gonic/gin
# github.com/gin-gonic/gin
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\context.go:735:13: c.engine.AppEngine undefined (type *Engine has no field or method AppEngine)
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:154:3: unknown field 'UseRawPath' in struct literal of type Engine
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:156:3: unknown field 'UnescapePathValues' in struct literal of type Engine
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:508:11: engine.UseRawPath undefined (type *Engine has no field or method UseRawPath)
..\..\..\..\go\pkg\mod\github.com\gin-gonic\gin@v1.7.5\gin.go:510:20: engine.UnescapePathValues undefined (type *Engine has no field or method UnescapePathValues)

答案1

得分: 3

我降级到了v1.7.2,一切都正常工作了。请查看https://github.com/gin-gonic/gin/issues/2948。

英文:

I downgraded to v1.7.2 and everything worked well. Take a look at https://github.com/gin-gonic/gin/issues/2948

答案2

得分: 0

我在使用gin@v1.7.5时也遇到了同样的问题,所以我降级到了gin@v1.7.4,然后问题解决了。

英文:

I have the same problem when using gin@v1.7.5, so I downgrade to gin@v1.7.4, and it works well

答案3

得分: -1

我遇到了同样的问题,但我在Ubuntu上使用root权限解决了它。同样地,使用"以管理员身份运行"可能会有帮助。

英文:

I had the same problem. but I resolve it with root on ubuntu. Similarly, It'd be good to execute with "run as administrator"

huangapple
  • 本文由 发表于 2021年11月21日 22:12:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/70055303.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定