我通过将代码拆分为更多 Go 包对代码进行了大扫除,主要是为了提高可重用性(每个“构建块”都在自己的包中)。
修复导入错误后,我发现我的程序突然无法构建。运行“go build”会返回一个nosplit 堆栈溢出错误。
机器人 main.init: nosplit 堆栈溢出
120 guaranteed after split check in main.init
112 on entry to robot/web.init
104 on entry to robot/controller.init
96 on entry to robot/slam.init
88 on entry to robot/slam/hector.init
80 on entry to hectormapping/map/mapimages.init
72 on entry to hectormapping/map/maprep.init
64 on entry to hectormapping/map/mapproccontainer.init
56 on entry to hectormapping/scanmatcher.init
48 on entry to hectormapping/map/gridmap/occbase.init
40 on entry to hectormapping/map/gridmap/base.init
32 on entry to hectormapping/map/gridmap.init
24 on entry to github.com/skelterjohn/go%2ematrix.init
16 on entry to math.init
8 on entry to math.init┬À1
0 on entry to runtime.panicindex
-8 on entry to runtime.morestack00
runtime.main: nosplit 堆栈溢出
120 guaranteed after split check in runtime.main
128 after runtime.main uses -8
120 on entry to main.init
112 on entry to robot/web.init
104 on entry to robot/controller.init
96 on entry to robot/slam.init
88 on entry to robot/slam/hector.init
80 on entry to hectormapping/map/mapimages.init
72 on entry to hectormapping/map/maprep.init
64 on entry to hectormapping/map/mapproccontainer.init
56 on entry to hectormapping/scanmatcher.init
48 on entry to hectormapping/map/gridmap/occbase.init
40 on entry to hectormapping/map/gridmap/base.init
32 on entry to hectormapping/map/gridmap.init
有谁知道这是关于什么的?我找不到关于可能导致它的原因的太多文档,除了在某些情况下,这是一个应该已修复的错误。
一些代码被拆分到“src”文件夹中的一个新文件夹中,因此文件结构现在是:
src/robot/main.go (main() lives here)
src/robot/(...) (application-specific packages)
src/hectormapping/(...) (stand-alone package used in "robot")
我在 Windows 7 (x64) 上使用 Go 1.0.3。
相关分类