setup typecheck error file if it's empty
This commit is contained in:
parent
27752e81a7
commit
7278b7ae8a
@ -31,6 +31,16 @@ func ExtractErrors(pkg *packages.Package) []packages.Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some errors like "code in directory expects import" don't have Pos, set it here
|
||||||
|
if len(pkg.GoFiles) != 0 {
|
||||||
|
for i := range uniqErrors {
|
||||||
|
err := &uniqErrors[i]
|
||||||
|
if err.Pos == "" {
|
||||||
|
err.Pos = fmt.Sprintf("%s:1", pkg.GoFiles[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return uniqErrors
|
return uniqErrors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,10 @@ func (p *AutogeneratedExclude) getOrCreateFileSummary(i *result.Issue) (*ageFile
|
|||||||
fs = &ageFileSummary{}
|
fs = &ageFileSummary{}
|
||||||
p.fileSummaryCache[i.FilePath()] = fs
|
p.fileSummaryCache[i.FilePath()] = fs
|
||||||
|
|
||||||
|
if i.FilePath() == "" {
|
||||||
|
return nil, fmt.Errorf("no file path for issue")
|
||||||
|
}
|
||||||
|
|
||||||
f := p.astCache.GetOrParse(i.FilePath(), nil)
|
f := p.astCache.GetOrParse(i.FilePath(), nil)
|
||||||
if f.Err != nil {
|
if f.Err != nil {
|
||||||
return nil, fmt.Errorf("can't parse file %s: %s", i.FilePath(), f.Err)
|
return nil, fmt.Errorf("can't parse file %s: %s", i.FilePath(), f.Err)
|
||||||
|
@ -83,6 +83,10 @@ func (p *Nolint) getOrCreateFileData(i *result.Issue) (*fileData, error) {
|
|||||||
fd = &fileData{}
|
fd = &fileData{}
|
||||||
p.cache[i.FilePath()] = fd
|
p.cache[i.FilePath()] = fd
|
||||||
|
|
||||||
|
if i.FilePath() == "" {
|
||||||
|
return nil, fmt.Errorf("no file path for issue")
|
||||||
|
}
|
||||||
|
|
||||||
file := p.astCache.GetOrParse(i.FilePath(), nil)
|
file := p.astCache.GetOrParse(i.FilePath(), nil)
|
||||||
if file.Err != nil {
|
if file.Err != nil {
|
||||||
return nil, fmt.Errorf("can't parse file %s: %s", i.FilePath(), file.Err)
|
return nil, fmt.Errorf("can't parse file %s: %s", i.FilePath(), file.Err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user