Skip to content

Separate the GenerateRandomAlphaOnlyString function from stringutils#35313

Merged
thaJeztah merged 1 commit intomoby:masterfrom
ChiuWang:RandomAlpha
Oct 29, 2017
Merged

Separate the GenerateRandomAlphaOnlyString function from stringutils#35313
thaJeztah merged 1 commit intomoby:masterfrom
ChiuWang:RandomAlpha

Conversation

@ChiuWang
Copy link
Contributor

@ChiuWang ChiuWang commented Oct 27, 2017

Signed-off-by: Chao Wang [email protected]

- What I did
GenerateRandomAlphaOnlyString() in pkg/stringutils only used in test(integration-cli), so we move it to the integration-cli/cli. And it's a part of improving stringutls.
- How I did it
According to @thaJeztah 's suggestion at /moby/moby/pull/35034(closed)

  • Move Ellipsis() to Docker/cli repository, and rewrite to fix multilanguage display bug. docker/cli/pull/621

  • Separate the GenerateRandomAlphaOnlyString() function from stringutils.

  • We should copy Inslice() to those parts that use it, possibly renaming it for each purpose. ( Used in a couple of tests, and also in the seccomp and oci_linux parts )

  • stringutils can be removed safely. Truncate() & GenerateRandomASCIIString() & ShellQuoteArguments() & InSlice()

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should move it somewhere inside docker/internal/test/, together with the existing unit tests; that marks the package as "internal" only

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

Copy link
Member

Choose a reason for hiding this comment

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

You can create a file there, and move the GenerateRandomAlphaOnlyString() function there, including the associated tests from https://github.com/moby/moby/blob/master/pkg/stringutils/stringutils_test.go

As I noticed in #35034 (review), GenerateRandomASCIIString() is not used anywhere, so that can be removed from the pkg/stringutils/ as well (I suggest doing that all in a single PR/commit so that it's easier to track where things went)

Copy link
Contributor Author

@ChiuWang ChiuWang Oct 27, 2017

Choose a reason for hiding this comment

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

Yes. As I comment it above in the tasklist, it will be done next. And would plz check PR func Ellipsis() at docker/cli

Copy link
Member

Choose a reason for hiding this comment

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

Oh, missed that comment; perfect!

Let me review that PR, I see you updated 👍

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "RandomAlpha" [email protected]:charrywanganthony/moby.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@GordonTheTurtle GordonTheTurtle added dco/no Automatically set by a bot when one of the commits lacks proper signature status/0-triage labels Oct 27, 2017
Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

second commit needs to be signed, otherwise LGTM

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

@charrywanganthony can you remove the GenerateRandomAlphaOnlyString() and tests from the original package? I'd prefer to have that done in the same pull request.

Also, can you squash your commits?

@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 28, 2017
@ChiuWang
Copy link
Contributor Author

Modified. squash commits and remove function from original package.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit ba3bf81 into moby:master Oct 29, 2017
@ChiuWang ChiuWang deleted the RandomAlpha branch October 30, 2017 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants