亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
archive archive/tar archive/zip bufio bufio(緩存) builtin builtin(內(nèi)置包) bytes bytes(包字節(jié)) compress compress/bzip2(壓縮/bzip2) compress/flate(壓縮/flate) compress/gzip(壓縮/gzip) compress/lzw(壓縮/lzw) compress/zlib(壓縮/zlib) container container/heap(容器數(shù)據(jù)結(jié)構(gòu)heap) container/list(容器數(shù)據(jù)結(jié)構(gòu)list) container/ring(容器數(shù)據(jù)結(jié)構(gòu)ring) context context(上下文) crypto crypto(加密) crypto/aes(加密/aes) crypto/cipher(加密/cipher) crypto/des(加密/des) crypto/dsa(加密/dsa) crypto/ecdsa(加密/ecdsa) crypto/elliptic(加密/elliptic) crypto/hmac(加密/hmac) crypto/md5(加密/md5) crypto/rand(加密/rand) crypto/rc4(加密/rc4) crypto/rsa(加密/rsa) crypto/sha1(加密/sha1) crypto/sha256(加密/sha256) crypto/sha512(加密/sha512) crypto/subtle(加密/subtle) crypto/tls(加密/tls) crypto/x509(加密/x509) crypto/x509/pkix(加密/x509/pkix) database database/sql(數(shù)據(jù)庫(kù)/sql) database/sql/driver(數(shù)據(jù)庫(kù)/sql/driver) debug debug/dwarf(調(diào)試/dwarf) debug/elf(調(diào)試/elf) debug/gosym(調(diào)試/gosym) debug/macho(調(diào)試/macho) debug/pe(調(diào)試/pe) debug/plan9obj(調(diào)試/plan9obj) encoding encoding(編碼) encoding/ascii85(編碼/ascii85) encoding/asn1(編碼/asn1) encoding/base32(編碼/base32) encoding/base64(編碼/base64) encoding/binary(編碼/binary) encoding/csv(編碼/csv) encoding/gob(編碼/gob) encoding/hex(編碼/hex) encoding/json(編碼/json) encoding/pem(編碼/pem) encoding/xml(編碼/xml) errors errors(錯(cuò)誤) expvar expvar flag flag(命令行參數(shù)解析flag包) fmt fmt go go/ast(抽象語(yǔ)法樹(shù)) go/build go/constant(常量) go/doc(文檔) go/format(格式) go/importer go/parser go/printer go/scanner(掃描儀) go/token(令牌) go/types(類型) hash hash(散列) hash/adler32 hash/crc32 hash/crc64 hash/fnv html html html/template(模板) image image(圖像) image/color(顏色) image/color/palette(調(diào)色板) image/draw(繪圖) image/gif image/jpeg image/png index index/suffixarray io io io/ioutil log log log/syslog(日志系統(tǒng)) math math math/big math/big math/bits math/bits math/cmplx math/cmplx math/rand math/rand mime mime mime/multipart(多部分) mime/quotedprintable net net net/http net/http net/http/cgi net/http/cookiejar net/http/fcgi net/http/httptest net/http/httptrace net/http/httputil net/http/internal net/http/pprof net/mail net/mail net/rpc net/rpc net/rpc/jsonrpc net/smtp net/smtp net/textproto net/textproto net/url net/url os os os/exec os/signal os/user path path path/filepath(文件路徑) plugin plugin(插件) reflect reflect(反射) regexp regexp(正則表達(dá)式) regexp/syntax runtime runtime(運(yùn)行時(shí)) runtime/debug(調(diào)試) runtime/internal/sys runtime/pprof runtime/race(競(jìng)爭(zhēng)) runtime/trace(執(zhí)行追蹤器) sort sort(排序算法) strconv strconv(轉(zhuǎn)換) strings strings(字符串) sync sync(同步) sync/atomic(原子操作) syscall syscall(系統(tǒng)調(diào)用) testing testing(測(cè)試) testing/iotest testing/quick text text/scanner(掃描文本) text/tabwriter text/template(定義模板) text/template/parse time time(時(shí)間戳) unicode unicode unicode/utf16 unicode/utf8 unsafe unsafe
characters

  • import "go/doc"

  • Overview

  • Index

概觀

Package doc從Go AST中提取源代碼文檔。

索引

  • Variables

  • func Examples(files ...*ast.File) []*Example

  • func IsPredeclared(s string) bool

  • func Synopsis(s string) string

  • func ToHTML(w io.Writer, text string, words map[string]string)

  • func ToText(w io.Writer, text string, indent, preIndent string, width int)

  • type Example

  • type Filter

  • type Func

  • type Mode

  • type Note

  • type Package

  • func New(pkg *ast.Package, importPath string, mode Mode) *Package

  • func (p *Package) Filter(f Filter)

  • type Type

  • type Value

包文件

comment.go doc.go example.go exports.go filter.go reader.go synopsis.go

變量

var IllegalPrefixes = []string{        "copyright",        "all rights",        "author",}

func Examples

func Examples(files ...*ast.File) []*Example

Examples返回按名稱字段排序的文件中找到的示例。Order字段記錄遇到示例的順序。

可播放的示例必須位于名稱以“_test”結(jié)尾的包中。在以下任一情況下,示例都是“可播放的”(播放字段不為零):

- The example function is self-contained: the function references only
  identifiers from other packages (or predeclared identifiers, such as  "int") and the test file does not include a dot import.- The entire test file is the example: the file contains exactly one
  example function, zero test or benchmark functions, and at least one
  top-level function, type, variable, or constant declaration other
  than the example function.

