comments

package
v0.0.0-...-c9361cd Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentList

func CommentList(docs ...*ast.CommentGroup) []string

Types

type CommentMap

type CommentMap struct {
	Structs    []Struct
	Funcs      []Func
	Interfaces []Interface
	Others     []OtherNamed
}

func ExtractComments

func ExtractComments(file *ast.File, pkg *packages.Package) *CommentMap

func (*CommentMap) CopyForewordsToFirstField

func (cm *CommentMap) CopyForewordsToFirstField() *CommentMap

type Field

type Field struct {
	Name     string
	Comments []string
}

func ExtractFieldsComments

func ExtractFieldsComments(fields []*ast.Field) []Field

func ExtractParamsComments

func ExtractParamsComments(fieldList *ast.FieldList, cmap ast.CommentMap) []Field

type Func

type Func struct {
	Name                    string
	Comments                []string
	ParamsForewordComments  []string
	Params                  []Field
	ResultsForewordComments []string
	Results                 []Field
}

func ExtractFuncComments

func ExtractFuncComments(typ *ast.FuncDecl, cmap ast.CommentMap) Func

func ExtractMethodsComments

func ExtractMethodsComments(methods []*ast.Field, cmap ast.CommentMap) []Func

type Interface

type Interface struct {
	Name     string
	Comments []string
	Methods  []Func
}

type OtherNamed

type OtherNamed struct {
	Name     string
	Comments []string
	TypeDesc string
}

type Struct

type Struct struct {
	Name     string
	Comments []string
	Fields   []Field
}

Directories

Path Synopsis
internal
book
package book is an internal package used for test comments
package book is an internal package used for test comments

Jump to

Keyboard shortcuts

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