From 7355f0a119e7fc2a0adc83c19d443cfeaca6c736 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Sat, 10 Feb 2018 20:10:56 +0100 Subject: [PATCH] Fix some gas warnings --- analyzer.go | 5 ++++- issue.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/analyzer.go b/analyzer.go index e336869..b7a5e8f 100644 --- a/analyzer.go +++ b/analyzer.go @@ -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) diff --git a/issue.go b/issue.go index 1060f43..2113529 100644 --- a/issue.go +++ b/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 {