diff --git a/iptables/iptables.go b/iptables/iptables.go index f8b3aa7..204d703 100644 --- a/iptables/iptables.go +++ b/iptables/iptables.go @@ -41,7 +41,7 @@ type ChainError struct { Output []byte } -func (e *ChainError) Error() string { +func (e ChainError) Error() string { 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 { return err } 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, @@ -154,7 +154,7 @@ func (c *Chain) Forward(action Action, ip net.IP, port int, proto, destAddr stri "-j", "ACCEPT"); err != nil { return err } 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", @@ -165,7 +165,7 @@ func (c *Chain) Forward(action Action, ip net.IP, port int, proto, destAddr stri "-j", "MASQUERADE"); err != nil { return err } else if len(output) != 0 { - return &ChainError{Chain: "FORWARD", Output: output} + return ChainError{Chain: "FORWARD", Output: output} } 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 { return err } else if len(output) != 0 { - return &ChainError{Chain: "PREROUTING", Output: output} + return ChainError{Chain: "PREROUTING", Output: output} } 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 { return err } else if len(output) != 0 { - return &ChainError{Chain: "OUTPUT", Output: output} + return ChainError{Chain: "OUTPUT", Output: output} } return nil } diff --git a/streamformatter/streamformatter.go b/streamformatter/streamformatter.go index 383e7ad..90f2b69 100644 --- a/streamformatter/streamformatter.go +++ b/streamformatter/streamformatter.go @@ -3,8 +3,9 @@ package streamformatter import ( "encoding/json" "fmt" - "github.com/docker/docker/pkg/jsonmessage" "io" + + "github.com/docker/docker/pkg/jsonmessage" ) type StreamFormatter struct { diff --git a/streamformatter/streamformatter_test.go b/streamformatter/streamformatter_test.go index edc432e..1dee05a 100644 --- a/streamformatter/streamformatter_test.go +++ b/streamformatter/streamformatter_test.go @@ -3,9 +3,10 @@ package streamformatter import ( "encoding/json" "errors" - "github.com/docker/docker/pkg/jsonmessage" "reflect" "testing" + + "github.com/docker/docker/pkg/jsonmessage" ) func TestFormatStream(t *testing.T) {