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

doc: doc/articles/wiki clarification #25188

Closed
ghost opened this issue Apr 30, 2018 · 6 comments
Closed

doc: doc/articles/wiki clarification #25188

ghost opened this issue Apr 30, 2018 · 6 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Apr 30, 2018

What version of Go are you using (go version)?

go version go1.10.1 windows/amd64

Does this issue reproduce with the latest release?

N/A

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\sfmjp.WFC\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\sfmjp.WFC\go
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\sfmjp.WFC\AppData\Local\Temp\go-build919863594=/tmp/go-build -gno-record-gcc-switches

What did you do?

Following the wiki docs, I ran into an issue when getting to the following section: Using net/http to serve wiki pages.

The code sample explicitly says to add "net/http" to the import statement. It doesn't state to add "log", though it's also necessary. So when following along, a user will get a compilation error saying that log doesn't exist. It isn't until the user navigates to the "code so far" link does it show the need to add the import statement for log.

What did you expect to see?

I would expect the documentation to reflect the need to import both net/http and log at this point. If you're experienced in Go, then it may be obvious that you need to add an import statement for log. As a newer Gopher, this caused a situation where it's not entirely obvious that it was necessary to add until I looked at the code so far link.

@FiloSottile FiloSottile changed the title doc/articles/wiki clarification doc: doc/articles/wiki clarification Apr 30, 2018
@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 30, 2018
@FiloSottile FiloSottile added this to the Unplanned milestone Apr 30, 2018
@FiloSottile
Copy link
Contributor

Thanks for reporting this.

Would adding

We need to also import the log package to use log.Fatal.

at the end of this paragraph

To use this handler, we rewrite our main function to initialize http using the viewHandler to handle any requests under the path /view/.

be a good fix in your opinion?

@ghost
Copy link
Author

ghost commented Apr 30, 2018

That would be super helpful! As I went further through the article(I've completed it now!), I would also update the remaining snippets that include the import statement to reflect the addition of the log like so:

import (
	"html/template"
	"io/ioutil"
	"log"
	"net/http"
)

In the future, are pull requests accepted for documentation changes?

@FiloSottile
Copy link
Contributor

We do gladly accept PRs! If you are looking for a new task now that you completed the article, please feel free to submit a PR applying the changes you and I suggested here.

https://github.com/golang/go/tree/master/doc/articles/wiki

You might want to read http://golang.org/wiki/CommitMessage first.

@dupoxy
Copy link
Contributor

dupoxy commented May 2, 2018

Maybe PR #24584 is related.

@gopherbot
Copy link

Change https://golang.org/cl/148830 mentions this issue: go/doc: add missing log package imports

@seankhliao
Copy link
Member

This looks fixed

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2022
@golang golang locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants