Skip to content

x/website: Executing transactions example has compilation error #51294

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

Closed
Bo0mer opened this issue Feb 21, 2022 · 1 comment
Closed

x/website: Executing transactions example has compilation error #51294

Bo0mer opened this issue Feb 21, 2022 · 1 comment

Comments

@Bo0mer
Copy link

Bo0mer commented Feb 21, 2022

What is the URL of the page with the issue?

https://go.dev/doc/database/execute-transactions

What is your user agent?

Should not matter.

[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36](https://developers.whatismybrowser.com/useragents/parse/?analyse-my-user-agent=yes)

Screenshot

Screenshot 2022-02-21 at 10 57 32

What did you do?

Tried to run the highlighted part of the example code:

    // Create a helper function for preparing failure results.
    fail := func(err error) (int64, error) {
        return fmt.Errorf("CreateOrder: %v", err)
    }

The code declares a function variable that should return two results (int64 and error), but the implementation returns only error. This leads to compilation error.

What did you expect to see?

I expected that the code would compile without any errors.

What did you see instead?

Compiling the code results in error:

./prog.go:10:3: not enough arguments to return
	have (error)
	want (int64, error)

I was not able to find where the code lives, otherwise I'd be happy to send a PR.

@gopherbot gopherbot added this to the Unreleased milestone Feb 21, 2022
@seankhliao
Copy link
Member

Duplicate of #50508

@seankhliao seankhliao marked this as a duplicate of #50508 Feb 21, 2022
@golang golang locked and limited conversation to collaborators Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants