Description
gopls version
Build info
----------
golang.org/x/tools/gopls v0.11.0
golang.org/x/tools/[email protected] h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=
github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/[email protected] h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE=
golang.org/x/exp/[email protected] h1:fl8k2zg28yA23264d82M4dp+YlJ3ngDcpuB1bewkQi4=
golang.org/x/[email protected] h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/[email protected] h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/[email protected] h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/[email protected] h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/[email protected] h1:7/HkGkN/2ktghBCSRRgp31wAww4syfsW52tj7yirjWk=
golang.org/x/[email protected] h1:qptQiQwEpETwDiz85LKtChqif9xhVkAm8Nhxs0xnTww=
honnef.co/go/[email protected] h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA=
mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.19.1
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ichamberlain/Library/Caches/go-build"
GOENV="/Users/ichamberlain/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ichamberlain/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ichamberlain/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org"
GOROOT="/usr/local/Cellar/go/1.19.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.19.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ichamberlain/Documents/go-sandbox/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wb/7n13y1cx0v1d28zb304bw8bm0000gn/T/go-build1610262310=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
The new go1.19 doc comments are rendered to markdown, as mentioned in #54260, but the implementation seems to be incomplete to me. Mostly, linking to anything (package-local or otherwise) seems broken, and markdown links don't render as expected.
I believe all of these formats should be supported per https://go.dev/doc/comment#links
Sample program:
package main
import (
"fmt"
)
// Struct is a struct.
//
// # Unexpected link behavior
//
// - [fmt.Println] is linked to, but the link doesn't work (leads to non-existent "fmt")
// - [fmt] same as above
// - [Struct] isn't linked to
// - [absolute markdown links] don't seem to work
// - [relative markdown links] don't seem to work, although I'm
// not entirely sure what the expected behavior here is
//
// [absolute markdown links]: https://example.com
// [relative markdown links]: #Example
//
//nolint:ignored
type Struct struct{}
func main() {
fmt.Println()
}
What did you expect to see?
I would expect a hover comment to render something like this (using GitHub to render the expected markdown):
Struct is a struct.
Unexpected link behavior
- fmt.Println is linked to, but the link doesn't work (leads to non-existent "fmt")
- fmt same as above
- Struct isn't linked to
- absolute markdown links don't seem to work
- relative markdown links don't seem to work, although I'm
not entirely sure what the expected behavior here is
Whether fmt.Println
should link to pkg.go.dev
or be a "go to definition" link is up for debate, but maybe making it configurable would be nice?
For local links like Struct
I think the same question applies but I would lean towards "go to definition", it seems there has been some tangentially related discussion in #44890.
What did you see instead?
Clicking the fmt
links leads to this:
Editor and settings
Version: 1.75.0
Commit: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
Date: 2023-02-01T15:24:42.903Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No
Relevant config:
Logs
N/A, I think — but I can capture some if necessary.