Is there a way to get Go module's full path inside Go code-ThrowExceptions

Exception or error:

Is there a way that I can get the full path of a module, under external libraries, that my project is using?

How to solve:

Go is a compiled language, and most external libraries (modules) will be statically linked into the same binary. This means all Go libraries you are using are inside the same binary, and not in your PC.

If you are using go mod, this post will help you understand where the modules are located during build time.
If you are using GOPATH alone, the libraries will be downloaded into your $GOPATH/src followed by the address used fot the import.

If this is not what you are looking for, one way to analyze the libraries you used would be to check you go.mod file.


Is there a way to get go modules full path inside go code


Leave a Reply

Your email address will not be published. Required fields are marked *