Просмотр исходного кода

Fix Printf without formatting warnings

The `Errorf` one is special in that there apparently isn't `fmt.Error("")`
Matthew L Daniel 7 лет назад
Родитель
Сommit
aebbe694a3
2 измененных файлов с 5 добавлено и 5 удалено
  1. 3 3
      cloud/provider.go
  2. 2 2
      costmodel/costmodel.go

+ 3 - 3
cloud/provider.go

@@ -2,7 +2,7 @@ package cloud
 
 import (
 	"encoding/json"
-	"fmt"
+	"errors"
 	"io/ioutil"
 	"log"
 	"net/url"
@@ -149,7 +149,7 @@ func NewProvider(clientset *kubernetes.Clientset, apiKey string) (Provider, erro
 	if metadata.OnGCE() {
 		log.Print("metadata reports we are in GCE")
 		if apiKey == "" {
-			return nil, fmt.Errorf("Supply a GCP Key to start getting data")
+			return nil, errors.New("Supply a GCP Key to start getting data")
 		}
 		return &GCP{
 			Clientset: clientset,
@@ -174,7 +174,7 @@ func NewProvider(clientset *kubernetes.Clientset, apiKey string) (Provider, erro
 			},
 		}, nil
 	} else {
-		log.Printf("Unsupported provider, falling back to default")
+		log.Print("Unsupported provider, falling back to default")
 		return &CustomProvider{
 			Clientset: clientset,
 		}, nil

+ 2 - 2
costmodel/costmodel.go

@@ -267,10 +267,10 @@ func getNodeCost(clientset *kubernetes.Clientset, cloud costAnalyzerCloud.Provid
 			totalCPUPrice := basePrice * cpu
 			var nodePrice float64
 			if cnode.Cost != "" {
-				log.Printf("Use given nodeprice as whole node price")
+				log.Print("Use given nodeprice as whole node price")
 				nodePrice, _ = strconv.ParseFloat(cnode.Cost, 64)
 			} else {
-				log.Printf("Use cpuprice as whole node price")
+				log.Print("Use cpuprice as whole node price")
 				nodePrice, _ = strconv.ParseFloat(cnode.VCPUCost, 64) // all the price was allocated the the CPU
 			}
 			if totalCPUPrice >= nodePrice {