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: identifier links in comments #31560

Closed
CAFxX opened this issue Apr 18, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@CAFxX
Copy link
Contributor

commented Apr 18, 2019

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

$ go version
go version go1.12.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/Users/cafxx/go/bin"
GOCACHE="/Users/cafxx/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/cafxx/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ql/lydqwymx3kz23j27p_dr5kz00000gp/T/go-build764495944=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I wanted to have identifiers in comments turn into links, for ease of navigation. I have comments like the following in my repos:

// SomeFunction does something.
// SomeFunction can not be called concurrently; you can use OtherFunction
// if your code must be able to perform this operation concurrently.
func SomeFunction() {
  // ...
}

// OtherFunction is the same as SomeFunction but it can be called concurrently.
func OtherFunction() {
}

Note that this would not need to apply only to functions. Ideally it should happen for any (public?) identifier in the same package, as well as for public identifiers in other packages (if they are properly prefixed with the package name).

Examples of places where this could be useful (cursory check on a single package in the stdlib):

What did you expect to see?

I would expect the SomeOtherFunction in the comment be rendered as a link to SomeOtherFunction in the HTML output of godoc.

What did you see instead?

No links. 😭

@gopherbot gopherbot added this to the Unreleased milestone Apr 18, 2019

@agnivade

This comment has been minimized.

Copy link
Member

commented Apr 19, 2019

@agnivade agnivade closed this Apr 19, 2019

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