Add protogetter
linter and fix warnings #267
3 changed files with 19 additions and 6 deletions
|
@ -63,5 +63,6 @@ linters:
|
||||||
- funlen
|
- funlen
|
||||||
- gocognit
|
- gocognit
|
||||||
- contextcheck
|
- contextcheck
|
||||||
|
- protogetter
|
||||||
disable-all: true
|
disable-all: true
|
||||||
fast: false
|
fast: false
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -77,3 +77,15 @@ help:
|
||||||
@echo ' Targets:'
|
@echo ' Targets:'
|
||||||
@echo ''
|
@echo ''
|
||||||
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u
|
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u
|
||||||
|
|
||||||
|
# Activate pre-commit hooks
|
||||||
|
pre-commit:
|
||||||
|
pre-commit install --hook-type pre-commit
|
||||||
|
|
||||||
|
# Deactivate pre-commit hooks
|
||||||
|
unpre-commit:
|
||||||
|
pre-commit uninstall --hook-type pre-commit
|
||||||
|
|
||||||
|
# Run pre-commit hooks
|
||||||
|
pre-commit-run:
|
||||||
|
@pre-commit run --all-files --hook-stage manual
|
||||||
|
|
|
@ -360,7 +360,7 @@ func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*grpcService
|
||||||
// Empty result is expected due to delayed tree service sync.
|
// Empty result is expected due to delayed tree service sync.
|
||||||
// Return an error there to trigger retry and ignore it after,
|
// Return an error there to trigger retry and ignore it after,
|
||||||
// to keep compatibility with 'GetNodeByPath' implementation.
|
// to keep compatibility with 'GetNodeByPath' implementation.
|
||||||
if inErr == nil && len(resp.Body.Nodes) == 0 {
|
if inErr == nil && len(resp.GetBody().GetNodes()) == 0 {
|
||||||
return errNodeEmptyResult
|
return errNodeEmptyResult
|
||||||
}
|
}
|
||||||
return handleError("failed to get node by path", inErr)
|
return handleError("failed to get node by path", inErr)
|
||||||
|
@ -389,7 +389,7 @@ func (x *SubTreeReader) Read(buf []*grpcService.GetSubTreeResponse_Body) (int, e
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return i, handleError("failed to get sub tree", err)
|
return i, handleError("failed to get sub tree", err)
|
||||||
}
|
}
|
||||||
buf[i] = resp.Body
|
buf[i] = resp.GetBody()
|
||||||
}
|
}
|
||||||
|
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
|
@ -405,7 +405,7 @@ func (x *SubTreeReader) ReadAll() ([]*grpcService.GetSubTreeResponse_Body, error
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return nil, handleError("failed to get sub tree", err)
|
return nil, handleError("failed to get sub tree", err)
|
||||||
}
|
}
|
||||||
res = append(res, resp.Body)
|
res = append(res, resp.GetBody())
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
|
@ -421,7 +421,7 @@ func (x *SubTreeReader) Next() (*grpcService.GetSubTreeResponse_Body, error) {
|
||||||
return nil, handleError("failed to get sub tree", err)
|
return nil, handleError("failed to get sub tree", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.Body, nil
|
return resp.GetBody(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSubTree invokes eponymous method from TreeServiceClient.
|
// GetSubTree invokes eponymous method from TreeServiceClient.
|
||||||
|
@ -535,12 +535,12 @@ func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint
|
||||||
body := resp.GetBody()
|
body := resp.GetBody()
|
||||||
if body == nil {
|
if body == nil {
|
||||||
return 0, errors.New("nil body in tree service response")
|
return 0, errors.New("nil body in tree service response")
|
||||||
} else if len(body.Nodes) == 0 {
|
} else if len(body.GetNodes()) == 0 {
|
||||||
return 0, errors.New("empty list of added nodes in tree service response")
|
return 0, errors.New("empty list of added nodes in tree service response")
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first node is the leaf that we add, according to tree service docs.
|
// The first node is the leaf that we add, according to tree service docs.
|
||||||
return body.Nodes[0], nil
|
return body.GetNodes()[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveNode invokes eponymous method from TreeServiceClient.
|
// MoveNode invokes eponymous method from TreeServiceClient.
|
||||||
|
|
Loading…
Add table
Reference in a new issue