From b4974183c6566715fa39084c14ad477535b0c19a Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 20 Jun 2018 16:02:23 +0900 Subject: [PATCH] ing --- Gopkg.lock | 4 ++-- auth/info/info.go | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 39df110..a8da35e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -86,7 +86,7 @@ "model/sensorconfig", "service/probe" ] - revision = "fc4a5e60d0579e7ea1ba316551237143c72b9019" + revision = "f64ffa19c31f7b997fdd9d2875f83b0cae176ac2" [[projects]] name = "github.com/BurntSushi/toml" @@ -188,7 +188,7 @@ "unix", "windows" ] - revision = "8883426083c04a2627e6e59d84d5f6fb63d16c91" + revision = "fc8bd948cf46f9c7af0f07d34151ce25fe90e477" [[projects]] name = "gopkg.in/yaml.v2" diff --git a/auth/info/info.go b/auth/info/info.go index e9cb4be..9d950ad 100644 --- a/auth/info/info.go +++ b/auth/info/info.go @@ -5,7 +5,6 @@ import ( "compress/gzip" "encoding/base64" "encoding/json" - "log" "net" cun "git.loafle.net/commons/util-go/net" @@ -38,21 +37,23 @@ func GetRegistHeader(apiKey string) (string, error) { } var b bytes.Buffer - gz := gzip.NewWriter(&b) - if _, err := gz.Write(buf); err != nil { + gWriter, err := gzip.NewWriterLevel(&b, gzip.BestSpeed) + if nil != err { return "", err } - if err := gz.Flush(); err != nil { + + if _, err := gWriter.Write(buf); nil != err { return "", err } - if err := gz.Close(); err != nil { + if err := gWriter.Flush(); nil != err { + return "", err + } + if err := gWriter.Close(); nil != err { return "", err } gBuf := b.Bytes() - log.Printf("RegistHeader length: %d", len(gBuf)) - enc := base64.StdEncoding.EncodeToString(gBuf) return enc, nil