go/doc/comment: 结构体字段文档的doc链接无法工作

tyg4sfes  于 9个月前  发布在  Go
关注(0)|答案(6)|浏览(97)

你使用的Go版本是什么( go version )?

  1. $ go version
  2. go version go1.19.1 darwin/amd64

这个问题在最新版本中是否会重现?

是的

你正在使用什么操作系统和处理器架构( go env )?

go env 输出

  1. $ go env
  2. GO111MODULE=""
  3. GOARCH="amd64"
  4. GOBIN=""
  5. GOCACHE="/Users/Will/Library/Caches/go-build"
  6. GOENV="/Users/Will/Library/Application Support/go/env"
  7. GOEXE=""
  8. GOEXPERIMENT=""
  9. GOFLAGS=""
  10. GOHOSTARCH="amd64"
  11. GOHOSTOS="darwin"
  12. GOINSECURE=""
  13. GOMODCACHE="/Users/Will/Developer/go/pkg/mod"
  14. GONOPROXY=""
  15. GONOSUMDB=""
  16. GOOS="darwin"
  17. GOPATH="/Users/Will/Developer/go"
  18. GOPRIVATE=""
  19. GOPROXY="https://proxy.golang.org,direct"
  20. GOROOT="/usr/local/Cellar/go/1.19.1/libexec"
  21. GOSUMDB="sum.golang.org"
  22. GOTMPDIR=""
  23. GOTOOLDIR="/usr/local/Cellar/go/1.19.1/libexec/pkg/tool/darwin_amd64"
  24. GOVCS=""
  25. GOVERSION="go1.19.1"
  26. GCCGO="gccgo"
  27. GOAMD64="v1"
  28. AR="ar"
  29. CC="clang"
  30. CXX="clang++"
  31. CGO_ENABLED="1"
  32. GOMOD="/Users/Will/Developer/ebnf/go.mod"
  33. GOWORK=""
  34. CGO_CFLAGS="-g -O2"
  35. CGO_CPPFLAGS=""
  36. CGO_CXXFLAGS="-g -O2"
  37. CGO_FFLAGS="-g -O2"
  38. CGO_LDFLAGS="-g -O2"
  39. PKG_CONFIG="pkg-config"
  40. GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/go-build1943356326=/tmp/go-build -gno-record-gcc-switches -fno-common"
  41. GOROOT/bin/go version: go version go1.19.1 darwin/amd64
  42. GOROOT/bin/go tool compile -V: compile version go1.19.1
  43. uname -v: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
  44. ProductName: macOS
  45. ProductVersion: 12.6
  46. BuildVersion: 21G115
  47. lldb --version: lldb-1400.0.30.3
  48. Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)

你做了什么?

  1. // FirstFollowConflictError is a first/follow LL(1) grammar parse conflict.
  2. type FirstFollowConflictError struct {
  3. Nonterminal string
  4. // An [Identifier] or [Literal]
  5. Terminal any // an [Identifier] or [Literal]
  6. }
  1. $ go doc FirstFollowConflictError

你期望看到什么?

  1. package ebnf // import "."
  2. type FirstFollowConflictError struct {
  3. Nonterminal string
  4. // An Identifier or Literal
  5. Terminal any // an Identifier or Literal
  6. }
  7. FirstFollowConflictError is a first/follow LL(1) grammar parse conflict.

你实际看到了什么?

  1. package ebnf // import "."
  2. type FirstFollowConflictError struct {
  3. Nonterminal string
  4. // An [Identifier] or [Literal]
  5. Terminal any // an [Identifier] or [Literal]
  6. }
  7. FirstFollowConflictError is a first/follow LL(1) grammar parse conflict.

注意上面和旁边的Terminal字段周围的方括号。它们没有被解析和呈现为文档链接。如果将它们放在类型声明上方,括号就会消失,如预期的那样。

xkftehaa

xkftehaa1#

IdentifierLiteral 是什么?

0ve6wy6x

0ve6wy6x2#

包范围内的结构体类型。

  1. package ebnf // import "."
  2. type Identifier struct {
  3. Text string
  4. }
  5. type Literal struct {
  6. Text string
  7. }
nbnkbykc

nbnkbykc3#

请查看https://pkg.go.dev/github.com/willfaught/ebnf@v0.4.1#FirstFollowConflictError以获取完整上下文,尽管那里省略了括号,因为它不起作用。

tzdcorbm

tzdcorbm4#

cc @griesemer

bxjv4tth

bxjv4tth5#

See also #59728 .

ckx4rj1h

ckx4rj1h6#

经历类似的事情,有人可以看一下#67473

相关问题