MCPcopy
hub / github.com/sqlc-dev/sqlc / NewCmdVet

Function NewCmdVet

internal/cmd/vet.go:43–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41var pjson = protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
42
43func NewCmdVet() *cobra.Command {
44 return &cobra.Command{
45 Use: "vet",
46 Short: "Vet examines queries",
47 RunE: func(cmd *cobra.Command, args []string) error {
48 defer trace.StartRegion(cmd.Context(), "vet").End()
49 stderr := cmd.ErrOrStderr()
50 opts := &Options{
51 Env: ParseEnv(cmd),
52 Stderr: stderr,
53 }
54 dir, name := getConfigPath(stderr, cmd.Flag("file"))
55 if err := Vet(cmd.Context(), dir, name, opts); err != nil {
56 if !errors.Is(err, ErrFailedChecks) {
57 fmt.Fprintf(stderr, "%s\n", err)
58 }
59 os.Exit(1)
60 }
61 return nil
62 },
63 }
64}
65
66func Vet(ctx context.Context, dir, filename string, opts *Options) error {
67 e := opts.Env

Callers 1

DoFunction · 0.85

Calls 3

ParseEnvFunction · 0.85
getConfigPathFunction · 0.85
VetFunction · 0.85

Tested by

no test coverage detected