Skip to content

Commit 16440d8

Browse files
author
Abhijeet V
committed
fix lint errors
1 parent 158206c commit 16440d8

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

args.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ type ConverterGenFunc func(Value) (*Func, error)
187187
// If the function returns a nil Func, then no converter is generated.
188188
func ConverterGen(fs ...ConverterGenFunc) Arg {
189189
return func(a *argBuilder) error {
190-
for _, f := range fs {
191-
a.convGens = append(a.convGens, f)
192-
}
190+
a.convGens = append(a.convGens, fs...)
193191
return nil
194192
}
195193
}

call.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ func (f *Func) callGraph(args *argBuilder) (
225225
include := true
226226
if args.filterInput != nil && !args.filterInput(value) {
227227
log.Trace("excluding input due to failed filter", "value", value)
228-
include = false
229228
continue
230229
}
231230

@@ -255,7 +254,7 @@ func (f *Func) callGraph(args *argBuilder) (
255254
// other zero index topo sort value.
256255
graph.VertexID(vertexRoot): struct{}{},
257256
}
258-
g.Reverse().DFS(vertexRoot, func(v graph.Vertex, next func() error) error {
257+
_ = g.Reverse().DFS(vertexRoot, func(v graph.Vertex, next func() error) error {
259258
visited[graph.VertexID(v)] = struct{}{}
260259

261260
if v == vertexF {
@@ -577,6 +576,7 @@ func (f *Func) callDirect(log hclog.Logger, argMap map[interface{}]reflect.Value
577576
// This should never happen because we catch unsatisfied errors
578577
// earlier in the process. Because of this, we output a message
579578
// that there is a bug.
579+
//nolint:staticcheck // ST1005 Consumers maybe relying on the error message.
580580
buildErr = multierror.Append(buildErr, fmt.Errorf(
581581
"argument cannot be satisfied: %s. This is a bug in "+
582582
"the go-argmapper library since this shouldn't happen at this "+

func_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,7 @@ func TestBuildFunc_errValue(t *testing.T) {
14141414
f, err = BuildFunc(input, f.Output(), func(in, out *ValueSet) error {
14151415
return fmt.Errorf("some error")
14161416
})
1417+
require.NoError(err)
14171418

14181419
require.EqualError(f.Output().FromResult(f.Call(Named("a", 12))), "some error")
14191420
}

graph.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
const (
1414
// weightNormal is the typcal edge weight.
15+
//nolint:unused
1516
weightNormal = 1
1617

1718
// weightTyped is the weight to use for edges that connected to any

internal/graph/dijkstra.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func (g *Graph) Dijkstra(src Vertex) (distTo map[interface{}]int, edgeTo map[int
2121
*/
2222
queue := make(distQueue, 0, len(g.hash))
2323
queueItem := map[interface{}]*distQueueItem{}
24-
for k, _ := range g.hash {
24+
for k := range g.hash {
2525
item := &distQueueItem{
2626
v: k,
2727
distance: math.MaxInt32,

internal/graph/vertex.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func VertexID(v Vertex) interface{} {
2424
func VertexName(v Vertex) string {
2525
switch v := v.(type) {
2626
case fmt.Stringer:
27-
return fmt.Sprintf("%s", v)
27+
return v.String()
2828
default:
2929
return fmt.Sprintf("%v", v)
3030
}

0 commit comments

Comments
 (0)