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

Refactor AppendError to check for build.NoGoError (#1273)

This commit is contained in:
Oleksandr Redko
2024-12-19 12:55:12 +02:00
committed by GitHub
parent 9a2d74ffe0
commit 36c81ed69b
2 changed files with 8 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ package gosec_test
import (
"errors"
"go/build"
"log"
"regexp"
"strings"
@@ -1311,7 +1312,10 @@ var _ = Describe("Analyzer", func() {
Context("when appending errors", func() {
It("should skip error for non-buildable packages", func() {
analyzer.AppendError("test", errors.New(`loading file from package "pkg/test": no buildable Go source files in pkg/test`))
err := &build.NoGoError{
Dir: "pkg/test",
}
analyzer.AppendError("test", err)
_, _, errors := analyzer.Report()
Expect(errors).To(BeEmpty())
})