go build works fine but go run fails

后端 未结 2 1562
无人及你
无人及你 2020-11-29 08:31

I have a few files in the main package under one directory:

main.go config.go server.go

When I do: \"go build\" the program builds perfect and runs fine. Whe

相关标签:
2条回答
  • 2020-11-29 08:46

    You could execute it as:

    go run .
    

    so you don't have to include all files manually.

    0 讨论(0)
  • 2020-11-29 08:57

    This should work

    go run main.go config.go server.go
    

    Go run takes a file or files and it complies those and only those files which explains the missing symbols in the original post.

    0 讨论(0)
提交回复
热议问题