abstract the string slice struct to stringutils package#15913
abstract the string slice struct to stringutils package#15913runcom merged 1 commit intomoby:masterfrom
Conversation
|
Very nice. LGTM |
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
|
I like the idea of combining these types. But I'm not sure I see the value of having an abstraction around What about just using |
|
@aaronlehmann we can't use []string directly because the cmd or entrypoint may be a string or a slice of strings. If we use []string a BC break will be introduced. If in the future we need to add more fields to the structure, we can just create a new struct in runconfig and embed the StrSlice struct. |
|
@aaronlehmann, @mountkin is right. We need this struct to support arguments that can be a string and a slice of strings at the same time. |
There was a problem hiding this comment.
nit, only need to define the type here once since both args are the same type.
|
LGTM |
|
This may also be useful if we should continue supporting old []string which accept a string as well (see #14338) LGTM |
abstract the string slice struct to stringutils package
The logic of
runconfig.Entrypointandrunconfig.Commandare almost the same.While I'm working on #15780 I find that I also need the string or slice parsing utils.
So I think abstracting the parsing code to a business independent package may be useful for other similar functions.