internal: make function and struct comments match the names
Change-Id: Id996816dd5552fcf202c283f4a921df9a5d5eeee
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/638777
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/internal/gitrepo/gitrepo.go b/internal/gitrepo/gitrepo.go
index 87cc9c0..e5e36a8 100644
--- a/internal/gitrepo/gitrepo.go
+++ b/internal/gitrepo/gitrepo.go
@@ -33,7 +33,7 @@
return CloneAt(ctx, repoURL, plumbing.HEAD)
}
-// Clone returns a bare repo by cloning the repo at repoURL at the given ref.
+// CloneAt returns a bare repo by cloning the repo at repoURL at the given ref.
func CloneAt(ctx context.Context, repoURL string, ref plumbing.ReferenceName) (repo *git.Repository, err error) {
log.Infof(ctx, "Cloning repo %q at %s", repoURL, ref)
return git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
@@ -103,7 +103,7 @@
return RootAt(repo, head)
}
-// Root returns the root tree of the repo at the given commit.
+// RootAt returns the root tree of the repo at the given commit.
func RootAt(repo *git.Repository, commit *object.Commit) (root *object.Tree, err error) {
return repo.TreeObject(commit.TreeHash)
}
diff --git a/internal/internal.go b/internal/internal.go
index f88d3f6..487ef5f 100644
--- a/internal/internal.go
+++ b/internal/internal.go
@@ -13,7 +13,7 @@
"golang.org/x/vulndb/internal/derrors"
)
-// Readfilelines reads and returns the lines from a file.
+// ReadFileLines reads and returns the lines from a file.
// Whitespace on each line is trimmed.
// Blank lines and lines beginning with '#' are ignored.
func ReadFileLines(filename string) (lines []string, err error) {
diff --git a/internal/report/report.go b/internal/report/report.go
index aa0b19f..4c05860 100644
--- a/internal/report/report.go
+++ b/internal/report/report.go
@@ -489,7 +489,7 @@
return all
}
-// AllPkgs returns all affected packages in a given module.
+// AllPackages returns all affected packages in a given module.
func (m *Module) AllPackages() map[string]*Package {
pkgs := make(map[string]*Package)
for _, pkg := range m.Packages {
diff --git a/internal/worker/store/mem_store.go b/internal/worker/store/mem_store.go
index 2700cb5..f26755d 100644
--- a/internal/worker/store/mem_store.go
+++ b/internal/worker/store/mem_store.go
@@ -82,7 +82,7 @@
return urs, nil
}
-// GetCVE4Record implements store.GetCVE4Record.
+// GetRecord implements store.GetCVE4Record.
func (ms *MemStore) GetRecord(_ context.Context, id string) (Record, error) {
switch {
case idstr.IsGHSA(id):
@@ -132,7 +132,7 @@
ms *MemStore
}
-// SetCVE4Record implements Transaction.SetCVE4Record.
+// SetRecord implements Transaction.SetCVE4Record.
func (tx *memTransaction) SetRecord(r Record) error {
if err := r.Validate(); err != nil {
return err
@@ -198,7 +198,7 @@
}
}
-// GetLegacyGHSARecord implements Transaction.GetLegacyGHSARecord.
+// GetRecord implements Transaction.GetLegacyGHSARecord.
func (tx *memTransaction) GetRecord(id string) (Record, error) {
switch {
case idstr.IsGHSA(id):
diff --git a/internal/worker/store/store.go b/internal/worker/store/store.go
index 5a47e0f..5018d8f 100644
--- a/internal/worker/store/store.go
+++ b/internal/worker/store/store.go
@@ -23,7 +23,7 @@
ID string
// Path is the path to the CVE file in the repo.
Path string
- // Blobhash is the hash of the CVE's blob in repo, for quick change detection.
+ // BlobHash is the hash of the CVE's blob in repo, for quick change detection.
BlobHash string
// CommitHash is the commit of the cvelist repo from which this information came.
CommitHash string
@@ -261,7 +261,7 @@
// If not found, it returns (nil, nil).
GetRecord(id string) (Record, error)
- // GetRecords retrieves records for all CVE IDs between startID and
+ // GetCVE4Records retrieves records for all CVE IDs between startID and
// endID, inclusive.
GetCVE4Records(startID, endID string) ([]*CVE4Record, error)