Skip to content

Commit 808b2dd

Browse files
committed
chore: apply go vet improvements
1 parent 75b6f09 commit 808b2dd

25 files changed

+163
-791
lines changed

algo/packed_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ func TestMergeSorted1Packed(t *testing.T) {
4242
require.Equal(t, []uint64{55}, codec.Decode(MergeSortedPacked(input), 0))
4343
}
4444

45-
func printPack(t *testing.T, pack *pb.UidPack) {
46-
for _, block := range pack.Blocks {
47-
t.Logf("[%x]Block base: %d. Num uids: %d. Deltas: %x\n",
48-
pack.AllocRef, block.Base, block.NumUids, block.Deltas)
49-
}
50-
}
51-
5245
func TestMergeSorted2Packed(t *testing.T) {
5346
input := []*pb.UidPack{
5447
newUidPack([]uint64{1, 3, 6, 8, 10}),

compose/compose.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func getZero(idx int, raft string) service {
245245
svc.Command += fmt.Sprintf(" --vmodule=%s", opts.Vmodule)
246246
}
247247
if idx == 1 {
248-
svc.Command += fmt.Sprintf(" --bindall")
248+
svc.Command += " --bindall"
249249
} else {
250250
svc.Command += fmt.Sprintf(" --peer=%s:%d", name(basename, 1), basePort)
251251
}
@@ -734,9 +734,9 @@ func main() {
734734

735735
doc := fmt.Sprintf("# Auto-generated with: %v\n#\n", os.Args)
736736
if opts.UserOwnership {
737-
doc += fmt.Sprint("# NOTE: Env var UID must be exported by the shell\n#\n")
737+
doc += "# NOTE: Env var UID must be exported by the shell\n#\n"
738738
}
739-
doc += fmt.Sprintf("%s", yml)
739+
doc += string(yml)
740740
if opts.OutFile == "-" {
741741
x.Check2(fmt.Printf("%s", doc))
742742
} else {

contrib/integration/mutates/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func testInsert3Quads(ctx context.Context, c *dgo.Dgraph) {
107107

108108
func testQuery3Quads(ctx context.Context, c *dgo.Dgraph) {
109109
txn := c.NewTxn()
110-
q := fmt.Sprint(`{ me(func: uid(200, 300, 400)) { name }}`)
110+
q := `{ me(func: uid(200, 300, 400)) { name }}`
111111
resp, err := txn.Query(ctx, q)
112112
if err != nil {
113113
log.Fatalf("Error while running query: %v\n", err)

contrib/teamcity/README.md

-15
This file was deleted.

contrib/teamcity/test_stats.go

-262
This file was deleted.

dgraph/cmd/zero/oracle.go

-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ import (
3434
"github.com/dgraph-io/ristretto/z"
3535
)
3636

37-
type syncMark struct {
38-
index uint64
39-
ts uint64
40-
}
41-
4237
// Oracle stores and manages the transaction state and conflict detection.
4338
type Oracle struct {
4439
x.SafeMutex

dgraph/cmd/zero/tablet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (s *Server) MoveTablet(ctx context.Context, req *pb.MoveTabletRequest) (*pb
9191
}
9292
if !isKnown {
9393
return &pb.Status{Code: 1, Msg: x.ErrorInvalidRequest},
94-
fmt.Errorf("Group: [%d] is not a known group.", req.DstGroup)
94+
fmt.Errorf("group: [%d] is not a known group", req.DstGroup)
9595
}
9696

9797
tablet := x.NamespaceAttr(req.Namespace, req.Tablet)

dgraph/cmd/zero/zero_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestIdBump(t *testing.T) {
7171
bumpTo := res.GetEndId() + 100000
7272

7373
// Bump the lease to (last result + 100000).
74-
res, err = zc.AssignIds(ctx, &pb.Num{Val: bumpTo, Type: pb.Num_UID, Bump: true})
74+
_, err = zc.AssignIds(ctx, &pb.Num{Val: bumpTo, Type: pb.Num_UID, Bump: true})
7575
require.NoError(t, err)
7676

7777
// Next assignemnt's startId should be greater than bumpTo.
@@ -81,6 +81,6 @@ func TestIdBump(t *testing.T) {
8181
require.Equal(t, uint64(10), res.GetEndId()-res.GetStartId()+1)
8282

8383
// If bump request is less than maxLease, then it should result in no-op.
84-
res, err = zc.AssignIds(ctx, &pb.Num{Val: 10, Type: pb.Num_UID, Bump: true})
84+
_, err = zc.AssignIds(ctx, &pb.Num{Val: 10, Type: pb.Num_UID, Bump: true})
8585
require.Contains(t, err.Error(), "Nothing to be leased")
8686
}

edgraph/server.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"github.com/pkg/errors"
3838
ostats "go.opencensus.io/stats"
3939
"go.opencensus.io/tag"
40-
"go.opencensus.io/trace"
4140
otrace "go.opencensus.io/trace"
4241
"google.golang.org/grpc"
4342
"google.golang.org/grpc/codes"
@@ -255,8 +254,9 @@ func validateAlterOperation(ctx context.Context, op *api.Operation) error {
255254

256255
// parseSchemaFromAlterOperation parses the string schema given in input operation to a Go
257256
// struct, and performs some checks to make sure that the schema is valid.
258-
func parseSchemaFromAlterOperation(ctx context.Context, op *api.Operation) (*schema.ParsedSchema,
259-
error) {
257+
func parseSchemaFromAlterOperation(ctx context.Context, op *api.Operation) (
258+
*schema.ParsedSchema, error) {
259+
260260
// If a background task is already running, we should reject all the new alter requests.
261261
if schema.State().IndexingInProgress() {
262262
return nil, errIndexingInProgress
@@ -980,7 +980,7 @@ type queryContext struct {
980980
// l stores latency numbers
981981
latency *query.Latency
982982
// span stores a opencensus span used throughout the query processing
983-
span *trace.Span
983+
span *otrace.Span
984984
// graphql indicates whether the given request is from graphql admin or not.
985985
graphql bool
986986
// gqlField stores the GraphQL field for which the query is being processed.
@@ -1228,7 +1228,7 @@ func (s *Server) doQuery(ctx context.Context, req *Request) (resp *api.Response,
12281228
return nil, errors.Errorf("empty request")
12291229
}
12301230

1231-
span.AddAttributes(trace.StringAttribute("Query", req.req.Query))
1231+
span.AddAttributes(otrace.StringAttribute("Query", req.req.Query))
12321232
span.Annotatef(nil, "Request received: %v", req.req)
12331233
if isQuery {
12341234
ostats.Record(ctx, x.PendingQueries.M(1), x.NumQueries.M(1))

0 commit comments

Comments
 (0)