草庐IT

get-stream

全部标签

go - "go get golang.org/x/tools/go/gcimporter15"在未定义的标识符上失败

我正在尝试为Go创建一个依赖于gcimporter15的程序,因此我正在使用命令“gogetgolang.org/x/tools/go/gcimporter15”,但它失败并显示错误:#golang.org/x/tools/go/gcimporter15../../go/src/golang.org/x/tools/go/gcimporter15/bexport.go:557:undefined:constant.ToFloat../../go/src/golang.org/x/tools/go/gcimporter15/gcimporter.go:396:pkg.SetNameund

go - 使用 UseNumber 解码 GET 请求

我有以下向Elasticsearch发出请求的代码://Preparerequesttr:=&http.Transport{TLSClientConfig:&tls.Config{InsecureSkipVerify:true},}client:=&http.Client{Transport:tr}req,err:=http.NewRequest("GET",url,nil)req.Header.Add("Authorization",ES_AUTH)//Makerequestresp,err:=client.Do(req)iferr!=nil{log.Fatal(err)}defer

go - httprouter.GET 不工作

我有一个使用get方法提交数据的html表单。WebSearchEnteryourtags(Commaseparated)这是我的代码packagemainimport("net/http""log""html/template""fmt""github.com/julienschmidt/httprouter")funcmain(){router:=httprouter.New()router.GET("/",Search)router.GET("/search?key=:tags",GrabQuestions)log.Fatal(http.ListenAndServe(":8080

go - 虹膜错误 - Unresolved 'Get'

这是我的代码`packagemainimport"github.com/kataras/iris"funcmain(){iris.Get("/hi",func(ctx*iris.Context){ctx.Writef("Hi%s","iris")})iris.Listen(":8080")}`我有“goget-ugithub.com/kataras/iris/iris”这就是我得到的,我一直在努力,但仍然无法解决这个问题。./IRIS.go:6:undefined:iris.Get./IRIS.go:9:undefined:iris.Listen这是我第一次尝试这个框架,我从页面htt

go - 不能在 http.Get 的参数中使用 baseURL(类型 *url.URL)作为类型字符串

我编写了一个简单的Web服务器,它使用url.ResolveReference将一些相对路径附加到基本URL。然后我想使用http.Get()获取结果URL的内容,但问题是http.get()将字符串作为参数,我有一个类型为*url.URL的对象。如何解决这个问题?我的代码如下:packagemainimport("fmt""io/ioutil""log""net/http""net/url")funcfactHandler(whttp.ResponseWriter,r*http.Request){str1:="http://www.meaningfultype.com/"u1,_:=

c - O_NONBLOCK SOCK_STREAM 限制为 8192

我正在从C程序写入SOCK_STREAM正在从go程序监听的Unix域套接字,使用net.Listen("unix",sockname).当我将套接字设置为O_NONBLOCK使用fcntl(),我看到C程序在第一次写入时只写入了8192字节。失败后,我监控并回写剩余数据,但我服务器上读取的数据在这种情况下是无效的。当我不使用O_NONBLOCK时,然后整个8762字节被写在一个单一的写入中,一切都按预期工作。C客户端套接字连接if((fd=socket(AF_UNIX,SOCK_STREAM,0))==-1){return;}intflags=fcntl(fd,F_GETFL,0);

macos - Golang 交叉编译的 OSX 二进制文件在 net/http.Get() 中使用 VPN 时挂起

我创建了一个简单的go程序,它执行HTTPGET请求并打印执行该请求所花费的时间:packagemainimport("log""net/http""time")funcmain(){start:=time.Now()http.Get("https://google.com")log.Printf("Elapsed:%v",time.Since(start))}在OSX(Sierra10.12.1)上本地构建时,执行请求所用的时间是合理的($foriin`seq110`;do./httpgettest;done2017/08/1514:20:44Elapsed:525.989928ms

go - Golang扫描函数中 "ERROR: IOError: closed stream"如何处理?

我在Golang代码中使用knifebootstrap命令来引导节点。有时食谱中有等待,等待超过10分钟。在这种情况下,我收到错误“错误:IOStream关​​闭”。有什么办法可以增加时间限制吗?我也在不断地从cmd的输出和错误流中读取日志。funcexecuteCMDWorkstation(cmd*exec.Cmd,projectId,cr_idstring)bool{stdout,err3:=cmd.StdoutPipe()iferr3!=nil{utils.Info.Println(err3)returnfalse}deferstdout.Close()stderr,err4:=

http - 在 App Engine 的灵活环境中发出 HTTP Get 请求

我在AppEngine中使用FlexibleEnvironment我想在我的代码中发送HTTPGet请求。ctx:=appengine.NewContext(r)client:=urlfetch.Client(ctx)req,err:=http.NewRequest("GET","https://www.google.com/",nil)res,err:=client.Do(req)iferr!=nil{http.Error(w,err.Error(),http.StatusInternalServerError)return}fmt.Fprintf(w,"HTTPGETreturne

go - 以太坊简单存储 : get() func always returns zero?

https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contractshttps://decentralize.today/introducing-perigord-golang-tools-for-ethereum-dapp-development-60556c2d9fd简单存储.sol:pragmasolidity^0.4.4;contractSimpleStorage{uintstoredData;functionset(uintx)public{storedData