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

Update cli providers package according to golang conventions #3926

Open
bilge-cakmak opened this issue Nov 9, 2022 · 0 comments
Open

Update cli providers package according to golang conventions #3926

bilge-cakmak opened this issue Nov 9, 2022 · 0 comments

Comments

@bilge-cakmak
Copy link
Contributor

According to #PR3904reviews the cli/pkg/providers/provider.go package's Provider interface needs to be improved. And the changes should be reflected on cli/pkg/providers/provider_name_here.

Recommendations are below:

All providers' go files has this function below. It is always better to return a struct and not a pointer specially when the struct only contains pointers

func New(w io.Writer, analytics *console.AiryAnalytics) *provider {
	return &provider{
		w:         w,
		analytics: *analytics,
	}
}

For Provision() function:

  • console.Exit will kill the process, so in case of error this function will never return. those error is always nil. in this case there is golang convention for this.
    The function should not return a value, and it is better if you call it MustProvision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant