This commit is contained in:
crusader 2018-06-20 16:02:23 +09:00
parent 5c79b397ea
commit b4974183c6
2 changed files with 10 additions and 9 deletions

4
Gopkg.lock generated
View File

@ -86,7 +86,7 @@
"model/sensorconfig", "model/sensorconfig",
"service/probe" "service/probe"
] ]
revision = "fc4a5e60d0579e7ea1ba316551237143c72b9019" revision = "f64ffa19c31f7b997fdd9d2875f83b0cae176ac2"
[[projects]] [[projects]]
name = "github.com/BurntSushi/toml" name = "github.com/BurntSushi/toml"
@ -188,7 +188,7 @@
"unix", "unix",
"windows" "windows"
] ]
revision = "8883426083c04a2627e6e59d84d5f6fb63d16c91" revision = "fc8bd948cf46f9c7af0f07d34151ce25fe90e477"
[[projects]] [[projects]]
name = "gopkg.in/yaml.v2" name = "gopkg.in/yaml.v2"

View File

@ -5,7 +5,6 @@ import (
"compress/gzip" "compress/gzip"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"log"
"net" "net"
cun "git.loafle.net/commons/util-go/net" cun "git.loafle.net/commons/util-go/net"
@ -38,21 +37,23 @@ func GetRegistHeader(apiKey string) (string, error) {
} }
var b bytes.Buffer var b bytes.Buffer
gz := gzip.NewWriter(&b) gWriter, err := gzip.NewWriterLevel(&b, gzip.BestSpeed)
if _, err := gz.Write(buf); err != nil { if nil != err {
return "", err return "", err
} }
if err := gz.Flush(); err != nil {
if _, err := gWriter.Write(buf); nil != err {
return "", 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 return "", err
} }
gBuf := b.Bytes() gBuf := b.Bytes()
log.Printf("RegistHeader length: %d", len(gBuf))
enc := base64.StdEncoding.EncodeToString(gBuf) enc := base64.StdEncoding.EncodeToString(gBuf)
return enc, nil return enc, nil