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/website: Tutorial contains stale code/advice (no need to seed rand anymore) #60627

Closed
medkhabt opened this issue Jun 6, 2023 · 9 comments · May be fixed by golang/website#271
Closed

x/website: Tutorial contains stale code/advice (no need to seed rand anymore) #60627

medkhabt opened this issue Jun 6, 2023 · 9 comments · May be fixed by golang/website#271
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. website

Comments

@medkhabt
Copy link

medkhabt commented Jun 6, 2023

What is the URL of the page with the issue?

https://go.dev/doc/tutorial/random-greeting

What is your user agent?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Screenshot

Bildschirmfoto 2023-06-06 um 11 45 42

What did you do?

--

What did you expect to see?

I expect to not see that paragraph. I assumed that there was an init() function for older versions of the code but forgot to change also the paragraph that explains the code.
Or maybe I am missing something about the language, I am new to GO.

What did you see instead?

The paragraph inside the blue border of the screenshot.

Have a great day!

@gopherbot gopherbot added this to the Unreleased milestone Jun 6, 2023
@dr2chase dr2chase changed the title x/website: Paragraph with older version of the code. x/website: Tutorial contains stale code/advice (no need to seed rand anymore) Jun 6, 2023
@dr2chase
Copy link
Contributor

dr2chase commented Jun 6, 2023

@golang/tools-team
Looks like an issue to me, too.

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 6, 2023
@jexlock
Copy link

jexlock commented Jun 18, 2023

I think it would be worth adding additional context rather than completely removing. I happened to be working through this example with go1.19.5 which seems to not init() the rand function, and as such had some mild confusion when my code matched but the output did not (fixed by adding a seed the example code did not have).

Installing 1.20.5 seems to have solved the seed issue, but I think for newer users it may be nice to have this section call out the change of functionality from version X to version X and that older versions require manual init seeding.

@findleyr
Copy link
Member

CC @ansaba

@fzipp
Copy link
Contributor

fzipp commented Aug 10, 2023

Can anything be done about this? Every single developer who starts learning Go from the official website has had a frustrating experience right from the start for the last months, because the tutorial is broken. Every week someone creates a new issue.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/518475 mentions this issue: _content/doc/tutorial: remove outdated paragraph about seeding the rand package

@ianlancetaylor
Copy link
Member

I think this was fixed by https://go.dev/cl/507096. Sorry for the delay.

@Jaculabilis
Copy link

I would like to echo @jexlock's sentiment. I started going through the tutorial on a Linux Mint machine, and the Go version I get from sudo apt install golang is 1.18.1. It would be helpful to at least have a note that this requires 1.20, or that users below 1.20 may need to add additional code to get the example to work. Removing any mention of init entirely just makes the subsequent un-seeded behavior even more mysterious.

@leimao
Copy link

leimao commented Jan 18, 2024

Why there is no version control for the tutorial?

leimao added a commit to leimao/website that referenced this issue Jan 24, 2024
leimao added a commit to leimao/website that referenced this issue Jan 24, 2024
leimao added a commit to leimao/website that referenced this issue Jan 24, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/557795 mentions this issue: _content/doc/tutorial: add version prerequisite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants