作者:QuincySwim | 来源:互联网 | 2023-05-18 04:11
问题】
我有一个文件夹,文件夹名字叫 12 ,并且我创建了一个Go源文件 12_test.go,代码如下:
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
运行下面命令时出了错:
go build 12_test.go
"go build command-line-arguments: no buildable Go source files in D:\12"
【解决】
_test后缀在Go语言中有着特殊含义,是用来给Go程序做测试的,build工具会忽略它们。从文件名中删除_test,或者重命名就可以解决这个问题。
原文地址:http://stackoverflow.com/questions/29136488/go-no-buildable-go-source-file-in