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: various mistakes in documentation on modules #44241

Closed
fzipp opened this issue Feb 12, 2021 · 10 comments
Closed

x/website: various mistakes in documentation on modules #44241

fzipp opened this issue Feb 12, 2021 · 10 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@fzipp
Copy link
Contributor

fzipp commented Feb 12, 2021

I read the new documentation on modules (which is great, btw) and took notes of mistakes I encountered.

https://golang.org/doc/modules/gomod-ref

  1. Contradiction: The description for 'replacement-path' says:

    "[...] If this is a module path, you must specify a _replacement-version_ value. [...]"
    But the following example shows the replacement of a module path without a replacement version value:
    "replace example.com/othermodule => example.com/myfork/othermodule"

  2. Section 'exclude', description of 'module-version":

    "If this version number is omitted, all versions of the module are replaced with the content on the right side of the arrow."

    But an 'exclude' directive doesn't have an arrow. This sentence seems to be copy&pasted from the 'replace' directive and wrong.

  3. Contradiction:

    "These directives are ignored in modules that depend on the current module."
    vs. later
    "These directives are ignored in modules that are dependencies of the current module."
    Which one is it?

  4. Formatting: In the first example one line is not correctly indented.

  5. Formatting: "_replacement-version_", "_replacement-path_". The underscores are probably not intended, but unsupported Markdown syntax.

https://golang.org/doc/tutorial/create-module

  1. "This tutorial's sequence includes six brief topics [...]"

    Followed by a numbered list of seven topics. s/six/seven/

https://golang.org/doc/tutorial/call-module-code

  1. Broken link: "Here, the replace directive [...]"

  2. Broken tutorial: "In the hello directory, run go build to make Go locate the module and add it as a dependency to the go.mod file."

    Starting with Go 1.16 'go build' doesn't add dependencies anymore, which breaks this tutorial (similar to x/website: Getting Started tutorial doesn't work with Go 1.16 #43672).

https://golang.org/doc/tutorial/getting-started

  1. Outdated description: "3. On the Doc tab, under Index, [...]"

    The former Doc tab is a menu item named 'Documentation' on the left side now.

https://golang.org/doc/modules/managing-dependencies

  1. Broken link: "See package discovery."

  2. Typo: "One you've discovered" s/One/Once/

https://golang.org/doc/modules/version-numbers

  1. Typo: "For more, see Managingdependencies." (missing space)

https://golang.org/doc/modules/publishing

  1. Typo: "6. [...] with 1nformation about [...]"

    s/1nformation/information/

  2. Broken links: "go get command" (twice)

    here: "[ ... ] and run the go get command [...]",
    and here: "They can run the go get command [...]

https://golang.org/doc/modules/major-version

  1. Invalid syntax:

    "Old import statement: import example.com/mymodule/package1
    New import statement: import example.com/mymodule/v2/package1"

    Package paths must be in quotes.

General

  1. The anchors on most pages under doc/modules have temporary names: #tmp_0, #tmp_1, etc.
@gopherbot gopherbot added this to the Unreleased milestone Feb 12, 2021
@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Feb 12, 2021
@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 12, 2021
@fzipp
Copy link
Contributor Author

fzipp commented Feb 13, 2021

  1. Adding to this point:

Starting with Go 1.16 'go build' doesn't add dependencies anymore, which breaks this tutorial.

Step 4 on https://golang.org/doc/tutorial/call-module-code tells the user to run go mod init hello:

$ go mod init hello
go: creating new go.mod: module hello

But the actual output starting with Go 1.16 is:

$ go mod init hello
go: creating new go.mod: module hello
go: to add module requirements and sums:
	go mod tidy

The tutorial should tell the user to ignore the go mod tidy message, since it will go on to set up a replace directive for example.com/greetings to a local directory.

@fzipp
Copy link
Contributor Author

fzipp commented Feb 13, 2021

  1. Another tutorial that needs to be updated for the Go 1.16 changes:

https://golang.org/doc/code.html

When you run commands like go install, go build, or go run, the go command will automatically download the remote module and record its version in your go.mod file:

