Skip to content

Commit

Permalink
Merge pull request #149 from jabley/feature/fix-go-typo
Browse files Browse the repository at this point in the history
Fix typo in Go code
  • Loading branch information
jgonggrijp committed Oct 31, 2023
2 parents 59be9b2 + d6790d0 commit 982aa9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions specs/~lambdas.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"python": "lambda: \"world\"",
"clojure": "(fn [] \"world\")",
"lisp": "(lambda () \"world\")",
"pwsh": "\"world\""
"pwsh": "\"world\"",
"go": "func() string { return \"world\" }"
}
},
"template": "Hello, {{lambda}}!",
Expand All @@ -37,7 +38,8 @@
"python": "lambda: \"{{planet}}\"",
"clojure": "(fn [] \"{{planet}}\")",
"lisp": "(lambda () \"{{planet}}\")",
"pwsh": "\"{{planet}}\""
"pwsh": "\"{{planet}}\"",
"go": "func() string { return \"{{planet}}\" }"
}
},
"template": "Hello, {{lambda}}!",
Expand All @@ -58,7 +60,8 @@
"python": "lambda: \"|planet| => {{planet}}\"",
"clojure": "(fn [] \"|planet| => {{planet}}\")",
"lisp": "(lambda () \"|planet| => {{planet}}\")",
"pwsh": "\"|planet| => {{planet}}\""
"pwsh": "\"|planet| => {{planet}}\"",
"go": "func() string { return \"|planet| => {{planet}}\" }"
}
},
"template": "{{= | | =}}\nHello, (|&lambda|)!",
Expand All @@ -78,7 +81,8 @@
"python": "lambda: globals().update(calls=globals().get(\"calls\",0)+1) or calls",
"clojure": "(def g (atom 0)) (fn [] (swap! g inc))",
"lisp": "(let ((g 0)) (lambda () (incf g)))",
"pwsh": "if (($null -eq $script:calls) -or ($script:calls -ge 3)){$script:calls=0}; ++$script:calls; $script:calls"
"pwsh": "if (($null -eq $script:calls) -or ($script:calls -ge 3)){$script:calls=0}; ++$script:calls; $script:calls",
"go": "func() func() int { g := 0; return func() int { g++; return g } }()"
}
},
"template": "{{lambda}} == {{{lambda}}} == {{lambda}}",
Expand All @@ -98,7 +102,8 @@
"python": "lambda: \">\"",
"clojure": "(fn [] \">\")",
"lisp": "(lambda () \">\")",
"pwsh": "\">\""
"pwsh": "\">\"",
"go": "func() string { return \">\" }"
}
},
"template": "<{{lambda}}{{{lambda}}}",
Expand All @@ -119,7 +124,8 @@
"python": "lambda text: text == \"{{x}}\" and \"yes\" or \"no\"",
"clojure": "(fn [text] (if (= text \"{{x}}\") \"yes\" \"no\"))",
"lisp": "(lambda (text) (if (string= text \"{{x}}\") \"yes\" \"no\"))",
"pwsh": "if ($args[0] -eq \"{{x}}\") {\"yes\"} else {\"no\"}"
"pwsh": "if ($args[0] -eq \"{{x}}\") {\"yes\"} else {\"no\"}",
"go": "func(text string) string { if text == \"{{x}}\" { return \"yes\" } else { return \"no\" } }"
}
},
"template": "<{{#lambda}}{{x}}{{/lambda}}>",
Expand All @@ -140,7 +146,8 @@
"python": "lambda text: \"%s{{planet}}%s\" % (text, text)",
"clojure": "(fn [text] (str text \"{{planet}}\" text))",
"lisp": "(lambda (text) (format nil \"~a{{planet}}~a\" text text))",
"pwsh": "\"$($args[0]){{planet}}$($args[0])\""
"pwsh": "\"$($args[0]){{planet}}$($args[0])\"",
"go": "func(text string) string { return text + \"{{planet}}\" + text }"
}
},
"template": "<{{#lambda}}-{{/lambda}}>",
Expand All @@ -161,7 +168,8 @@
"python": "lambda text: \"%s{{planet}} => |planet|%s\" % (text, text)",
"clojure": "(fn [text] (str text \"{{planet}} => |planet|\" text))",
"lisp": "(lambda (text) (format nil \"~a{{planet}} => |planet|~a\" text text))",
"pwsh": "\"$($args[0]){{planet}} => |planet|$($args[0])\""
"pwsh": "\"$($args[0]){{planet}} => |planet|$($args[0])\"",
"go": "func(text string) string { return text + \"{{planet}} => |planet|\" + text }"
}
},
"template": "{{= | | =}}<|#lambda|-|/lambda|>",
Expand All @@ -181,7 +189,8 @@
"python": "lambda text: \"__%s__\" % (text)",
"clojure": "(fn [text] (str \"__\" text \"__\"))",
"lisp": "(lambda (text) (format nil \"__~a__\" text))",
"pwsh": "\"__$($args[0])__\""
"pwsh": "\"__$($args[0])__\"",
"go": "func(text string) string { return \"__\" + text + \"__\" }"
}
},
"template": "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}",
Expand All @@ -202,7 +211,8 @@
"python": "lambda text: 0",
"clojure": "(fn [text] false)",
"lisp": "(lambda (text) (declare (ignore text)) nil)",
"pwsh": "$false"
"pwsh": "$false",
"go": "func(text string) bool { return false }"
}
},
"template": "<{{^lambda}}{{static}}{{/lambda}}>",
Expand Down
2 changes: 1 addition & 1 deletion specs/~lambdas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ tests:
clojure: '(fn [text] (if (= text "{{x}}") "yes" "no"))'
lisp: '(lambda (text) (if (string= text "{{x}}") "yes" "no"))'
pwsh: 'if ($args[0] -eq "{{x}}") {"yes"} else {"no"}'
go: 'func(text string) string { if text == "{{x}}" { return "yes" } return "no" }'
go: 'func(text string) string { if text == "{{x}}" { return "yes" } else { return "no" } }'
template: "<{{#lambda}}{{x}}{{/lambda}}>"
expected: "<yes>"

Expand Down

0 comments on commit 982aa9b

Please sign in to comment.