flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

Implement make flow-go-wide

Open simonhf opened this issue 2 years ago • 3 comments

Maybe there is an easier way to make Golang source 'wider'?

simonhf avatar Jul 29 '22 00:07 simonhf

Codecov Report

Merging #2889 (b47e887) into master (33f758f) will increase coverage by 0.00%. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2889   +/-   ##
=======================================
  Coverage   56.64%   56.64%           
=======================================
  Files         695      695           
  Lines       63003    63003           
=======================================
+ Hits        35688    35689    +1     
  Misses      24364    24364           
+ Partials     2951     2950    -1     
Flag Coverage Δ
unittests 56.64% <ø> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
consensus/hotstuff/eventloop/event_loop.go 73.46% <0.00%> (-1.37%) :arrow_down:
utils/debug/profiler.go 79.20% <0.00%> (ø)
engine/consensus/compliance/core.go 76.51% <0.00%> (ø)
module/mempool/epochs/transactions.go 100.00% <0.00%> (+9.67%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 33f758f...b47e887. Read the comment docs.

codecov-commenter avatar Jul 29 '22 00:07 codecov-commenter

This will be quite hard to support given that it should be impossible to parse a context free grammar with a regex.

If the purpose is to look at the context then -B/-C should be enough (ag does that by default ). If this is a usability feature, then most IDEs have terminal integration and you can ctrl/cmd+click on filename:lineno to open it directly in the editor:

https://user-images.githubusercontent.com/169976/181661390-c4bb52a9-9801-4826-b116-ebe8483b3cbd.mov

If the purpose of the diff is to simplify automated refactoring, then it is likely easier to do that with golang.org/x/tools/go/packages and AST rewrites.

SaveTheRbtz avatar Jul 29 '22 01:07 SaveTheRbtz

Thanks for the comments!

This will be quite hard to support given that it should be impossible to parse a context free grammar with a regex.

It does a slightly better job than -- and is just another alternative to -- regular grep or git grep and shouldn't need that much support since Golang grammar does not change very often?

If the purpose is to look at the context then -B / -C should be enough

Yes, that's what I have been using up until now. But I tried it to search for zerolog lines and some lines are ~ 20 lines long! :-) So if I just want to browse types of zerolog lines then the output becomes a mess. This PR offers an alternative way to grep where the ~ 20 lines are already flattened onto a single line and therefore -B / -C grep options are not necessary :-)

However, I would be interested in an alternative way to achieve the same results, because I like the output but like you, I don't like the regexes... If there is already a tool to do this then that'd be great... :-)

ag does that by default

What's ag?

If the purpose of the diff is to simplify automated refactoring

The purpose of the diff is just to give more context when grepping on the command line.

simonhf avatar Jul 29 '22 01:07 simonhf

Going to close this as it's not caught any traction on the team. If problems similar to this pop up again, will revisit

Kay-Zee avatar Sep 26 '22 23:09 Kay-Zee