Refactor utils/utils, fixes #11923#11992
Conversation
|
Holy 💩, nice work :-) |
|
I'll fix test asap! |
|
I'm not sure about |
|
@icecrime same thought, I was going to add a bool wheater to compare sensitive or insensitive to InSlice, what do you think? Otherwise I'll just rename it back |
|
Sorry, I just deleted a stupid comment of mine ( |
|
alright, I was using |
a12b117 to
4611a93
Compare
|
tests fixed @icecrime |
|
ooo cool table |
|
this is legit! |
|
gonna rebase this if it's still ok! many many conflicts lol |
|
Yes we def want |
|
This is gonna be a mess 😩 I'll do it asap! |
4611a93 to
39084d6
Compare
|
@jfrazelle rebased |
There was a problem hiding this comment.
Should this be moved to pkg/stringid in stead? That's also used to generate IDs
There was a problem hiding this comment.
^^ just thinking out loud; I'm not a maintainer
There was a problem hiding this comment.
@thaJeztah ValidateID is a docker specific routine to check whether the image id is valid or not and cannot be included in pkg/stringid because whole pkgs purpose is about reusable code not tied to docker internals. Plus it's already namespaced here so image.ValidateID is just about validating image ids.
There was a problem hiding this comment.
hm, yes. stringid.TruncateID() is quite docker-specific though, because of the arbitrary length. Think that put me on the wrong foot.
There was a problem hiding this comment.
mmm I don't know, the stringid/truncindex are tied but can be useful outside docker too I suppose.
There was a problem hiding this comment.
yeah, I just thought I'd mention it. I was thinking of creating an (non related) issue because I noticed some parts of the code used stringid.TruncateID() and some parts used a literal id[:12], then I stumbled upon this PR 😄
39084d6 to
b295d30
Compare
Signed-off-by: Antonio Murdaca <[email protected]>
b295d30 to
c30a55f
Compare
|
ping @LK4D4 rebased and moved |
There was a problem hiding this comment.
Btw makes sense to make it value, not pointer. It isn't big deal for client though, just matter of Go-style. You can create issue for newbie contributors about it.
|
LGTM |
1 similar comment
|
LGTM |
Refactor utils/utils, fixes #11923
Pretty big changes here, sorry for this. (@jfrazelle I've read you had brain explosion while cherry-picking commits for release after one of my "refactors", again, sorry 😅)
The whole point is to get rid of
utils/utilsunless strictly needed for docker's thingies.Only functions left in
utils/utilsare, as said, functions needed in the project that either cannot be in pkgs (because docker related) or cannot be moved to specific part of the project (because used in many places).Did it for fun and because I don't like utils pattern.. Feel free to close this if it's totally unnecessary.
utils/utilsfunctionTruncTruncatepkg/stringutilsStringsContainsNocaseInSlicepkg/stringutilsDownloadpkg/httputilsCopyFilepkg/fileutilsValidateIDimage.goWriteCounter*pkg/ioutils/writers.goGetTotalUsedFdspkg/fileutilsCopyEscapablecopyEscapableattach.goHashDatapkg/ioutils/reader.goShellQuoteArgumentspkg/stringutilsReadSymlinkedDirectorypkg/fileutilsKeyValuePair(struct)runconfigNewHTTPRequestErrorpkg/httputilsStatusError(struct)api/clientFixes #11923.
Signed-off-by: Antonio Murdaca [email protected]