client: Use string concatenation instead of Sprintf#33536
client: Use string concatenation instead of Sprintf#33536thaJeztah merged 1 commit intomoby:masterfrom
Conversation
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
| } | ||
|
|
||
| apiPath := fmt.Sprintf("/containers/%s/archive", container) | ||
| apiPath := "/containers/" + container + "/archive" |
There was a problem hiding this comment.
Wondering if we should use path.Join() for these (although they're of course URL's, so probably won't make much of a difference)
There was a problem hiding this comment.
I'd be okay with that. I don't have much of a preference either way.
There was a problem hiding this comment.
I think for now this is ok, as it's closest to what the existing code does. We should do a whole scan of all URL's we generate, because there's no escaping / handling of special characters in most locations
|
@tophj-ibm flaky test on z? |
|
Hm, and flaky test on Windows; |
|
The logic in I guess ideally the test could be rewritten to avoid sleeps and poll the PEM file on disk instead. Then if it still fails, we'd have more confidence that something is actually wrong. There's something very similar here: moby/integration-cli/docker_api_swarm_test.go Lines 214 to 224 in 376c75d I can give this a try if I have a chance. cc @cyli |
|
@thaJeztah it used to be, although I haven't seen it fail in a few months and thought it was fixed. @aaronlehmann looking at the logs https://jenkins.dockerproject.org/job/Docker-PRs-s390x/3482/ in between the first and second restarts in checkSwarmUnlockedToLocked, the failing daemon starts up (is unlocked), starts its own leader election, and times out with "session initiation timed out". This happens a few times, it complains about not having a leader and then the 2nd restart occurs. So if I'm reading everything correctly, it does look like a spurious leader election on restart, which makes it never read the logs from the leader and lock. |
|
@aaronlehmann @tophj-ibm Thanks for finding that! |
|
Don't know what's wrong with WindowsRS1; https://jenkins.dockerproject.org/job/Docker-PRs-WoW-RS1/14661/console |
|
All green now 🎉 |
Despite my C background, I dislike
Sprintfand try to avoid it when I can. I've seen too many printf format string bugs. I tolerate it when it's used for actual formatting, but for simple string concatenation, I much prefer the+operator. It makes code easier to read and allows more compile-time checking.