golang.org/x/tools/gopls@v0.15.3/internal/cmd/vulncheck.go (about) 1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package cmd 6 7 import ( 8 "context" 9 "flag" 10 "fmt" 11 "os" 12 13 "golang.org/x/tools/gopls/internal/vulncheck/scan" 14 ) 15 16 // vulncheck implements the vulncheck command. 17 // TODO(hakim): hide from the public. 18 type vulncheck struct { 19 app *Application 20 } 21 22 func (v *vulncheck) Name() string { return "vulncheck" } 23 func (v *vulncheck) Parent() string { return v.app.Name() } 24 func (v *vulncheck) Usage() string { return "" } 25 func (v *vulncheck) ShortHelp() string { 26 return "run vulncheck analysis (internal-use only)" 27 } 28 func (v *vulncheck) DetailedHelp(f *flag.FlagSet) { 29 fmt.Fprint(f.Output(), ` 30 WARNING: this command is for internal-use only. 31 32 By default, the command outputs a JSON-encoded 33 golang.org/x/tools/gopls/internal/protocol/command.VulncheckResult 34 message. 35 Example: 36 $ gopls vulncheck <packages> 37 38 `) 39 } 40 41 func (v *vulncheck) Run(ctx context.Context, args ...string) error { 42 if err := scan.Main(ctx, args...); err != nil { 43 fmt.Fprintln(os.Stderr, err) 44 os.Exit(1) 45 } 46 return nil 47 }