Im having problem with building my project, i.e, "goapp serve".
I get this message:
Failed to build Go application: (Executed command: /Users/simon/go_appengine/goroot/bin/go-app-builder -app_base /Users/simon/Programming/golang_projects/src/googleglass_backend -arch 6 -dynamic -goroot /Users/simon/go_appengine/goroot -gopath /Users/simon/Programming/golang_projects -nobuild_files ^^$ -incremental_rebuild -unsafe -print_extras_hash handlers/mainpage.go types/user.go types/data.go handlers/utils.go server.go)
2017/01/16 14:04:30 go-app-builder: Failed parsing input: app file data.go conflicts with same file imported from GOPATH
My project structure looks like this:
golang_projects
bin
...
pkg
...
src
googleglass_backend
app.yaml
handlers
utils.go
mainpage.go
index.yaml
server.go
types
data.go
user.go
My GOPATH looks like this:
/Users/simon/Programming/golang_projects
I dont know what data.go could be conflicting with?
My server.go file:
package main
import (
"googleglass_backend/handlers"
"googleglass_backend/types"
"github.com/gorilla/mux"
"encoding/gob"
"net/http"
"github.com/rs/cors"
)
func init() {
router := mux.NewRouter()
gob.Register(types.User{})
//For all includes in html files
router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("web/static/"))))
router.HandleFunc("/", handlers.IndexTemplate)
handler := cors.Default().Handler(router)
http.Handle("/", handler)
}
Contents of data.go:
package types
import (
"time"
)
type Data struct {
xaxis int
yaxis int
beacon_1 int
beacon_2 int
beacon_3 int
RegisterTime time.Time
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…