use ioutil.ReadAll instead of just a plain read"

This commit is contained in:
Your Name 2021-08-16 18:05:20 -04:00
parent a2826f5bcf
commit 43a6a202dd
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"flag" "flag"
"github.com/elliotchance/phpserialize" "github.com/elliotchance/phpserialize"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
"io/ioutil"
"log" "log"
"net" "net"
"os" "os"
@ -193,7 +194,7 @@ func handleConnection(conn net.Conn, UC MetadataCache, PC MetadataCache) {
log.Println("handleConnection started") log.Println("handleConnection started")
var buf []byte var buf []byte
var m *MetadataCache var m *MetadataCache
_, err := conn.Read(buf) buf, err := ioutil.ReadAll(conn)
var c cachecommand var c cachecommand
err = json.Unmarshal(buf, &c) err = json.Unmarshal(buf, &c)
if err != nil { if err != nil {