juju/errors

Something wrong in functions.go#L300

zzy131250 opened this issue · 1 comments

file, line := err.Location()
but err.Location() return function name and line

tlm commented

Hi @zzy131250,

Thank you for raising the issue. In recent updates to this errors library we have had to change the value that is returned from Location to match a new Locationer interface placed in the library.

The reason for this change is that the old code we had for indicating the file no longer worked correctly with the introduction of go mod and the file reported would be an absolute path for the system the program was compiled on. This would be very confusing for production applications as it would essentially contain the path's from the system used to compile the software.

The change we have introduced now outputs package name and function name that is more akin to the old behavior.

tlm