The Go Configuration

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
  • Go Language Development installation package under Windows

    Official Download Address:

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

  • Go Language Civil Service network (with reference and documentation)

    http://zh.golanger.com/

Method/Step

  1. 1

    Download the Go Language Development Kit under windows in the Go Language Google Code project (download address see tools). There are two versions of Zip and MSI installed as per this download. (It is convenient to use the MSI installation version here.)

  2. 2

    Download to get an MSI installation file and run it. All the way next to set the installation path here. If you need to change the installation path.

    Note: Never have Chinese in the path. Otherwise, you will not be able to use the Go Language development tool properly.

  3. 3

    Wait for installation to end ....

    Installation Successful

  4. 4

    Because the MSI installation file is used, the Go Language environment variable is set up automatically.

    Note: If the following HelloWorld program does not work, or if you are using a ZIP package, you can set the environment variable here:

    System Variable Name:

    Goroot

    Value:

    Where Go is installed

    System Variable Name:

    Path

    Append value:

    ;%goroot%\bin

  5. 5

    When the installation is complete, verify that the go is installed correctly:

    Open a command prompt in Windows (Cmd.exe) to execute the command:

    Go version

    If the go version is displayed as normal in the diagram, the go has been installed in your computer properly.

  6. 6

    Let's test the HelloWorld of the Go language:

    Code:

    Package Main

    Import "FMT"

    Func Main () {

    Fmt. Printf ("helloworld!")

    }

    Code Note:

    Func Main () {

    Can not be written

    Func Main ()

    {

    This is not just code specification, but also the syntax of Go. Or you'll get an error.

  7. 7

    Save, compile, execute:

    1. Save to a xxx.go file (I saved here to C:\test.go)

    2. Compile and execute the command at the command prompt:

    Go build-o C:\test.exe C:\test.go

    Or

    Go Build C:\test.go

    (Note: The exe file with the output specified above has C:\test.exe, and the following will generate Test.exe (which may not be C:\test.go location) under the current path.)

    3. Execute, execute the command at the command prompt:

    Test.exe

    You can see the helloworld! words on the screen.

  8. 8

    In this step, the development environment of Go language is set up and the discussion is over.

    END

Precautions

  • Step Two:

    Note: Never show Chinese in the installation path. Otherwise, you will not be able to use the Go Language development tool properly.

  • Fourth Step:

    Note: If the following HelloWorld program does not work, or if you are using a ZIP package, you can set the environment variable here:

    System Variable Name:

    Goroot

    Value:

    Where Go is installed

    System Variable Name:

    Path

    Append value:

    ;%goroot%\bin

  • sixth step:

    code Note:

    Func main () {

    cannot be written as

    func main ()

    {

    this is not just the code specification, but the syntax of go. Otherwise the error will be

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.