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

Allow enable on constructors like NewXXX #74

Open
pengubco opened this issue Sep 29, 2023 · 0 comments
Open

Allow enable on constructors like NewXXX #74

pengubco opened this issue Sep 29, 2023 · 0 comments

Comments

@pengubco
Copy link

I ran into some nil pointer bug which was caused by pattern like this.

func NewXXX(client Client, x X,  y Y) *A {
 return &A{
   x: x,   
   y: y 
 }
}  

The nil pointer was from code r.client.Foo(). That leads me to unparam which could've have reported I forgot to set client.
However, unparam recommended to rurn off -exported. I wonder whether we can turn on just those constructors like NewxXX.
How do you think?

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

No branches or pull requests

1 participant