這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
Go and Beego are part of the continuing evolution of web development. In Darwinian fashion, we see the adaptation of language and framework to meet the needs of simplification, productivity, performance, and reliability in the software development process. Let’s get going…
Installing Go
First, download the latest Go installation file here. For example, to get the Linux installation file:
$ wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
Now, you must decompress the file:
$ sudo tar -C /usr/local -xzf go1.3.3.linux-amd64.tar.gz
You should update your PATH environment variable, either in /etc/profile or in $HOME/.profile, by add these lines:
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Then logout and login again, or restart Terminal. You can also execute the above two export statements, instead.
You really need GOPATH so that Beego knows where to install Bee.
Installing Go for OS X and Windows is even easier. From here, just download, for example, the latest “.pkg” file (for OS X) or the latest “.msi” file (for Windows):
https://storage.googleapis.com/golang/go1.3.3.darwin-amd64-osx10.8.pkg
Or
https://storage.googleapis.com/golang/go1.3.3.windows-amd64.msi
Installing Beego
You will need to install Git first. In Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install git
For Git on OS X and Windows, look here.
Now, you can install Beego:
$ go get github.com/astaxie/beego
$ go get github.com/beego/bee
Finally, create your first Beego project and run it:
$ cd $GOPATH/src
$ bee new yourprojectname
$ cd yourprojectname
$ bee run
There, you’re done! Visit http://localhost:8080 to see the app running.
Wrapping Up
Do not be afraid of the command line. It is your friend! Very often, the monuments to mouse and GUI just get in the way and make things more awkward than they need to be.
I’m not suggesting you that do everything on the command line. But for the simpler operations, such as downloading or updating software, the keyboard is much more efficient.