Skip to content

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

Closed
golang/website
#271

Description

@medkhabt

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!

Activity

  1. added this to the Unreleased milestone on Jun 6, 2023
  2. 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)[/+] on Jun 6, 2023
  3. dr2chase commented on Jun 6, 2023

    @dr2chase
    Contributor

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

  4. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jun 6, 2023
  5. ohmyfolly commented on Jun 18, 2023

    @ohmyfolly

    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.

  6. findleyr commented on Jun 21, 2023

    @findleyr
    Contributor
  7. fzipp commented on Aug 10, 2023

    @fzipp
    Contributor

    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.

  8. gopherbot commented on Aug 10, 2023

    @gopherbot
    Contributor

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

  9. ianlancetaylor commented on Aug 11, 2023

    @ianlancetaylor
    Contributor

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

  10. Jaculabilis commented on Sep 8, 2023

    @Jaculabilis

    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.

  11. leimao commented on Jan 18, 2024

    @leimao

    Why there is no version control for the tutorial?

  12. added 3 commits that reference this issue on Jan 24, 2024
    73cd837
    4d39ad9
    e4d2ee2
  13. gopherbot commented on Jan 24, 2024

    @gopherbot
    Contributor

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

  14. locked and limited conversation to collaborators on Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.website

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions