From 1795d15837a6230a6ef27576d3b5cfe810ecdfc8 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 1 Oct 2020 08:57:04 +0000 Subject: [PATCH] Add missing error handling It looks like these checks were just forgotten. Should we intentionally ignore errors here, we should probably unassign err. --- parser/parser.go | 3 +++ pkging/pkgutil/stuff.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/parser/parser.go b/parser/parser.go index 72fd023..66c2109 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -84,6 +84,9 @@ func (p *Parser) ParseFile(abs string, mode parser.Mode) (*ParsedSource, error) } s.Path, err = s.Here.Parse(strings.TrimPrefix(abs, dir)) + if err != nil { + return nil, err + } return p.ParseSource(s, 0) } diff --git a/pkging/pkgutil/stuff.go b/pkging/pkgutil/stuff.go index 0fbf02d..1169a30 100644 --- a/pkging/pkgutil/stuff.go +++ b/pkging/pkgutil/stuff.go @@ -57,5 +57,5 @@ func Stuff(w io.Writer, c here.Info, decls parser.Decls) error { } _, err = w.Write(b) - return nil + return err }