草庐IT

runtime-type

全部标签

linux - 构建 cf-cli : go build runtime: linux/386 must be bootstrapped using make. bash 时出错

CloudFoundry的CLI工具位于cloudfoundry/cli是用围棋写的。我正在尝试构建CLI工具但出现此错误:gobuildruntime:linux/386必须使用make.bash引导如何解决这个问题?下面是cli/bin/build-all.sh脚本的内容:#!/bin/bashset-eset-xOUTDIR=$(dirname$0)/../outGOARCH=amd64GOOS=windows$(dirname$0)/build&&cp$OUTDIR/cf$OUTDIR/cf-windows-amd64.exeGOARCH=386GOOS=windows$(di

go - panic : runtime error: invalid memory address or nil pointer dereference when running Blockchainr

我运行blockchain并获得以下终端输出:17:39:572015-06-16[INF]loadingdbleveldbpanic:runtimeerror:invalidmemoryaddressornilpointerdereferencepanic:runtimeerror:invalidmemoryaddressornilpointerdereference[signal0xbcode=0x1addr=0x0pc=0x402cb63]goroutine1[running]:main.search(0x4911ef8,0xc20806e2d0,0x0,0x0,0x4911ef

types - golang 在 switch 中动态创建接收器

我想使用Process接口(interface)中实现的Read和Write方法从不同来源读取、提取和保存数据该代码在第一个example中正常工作:typeProcessinterface{Read()write()string}typeNcstruct{datastring}typeCtdNctypeBtlNcfunc(nc*Ctd)Read(){nc.data="CTD"}func(nc*Ctd)Write()string{returnnc.data}func(nc*Btl)Read(){nc.data="BTL"}func(nc*Btl)Write()string{return

go - 编写 CLI : How to avoid showing the typed password on screen

这个问题在这里已经有了答案:getpasswdfunctionalityinGo?(11个答案)关闭7年前。我正在使用Go编写命令行工具,其中一个命令将查询用户的用户名和密码(并将其保存到主目录内的配置文件中)。目前我还不知道如何将键入的密码替换为“*”,甚至无法像许多命令行工具那样不键入任何内容。在使用golang时如何做到这一点?

amazon-web-services - 从 AWS S3 panic : runtime error: 下载日志文件

我要下载特定存储桶(最终我拥有的每个存储桶)中的所有日志文件,这是我正在使用的代码packagemainimport("fmt""os""path/filepath""github.com/aws/aws-sdk-go/aws""github.com/aws/aws-sdk-go/aws/session""github.com/aws/aws-sdk-go/service/s3""github.com/aws/aws-sdk-go/service/s3/s3manager")var(//variablesemptyforsecurityBucket=""//Downloadfromth

elasticsearch - go + elastigo panic : runtime error: index out of range

我正在用elasticsearch测试golang我正在使用图书馆:https://github.com/mattbaird/elastigo我的问题是当我运行时:gorunelastigo_postal_code2.go编译器显示如下:panic:runtimeerror:indexoutofrangegoroutine1[running]:panic(0x893ce0,0xc82000a150)/opt/go/src/runtime/panic.go:464+0x3ffmain.main()/home/hector/go/elastigo_postal_code2.go:80+0x

go - 关于 "cannot use time.Now() (type time.Time) as type "

使用以下类型定义获取“不能使用time.Now()(类型time.Time)作为字段值中的类型typetime”import("time")typetypetimetime.TimetypeFriendsstruct{NamestringBirthdaytypetime}John:=Friends{Name:"John",Birthday:time.Now()}如果我用直接类型形式(time.Time)替换typetime,就没有问题。GO的规则背后是什么??:> 最佳答案 time.Time和typetime是不同的类型(尽管它们

macos - 更新到 macOS beta 4 后,go test -cover 抛出 "fatal error: unexpected signal during runtime execution"

Gobuild和gotest仍然有效。在更新到macOSbeta之前,我使用测试覆盖工具没有遇到任何问题。“去测试”工作正常;但是,所有覆盖率测试命令都抛出此错误(gotest-coverprofile=coverage.out抛出相同的问题)。如果有人知道如何解决这个问题,我将不胜感激!$gotest-covergobuildgithub.com/hunteramericano/ErrorQuiver:/usr/local/Cellar/go/1.6.3/libexec/pkg/tool/darwin_amd64/cover:signal:fatalerror:unexpecteds

戈朗 : building interfaces for existing types to make code testable

为了使调用sql包的代码可测试,我构建了以下2个接口(interface):typeDatabaseinterface{Close()errorQuery(string,...interface{})(DatabaseRows,error)}typeDatabaseRowsinterface{Close()errorNext()boolScan(...interface{})error}我要测试的实际代码是:funcgetDatabase(connectionStringstring)(dbDatabase,errerror){ifdb,err=sql.Open("mysql",con

go - 为什么 golang duck typing 在我下面的代码中对我不起作用?

在下面的代码中,我尝试创建模型接口(interface)和API接口(interface)的具体实现:packagemainimport"fmt"/////////typeModelinterface{ID()string}typeAPIinterface{Create(Model)}/////////typeConcreteModelstruct{}func(modelConcreteModel)ID()string{return"123"}func(modelConcreteModel)Name()string{return"aron"}typeConcreteAPIstruct{