-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove unused internal or unexported functions #3481
base: master
Are you sure you want to change the base?
Remove unused internal or unexported functions #3481
Conversation
func Toc(start time.Time) { | ||
end := time.Now() | ||
log.Println("END: ElapsedTime in seconds:", end.Sub(start)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These may be actually occasionally useful for profiling?
BTW I didn't even know about the existence of this internal/util/profile.go
until now (and I find it rather nice). (And BTW also I didn't know about the existence of the memusage
command.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a big deal to write two lines when we need to profile something. For now, I propose removing redundant code that is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly would we achieve by removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing unnecessary functions will allow refactoring the util
package into something more meaningful with a better name.
The package name util
is considered a bad package name according to https://go.dev/blog/package-names#bad-package-names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactoring the
util
package into something more meaningful with a better name.
Like what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package name
util
is considered a bad package name according to https://go.dev/blog/package-names#bad-package-names.
So it's the usual ideal world example which would have been nice in the moment it has been respected from the beginning. But unfortunately the world isn't ideal, it hasn't been considered from the beginning and thus util
is grown historically by throwing everything into it which doesn't fit into the other base packages.
I wouldn't say that we're against such a cleanup process, but currently we've bigger construction sites at other places.
Like what?
As said by @dmaluka or at least how I interpret it:
If you have a much better suggestion, please go ahead.
But remember, especially with the lua.go
in util
we most probably face problems with plugin
interfaces.
This PR removes unused internal or unexported functions reported by the deadcode analyzer.
Details