Skip to content

Dependency conflict: github.com/armon/go-metrics vs github.com/hashicorp/go-metrics breaks downstream imports #22838

@dharmil-iv

Description

@dharmil-iv

Overview of the Issue

The Consul repository imports github.com/armon/go-metrics, which has been renamed and moved to github.com/hashicorp/go-metrics. This causes conflicts and import issues downstream, especially when other dependencies require the new import path (hashicorp/go-metrics). For example, when integrating Consul with other libraries, Go's module system encounters ambiguities and requires manual replace directives, which do not always fully resolve the issues.

This breaks importing libraries such as github.com/mennanov/limiters. Attempting to import this library fails due to the conflicting metric library dependencies.

Reproduction Steps

  1. Create a new Go project.
  2. Run the following command:
go get github.com/mennanov/[email protected]
  1. Observe the following error:
go: github.com/mennanov/limiters imports
        github.com/hashicorp/consul/api imports
        github.com/hashicorp/serf/coordinate imports
        github.com/hashicorp/go-metrics/compat imports
        github.com/armon/go-metrics: github.com/armon/[email protected]: parsing go.mod:
        module declares its path as: github.com/hashicorp/go-metrics
                but was required as: github.com/armon/go-metrics

Consul info for both Client and Server

N/A (problem is with module resolution, not a running agent)

Operating system and Environment details

  • Go version: (reproducible with Go 1.21+)
  • Any OS/Arch

Log Fragments

N/A

Notes

  • The problem arises from a mismatch between github.com/armon/go-metrics and github.com/hashicorp/go-metrics in the dependency tree.
  • Because of this, limiters cannot be imported without manual fixes.

Request

Could this dependency be updated or fixed in Consul?
Any guidance on a workaround would be very helpful.


Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions