windows下beego的安装

1.go get 可能不好使

多尝试几次,ping 一下 github.com ,可能是被墙了,没办法,只能找代理了
运气好的话,就继续下去吧,否则请绕路
说明: 全局只有一个
事先声明,默认情况下,go get 是下载到 GOPATH (这是go的工作目录)的全局变量的目录下的
搞清楚这个目录后,方便后面使用,否则重新建立,但是记住,这个目录 全局只有一个
2.从 go get bee 工具 开始 1设置好了GOPATH后
【windows下beego的安装】1?? go get -v github.com/beego/bee
windows下beego的安装
文章图片

github.com/beego/bee (download) github.com/beego/bee/vendor/gopkg.in/yaml.v2 github.com/beego/bee/logger/colors github.com/beego/bee/vendor/github.com/lib/pq/oid github.com/beego/bee/vendor/github.com/go-sql-driver/mysql github.com/beego/bee/vendor/github.com/lib/pq github.com/beego/bee/logger github.com/beego/bee/vendor/github.com/derekparker/delve/dwarf/util github.com/beego/bee/vendor/golang.org/x/debug/dwarf github.com/beego/bee/vendor/github.com/derekparker/delve/dwarf/frame github.com/beego/bee/config github.com/beego/bee/vendor/github.com/derekparker/delve/dwarf/line github.com/beego/bee/vendor/github.com/derekparker/delve/dwarf/op github.com/beego/bee/utils github.com/beego/bee/vendor/golang.org/x/sys/windows github.com/beego/bee/vendor/rsc.io/x86/x86asm github.com/beego/bee/vendor/github.com/derekparker/delve/dwarf/reader github.com/beego/bee/cmd/commands github.com/beego/bee/vendor/github.com/derekparker/delve/version github.com/beego/bee/cmd/commands/version github.com/beego/bee/vendor/github.com/derekparker/delve/config github.com/beego/bee/vendor/github.com/mattn/go-isatty github.com/beego/bee/cmd/commands/migrate github.com/beego/bee/cmd/commands/bale github.com/beego/bee/cmd/commands/beefix github.com/beego/bee/vendor/github.com/derekparker/delve/proc github.com/beego/bee/vendor/github.com/mattn/go-colorable github.com/beego/bee/generate github.com/beego/bee/vendor/github.com/peterh/liner github.com/beego/bee/vendor/github.com/fsnotify/fsnotify github.com/beego/bee/cmd/commands/dockerize github.com/beego/bee/cmd/commands/api github.com/beego/bee/vendor/github.com/astaxie/beego/swagger github.com/beego/bee/vendor/github.com/astaxie/beego/utils github.com/beego/bee/cmd/commands/hprose github.com/beego/bee/cmd/commands/new github.com/beego/bee/vendor/github.com/derekparker/delve/service/api github.com/beego/bee/cmd/commands/pack github.com/beego/bee/generate/swaggergen github.com/beego/bee/cmd/commands/rs github.com/beego/bee/vendor/github.com/derekparker/delve/service github.com/beego/bee/vendor/github.com/derekparker/delve/service/debugger github.com/beego/bee/vendor/github.com/gorilla/websocket github.com/beego/bee/cmd/commands/server github.com/beego/bee/cmd/commands/generate github.com/beego/bee/vendor/github.com/derekparker/delve/service/rpc2 github.com/beego/bee/vendor/github.com/derekparker/delve/service/rpc1 github.com/beego/bee/vendor/github.com/derekparker/delve/terminal github.com/beego/bee/cmd/commands/run github.com/beego/bee/vendor/github.com/derekparker/delve/service/rpccommon github.com/beego/bee/cmd/commands/dlv github.com/beego/bee/cmd github.com/beego/bee

2 添加bee 工具的bin目录路径到环境变量path
进入到GOPATH的里面的bin目录下:
将bin目录路径添加到path环境变量下;
注:如果添加后导致go 命令不能使用,那就删了bee刚刚添加的bin路径,重启一下高级系统设置,然后再次添加(我的错误可能是由于使用 set path=F:\goPATH\bin cmd 命令不成功导致的)
查看bee 命令是否可以使用
F:\goPATH>bee 'bee' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

