草庐IT

package_test

全部标签

package - 为什么 "go build"找不到包?

我安装了一个test0包到$gopath\pkg\windows_386\hello\test0.a,但是当我构建一个依赖于的主包时test0包,编译器提示:import"hello/test0":cannotfindpackage。为什么会这样?我有两个go文件:$gopath/src/hello.gopackagemainimport("fmt""hello/test0")funcmain(){fmt.Println(test0.Number)}$gopath/src/hello/test0/test0.gopackagetest0const(Numberint=255)首先,我运

package - 为什么 "go build"找不到包?

我安装了一个test0包到$gopath\pkg\windows_386\hello\test0.a,但是当我构建一个依赖于的主包时test0包,编译器提示:import"hello/test0":cannotfindpackage。为什么会这样?我有两个go文件:$gopath/src/hello.gopackagemainimport("fmt""hello/test0")funcmain(){fmt.Println(test0.Number)}$gopath/src/hello/test0/test0.gopackagetest0const(Numberint=255)首先,我运

google-app-engine - gcloud 应用程序部署失败 "cannot import internal package"

我正在编译我想上传并在谷歌云平台上运行的GO应用程序。我正在导入appengine/datastore包,但遇到了包vendor的问题。因为我想提供稳定的构建,所以我希望在我的源代码树中提供尽可能多的依赖项,但是当我提供appengine/datastore时,我遇到了运行gcloudappdeploy:OperationError:错误响应:[9]部署包含无法编译的文件:编译失败:2017/09/1901:07:31go-app-builder:解析输入失败:包“vendor/google.golang.org/appengine/search”无法导入内部包“google.gola

google-app-engine - gcloud 应用程序部署失败 "cannot import internal package"

我正在编译我想上传并在谷歌云平台上运行的GO应用程序。我正在导入appengine/datastore包,但遇到了包vendor的问题。因为我想提供稳定的构建,所以我希望在我的源代码树中提供尽可能多的依赖项,但是当我提供appengine/datastore时,我遇到了运行gcloudappdeploy:OperationError:错误响应:[9]部署包含无法编译的文件:编译失败:2017/09/1901:07:31go-app-builder:解析输入失败:包“vendor/google.golang.org/appengine/search”无法导入内部包“google.gola

去构建错误 : no non-test Go files in <dir>

尝试运行时出错gobuild./...来self的$GOPATH/src。nonon-testGofilesin错误是正确的中没有测试文件但为什么会导致编译错误?是错误吗? 最佳答案 称其为错误……如果测试通过,构建应该不会失败。归档于此:https://github.com/golang/go/issues/22409我提交的错误是https://github.com/golang/go/issues/8279的副本看起来它在1.3中被破坏了。 关于去构建错误:nonon-testGo

去构建错误 : no non-test Go files in <dir>

尝试运行时出错gobuild./...来self的$GOPATH/src。nonon-testGofilesin错误是正确的中没有测试文件但为什么会导致编译错误?是错误吗? 最佳答案 称其为错误……如果测试通过,构建应该不会失败。归档于此:https://github.com/golang/go/issues/22409我提交的错误是https://github.com/golang/go/issues/8279的副本看起来它在1.3中被破坏了。 关于去构建错误:nonon-testGo

unit-testing - 如何在导入包中重用测试代码?

这个问题在这里已经有了答案:CanIcreatesharedtestutilities?(2个答案)关闭3年前。这是我的目录层次结构:/|--main.go//packagemain,anHTTPserverwhichacceptsrequestandcallsC/UAPIsinpkg1tofinishcertaintask|--main_test.go//wantstocallveryfyTaskNumberinpkg1_test|--pkg1//packagepkg1,CRUDAPIswithRetrieve&Deleteunexportedforsafety|--pkg1_tes

unit-testing - 如何在导入包中重用测试代码?

这个问题在这里已经有了答案:CanIcreatesharedtestutilities?(2个答案)关闭3年前。这是我的目录层次结构:/|--main.go//packagemain,anHTTPserverwhichacceptsrequestandcallsC/UAPIsinpkg1tofinishcertaintask|--main_test.go//wantstocallveryfyTaskNumberinpkg1_test|--pkg1//packagepkg1,CRUDAPIswithRetrieve&Deleteunexportedforsafety|--pkg1_tes

unit-testing - 当测试在另一个包中时获取覆盖率统计信息

我的测试与我的代码不在同一个包中。我发现这是一种使用大量测试文件组织代码库的不那么困惑的方式,而且我读到这是一个好主意,可以将测试限制为通过包的公共(public)api进行交互。所以它看起来像这样:api_client:Client.goArtistService.go...api_client_testsArtistService.Events_test.goArtistService.Info_test.goUtilityFunction.go...我可以输入gotestbandsintown-api/api_client_tests-cover并查看0.181s覆盖率:100.

unit-testing - 当测试在另一个包中时获取覆盖率统计信息

我的测试与我的代码不在同一个包中。我发现这是一种使用大量测试文件组织代码库的不那么困惑的方式,而且我读到这是一个好主意,可以将测试限制为通过包的公共(public)api进行交互。所以它看起来像这样:api_client:Client.goArtistService.go...api_client_testsArtistService.Events_test.goArtistService.Info_test.goUtilityFunction.go...我可以输入gotestbandsintown-api/api_client_tests-cover并查看0.181s覆盖率:100.