草庐IT

visual-c++-runtime

全部标签

go - 分配错误 : runtime: out of memory

我写了这段代码:packagemainimport("log")funcmain(){varc[]int64fori:=0;i此代码内存不足:fatalerror:运行时:内存不足。在每次迭代中,c都会被分配一个新的slice。所以上一个slice是不可达的。为什么GC似乎没有收集无法访问的内存? 最佳答案 每个c=make([]int64,10000000000都试图分配80GB(8*10,000,000,000字节)的内存。使用合理大小的分配(相对于实际内存的大小)和一切都按预期工作。例如,packagemainimport("

go - 带有 GO 的 Visual Studio Code - 多个主要声明(启动设置)

我是VS代码和Golang的新手。我有一个包含2种不同服务的现有项目-我们称其为A,第二个为B。A和B都位于同一目录下。每当我尝试运行A或B时,我都会收到以下错误:#directory/directory/directory/A&B_Directory./A.go:12:6:mainredeclaredinthisblockpreviousdeclarationat./B.go:18:6我尝试使用launch.json文件,添加以下部分:{"name":"LaunchProgram","type":"go","request":"launch","mode":"debug","prog

go - 为什么 runtime.caller(0) 在单元测试中使用 '--cover' 参数给出不同的路径

当尝试不带任何参数执行单元测试函数时,它给出以下输出路径C:/ProgramFiles(x86)/Go1.8\bin\go.exe"test-vgclassec/skyline/loggers-run^TestCreateLogFilesPath$filePath:===C:/GerritNew/goclassec/src/gclassec/skyline/loggers/logs.go但是当我尝试使用任何参数运行它时,例如--cover文件路径值更改如下:"C:/ProgramFiles(x86)/Go1.8\bin\go.exe"test-v--covergclassec/skyl

mongodb - 当我尝试调用 API 时,本地服务器返回 "http: panic serving [::1]:52781: runtime error: invalid memory address or nil pointer dereference"

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭3年前。Improvethisquestion我按照指南在这里编写了mongodbAPI:https://www.thepolyglotdeveloper.com/2019/02/developing-restful-api-golang-mongodb-nosql-database/指南的代码运行

go - 在 : panic: runtime error: index out of range 中转换数据结构

我在go中有一个数据结构:typeAPIMainstruct{CodeConvstring`json:"codeConv"`Starttime.Time`json:"start"`Endtime.Time`json:"end"`Details[]struct{IDPrmstring`json:"idPrm"`Keys[]struct{Timestamptime.Time`json:"timestamp"`Valuefloat64`json:"value"`}`json:"keys"`}`json:"details"`}我需要转换为:typeDataGroupedByTSstruct{C

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

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

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