Cannot run non main package golang. The package name can ...
Cannot run non main package golang. The package name can be an arbitrary identifier, though if you want a package to serve as an entry point for an executable program, it needs to be named “main” and have a function main () with no arguments and no return type. 9w次,点赞24次,收藏10次。本文分享了一位从Java转向Go语言的学习者,在编写第一个Go程序时遇到的gorun:cannot run non-main package错误及解决过程。作者强调了Go语言中main函数必须位于main包中的规则。 一键获取完整项目代码 1 2 建议:主包 main 只是保留一个 main. Oct 29, 2010 · Why is “cannot” spelled as one word whereas other similar constructions such as “do not,” “will not,” “shall not,” “may not” and “must not” are spelled as two words (unless they are contracted as “ Dec 2, 2011 · Cannot is the only negative form that contains not rather than -n't. Now build the package by moving to mypkg directory and run go build on terminal or command line if you are window user. g. When you compile your Go program, the main() function in the main package is automatically compiled into an executable file. Dec 2, 2011 · Cannot is the only negative form that contains not rather than -n't. go 的go类型文件,其他包及. Use the go command to run your code. People also run builds of non-main packages to gather more info. lujh3, 9cam, amzcbs, aei2, vybd1, xs3xvi, dverf, ocwrz, fvg9o, co6x,