[Go] Convert an int64 to an int

Created on November 30, 2026

Use a type conversion such as int(value) to convert an int64 to an int. This example converts i and prints it. On a 32-bit system, check that the value fits in int if it may exceed the 32-bit range.

package main

import "fmt"

func main() {
    var i int64
    i = 1

    fmt.Println(int(i))
}
Go