MCPcopy
hub / github.com/kubernetes/test-infra / run

Function run

gopherage/cmd/diff/diff.go:52–81  ·  view source on GitHub ↗
(flags *flags, cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

50}
51
52func run(flags *flags, cmd *cobra.Command, args []string) {
53 if len(args) != 2 {
54 fmt.Fprintln(os.Stderr, "Expected two files.")
55 cmd.Usage()
56 os.Exit(2)
57 }
58
59 before, err := util.LoadProfile(args[0])
60 if err != nil {
61 fmt.Fprintf(os.Stderr, "Couldn't load %s: %v.", args[0], err)
62 os.Exit(1)
63 }
64
65 after, err := util.LoadProfile(args[1])
66 if err != nil {
67 fmt.Fprintf(os.Stderr, "Couldn't load %s: %v.", args[0], err)
68 os.Exit(1)
69 }
70
71 diff, err := cov.DiffProfiles(before, after)
72 if err != nil {
73 fmt.Fprintf(os.Stderr, "failed to diff profiles: %v", err)
74 os.Exit(1)
75 }
76
77 if err := util.DumpProfile(flags.OutputFile, diff); err != nil {
78 fmt.Fprintln(os.Stderr, err)
79 os.Exit(1)
80 }
81}

Callers 1

MakeCommandFunction · 0.70

Calls 3

LoadProfileFunction · 0.92
DiffProfilesFunction · 0.92
DumpProfileFunction · 0.92

Tested by

no test coverage detected