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

Consider panicing (or similar) for functions without return values #15

Closed
stapelberg opened this issue Jan 3, 2018 · 3 comments · Fixed by #16
Closed

Consider panicing (or similar) for functions without return values #15

stapelberg opened this issue Jan 3, 2018 · 3 comments · Fixed by #16

Comments

@stapelberg
Copy link
Owner

Split out of #1

From @fatih:

func foo() {
	// I want to panic here
	bar()

}

func bar() error {
	return errors.New("foo")
}

When I call :GoExpandErr when my cursor is on bar()~ inside foo()` I got this error:

2017/12/28 18:04:49 current function returns no values, cannot return error

I think if there are no returns, it should default to panic(err.Error()) or something alike.

@stapelberg
Copy link
Owner Author

It’s not entirely clear to me whether we should panic, log.Fatal (which is what I prefer to use), or even make this configurable. Thoughts?

@fatih
Copy link

fatih commented Jan 13, 2018

It’s not entirely clear to me whether we should panic, log.Fatal (which is what I prefer to use), or even make this configurable. Thoughts?

Could this be a setting maybe that user can define? I'm not sure how feasible it would be, but worth trying it out.

@stapelberg
Copy link
Owner Author

I think we could allow users to specify a Go template expression.

This should be a reasonably easy task for newcomers to contribute to the project. Applied the help wanted label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants