doc

package
v0.0.0-...-7f17c66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2018 License: BSD-3-Clause Imports: 20 Imported by: 0

README

This is the entire source of the gddo/doc directory, copied over and tweaked
for use with metagodoc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultGOOS

func SetDefaultGOOS(goos string)

SetDefaultGOOS sets given GOOS value as default one to use when building package documents. SetDefaultGOOS has no effect on some windows-only packages.

Types

type Annotation

type Annotation struct {
	Pos       int32          `json:"pos" esType:"integer"`
	End       int32          `json:"end" esType:"integer"`
	Kind      AnnotationKind `json:"kind" esType:"keyword"`
	PathIndex int16          `json:"path_index" esType:"short"`
}

type AnnotationKind

type AnnotationKind int16
const (
	// Link to export in package specified by Paths[PathIndex] with fragment
	// Text[strings.LastIndex(Text[Pos:End], ".")+1:End].
	LinkAnnotation AnnotationKind = iota

	// Anchor with name specified by Text[Pos:End] or typeName + "." +
	// Text[Pos:End] for type declarations.
	AnchorAnnotation

	// Comment.
	CommentAnnotation

	// Link to package specified by Paths[PathIndex].
	PackageLinkAnnotation

	// Link to builtin entity with name Text[Pos:End].
	BuiltinAnnotation
)

type Code

type Code struct {
	Text        string       `json:"text" esType:"keyword"`
	Annotations []Annotation `json:"annotations"`
	Paths       []string     `json:"paths" esType:"keyword"`
}

type Example

type Example struct {
	Name   string `json:"name" esType:"keyword"`
	Doc    string `json:"doc" esType:"text" esAnalyzer:"english"`
	Code   Code   `json:"code"`
	Play   string `json:"play" esType:"keyword"`
	Output string `json:"output" esType:"keyword"`
}

type File

type File struct {
	Name string `json:"name" esType:"keyword"`
	URL  string `json:"url" esType:"keyword"`
}

type Func

type Func struct {
	Decl     Code       `json:"decl"`
	Pos      Pos        `json:"pos"`
	Doc      string     `json:"doc" esType:"text" esAnalyzer:"english"`
	Name     string     `json:"name" esType:"keyword"`
	Recv     string     `json:"recv" esType:"keyword"` // Actual receiver "T" or "*T".
	Orig     string     `json:"orig" esType:"keyword"` // Original receiver "T" or "*T". This can be different from Recv due to embedding.
	Examples []*Example `json:"examples"`
}

type Note

type Note struct {
	Pos  Pos    `json:"pos"`
	UID  string `json:"uid" esType:"keyword"`
	Body string `json:"uid" esType:"text" esAnalyzer:"english"`
}

type Package

type Package struct {
	// The import path for this package.
	ImportPath string

	// Errors found when fetching or parsing this package.
	Errors []string

	// Packages referenced in README files.
	References []string

	// Package name or "" if no package for this import path. The proceeding
	// fields are set even if a package is not found for the import path.
	Name string

	// Synopsis and full documentation for the package.
	Synopsis string
	Doc      string

	// Format this package as a command.
	IsCmd bool

	// Environment
	GOOS, GOARCH string

	// Top-level declarations.
	Consts []*Value
	Funcs  []*Func
	Types  []*Type
	Vars   []*Value

	// Package examples
	Examples []*Example

	Notes map[string][]*Note

	// Source.
	LineFmt   string
	BrowseURL string
	Files     []*File
	TestFiles []*File

	// Source size in bytes.
	SourceSize     int
	TestSourceSize int

	// Imports
	Imports      []string
	TestImports  []string
	XTestImports []string
}

func NewPackage

func NewPackage(dir *directory.Directory) (*Package, error)

type Pos

type Pos struct {
	Line int32  `json:"line" esType:"integer"` // 0 if not valid.
	N    uint16 `json:"n" esType:"integer"`    // number of lines - 1
	File int16  `json:"file" esType:"short"`   // index in Package.Files
}

type Type

type Type struct {
	Doc      string     `json:"doc" esType:"text" esAnalyzer:"english"`
	Name     string     `json:"name" esType:"keyword"`
	Decl     Code       `json:"decl"`
	Pos      Pos        `json:"pos"`
	Consts   []*Value   `json:"consts"`
	Vars     []*Value   `json:"vars"`
	Funcs    []*Func    `json:"funcs"`
	Methods  []*Func    `json:"methods"`
	Examples []*Example `json:"examples"`
}

type Value

type Value struct {
	Decl Code   `json:"code"`
	Pos  Pos    `json:"pos"`
	Doc  string `json:"doc" esType:"text" esAnalyzer:"english"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL