1

(纯主观)一个 javaver 用 go 语言的初步体验

 2 years ago
source link: https://www.v2ex.com/t/838094
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

(纯主观)一个 javaver 用 go 语言的初步体验

  voidmnwzp · 21 小时 10 分钟前 via iPhone · 3350 次点击
以下观点纯属个人主观感受
1.协程体验完美 无需内核态的上下文切换吊打 jvm 的线程,语法层面也是完爆 一个关键字就完事 go func 吊打 new thread(啰嗦一大堆).start ()
2.类型推断也不要太爽 := 和 var 用的不亦乐乎 jdk10 的 var 不知猴年马月才能用到
3.自定义类型也很香 type Unixtimestamp int64 type Timestamp int64 规范又优雅,结构体可以当值用也可以 new 一个当对象用,关键是再也不用定义恶心的包装类型了以及得注意拆箱的空指针了
4.自带的轮子少但够用,日期处理一个 time 包就够了,date 、calendar 、localdate 、localtime 、sdf 一边去吧,线程安全 mutex 就够用了、异步转同步 channel 也够了
5.Gin 使用体验下来也是简洁程度吊打 mvc+springboot ,启动速度更是完爆之,直接交叉编译一个可执行文件丢到服务器上,远离 jar 包
6.多返回值和函数传参很赞,闭包就更不用提了

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK