kubernetes / kubernetes/kube-openapi

The model name file should use pointer receiver

Open
#637 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
356
Forks
249
Avg merge
1d 15h
Merged PRs (30d)
3

Description

Currently, the generated model name file contains value receiver:

```go
func (in Foo) OpenFooName() string {
return "com.example.Foo"
}
```

Meanwhile, deepcopy-gen generates pointer receiver functions like:

```go
func (in *Foo) DeepCopyInto(out *Foo) {
...
}
```

Go spec allows mixing value and pointe receiver functions, but it might introduce subtle bugs.
[recvcheck](https://github.com/raeperd/recvcheck) linter will flag them.

Could you please generate a model name file with pointer receiver?
If the backward compatibility is required, it would be nice to gate this feature behind the flag.

Thank you.

Contributor guide

Open the contributing guide

Research direction

Start by locating the generator that writes the model name file and compare its receiver generation with the pointer receivers produced by deepcopy-gen. Check any existing generator tests or generated fixtures. Done means generated model name methods use pointer receivers, with a compatibility flag only if the existing API requires it.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.