How to compile Go program consisting of multiple files?

前端 未结 7 1062
野的像风
野的像风 2020-12-04 09:15

I have a small program that consists of three files, all belonging to the same package (main), but when I do \"go build main.go\" the build doesn\'t succeed. When it was jus

7条回答
  •  甜味超标
    2020-12-04 10:02

    You can use

    go build *.go 
    go run *.go
    

    both will work also you may use

    go build .
    go run .
    

提交回复
热议问题