本文整理汇总了Golang中go/doc.Package类的典型用法代码示例。如果您正苦于以下问题:Golang Package类的具体用法?Golang Package怎么用?Golang Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Package类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: untangleDoc
func untangleDoc(dpkg *doc.Package) {
for _, t := range dpkg.Types {
dpkg.Consts = append(dpkg.Consts, t.Consts...)
t.Consts = nil
dpkg.Vars = append(dpkg.Vars, t.Vars...)
t.Vars = nil
dpkg.Funcs = append(dpkg.Funcs, t.Funcs...)
t.Funcs = nil
}
}
示例2: untangleDoc
func untangleDoc(pkg *godoc.Package) {
for _, t := range pkg.Types {
pkg.Consts = append(pkg.Consts, t.Consts...)
t.Consts = nil
pkg.Vars = append(pkg.Vars, t.Vars...)
t.Vars = nil
pkg.Funcs = append(pkg.Funcs, t.Funcs...)
t.Funcs = nil
}
}
示例3: removeAssociations
func removeAssociations(dpkg *doc.Package) {
for _, t := range dpkg.Types {
dpkg.Funcs = append(dpkg.Funcs, t.Funcs...)
t.Funcs = nil
}
sort.Sort(byFuncName(dpkg.Funcs))
}
示例4: trPackage
func trPackage(lang, importPath string, pkg *doc.Package) *doc.Package {
key := mapKey(lang, pkg.ImportPath, __pkg__)
localPkg, _ := pkgDocTable[key]
if localPkg == nil {
return nil
}
pkg.Name = localPkg.Name
pkg.Doc = localPkg.Doc
for k, _ := range pkg.Notes {
if notes, _ := localPkg.Notes[k]; notes != nil {
pkg.Notes[k] = notes
}
}
for i := 0; i < len(pkg.Consts); i++ {
key := mapKey(lang, pkg.ImportPath, pkg.Consts[i].Names[0])
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Consts[i].Doc = s
}
}
for i := 0; i < len(pkg.Types); i++ {
key := mapKey(lang, pkg.ImportPath, pkg.Types[i].Name)
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Types[i].Doc = s
}
for j := 0; j < len(pkg.Types[i].Consts); j++ {
key := mapKey(lang, pkg.ImportPath, pkg.Types[i].Consts[j].Names[0])
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Types[i].Consts[j].Doc = s
}
}
for j := 0; j < len(pkg.Types[i].Vars); j++ {
key := mapKey(lang, pkg.ImportPath, pkg.Types[i].Vars[j].Names[0])
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Types[i].Vars[j].Doc = s
}
}
for j := 0; j < len(pkg.Types[i].Funcs); j++ {
key := mapKey(lang, pkg.ImportPath, pkg.Types[i].Funcs[j].Name)
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Types[i].Funcs[j].Doc = s
}
}
for j := 0; j < len(pkg.Types[i].Methods); j++ {
id := methodId(pkg.Types[i].Name, pkg.Types[i].Methods[j].Name)
key := mapKey(lang, pkg.ImportPath, id)
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Types[i].Methods[j].Doc = s
}
}
}
for i := 0; i < len(pkg.Vars); i++ {
key := mapKey(lang, pkg.ImportPath, pkg.Vars[i].Names[0])
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Vars[i].Doc = s
}
}
for i := 0; i < len(pkg.Funcs); i++ {
key := mapKey(lang, pkg.ImportPath, pkg.Funcs[i].Name)
if s, _ := pkgDocIndexTable[key]; s != "" {
pkg.Funcs[i].Doc = s
}
}
return pkg
}