-
Couldn't load subscription status.
- Fork 14
Open
@ns-cweber
Description
Compiling the following program to Go produces no error handling logic:
import sys print(int(sys.argv[1]))
package main import ( "strconv" "os" "fmt" ) func main() { _int, _ := strconv.Atoi(os.Args[1]) // error handling missing fmt.Println(_int) }
When we go run foo.go "not_an_int", the program prints 0 and exists successfully. When we python3 foo.py "not_an_int", we see:
Traceback (most recent call last):
File "foo.py", line 3, in <module>
print(int(sys.argv[1]))
ValueError: invalid literal for int() with base 10: 'not_an_int'
Metadata
Metadata
Assignees
Labels
No labels