$ go install example.com/user/hello
go: finding module for package github.com/google/go-cmp/cmp
go: downloading github.com/google/go-cmp v0.4.0
go: found github.com/google/go-cmp/cmp in github.com/google/go-cmp v0.4.0

go install no longer automatically downloads modules. The actual output is:

$ go install example.com/user/hello
hello.go:7:2: no required module provides package github.com/google/go-cmp/cmp; to add it:
	go get github.com/google/go-cmp/cmp

@fzipp
Copy link
Contributor Author

fzipp commented Feb 17, 2021

The minor issues (typos, broken links, formatting) are addressed by CL 293229

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/293229 mentions this issue: _content/doc: fix typos, broken links, and text formatting

@dmitshur
Copy link
Contributor

Thank you for reporting this and sending a CL.

CC @stevetraut.

@stevetraut
Copy link

Thanks so much for these fixes, @fzipp! I'll take a look at the CL.

@fzipp
Copy link
Contributor Author

fzipp commented Feb 18, 2021

@stevetraut
Thanks. I have numbered the points now. The CL only fixes the simpler points (1, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15).

Points 2, 3, 8, 16, 17, 18 are still open, and some of them are more important, because they break the tutorial experience, but I think they should be addressed by you, because in some cases I don't know what the right answer or best practice is.

@stevetraut
Copy link

Thanks, @fzipp. I'll take a look.

@stevetraut stevetraut self-assigned this Feb 18, 2021
gopherbot pushed a commit to golang/website that referenced this issue Feb 25, 2021
For golang/go#44241

Change-Id: Ie23c99c6e36c618d0a3135167cf780f02ea3e3ea
Reviewed-on: https://go-review.googlesource.com/c/website/+/293229
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Steve Traut <straut@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/297531 mentions this issue: _content/doc: fix module and tutorial bugs and clean up flow

gopherbot pushed a commit to golang/website that referenced this issue Mar 2, 2021
For golang/go#44241

- Fix issues 2, 3, 8, 16, 17, 18 from golang/go#44241

Other changes in multiple topics:

- In markdown, replace HTML anchor tags with {#anchor} tags.
- In a few places, add content to clarify that module path must
  be a location from which the module can be downloaded.
- Where it was missing, add example.com domain to example module
  paths. Hopefully, this will reinforce the idea that the module
  path should typically include a domain. Docs will use
  something that looks like a domain name for module path.
- Add more cross-references from tutorial to references for
  packages and commands.
- Rewrite a few links so that they include the topic title,
  rather than simply inline text. Left those links whose
  destinations are references -- the item's name seems to
  suggest that a reference is at the destination.
- Remove domain name from golang.org doc links, leaving root
  directory. Such as /cmd/go/* or /doc/modules/*
- Add path up to root for all links in the same domain.
  Some were linking by file name only.
- Change standard library links from golang.org to pkg.go.dev.

Changes in the module tutorial:

- Add text to help clarify that there should be a hello and
  greetings directory as siblings in their directory hierarchy.
  Some users thought one should be subordinate to the other.
- Where needed, reorder steps so that `go mod init` is run before
  code is added. This is intended to reinforce the importance of
  the module's presence.
- In require/replace steps, have the user use `go mod edit`
  rather than editing the go.mod file in an editor. The tools
  are more likely to yield a functioning result.
- Where possible/appropriate, change module directive link
  destinations from "Modules reference" to go.mod reference.
- Change "run the code" steps so that they all use `go run .`
  rather than `go build` or `go run <filename>`. This removes
  the impedance of explanation and more commands, while
  moving the explanation of `go build` and `go install` to
  a separate topic where they share a clearer context.
- Add a "Conclusion" topic with a few links. The tutorial ended
  rather abruptly before.
- Minor edits to remove some redundant language.

Change-Id: I93055035d73c362ba73edea458fc53bc45e66512
Reviewed-on: https://go-review.googlesource.com/c/website/+/297531
Trust: Steve Traut <straut@google.com>
Run-TryBot: Steve Traut <straut@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@stevetraut
Copy link

Added fixes for points 2, 3, 8, 16, 17, and 18. Thanks for the report, @fzipp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to 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