Disadvantages of go language: 1. Lack of framework; 2. Go language simply returns errors through functions and expected call codes, easily losing the scope of error occurrence; 3. There is no way to formulate package management in go language Specific versions of dependent libraries.
The operating environment of this article: windows10 system, Go 1.11.2, thinkpad t480 computer.
Disadvantage 1: Lack of framework
The Go language does not have a major framework, such as Ruby's Rails framework, Python's Django framework, or PHP's Laravel. This is a hotly debated issue in the Go community, as many believe we shouldn't start with frameworks. This is true in many case scenarios, but if you just want to build a simple CRUD API, it will be much simpler to use Django/DJRF, Rails Laravel or Phoenix.
Disadvantage 2: Error handling
The Go language helps developers handle compilation errors by simply returning an error (or returning the call stack) through the function and the expected calling code. While this approach is effective, it is easy to lose the scope in which the error occurred, making it difficult to provide meaningful error information to the user. The errors package can solve this problem by allowing us to add context and stack traces for the returned errors.
Another problem is that we may forget to handle errors. Static analysis tools such as errcheck and megacheck can avoid these mistakes. While these solutions are effective, they may not be the right approach.
Disadvantage 3: Software package management
Go language package management is definitely not perfect. By default, it has no way to specify versions of dependent libraries, nor to create overridable builds. In comparison, Python, Node, and Ruby all have better package management systems. However, with the right tools, Go language package management can also perform well.
We can use Dep to manage dependencies, and it can also specify specific package versions. In addition, we can also use an open source tool called VirtualGo, which can easily manage multiple projects written in Go language.
Related recommendations: golang tutorial
The above is the detailed content of What are the disadvantages of go language. For more information, please follow other related articles on the PHP Chinese website!