Skip to content

Commit

Permalink
Use log.Fatalf for brevity
Browse files Browse the repository at this point in the history
- Fix misleading error message (said 'in', should've been 'check')

[#4]

Signed-off-by: Jacques Chester <jchester@pivotal.io>
  • Loading branch information
jchester authored and jchesterpivotal committed Aug 19, 2018
1 parent 151b924 commit ccaf35e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions cmd/check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ func main() {
var request config.CheckRequest
err := json.NewDecoder(os.Stdin).Decode(&request)
if err != nil {
log.Printf("failed to parse input JSON: %s", err)
os.Exit(1)
return
log.Fatalf("failed to parse input JSON: %s", err)
}

checkResponse, err := check.Check(&request)
if err != nil {
log.Printf("failed to perform 'in': %s", err)
os.Exit(1)
return
log.Fatalf("failed to perform 'check': %s", err)
}

err = json.NewEncoder(os.Stdout).Encode(checkResponse)
Expand Down
8 changes: 2 additions & 6 deletions cmd/in/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ func main() {
var request config.InRequest
err := json.NewDecoder(os.Stdin).Decode(&request)
if err != nil {
log.Printf("failed to parse input JSON: %s", err)
os.Exit(1)
return
log.Fatalf("failed to parse input JSON: %s", err)
}

request.WorkingDirectory = os.Args[1]

inResponse, err := in.In(&request)
if err != nil {
log.Printf("failed to perform 'in': %s", err)
os.Exit(1)
return
log.Fatalf("failed to perform 'in': %s", err)
}

json.NewEncoder(os.Stdout).Encode(inResponse)
Expand Down

0 comments on commit ccaf35e

Please sign in to comment.