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/tools/cmd/godoc: Some links are absolute rather than relative. #22681

Closed
Konstantin8105 opened this issue Nov 12, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@Konstantin8105
Copy link
Contributor

commented Nov 12, 2017

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

○ → go version
go version go1.9.1 linux/amd64

Does this issue reproduce with the latest release?

Not checked.

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

GOARCH="amd64"
GOBIN="/home/lepricon/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/lepricon/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build790165923=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

  1. Run godoc -http=:9000
  2. Open page on link http://localhost:9000/blog/organizing-go-code. Name of page Organizing Go code.
  3. Scroll to par. What to put into a package
  4. We see 2 links under words: http package and hash package. And that links go to golang.org/... pages.

What did you expect to see?

For localhost godoc links on standard packages go to localhost:port/.....

What did you see instead?

Links go to golang.org/... pages.

@forskning

This comment has been minimized.

Copy link

commented Nov 13, 2017

@Konstantin8105 somewhat off topic but if from your example after running the command 'godoc -http=:9000', you would then open a browser and enter the URL http://localhost:9000/, when navigating through the buttons and coming to the blog button, does your shell output a message that /usr/local/go/fonts.css can not be found?

I get the following output from a 386 Windows binary download.

2017/11/13 06:57:18 GetFileAttributesEx C:\go\fonts.css: Den angivne fil blev ikke fundet.

And from 386 GNU/Linux source install (I'm not running godoc in the background).

2017/11/13 08:51:49 lstat /usr/lib/go1.9.2/go/fonts.css: no such file or directory

Looking at the source of https://blog.golang.org/ there are 2 .css files in that code, but the shell only complains about not being able to locate the 2nd named .css file.

The blog subrepo contains the following file.

go/src/golang.org/x/blog/static/fonts.css

@dmitshur dmitshur changed the title godoc: Documentation: Links x/tools/cmd/godoc: Some links are absolute rather than relative. Mar 11, 2018

@gopherbot gopherbot added this to the Unreleased milestone Mar 11, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Apr 8, 2018

This isn't as trivial as making all the links relative inside the blog template. Primarily because the blog site is served from blog.golang.org and it has links to golang.org/pkg... So, we need to check for the request host and replace the links dynamically at runtime.

Will send a CL.

@agnivade agnivade self-assigned this Apr 13, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Apr 13, 2018

Change https://golang.org/cl/105835 mentions this issue: blog: serve relative links when run locally

@golang golang locked and limited conversation to collaborators Apr 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.