GoLand error: run after the build is not possible the 'main' file has the non-ma

602 阅读1分钟

GoLand error: run after the build is not possible the 'main' file has the non-main package or does not contain the 'main' function

image.png

在该目录下创建 bin,pkg,src三个文件夹

src目录下创建一个文件夹名字可为项目名(自定义)再在里面创建main.go(意思就是main方法是在src目下创建才可以正常运行的)

必须是 main 包

package main

必须是 main方法

func main()

文件名不一定是 main.go

image.png

debug

image.png