草庐IT

windows-error-reporting

全部标签

go - 构建 .go 包时出现 fatal error

我正在尝试安装一个go包。我克隆了包,运行以下命令来构建它:$goget-v-dFetchinghttps://golang.org/x/net/publicsuffix?go-get=1Parsingmetatagsfromhttps://golang.org/x/net/publicsuffix?go-get=1(statuscode200)get"golang.org/x/net/publicsuffix":foundmetatagmain.metaImport{Prefix:"golang.org/x/net",VCS:"git",RepoRoot:"https://go.go

windows - 通过在 Go 中调用 Windows DLL 发送 ARP 请求不起作用

我正在尝试调用WindowsAPISendARP从Go在Windows上发送arp请求,但它总是返回1168,又名ERROR_NOT_FOUND,MSDN对此错误代码的描述:Elementnotfound.ThiserrorisreturnedonWindowsVistaifthetheSrcIpparameterdoesnotspecifyasourceIPv4addressonaninterfaceonthelocalcomputerortheINADDR_ANYIPaddress(anIPv4addressof0.0.0.0).但我在Windows7上,而且我确实指定了正确的源I

windows - 如何打印到控制台窗口?

我想像这样从cmd运行我的go程序:C:\go\awesomeProject>goprogramm.exe-generate-val=2并希望得到这样的反馈:>Processstarted>Somethingwentwrong.Typee-mailtoreceivereport:>|...是的,我用谷歌搜索了很多。标准输出、执行、管道等。不能混为一谈。 最佳答案 最简单的是使用fmt包及其全局函数,例如:fmt.Println("Processstarted")fmt.Println("Somethingwentwrong.Type

go - channel 未缓冲时出现 fatal error : all goroutines are asleep - deadlock!

我试图理解我在channel未缓冲时遇到的错误:"fatalerror:allgoroutinesareasleep-deadlock!"packagemainimport"fmt"funcmain(){ch:=make(chanint)ch它在我缓冲channel后工作ch:=make(chanint,2) 最佳答案 通过非缓冲channel发送和检索数据都是阻塞进程。在您的代码中,您尝试发送数值1通过channelch.由于该操作是阻塞的,因此在当前行执行完成之前不会执行下面的代码。语句执行期间ch,同时没有进程正在运行以从ch

go - 在 Go 脚本中运行 'syntax error: A unknown token can’ 时如何修复 `exec.Command` t go here'

我正在尝试在我的Go脚本中使用osascript运行此AppleScript命令,但出现错误0:1:syntaxerror:Aunknowntokencan'tgohere.(-2740)。这是在终端中运行时效果很好的命令!/usr/bin/osascript-e'onrun{f,c}'-e'告诉应用程序“Finder”将(POSIX文件f作为别名)的注释设置为c'-eend"/Users/computerman/Desktop/testfile.png""Hello,World"我下面的Go脚本实际上输出了上面的字符串,我可以直接在终端中剪切和粘贴它并且它可以工作。但是,运行Go脚本

image - Go 生成的动画 GIF 在 Windows 中不起作用

我发现一个示例在Windows中无法正常运行。该程序演示了Go标准图像包的基本用法,我们将使用它来创建位图图像序列,然后将该序列编码为GIF动画。packagemainimport("image""image/color""image/gif""io""math""math/rand""os")import("log""net/http""time")//!+mainvarpalette=[]color.Color{color.White,color.Black}const(whiteIndex=0//firstcolorinpaletteblackIndex=1//nextcolor

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 - fmt.Print(myError) 没有隐式调用 Error()?

我想打印我的自定义错误结构中的所有内容,例如fmt.Print()打印任何其他结构,但由于它实现了error它只打印一个字段,我通过Error()传递了一个。我该怎么做? 最佳答案 您可以将error接口(interface)类型断言到您的自定义类型。请注意,理想情况下,您应该在执行此操作时使用“comma,ok”习惯用法,否则如果类型断言失败,您的应用程序将崩溃。packagemainimport"fmt"typeMyErrorstruct{StatusintMessagestring}func(eMyError)Error()s

windows - 在 Go 中读取 XML 文件

我用Go编写了一小段代码,我认为它足以读取XML文件。有人能知道发生了什么事吗?XML文件:Go2009http://golang.org/去代码:packagemainimport("io""log""os")funcmain(){input,err:=os.Open("C:\GoWork\toy\lang.xml")iferr!=nil{log.Fatal(err)}io.Copy(os.Stdout,input)}Errormessage:.\xmltoStruct.go:11:unknownescapesequence:G.\xmltoStruct.go:11:unknowne

windows.Environ() 字符串 [0] 和 [1]

我对Windowspro7系统(go1.8windows/amd64版本)上“windows.Environ()”返回的前两个字符串感到困惑。env[0]显然有一个键“=::”;env[1]有一个键“=C:”。谁能指出我在哪里记录?提前致谢。str_EnvStrs:=windows.Environ()////str_EnvStrs[0]=='=::=::\'fmt.Printf("str_EnvStrs[0]=='%v'\n",str_EnvStrs[0])////str_EnvStrs[1]=='=C:=C:\Users\(WINLOGIN)\Documents\Source\go\