[#190] sdk-go: Gofumpt fixes

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-21 12:57:35 +03:00
parent 157a9930e8
commit 56debcfa56
10 changed files with 17 additions and 18 deletions

View file

@ -33,7 +33,8 @@ func TestErrors(t *testing.T) {
{
check: client.IsErrSessionExpired,
err: new(apistatus.SessionTokenExpired),
}, {
},
{
check: client.IsErrSessionNotFound,
err: new(apistatus.SessionTokenNotFound),
},

View file

@ -186,8 +186,7 @@ func (c *Client) NetworkInfo(ctx context.Context, prm PrmNetworkInfo) (*ResNetwo
}
// PrmNetMapSnapshot groups parameters of NetMapSnapshot operation.
type PrmNetMapSnapshot struct {
}
type PrmNetMapSnapshot struct{}
// ResNetMapSnapshot groups resulting values of NetMapSnapshot operation.
type ResNetMapSnapshot struct {

View file

@ -355,7 +355,7 @@ func (x Container) IterateAttributes(f func(key, val string)) {
func (x Container) IterateUserAttributes(f func(key, val string)) {
attrs := x.v2.GetAttributes()
for _, attr := range attrs {
var key = attr.GetKey()
key := attr.GetKey()
if !strings.HasPrefix(key, container.SysAttributePrefix) &&
!strings.HasPrefix(key, container.SysAttributePrefixNeoFS) {
f(key, attr.GetValue())

View file

@ -7,8 +7,7 @@ import (
// Validator is a tool that calculates
// the action on a request according
// to the extended ACL rule table.
type Validator struct {
}
type Validator struct{}
// NewValidator creates and initializes a new Validator using options.
func NewValidator() *Validator {

View file

@ -53,7 +53,6 @@ func BenchmarkNetmap_ContainerNodes(b *testing.B) {
b.Fatal(err)
}
}
})
}
}

View file

@ -31,7 +31,7 @@ func TestPlacementPolicyEncoding(t *testing.T) {
}
func TestPlacementPolicyWriteString(t *testing.T) {
var testCases = []struct {
testCases := []struct {
name string
input string
output string // If the output is empty, make it equal to input.

View file

@ -99,10 +99,12 @@ func BenchmarkPolicyHRWType(b *testing.B) {
p := newPlacementPolicy(1,
[]ReplicaDescriptor{
newReplica(1, "loc1"),
newReplica(1, "loc2")},
newReplica(1, "loc2"),
},
[]Selector{
newSelector("loc1", "Location", 1, "loc1", (*Selector).SelectSame),
newSelector("loc2", "Location", 1, "loc2", (*Selector).SelectSame)},
newSelector("loc2", "Location", 1, "loc2", (*Selector).SelectSame),
},
[]Filter{
newFilter("loc1", "Location", "Shanghai", netmap.EQ),
newFilter("loc2", "Location", "Shanghai", netmap.NE),
@ -144,10 +146,12 @@ func TestPlacementPolicy_DeterministicOrder(t *testing.T) {
p := newPlacementPolicy(1,
[]ReplicaDescriptor{
newReplica(1, "loc1"),
newReplica(1, "loc2")},
newReplica(1, "loc2"),
},
[]Selector{
newSelector("loc1", "Location", 1, "loc1", (*Selector).SelectSame),
newSelector("loc2", "Location", 1, "loc2", (*Selector).SelectSame)},
newSelector("loc2", "Location", 1, "loc2", (*Selector).SelectSame),
},
[]Filter{
newFilter("loc1", "Location", "Shanghai", netmap.EQ),
newFilter("loc2", "Location", "Shanghai", netmap.NE),

View file

@ -36,7 +36,7 @@ func TestChannelTarget(t *testing.T) {
actualIDs := writeObject(t, ctx, chTarget, hdr, payload)
_ = expectedIDs
_ = actualIDs
//require.Equal(t, expectedIDs, actualIDs)
// require.Equal(t, expectedIDs, actualIDs)
for i := range tt.objects {
select {

View file

@ -23,10 +23,8 @@ type treeClient struct {
healthy bool
}
var (
// ErrUnhealthyEndpoint is returned when client in the pool considered unavailable.
ErrUnhealthyEndpoint = errors.New("unhealthy endpoint")
)
// ErrUnhealthyEndpoint is returned when client in the pool considered unavailable.
var ErrUnhealthyEndpoint = errors.New("unhealthy endpoint")
// newTreeClient creates new tree client with auto dial.
func newTreeClient(addr string, opts ...grpc.DialOption) *treeClient {

View file

@ -211,7 +211,6 @@ func TestRetry(t *testing.T) {
checkIndicesAndReset(t, p, 0, 2)
p.maxRequestAttempts = oldVal
})
}
func TestRebalance(t *testing.T) {