Go's syntax is rather simple and similar to C. It is not overwhelmed with features and it compiles into a native executable. Therefore, it is easy to learn and use to write readable, maintainable code. In addition, GO has very few keywords compared to other mainstream languages: the GO specification mentions 25 keywords.
When bulding a GO program, the resulting binary is as-is: there are no other dependencies. You can port this binary to any platform that supports GO to execute it there - unlike other programming languages such as JAVA or Python, where multiple dependencies need to be taken care of and packed along when creating a self-contained binary. In Go, the concept of Dynamic Link Library does not exist as it supports static linking: GO is statically linked to all the libraries in a single, standalone, large binary.
There are two types of module dependencies:
- Direct - a dependency directly imported by the module
- Indirect – a dependency imported by the module’s direct dependencies. Also, any dependency that is mentioned in the go.mod file but not imported in any of the source files of the module is also treated as an indirect dependency.
go.sum lists down the checksum of direct and indirect dependencies required along with the version. It is used to validate that none of these dependencies has been modified.
go.mod records only direct dependencies. However, it may record an indirect dependency in case there is an indirect dependency that is not listed in the go.mod file of your direct dependency, or if a direct dependency does not have a
go.mod file. In this case, the dependency will be added to the
go.mod file with the suffix //indirect.
go.mod file is enough for a successful build.
Updated about 1 month ago