Skip to content

Commit

Permalink
🚨 fix deepsource issues
Browse files Browse the repository at this point in the history
Signed-off-by: Rintaro Okamura <[email protected]>
  • Loading branch information
rinx committed Jul 9, 2020
1 parent 587b8ab commit ca58ce7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions internal/net/http/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ func ErrorHandler(w http.ResponseWriter, r *http.Request,
}

// Request sends http json request.
func Request(ctx context.Context, method string, url string, payloyd interface{}, data interface{}) error {
func Request(ctx context.Context, method, url string, payload, data interface{}) error {
req, err := http.NewRequestWithContext(ctx, method, url, nil)
if err != nil {
return err
}

if payloyd != nil && method != http.MethodGet {
if err := EncodeRequest(req, payloyd, rest.ApplicationJSON, rest.CharsetUTF8); err != nil {
if payload != nil && method != http.MethodGet {
if err := EncodeRequest(req, payload, rest.ApplicationJSON, rest.CharsetUTF8); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (n *ngt) initNGT(opts ...core.Option) (err error) {
}))

eg.Go(safety.RecoverFunc(func() (err error) {
if len(n.path) != 0 && !n.inMem {
if n.path != "" && !n.inMem {
gob.Register(map[string]uint32{})
f, err := file.Open(
filepath.Join(n.path, kvsFileName),
Expand Down Expand Up @@ -653,7 +653,7 @@ func (n *ngt) saveIndex(ctx context.Context) (err error) {
eg, ctx := errgroup.New(ctx)

eg.Go(safety.RecoverFunc(func() error {
if len(n.path) != 0 {
if n.path != "" {
m := make(map[string]uint32, n.kvs.Len())
var mu sync.Mutex
n.kvs.Range(ctx, func(key string, id uint32) bool {
Expand Down

0 comments on commit ca58ce7

Please sign in to comment.