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 the study
Under Windows, the development environment is built:
There are two options for the IDE: one is the liteide developed by the Chinese, and the other is to download the Goclipse plugin for Eclipse. 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/list
2. Download Liteide, go to the following link, select the appropriate installation package (I use the liteidex17.windows-webkit.7z), download the completion of the extract 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 the relevant information to use correctly. Click "View" → "options" to open the Options page and select Liteenv in the list:
4. Modify the corresponding file for your system. 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:\Go
5. Configure Gopath, click "View" → "Set Gopath", click Browse in the custom Gopath in the open window, select the folder you want to store the Go project later, add and select OK. :
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 for our ancestors, let's Take a HelloWorld tour
Select New from the Start page, select Go1 Command Project from the template, and 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 the 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 it up ~
With a liteide auto-completion function:
Welcome to go big God enlighten ~
Transferred from: http://studygolang.com/articles/1758