Skip to content

Commit 7d59d22

Browse files
skrdgraphall-seeing-code
authored andcommitted
fix(linter): address gosimple linter reports & errors (#8628)
GoLinter failures: - related to #8620 & https://github.com/dgraph-io/dgraph/actions/runs/3971511349/jobs/6815792372 - Addressing this partially #8572 (comment) - fix `gosimple` & `unused` linter reports - comment the rest to address later
1 parent 02112ac commit 7d59d22

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

.golangci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ linters-settings:
1919
linters:
2020
disable-all: true
2121
enable:
22-
- errcheck
23-
- ineffassign
24-
- gas
22+
#- errcheck
23+
#- ineffassign
24+
#- gas
2525
- gofmt
26-
- golint
26+
#- golint
2727
- gosimple
2828
- govet
2929
- lll

dgraph/cmd/bulk/loader.go

-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ func (ld *loader) processGqlSchema(loadType chunker.InputFormat) {
404404
}
405405
process(ld.opt.Namespace, schemas[ld.opt.Namespace])
406406
}
407-
return
408407
}
409408

410409
func (ld *loader) reduceStage() {

dgraph/cmd/bulk/schema.go

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func (s *schemaStore) checkAndSetInitialSchema(namespace uint64) {
110110
}
111111
}
112112
s.namespaces.Store(namespace, struct{}{})
113-
return
114113
}
115114

116115
func (s *schemaStore) validateType(de *pb.DirectedEdge, objectIsUID bool) {

query/outputnode.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ func (enc *encoder) setCustom(fj fastJsonNode) {
365365
fj.meta |= customBit
366366
}
367367

368+
//nolint:unused // appendAttrs is used in outputnode_test.go as a helper function
368369
func (enc *encoder) appendAttrs(fj, child fastJsonNode) {
369370
enc.addChildren(fj, child)
370371
}
@@ -907,7 +908,7 @@ func (enc *encoder) normalize(fj fastJsonNode) ([]fastJsonNode, error) {
907908
var shead, curScalar fastJsonNode
908909
chead = enc.children(fj)
909910
for chead != nil {
910-
if enc.children(chead) != nil && enc.getFacetsParent(chead) == false {
911+
if enc.children(chead) != nil && !enc.getFacetsParent(chead) {
911912
chead = chead.next
912913
continue
913914
}

query/query.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -2187,9 +2187,7 @@ func ProcessGraph(ctx context.Context, sg, parent *SubGraph, rch chan error) {
21872187
// we end up modifying the first list from the uidMatrix which ends up modifying the srcUids of the next level.
21882188
// So to avoid that we make a copy.
21892189
newDestUIDList := &pb.List{Uids: make([]uint64, 0, len(sg.DestUIDs.Uids))}
2190-
for _, uid := range sg.DestUIDs.GetUids() {
2191-
newDestUIDList.Uids = append(newDestUIDList.Uids, uid)
2192-
}
2190+
newDestUIDList.Uids = append(newDestUIDList.Uids, sg.DestUIDs.GetUids()...)
21932191
sg.uidMatrix = []*pb.List{newDestUIDList}
21942192
} else {
21952193
sg.uidMatrix = []*pb.List{sg.DestUIDs}

upgrade/upgrade.go

-4
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,6 @@ func formatAsFlagParsingError(flag string, err error) error {
214214
return fmt.Errorf("error parsing flag `%s`: %w", flag, err)
215215
}
216216

217-
func formatAsFlagRequiredError(flag string) error {
218-
return formatAsFlagParsingError(flag, fmt.Errorf("`%s` is required", flag))
219-
}
220-
221217
// parseVersionFromString parses a version given as string to internal representation.
222218
// Some examples for input and output:
223219
// 1. input : v1.2.2

0 commit comments

Comments
 (0)