| > I have often been looking at stack traces from third party libraries, but I have rarely wanted to debug them. If you have found stack traces are already readily available in third-party packages – that you can claim you do it often – what's the issue? Maybe this thread would be better served by real world examples of where the lack of stack traces in Go has actually bitten you? > Maybe the error is somewhere further down in my own code (e.g. in a callback) To be fair, the Go authors have also driven home the fact that you need to make your errors meaningful with the full context necessary to determine the path of the error (granted, not necessarily a full-fledged call stack). They have been abundantly clear that you should never simply `return err`. If this is an issue, it is because the code was written poorly. And if a package is written poorly, and you don't want to fix the issues with it, perhaps you should reconsider using it in the first place? > This is different from the use of vendoring for versioning purposes. How so? The simplest form of a fork is one that is an exact copy of the original. If a package is already suitable to your needs, there is no reason to modify it, other than to perhaps merge in updates that the upstream author has made. You can either keep that fork in a global repository, or you can keep it in vendor. There is no fundamental difference between either of those. At all. Vendor is just a convenience feature to allow the fork to stay in your application's tree. Of course, if the library is poorly written or doesn't perfectly suit your needs you may have to make modifications to it. But that is true of every library written in every language in existence. It is not insane to do that, just pragmatic. |
Not in Go. I have found them extremely useful as a diagnostic tool in languages that have ubiquitous stack traces.
>And if a package is written poorly, and you don't want to fix the issues with it, perhaps you should reconsider using it in the first place?
As I said, the problem may not even originate in that particular third party library. The error may just be passing through, coming from my own code or from a different library altogether.
>How so? The simplest form of a fork is one that is an exact copy of the original.
Vendoring is not primarily about forking and then changing the code. The main purpose of vendoring is freezing dependencies.