"Original" Go language and Web frame beego environment without brain building

Source: Internet
Author: User
Tags version control system
This is a creation in Article, where the information may have evolved or changed.

The software in this article is subject to the latest version as of October 12, 2013.

1, related software preparation:

1) Go1.2rc1.windows-386.msi, corresponding to 32-bit Windows system installation using

Download Address:

Https://code.google.com/p/go/downloads/detail?name=go1.1.2.windows-386.msi

2) Go1.2rc1.windows-amd64.msi, corresponding to 32-bit Windows system installation using

Download Address:

Https://code.google.com/p/go/downloads/detail?name=go1.2rc1.windows-amd64.msi

3) liteidex19.windows.7z, the Chinese developed the go language IDE

Download Address:

https://code.google.com/p/golangide/downloads/detail?name=liteidex19.windows.7z&can=2&q=

4) Git-1.8.4-preview20130916.exe,msysgit is the version of Git version control system under Windows

Download Address:

Https://code.google.com/p/msysgit/downloads/list

2, Environment Construction:

1) Go Language Environment construction:

Step One,

Depending on whether the operating system is 32-bit or 64-bit to select the corresponding MSI file, double-click a fool to finish.

Step Two,

In the console to see if the go locale is complete, in Windows7, find "command Prompt" in "Start", right-click "Run as Administrator", enter "Go" and appear

Here you can see if the environment variable has been added to the Go Bin path, or at "command Prompt", enter "path", there is "installation path \ Bin" in the content. For example, I installed the path is the default C:\Go, then the appearance is OK.

For the convenience of subsequent work, here is a gopath, add a gopath system variable in the environment variable, as shown in.

In path, add "%gopath%bin" as shown in.

Incidentally, the Go Program directory structure is under the Gopath folder, divided into bin, pkg, and src three sub-folders

Bin folder : The binary executable program generated by each project of go. The. exe file is generated under Windows and executable files are generated under Linux. One of the biggest features of Go is portability, which means that when a demo.exe is generated, it can be executed on any Windows system (even if the go installation package is not installed). This is to let Php,python and other scripting language look mo.

pkg Folder : third-party libraries. Store the third-party libraries referenced in your project (unofficially provided libraries)

src folder : Each sub-folder (such as demo) represents a Go project, which stores the source program.

2) Use of the Go Language development IDE Tool Liteide:

Unzip our download good liteidex19.windows.7z, put Liteide folder in your favorite location, find \liteide\bin path Liteide.exe, very handsome a Taiji icon, double-click to run.

For Liteide, there are some simple settings: (Take the 64-bit version of Windows7 as an example)

Step one, find "options" in "View"

Step two, see if the path to the Goroot is the installation path for Go

Step three, view Gopath, two methods: one is to find "management Gopath" from "View";

The other is the yellow go button in the click. The Gopath path we configured earlier is seen here.

Once these settings are complete, restart the Liteide and click "Package Browse" on the left to see it.

National People's Congress cow VISUALFC produced this IDE is really handsome, smart tips, all kinds of debugging have, speed is also very fast.

3) GIT tool installation:

Double-click Install our download Git-1.8.4-preview20130916.exe, all the way to the idiot installation. After the installation is complete, you should see it in "Start", "All Programs", "Git".

4) Web Framework Beego Environment Construction:

Beego This framework is a lightweight application framework written by Chinese Daniel Xie Mengjun, which has a description of the framework in his book Go Web programming, and is well written in various ways.

We've installed git in front of us, and that's going to work.

Step One, install Beego

Click "Git Bash" and enter "Go get Github.com/astaxie/beego", as

Wait a minute. After the installation is complete, under the Gopath path, the path I gopath here is "C:\mygo\",

You can see the Astaxie folder under the "C:\mygo\pkg\github.com\" and "C:\mygo\src\github.com\" paths, as well as the subordinate Beego folder.

Step two, install the Bee tool (framework Generation tool)

For a convenient build frame, click "Git Bash" and enter "Go get Github.com/astaxie/bee", as

Also wait a while. When you are finished, under the "C:\mygo\src\github.com\" path, the Astaxie folder can see the subordinate Bee folder.

At the same time, in the Gopath path of the src sibling bin, there is "Bee.exe" file.

Step three, using the Bee tool to generate the framework engineering code

In start, locate the command prompt, right-run as administrator, enter the SRC path to Gopath, and then enter Bee new project name, as shown in.

The project of such a Beego framework has been built successfully.

Step four, use Liteide to open the run.

Find "Open Directory" in Liteide's "files" and locate the project folder you just created, as

Click "Select Folder" to load the entire project

Clear MVC at a glance. Ctrl+r compiled and executed. Of course you can also set breakpoints for various debugs.

Open the browser and enter "http://127.0.0.1:8080" to see the results of the operation.

To end the run, click the Small red button on the liteide after the "compile output".

3. Reference documents

Xie Mengjun, "Go Web Programming"

All the experiences of the seniors on the network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.