1、install go
go1.11.4.windows-amd64.msi #默认安装就可以
2、goland
goland-2018.2.2.exe 安装完成,不要运行软件。
软件下载:https://www.jetbrains.com/go/download/#section=windows (注意版本,否则激活不了)
安装路径:
D:Program FilesJetBrainsGoLand 2018.2.2
#程序的存放目录
D:GoFilessrc
软件激活方法:
#复制文件到下面目录中
D:softwarego开发工具goland-2018.2.2软件和激活工具libJetbrainsCrack-3.1-release-enc.jar
#修改配置文件:
在这个配置文件中增加JetbrainsCrack-3.1-release-enc.jar文件路径:
-javaagent:D:Program FilesJetBrainsGoLand 2018.2.2libJetbrainsCrack-3.1-release-enc.jar
D:softwarego开发工具goland-2018.2.2软件和激活工具ingoland.exe.vmoptions
D:softwarego开发工具goland-2018.2.2软件和激活工具ingoland64.exe.vmoptions
激活软件:
Activation code : www.sdbeta.com
3、安装git
Git-2.20.1-64-bit.exe
4、install beego
go get github.com/astaxie/beego
go get github.com/beego/bee
#创建项目名称
bee new word
#运行项目
bee run word
5、手工运行go报错:
D:GoFilessrc>bee run word
______
| ___
| |_/ / ___ ___
| ___ / _ / _
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
2018/12/29 17:23:27 INFO ▶ 0001 Using 'word' as 'appname'
2018/12/29 17:23:27 INFO ▶ 0002 Initializing watcher...
can't load package: package .: no Go files in D:GoFilessrc
2018/12/29 17:23:27 ERROR ▶ 0003 Failed to build the application: can't load
解决方法:
修改:vi main.go
package main
import (
"fmt"
_ "./routers" #修改为当前路径
"github.com/astaxie/beego"
)
func main() {
fmt.Println("hello world")
beego.Run()
}
D:go_scriptshello outers
package routers
import (
"../controllers" #修改为上上一级目录
"github.com/astaxie/beego"
)
func init() {
beego.Router("/", &controllers.MainController{})
}