Go 1.5+ : Error - imports runtime: C source files not allowed when not using cgo or SWIG

后端 未结 4 967
情书的邮戳
情书的邮戳 2021-02-07 03:07

My program was building perfectly with go 1.4.2. After installing go 1.5, I am getting following error.

imports runtime: C source files not allowed when n

4条回答
  •  無奈伤痛
    2021-02-07 03:44

    If you use brew to upgrade your go to Go 1.5. Here is my step to make it work:

    1. Remove pkg folder in %GOPATH%
    2. Reload terminal(console) session, make sure Go env goes to Go 1.5 folder.

    BTW: You need do the same thing if you want to switch from Go 1.5 back Go 1.4.2 via brew switch go 1.4.2.

提交回复
热议问题