mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 20:53:56 +02:00
Fix some gas warnings
This commit is contained in:
parent
230d286f4e
commit
7355f0a119
@ -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)
|
||||
|
2
issue.go
2
issue.go
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user