- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 36 for importSpec (0.25 sec)
-
src/cmd/fix/gotypes.go
// First find the import spec. var importSpec *ast.ImportSpec walk(f, func(n any) { if importSpec != nil { return } spec, ok := n.(*ast.ImportSpec) if !ok { return } path, err := strconv.Unquote(spec.Path.Value) if err != nil { return } if path == "golang.org/x/tools/go/exact" { importSpec = spec } }) if importSpec == nil { return false }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 1.7K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/ast/astutil/imports.go
func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { var groups [][]*ast.ImportSpec for _, decl := range f.Decls { genDecl, ok := decl.(*ast.GenDecl) if !ok || genDecl.Tok != token.IMPORT { break } group := []*ast.ImportSpec{} var lastLine int for _, spec := range genDecl.Specs { importSpec := spec.(*ast.ImportSpec) pos := importSpec.Path.ValuePos line := fset.Position(pos).Line
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 10 21:56:21 UTC 2022 - 13.4K bytes - Viewed (0) -
src/go/ast/import.go
} func importPath(s Spec) string { t, err := strconv.Unquote(s.(*ImportSpec).Path.Value) if err == nil { return t } return "" } func importName(s Spec) string { n := s.(*ImportSpec).Name if n == nil { return "" } return n.Name } func importComment(s Spec) string { c := s.(*ImportSpec).Comment if c == nil { return "" } return c.Text() }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 5.7K bytes - Viewed (0) -
src/cmd/fix/fix.go
} } after(x) } // imports reports whether f imports path. func imports(f *ast.File, path string) bool { return importSpec(f, path) != nil } // importSpec returns the import spec if f imports path, // or nil otherwise. func importSpec(f *ast.File, path string) *ast.ImportSpec { for _, s := range f.Imports { if importPath(s) == path { return s } } return nil }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 14.6K bytes - Viewed (0) -
src/go/ast/commentmap_test.go
var res = map[string]string{ " 5: *ast.File": "the very first comment\npackage p\n", " 5: *ast.Ident": " the name is p\n", " 8: *ast.GenDecl": "imports\n", " 9: *ast.ImportSpec": "bytes\n", "10: *ast.ImportSpec": "fmt\n", "16: *ast.GenDecl": "T\nalso associated with T\n", "17: *ast.Field": "associated with a, b, c\n", "19: *ast.Field": "associated with x, y\nfloat values\n",
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 09 15:35:30 UTC 2022 - 3.9K bytes - Viewed (0) -
src/go/doc/example.go
func findImportGroupStarts(imps []*ast.ImportSpec) []token.Pos { startImps := findImportGroupStarts1(imps) groupStarts := make([]token.Pos, len(startImps)) for i, imp := range startImps { groupStarts[i] = imp.Pos() } return groupStarts } // Helper for findImportGroupStarts to ease testing. func findImportGroupStarts1(origImps []*ast.ImportSpec) []*ast.ImportSpec { // Copy to avoid mutation.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 21.4K bytes - Viewed (0) -
src/cmd/cgo/ast.go
sawC := false for _, decl := range ast1.Decls { switch decl := decl.(type) { case *ast.GenDecl: for _, spec := range decl.Specs { s, ok := spec.(*ast.ImportSpec) if !ok || s.Path.Value != `"C"` { continue } sawC = true if s.Name != nil { error_(s.Path.Pos(), `cannot rename import "C"`) } cg := s.Doc
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jun 07 16:54:27 UTC 2023 - 14.3K bytes - Viewed (0) -
src/go/ast/ast.go
// constant, type, or variable declaration. type ( // The Spec type stands for any of *ImportSpec, *ValueSpec, and *TypeSpec. Spec interface { Node specNode() } // An ImportSpec node represents a single package import. ImportSpec struct { Doc *CommentGroup // associated documentation; or nil Name *Ident // local package name (including "."); or nil
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 28 21:32:41 UTC 2024 - 35.6K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go
case *ast.Ident: children = append(children, tok(n.NamePos, len(n.Name))) case *ast.IfStmt: children = append(children, tok(n.If, len("if"))) case *ast.ImportSpec: // TODO(adonovan): ImportSpec.{Doc,EndPos}? case *ast.IncDecStmt: children = append(children, tok(n.TokPos, len(n.Tok.String()))) case *ast.IndexExpr: children = append(children,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 18 21:28:13 UTC 2023 - 15.9K bytes - Viewed (0) -
api/go1.22.txt
pkg go/types, method (*Alias) String() string #63223 pkg go/types, method (*Alias) Underlying() Type #63223 pkg go/types, method (*Info) PkgNameOf(*ast.ImportSpec) *PkgName #62037 pkg go/types, method (Checker) PkgNameOf(*ast.ImportSpec) *PkgName #62037 pkg go/types, type Alias struct #63223 pkg go/types, type Info struct, FileVersions map[*ast.File]string #62605 pkg go/version, func Compare(string, string) int #62039
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 24 20:54:27 UTC 2024 - 7.7K bytes - Viewed (0)