From 690b87750bca62b24688d93ffe16cd6445b5f94a Mon Sep 17 00:00:00 2001 From: haya14busa Date: Tue, 13 Dec 2016 07:37:12 +0900 Subject: [PATCH] remove 'isatty' because isatty==false in CI server --- cmd/reviewdog/main.go | 8 ++------ cmd/reviewdog/main_test.go | 6 +----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/cmd/reviewdog/main.go b/cmd/reviewdog/main.go index 884e17a2cd..1e4424b33b 100644 --- a/cmd/reviewdog/main.go +++ b/cmd/reviewdog/main.go @@ -25,7 +25,6 @@ import ( "github.com/haya14busa/errorformat/fmts" "github.com/haya14busa/reviewdog" "github.com/haya14busa/reviewdog/project" - isatty "github.com/mattn/go-isatty" "github.com/mattn/go-shellwords" ) @@ -45,8 +44,6 @@ type option struct { name string // tool name which is used in comment ci string conf string - - isatty bool // it's not specified by flag } // flags doc @@ -89,8 +86,6 @@ func init() { flag.StringVar(&opt.name, "name", "", nameDoc) flag.StringVar(&opt.ci, "ci", "", ciDoc) flag.StringVar(&opt.conf, "conf", "reviewdog.yml", confDoc) - - opt.isatty = isatty.IsTerminal(os.Stdin.Fd()) } func usage() { @@ -116,7 +111,8 @@ func run(r io.Reader, w io.Writer, opt *option) error { return runList(w) } - isProject := opt.isatty && len(opt.efms) == 0 && opt.f == "" + // assume it's project based run when both -efm ane -f are not specified + isProject := len(opt.efms) == 0 && opt.f == "" var cs reviewdog.CommentService var ds reviewdog.DiffService diff --git a/cmd/reviewdog/main_test.go b/cmd/reviewdog/main_test.go index 0daf95849c..ea0dc6e208 100644 --- a/cmd/reviewdog/main_test.go +++ b/cmd/reviewdog/main_test.go @@ -71,8 +71,7 @@ line3 func TestRun_project(t *testing.T) { t.Run("diff command is empty", func(t *testing.T) { opt := &option{ - conf: "reviewdog.yml", - isatty: true, + conf: "reviewdog.yml", } stdout := new(bytes.Buffer) if err := run(nil, stdout, opt); err == nil { @@ -86,7 +85,6 @@ func TestRun_project(t *testing.T) { opt := &option{ conf: "reviewdog.notfound.yml", diffCmd: "echo ''", - isatty: true, } stdout := new(bytes.Buffer) if err := run(nil, stdout, opt); err == nil { @@ -107,7 +105,6 @@ func TestRun_project(t *testing.T) { opt := &option{ conf: conffile.Name(), diffCmd: "echo ''", - isatty: true, } stdout := new(bytes.Buffer) if err := run(nil, stdout, opt); err == nil { @@ -128,7 +125,6 @@ func TestRun_project(t *testing.T) { opt := &option{ conf: conffile.Name(), diffCmd: "echo ''", - isatty: true, } stdout := new(bytes.Buffer) if err := run(nil, stdout, opt); err != nil {