问题解决
将bin目录路径添加到path环境变量下;
再次查看
F:\goPATH>bee Bee is a Fast and Flexible tool for managing your Beego Web Application.USAGE bee command [arguments]AVAILABLE COMMANDSversionPrints the current Bee version migrateRuns database migrations apiCreates a Beego API application baleTransforms non-Go files to Go source files fixFixes your application by making it compatible with newer versions of Beego dlvStart a debugging session using Delve dockerizeGenerates a Dockerfile for your Beego application generateSource code generator hproseCreates an RPC application based on Hprose and Beego frameworks newCreates a Beego application packCompresses a Beego application into a single file rsRun customized scripts runRun the application by starting a local development server serverserving static content over HTTP on portUse bee help [command] for more information about a command.ADDITIONAL HELP TOPICSUse bee help [topic] for more information about that topic.

3. 继续下载beego
F:\goPATH>go get -v github.com/astaxie/beego
github.com/astaxie/beego (download) github.com/astaxie/beego/vendor/gopkg.in/yaml.v2 github.com/astaxie/beego/config github.com/astaxie/beego/utils github.com/astaxie/beego/logs github.com/astaxie/beego/grace github.com/astaxie/beego/session github.com/astaxie/beego/toolbox github.com/astaxie/beego/vendor/golang.org/x/crypto/acme github.com/astaxie/beego/context github.com/astaxie/beego/vendor/golang.org/x/crypto/acme/autocert github.com/astaxie/beego/context/param github.com/astaxie/beego

4.开启beego之旅
进入F:\goPATH\src下,执行bee new webApp
______ | ___ \ | |_/ /______ | ___ \ / _ \ / _ \ | |_/ /|__/|__/ \____/\___| \___| v1.10.0 2018/12/08 22:56:37 INFO? 0001 Creating application... createF:\goPATH\src\webApp\ createF:\goPATH\src\webApp\conf\ createF:\goPATH\src\webApp\controllers\ createF:\goPATH\src\webApp\models\ createF:\goPATH\src\webApp\routers\ createF:\goPATH\src\webApp\tests\ createF:\goPATH\src\webApp\static\ createF:\goPATH\src\webApp\static\js\ createF:\goPATH\src\webApp\static\css\ createF:\goPATH\src\webApp\static\img\ createF:\goPATH\src\webApp\views\ createF:\goPATH\src\webApp\conf\app.conf createF:\goPATH\src\webApp\controllers\default.go createF:\goPATH\src\webApp\views\index.tpl createF:\goPATH\src\webApp\routers\router.go createF:\goPATH\src\webApp\tests\default_test.go createF:\goPATH\src\webApp\main.go 2018/12/08 22:56:37 SUCCESS? 0002 New application successfully created!

1执行时出现问题
进入F:\goPATH\src下,直接执行bee run webApp(不好,出问题了)
F:\goPATH\src>bee run webapp ______ | ___ \ | |_/ /______ | ___ \ / _ \ / _ \ | |_/ /|__/|__/ \____/\___| \___| v1.10.0 2018/12/09 13:08:35 INFO? 0001 Using 'webapp' as 'appname' 2018/12/09 13:08:35 INFO? 0002 Initializing watcher... can't load package: package .: no Go files in F:\goPATH\src 2018/12/09 13:08:36 ERROR? 0003 Failed to build the application: can't load package: package .: no Go files in F:\goPATH\src

2 解决办法,需要进入到项目目录下,直接bee run任何参数都不需要加
F:\goPATH\src\webapp>bee run ______ | ___ \ | |_/ /______ | ___ \ / _ \ / _ \ | |_/ /|__/|__/ \____/\___| \___| v1.10.0 2018/12/09 12:55:33 INFO? 0001 Using 'webapp' as 'appname' 2018/12/09 12:55:33 INFO? 0002 Initializing watcher... 2018/12/09 12:55:36 SUCCESS? 0003 Built Successfully! 2018/12/09 12:55:36 INFO? 0004 Restarting 'webapp.exe'... 2018/12/09 12:55:36 SUCCESS? 0005 './webapp.exe' is running... 2018/12/09 12:55:38.098 [I] [asm_amd64.s:2337]http server Running on http://:8080 [beego] 2018/12/09 - 12:55:56 |::1| 200 |19.9616ms|match| GET/r:/ [beego] 2018/12/09 - 12:55:57 |::1| 304 |499.6μs|match| GET/static/js/reload.min.js

3.去浏览器查看结果:
复制 localhost:8080到地址栏, 查看到如下结果,标明OK
windows下beego的安装
文章图片

    推荐阅读