Go Language Learning 1.7

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

2014 is ready to learn about go, after all, is Daniel Ken Tompson participate in the project, understand.

Bought a "Go Language Program Design", read the first chapter today, the 1.7 section of the concurrency is after all interested in

Features Summary:

1. In most cases no need to display the lock

2. Goroutine can have many

3.channel channel to pass data instead of shared data


Run a routine Polar2cartesian, the effect is good, but there is a problem has not been solved.

Input terminated to Ctrl + Z, but repeated testing can not exit the loop, only with Ctrl + C exit


Related code:

If runtime. GOOS = = "Windows" {
prompt = Fmt. Sprintf (prompt, "Ctrl + Z, Enter")
} else {
prompt = Fmt. Sprintf (Prompt, "ctrl+d")
}

It means that the Windows operating system uses CTRL + Z

Fmt. Printf ("Radius and Angle:")
Line, err: = Reader. ReadString (' \ n ')
If err! = Nil {
Break
}

This is the condition of exiting the loop, the practice proves that cannot exit successfully


Who knows why?


In addition, go 1.2 seems to be stable, much better than the go used two years ago. Oh, can continue to learn

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.