草庐IT

User-invalid

全部标签

sqlite - 运行时错误 : invalid memory address or nil pointer dereference when Querying

我一直在研究用于身份验证的API,在尝试将其部署到服务器时,我偶然发现了这个奇怪的错误。该代码在我的笔记本电脑上运行得非常好,但是当我尝试部署它时,出现了这个错误:PANIC:runtimeerror:invalidmemoryaddressornilpointerdereferencegoroutine21[running]:github.com/urfave/negroni.(*Recovery).ServeHTTP.func1(0x7f5771b811e8,0xc4200980e8,0xc42009a870,0xc420138800)/home/linux/go/src/gith

go - 程序在主程序 block 中发现错误后出现 panic 。 panic : runtime error: invalid memory address or nil pointer dereference

我是golang的新手。在定义位置后trycatch主block中的错误后,我的程序出现panic。我在某处读过,添加defer.close()可能会有所帮助,但编译器再次说你的结构中不存在这样的定义帮助我解决它。typeIPInfostruct{IPstringHostnamestringCitystringCountrystringLocstringOrgstringPostalstring}funcmain(){ip:=getLocalIpv4()location,err:=ForeignIP(ip)iferr!=nil{fmt.Println("errorbro")}fmt.P

go - Go 中的 AntLR4 : Invalid type assertion: listener

我从Antlr4语法为Go语言生成了解析器。语法在这里:https://raw.githubusercontent.com/antlr/grammars-v4/master/solidity/Solidity.g4我生成解析器如下:java-jar$PWD/antlr-4.7.1-complete.jar-Dlanguage=Go-oparsersyntax/Solidity.g4生成的solidity_parser.go文件在任何地方都有以下错误listener.(SolidityListener)出现:无效类型断言:listener.(SolidityListener)(非接口(i

go - 使用beego验证码: invalid memory address or nil pointer dereference

我想在Beego下使用captcha生成验证码。但是它有错误无效的内存地址或零指针取消引用。有谁知道如何解决这个问题?谢谢。RequestMethod:GETRequestURL:/accounts/forgotpasswordRemoteAddr:127.0.0.1StackC:/Go/src/runtime/asm_amd64.s:573C:/Go/src/runtime/panic.go:505C:/Go/src/text/template/exec.go:137C:/Go/src/runtime/asm_amd64.s:573C:/Go/src/runtime/panic.go

go - standard_init_linux.go :207: exec user process caused "no such file or directory" while trying to statically link c libs

我无法在go中对用c编写的实用程序进行docker化和使用。我已经在没有docker的情况下在本地运行了这个程序并且它有效我尝试像这样使用gccgogobuild-compilergccgo-gccgoflags-static-libgo但我得到了同样的错误调用C函数的序言如下所示:/*#cgoamd64x86LDFLAGS:-L.-lsomelib-lsomeotherlib#include#include#include"someheader.h"*/我的docker文件如下所示:FROMgolang:1.12ASbuildWORKDIR/go/src/appCOPY..ENVGO

go - xorm 示例不工作 : "runtime error: invalid memory address or nil pointer dereference"

基于this示例我试图编写一个程序,该程序将从数据库返回一些数据。不幸的是,根据运行时控制台输出,(或多或少)相同的程序结构会在此处导致内存错误err:=orm.Find(&sensorDataEntry)。我在这里错过了什么?示例和我的程序都有使用make()创建的slice,并在Find()方法中使用引用。有问题的代码:packagemainimport("fmt""net/http""time""github.com/gorilla/mux"_"github.com/lib/pq"//"database/sql""github.com/go-xorm/xorm")varorm*x

docker - 从 Ubuntu amd64 到 arm7l : exec user process caused "exec format error" 进行交叉编译

从amd64到arm7l的交叉编译让我头疼我终于可以用GitlabCI做到这一点,所以现在,我在docker镜像中编译我的二进制文件,这是dockerfile:FROMgolangWORKDIR/go/src/gitlab.com/company/edge_to_bcCOPY..RUNdpkg--add-architecturearmhf&&aptupdate&&apt-getinstall-ygcc-arm-linux-gnueabihflibltdl-dev:armhf我将其构建为然后我将使用名称ubuntu:cross-compil构建新容器“cross-compil”现在,我可

user-interface - 增加这个简单的 go gui 应用程序的默认字体大小

我正在使用以下简单的演示代码来使用Fyne创建一个GUI包:packagemainimport("fyne.io/fyne/widget""fyne.io/fyne/app")funcmain(){app:=app.New()w:=app.NewWindow("Hello")w.SetContent(widget.NewVBox(widget.NewLabel("HelloFyne!"),widget.NewButton("Quit",func(){app.Quit()}),))w.ShowAndRun()}一切正常,但我想增加此GUI的默认字体大小(以便标签、按钮和任何其他小部件(如

user-interface - 编写确认(是/否)对话框

我正在尝试使用andlabs/ui在Go中编写一个是/否对话框它似乎没有这种类型的GUI组件:packagemainimport"github.com/andlabs/ui"funcconfirm(msgstring)bool{varconfirmWindow=ui.NewWindow("Pleaseconfirm",300,100,false)varvbox=ui.NewVerticalBox()vbox.Append(ui.NewLabel(msg),false)varyesButton=ui.NewButton("Yes")yesButton.OnClicked(func(*ui

go - Q : Getting Build Error "Invalid Import Path"

我坚持使用它说的“beerun”来运行BeeGO应用程序问题是我已经正确设置了我的GOPATH到D:/WebDev/GO/BeeGO/test-project/并且路由器路径确实存在,我已尝试手动构建文件,但它不会生成.exe文件。有人知道如何解决这个问题吗?我使用的是Windows8.1Pro(64位)谢谢 最佳答案 GO期望$GOPATH下的目录结构按照codeorganization中描述的以下方式:$GOPATH/src与其将源文件直接放在$GOPATH下(D:/WebDev/GO/BeeGO/test-project/对于