Currently, links inside blog articles are absolute links to golang.org. But when a godoc server is run locally, the blog package should serve local links pointing to the local godoc server. It is not possible to simply change the links inside the blog templates to relative urls because the blog articles are independant pages on their own. And moreover, they are served from blog.golang.org. Rather, the blog package consumes and serves blog articles. So, a flag was added in the Config struct to denote whether to convert the links or not. This flag is then set from the call site in godoc package where the blog server is initialized from. This was required because "golang.org/x/tools/blog" is a package which can be used by other code to serve blog pages and not just godoc. This preserves existing functionality for all working code which imports "golang.org/x/tools/blog" and changes the functionality only when a godoc server is run locally. And while here, replace relevant bytes.Buffer occurences with strings.Builder. Fixes golang/go#22681 Change-Id: I7dbf9c5f2f93fd0b7e17915238de1c084fcd1431 Reviewed-on: https://go-review.googlesource.com/105835 Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Go Tools
This subrepository holds the source for various packages and tools that support the Go programming language.
Some of the tools, godoc
and vet
for example, are included in binary Go
distributions.
Others, including the Go guru
and the test coverage tool, can be fetched with
go get
.
Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs.
Download/Install
The easiest way to install is to run go get -u golang.org/x/tools/...
. You can
also manually git clone the repository to $GOPATH/src/golang.org/x/tools
.
Report Issues / Send Patches
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your subdir):" in the subject line, so it is easy to find.