diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-12-16 14:21:05 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-25 10:12:41 +0100 |
| commit | 55adcb8ca0ca0b7185e917ece137fae218365c89 (patch) | |
| tree | 58b8661c65496f0a3fa2e7824bf1ebbc97c6d275 /pkg/csource | |
| parent | 257f4cb9050d29a38a992b814bd6e79e6f1bca99 (diff) | |
all: use tool.Failf instead of local functions
Diffstat (limited to 'pkg/csource')
| -rw-r--r-- | pkg/csource/gen.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/pkg/csource/gen.go b/pkg/csource/gen.go index 53b34bbc2..c92c4b581 100644 --- a/pkg/csource/gen.go +++ b/pkg/csource/gen.go @@ -11,17 +11,19 @@ import ( "io/ioutil" "os" "regexp" + + "github.com/google/syzkaller/pkg/tool" ) func main() { out, err := os.Create("generated.go") if err != nil { - failf("%v", err) + tool.Fail(err) } defer out.Close() data, err := ioutil.ReadFile("../../executor/common.h") if err != nil { - failf("%v", err) + tool.Fail(err) } executorFilenames := []string{ "common_linux.h", @@ -60,20 +62,15 @@ func main() { fmt.Fprintf(out, "`\n") } -func failf(msg string, args ...interface{}) { - fmt.Fprintf(os.Stderr, msg+"\n", args...) - os.Exit(1) -} - func replaceIncludes(filenames []string, location string, data []byte) []byte { for _, include := range filenames { contents, err := ioutil.ReadFile(location + include) if err != nil { - failf("%v", err) + tool.Fail(err) } replace := []byte("#include \"" + include + "\"") if bytes.Index(data, replace) == -1 { - failf("can't find %v include", include) + tool.Failf("can't find %v include", include) } data = bytes.Replace(data, replace, contents, -1) } |
