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

ghost opened this issue Apr 30, 2018 · 5 comments · May be fixed by #28726

doc: doc/articles/wiki clarification #25188

ghost opened this issue Apr 30, 2018 · 5 comments · May be fixed by #28726


Copy link

@ghost 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?


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 GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_CFLAGS=-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 this to the Unplanned milestone Apr 30, 2018
Copy link

@FiloSottile FiloSottile commented Apr 30, 2018

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?

Copy link

@ghost 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 (

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

Copy link

@FiloSottile FiloSottile commented Apr 30, 2018

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.

You might want to read first.

@agnivade agnivade added the help wanted label May 1, 2018
Copy link

@dupoxy dupoxy commented May 2, 2018

Maybe PR #24584 is related.

@ghost ghost linked a pull request that will close this issue Nov 11, 2018
Copy link

@gopherbot gopherbot commented Nov 11, 2018

Change mentions this issue: go/doc: add missing log package imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.