Skip to content

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

@Bo0mer

Description

@Bo0mer

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions