Ver Fonte

fix test script and style

Eugene Yakubovich há 10 anos atrás
pai
commit
d81e4573b5
2 ficheiros alterados com 4 adições e 5 exclusões
  1. 3 4
      pkg/ip/iptables.go
  2. 1 1
      test

+ 3 - 4
pkg/ip/iptables.go

@@ -18,7 +18,7 @@ func NewIPTables() (*IPTables, error) {
 	return &IPTables{path}, nil
 }
 
-func (ipt *IPTables) Exists(table string, args... string) (bool, error) {
+func (ipt *IPTables) Exists(table string, args ...string) (bool, error) {
 	cmd := append([]string{"-t", table, "-C"}, args...)
 	err := exec.Command(ipt.path, cmd...).Run()
 
@@ -32,13 +32,13 @@ func (ipt *IPTables) Exists(table string, args... string) (bool, error) {
 	}
 }
 
-func (ipt *IPTables) Append(table string, args... string) error {
+func (ipt *IPTables) Append(table string, args ...string) error {
 	cmd := append([]string{"-t", table, "-A"}, args...)
 	return exec.Command(ipt.path, cmd...).Run()
 }
 
 // AppendUnique acts like Append except that it won't add a duplicate
-func (ipt *IPTables) AppendUnique(table string, args... string) error {
+func (ipt *IPTables) AppendUnique(table string, args ...string) error {
 	exists, err := ipt.Exists(table, args...)
 	if err != nil {
 		return err
@@ -66,4 +66,3 @@ func (ipt *IPTables) ClearChain(table, chain string) error {
 		return err
 	}
 }
-

+ 1 - 1
test

@@ -14,7 +14,7 @@ COVER=${COVER:-"-cover"}
 
 source ./build
 
-TESTABLE="pkg subnet"
+TESTABLE="pkg/ip subnet"
 FORMATTABLE="$TESTABLE"
 
 # user has not provided PKG override