刚入门一天的goer安装iris
原来看教程上都是用 go get 获取软件包。提示如下,意思是go get要被废弃了。
我的版本是,go version go1.20.4 windows/amd64
go get -u github.com/kataras/iris
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
https://go.dev/doc/go-get-install-deprecation
对这个问题的解释。
Starting in Go 1.17, installing executables with
go get
is deprecated.go install
may be used instead.
Why this is happening
Since modules were introduced, the
go get
command has been used both to update dependencies ingo.mod
and to install commands. This combination is frequently confusing and inconvenient: in most cases, developers want to update a dependency or install a command but not both at the same time.Since Go 1.16,
go install
can install a command at a version specified on the command line while ignoring thego.mod
file in the current directory (if one exists).go install
should now be used to install commands in most cases.
go get
’s ability to build and install commands is now deprecated, since that functionality is redundant withgo install
. Removing this functionality will makego get
faster, since it won’t compile or link packages by default.go get
also won’t report an error when updating a package that can’t be built for the current platform.See proposal #40276 for the full discussion.
换命令。iris官网教程。https://www.iris-go.com/docs/#/
$ go get github.com/kataras/iris/v12@latest 抛弃go get 换 go install 执行。
go install github.com/kataras/iris/v12@latest
go install github.com/kataras/iris@latest
go: github.com/kataras/iris@latest: module github.com/kataras/iris: Get "https://proxy.golang.org/github.com/kataras/iris/@v/list": dial tcp 142.251.43.17:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
无法访问。
更换国内源
go get更换国内镜像源
https://www.cnblogs.com/nanahome/p/17731680.html
翻越千山万水。终于快到达目的地了。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
2021-09-27 创投机构BP联系方式2