草庐IT

FLAG_TEST_ONLY

全部标签

go - panic : runtime error: invalid memory address or nil pointer dereference only on the GAE

我正在使用gin框架开发golang应用程序。基本上它只是以JSON格式从firestore获取数据。在本地它工作得很好,但是当我将它部署到GAE(gcloudappdeploy)时,部署期间没有错误,但是当访问页面时它不起作用,并且在日志中提供了一个错误:“panic:runtimeerror:invalid内存地址或nil指针取消引用”包列表集合import("fmt""log""net/http""cloud.google.com/go/firestore""github.com/gin-gonic/gin""google.golang.org/api/iterator""goo

Golang 项目 Travis CI Build 失败,错误为 `Makefile:15: recipe for target ' test' failed`

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。这个问题似乎与helpcenter中定义的范围内的编程无关。.关闭3年前。Improvethisquestion我已经为我的Github项目设置了travisbuildCaptain.travis.yml的内容是:language:gogo:-1.12.xscript:makeenv:-GO111MODULE=onGOPROXY=https://proxy.golang.org我的Makefile的内容是:#GoparametersBINARY_FOLDER=./binGOCMD=goGOBUILD=

go test 错过了执行路径上的覆盖

考虑这样的文件结构:api--|_routes.go|_handler.goimpl--|_impl.go|_impl_test.go“impl”文件包含RESTAPI的内部实现,其处理程序和路由分别位于“handler.go”和“route.go”文件中。就打包而言,“api”文件夹下的所有内容都在“api”包中。“impl.go”中的代码在“impl”包中,“impl_test”包中的代码在“impl_test”包中。api-------|_routes|_handlerfunctionsimpl-------|_implfunctionsimpl_test--|_testfunc

go - vendor 问题 : found packages text (doc. 去)和转换(examples_test.go)在我的 vendor

这个问题在这里已经有了答案:Error"can'tloadpackage:packagemy_prog:foundpackagesmy_progandmain"(3个答案)关闭4年前。我遇到了一些问题:enterimagedescriptionhere..\vendor\github.com\spf13\afero\util.go:28:2:在D:\golang\src\services\vendor中找到包文本(doc.go)和转换(examples_test.go)\golang.org\x\text\transform我该如何解决这个问题?谢谢。

GoSonar : how to generate go test -json > report. json

如何生成gotest-json>report.jsonGo语言版本:Go1.10.3SonarQube属性:sonar.go.tests.reportPaths=report.json官方Sonar文档->https://docs.sonarqube.org/display/PLUG/Unit+Tests+Results+Import生成文件.PHONY:testtest:@$(foreachpackage,$(packages),\gotest-coverprofile$(package)/cover.out-covermode=count$(package);).PHONY:cov

unit-testing - 安装go lang后无法运行go test程序

尝试运行用Go编写的测试时出现以下错误。我安装了Golang和dep。我是Go的新手,我不确定这里的问题是什么。有人可以帮助我吗?xxxx-dxxxx:testxxxx$gotest#_/Users/xxxx/dev/xxxx/test/xxxx/testapplication_cluster_test.go:10:2:cannotfindpackage"github.com/stretchr/testify/assert"inanyof:/usr/local/Cellar/go/1.10.3/libexec/src/github.com/stretchr/testify/assert

mongodb - 无法解析行 #126 : mongo. 数据库 = mongo_db_test

我正在学习本教程Golang+Revelwebframework+MongodbRESTFulgeneratorfor(revel_mgo)一步一步来,但是当我最终结束它并尝试运行它时,它抛出了这个错误CRIT16:11:18revel_container.go:139:无法加载配置文件error="C:\Users\Userx\go\src\RevelApp\conf\app.conf:无法解析第126行:mongo.database=RevelApp"第126行是这样的:[dev]126-mongo.database=mongo_db_test127-mongo.path=127.

戈朗 : why does the word "hello" loop 5 times while the word "world" loops only 4?

这个问题在这里已经有了答案:Nooutputfromgoroutine(3个答案)关闭7年前。packagemainimport("fmt""time")funcsay(sstring){fori:=0;i运行代码,输出为:helloworldhelloworldhelloworldhelloworldhello在前4个循环中,每100毫秒,将打印一个“hello”,然后打印一个“world”。并且在最后一个循环中只会打印一个“hello”。有没有人可以解释一下代码的执行顺序是什么?

go - 为特定包运行 go test

我使用以下命令对特定包运行测试去测试fts-runrun_test.gocan'tloadpackage:packagefts:cannotfindpackage"fts"inanyof:/usr/local/Cellar/go/1.11.1/libexec/src/integration(from$GOROOT)/Users/i055555/go/src/fts(from$GOPATH)包裹看起来像gitproj/|----fts|-----command|-----run.go|-----run_test.go|----internal|-----fs.go|-----tb.go|

go - "go test"和 "bazel test"中的不同文件权限错误

如果一个测试想要断言文件权限错误,例如,写入文件系统的根目录,“gotest”返回一个syscall.EACCES错误,而“bazeltest”返回一个系统调用.EPERM。如何让“bazeltest”和“gotest”都通过测试?可以找到一个例子here. 最佳答案 您可以使用bazel--spawn_strategy=standalonetest//...禁用沙箱。我怀疑这会解决这个问题。但是,您可能需要考虑写入/是否是您要测试的行为。如果您需要在不同的操作系统或Docker容器内运行代码,在这种情况下您将获得不同的行为,因此您