- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我想让我的 go.mod
依赖项保持最新。使用 Node.js,我运行 npm outdated
(以及后来的 npm update
)。
Go mod 最接近的是什么?
理想情况下,我会看到一份关于我的项目的过时依赖项的报告(并非全部递归)。谢谢
最佳答案
这在 Go 1.11 Modules: How to Upgrade and Downgrade Dependencies 中有详细说明维基:
To view available minor and patch upgrades for all direct and indirect dependencies, run
go list -u -m all
.To upgrade to the latest version for all direct and indirect dependencies of the current module:
- run
go get -u
to use the latest minor or patch releases- run
go get -u=patch
to use the latest patch releases
您可以在此处阅读更多详细信息:Command go: List packages or modules .
还有一个第三方应用程序:https://github.com/psampaz/go-mod-outdated :
An easy way to find outdated dependencies of your Go projects. go-mod-outdated provides a table view of the go list -u -m -json all command which lists all dependencies of a Go project and their available minor and patch updates. It also provides a way to filter indirect dependencies and dependencies without updates.
如果你对间接依赖不感兴趣,我们可以过滤掉。没有用于过滤掉间接依赖项的标志,但我们可以使用自定义输出格式来做到这一点。
The
-f
flag specifies an alternate format for the list, using the syntax of package template.
所以你可以指定一个格式作为模板文档,符合text/template
.
When listing modules, the
-f
flag still specifies a format template applied to a Go struct, but now aModule
struct:type Module struct {
Path string // module path
Version string // module version
Versions []string // available module versions (with -versions)
Replace *Module // replaced by this module
Time *time.Time // time version was created
Update *Module // available update, if any (with -u)
Main bool // is this the main module?
Indirect bool // is this module only an indirect dependency of main module?
Dir string // directory holding files for this module, if any
GoMod string // path to go.mod file for this module, if any
Error *ModuleError // error loading module
}
type ModuleError struct {
Err string // the error itself
}
注意:这个 Module
结构是在命令 go 的内部包中定义的:https://godoc.org/cmd/go/internal/modinfo
因此,例如像以前一样列出直接和间接依赖关系,但现在还在间接依赖关系之后附加一个 IAMINDIRECT
词,可以这样完成:
go list -u -m -f '{{.}}{{if .Indirect}} IAMINDIRECT{{end}}' all
否定逻辑,列出直接和间接依赖关系,但这次只用IAMDRECT
“标记”直接依赖关系:
go list -u -m -f '{{.}}{{if not .Indirect}} IAMDIRECT{{end}}' all
我们快到了。我们现在只需要过滤掉不包含 IAMDRECT
单词的行:
go list -u -m -f '{{.}}{{if not .Indirect}} IAMDIRECT{{end}}' all | grep IAMDIRECT
上述解决方案基于 grep
命令。但实际上我们并不需要那样。如果指定的模板生成空文档,则从输出中跳过该行。
所以我们可以这样实现:
go list -u -m -f '{{if not .Indirect}}{{.}}{{end}}' all
基本上,如果不是间接的,我们只调用 Module.String()
(我们只包含一个依赖项)。作为额外的收获,此解决方案也适用于 Windows。
与我们过滤掉间接依赖的方式类似,这也是“小菜一碟”,因为 Module
结构包含一个 Update
字段,用于有更新的包/模块:
go list -u -m -f '{{if .Update}}{{.}}{{end}}' all
关于go - 什么是 npm-outdated 的 Go(mod)等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55866604/
嗨,我已经开始学习一些有关文件指针以及如何打开文件等的知识。我正在阅读 Stephen Prata 所著的《C Primer Plus 第五版》(SamsPublishing)我什至无法获得他们在我的
当我运行“npm outdated”时,它没有显示“最新”的任何内容。所有 @Angular 包都应该有至少 4.4.6 的最新版本,我预计大多数其他包也应该有更新的版本。 “当前”下列出的内容是我的
我已经为我的项目执行了“pod outdated”。这是输出: Analyzing dependencies The following pod updates are available: - Ki
当我运行“npm outdated”时,它没有显示“最新”的任何内容。所有 @Angular 包都应该有至少 4.4.6 的最新版本,我预计大多数其他包也应该有更新的版本。 “当前”下列出的内容是我的
我有一个巨大的对象列表,每个对象都包含许多图像。我想使用延迟加载来部分获取它们。我想了解如何使用 LazyDataModel 及其工作原理。 最初我认为我必须在 LazyDataModel 中仅保存可
我正在主干上创建一个补丁,将它应用到另一个分支时,出现“补丁似乎已过时”错误。我没有在 Google 上找到解决方案。主干刚刚合并到分支。 我在 Windows 7 上使用 64 位 Tortoise
我已经寻找解决方案,但找不到任何适合我的具体问题的内容,并且无法自行对其进行排序,我尝试的查询太繁重,导致我的服务器超时。 我有一个像这样的表“事件”: +-----------+----------
我在我的 package.json 文件中的 devDependencies 中指定了版本 7.3.0 中的 babelify,如下所示: "devDependencies": { ...,
我们的用例: 对于表 USERS: 更新所有行(为列 ACTIVE 设置值 'N')以防用户处于非事件状态(列 'LAST_VISIT') 60 分钟。 Google 帮助我找到了如何在数据库中获取当
我当前的项目中没有使用 kotlin,但总是显示以下警告: 当我点击“更新运行时”将显示以下弹出窗口: 这里是我使用的依赖项: 有人知道如何解决这个谷歌技巧吗? **编辑 这是 Android Stu
我想保留我的 build.gradle依赖关系是最新的。使用 Node.js,我运行 npm outdated (以及后来的 npm update )。 最接近 Gradle 的是什么? I don'
在图谱 API 文档中,以下内容位于新闻提要端点旁边的括号中: this is an outdated view, does not reflect the News Feed on facebook
我是 ant 的新手,而且更习惯 Makefile。在一个项目中,名为 Message_zh.class 等的 i18n 语言模块是在每次编译时无条件地从 zh.po 等构建的,尽管它们已经存在,这浪
我有一个带有 Gemfile 的文件夹,我可以用 bundle lock 生成 Gemfile.lock,我想通过 bundle outdated 获取可用的更新 但不需要在我的系统上安装 Gemfi
我怎么解决这个问题? 我将smartgit/hg用于svn存储库,它始终有效,并且只有一个中继。现在,我在其中启动了另一个分支,并使用“Cherry-pic”出现了这个问题: Executing a
我正在使用 Azure 静态 Web 应用来托管我的 React 网站。 我一直面临下面的错误。 yarn run v1.22.10 $ react-scripts build Creating an
我正在使用 Azure 静态 Web 应用来托管我的 React 网站。 我一直面临下面的错误。 yarn run v1.22.10 $ react-scripts build Creating an
使用具有以下内容的package.json文件 "devDependencies": { "grunt": "^0.4.5", "grunt-concurrent": "^1.0.0"
当我输入 npm outdated 时,它会显示类似于 的内容 Package Current Wanted Latest Location columnify 1.1
我正在尝试更新我的 pod,我通过 列出了 pod 更新 pod outdated podfile(此外,我什至尝试在 podfile 中输出 'Firebase/Auth', '6.3.1' 来指定
我是一名优秀的程序员,十分优秀!