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:
committed by
Cosmin Cojocar
parent
bac6f0fb8f
commit
3af4ae9ddb
7
issue.go
7
issue.go
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user