Go Language Primer-install-write-run

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

First, installation
Unzip the downloaded go language and put it on the C drive.




Second, the variable set.






We have added five global variables in the loop-increment variable-system variable, with the name
1. Variable name: GOBIN variable value: C:\go\bin It means that the Go compiler directory is in the C:\go\bin folder.
2. Variable name: Goroot variable value: C:\go It means that the home directory of Go is in the C:\go folder.
3. Variable name: GOOS Variable Value: MinGW If you download a second address, the value of this variable should be windows. This is why, because we have a folder under the C:\go\pkg directory named mingw_386, its dash front is mingw. And if we download the second address of the go language, the C:\go\pkg directory under the name of the folder becomes Windows_386,goos to find this folder, so we have to change according to the situation, if you do not change, the compiler will not find the library and error.
4, variable name: Goarch Variable Value: 386 This is basically the same as above. Don't say much.
5, this setting must pay attention, the above 4 have to we go to new, but the path does not need us new, the system generally has already had, just need us to fill in the content, so we point "edit", not "new". The specific variable value is%gobin%, but to illustrate, to the original basis of reference to the previous variable pattern plus a semicolon, this must be noted

http://blog.csdn.net/yjflinchong/article/details/8049350





Third, download and install notepad++5.6.8 (not to download the address, Google on a large)

Iv. Configure the notepad++:
After installing the notepad++, we also need to install a plugin for it. The installation process is plug-in-plugin manage-show Plugin Manager (see)





Under Available menu, find a plug-in called Nppexec, select, click Install Installation. See.





After the plug-in is installed, we need to set up the plugin. See



The specific settings are as follows:




V. Testing

Open notepad++, dot format-in UTF-8 no BOM format encoding, we want to write a go program in UTF-8 format. Here also note that before writing the program, must be used without BOM UTF-8 mode write, that is, the first change mode after the program, otherwise notepad++ will be in the default ANSI format encoding, the result is English is visible, and Chinese is garbled. The following is a well-written program, you can paste directly, (see):

Paste the following procedure into the notepad++:

Package Main
Import "FMT"
Func Main () {

Fmt. Printf ("Hello! China! Hello, World!!!! \ n ")

}

We save the program for a moment. See:


Name Hellol.go, save it to go directory or any directory, this according to your own hobby, there is no limit.

Finally, let's compile this go program, which I compiled:





We use the following command directly in the notepad++ can be debugged and compiled, we pay attention to the picture.
The specific commands are:
CD C:\go We go to the Go directory on the C drive first.
8g hello.go We compile hello.go file
8l hello.8 We connect hello.8 file
8 We execute executable file 8.exe, you can also enter 8.exe to execute.
After execution we can see the test characters in Chinese and English, stating that we are done.
If you download the second address of the go version, then after the connection is generated by the Hello.out.exe, then you need to type in the execution of Hello.out.exe to execute, so that the smooth completion of this, sometimes friends will be careless ah, to pay attention to.
Test success


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.