简体   繁体   English

如何将 main.go 文件拆分为多个文件? [解决了]

[英]How do I split a main.go file to multiple files? [solved]

Solution: Seems to be a problem with go run .解决方案:似乎是go run的问题。 It only uses files we explicitly pass to it, try building the binary它只使用我们明确传递给它的文件,尝试构建二进制文件

I want to get a variable from my other.go file in the same directory, but still can't import it.我想从同一目录中的 other.go 文件中获取一个变量,但仍然无法导入。 Both of my files are in the main package but seem to not see each other我的两个文件都在主 package 但似乎看不到对方

Seems to be a problem with go run .似乎是go run的问题。 It only uses files we explicitly pass to it, try building the binary它只使用我们明确传递给它的文件,尝试构建二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM