forked from mirror/pkger
verbs
This commit is contained in:
parent
b24faf1070
commit
ec8c803b27
|
@ -40,7 +40,7 @@ func (decls Decls) Files() ([]*File, error) {
|
|||
|
||||
files, err := fl.Files(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %s", err, d)
|
||||
return nil, fmt.Errorf("%s: %s", err, d)
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
|
|
|
@ -100,19 +100,19 @@ func (p *Parser) ParseDir(abs string, mode parser.Mode) ([]*ParsedSource, error)
|
|||
|
||||
her, err := here.Dir(abs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: here.Dir failed %s", err, abs)
|
||||
return nil, fmt.Errorf("%s: here.Dir failed %s", err, abs)
|
||||
}
|
||||
|
||||
pt, err := her.Parse(strings.TrimPrefix(abs, filepath.Dir(abs)))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: here.Parse failed %s", err, abs)
|
||||
return nil, fmt.Errorf("%s: here.Parse failed %s", err, abs)
|
||||
}
|
||||
|
||||
fset := token.NewFileSet()
|
||||
|
||||
pkgs, err := parser.ParseDir(fset, abs, nil, 0)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: ParseDir failed %s", err, abs)
|
||||
return nil, fmt.Errorf("%s: ParseDir failed %s", err, abs)
|
||||
}
|
||||
|
||||
var srcs []*ParsedSource
|
||||
|
@ -205,13 +205,13 @@ func (p *Parser) parse() error {
|
|||
|
||||
srcs, err := p.ParseDir(path, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %s", err, path)
|
||||
return fmt.Errorf("%s: %s", err, path)
|
||||
}
|
||||
|
||||
for _, src := range srcs {
|
||||
mm, err := src.DeclsMap()
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %s", err, src.Abs)
|
||||
return fmt.Errorf("%s: %s", err, src.Abs)
|
||||
}
|
||||
for k, v := range mm {
|
||||
p.decls[k] = append(p.decls[k], v...)
|
||||
|
|
|
@ -140,26 +140,26 @@ func (p *ParsedSource) parse() error {
|
|||
n := ce.Args[0]
|
||||
val, err := p.value(n)
|
||||
if err != nil {
|
||||
p.err = fmt.Errorf("%w: %s", err, n)
|
||||
p.err = fmt.Errorf("%s: %s", err, n)
|
||||
return false
|
||||
}
|
||||
|
||||
info, err := here.Dir(filepath.Dir(p.Abs))
|
||||
if err != nil {
|
||||
p.err = fmt.Errorf("%w: %s", err, p.Abs)
|
||||
p.err = fmt.Errorf("%s: %s", err, p.Abs)
|
||||
return false
|
||||
}
|
||||
|
||||
pt, err := info.Parse(val)
|
||||
if err != nil {
|
||||
p.err = fmt.Errorf("%w: %s", err, p.Abs)
|
||||
p.err = fmt.Errorf("%s: %s", err, p.Abs)
|
||||
return false
|
||||
}
|
||||
|
||||
if pt.Pkg != info.Module.Path {
|
||||
info, err = here.Package(pt.Pkg)
|
||||
if err != nil {
|
||||
p.err = fmt.Errorf("%w: %s", err, p.Abs)
|
||||
p.err = fmt.Errorf("%s: %s", err, p.Abs)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue