The linker should include the declaration position for types so that we can use this information in editors and disambiguate where the types come from.
The easiest to replicate the confusion is to have a project which has multiple main packages and to try to go to a specific type declared in both those main package. In this case, the type contains only the main.TypeName information so an editor would be forced to implement additional logic to infer where the main package is located in the binary.
The text was updated successfully, but these errors were encountered:
AFAIK, declaration coordinates for types are not stored anywhere in the object files that the linker gets. Type information in the linker comes from the runtime type structures, so we'd have expand those, which would increase memory usage and binary size even when DWARF was disabled. That's unlikely to happen unless there's a really compelling case for it.
If type DIEs were generated in the compiler, this would be more feasible, but that's a big project. We might get to it eventually.
Thank you for your quick reply. I realize that this is not necessarily a priority in the big picture. Would producing the package import path, for example github.com/dlsniper/demo/cmd/pkg.Type be a viable workaround? This would allow to have consistency with all other package names/paths.