Skip to content

Commit

Permalink
gofmt applied
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosaigor committed Apr 30, 2020
1 parent 871a010 commit b943d18
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion destroyer/destroyer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package destroyer

import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"errors"

"github.com/barbosaigor/april"
"github.com/barbosaigor/april/auth"
Expand Down
3 changes: 2 additions & 1 deletion destroyer/instance.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package destroyer

type Status uint8

// Status allowed values
const (
Up = Status(iota)
Expand All @@ -11,5 +12,5 @@ const (

type Instance struct {
Name string
Sts Status
Sts Status
}
6 changes: 3 additions & 3 deletions destroyer/request/reqtodtyr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"errors"
"fmt"
"net/http"
"io/ioutil"
"net/http"

"github.com/barbosaigor/april"
"github.com/barbosaigor/april/destroyer"
Expand Down Expand Up @@ -42,11 +42,11 @@ func ReqToDestroy(host string, svcs []april.Service, token string) error {
return err
}
defer resp.Body.Close()

if resp.StatusCode == 500 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return errors.New("Fail to destroy services or read response body")
return errors.New("Fail to destroy services or read response body")
}
resMsg := destroyer.ResponseMessage{}
json.Unmarshal(body, &resMsg)
Expand Down
8 changes: 4 additions & 4 deletions internal/chaoshost/chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package chaoshost

import (
"github.com/barbosaigor/april"
"github.com/barbosaigor/april/util"
"github.com/barbosaigor/april/destroyer/request"
"github.com/barbosaigor/april/util"
)

type ChaosHost struct {
Host string
Host string
Token string
}

Expand All @@ -27,7 +27,7 @@ func (ch ChaosHost) PickAndShutdownInstances(conf *april.ConfData, n uint32) ([]
svs := make([]april.Service, len(services))
for i, svcName := range services {
svs[i].Name = svcName
svs[i].Selector = conf.Services[svcName].Selector;
svs[i].Selector = conf.Services[svcName].Selector
}
if err = request.ReqToDestroy(ch.Host, svs, ch.Token); err != nil {
return nil, err
Expand All @@ -41,4 +41,4 @@ func (ch ChaosHost) PickAndShutdownInstancesFile(filePath string, n uint32) ([]s
return nil, err
}
return ch.PickAndShutdownInstances(conf, n)
}
}
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func chaosHandler(w http.ResponseWriter, r *http.Request) {
svs := make([]april.Service, len(services))
for i, s := range services {
svs[i].Name = s
svs[i].Selector = conf.Services[s].Selector;
svs[i].Selector = conf.Services[s].Selector
}
err = request.ReqToDestroy(destroyerHost, svs, token)
if err == request.ErrUnauthorized {
Expand Down
2 changes: 1 addition & 1 deletion util/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func ReadFile(fpath string) ([]byte, error) {
return nil, err
}
return fdata, nil
}
}

0 comments on commit b943d18

Please sign in to comment.