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

database/sql: CreateOrder example doesn't compile #50508

Open
imballinst opened this issue Jan 8, 2022 · 2 comments
Open

database/sql: CreateOrder example doesn't compile #50508

imballinst opened this issue Jan 8, 2022 · 2 comments
Labels
Documentation NeedsFix

Comments

@imballinst
Copy link

@imballinst imballinst commented Jan 8, 2022

What is the URL of the page with the issue?

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

What is your user agent?

Firefox 94.0 (64-bit)

Screenshot

The fail function (below the marked comment), expects 2 return values. However, the function only returns fmt.Errorf(...).

image

What did you do?

I copy-pasted the code to my IDE (VS Code) and got an error (the return line was marked with a red line).

What did you expect to see?

There should be no error in the copy-pasted function. It should return, maybe, 0, fmt.Errorf(...)?

What did you see instead?

Error during compilation.

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

I'm new to Go, so please let me know if I did something wrong instead. Thanks!

@gopherbot gopherbot added this to the pkgsite/unplanned milestone Jan 8, 2022
@seankhliao seankhliao changed the title x/pkgsite: getting wrong number of return values (want 2, got 1) in "Executing Transactions" from fail function database/sql: CreateOrder example doesn't compile Jan 8, 2022
@seankhliao seankhliao added Documentation NeedsFix and removed pkgsite labels Jan 8, 2022
@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jan 8, 2022

Thank you for filing this bug @imballinst and welcome to the Go project! Thank you @seankhliao for the triage. Happy New Year y'all!

@willpoint is going to send a CL shortly to fix this.

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 9, 2022

Change https://golang.org/cl/376974 mentions this issue: _content/doc: ensure database example code compiles

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

No branches or pull requests

4 participants