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

usecases/cli:chore - remove unnecessary UseCases struct #792

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

matheusalcantarazup
Copy link
Contributor

@matheusalcantarazup matheusalcantarazup commented Nov 18, 2021

This commit remove an unnecessary empty UseCases struct and change
their methods to functions and change the references to this struct to
call the public function directly.

Some private functions from this package was renamed to have consistency
between all of them.

Removing this struct we also remove an unnecessary heap allocation since
the NewCLIUseCases() function return a pointer to this struct.

The heap allocation was noticed using the
github.com/jordanlewis/gcassert using the gcassert:noescape directive
on cmd/app/start/start.go:68:

gcassert ./cmd/app/start/
cmd/app/start/start.go:75:useCases: cli.NewCLIUseCases(): &cli.UseCases{} escapes to heap:

Signed-off-by: Matheus Alcantara [email protected]

- What I did

- How to verify it

- Description for the changelog

This commit remove an unnecessary empty `UseCases` struct and change
their methods to functions and change the references to this struct to
call the public function directly.

Some private functions from this package was renamed to have consistency
between all of them.

Removing this struct we also remove an unnecessary heap allocation since
the `NewCLIUseCases()` function return a pointer to this struct.

The heap allocation was noticed using the
github.com/jordanlewis/gcassert using the `gcassert:noescape` directive
on cmd/app/start/start.go:68:

```
gcassert ./cmd/app/start/
cmd/app/start/start.go:75:useCases: cli.NewCLIUseCases(): &cli.UseCases{} escapes to heap:
```

Signed-off-by: Matheus Alcantara <[email protected]>
Copy link
Contributor

@iancardosozup iancardosozup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, great job !

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.

3 participants