Skip to content

Commit

Permalink
internal/lsp/command: remove unnecessary json struct tag
Browse files Browse the repository at this point in the history
Different naming style for Vuln type is unnecessary.
And, we can safely assume that ID is not empty.

Change-Id: Ifd43b671c814796af0110bad05642187bb1ea655
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395677
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
hyangah committed Mar 24, 2022
1 parent b7db7eb commit 1e5ae83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions gopls/doc/commands.md
Expand Up @@ -286,16 +286,16 @@ Result:
```
{
"Vuln": []{
"id": string,
"details": string,
"aliases": []string,
"symbol": string,
"pkg_path": string,
"mod_path": string,
"url": string,
"current_version": string,
"fixed_version": string,
"call_stacks": [][]golang.org/x/tools/internal/lsp/command.StackEntry,
"ID": string,
"Details": string,
"Aliases": []string,
"Symbol": string,
"PkgPath": string,
"ModPath": string,
"URL": string,
"CurrentVersion": string,
"FixedVersion": string,
"CallStacks": [][]golang.org/x/tools/internal/lsp/command.StackEntry,
},
}
```
Expand Down
20 changes: 10 additions & 10 deletions internal/lsp/command/interface.go
Expand Up @@ -350,35 +350,35 @@ type StackEntry struct {
type Vuln struct {
// ID is the vulnerability ID (osv.Entry.ID).
// https://ossf.github.io/osv-schema/#id-modified-fields
ID string `json:"id,omitempty"`
ID string
// Details is the description of the vulnerability (osv.Entry.Details).
// https://ossf.github.io/osv-schema/#summary-details-fields
Details string `json:"details,omitempty"`
Details string `json:",omitempty"`
// Aliases are alternative IDs of the vulnerability.
// https://ossf.github.io/osv-schema/#aliases-field
Aliases []string `json:"aliases,omitempty"`
Aliases []string `json:",omitempty"`

// Symbol is the name of the detected vulnerable function or method.
Symbol string `json:"symbol,omitempty"`
Symbol string `json:",omitempty"`
// PkgPath is the package path of the detected Symbol.
PkgPath string `json:"pkg_path,omitempty"`
PkgPath string `json:",omitempty"`
// ModPath is the module path corresponding to PkgPath.
// TODO: how do we specify standard library's vulnerability?
ModPath string `json:"mod_path,omitempty"`
ModPath string `json:",omitempty"`

// URL is the URL for more info about the information.
// Either the database specific URL or the one of the URLs
// included in osv.Entry.References.
URL string `json:"url,omitempty"`
URL string `json:",omitempty"`

// Current is the current module version.
CurrentVersion string `json:"current_version,omitempty"`
CurrentVersion string `json:",omitempty"`

// Fixed is the minimum module version that contains the fix.
FixedVersion string `json:"fixed_version,omitempty"`
FixedVersion string `json:",omitempty"`

// Example call stacks.
CallStacks []CallStack `json:"call_stacks,omitempty"`
CallStacks []CallStack `json:",omitempty"`

// TODO: import graph & module graph.
}
2 changes: 1 addition & 1 deletion internal/lsp/source/api_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1e5ae83

Please sign in to comment.