Golang Environment Construction

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

Build Golang development environment under Windows

Golang Installation

Download the corresponding operating system version and install, download address: Http://www.golangtc.com/download, for example, the download is go1.6beta1.windows-amd64.msi.

environment variable configuration, you only need to configure goroot,GOBIN , and gopath three environment variables.

GOBIN : Golang The bin directory under the root of the installation, that is, the default is C:\go\bin under the $goroot\bin\,windows platform, which is automatically added by the installer to the PATH environment variable during installation.

goroot : Golang The root directory after installation, Windows defaults to C:\go\, which is automatically written to the system environment variable during installation.

Gopath : Golang's working directory is an important variable to set the package load path, which is also the directory that go get and go install tools will use. The Gopath variable can have multiple directories at the same time, on Mac and Linux systems: Delimited and passed on Windows systems; In most cases, the first path will be preferred.

Open cmd and run the Go version command if you see the following message stating that the environment variable is configured successfully.

Compile and run the first Golang program:

// Hello.go Package   mainimport (    "fmt")func main () {    FMT. Println ("Hello world! Welcome to Go lang! " ) }

liteide Installation

Download version of Windows, download address: Http://www.golangtc.com/download/liteide.

Unzip the Liteidex28.windows-qt4.zip to local, for example: C:\liteide\.

Check the liteide environment variable: View + Edit Current Environment

mingw-w64 GCC toolchains Installation

You can use MINGW-W64 on the liteide to debug Golang on a gdb,windows that needs to be installed. Liteide environment variable LITEIDE_GDB can specify which gdb to use for debugging: On Windows, 32-bit environments use Gdb64.exe with gdb.exe,64-bit environments. This environment variable can be manually configured in the environment configuration file.

Download MinGW GCC toolchains, download address: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/ personal%20builds/rubenvb/gcc-4.8-release/

Unzip the x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z to local, for example: C:\mingw64\.

Check Modify liteide environment variable: view (V) + Edit Current Environment

Set Liteide compilation options, turn on debug: Compile (B) = + Compile config ... = change the Buildargs option to-gcflags "-n-l"

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.