golang中的文档管理
By admin
- One minute read - 212 wordsfoo.go
// CopyRight 2013 The Go Author. All Right reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE fifle.
/*
Package foo implements a set of simple mathematical functions. These comments are for
demonstration purpose only. Nothing more.
If you have any questions,please don’t hesitate to add yourself to
[email protected].
you can alse visit golang.org for full Go documentation.
*/
package foo
import (
"fmt"
)
// Foo compares the two input values and retrens the larger
// Value, If the two values are equal, return 0.
func Foo(a, b int) (ret int, err error) {
if a > b {
return a, nil
} else {
return b, nil
}
return 0, nil
}
// BUG(jack): #1: i’m sorry but this code has an issue to be solved.
// BUG(tom): #2: An issue assigned to anothoer person.
生成文档摘要
go doc foo.go
PACKAGE DOCUMENTATION import “D:\gotest\src”
FUNCTIONS
func Foo(a, b int) (ret int, err error) Foo compares the two input values and retrens the larger Value, If the two values are equal, return 0.
BUGS
#1: i’m sorry but this code has an issue to be solved.
#2: An issue assigned to anothoer person.
为了方便查看,也可以通过浏览器查看
godoc -http=:9090
然后输入 http://localhost:9090/pkg/foo 即可