1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-27 22:28:20 +02:00

Fix some lint warnings

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar
2019-04-30 11:32:06 +02:00
committed by Cosmin Cojocar
parent bac6f0fb8f
commit 3af4ae9ddb
4 changed files with 11 additions and 14 deletions

View File

@@ -77,8 +77,11 @@ func codeSnippet(file *os.File, start int64, end int64, n ast.Node) (string, err
return "", fmt.Errorf("Invalid AST node provided")
}
size := (int)(end - start) // Go bug, os.File.Read should return int64 ...
file.Seek(start, 0) // #nosec
size := (int)(end - start) // Go bug, os.File.Read should return int64 ...
_, err := file.Seek(start, 0) // #nosec
if err != nil {
return "", fmt.Errorf("move to the beginning of file: %v", err)
}
buf := make([]byte, size)
if nread, err := file.Read(buf); err != nil || nread != size {