Is everything from the imported Go module included in my application or is there some 'treeshaking' involved and only used code is included?
First, you cannot import modules in Go. You can only import packages.
Second, Go is a language specification, so the question of whether or not "tree-shaking", or any other method of dead code elimination is used, is up to the implementation.
But having said that, in general, the official Go compiler, and probably any other Go compiler, is smart enough not to include things that are obviously not used. Exactly how smart it is in this regard depends on the exact implementation and version.
If I have created for myself utility functions dealing with Gin and Gorm - would it make sense to have these functions in 2 separate libraries?
Whether it makes sense to be in a single library or not depends on how you organize your libraries. Organize your libraries logically, not according to compiler optimizations. Trust the compiler to do its job.
I probably would not put utility functions for Gin and Gorm in the same library, simply because they're not at all related to each other, though. But that's completely unrelated to dead code elimination of the compiler.