Skip to content

deps: fixes dep issue w/ gnmic/pkg/api#788

Merged
karimra merged 1 commit intoopenconfig:mainfrom
sgg:sgg/fix-deps
Jan 25, 2026
Merged

deps: fixes dep issue w/ gnmic/pkg/api#788
karimra merged 1 commit intoopenconfig:mainfrom
sgg:sgg/fix-deps

Conversation

@sgg
Copy link
Copy Markdown
Contributor

@sgg sgg commented Jan 7, 2026

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

#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.

**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 karimra merged commit c55b298 into openconfig:main Jan 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants