Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unexported type cli from documentation in pkg.go.dev #2078

Closed
Adirio opened this issue Mar 10, 2021 · 0 comments · Fixed by #2079
Closed

Removing unexported type cli from documentation in pkg.go.dev #2078

Adirio opened this issue Mar 10, 2021 · 0 comments · Fixed by #2079
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@Adirio
Copy link
Contributor

Adirio commented Mar 10, 2021

Official Go documentation is showing an unexported type *cli: https://pkg.go.dev/sigs.k8s.io/kubebuilder/v3@v3.0.0-beta.0/pkg/cli#Option

Note: WithCompletion also shows this type but it has already been fixed by #2045, once a new release is pushed it will be reflected in pkg.go.dev. However, the solution for this issue would also fix that in case it wasn't fixed already.

Unexported types should not be visible from the outside at all.

There are two possible approaches to solve this:
1- Remove the CLI interface and export cli as CLI (Option will be func(*CLI) error).
2- Change Option to func(CLI) error and type-cast to *cli inside every Option.

I personally don't see any reason to have cli unexported and exposed by an interface as all the fields and methods are unexported except for Run. So I think that the first approach is the less intrusive. The second approach requires to take into account the type-cast every time we create a new Option.

The only scenario where the CLI interface would make sense would be if we wanted to have different implementations, which is something that we haven't planned for now AFAIK.

@Adirio Adirio added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant