From ea666bfa6a138e58acee822d37838d581b4a749f Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Fri, 22 Jan 2021 21:27:51 +0000 Subject: [PATCH] Fix linter problems in function.go and types.go --- bootstrap/pkg/core/function.go | 5 +++-- bootstrap/pkg/core/types.go | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bootstrap/pkg/core/function.go b/bootstrap/pkg/core/function.go index e04a5fd..6de8be3 100644 --- a/bootstrap/pkg/core/function.go +++ b/bootstrap/pkg/core/function.go @@ -156,7 +156,8 @@ func MakeFunction(n Node, scope IScope, params IColl, body *Block) *Function { // MakeFnScope a new scope for the body of a function. It binds the `bindings` // to the given `values`. -func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Scope, IError) { +func MakeFnScope(rt *Runtime, parent IScope, bindings, values IColl) (*Scope, IError) { //nolint:gocyclo + // TODO: Break this function into smaller functions scope := MakeScope(rt, parent.(*Scope), nil) // TODO: Implement destructuring binds := bindings.ToSlice() @@ -193,7 +194,7 @@ func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Sco ) } - for i := 0; i < len(binds); i += 1 { + for i := 0; i < len(binds); i++ { // If an argument started with char `&` use it to represent // rest of values. // diff --git a/bootstrap/pkg/core/types.go b/bootstrap/pkg/core/types.go index cbf8f39..6c7fcfa 100644 --- a/bootstrap/pkg/core/types.go +++ b/bootstrap/pkg/core/types.go @@ -115,11 +115,11 @@ func changeExecutionScope(es []IExpr, scope IScope) { // IRepresentable. Since golangs type system is weird ( if A is an interface // that embeds interface B you []A should be usable as []B but that's not the // case in Golang), we need this convertor helper -func toRepresentables(ast IColl) []IRepresentable { +func toRepresentables(forms IColl) []IRepresentable { var params []IRepresentable - for _, x := range ast.ToSlice() { - params = append(params, x.(IRepresentable)) + for _, x := range forms.ToSlice() { + params = append(params, x) } return params @@ -162,7 +162,7 @@ func MakeNodeFromExprs(es []IExpr) *Node { // MakeNode creates a new Node in the the given `input` that points to a // range of characters starting from the `start` till the `end`. -func MakeNode(input *ast.Source, start int, end int) Node { +func MakeNode(input *ast.Source, start, end int) Node { return MakeNodeFromLocation(ast.MakeLocation(input, start, end)) }