Execute CopyPasta Language: Difference between revisions
Content deleted Content added
Added tentative Go solution. |
→{{header|Go}}: Improved error handling. |
||
Line 54:
func check(err error) {
if err != nil {
clipboard.WriteAll("") // clear clipboard
log.Fatal(err)
}
Line 73 ⟶ 74:
}
i++
err := clipboard.WriteAll(lines[i])
check(err)
case "CopyFile":
if i == le-1 {
Line 80 ⟶ 82:
i++
if lines[i] == "TheF*ckingCode" {
err := clipboard.WriteAll(source)
check(err)
} else {
bytes, err := ioutil.ReadFile(lines[i])
check(err)
err = clipboard.WriteAll(string(bytes))
check(err)
}
case "Duplicate":
|