func IsPredeclared

func IsPredeclared(s string) bool

IsPredeclared報(bào)告s是否是預(yù)先標(biāo)識(shí)的標(biāo)識(shí)符。

func Synopsis

func Synopsis(s string) string

Synopsis返回s中第一句話的清晰版本。該句在第一個(gè)句點(diǎn)后加空格,并且前面沒(méi)有一個(gè)大寫字母后結(jié)束。結(jié)果字符串沒(méi)有\(zhòng) n,\ r或\ t字符,并且在單詞之間只使用單個(gè)空格。如果s從任何非法前綴開(kāi)始,則結(jié)果是空字符串。

func ToHTML

func ToHTML(w io.Writer, text string, words map[string]string)

ToHTML將注釋文本轉(zhuǎn)換為格式化的HTML。該評(píng)論是由DocReader編寫的,因此已知不會(huì)在行尾有空行,也不會(huì)在行尾有尾隨空格。評(píng)論標(biāo)記已被刪除。

不縮進(jìn)的非空行的每個(gè)跨度都被轉(zhuǎn)換為單個(gè)段落。規(guī)則有一個(gè)例外:由單一行組成的跨度,后面跟著另一段跨度,以大寫字母開(kāi)頭,并且不包含標(biāo)點(diǎn)符號(hào)被格式化為標(biāo)題。

縮進(jìn)行的跨度被轉(zhuǎn)換為<pre>塊,并刪除了公共縮進(jìn)前綴。

評(píng)論文本中的URL被轉(zhuǎn)換為鏈接; 如果URL也出現(xiàn)在單詞映射中,則鏈接將從映射中獲?。ㄈ绻鄳?yīng)的映射值是空字符串,則URL不會(huì)轉(zhuǎn)換為鏈接)。

出現(xiàn)在單詞映射中的Go標(biāo)識(shí)符以斜體表示; 如果相應(yīng)的映射值不是空字符串,則將其視為URL并將該單詞轉(zhuǎn)換為鏈接。

func ToText

func ToText(w io.Writer, text string, indent, preIndent string, width int)

ToText以文本輸出的形式準(zhǔn)備評(píng)論文本。它將文本段落包裝成寬度或更少的Unicode代碼點(diǎn),然后將每行縮進(jìn)前綴。在預(yù)先格式化的部分(如程序文本)中,它使用preIndent前綴每個(gè)非空行。

type Example

一個(gè)Example 代表了一個(gè)在源文件中找到的示例函數(shù)。

type Example struct {
        Name        string // name of the item being exemplified
        Doc         string // example function doc string
        Code        ast.Node
        Play        *ast.File // a whole program version of the example
        Comments    []*ast.CommentGroup
        Output      string // expected output
        Unordered   bool
        EmptyOutput bool // expect empty output
        Order       int  // original source code order}

type Filter

type Filter func(string) bool

type Func

Func是func聲明的文檔。

type Func struct {
        Doc  string
        Name string
        Decl *ast.FuncDecl        // methods        // (for functions, these fields have the respective zero value)
        Recv  string // actual   receiver "T" or "*T"
        Orig  string // original receiver "T" or "*T"
        Level int    // embedding level; 0 means not embedded}

type Mode

Mode值控制New的操作。

type Mode int
const (        // extract documentation for all package-level declarations,        // not just exported ones
        AllDecls Mode = 1 << iota        // show all embedded methods, not just the ones of        // invisible (unexported) anonymous fields
        AllMethods)

type Note

Note 代表以“MARKER(uid):note body”開(kāi)頭的標(biāo)注注釋。任何帶有2個(gè)或更多大寫AZ字母的標(biāo)記以及至少一個(gè)字符的uid都被識(shí)別。uid后面的“:”是可選的。注釋收集在由Note 標(biāo)記索引的Package.Notes地圖中。

type Note struct {
        Pos, End token.Pos // position range of the comment containing the marker
        UID      string    // uid found with the marker
        Body     string    // note body text}

type Package

Package 是整個(gè)包的文檔。

type Package struct {
        Doc        string
        Name       string
        ImportPath string
        Imports    []string
        Filenames  []string
        Notes      map[string][]*Note        // Deprecated: For backward compatibility Bugs is still populated,        // but all new code should use Notes instead.
        Bugs []string        // declarations
        Consts []*Value
        Types  []*Type
        Vars   []*Value
        Funcs  []*Func}

func New

func New(pkg *ast.Package, importPath string, mode Mode) *Package

New計(jì)算給定包AST的包文檔。New取得AST pkg的所有權(quán),并可以編輯或覆蓋它。

func (*Package) Filter

func (p *Package) Filter(f Filter)

過(guò)濾器消除了不通過(guò)過(guò)濾器f的名稱的文檔。TODO(gri):將“Type.Method”識(shí)別為名稱。

type Type

Type是類型聲明的文檔。

type Type struct {
        Doc  string
        Name string
        Decl *ast.GenDecl        // associated declarations
        Consts  []*Value // sorted list of constants of (mostly) this type
        Vars    []*Value // sorted list of variables of (mostly) this type
        Funcs   []*Func  // sorted list of functions returning this type
        Methods []*Func  // sorted list of methods (including embedded ones) of this type}

type Value

Value 是(可能分組的)var或const聲明的文檔。

type Value struct {
        Doc   string
        Names []string // var or const names in declaration order
        Decl  *ast.GenDecl        // contains filtered or unexported fields}
Previous article: Next article: