简体   繁体   English

如果其中一项要求不兼容,请在 go.mod 中获取最新版本

[英]Get latest version in go.mod if one of the requires is +incompatible

I have go.mod file, with require, one of them if github.com/mattermost/mattermost-server v5.11.1+incompatible but there is a new version of library in github, 5.17.1 .我有 go.mod 文件,需要,如果github.com/mattermost/mattermost-server v5.11.1+incompatible是其中之一,但 github 中有一个新版本的库, 5.17.1

I download latest version and work with it, but when i run go mod init my go.mod contains 5.11.1+incompatible version.我下载了最新版本并使用它,但是当我运行go mod init我的 go.mod 包含 5.11.1+ 5.11.1+incompatible版本。

How do I configure the go.mod files to use the latest version ?如何配置 go.mod 文件以使用最新版本?

在go.mod中使用replace

replace github.com/mattermost/mattermost-server v5.11.1+incompatible => github.com/mattermost/mattermost-server v5.17.1

First of all prune the no-more-necessart dependencies using go mod tidy .首先,使用go mod tidy修剪 no-more-necessart 依赖项。 Now, update all direct and indirect packages to the latest (minor) version with go get -u ./... where the go.mod file is located.现在,使用go get -u ./...将所有直接和间接包更新到最新(次要)版本,其中go.mod文件所在的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM