- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 486 for parseDir (0.14 sec)
-
test/stress/parsego.go
!strings.HasSuffix(dir.Name(), "_test.go") // ignore test files } func pkgName(filename string) string { file, err := parser.ParseFile(token.NewFileSet(), filename, nil, parser.PackageClauseOnly) if err != nil || file == nil { return "" } return file.Name.Name } func parseDir(dirpath string) map[string]*ast.Package { // the package name is the directory name within its parent.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 02 13:43:18 UTC 2016 - 4.1K bytes - Viewed (0) -
src/go/parser/testdata/issue42951/not_a_file.go/invalid.go
This file should not be parsed by ParseDir....
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Dec 02 23:05:56 UTC 2020 - 44 bytes - Viewed (0) -
src/go/doc/headscan.go
flag.Parse() fset := token.NewFileSet() nheadings := 0 err := filepath.WalkDir(*root, func(path string, info fs.DirEntry, err error) error { if !info.IsDir() { return nil } pkgs, err := parser.ParseDir(fset, path, isGoFile, parser.ParseComments) if err != nil { if *verbose { fmt.Fprintln(os.Stderr, err) } return nil } for _, pkg := range pkgs { d := doc.New(pkg, path, doc.Mode(0))
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 06 21:50:52 UTC 2022 - 2.5K bytes - Viewed (0) -
src/go/parser/parser_test.go
} } func TestParseDir(t *testing.T) { path := "." pkgs, err := ParseDir(token.NewFileSet(), path, dirFilter, 0) if err != nil { t.Fatalf("ParseDir(%s): %v", path, err) } if n := len(pkgs); n != 1 { t.Errorf("got %d packages; want 1", n) } pkg := pkgs["parser"] if pkg == nil { t.Errorf(`package "parser" not found`) return } if n := len(pkg.Files); n != 3 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 31 20:26:14 UTC 2024 - 24.6K bytes - Viewed (0) -
src/go/parser/interface.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the exported entry points for invoking the parser. package parser import ( "bytes" "errors" "go/ast" "go/token" "io" "io/fs" "os" "path/filepath" "strings" ) // If src != nil, readSource converts src to a []byte if possible;
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 12:02:03 UTC 2023 - 7.5K bytes - Viewed (0) -
src/internal/reflectlite/reflect_mirror_test.go
} return v } func loadTypes(path, pkgName string, v visitor) { fset := token.NewFileSet() filter := func(fi fs.FileInfo) bool { return strings.HasSuffix(fi.Name(), ".go") } pkgs, err := parser.ParseDir(fset, path, filter, 0) if err != nil { panic(err) } pkg := pkgs[pkgName] for _, f := range pkg.Files { ast.Walk(v, f) } } func TestMirrorWithReflect(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 19 21:11:15 UTC 2024 - 2.8K bytes - Viewed (0) -
src/go/doc/comment_test.go
// license that can be found in the LICENSE file. package doc import ( "bytes" "go/parser" "go/token" "internal/diff" "testing" ) func TestComment(t *testing.T) { fset := token.NewFileSet() pkgs, err := parser.ParseDir(fset, "testdata/pkgdoc", nil, parser.ParseComments) if err != nil { t.Fatal(err) } if pkgs["pkgdoc"] == nil { t.Fatal("missing package pkgdoc") }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Nov 10 06:33:18 UTC 2022 - 3K bytes - Viewed (0) -
src/go/types/gotype.go
errorCount = 0 sequential = false parserMode parser.Mode ) func initParserMode() { if *allErrors { parserMode |= parser.AllErrors } if *printAST { sequential = true } if *printTrace { parserMode |= parser.Trace sequential = true } if *parseComments && (*printAST || *printTrace) { parserMode |= parser.ParseComments } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Nov 18 17:59:44 UTC 2022 - 8.3K bytes - Viewed (0) -
cmd/preferredimports/preferredimports.go
func (a *analyzer) collect(dir string) { if _, ok := a.donePaths[dir]; ok { return } a.donePaths[dir] = nil // Create the AST by parsing src. fs, err := parser.ParseDir(a.fset, dir, nil, parser.AllErrors|parser.ParseComments) if err != nil { fmt.Fprintln(os.Stderr, "ERROR(syntax)", logPrefix, err) a.failed = true return } for _, p := range fs {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Mar 01 06:06:44 UTC 2024 - 7.1K bytes - Viewed (0) -
src/runtime/align_test.go
// that the tables used by the code above are exhaustive. // Parse the whole runtime package, checking that arguments of // appropriate atomic operations are in the list above. fset := token.NewFileSet() m, err := parser.ParseDir(fset, ".", nil, 0) if err != nil { t.Fatalf("parsing runtime failed: %v", err) } pkg := m["runtime"] // Note: ignore runtime_test and main packages
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 08 14:52:12 UTC 2023 - 5.4K bytes - Viewed (0)