Skip to content

Commit

Permalink
all: remove test that runs govulncheck on govulncheck
Browse files Browse the repository at this point in the history
The only interesting vulnerabilities this test can find are stdlib ones.
We cannot really do much about those. On the other hand, whoever is
developing this module on a go version that is not the latest patch or
top will see a failure. This is annoying so we remove the test.

Change-Id: I3236393354565eb9d682075948330b0612434606
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/589235
Reviewed-by: Maceo Thompson <maceothompson@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
zpavlinovic committed Jun 3, 2024
1 parent c68e251 commit b6af818
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ package main

import (
"bufio"
"bytes"
"context"
"errors"
"io/fs"
"os"
Expand All @@ -21,7 +19,6 @@ import (

"golang.org/x/mod/modfile"
"golang.org/x/vuln/internal/testenv"
"golang.org/x/vuln/scan"
)

// excluded contains the set of modules that x/vuln should not depend on.
Expand Down Expand Up @@ -55,33 +52,6 @@ func TestDependencies(t *testing.T) {
}
}

func TestGovulncheck(t *testing.T) {
skipIfShort(t)
testenv.NeedsGoBuild(t)

var o string
out := bytes.NewBufferString(o)
ctx := context.Background()

cmd := scan.Command(ctx, "./...")
cmd.Stdout = out
cmd.Stderr = out
err := cmd.Start()
if err == nil {
err = cmd.Wait()
}

t.Logf("govulncheck finished with std out/err:\n%s", out.String())
switch err := err.(type) {
case nil:
t.Log("govulncheck: no vulnerabilities detected")
case interface{ ExitCode() int }:
t.Errorf("govulncheck: unexpected exit code %d and error %v", err.ExitCode(), err)
default:
t.Errorf("govulncheck: abruptly failed with error %v", err)
}
}

func TestVet(t *testing.T) {
rungo(t, "vet", "-all", "./...")
}
Expand Down

0 comments on commit b6af818

Please sign in to comment.