Documentation ¶
Index ¶
- Constants
- Variables
- func BuildContext(mx *mg.Ctx) *build.Context
- func BuildContextWithoutCallbacks(mx *mg.Ctx) *build.Context
- func ClosestPkgDir(dir string) *vfs.Node
- func ClosestPkgDirNd(nd *vfs.Node) *vfs.Node
- func Dedent(s string) string
- func DedentCompletion(s string) string
- func HasImportPath(root, dir string) (importPath string, ok bool)
- func IdentAt(af *ast.File, pos token.Pos) *ast.Ident
- func IsLetter(ch rune) bool
- func IsPkgDir(dir string) bool
- func IsPkgDirNd(nd *vfs.Node) bool
- func ModEnabled(mx *mg.Ctx, srcDir string) bool
- func ModFileNd(mx *mg.Ctx, srcDir string) *vfs.Node
- func NodeEnclosesPos(node ast.Node, pos token.Pos) bool
- func PathList(p string) []string
- func PkgNdFilter(nd *vfs.Node) bool
- type ParsedFile
- type PosEnd
- type ReleaseVersion
- type SrcDirKey
Constants ¶
View Source
const (
ModEnvVar = "GO111MODULE"
)
View Source
const (
ParseFileMode = parser.ParseComments | parser.DeclarationErrors | parser.AllErrors
)
Variables ¶
View Source
var ( NilPkgName = "_" NilFset = token.NewFileSet() NilPkgSrc = "\n\npackage " + NilPkgName + "\n" NilAstFile, _ = parser.ParseFile(NilFset, "", NilPkgSrc, 0) NilTokenFile = NilFset.File(NilAstFile.Pos()) )
View Source
var ( VersionTag string = build.Default.ReleaseTags[len(build.Default.ReleaseTags)-1] Version ReleaseVersion = func() ReleaseVersion { s := strings.TrimPrefix(VersionTag, "go") l := strings.SplitN(s, ".", 2) v := ReleaseVersion{} v.Major, _ = strconv.Atoi(l[0]) v.Minor, _ = strconv.Atoi(l[1]) return v }() )
Functions ¶
func ClosestPkgDir ¶
func DedentCompletion ¶
DedentCompletion Dedents s then trims preceding and succeeding empty lines.
func HasImportPath ¶
HasImportPath reports whether dir is lexically a subdirectory of root. If so, it sets importPath to a slash-separated path that can be joined to root to produce a path equivalent to dir.
HasImportPath is an implementation of go/build.Context.HasSubdir
func IsPkgDirNd ¶
func ModEnabled ¶
ModEnabled returns true of Go modules are enabled in srcDir
func PkgNdFilter ¶
Types ¶
type ParsedFile ¶
type ParsedFile struct { Fset *token.FileSet AstFile *ast.File TokenFile *token.File Error error ErrorList scanner.ErrorList }
func ParseFileWithMode ¶
type ReleaseVersion ¶
Click to show internal directories.
Click to hide internal directories.