Fix some random linting issues

This commit is contained in:
Sameer Rahmani 2021-01-21 22:52:18 +00:00
parent 8bcf1ea566
commit fabb3cbb32
4 changed files with 5 additions and 7 deletions

View File

@ -34,7 +34,7 @@ linters-settings:
gomnd: gomnd:
settings: settings:
mnd: mnd:
checks: argument,case,condition,return checks: argument,return
govet: govet:
check-shadowing: true check-shadowing: true
maligned: maligned:
@ -100,4 +100,3 @@ run:
tests: true tests: true
skip-dirs-use-default: true skip-dirs-use-default: true
allow-parallel-runners: true allow-parallel-runners: true

View File

@ -58,7 +58,7 @@ func (b *Block) GetLocation() *ast.Location {
return ast.MakeUnknownLocation() return ast.MakeUnknownLocation()
} }
func (l *Block) Hash() uint32 { func (b *Block) Hash() uint32 {
bytes := []byte("TODO") bytes := []byte("TODO")
return hash.Of(append([]byte{byte(ast.Block)}, bytes...)) return hash.Of(append([]byte{byte(ast.Block)}, bytes...))
} }

View File

@ -78,7 +78,7 @@ func (s *Scope) GetNS(rt *Runtime) *Namespace {
} }
ns, ok := rt.GetNS(*s.ns) ns, ok := rt.GetNS(*s.ns)
if !ok { if !ok {
panic(fmt.Sprintf("A scope with the wrong namespace! '%s'", s.ns)) panic(fmt.Sprintf("A scope with the wrong namespace! '%s'", *(s.ns)))
} }
return ns return ns
} }

View File

@ -29,8 +29,7 @@ import (
// the second param should be the value of the binding // the second param should be the value of the binding
func Def(rt *Runtime, scope IScope, args *List) (IExpr, IError) { func Def(rt *Runtime, scope IScope, args *List) (IExpr, IError) {
// TODO: Add support for docstrings and meta // TODO: Add support for docstrings and meta
switch args.Count() { if args.Count() == 2 {
case 2:
name := args.First() name := args.First()
if name.GetType() != ast.Symbol { if name.GetType() != ast.Symbol {
@ -104,7 +103,7 @@ func DefMacro(rt *Runtime, scope IScope, args *List) (IExpr, IError) {
} }
// Fn defines a function inside the given scope `scope` with the given `args`. // Fn defines a function inside the given scope `scope` with the given `args`.
// `args` contains the arugment list, docstring and body of the function. // `args` contains the argument list, docstring and body of the function.
func Fn(rt *Runtime, scope IScope, args *List) (IExpr, IError) { func Fn(rt *Runtime, scope IScope, args *List) (IExpr, IError) {
if args.Count() < 2 { if args.Count() < 2 {