a4a878dfdb
Closes #14621 This one grew to be much more than I expected so here's the story... :-) - when a bad port string (e.g. xxx80) is passed into container.create() via the API it wasn't being checked until we tried to start the container. - While starting the container we trid to parse 'xxx80' in nat.Int() and would panic on the strconv.ParseUint(). We should (almost) never panic. - In trying to remove the panic I decided to make it so that we, instead, checked the string during the NewPort() constructor. This means that I had to change all casts from 'string' to 'Port' to use NewPort() instead. Which is a good thing anyway, people shouldn't assume they know the internal format of types like that, in general. - This meant I had to go and add error checks on all calls to NewPort(). To avoid changing the testcases too much I create newPortNoError() **JUST** for the testcase uses where we know the port string is ok. - After all of that I then went back and added a check during container.create() to check the port string so we'll report the error as soon as we get the data. - If, somehow, the bad string does get into the metadata we will generate an error during container.start() but I can't test for that because the container.create() catches it now. But I did add a testcase for that. Signed-off-by: Doug Davis <dug@us.ibm.com> |
||
---|---|---|
archive | ||
broadcastwriter | ||
chrootarchive | ||
devicemapper | ||
directory | ||
fileutils | ||
graphdb | ||
homedir | ||
httputils | ||
ioutils | ||
jsonlog | ||
jsonmessage | ||
listenbuffer | ||
mflag | ||
mount | ||
namesgenerator | ||
nat | ||
parsers | ||
pidfile | ||
plugins | ||
pools | ||
progressreader | ||
promise | ||
proxy | ||
pubsub | ||
random | ||
reexec | ||
signal | ||
sockets | ||
stdcopy | ||
streamformatter | ||
stringid | ||
stringutils | ||
symlink | ||
sysinfo | ||
system | ||
systemd | ||
tailfile | ||
tarsum | ||
term | ||
timeoutconn | ||
timeutils | ||
tlsconfig | ||
transport | ||
truncindex | ||
ulimit | ||
units | ||
urlutil | ||
useragent | ||
version | ||
README.md |
pkg/ is a collection of utility packages used by the Docker project without being specific to its internals.
Utility packages are kept separate from the docker core codebase to keep it as small and concise as possible. If some utilities grow larger and their APIs stabilize, they may be moved to their own repository under the Docker organization, to facilitate re-use by other projects. However that is not the priority.
The directory pkg
is named after the same directory in the camlistore project. Since Brad is a core
Go maintainer, we thought it made sense to copy his methods for organizing Go code :) Thanks Brad!
Because utility packages are small and neatly separated from the rest of the codebase, they are a good place to start for aspiring maintainers and contributors. Get in touch if you want to help maintain them!