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

remove unnecessary error return type after using log.Fatalf() #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaanburaksener
Copy link

NewAdapter(driverName, dataSourceName string) function has only one return statement located at the end of the body, it always returns nil for error, and two error cases were covered by calling log.Fatalf() so we can remove the error type from the method signature along with the places we call NewAdapter() method as a small clean up.

@kantancoding
Copy link
Owner

@kaanburaksener Good catch! I'm wondering if it might be better to just return the error instead of calling os.Exit(1) within the factory function. That way we aren't delegating the control of application termination away from main.go. What do you think?

@kaanburaksener
Copy link
Author

kaanburaksener commented Jan 9, 2022

@selikapro Sounds good to me as well. On the other hand, I see the usage of log.Fatalf() in some other places (like in Run() method in server.go) as well so if you would like to delegate the termination of the app to main.go, then you should introduce this change in the whole repo.

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