Documentation
¶
Overview ¶
Package govulncheck provides functionality to support the govulncheck command.
Index ¶
- Variables
- func AbsRelShorter(path string) string
- func Flush(h govulncheck.Handler) error
- func FuncName(frame *govulncheck.StackFrame) string
- func IsCalled(v *govulncheck.Vuln) bool
- func NewTextHandler(w io.Writer, source, verbose bool) govulncheck.Handler
- func Pos(sf *govulncheck.StackFrame) string
- type Cmd
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVulnerabilitiesFound indicates that vulnerabilities were detected // when running govulncheck. This returns exit status 3 when running // without the -json flag. ErrVulnerabilitiesFound = errors.New("vulnerabilities found") // ErrNoPatterns indicates that no patterns were passed in when running // govulncheck. // // In this case, we assume that the user does not know how to run // govulncheck, and print the usage message with exit status 1. ErrNoPatterns = errors.New("no patterns provided") )
var LoadMode = packages.NeedName | packages.NeedImports | packages.NeedTypes | packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedDeps | packages.NeedModule
LoadMode is the level of information needed for each package for running golang.org/x/tools/go/packages.Load.
Functions ¶
func AbsRelShorter ¶
AbsRelShorter takes path and returns its path relative to the current directory, if shorter. Returns path when path is an empty string or upon any error.
func Flush ¶
func Flush(h govulncheck.Handler) error
func FuncName ¶
func FuncName(frame *govulncheck.StackFrame) string
FuncName returns the full qualified function name from a stack frame, adjusted to remove pointer annotations.
func IsCalled ¶
func IsCalled(v *govulncheck.Vuln) bool
IsCalled reports whether the vulnerability is called, therefore affecting the target source code or binary.
func NewTextHandler ¶
func NewTextHandler(w io.Writer, source, verbose bool) govulncheck.Handler
NewtextHandler returns a handler that writes govulncheck output as text.
func Pos ¶
func Pos(sf *govulncheck.StackFrame) string
Pos returns the position of the call in sf as string. If position is not available, return "".
Types ¶
type Cmd ¶
type Cmd struct { // Stdout specifies the standard output. If nil, Run connects os.Stdout. Stdout io.Writer // contains filtered or unexported fields }
Cmd represents an external govulncheck command being prepared or run, similar to exec.Cmd.
func (*Cmd) Start ¶
Start starts the specified command but does not wait for it to complete.
After a successful call to Start the Wait method must be called in order to release associated system resources.
func (*Cmd) StdoutPipe ¶
func (c *Cmd) StdoutPipe() io.ReadCloser
StdoutPipe returns a pipe that will be connected to the command's standard output when the command starts.