sequence

I have used Golang to develop business codes for a while. In this paper, I will sort out my experience and summarize common class libraries for easy reference. As I am a heavy Java user, I can not help but compare and ridicule, please forgive me.

Go do business development?

Here’s what it’s like to do business development with GO:

  • advantages

    • Cloud native preferred, save within the province
    • Great for scripting, an alternative to Python
  • disadvantages

    • If you don’t use it well, there will be panic. Direct process exit of online service is quite serious
    • Go does not have a SNAPSHOT version of Maven. It is based on the commit hash and date as the pseudo version. Invalid version is very easy to appear
    • Writing object-oriented is a bit of a chore, with a receiver for each method, unlike Java
    • The support of IOC is not as good as Java’s ioc standard and ecology. For example, Uber/DIG cannot inject map structure by name
    • Godoc is too crude and not as neat as Javadoc
    • There are no annotations or generics (it’s supported in the new version, but can’t be used properly until the surrounding ecosystem supports it), and the language is much weaker
    • As for coroutines, business development doesn’t seem to help
    • The package mechanism is very strange, the default is the last one, it is easy to conflict, not easy to identify, if the alias is added, it is a disaster, very bad analysis
    • Lack of a useful Test suite, unlike Java’s Juint, where you can just write a few annotations, which can be quite taxing

Golang Common class library

  • Parameter calibration
    • go-playground/validator
  • Test to enhance
    • testify
    • gomonkey
    • goconvey
  • Type conversion
    • cast
    • go-conv
    • copier
  • reflection
    • go-reflector
  • serialization
    • mapstructure
    • json-iterator
  • Data structure enhancement
    • decimal
    • atomic
    • errors
    • multierr
    • gods
    • go-datastructures
    • golang-set
  • The stream operation
    • go-funk
    • go-linq
  • Dependency injection
    • di
    • dig
    • fx
  • Microservice correlation
    • viper
    • hdrhistogram-go
    • hystrix-go
    • sentinel-golang
    • client_golang
    • opentracing-go
    • jaeger-client-go
    • redislock
    • entroq

conclusion

The cost of business development with GO is quite high, which is definitely not saved within the province. If it is a big company, it can spend money on it, I have no words. Small and medium-sized companies, if their team is not go background, want to start from zero, feel the cost is quite large, personal opinion.