Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] _PrintWithSpanId -> _PrintWithLocation #1490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abathur
Copy link
Collaborator

@abathur abathur commented Feb 5, 2023

This bite is a little bigger (and more complex) than I really wanted to take, so my confidence is only moderate. Be skeptical :)

@abathur abathur force-pushed the refactor_print_with_location branch from c67d71e to 8150234 Compare February 5, 2023 22:28
@andychu
Copy link
Contributor

andychu commented Feb 6, 2023

Thanks for looking at this!

Now that I think about it, I said we were going to remove loc.Span(). That's true long term, but short term we're going to INTRODUCE loc.Span(), because it's a trivial wrapper around a span_id that lets us do the type-driven refactoring.

It would be nice to "pull the band-aid off all at once", but now that I look at it, we have to do it two steps:

  1. Change APIs to take loc_t, and pass loc.Span(span_id) mechanically
  2. Later get rid of `loc.Span()

The reason is that there are simply a lot of usages! This command shows there are 677 !! Location info is all over the codebase, because that's how we get fine-grained error messages.

$ metrics/source-code.sh osh-files | xargs egrep 'span_id|spid'  | wc -l
677

So I think I found a tinier piece to bite off. Take a look at this PR:

#1491

And maybe try the same thing for one of the other methods Print_() or PrintMessage()

I think those will be smaller bites and we can lean on the type system more. (Although leaning on the CI is also OK!)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants