我在构建项目时遇到了问题,即" goapp serve"。
我收到此消息:
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
我的项目结构如下:
golang_projects
bin
...
pkg
...
src
googleglass_backend
app.yaml
handlers
utils.go
mainpage.go
index.yaml
server.go
types
data.go
user.go
我的GOPATH看起来像这样:
/Users/simon/Programming/golang_projects
我不知道data.go可能与哪些内容发生冲突?
我的server.go文件:
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)
}
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
}