-
Notifications
You must be signed in to change notification settings - Fork 379
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 github.com/otiai10/copy dependency #2239
Remove github.com/otiai10/copy dependency #2239
Conversation
Signed-off-by: Oleksandr Redko <[email protected]>
LGTM |
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.
Thanks!
I don’t feel strongly about the change itself.
It’s just… This is a unit test. It does not show up in any dependency of c/image. So why is it important to trim dependencies? To me, adding and reviewing extra ~55 lines of code for no end-user benefit seems like a bad trade. So what am I missing? Are there any negative effects of that dependency I don’t know about, which would also apply to other dependencies in the future?
@mtrmac The README indeed categorizes Adding to this, having fewer dependencies enhances the overall control we have on the application. Reviewing and adding 55 lines of code is a one-time task. But every extra dependency is an added layer of complexity, potential security risk, and another component that should be maintained and kept updated. We are simplifying the application maintenance process by trimming down dependencies, just as Rob Pike mentioned about keeping the dependency tree small (check video). https://medium.com/@cep21/aspects-of-a-good-go-library-7082beabb403 |
I mean… % cat foo.go
package foo
import "github.com/containers/image/v5/oci/layout"
func main() {
_ = layout.Transport
}
% go mod tidy && go mod vendor
% grep -lr 10/copy
./go.sum Test-only dependencies don’t really “infect” the consumer. |
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 recent commits need to follow https://github.com/containers/image/blob/main/CONTRIBUTING.md#sign-your-prs .
(And eventually, please squash them into one.)
Actually, you're right. Test dependencies won't inflect customer since Go 1.18. Found this change Closing PR. |
This PR replaces usage of
copy.Copy
with hand-writtencopyDir
function. It's not worth keeping this dependency used only in tests.Yeah,
copyDir
is not ideal, andcopy.Copy
is much more powerful and covers many of OS's corner cases, but for tests it's good. In the future, we can return this dependency ifcopy.Copy
will be needed for the prod code.