mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #12453 from runcom/style-minor-fixes
Add minor stylistic fixes
This commit is contained in:
commit
a7690076c9
5 changed files with 14 additions and 13 deletions
|
@ -609,11 +609,10 @@ func (b *Builder) run(c *daemon.Container) error {
|
||||||
|
|
||||||
// Wait for it to finish
|
// Wait for it to finish
|
||||||
if ret, _ := c.WaitStop(-1 * time.Second); ret != 0 {
|
if ret, _ := c.WaitStop(-1 * time.Second); ret != 0 {
|
||||||
err := &jsonmessage.JSONError{
|
return &jsonmessage.JSONError{
|
||||||
Message: fmt.Sprintf("The command %v returned a non-zero code: %d", b.Config.Cmd, ret),
|
Message: fmt.Sprintf("The command %v returned a non-zero code: %d", b.Config.Cmd, ret),
|
||||||
Code: ret,
|
Code: ret,
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -308,7 +308,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
|
||||||
"-t", string(iptables.Nat), "-I", "POSTROUTING"}, natArgs...)...); err != nil {
|
"-t", string(iptables.Nat), "-I", "POSTROUTING"}, natArgs...)...); err != nil {
|
||||||
return fmt.Errorf("Unable to enable network bridge NAT: %s", err)
|
return fmt.Errorf("Unable to enable network bridge NAT: %s", err)
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &iptables.ChainError{Chain: "POSTROUTING", Output: output}
|
return iptables.ChainError{Chain: "POSTROUTING", Output: output}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
|
||||||
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, outgoingArgs...)...); err != nil {
|
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, outgoingArgs...)...); err != nil {
|
||||||
return fmt.Errorf("Unable to allow outgoing packets: %s", err)
|
return fmt.Errorf("Unable to allow outgoing packets: %s", err)
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &iptables.ChainError{Chain: "FORWARD outgoing", Output: output}
|
return iptables.ChainError{Chain: "FORWARD outgoing", Output: output}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
|
||||||
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, existingArgs...)...); err != nil {
|
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, existingArgs...)...); err != nil {
|
||||||
return fmt.Errorf("Unable to allow incoming packets: %s", err)
|
return fmt.Errorf("Unable to allow incoming packets: %s", err)
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &iptables.ChainError{Chain: "FORWARD incoming", Output: output}
|
return iptables.ChainError{Chain: "FORWARD incoming", Output: output}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -41,7 +41,7 @@ type ChainError struct {
|
||||||
Output []byte
|
Output []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ChainError) Error() string {
|
func (e ChainError) Error() string {
|
||||||
return fmt.Sprintf("Error iptables %s: %s", e.Chain, string(e.Output))
|
return fmt.Sprintf("Error iptables %s: %s", e.Chain, string(e.Output))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ func (c *Chain) Forward(action Action, ip net.IP, port int, proto, destAddr stri
|
||||||
"--to-destination", net.JoinHostPort(destAddr, strconv.Itoa(destPort))); err != nil {
|
"--to-destination", net.JoinHostPort(destAddr, strconv.Itoa(destPort))); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &ChainError{Chain: "FORWARD", Output: output}
|
return ChainError{Chain: "FORWARD", Output: output}
|
||||||
}
|
}
|
||||||
|
|
||||||
if output, err := Raw("-t", string(Filter), string(action), c.Name,
|
if output, err := Raw("-t", string(Filter), string(action), c.Name,
|
||||||
|
@ -154,7 +154,7 @@ func (c *Chain) Forward(action Action, ip net.IP, port int, proto, destAddr stri
|
||||||
"-j", "ACCEPT"); err != nil {
|
"-j", "ACCEPT"); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &ChainError{Chain: "FORWARD", Output: output}
|
return ChainError{Chain: "FORWARD", Output: output}
|
||||||
}
|
}
|
||||||
|
|
||||||
if output, err := Raw("-t", string(Nat), string(action), "POSTROUTING",
|
if output, err := Raw("-t", string(Nat), string(action), "POSTROUTING",
|
||||||
|
@ -165,7 +165,7 @@ func (c *Chain) Forward(action Action, ip net.IP, port int, proto, destAddr stri
|
||||||
"-j", "MASQUERADE"); err != nil {
|
"-j", "MASQUERADE"); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &ChainError{Chain: "FORWARD", Output: output}
|
return ChainError{Chain: "FORWARD", Output: output}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -208,7 +208,7 @@ func (c *Chain) Prerouting(action Action, args ...string) error {
|
||||||
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &ChainError{Chain: "PREROUTING", Output: output}
|
return ChainError{Chain: "PREROUTING", Output: output}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ func (c *Chain) Output(action Action, args ...string) error {
|
||||||
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(output) != 0 {
|
} else if len(output) != 0 {
|
||||||
return &ChainError{Chain: "OUTPUT", Output: output}
|
return ChainError{Chain: "OUTPUT", Output: output}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@ package streamformatter
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StreamFormatter struct {
|
type StreamFormatter struct {
|
||||||
|
|
|
@ -3,9 +3,10 @@ package streamformatter
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFormatStream(t *testing.T) {
|
func TestFormatStream(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue