go-stack / stack

Package stack implements utilities to capture, manipulate, and format call stacks.
MIT License
395 stars 33 forks source link

Possible to get the package name at a given call depth? #16

Closed chmorgan closed 7 years ago

chmorgan commented 7 years ago

Any interest in having that feature in the package?

chmorgan commented 7 years ago

I'm asking because I'll put together a PR to add support for it if so.

ChrisHines commented 7 years ago

Yes, this could be useful. I think adding a new formatting verb that produces the package name is the way to go here. One of the forks has added %k for package name (https://github.com/getlantern/stack/commit/02f928aad224fbccd50d66edd776fc9d1e9f2f2b). We should also consider %p.

chmorgan commented 7 years ago

@ChrisHines submitted a PR with this change after reviewing and testing it.

ChrisHines commented 7 years ago

Implemented by #18.

ChrisHines commented 7 years ago

@chmorgan Thanks for the feature suggestion and being patient during my code review. The new feature was just released in v1.6.0. 🎉

chmorgan commented 7 years ago

@ChrisHines its no trouble, thanks for fixing the code up and getting this through vs. having it sit here. I'm not good at golang yet, especially not with slices. Coming next is PR against go-kit for the package name and package filtering.