Fix some gas warnings

This commit is contained in:
Cosmin Cojocar 2018-02-10 20:10:56 +01:00
parent 230d286f4e
commit 7355f0a119
2 changed files with 5 additions and 2 deletions

View file

@ -102,7 +102,10 @@ func (gas *Analyzer) Process(packagePaths ...string) error {
AllowErrors: true,
}
for _, packagePath := range packagePaths {
abspath, _ := filepath.Abs(packagePath)
abspath, err := filepath.Abs(packagePath)
if err != nil {
return err
}
gas.logger.Println("Searching directory:", abspath)
basePackage, err := build.Default.ImportDir(packagePath, build.ImportComment)

View file

@ -76,7 +76,7 @@ func codeSnippet(file *os.File, start int64, end int64, n ast.Node) (string, err
}
size := (int)(end - start) // Go bug, os.File.Read should return int64 ...
file.Seek(start, 0)
file.Seek(start, 0) // #nosec
buf := make([]byte, size)
if nread, err := file.Read(buf); err != nil || nread != size {