mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 07:29:00 -08:00
chore: bump golangci-lint from v1.58 to v1.59 (#7077)
Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
id: lint
|
id: lint
|
||||||
uses: golangci/golangci-lint-action@v6.0.1
|
uses: golangci/golangci-lint-action@v6.0.1
|
||||||
with:
|
with:
|
||||||
version: v1.58
|
version: v1.59
|
||||||
args: --verbose --out-format=line-number
|
args: --verbose --out-format=line-number
|
||||||
if: matrix.operating-system == 'ubuntu-latest-m'
|
if: matrix.operating-system == 'ubuntu-latest-m'
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ func AssertRuleFound(t *testing.T, ruleID string, results scan.Results, message
|
|||||||
meta := &m
|
meta := &m
|
||||||
for meta != nil {
|
for meta != nil {
|
||||||
assert.NotNil(t, meta.Range(), 0)
|
assert.NotNil(t, meta.Range(), 0)
|
||||||
assert.Greater(t, meta.Range().GetStartLine(), 0)
|
assert.Positive(t, meta.Range().GetStartLine())
|
||||||
assert.Greater(t, meta.Range().GetEndLine(), 0)
|
assert.Positive(t, meta.Range().GetEndLine())
|
||||||
meta = meta.Parent()
|
meta = meta.Parent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func (Tool) Wire() error {
|
|||||||
|
|
||||||
// GolangciLint installs golangci-lint
|
// GolangciLint installs golangci-lint
|
||||||
func (t Tool) GolangciLint() error {
|
func (t Tool) GolangciLint() error {
|
||||||
const version = "v1.58.2"
|
const version = "v1.59.1"
|
||||||
bin := filepath.Join(GOBIN, "golangci-lint")
|
bin := filepath.Join(GOBIN, "golangci-lint")
|
||||||
if exists(bin) && t.matchGolangciLintVersion(bin, version) {
|
if exists(bin) && t.matchGolangciLintVersion(bin, version) {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func TestDownload(t *testing.T) {
|
|||||||
// Set up a test server with a self-signed certificate
|
// Set up a test server with a self-signed certificate
|
||||||
server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
_, err := w.Write([]byte("test content"))
|
_, err := w.Write([]byte("test content"))
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}))
|
}))
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ func TestArtifact_inspectOCIReferrerSBOM(t *testing.T) {
|
|||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case "/v2":
|
case "/v2":
|
||||||
_, err := w.Write([]byte("ok"))
|
_, err := w.Write([]byte("ok"))
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
case "/v2/test/image/referrers/sha256:782143e39f1e7a04e3f6da2d88b1c057e5657363c4f90679f3e8a071b7619e02":
|
case "/v2/test/image/referrers/sha256:782143e39f1e7a04e3f6da2d88b1c057e5657363c4f90679f3e8a071b7619e02":
|
||||||
http.ServeFile(w, r, "testdata/index.json")
|
http.ServeFile(w, r, "testdata/index.json")
|
||||||
case "/v2/test/image/manifests/sha256:37c89af4907fa0af078aeba12d6f18dc0c63937c010030baaaa88e958f0719a5":
|
case "/v2/test/image/manifests/sha256:37c89af4907fa0af078aeba12d6f18dc0c63937c010030baaaa88e958f0719a5":
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func Test_OptionWithDebugWriter(t *testing.T) {
|
|||||||
_ = scanWithOptions(t, `
|
_ = scanWithOptions(t, `
|
||||||
resource "something" "else" {}
|
resource "something" "else" {}
|
||||||
`, scannerOpts...)
|
`, scannerOpts...)
|
||||||
require.Greater(t, buffer.Len(), 0)
|
require.Positive(t, buffer.Len())
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_OptionWithPolicyDirs(t *testing.T) {
|
func Test_OptionWithPolicyDirs(t *testing.T) {
|
||||||
@@ -217,7 +217,11 @@ func Test_OptionWithPolicyNamespaces(t *testing.T) {
|
|||||||
wantFailure: true,
|
wantFailure: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
includedNamespaces: []string{"a", "users", "b"},
|
includedNamespaces: []string{
|
||||||
|
"a",
|
||||||
|
"users",
|
||||||
|
"b",
|
||||||
|
},
|
||||||
policyNamespace: "users",
|
policyNamespace: "users",
|
||||||
wantFailure: true,
|
wantFailure: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func TestManager_Update(t *testing.T) {
|
|||||||
|
|
||||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
_, err := w.Write([]byte(`this is index`))
|
_, err := w.Write([]byte(`this is index`))
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}))
|
}))
|
||||||
t.Cleanup(ts.Close)
|
t.Cleanup(ts.Close)
|
||||||
|
|
||||||
|
|||||||
@@ -70,11 +70,11 @@ func TestManager_Install(t *testing.T) {
|
|||||||
zr := zip.NewWriter(w)
|
zr := zip.NewWriter(w)
|
||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case "/test_plugin.zip":
|
case "/test_plugin.zip":
|
||||||
require.NoError(t, zr.AddFS(os.DirFS("testdata/test_plugin/test_plugin")))
|
assert.NoError(t, zr.AddFS(os.DirFS("testdata/test_plugin/test_plugin")))
|
||||||
case "/test_nested.zip":
|
case "/test_nested.zip":
|
||||||
require.NoError(t, zr.AddFS(os.DirFS("testdata/test_plugin")))
|
assert.NoError(t, zr.AddFS(os.DirFS("testdata/test_plugin")))
|
||||||
}
|
}
|
||||||
require.NoError(t, zr.Close())
|
assert.NoError(t, zr.Close())
|
||||||
}))
|
}))
|
||||||
t.Cleanup(ts.Close)
|
t.Cleanup(ts.Close)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common"
|
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/sigstore/rekor/pkg/generated/models"
|
"github.com/sigstore/rekor/pkg/generated/models"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/aquasecurity/trivy/pkg/attestation"
|
"github.com/aquasecurity/trivy/pkg/attestation"
|
||||||
)
|
)
|
||||||
@@ -316,19 +316,19 @@ func NewServer(t *testing.T) *Server {
|
|||||||
case "/api/v1/index/retrieve":
|
case "/api/v1/index/retrieve":
|
||||||
var params models.SearchIndex
|
var params models.SearchIndex
|
||||||
err := json.NewDecoder(r.Body).Decode(¶ms)
|
err := json.NewDecoder(r.Body).Decode(¶ms)
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
if res, ok := indexRes[params.Hash]; ok {
|
if res, ok := indexRes[params.Hash]; ok {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
err = json.NewEncoder(w).Encode(res)
|
err = json.NewEncoder(w).Encode(res)
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, "something wrong", http.StatusNotFound)
|
http.Error(w, "something wrong", http.StatusNotFound)
|
||||||
}
|
}
|
||||||
case "/api/v1/log/entries/retrieve":
|
case "/api/v1/log/entries/retrieve":
|
||||||
var params models.SearchLogQuery
|
var params models.SearchLogQuery
|
||||||
err := json.NewDecoder(r.Body).Decode(¶ms)
|
err := json.NewDecoder(r.Body).Decode(¶ms)
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
resEntries := models.LogEntry{}
|
resEntries := models.LogEntry{}
|
||||||
for _, uuid := range params.EntryUUIDs {
|
for _, uuid := range params.EntryUUIDs {
|
||||||
@@ -341,7 +341,7 @@ func NewServer(t *testing.T) *Server {
|
|||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
err = json.NewEncoder(w).Encode([]models.LogEntry{resEntries})
|
err = json.NewEncoder(w).Encode([]models.LogEntry{resEntries})
|
||||||
require.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user