Learn about the Go language

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

Google Development
Compiled type
and hairstyle
has garbage collection function

Linux/mac osx/windows

Syntax close to C
For loop and if judgment without parentheses
Support for garbage collection

The parallel model is based on Donnijol CSP

Compared to C + +
Go does not include: exception handling, inheritance, generics, assertions, virtual functions, etc.
Increased slice, concurrency, pipelines, garbage collection, Interfaces (interface), etc.
Different from Java
Go inline associative array, called hash table (hashes) or dictionary (dictionaries)

Hello World:

package mainimport"fmt"func main() {  fmt.Printf("Hello, 世界\n")}

GitHub
Https://github.com/golang/go

What are the pros and cons of your use of the go language?
Chen Hui: 最大的优点是易于维护,代码写完之后几个月再去看完全没生疏感,仿佛在 Go 中实现一个功能只有这么一种写法。
而且还有 gofmt 这个格式化工具,让团队中所有人的代码风格都是一样的。
Go 是一种不会让团队其他小伙伴看代码时皱眉头的语言,没有什么比这更重要了。

Second Go has the advantage of C, but there is no C + + weakness.
The first is a strongly typed language, and any serious software project should not choose to use a weakly typed language.
Then Go's interface can meet more than 90% of the OOP needs, but there are no C + + traps. Finally, the execution speed is fast enough.
Then, Go has good code management, build, and profiling capabilities.
Profiling is powerful, plus the build system replaces one of the most important features of a good IDE.
Finally, Goroutines provides natural concurrency programming support, which is one of my favorite features.
Of course it is not without shortcomings, in my eyes the downside of Go: virtual function support is not very good (or not exist?) ), code reuse cannot be implemented through inheritance.
In addition, the use of pointer is sometimes confusing.

Chen Hui's Open source project

Https://github.com/huichen

Install

Go is assumed to be installed in/usr/local/go, if installed in a non-standard location, you need to set Goroot

export GOROOT=$HOME/goexport PATH=$PATH:$GOROOT/bin

Test Install

package mainimport"fmt"func main() {    fmt.Printf("hello, world\n"go toolgo run hello.go
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.