Skip to content

Commit

Permalink
replace fmt package by log
Browse files Browse the repository at this point in the history
  • Loading branch information
yanc0 committed Mar 25, 2019
1 parent a8fbe7b commit 5d70980
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"flag"
"fmt"
"log"
"os"
"strings"
"sync"
Expand All @@ -29,7 +29,7 @@ func main() {
// Config Load
cfg, err := config.Load(*cfgPathOpt)
if err != nil {
fmt.Printf("[ERR] Cannot load %s file: %v\n", *cfgPathOpt, err)
log.Printf("[ERR] Cannot load %s file: %v\n", *cfgPathOpt, err)
os.Exit(1)
}

Expand All @@ -38,7 +38,7 @@ func main() {
defer wg.Done()
resourcesIn, err = getKubernetesResources(cfg.In)
if err != nil {
fmt.Printf("[ERR] Failed to get Kubernetes resources (in): %v\n", err)
log.Printf("[ERR] Failed to get Kubernetes resources (in): %v\n", err)
os.Exit(1)
}
}()
Expand All @@ -48,7 +48,7 @@ func main() {
defer wg.Done()
resourcesOut, err = getKubernetesResources(cfg.Out)
if err != nil {
fmt.Printf("[ERR] Failed to get Kubernetes resources (out): %v\n", err)
log.Printf("[ERR] Failed to get Kubernetes resources (out): %v\n", err)
os.Exit(1)
}
}()
Expand Down Expand Up @@ -79,9 +79,9 @@ func getKubernetesResources(cfgs []*config.CommandConfig) ([]*kubernetes.Resourc
defer wg.Done()
stdout, stderr, err := utils.Exec(cmd, args...)
if err != nil {
fmt.Println(cmd, args)
fmt.Println(string(stderr))
fmt.Println(err)
log.Println(cmd, args)
log.Println(string(stderr))
log.Println(err)
os.Exit(1)
}

Expand All @@ -90,7 +90,7 @@ func getKubernetesResources(cfgs []*config.CommandConfig) ([]*kubernetes.Resourc

yaml.Unmarshal([]byte(yml), &resource)
if err != nil {
fmt.Println(err)
log.Println(err)
os.Exit(1)
}

Expand Down

0 comments on commit 5d70980

Please sign in to comment.