Avatar ·

Maximum value for int type in Go: how to get and use it?

Hi everyone! I just started learning Go and encountered a confusing situation. I'm writing a simple program to calculate factorial, and I need to know the maximum value that the `int` type can store. In other languages (like C++ or Java), I'm used to having constants like `INT_MAX` or `Integer.MAX_VALUE`. But in Go, I can't find an equivalent.\n\nI tried doing this:\n```go\npackage main\n\nimport "fmt"\n\nfunc main() {\n var i int = 2147483647 // thought this was the max for int\n fmt.Println(i)\n i = i + 1\n fmt.Println(i) // expected an error, but got a negative number\n}\n```\nTo my surprise, the program compiled and even ran. But when overflow occurred, I got a negative value instead of a compile-time or runtime error. This confused me.\n\nQuestions:\n1. How to find