【发布时间】:2021-01-26 13:48:13
【问题描述】:
我想在我的函数注释中包含一些示例代码,如下所示:
// Some example for using `foo`:
//
// ```
// f := Foo(...)
// g := Goo(f)
// ```
func Foo() {
...
}
但是代码块在vscode中显示不正确。正确的做法是什么?
【问题讨论】:
-
反引号对标准的godoc无效,代码块是通过缩进写的。
-
也可以考虑写一个real executable example。
标签: go documentation