deps: fixes dep issue w/ gnmic/pkg/api#788
Merged
karimra merged 1 commit intoopenconfig:mainfrom Jan 25, 2026
Merged
Conversation
**Problem** `openconfig/gnmic` v0.40.0 and newer rely on `openconfig/gnmic/pkg/api` v0.1.**9** however the go.mod file for the former modules specifies `openconfig/gnmic/pkg/api` v0.1.**8**. As such, if you try to build gnmic without the replace directives it fails. I tripped on this because we have a wrapper around gnmic that pulls in the `openconfig/gnmic` module as a **dependency** rather than building in repo; as such the replace directives are not processed. **Repro** To reproduce this one can simply remove the `replace` directives in the go.mod file, run `go mod tidy`, and then run `go build`; at which point you will be met with the following error: ``` ❯ go build pkg/app/api.go:105:14: tc.DeepCopy undefined (type *"github.com/openconfig/gnmic/pkg/api/types".TargetConfig has no field or method DeepCopy) pkg/app/api.go:117:11: t.DeepCopy undefined (type *"github.com/openconfig/gnmic/pkg/api/types".TargetConfig has no field or method DeepCopy) pkg/app/api.go:242:11: t.DeepCopy undefined (type *"github.com/openconfig/gnmic/pkg/api/types".TargetConfig has no field or method DeepCopy) ``` **Root Cause** openconfig#556 introduced a new `DeepCopy` method on a type in the `gnmic/pkg/api` module and then consumed that method in the `gnmic` module. While a gnmic/pkg/api v0.1.9 was cut, the go.mod file for the `gnmic` module was never updated. My guess is this was never detected because we leverage replace directives for local dev. To prevent issues like this in the future we may want to consider using Go Workspaces for dev instead of replace directives.
karimra
approved these changes
Jan 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
openconfig/gnmicv0.40.0 and newer rely onopenconfig/gnmic/pkg/apiv0.1.9 however the go.mod file for the former modules specifiesopenconfig/gnmic/pkg/apiv0.1.8.As such, if you try to build gnmic without the replace directives it fails.
I tripped on this because we have a wrapper around gnmic that pulls in the
openconfig/gnmicmodule as a dependency rather than building in repo; as such the replace directives are not processed.Repro
To reproduce this one can simply remove the
replacedirectives in the go.mod file, rungo mod tidy, and then rungo build; at which point you will be met with the following error:Root Cause
#556 introduced a new
DeepCopymethod on a type in thegnmic/pkg/apimodule and then consumed that method in thegnmicmodule.While a gnmic/pkg/api v0.1.9 was cut, the go.mod file for the
gnmicmodule was never updated. My guess is this was never detected because we leverage replace directives for local dev.To prevent issues like this in the future we may want to consider using Go Workspaces for dev instead of replace directives.