mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
why there are so many mistakes in our repo (up to /cmd)
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
This commit is contained in:
parent
387ff3c41d
commit
f8a4047796
19 changed files with 20 additions and 20 deletions
|
@ -18,7 +18,7 @@ type ContainerAttachConfig struct {
|
||||||
Stream bool
|
Stream bool
|
||||||
DetachKeys string
|
DetachKeys string
|
||||||
|
|
||||||
// Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/sderr messages accordingly.
|
// Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/stderr messages accordingly.
|
||||||
// TODO @cpuguy83: This shouldn't be needed. It was only added so that http and websocket endpoints can use the same function, and the websocket function was not using a stdwriter prior to this change...
|
// TODO @cpuguy83: This shouldn't be needed. It was only added so that http and websocket endpoints can use the same function, and the websocket function was not using a stdwriter prior to this change...
|
||||||
// HOWEVER, the websocket endpoint is using a single stream and SHOULD be encoded with stdout/stderr as is done for HTTP since it is still just a single stream.
|
// HOWEVER, the websocket endpoint is using a single stream and SHOULD be encoded with stdout/stderr as is done for HTTP since it is still just a single stream.
|
||||||
// Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately.
|
// Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately.
|
||||||
|
|
|
@ -179,9 +179,9 @@ func TestBuilderFlags(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if flStr1.Value != "BYE" {
|
if flStr1.Value != "BYE" {
|
||||||
t.Fatalf("Teset %s, str1 should be BYE", bf.Args)
|
t.Fatalf("Test %s, str1 should be BYE", bf.Args)
|
||||||
}
|
}
|
||||||
if !flBool1.IsTrue() {
|
if !flBool1.IsTrue() {
|
||||||
t.Fatalf("Teset %s, bool1 should be true", bf.Args)
|
t.Fatalf("Test %s, bool1 should be true", bf.Args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -724,7 +724,7 @@ func stopSignal(b *Builder, args []string, attributes map[string]bool, original
|
||||||
// ARG name[=value]
|
// ARG name[=value]
|
||||||
//
|
//
|
||||||
// Adds the variable foo to the trusted list of variables that can be passed
|
// Adds the variable foo to the trusted list of variables that can be passed
|
||||||
// to builder using the --build-arg flag for expansion/subsitution or passing to 'run'.
|
// to builder using the --build-arg flag for expansion/substitution or passing to 'run'.
|
||||||
// Dockerfile author may optionally set a default value of this variable.
|
// Dockerfile author may optionally set a default value of this variable.
|
||||||
func arg(b *Builder, args []string, attributes map[string]bool, original string) error {
|
func arg(b *Builder, args []string, attributes map[string]bool, original string) error {
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
|
|
|
@ -210,7 +210,7 @@ func TestFrom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.image != "" {
|
if b.image != "" {
|
||||||
t.Fatalf("Image shoule be empty, got: %s", b.image)
|
t.Fatalf("Image should be empty, got: %s", b.image)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.noBaseImage != true {
|
if b.noBaseImage != true {
|
||||||
|
|
|
@ -16,7 +16,7 @@ func TestEmptyDockerfile(t *testing.T) {
|
||||||
|
|
||||||
createTestTempFile(t, contextDir, builder.DefaultDockerfileName, "", 0777)
|
createTestTempFile(t, contextDir, builder.DefaultDockerfileName, "", 0777)
|
||||||
|
|
||||||
readAndCheckDockerfile(t, "emptyDockefile", contextDir, "", "The Dockerfile (Dockerfile) cannot be empty")
|
readAndCheckDockerfile(t, "emptyDockerfile", contextDir, "", "The Dockerfile (Dockerfile) cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSymlinkDockerfile(t *testing.T) {
|
func TestSymlinkDockerfile(t *testing.T) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ type Node struct {
|
||||||
// parsing directives.
|
// parsing directives.
|
||||||
type Directive struct {
|
type Directive struct {
|
||||||
EscapeToken rune // Current escape token
|
EscapeToken rune // Current escape token
|
||||||
LineContinuationRegex *regexp.Regexp // Current line contination regex
|
LineContinuationRegex *regexp.Regexp // Current line continuation regex
|
||||||
LookingForDirectives bool // Whether we are currently looking for directives
|
LookingForDirectives bool // Whether we are currently looking for directives
|
||||||
EscapeSeen bool // Whether the escape directive has been seen
|
EscapeSeen bool // Whether the escape directive has been seen
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ func newExecOptions() *execOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExecCommand creats a new cobra.Command for `docker exec`
|
// NewExecCommand creates a new cobra.Command for `docker exec`
|
||||||
func NewExecCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewExecCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
opts := newExecOptions()
|
opts := newExecOptions()
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ func marshalMap(x interface{}) (map[string]interface{}, error) {
|
||||||
return nil, fmt.Errorf("expected a pointer to a struct, got %v", val.Kind())
|
return nil, fmt.Errorf("expected a pointer to a struct, got %v", val.Kind())
|
||||||
}
|
}
|
||||||
if val.IsNil() {
|
if val.IsNil() {
|
||||||
return nil, fmt.Errorf("expxected a pointer to a struct, got nil pointer")
|
return nil, fmt.Errorf("expected a pointer to a struct, got nil pointer")
|
||||||
}
|
}
|
||||||
valElem := val.Elem()
|
valElem := val.Elem()
|
||||||
if valElem.Kind() != reflect.Struct {
|
if valElem.Kind() != reflect.Struct {
|
||||||
|
|
|
@ -120,7 +120,7 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
|
|
||||||
// lastProgressOutput is the same as progress.Output except
|
// lastProgressOutput is the same as progress.Output except
|
||||||
// that it only output with the last update. It is used in
|
// that it only output with the last update. It is used in
|
||||||
// non terminal scenarios to depresss verbose messages
|
// non terminal scenarios to suppress verbose messages
|
||||||
type lastProgressOutput struct {
|
type lastProgressOutput struct {
|
||||||
output progress.Output
|
output progress.Output
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ func GetContextFromReader(r io.ReadCloser, dockerfileName string) (out io.ReadCl
|
||||||
// Input should be read as a Dockerfile.
|
// Input should be read as a Dockerfile.
|
||||||
tmpDir, err := ioutil.TempDir("", "docker-build-context-")
|
tmpDir, err := ioutil.TempDir("", "docker-build-context-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("unbale to create temporary context directory: %v", err)
|
return nil, "", fmt.Errorf("unable to create temporary context directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Create(filepath.Join(tmpDir, DefaultDockerfileName))
|
f, err := os.Create(filepath.Join(tmpDir, DefaultDockerfileName))
|
||||||
|
|
|
@ -106,7 +106,7 @@ func runCreate(dockerCli *command.DockerCli, opts createOptions) error {
|
||||||
// Consolidates the ipam configuration as a group from different related configurations
|
// Consolidates the ipam configuration as a group from different related configurations
|
||||||
// user can configure network with multiple non-overlapping subnets and hence it is
|
// user can configure network with multiple non-overlapping subnets and hence it is
|
||||||
// possible to correlate the various related parameters and consolidate them.
|
// possible to correlate the various related parameters and consolidate them.
|
||||||
// consoidateIpam consolidates subnets, ip-ranges, gateways and auxiliary addresses into
|
// consolidateIpam consolidates subnets, ip-ranges, gateways and auxiliary addresses into
|
||||||
// structured ipam data.
|
// structured ipam data.
|
||||||
func consolidateIpam(subnets, ranges, gateways []string, auxaddrs map[string]string) ([]network.IPAMConfig, error) {
|
func consolidateIpam(subnets, ranges, gateways []string, auxaddrs map[string]string) ([]network.IPAMConfig, error) {
|
||||||
if len(subnets) < len(ranges) || len(subnets) < len(gateways) {
|
if len(subnets) < len(ranges) || len(subnets) < len(gateways) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) {
|
||||||
expectedError: "error initializing the swarm",
|
expectedError: "error initializing the swarm",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "init-faild-with-ip-choice",
|
name: "init-failed-with-ip-choice",
|
||||||
swarmInitFunc: func() (string, error) {
|
swarmInitFunc: func() (string, error) {
|
||||||
return "", fmt.Errorf("could not choose an IP address to advertise")
|
return "", fmt.Errorf("could not choose an IP address to advertise")
|
||||||
},
|
},
|
||||||
|
|
|
@ -137,7 +137,7 @@ type StringOrNumberList []string
|
||||||
// key=value strings
|
// key=value strings
|
||||||
type MappingWithEquals map[string]string
|
type MappingWithEquals map[string]string
|
||||||
|
|
||||||
// MappingWithColon is a mapping type that can be converted from alist of
|
// MappingWithColon is a mapping type that can be converted from a list of
|
||||||
// 'key: value' strings
|
// 'key: value' strings
|
||||||
type MappingWithColon map[string]string
|
type MappingWithColon map[string]string
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (c *nativeStore) getCredentialsFromStore(serverAddress string) (types.AuthC
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if credentials.IsErrCredentialsNotFound(err) {
|
if credentials.IsErrCredentialsNotFound(err) {
|
||||||
// do not return an error if the credentials are not
|
// do not return an error if the credentials are not
|
||||||
// in the keyckain. Let docker ask for new credentials.
|
// in the keychain. Let docker ask for new credentials.
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
return ret, err
|
return ret, err
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TestContainerCreateError(t *testing.T) {
|
||||||
t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %v", err)
|
t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 404 doesn't automagitally means an unknown image
|
// 404 doesn't automatically means an unknown image
|
||||||
client = &Client{
|
client = &Client{
|
||||||
client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
|
client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TestImageTagError(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this is not testing all the InvalidReference as it's the reponsability
|
// Note: this is not testing all the InvalidReference as it's the responsibility
|
||||||
// of distribution/reference package.
|
// of distribution/reference package.
|
||||||
func TestImageTagInvalidReference(t *testing.T) {
|
func TestImageTagInvalidReference(t *testing.T) {
|
||||||
client := &Client{
|
client := &Client{
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmUnlock unlockes locked swarm.
|
// SwarmUnlock unlocks locked swarm.
|
||||||
func (cli *Client) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error {
|
func (cli *Client) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error {
|
||||||
serverResp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil)
|
serverResp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil)
|
||||||
ensureReaderClosed(serverResp)
|
ensureReaderClosed(serverResp)
|
||||||
|
|
|
@ -679,7 +679,7 @@ Use `df <source-dir>` to figure out the source mount and then use
|
||||||
`findmnt -o TARGET,PROPAGATION <source-mount-dir>` to figure out propagation
|
`findmnt -o TARGET,PROPAGATION <source-mount-dir>` to figure out propagation
|
||||||
properties of source mount. If `findmnt` utility is not available, then one
|
properties of source mount. If `findmnt` utility is not available, then one
|
||||||
can look at mount entry for source mount point in `/proc/self/mountinfo`. Look
|
can look at mount entry for source mount point in `/proc/self/mountinfo`. Look
|
||||||
at `optional fields` and see if any propagaion properties are specified.
|
at `optional fields` and see if any propagation properties are specified.
|
||||||
`shared:X` means mount is `shared`, `master:X` means mount is `slave` and if
|
`shared:X` means mount is `shared`, `master:X` means mount is `slave` and if
|
||||||
nothing is there that means mount is `private`.
|
nothing is there that means mount is `private`.
|
||||||
|
|
||||||
|
|
|
@ -653,7 +653,7 @@ Example use: `dockerd -s zfs --storage-opt zfs.fsname=zroot/docker`
|
||||||
|
|
||||||
#### btrfs.min_space
|
#### btrfs.min_space
|
||||||
|
|
||||||
Specifies the mininum size to use when creating the subvolume which is used for
|
Specifies the minimum size to use when creating the subvolume which is used for
|
||||||
containers. If user uses disk quota for btrfs when creating or running a
|
containers. If user uses disk quota for btrfs when creating or running a
|
||||||
container with **--storage-opt size** option, docker should ensure the **size**
|
container with **--storage-opt size** option, docker should ensure the **size**
|
||||||
cannot be smaller than **btrfs.min_space**.
|
cannot be smaller than **btrfs.min_space**.
|
||||||
|
|
Loading…
Reference in a new issue