要确定所有版本的依赖项,请尝试使用go list 工具 (List packages or modules)
例如(所有依赖版本的列表)
% cat go.mod
module github.com/hashicorp/consul
go 1.13
replace github.com/hashicorp/consul/api => ./api ?? replace ➡️ consul/api v1.8.0
replace github.com/hashicorp/consul/sdk => ./sdk ?? replace ➡️ consul/sdk v0.7.0
replace launchpad.net/gocheck => github.com/go-check/check v0.0.0-20140225173054-eb6ee6f84d0a
require (
github.com/Microsoft/go-winio v0.4.3 // indirect
github.com/NYTimes/gziphandler v1.0.1
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
github.com/armon/go-metrics v0.3.6
github.com/armon/go-radix v1.0.0
github.com/aws/aws-sdk-go v1.25.41
github.com/coredns/coredns v1.1.2
github.com/coreos/go-oidc v2.1.0+incompatible
github.com/digitalocean/godo v1.10.0 // indirect
github.com/docker/go-connections v0.3.0
github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0
github.com/envoyproxy/go-control-plane v0.9.5
github.com/frankban/quicktest v1.11.0 // indirect
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
github.com/golang/protobuf v1.3.5
github.com/google/go-cmp v0.5.2
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.2.0
github.com/google/tcpproxy v0.0.0-20180808230851-dfa16c61dad2
github.com/hashicorp/consul/api v1.8.0 ?? replace
github.com/hashicorp/consul/sdk v0.7.0 ?? replace
...
% go list -json -m -u all
{
"Path": "github.com/hashicorp/consul",
"Main": true,
"Dir": "/Users/a18388871/GoProjects/consul",
"GoMod": "/Users/a18388871/GoProjects/consul/go.mod",
"GoVersion": "1.13"
}
...
{
"Path": "github.com/grpc-ecosystem/grpc-gateway",
"Version": "v1.9.0",
"Time": "2019-05-14T09:07:28Z",
"Update": {
"Path": "github.com/grpc-ecosystem/grpc-gateway",
"Version": "v1.16.0",
"Time": "2020-10-28T10:29:51Z"
},
"Indirect": true,
"Dir": "/Users/a18388871/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.9.0",
"GoMod": "/Users/a18388871/go/pkg/mod/cache/download/github.com/grpc-ecosystem/grpc-gateway/@v/v1.9.0.mod"
}
{
"Path": "github.com/hashicorp/consul/api",
"Version": "v1.8.0",
"Replace": { ??. Replace field describes the replacement module, and its Dir field is set to the replacement's source code
"Path": "./api",
"Dir": "/Users/a18388871/GoProjects/consul/api",
"GoMod": "/Users/a18388871/GoProjects/consul/api/go.mod",
"GoVersion": "1.12"
},
"Update": { ??' The -u flag adds information about available upgrades'
"Path": "github.com/hashicorp/consul/api",
"Version": "v1.8.1",
"Time": "2020-12-10T20:49:49Z"
},
"Dir": "/Users/a18388871/GoProjects/consul/api",
"GoMod": "/Users/a18388871/GoProjects/consul/api/go.mod",
"GoVersion": "1.12"
}
...