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

x/pkgsite: CreateOrder example on go.dev/doc/database/execute-transactions page doesn't compile #50508

Closed
imballinst opened this issue Jan 8, 2022 · 3 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.

Comments

@imballinst
Copy link

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 The path to resolution is known, but the work has not been done. and removed pkgsite labels Jan 8, 2022
@odeke-em
Copy link
Member

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
Contributor

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

@dharmit
Copy link

dharmit commented Mar 24, 2023

@odeke-em well the PR looks good (or could've used orderID instead of 0 - no big deal). Could someone with enough rights help merge it so that the example isn't broken any more?

@dmitshur dmitshur changed the title database/sql: CreateOrder example doesn't compile x/pkgsite: CreateOrder example on go.dev/doc/database/execute-transactions page doesn't compile Mar 24, 2023
@golang golang locked and limited conversation to collaborators Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants