Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.15.5 linux/amd64
Does this issue reproduce with the latest release?
yep.
What operating system and processor architecture are you using (go env
)?
ubuntu@VM-0-6-ubuntu:~$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build235759783=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Run this golang program:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
// "crypto/tls"
"time"
)
func PostJSONWithTimeout(
urlString string,
req interface{},
timeout time.Duration,
) (body []byte, err error) {
buffer := new(bytes.Buffer)
json.NewEncoder(buffer).Encode(req)
client := http.Client{
Timeout: timeout,
Transport: &http.Transport{
//TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DisableKeepAlives: true},
}
resp, err := client.Post(urlString, "application/json", buffer)
if err != nil {
fmt.Printf("err:%v", err)
return nil, err
}
defer resp.Body.Close()
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("error:%s", err.Error())
} else {
fmt.Printf("suc %s\n", string(body))
}
return body, nil
}
func main() {
req := map[string]string{
"appkey": "",
"encryptsecret": "",
"firmacctid": "tt",
}
PostJSONWithTimeout("https://firmacct.html5.qq.com/oauth2/get_sig", req, time.Hour)
}
Get Error :
ubuntu@VM-0-6-ubuntu:~$ ~/go/bin/go version && ~/go/bin/go run ./main2.go
go version go1.15.5 linux/amd64
err:Post "https://firmacct.html5.qq.com/oauth2/get_sig": dial tcp: lookup firmacct.html5.qq.com: too many open files
ubuntu@VM-0-6-ubuntu:~$ ^C
But when I use the go 1.10.4
ubuntu@VM-0-6-ubuntu:~$ go version && go run ./main2.go
go version go1.10.4 linux/amd64
suc {"ErrCode":-1004,"ErrMsg":"http postbody param empty","Sig":""}
Question
I am confused that why the error message is so strange?
I think he may have something to do with site credentials, but why is the error message so confusing?