3

sequence

Using golang to develop business code for a while, this article mainly sorts out my own experience, and summarizes the commonly used class libraries for easy reference. Since I am a heavy user of java, I can't help but compare and complain, please forgive me.

go do business development?

Compared with java, here is the feeling of using go for business development:

  • advantage

    • Cloud native first choice, save memory
    • It is very suitable for writing scripts and can replace python
  • shortcoming

    • If you don't use it well, you will panic, and the direct process exit of the online service is quite serious.
    • Go does not have a SNAPSHOT version of maven. Based on the commit hash and date as a pseudo version, it is easy to have an invalid version, and the experience is very bad. It is not as easy as SNAPSHOT.
    • It is more laborious to write object-oriented, each method must write a receiver, not as regular as java
    • The support of ioc is not like java has the standard of ioc, and the ecology is not very good. For example, uber/dig cannot be injected into the map structure by name.
    • godoc is too rudimentary, not as neat as javadoc
    • There are no annotations and generics (although the new version supports it, but it can only be used when the surrounding ecology supports it), the language expression is much weaker
    • As for coroutines, business development seems to be useless.
    • The mechanism of the package is quite strange. The default is based on the last one. It is easy to conflict and difficult to identify. If an alias is added, it will be a disaster, which is very unfavorable for analysis.
    • Lack of easy-to-use test suites, unlike java's juint, you can just write a few annotations, which is quite laborious

golang common class library

Summarize

The cost of using go for business development seems to be quite high. It is definitely not to save memory. It is such a simple thing as cloud native. If it is a big company, you can spend money on it. I have nothing to say. If a small and medium-sized company does not have a Go background and wants to start from scratch, it feels that the cost is quite high, which is my humble opinion.


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...