Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jan 7, 2020
1 parent 48d949d commit 2f33a53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
34 changes: 2 additions & 32 deletions pkg/visor/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,25 +426,10 @@ func (mc *mockRPCClient) SetAutoStart(appName string, autostart bool) error {
func (mc *mockRPCClient) SetSocksPassword(password string) error {
return mc.do(true, func() error {
const socksName = "skysocks"
const passcodeArgName = "-passcode"

changed := false

for i := range mc.s.Apps {
if mc.s.Apps[i].Name == socksName {
for j := range mc.s.Apps[i].Args {
if mc.s.Apps[i].Args[j] == passcodeArgName && j+1 < len(mc.s.Apps[i].Args) {
mc.s.Apps[i].Args[j+1] = password
changed = true
break
}
}

if !changed {
mc.s.Apps[i].Args = append(mc.s.Apps[i].Args, passcodeArgName, password)
}

break
return nil
}
}

Expand All @@ -456,25 +441,10 @@ func (mc *mockRPCClient) SetSocksPassword(password string) error {
func (mc *mockRPCClient) SetSocksClientPK(pk cipher.PubKey) error {
return mc.do(true, func() error {
const socksName = "skysocks-client"
const pkArgName = "-srv"

changed := false

for i := range mc.s.Apps {
if mc.s.Apps[i].Name == socksName {
for j := range mc.s.Apps[i].Args {
if mc.s.Apps[i].Args[j] == pkArgName && j+1 < len(mc.s.Apps[i].Args) {
mc.s.Apps[i].Args[j+1] = pk.String()
changed = true
break
}
}

if !changed {
mc.s.Apps[i].Args = append(mc.s.Apps[i].Args, pkArgName, pk.String())
}

break
return nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ type AppState struct {
AutoStart bool `json:"autostart"`
Port routing.Port `json:"port"`
Status AppStatus `json:"status"`
Args []string `json:"args"`
}

// Node provides messaging runtime for Apps by setting up all
Expand Down Expand Up @@ -399,7 +398,7 @@ func (node *Node) Apps() []*AppState {
res := make([]*AppState, 0)

for _, app := range node.appsConf {
state := &AppState{app.App, app.AutoStart, app.Port, AppStatusStopped, nil}
state := &AppState{app.App, app.AutoStart, app.Port, AppStatusStopped}

if node.procManager.Exists(app.App) {
state.Status = AppStatusRunning
Expand Down Expand Up @@ -510,6 +509,7 @@ func (node *Node) StopApp(appName string) error {
return nil
}

// RestartApp restarts running App.
func (node *Node) RestartApp(name string) error {
if err := node.StopApp(name); err != nil {
return err
Expand Down

0 comments on commit 2f33a53

Please sign in to comment.