Compile the go language on Windows

Source: Internet
Author: User

Google hasn't officially released the go language compiling environment on the Windows platform. However, if you want to use the go language, you can try writing

Port version

Download:

Go-1.zip 

 

 

Environment Settings:

Set goroot = <The go folder> <br/> set GOOS = mingw <br/> set goarch = 386 

For example, I installed it in the following directory:

F:/tool/go-1/go/

 

The settings are as follows:

 

C:/> set goroot = F:/tool/go-1/go/

 

C:/> set GOOS = mingw

 

C:/> set goarch = 386

 

C:/> set Gobin = F:/tool/go-1/go/bin

 

 

Compilation exampleProgram

 

Enter a program in notepad and save it as hello. Go.

 

Package main
Import "FMT"

Func main (){
FMT. printf ("Hello, world! /N ");

}

 

 

Enter

 

8g hello. Go

Compile and output the hello.8 file.

 

Connect to the file to generate an executable file

8l-O hello.exe hello.8

 

Connection output hello.exe

 

The output of hello.exe is as follows:

Hello, world!

 

The entire process is as follows:

 

F:/go> 8g hello. Go

 

F:/go> 8l-O hello hello.8

 

 

 

F:/go> hello.exe

Hello, world!

 

 

 

 

 

 

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.