Go Language Win7 Environment building

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
  1. Go download

    For some reason golang.org can not access, looked for a long time to find the following mirror address under

    http://fossies.org/windows/misc/

    My environment is Win7 32 bit , so choose go1.5.1.windows-386.zip to download

  2. Go installation

    Unzip the downloaded file to D:\app\go

    Set the Windows environment variable goroot=d:\app\go

    Add%goroot%\bin in the environment variable path

    This allows you to run programs in the%goroot%\bin directory directly from any directory in DOS command mode.

    About the setup instructions for goroot and Gopath

    Goroot:go installation path, the official package path is automatically matched according to this setting

    Gopath: Working path (project path or third-party package path), you can set multiple, separated by semicolons (;)

    Since my development tool is liteide, (as for why choose it and its installation configuration, follow-up) This tool can be set Gopath, so here the environment variable is no longer set Gopath

  3. The choice of Go development tools

    Since I had previously developed a Java project based on Eclipse, search learned that the Eclipse plug-in can develop the go language, and it is natural to think that the development tools for the go language using Goclipse are more appropriate, by downloading the installation configuration (goclipse Process everyone can search on the internet has a lot, here is not detailed description), finally found that the latest version of Goclipse can not be implemented GDB debugging (online introduction of the version may be implemented), always reported ^error,msg= "Undefined item: \" Utf-8\ "." Error, online search for a long time has not found a solution, because of this reason had to give up.

    If you have a solution, you may as well tell me. So I tried to develop it with liteide.

  4. Liteide Download

    Liteide of the introduction of people can find their own online, the following is Golang China provides liteide download

    Http://www.golangtc.com/download/liteide

    Choose your own appropriate system files to download, here I choose is liteidex27.2.1.windows-qt5.7z

    About the difference between liteidex27.2.1.windows-qt5.7z and liteidex27.2.1.windows-qt4.7z, the information is qt4 and qt5 differences, not too familiar with the development of QT, two are downloaded after the operation is not a problem, so the final choice to use liteidex27.2.1.windows-qt5.7z

  5. Liteide Installation

    Unzip the downloaded file to D:\app\liteide

    Run Bin\liteide.exe to start

  6. Liteide Configuration

    liteide Start, the first step needs to set the current environment, because my machine environment is Win7 32 bit, so I choose is Win32, the specific way is in the middle of the toolbar, there is a drop-down selection box, which lists the supported system environment, there are Win64, CROSS-LINUX32, etc.

    After the switch is complete, you can edit it by looking at the edit current context menu, where you need to check if the setup goroot is your go installation path

    Create a new project path, for example: D:\work\go\hello, for storing your project code or a third-party package code

    After that, by looking under the Manage Gopath menu to add your new path, note, add to the Custom directory box, where you can add multiple paths, the effect is equivalent to the one we mentioned above in the system environment variable set Gopath

  7. Simple Project

    After the above operation configuration is complete, we can add the directory menu under the file to select D:\work\go\hello to develop the

    Create the Go source file Main.go content as follows

  8. Package Mainimport ("FMT") func main () {FMT. Println ("Hello world!")}

    Execute ctrl+b to compile or ctrl+r compile and run, but also to debug

    Now some of the third-party packages of Go languages are on GitHub, and how we reference them becomes a problem.

    Go language support Get method, can get download code from remote, how to combine liteide to implement, next we introduce

  9. git installation

    Downloading the third package from GitHub requires the installation of a GIT client

    We can download the corresponding client program from https://github.com/git-for-windows/git/releases, here I choose Git-2.5.2.2-32-bit.exe

    The download completes the installation, the detailed procedure everybody may carry on the search

  10. git settings

    support Git in liteide, need to pass the setting to be able, concrete way: View under Edit Current Environment menu to enter environment edit, add git installation path in path, concrete setting example: Path=c:\mingw32\bin;%goroot%\bin; C:\Program files\git\bin;%path%

  11. Third party Kingshard Project

    Through the above settings, we can refer to download third party package, here I take the Kingshard project as an example, the project introduction you can see the address: Https://github.com/flike/kingshard

How to: Modify the previous Main.go file, add a reference to the "Github.com/flike/kingshard" in the header reference

Package Mainimport ("FMT" "Github.com/flike/kingshard") func main () {FMT. Println ("Hello world!")}

After selecting the "G" icon button in the Liteide toolbar, the project source file will be downloaded automatically.

Need to say is, if a project directory root below the go source file does not have, can not this get,

Failed connect to github.com:443 error may be reported when get, you need to execute in git Shell client command

git config--global http.sslverify false

Turn off SSL so you can access GitHub using the HTTP protocol

The Go language environment is basically built.




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.