Versions in this module Expand all Collapse all v1 v1.0.0 Nov 6, 2022 Changes in this version + func FormatCodeFromParser(p *Parser, dst io.Writer, opts ...FormatOptions) error + func FormatCodeFromSource(src []byte) ([]byte, error) + func GetGoModuleNameFromDir(dir string) string + func GoBin() string + func GoInstall(repository string) error + func GoModCachePath() string + func GoModFilePath() string + func GoModName() string + func GoModPath() string + func GoPath() string + func GoProxy() string + func GoRoot() string + func GoVersion() string + func ImportPathForDir(dir string) (res string) + func IsGO111ModuleOn() bool + func IsGoFile(path string) bool + func IsGoModProject() bool + func IsInvalidPackageName(pkg string) bool + func IsValidPackageName(pkg string) bool + func NameForDir(dir string) string + func NormalizeVendor(pkg string) string + func QualifyPackagePath(importPath string) string + func RefPathToGoModPath(path string) string + func RemoveUnusedImports(parser *Parser) + func SanitizePackageName(pkg string) string + func SortImports(parser *Parser) + type FormatOptions func(opt *imports.Options) + func WithAllErrors(allErrors bool) FormatOptions + func WithComments(comments bool) FormatOptions + func WithFormatOnly(formatOnly bool) FormatOptions + func WithFragment(fragment bool) FormatOptions + func WithOptions(opts imports.Options) FormatOptions + func WithTabIndent(tabIndent bool) FormatOptions + func WithTabWidth(tabWidth int) FormatOptions + type ImportSpec struct + Name string + Path string + func CollectImports(parser *Parser) []*ImportSpec + func NewImport(name, path string) *ImportSpec + func SimpleImport(path string) *ImportSpec + func (s *ImportSpec) Code() string + type Node struct + type Parser struct + func MustParser(p *Parser, err error) *Parser + func NewParser(filename string, src any, mode parser.Mode) (*Parser, error) + func (p *Parser) File() *ast.File + func (p *Parser) FileSet() *token.FileSet