report: moved to internal/report
Package report is moved to internal/report, since that package is only
used by the vulndb module.
Change-Id: I773f6e00f4d99327ba65a28f8ba7ba4ed24d5bd6
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/355269
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
diff --git a/README.md b/README.md
index 40e8679..0912eff 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,6 @@
Some of these packages can probably be coalesced, but for now are easier to work
on in a more segmented fashion.
-* `report` provides a package for parsing and linting YAML reports
* `osv` provides a package for generating OSV-style JSON vulnerability entries
from a `report.Report`
* `client` contains a client for accessing HTTP/fs based vulnerability
diff --git a/cmd/gendb/main.go b/cmd/gendb/main.go
index 36c20c0..0d175a4 100644
--- a/cmd/gendb/main.go
+++ b/cmd/gendb/main.go
@@ -14,8 +14,8 @@
"reflect"
"strings"
+ "golang.org/x/vulndb/internal/report"
"golang.org/x/vulndb/osv"
- "golang.org/x/vulndb/report"
"gopkg.in/yaml.v2"
)
diff --git a/cmd/genhtml/main.go b/cmd/genhtml/main.go
index c2c4ccc..aa00048 100644
--- a/cmd/genhtml/main.go
+++ b/cmd/genhtml/main.go
@@ -14,7 +14,7 @@
"sort"
"strings"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
"gopkg.in/yaml.v2"
)
diff --git a/cmd/linter/main.go b/cmd/linter/main.go
index 09e019a..803aee3 100644
--- a/cmd/linter/main.go
+++ b/cmd/linter/main.go
@@ -9,7 +9,7 @@
"io/ioutil"
"os"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
"gopkg.in/yaml.v2"
)
diff --git a/cmd/report2cve/main.go b/cmd/report2cve/main.go
index e4c8973..4f3f588 100644
--- a/cmd/report2cve/main.go
+++ b/cmd/report2cve/main.go
@@ -7,13 +7,12 @@
import (
"encoding/json"
"errors"
- "flag"
"fmt"
"io/ioutil"
"os"
"strings"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
"gopkg.in/yaml.v2"
)
@@ -213,14 +212,8 @@
}
func main() {
- flag.Usage = func() {
- fmt.Fprintf(flag.CommandLine.Output(), "usage: report2cve GO-YYYY-NNNN.yaml\n")
- fmt.Fprintf(flag.CommandLine.Output(), " Create a CVE report from a file with the name structure GO-YYYY-NNNN.yaml in the reports/ directory.\n")
- flag.PrintDefaults()
- }
- flag.Parse()
- if flag.NArg() != 2 {
- flag.Usage()
+ if len(os.Args) != 2 {
+ fmt.Fprint(os.Stderr, "usage: report2cve report.yaml")
os.Exit(1)
}
diff --git a/report/lint.go b/internal/report/lint.go
similarity index 100%
rename from report/lint.go
rename to internal/report/lint.go
diff --git a/report/report.go b/internal/report/report.go
similarity index 95%
rename from report/report.go
rename to internal/report/report.go
index a400a00..2c21af9 100644
--- a/report/report.go
+++ b/internal/report/report.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// Package report contains functionality for parsing and linting YAML reports
+// in reports/.
package report
import "time"
diff --git a/lint_test.go b/lint_test.go
index 10460eb..4a4d217 100644
--- a/lint_test.go
+++ b/lint_test.go
@@ -11,7 +11,7 @@
"strings"
"testing"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
"gopkg.in/yaml.v2"
)
diff --git a/osv/json.go b/osv/json.go
index fa7e5bd..5577937 100644
--- a/osv/json.go
+++ b/osv/json.go
@@ -16,7 +16,7 @@
"time"
"golang.org/x/mod/semver"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
)
// DBIndex contains a mapping of vulnerable packages to the
diff --git a/osv/json_test.go b/osv/json_test.go
index d55d5ca..9ef2a05 100644
--- a/osv/json_test.go
+++ b/osv/json_test.go
@@ -11,7 +11,7 @@
"time"
"github.com/google/go-cmp/cmp"
- "golang.org/x/vulndb/report"
+ "golang.org/x/vulndb/internal/report"
)
func TestGenerate(t *testing.T) {