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
parameter verification
Test enhancements
type conversion
reflection
Serialization
data structure enhancements
stream operations
dependency injection
Microservice related
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.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。