Formatting the code with https://github.com/mvdan/gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -352,7 +352,8 @@ func setInterfaceMaster(nlh *netlink.Handle, iface netlink.Link, i *nwIface) err |
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 | 354 |
return nlh.LinkSetMaster(iface, &netlink.Bridge{
|
| 355 |
- LinkAttrs: netlink.LinkAttrs{Name: i.DstMaster()}})
|
|
| 355 |
+ LinkAttrs: netlink.LinkAttrs{Name: i.DstMaster()},
|
|
| 356 |
+ }) |
|
| 356 | 357 |
} |
| 357 | 358 |
|
| 358 | 359 |
func setInterfaceMAC(nlh *netlink.Handle, iface netlink.Link, i *nwIface) error {
|
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
// For e.g. net.ipv4.ip_forward translated to /proc/sys/net/ipv4/ip_forward. |
| 14 | 14 |
func writeSystemProperty(key, value string) error {
|
| 15 | 15 |
keyPath := strings.ReplaceAll(key, ".", "/") |
| 16 |
- return os.WriteFile(path.Join("/proc/sys", keyPath), []byte(value), 0644)
|
|
| 16 |
+ return os.WriteFile(path.Join("/proc/sys", keyPath), []byte(value), 0o644)
|
|
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
// readSystemProperty reads the value from the path under /proc/sys and returns it |
| ... | ... |
@@ -73,7 +73,7 @@ func basePath() string {
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
func createBasePath() {
|
| 76 |
- err := os.MkdirAll(basePath(), 0755) |
|
| 76 |
+ err := os.MkdirAll(basePath(), 0o755) |
|
| 77 | 77 |
if err != nil {
|
| 78 | 78 |
panic("Could not create net namespace path directory")
|
| 79 | 79 |
} |
| ... | ... |
@@ -380,12 +380,12 @@ func (n *networkNamespace) DisableARPForVIP(srcName string) (Err error) {
|
| 380 | 380 |
|
| 381 | 381 |
err := n.InvokeFunc(func() {
|
| 382 | 382 |
path := filepath.Join("/proc/sys/net/ipv4/conf", dstName, "arp_ignore")
|
| 383 |
- if err := os.WriteFile(path, []byte{'1', '\n'}, 0644); err != nil {
|
|
| 383 |
+ if err := os.WriteFile(path, []byte{'1', '\n'}, 0o644); err != nil {
|
|
| 384 | 384 |
Err = fmt.Errorf("Failed to set %s to 1: %v", path, err)
|
| 385 | 385 |
return |
| 386 | 386 |
} |
| 387 | 387 |
path = filepath.Join("/proc/sys/net/ipv4/conf", dstName, "arp_announce")
|
| 388 |
- if err := os.WriteFile(path, []byte{'2', '\n'}, 0644); err != nil {
|
|
| 388 |
+ if err := os.WriteFile(path, []byte{'2', '\n'}, 0o644); err != nil {
|
|
| 389 | 389 |
Err = fmt.Errorf("Failed to set %s to 2: %v", path, err)
|
| 390 | 390 |
return |
| 391 | 391 |
} |
| ... | ... |
@@ -58,7 +58,8 @@ func newKey(t *testing.T) (string, error) {
|
| 58 | 58 |
func newInfo(hnd *netlink.Handle, t *testing.T) (Sandbox, error) {
|
| 59 | 59 |
veth := &netlink.Veth{
|
| 60 | 60 |
LinkAttrs: netlink.LinkAttrs{Name: vethName1, TxQLen: 0},
|
| 61 |
- PeerName: vethName2} |
|
| 61 |
+ PeerName: vethName2, |
|
| 62 |
+ } |
|
| 62 | 63 |
if err := hnd.LinkAdd(veth); err != nil {
|
| 63 | 64 |
return nil, err |
| 64 | 65 |
} |
| ... | ... |
@@ -97,7 +98,8 @@ func newInfo(hnd *netlink.Handle, t *testing.T) (Sandbox, error) {
|
| 97 | 97 |
|
| 98 | 98 |
veth = &netlink.Veth{
|
| 99 | 99 |
LinkAttrs: netlink.LinkAttrs{Name: vethName3, TxQLen: 0},
|
| 100 |
- PeerName: vethName4} |
|
| 100 |
+ PeerName: vethName4, |
|
| 101 |
+ } |
|
| 101 | 102 |
|
| 102 | 103 |
if err := hnd.LinkAdd(veth); err != nil {
|
| 103 | 104 |
return nil, err |
| ... | ... |
@@ -4,10 +4,8 @@ package osl |
| 4 | 4 |
|
| 5 | 5 |
import "errors" |
| 6 | 6 |
|
| 7 |
-var ( |
|
| 8 |
- // ErrNotImplemented is for platforms which don't implement sandbox |
|
| 9 |
- ErrNotImplemented = errors.New("not implemented")
|
|
| 10 |
-) |
|
| 7 |
+// ErrNotImplemented is for platforms which don't implement sandbox |
|
| 8 |
+var ErrNotImplemented = errors.New("not implemented")
|
|
| 11 | 9 |
|
| 12 | 10 |
// NewSandbox provides a new sandbox instance created in an os specific way |
| 13 | 11 |
// provided a key which uniquely identifies the sandbox |