go-stack / stack

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

add %k and %+k to stack formatter #18

Closed chmorgan closed 7 years ago

chmorgan commented 7 years ago

Pull from golantern/stack, revert name changes back to go-stack/stack.

Tested here and reviewed implementation. Looks like a good approach as the call to .Name() does retrieve the package, filename and other information so it seems to make sense to overload the %n handler to also handle %k.

Goal is to have this available for go-kit/log to retrieve a package name.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.5%) to 88.832% when pulling 3a3e99b4ba4737f629b56b80fe651ae65ea54d58 on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.9%) to 89.216% when pulling fa228a6796b776721902144e8b8d86f74687445a on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.9%) to 89.216% when pulling fa228a6796b776721902144e8b8d86f74687445a on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.9%) to 89.216% when pulling fa228a6796b776721902144e8b8d86f74687445a on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

chmorgan commented 7 years ago

@ChrisHines changes pushed, waiting for next round of feedback :-)

chmorgan commented 7 years ago

@ChrisHines tried to rewrite it without any concatenation. Not sure I'm super happy with the outcome but without the string concatenation I'm guessing its more efficient. Net lines of code went up though. Thoughts? I'm still new to go.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.1%) to 89.474% when pulling f3b7c2490066f48b69b6767f8ba178833cabbaa9 on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.1%) to 89.474% when pulling f3b7c2490066f48b69b6767f8ba178833cabbaa9 on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.1%) to 89.474% when pulling f3b7c2490066f48b69b6767f8ba178833cabbaa9 on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.1%) to 89.474% when pulling f3b7c2490066f48b69b6767f8ba178833cabbaa9 on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.9%) to 89.216% when pulling 68206431471b1917aed9574c25f032c23100004d on chmorgan:develop into 3bd81bdde4686ea4aee961921944d1d012253997 on go-stack:develop.