juno icon indicating copy to clipboard operation
juno copied to clipboard

Iron gauntlets/simplify cmd

Open IronGauntlets opened this issue 3 years ago • 1 comments

Fixes | Closes | Resolves #

Description

Explanation about why the PR is necessary.

Changes:

  • Change 1
  • Change 2

Types of changes

Leave only items that describe your changes, remove the rest. Remove this line too.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing: Yes/No

Did you write tests??: Yes/No

Documentation

If this requires a documentation update, did you add one? Yes/No

IronGauntlets avatar Aug 17 '22 22:08 IronGauntlets

Codecov Report

Merging #359 (88ff110) into main (8d4c892) will decrease coverage by 7.41%. The diff coverage is 80.73%.

:exclamation: Current head 88ff110 differs from pull request most recent head 0bd8a09. Consider uploading reports for the commit 0bd8a09 to get more accurate results

@@            Coverage Diff             @@
##             main     #359      +/-   ##
==========================================
- Coverage   99.53%   92.12%   -7.42%     
==========================================
  Files          55       66      +11     
  Lines        6484     7087     +603     
==========================================
+ Hits         6454     6529      +75     
- Misses         30      554     +524     
- Partials        0        4       +4     
Flag Coverage Δ
unittests 92.12% <80.73%> (-7.42%) :arrow_down:

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

Impacted Files Coverage Δ
cmd/juno/main.go 0.00% <0.00%> (ø)
internal/sync/sync.go 100.00% <ø> (ø)
internal/utils/datadir.go 65.62% <65.62%> (ø)
cmd/juno/juno.go 86.04% <86.04%> (ø)
internal/juno/juno.go 100.00% <100.00%> (ø)
internal/log/log.go 100.00% <100.00%> (ø)
internal/utils/network.go 100.00% <100.00%> (ø)
internal/rpc/starknet/errors.go 0.00% <0.00%> (ø)
pkg/jsonrpc/providers/http/provider.go 0.00% <0.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 17 '22 22:08 codecov[bot]

The previous structure also allowed the binary to be automatically named juno when one ran go build ./cmd/juno/. Now it's going to be cmd which is not idiomatic. See reference or how Kubernetes or even geth does it.

I am happy to follow the geth style:

cmd/juno
  main.go
  juno.go
  juno_test.go

I am a bit apprehensive about your suggestion because I don't want to introduce another internal package. When it comes to the cmd package there is an assumption that it is not meant to be imported.

The logic in internal/juno is also not as reusable as some of the packages in there so I would also favour moving that logic to the cmd/juno/internal/ directory above.

I am not sure which part you are referring to that is not reusable.

IronGauntlets avatar Aug 25 '22 13:08 IronGauntlets

I am happy to follow the geth style:

cmd/juno
  main.go
  juno.go
  juno_test.go

That works for me.

I am not sure which part you are referring to that is not reusable.

I suppose it doesn't matter since the existing structure is that of a monolith 🤔 you can disregard that comment.

tshakalekholoane avatar Aug 25 '22 14:08 tshakalekholoane