From 364dfecb31c3fe25f72293636257679900dd71ff Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Fri, 21 Sep 2018 16:57:02 +0200 Subject: [PATCH] Cleaning code to please the linter Added feature for #145 Fix bug #145 --- go.mod | 2 +- openwrt/network.go | 2 +- openwrt/uci_test.go | 9 +++++++++ openwrt/wifi.go | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 066ee89..f641e43 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module forge.cadoles.com/Pyxis/orion require ( forge.cadoles.com/Pyxis/golang-socketio v0.0.0-20180919100209-bb857ced6b95 github.com/caarlos0/env v3.3.0+incompatible - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.1 github.com/go-chi/chi v3.3.3+incompatible github.com/gorilla/websocket v1.4.0 // indirect github.com/mitchellh/mapstructure v1.0.0 diff --git a/openwrt/network.go b/openwrt/network.go index 6ba5d47..dc3d449 100644 --- a/openwrt/network.go +++ b/openwrt/network.go @@ -24,7 +24,7 @@ func NewNetworkWithExecutor(exe Executor) *Network { return &Network{exec} } -// ListInterfaces list all available interfaces on a system using "ip" commmand +// ListInterfaces list all available interfaces on a system using "ip" command func (n *Network) ListInterfaces() []net.Interface { var result []net.Interface ifaces, err := net.Interfaces() diff --git a/openwrt/uci_test.go b/openwrt/uci_test.go index 36418af..34a1522 100644 --- a/openwrt/uci_test.go +++ b/openwrt/uci_test.go @@ -22,6 +22,15 @@ func TestUCIAdd(t *testing.T) { } } +func TestUCIAddFailed(t *testing.T) { + exec := createMockExecutor("", "BigError", 3) + uci := NewUCIWithExecutor(exec) + res := uci.Add("wireless", "test") + if res.ReturnCode != 3 { + t.Error("Bad Return Code !") + } +} + func TestUCIDelete(t *testing.T) { exec := createMockExecutor("", "", 0) uci := NewUCIWithExecutor(exec) diff --git a/openwrt/wifi.go b/openwrt/wifi.go index e930bc5..c884f14 100644 --- a/openwrt/wifi.go +++ b/openwrt/wifi.go @@ -61,7 +61,7 @@ func (w *Wifi) parseWifiCells(stdout string) int { return 0 } -// GetWifiCells retrieves all availabe wifi cells for a card ! +// GetWifiCells retrieves all available wifi cells for a card ! func (w *Wifi) GetWifiCells() int { res := w.exec.Run("iwinfo", w.iface, "scan") if res.ReturnCode != 0 {