mirror of https://github.com/docker/cli.git
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
1de08ac417
commit
ca2aeb5a3e
|
@ -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")
|
||||||
},
|
},
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue