Reputation: 9873
I am trying to use Go with App Engine SDK for Go and when I run goapp serve
, I get the following error in printed the browser after going to http://localhost:8080 (I get similar errors in the terminal):
The Go application could not be built.
(Executed command: C:\go_appengine\goroot\bin\go-app-builder.exe -app_base C:\Projects\Go\Davilex -arch 6 -dynamic -goroot C:\go_appengine\goroot -nobuild_files ^^$ -unsafe -gopath C:\Projects\Go -print_extras_hash controllers\form\form.go main.go controllers\pages\pages.go models\form.go)
2016/01/20 22:10:42 go-app-builder: Failed parsing input: parser: bad import "syscall" in colorable_windows.go from GOPATH
Seems there is a somewhat similar question here a few days ago, with no resolve: bad import "syscall" for cloud storage APIs
At first I thought it was because I had both Python 2.7.x and 3.5.x installed and the the docs specifically say it will only work with v 2.7.x, so I uninstalled all 3.5.x references, removed the SDK and reinstalled it/unzipped/added its path to my PATH.
I can run gcloud
, goapp
and go
all fine so everything should be set up correctly as far as I can tell, and just doing regular go run main.go
runs fine and works, but I can't seem to be able to use goapp serve
and I have no clue where to go about the error above.
EDIT/SOLUTION
I created a dummy project and just added this simple set of code into it:
package main
import "net/http"
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!"))
}
And the error seems to have gone away and everything works fine. So the problem must be occuring from either my code or my use of https://github.com/gin-gonic/gin package.
Hope that may help anyone with a similar problem. Try creating another project and see if it works. If it does, you now know where the issue is coming from.
Upvotes: 0
Views: 771
Reputation: 9873
I created a dummy project and just added this simple set of code into it:
package main
import "net/http"
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!"))
}
And the error seems to have gone away and everything works fine. So the problem must be occuring from either my code or my use of https://github.com/gin-gonic/gin package.
Hope that may help anyone with a similar problem. Try creating another project and see if it works. If it does, you now know where the issue is coming from.
Upvotes: 0