Documentation ¶
Index ¶
Constants ¶
View Source
const (
CommentPrefix = "+typewriter"
)
View Source
const (
LoadMode = packages.NeedName | packages.NeedFiles | packages.NeedImports | packages.NeedDeps | packages.NeedTypes | packages.NeedSyntax
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) GetPackage ¶
GetPackage accepts absolute local path or Go module path and returns a single package. It caches by Go module path in both cases.
type CommentCache ¶
type CommentCache struct {
// contains filtered or unexported fields
}
CommentCache serves as the cache for accessing comments in packages. Indexed by package path.
func NewCommentCache ¶
func NewCommentCache(cache *Cache) *CommentCache
func (*CommentCache) GetPackageComments ¶
func (cc *CommentCache) GetPackageComments(pkgPath string) (Comments, error)
type CommentMarkers ¶
type CommentMarkers struct { // SectionContents holds the equality pairs and indexed by the string until // the last ":". // For example, the following two lines: // +typewriter:types:key1=val1 // +typewriter:types:key2=val2 // would be indexed as following: // { // "types": {"key1":"val1", "key2":"val2"} // } SectionContents map[string]map[string]string // Comment is the original comment string. Comment string }
func NewCommentMarkers ¶
func NewCommentMarkers(c string) CommentMarkers
func NewCommentMarkersFromText ¶
func NewCommentMarkersFromText(c string, prefix string) CommentMarkers
func (CommentMarkers) Print ¶
func (ct CommentMarkers) Print(prefix string) string
type Comments ¶
type Comments struct {
// contains filtered or unexported fields
}
Comments lets you fetch comment of an object.
func LoadComments ¶
type Imports ¶
func NewImports ¶
func (*Imports) UsePackage ¶
UsePackage adds the package to the import map and returns the alias you can use in that Go file. The returned package name will have "." as suffix if it is from a different package than the current one.
Click to show internal directories.
Click to hide internal directories.