“This is the 15th day of my participation in the First Challenge 2022. For details: First Challenge 2022.”
My point of view
Because go’s standard library is very rich, especially the existence of the NET/HTTP package, basically other languages need to do through the framework to do things, without the framework light standard library can also smoothly develop requirements.
The purpose of the framework is to help us provide efficiency. There is no absolute good or bad in the framework itself. We should choose the appropriate framework according to our own needs.
Here I will briefly introduce the advantages and disadvantages of the current Go language Web mainstream development framework comparison, convenient for you to have a targeted choice of framework.
Gin
HTTP Web framework written in Go language, it implements martini-like API with better performance, better performance
advantages
- Encapsulation is better, API friendly, source code annotation is more clear, with fast and flexible, convenient fault tolerance and other characteristics
- Fast running, grouped routers, good crash capture and error handling, very good support for middleware and JSON
disadvantages
- Beego is a very streamlined Web development framework that does not provide many modules. This is both a weakness and a strength, and people choose according to their own project needs
conclusion
Gin is the first framework I used to get started with Go language development, and I am very interested in my middleware based on Gin: # User role Permission Management middleware and # Operation Log middleware
Echo
Echo Is a high-performance, minimalist Go Web framework
advantages
- High Routing performance
- A more lightweight Web development framework
disadvantages
- Inconvenient debugging, error message is not friendly
- Although the routing performance is high, the underlying algorithm of routing does not support routing sorting, resulting in route conflicts
conclusion
Echo is ideal for developing lightweight microservices
Beego
Beego is an open source high-performance Web framework for the Go programming language
advantages
- It’s all very simple
- Not only the pursuit of performance, the same pursuit of development efficiency, the liberation of programmer productivity
- Good community, many Chinese developers, looking for information is very convenient
- The code is well documented
disadvantages
- More bloated, because it provides a lot of support, when the pit needs to spend a lot of time to check source code to solve the problem
- Modules are numerous, which is both a strength and a weakness
conclusion
Beego is a very excellent framework on the whole, attracting a large number of Go language beginners as the first framework, suitable for industrial project development
Iris
Iris claims to be the fastest Go language Web framework in the universe, complete MVC support, embrace the future
advantages
- Community driven Go Language Web framework, support HTTP2, complete MVC support.
- Minimalist style
- Community activity and documentation support are excellent
disadvantages
- It is not stable enough. Some people in the community reported that the latest release is the alpha version, which is very unstable
- Support for Iris is high, but still not as high as Gin and Echo
conclusion
In order to optimize performance, Iris developed and integrated the fastest components, such as the built-in Golog module for logging, and the third-party library Jsoniter for JSON serialization, which is very powerful in terms of framework design.
conclusion
- For starters, it is important to choose a framework that is easy to learn, and I recommend Gin and Echo
- For enterprise developers, they need to choose a framework based on their own project characteristics. The framework is only a part of the project implementation. Go itself provides a rich class library, and the choice of framework is not so important as the elegant business implementation. We can combine our actual projects for secondary encapsulation.
- Attitude towards the new framework: I think it is more important to take the time to re-write your own project, to re-write it in time, to be proficient in a mainstream framework, a mainstream language, than to take the time to understand the framework.
I recommend
Please subscribe to my Go Language Learning column
A year-end summary and review of my Go learning journey
The last
Thanks for reading and welcome to like, favorites,coin(attention)!!