nomad icon indicating copy to clipboard operation
nomad copied to clipboard

Annotate go mod replace statements

Open shoenig opened this issue 3 years ago • 2 comments
trafficstars

In the nomad go.mod file we have a set of replace directives to pin certain dependencies to an older version. For example, NYTimes/gziphandler made a breaking change where existing zipped data can not be unzipped with newer versions. We should link to an issue documenting why each dependency is stuck, and maybe look into whether any of them can be updated now.

github.com/Microsoft/go-winio

We depend on a fork https://github.com/hashicorp/nomad/pull/5864 with changes not in upstream

github.com/hashicorp/go-discover

Necessary because transitive dependencies also use replace directives for this module, and we want to avoid pulling in more than one version. Using replace in the top level go.mod overrides everything else.

github.com/hashicorp/hcl

Nomad still supports HCL v1, but the hcl repository has switched to v2 in the go.mod file

shoenig avatar Jan 12 '22 14:01 shoenig

@shoenig Regarding go-discover. Which dependency here uses replace? I grepped through but couldn't find any. The only thing that failed when removing the replace was consul via:

go: github.com/hashicorp/[email protected] requires
	github.com/hashicorp/[email protected] requires
	github.com/tencentcloud/[email protected]+incompatible: reading github.com/tencentcloud/tencentcloud-sdk-go/go.mod at revision v3.0.83: unknown revision v3.0.83

This should be solvable by updating consul to a newer library instead though.

apollo13 avatar Jan 14 '22 08:01 apollo13

I think you're right @apollo13, unfortunately updating consul isn't going to be straightforward since they split out autopilot to https://github.com/hashicorp/raft-autopilot

➜ go mod tidy
go: finding module for package github.com/hashicorp/consul/agent/consul/autopilot
github.com/hashicorp/nomad/command/agent imports
	github.com/hashicorp/consul/agent/consul/autopilot: module github.com/hashicorp/consul@latest found (v1.11.2), but does not contain package github.com/hashicorp/consul/agent/consul/autopilot

I suspect raft-autopilot only works with raft v3, and Nomad would have to drop support for raft v2 first.

shoenig avatar Jan 20 '22 18:01 shoenig

go-metrics cannot be upgraded to hashicorp/go-metrics until all dependencies that use armon/go-metrics are also updated (ref https://github.com/hashicorp/nomad/issues/19369).

This is the current list of dependencies using it:

$ go mod graph | grep ' github.com/armon/go-metrics'
github.com/hashicorp/nomad github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]
github.com/hashicorp/consul/[email protected] github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]
github.com/hashicorp/raft-boltdb/[email protected] github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]
github.com/hashicorp/[email protected] github.com/armon/[email protected]

lgfa29 avatar Dec 08 '23 00:12 lgfa29