go语言introduction

官网: link.

Go is expressive, concise, clean, and efficient.
Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, 
while its novel type system enables flexible and modular program construction.
Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. 
It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

expressive, concise, clean, and efficient

自我夸赞了,是否简洁好用见仁见智。但是go语言关键字少,执行效率高,单核http hello world qps 轻松上万。

concurrency mechanisms

goroutine确实好用,底层实现了异步非阻塞,程序猿可以像平时编写同步程序的方式写程序,由go运行时调度协程的执行。多多线程和网络变成来说确实是福音。

flexible and modular

go package也不算出彩吧,跟java差不多,比c++略好用

garbage collection

这个是现代语言的好处。1.5之前貌似有很大问题,不过现在解决了

run-time reflection

interface和reflect包用起来确实方便,但是reflect应该严格限制在必要的场合,比如json,xml,orm等序列化和反序列化的场景。我们要尽量利用go语言的类型系统帮助我们避免错误。

fast, statically typed, compiled

只有一个二进制可执行文件, 0外部依赖,还可以直接把css等文件潜入二进制可执行程序里面,确实优秀。

like a dynamically typed, interpreted language

言过其实了吧。尤其是没有template,有时候代码特别冗余。比不上c++, java

go语言的真正威力

它是一门通用的语言,很多领域都能用,标准库,三方库,各类支持很齐全,同时在性能和简易程度方面也是佼佼者,性价比很高。用c++来开发webserver几乎是不可能的,java没深入,java EE太复杂也不想学了,与go语言相比也没多大优势。go最大的优势是goroutine和channel,用好这两个能写出执行效率很高的程序。

发布了96 篇原创文章 · 获赞 0 · 访问量 1027

猜你喜欢

转载自blog.csdn.net/weixin_45594127/article/details/103729311
今日推荐