Go language knowledge accumulation--Features introduction and Windows Development environment construction

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
Origin see an article about how to reduce the server from 30 to 2, performance even more excellent. This article describes the completion of this excellent task in the language of go, so the go language has become interested in, and gradually understand that this is a relatively new language, and the potential is very sufficient. So we started a research trip.
Features Introduction:
1. Introduce lightweight threading--the coroutine, called Goroutine in the Go language.
2. Use the Erlang-style concurrency model, where messages are the only means of communication between processes (rather than shared memory). Communication between two Goroutine is carried out via channel.
3. The code style is unified, such as the public variable must start with a capital letter, the private variable must start with a lowercase letter, thus omitting the two keywords. {The writing in {} cannot be another line, and so on.
The 4.defer keyword, regardless of whether the program is unusual, executes code at exit. A large number of try and catch statements are avoided.
5. The function allows multiple values to be returned, and the last value asks the error type, which is used to return details in the case of an error.
6. An overload that opposes (does not provide) functions and operators, does not provide inheritance, virtual functions, virtual function overloads. But to provide a combination, but also to achieve the purpose of inheritance.
7. There is no constructor and destructor to provide an interface, the biggest difference from other languages is that the interface is non-intrusive. That is, the implementation class does not derive from the interface
8. Support anonymous functions and closures.
... Continue to study in Windows, the development environment of the building: The IDE has two options, one is the development of Liteide, one is to the eclipse download Goclipse plugin. But for unknown reasons, I did not tune the Gocode-based Go language auto-completion feature in Eclipse. So I chose Liteide, the following describes how to build a liteide environment, eclipse of the method to explore it yourself. Welcome to share your experience. 1. Download the Go Language installation package, go to the link below, select the appropriate installation package for download (I use the Go1.0.3.windows-386.msi), and then install, record the installed root directory for configuration use.  Download Address: https://code.google.com/p/go/downloads/ List2. Download Liteide, go to the link below, select the appropriate installation package (I use the liteidex17.windows-webkit.7z), after the download is complete, unzip to any directory, and then into the root directory of the bin folder, Double-click Liteide.exe to open the software.  Download Address: https://code.google.com/p/golangide/downloads/list  The software interface is as follows: 3. Configure liteide information, the first time you open this IDE, you need to configure relevant information to use correctly. Click "View" → "options" to open the Options page and select Liteenv,:4 in the list. For your system, modify the corresponding file. I am a 32-bit system, so I need to modify win32-user.env and win32.env. The contents of the amendment are as follows:
#nativecompilerwindows386
Goroot=e:\go
Gobin=e:\go\bin
Goarch=386
Goos=windows
Cgo_enabled=1
path=%gobin%;%goroot%\bin;%path%
Liteide_gdb=gdb
Liteide_make=mingw32-make
liteide_term=%comspec%
liteide_termargs=
liteide_exec=%comspec%
Liteide_execopt=/c
Both Goroot and Gobin are configured according to the directory selected in the previous Go language installation. The path I chose when I installed the Go language was E:\Go5. Configure Gopath, click "View" → "Settings Gopath", click Browse in the custom Gopath in the open window, select the folder you want to store the go project in the future, select OK after adding. : 6. Close the IDE, reopen, after clicking on "View" → "tool Window" → "package browse", open the package browse, if you can see the Go directory, you can use. With respect to the ancestors, we have a HelloWorld trip ~ Select the Start page of the new, select Go1 Command Project at the template, a name, click OK. The HelloWorld program is automatically generated ~ Click the BR button at the top of the edit window to run the program and get output in the Compile Output window. Well, now it's time to explore this stage. Installing the Goclipse plugin in eclipse encountered a variety of problems, although the final installation was successful, but there was no auto-completion feature. So give up ~ with a liteide auto-completion function: Welcome all the way go God enlighten ~
PS: I have existed, I have met, I have failed. Some roads, obviously have a pit but never put warning signs. Some things, obviously is wrong but no one to tube. Some words, obviously should tell Yimeimei but no one to say. Since no one is doing it, let me do it. I hope that the setbacks I have experienced are no longer reproduced in Yimeimei. Hope that the inheritance can not just hanging on the mouth. Hope that human model human shape "people" can be a real person.

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.