Skip to content

Commit

Permalink
partial fixes based on golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Dec 5, 2023
1 parent d31b808 commit a3dcf76
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ linters-settings:
- name: unused-parameter
gosec:
exclude-rules:
- id: G504
- G504


linters:
Expand Down
2 changes: 1 addition & 1 deletion evaldo/builtins_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func __https_s_get(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2
// Print the HTTP Status Code and Status Name
//mt.Println("HTTP Response Status:", resp.StatusCode, http.StatusText(resp.StatusCode))
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, _ := ioutil.ReadAll(resp.Body)

if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
return *env.NewString(string(body))
Expand Down
3 changes: 0 additions & 3 deletions evaldo/builtins_structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ func do_structures(ps *env.ProgramState, data env.Dict, rmap env.Dict) env.Objec
EvalBlockInj(ps, JsonToRye(val), true)
ps.Ser = ser
}

} else {
// fmt.Println("not found")
}
}
return nil
Expand Down
10 changes: 4 additions & 6 deletions evaldo/evaldo.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,12 +758,10 @@ func CallBuiltin(bi env.Builtin, ps *env.ProgramState, arg0_ env.Object, toLeft
if arg0_ != nil && !pipeSecond {
//fmt.Println("ARG0 = LEFT")
arg0 = arg0_
if !toLeft {
//fmt.Println("L TO R *** ")
//evalExprFn = EvalExpression_
} else {
//fmt.Println("TO THE *** LEFT")
}
//if !toLeft {
//fmt.Println("L TO R *** ")
//evalExprFn = EvalExpression_
// }
} else if firstVal != nil && pipeSecond {
arg0 = firstVal
} else if bi.Argsn > 0 && bi.Cur0 == nil {
Expand Down
11 changes: 5 additions & 6 deletions evaldo/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func genPrompt(shellEd *ShellEd, line string) (string, string) {
if shellEd.Mode != "" {
a := shellEd.Askfor
if len(a) > 0 {
x, a := a[0], a[1:]
x := a[0]
a = a[1:]
shellEd.Askfor = a
return "{ Rye - value of " + x + " } ", x
} else if shellEd.Return == nil {
Expand Down Expand Up @@ -87,9 +88,9 @@ func maybeDoShedCommands(line string, es *env.ProgramState, shellEd *ShellEd) {
}

func maybeDoShedCommandsBlk(line string, es *env.ProgramState, block *env.Block, shed_pause *bool) {
if block != nil {
//block.Trace("TOP")
}
//if block != nil {
//block.Trace("TOP")
//}
line1 := strings.Split(line, " ")
switch line1[0] {
case "#in":
Expand Down Expand Up @@ -265,8 +266,6 @@ func DoRyeRepl(es *env.ProgramState, showResults bool) {
}
if es.Res != nil && shellEd.Mode != "" && !shellEd.Pause && es.Res == shellEd.Return {
fmt.Println(" <- the correct value was returned")
} else {
// fmt.Println("")
}
}

Expand Down
12 changes: 5 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ func main_ryk() {
log.Fatal(err)
}
input = string(content)
} else {
// fmt.Print("no preload")
}

block, genv := loader.LoadString(input, false)
Expand Down Expand Up @@ -140,7 +138,7 @@ func main_ryk() {
if len(os.Args) >= 5 {
if os.Args[argIdx] == "--begin" {
block, genv := loader.LoadString(os.Args[argIdx+1], false)
es := env.AddToProgramState(es, block.(env.Block).Series, genv)
es = env.AddToProgramState(es, block.(env.Block).Series, genv)
evaldo.EvalBlockInj(es, es.ForcedResult, true)
es.Ser.Reset()
argIdx += 2
Expand Down Expand Up @@ -216,7 +214,7 @@ func main_ryk() {
if len(os.Args) >= argIdx+2 {
if os.Args[argIdx] == "--end" {
block, genv := loader.LoadString(os.Args[argIdx+1], false)
es := env.AddToProgramState(es, block.(env.Block).Series, genv)
es = env.AddToProgramState(es, block.(env.Block).Series, genv)
evaldo.EvalBlockInj(es, es.ForcedResult, true)
es.Ser.Reset()
}
Expand Down Expand Up @@ -298,7 +296,7 @@ func main_cgi_file(file string, sig bool) {
block, genv = loader.LoadString(content, sig)
switch val := block.(type) {
case env.Block:
es := env.AddToProgramState(es, block.(env.Block).Series, genv)
es = env.AddToProgramState(es, block.(env.Block).Series, genv)
evaldo.RegisterBuiltins(es)
contrib.RegisterBuiltins(es, &evaldo.BuiltinNames)

Expand All @@ -314,7 +312,7 @@ func main_cgi_file(file string, sig bool) {

}

func main_rye_repl(in io.Reader, out io.Writer, subc bool) {
func main_rye_repl(_ io.Reader, _ io.Writer, subc bool) {

input := " 123 " // "name: \"Rye\" version: \"0.011 alpha\""
user, _ := user.Current()
Expand Down Expand Up @@ -368,7 +366,7 @@ func main_rysh() {
//line = line[:len(line)-1]
fmt.Println()
shellEditor = false
cursorPos = len(line)
// cursorPos = len(line)
fmt.Print("YOLO")
break
}
Expand Down

0 comments on commit a3dcf76

Please sign in to comment.