本文整理匯總了Golang中github.com/Unknwon/gowalker/doc.Package.Examples方法的典型用法代碼示例。如果您正苦於以下問題:Golang Package.Examples方法的具體用法?Golang Package.Examples怎麽用?Golang Package.Examples使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Unknwon/gowalker/doc.Package
的用法示例。
在下文中一共展示了Package.Examples方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ConvertDataFormat
//.........這裏部分代碼省略.........
val := new(doc.Func)
for j, s := range strings.Split(v, "&F#") {
switch j {
case 0: // Name
val.Name = s
case 1: // Doc
val.Doc = s
case 2: // Decl
val.Decl = s
case 3: // URL
val.URL = s
case 4: // Code
val.Code = *codeDecode(&s)
}
}
pdoc.Funcs = append(pdoc.Funcs, val)
}
pdoc.Funcs = pdoc.Funcs[:len(pdoc.Funcs)-1]
// Types
pdoc.Types = make([]*doc.Type, 0, 10)
for _, v := range strings.Split(pdecl.Types, "&##") {
val := new(doc.Type)
for j, s := range strings.Split(v, "&$#") {
switch j {
case 0: // Type
for y, s2 := range strings.Split(s, "&T#") {
switch y {
case 0: // Name
val.Name = s2
case 1: // Doc
val.Doc = s2
case 2: // Decl
val.Decl = s2
case 3: // URL
val.URL = s2
}
}
case 1: // Functions
val.Funcs = make([]*doc.Func, 0, 2)
for _, v2 := range strings.Split(s, "&M#") {
val2 := new(doc.Func)
for y, s2 := range strings.Split(v2, "&F#") {
switch y {
case 0: // Name
val2.Name = s2
case 1: // Doc
val2.Doc = s2
case 2: // Decl
val2.Decl = s2
case 3: // URL
val2.URL = s2
case 4: // Code
val2.Code = *codeDecode(&s2)
}
}
val.Funcs = append(val.Funcs, val2)
}
val.Funcs = val.Funcs[:len(val.Funcs)-1]
case 3: // Methods.
val.Methods = make([]*doc.Func, 0, 5)
for _, v2 := range strings.Split(s, "&M#") {
val2 := new(doc.Func)
for y, s2 := range strings.Split(v2, "&F#") {
switch y {
case 0: // Name
val2.Name = s2
case 1: // Doc
val2.Doc = s2
case 2: // Decl
val2.Decl = s2
case 3: // URL
val2.URL = s2
case 4: // Code
val2.Code = *codeDecode(&s2)
}
}
val.Methods = append(val.Methods, val2)
}
val.Methods = val.Methods[:len(val.Methods)-1]
}
}
pdoc.Types = append(pdoc.Types, val)
}
pdoc.Types = pdoc.Types[:len(pdoc.Types)-1]
// Examples.
pdoc.Examples = convertDataFormatExample(pdecl.Examples, "")
// Dirs.
pdoc.Dirs = strings.Split(pdecl.Dirs, "|")
pdoc.Dirs = pdoc.Dirs[:len(pdoc.Dirs)-1]
// Imports.
pdoc.Imports = strings.Split(pdecl.Imports, "|")
// Files.
pdoc.Files = strings.Split(pdecl.Files, "|")
return nil
}