Build Go program under Windows

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

See the Go language this afternoon (I see "Go Language Programming"), which has a complete program, but the book is built in the Linux environment, but I am in the Windows environment, how much different.

The first thing to figure out is the path to go:

Goroot:go is automatically added to the system environment variable after installation

Gopath: This needs to be configured by itself, the class is in Java configuration classpath the same

After creating the environment variable, build the first project:

1. Program Directory structure:

A

b) where the parent directory of this bin is the directory of the Gopath configuration, bin, pkg, src start with some empty folders

c) SRC created below are some packages, such as: Algorithm,sorter

D) The code is all placed in SRC

2. After writing the code, start building the program.

A) A brief introduction to the program structure

I. Main function in the Sorter.go file, Sorter.go calls the functions in the Bubblesort.go and file Qsort.go files

II. BUBBLESORT_TEST.GO and qsort_test.go are test files

b) Enter the directory where Gopath is located in the command line

c) and then start building the code

I. Go build Algorithm/qsort

II. Go Build Algorithm/bubblesort

Iii. Go Test Algorithm/qsort

Iv. Go Test Algorithm/bubblesort

V. Go install Algorithm/qsort

VI. Go Install Algorithm/bubblesort

Vii. Go Build Sorter

Viii. Go Install Sorter

D) If no prompt error message appears, you can see a sorter.exe file in the current directory

e) then run up to see if the expected results

f) to be here is to build and execute the GO program successfully

3. Final result diagram:

December 10, 2015 17:25:37

By:champly

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.