From 1dd18a574d69634ee87ecfebe583f5956aed4a81 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 21 Nov 2017 23:27:59 +0900 Subject: [PATCH] Move fail and printToStderr functions --- main.go | 14 ++++++++++++++ utils.go | 19 +------------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/main.go b/main.go index 3bc31af..55f9b75 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,12 @@ package main import ( + "fmt" "os" + "strings" "sync" + + "github.com/fatih/color" ) func main() { @@ -49,3 +53,13 @@ func main() { os.Exit(1) } } + +func printToStderr(xs ...interface{}) { + fmt.Fprintln(os.Stderr, xs...) +} + +func fail(err error) { + s := err.Error() + printToStderr(color.RedString(strings.ToUpper(s[:1]) + s[1:])) + os.Exit(1) +} diff --git a/utils.go b/utils.go index bd369c9..5c4e211 100644 --- a/utils.go +++ b/utils.go @@ -1,13 +1,6 @@ package main -import ( - "fmt" - "os" - "strings" - - "github.com/fatih/color" - "github.com/kr/text" -) +import "github.com/kr/text" func stringSetToSlice(s2b map[string]bool) []string { ss := make([]string, 0, len(s2b)) @@ -19,16 +12,6 @@ func stringSetToSlice(s2b map[string]bool) []string { return ss } -func printToStderr(xs ...interface{}) { - fmt.Fprintln(os.Stderr, xs...) -} - -func fail(err error) { - s := err.Error() - printToStderr(color.RedString(strings.ToUpper(s[:1]) + s[1:])) - os.Exit(1) -} - func indent(s string) string { return text.Indent(s, "\t") }