官术网_书友最值得收藏!

Leave your baggage at the door

If you were to ask me what is the most frequent mistake new Go programmers make?, I would not hesitate to tell you that it's bringing other language patterns into Go. I know this was my biggest early mistake. My first Go service looked like a Java app written in Go. Not only was the result subpar but it was rather painful, particularly while I was trying to achieve things such as inheritance. I've had a similar experience programming Go in a functional style, as you might see in Node.js.

In short, please don't do it. Re-read Effective Go and Go blogs as often as you need to until you find yourself using small interfaces, firing off Go routines without reservation, loving channels, and wondering why you ever needed more than composition to achieve nice polymorphism.

主站蜘蛛池模板: 西昌市| 高唐县| 福贡县| 新泰市| 武陟县| 随州市| 左云县| 邢台市| 呼图壁县| 布拖县| 河曲县| 绿春县| 韩城市| 静乐县| 宜黄县| 阳泉市| 汕头市| 高碑店市| 红安县| 云和县| 桂林市| 巍山| 黔南| 台州市| 望谟县| 辽源市| 慈利县| 卓尼县| 和静县| 敦化市| 小金县| 南华县| 随州市| 三明市| 民丰县| 永靖县| 罗江县| 汶上县| 庆安县| 卓资县| 迁安市|