Skip to content

Drop driver's Executor.Exec first return value (which is empty)#936

Merged
brandur merged 1 commit into
masterfrom
brandur-drop-exec-return
May 28, 2025
Merged

Drop driver's Executor.Exec first return value (which is empty)#936
brandur merged 1 commit into
masterfrom
brandur-drop-exec-return

Conversation

@brandur

@brandur brandur commented May 28, 2025

Copy link
Copy Markdown
Contributor

Here, drop the first return value of the driver's Executor.Exec
function, which previously returned a struct{} in first position. When
I was first putting this all in, I figured it'd be better for consistency
if all driver functions returned exactly two values, even if one wasn't
really needed. Since then, we've picked up lots of driver functions that
return only an error, so that original premise doesn't hold anymore.

Returning only an error is advantageous in some cases because it lets
the return value be passed directly into functions. e.g.

require.NoError(t, exec.Exec(ctx, ...))

I've been meaning to make this change for a while, and it seems like a
good time now given we're going to be making lots of changes to the
driver interface for the next release anyway.

Here, drop the first return value of the driver's `Executor.Exec`
function, which previously returned a `struct{}` in first position. When
I was first putting this all in, I figured it'd be better for consistency
if all driver functions returned exactly two values, even if one wasn't
really needed. Since then, we've picked up lots of driver functions that
return only an error, so that original premise doesn't hold anymore.

Returning only an error is advantageous in some cases because it lets
the return value be passed directly into functions. e.g.

    require.NoError(t, exec.Exec(ctx, ...))

I've been meaning to make this change for a while, and it seems like a
good time now given we're going to be making lots of changes to the
driver interface for the next release anyway.
@brandur brandur requested a review from bgentry May 28, 2025 09:41
@brandur

brandur commented May 28, 2025

Copy link
Copy Markdown
Contributor Author

ty.

@brandur brandur merged commit 1c1c851 into master May 28, 2025
19 of 20 checks passed
@brandur brandur deleted the brandur-drop-exec-return branch May 28, 2025 14:50
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