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: Getting Started tutorial doesn't work with Go 1.16 #43672

Closed
FiloSottile opened this issue Jan 13, 2021 · 8 comments
Closed

x/website: Getting Started tutorial doesn't work with Go 1.16 #43672

FiloSottile opened this issue Jan 13, 2021 · 8 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@FiloSottile
Copy link
Contributor

FiloSottile commented Jan 13, 2021

The Getting Started tutorial relies on go run modifying the go.mod automatically, which is now deprecated.

hello.go:5:8: no required module provides package rsc.io/quote; try 'go mod tidy' to add it

The tutorial should instruct the user to run go get immediately before editing the code or go mod tidy after editing the code.

/cc @stevetraut

@gopherbot gopherbot added this to the Unreleased milestone Jan 13, 2021
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 13, 2021
@cagedmantis
Copy link
Contributor

/cc @dmitshur

@dmitshur
Copy link
Contributor

Issue #43430 is related. CC @jayconrod.

Based on the discussion there, I suspect we prefer suggesting go get over go mod tidy for the specific task of adding new dependencies. (go mod tidy is fine to use for other module management, like removing unused dependencies.)

@jayconrod
Copy link
Contributor

I think at tip we recommend go get instead of go mod tidy. In any case, the text will need to be updated.

I'll take a look soon after 1.16 release blockers are resolved.

@FiloSottile
Copy link
Contributor Author

I just noticed that starting in Go 1.16, go run . doesn't work without a module, too.

https://golang.org/cl/283635 replaced go run hello.go with go run ., so that part will break with Go 1.16 too. My suggestion would be to introduce a go mod init earlier, because I think modules is something every developer will encounter in the first hour, while the command-line-arguments package is not something they need to know about at all, and can only confuse them. Alternatively, the CL can be rolled back.

@gopherbot
Copy link

Change https://golang.org/cl/288277 mentions this issue: content: improve getting started document

@dmitshur dmitshur assigned oiooj and stevetraut and unassigned jayconrod Feb 8, 2021
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 8, 2021
@FiloSottile
Copy link
Contributor Author

FiloSottile commented Feb 11, 2021 via email

@jayconrod
Copy link
Contributor

go mod tidy is easier to use, but go get is more precise. Since this doc is targeted at new users, go mod tidy is probably a better choice. Either is fine though.

@stevetraut
Copy link

I've heard the two commands suggested interchangeably at times. I think we should decide what the contexts for recommending go get and go mod tidy are and stick with them in docs.

This is clearly a new user hunk of documentation. If go mod tidy is best for context, then we should keep it here. However, being the easiest doesn't necessarily make it the best practice (though the easiest should be the best practice for new users, IMO). We also should be about introducing the best practice commands for a given workflow.

@golang golang locked and limited conversation to collaborators Feb 11, 2022
@rsc rsc unassigned oiooj and stevetraut Jun 23, 2022
passionSeven added a commit to passionSeven/website that referenced this issue Oct 18, 2022
Improve the guidance document to adapt to the Go 1.16.

Fixes golang/go#43672

Change-Id: I443540591d032e05dbec951e2a4995f6dbc2bc77
Reviewed-on: https://go-review.googlesource.com/c/website/+/288277
Run-TryBot: Baokun Lee <bk@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Baokun Lee <bk@golangcn.org>
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

7 participants