From 3ba9f62b026368e30320457ce28dc48e2443aad5 Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Tue, 5 May 2020 13:24:14 +0100 Subject: [PATCH] checker: change logger --- cmd/checker/main.go | 13 +++++++++++++ util/env.go | 4 ---- util/log.go | 4 ++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/checker/main.go b/cmd/checker/main.go index 9090666e..d53b9ed0 100644 --- a/cmd/checker/main.go +++ b/cmd/checker/main.go @@ -24,6 +24,9 @@ func main() { fmt.Println("Running in debug mode") } + // change output for readability in CI + util.SetLoggerFlag(0) + if subcommand == "lint" { lintPackage(flag.Arg(1)) @@ -34,9 +37,19 @@ func main() { return } + if subcommand == "show-files" { + showFiles(flag.Arg(1)) + return + } + panic("unknown subcommand") } +func showFiles(path string) { + ctx := util.ContextWithName(path) + err(ctx, "not implemented yet") +} + func lintPackage(path string) { ctx := util.ContextWithName(path) diff --git a/util/env.go b/util/env.go index 19449758..6b3d03af 100644 --- a/util/env.go +++ b/util/env.go @@ -26,10 +26,6 @@ func GetBotBasePath() string { return GetEnv("BOT_BASE_PATH") } -func GetCDNJSPath() string { - return path.Join(GetBotBasePath(), "cdnjs") -} - func GetCDNJSPackages() string { return path.Join(GetBotBasePath(), "cdnjs", "ajax", "libs") } diff --git a/util/log.go b/util/log.go index 342c142c..7a8fa2ac 100644 --- a/util/log.go +++ b/util/log.go @@ -24,3 +24,7 @@ func Debugf(ctx context.Context, format string, v ...interface{}) { Printf(ctx, format, v...) } } + +func SetLoggerFlag(f int) { + logger.SetFlags(f) +}