diff --git a/cmd/checker/main.go b/cmd/checker/main.go index 1a58d873..1b1d4d7e 100644 --- a/cmd/checker/main.go +++ b/cmd/checker/main.go @@ -1,12 +1,9 @@ package main import ( - "bytes" "context" "flag" "fmt" - "io/ioutil" - "net/http" "net/url" "os" "path/filepath" @@ -51,33 +48,9 @@ func main() { return } - if subcommand == "review" { - review(flag.Arg(1), flag.Arg(2)) - return - } - panic("unknown subcommand") } -func review(pr, run_id string) { - url := "https://github-ci.cdnjs.com/review" - var jsonStr = []byte(fmt.Sprintf(`{"pr":"%s", "run_id": "%s"}`, pr, run_id)) - req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) - util.Check(err) - req.Header.Set("Content-Type", "application/json") - - client := &http.Client{} - resp, err := client.Do(req) - util.Check(err) - - defer resp.Body.Close() - - fmt.Println("response Status:", resp.Status) - body, _ := ioutil.ReadAll(resp.Body) - fmt.Println("response Body:", string(body)) - -} - func showFiles(path string) { ctx := util.ContextWithName(path) pckg, readerr := packages.ReadPackageJSON(ctx, path) @@ -216,18 +189,26 @@ func lintPackage(path string) { } func err(ctx context.Context, s string) { - util.Printf(ctx, "error: "+s) + if prefix, ok := ctx.Value("loggerPrefix").(string); ok { + fmt.Printf("::error file=%s,line=1,col=1::%s\n", prefix, s) + } else { + fmt.Printf("error: %s\n", s) + } errCount += 1 } func warn(ctx context.Context, s string) { - util.Printf(ctx, "warning: "+s) + if prefix, ok := ctx.Value("loggerPrefix").(string); ok { + fmt.Printf("::warning file=%s,line=1,col=1::%s\n", prefix, s) + } else { + fmt.Printf("warning: %s\n", s) + } } func shouldBeEmpty(name string) string { - return fmt.Sprintf("%s should be empty\n", name) + return fmt.Sprintf("%s should be empty", name) } func shouldNotBeEmpty(name string) string { - return fmt.Sprintf("%s should be specified\n", name) + return fmt.Sprintf("%s should be specified", name) }