go Arrays in Golang are value types.

package main

import (
    "fmt"
)

func main() {
    arr1 := [3]int{1, 2, 3}
    arr2 := arr1

    arr2[0] = 5

    fmt.Println("arr1:", arr1) // Output: arr1: [1 2 3]
    fmt.Println("arr2:", arr2) // Output: arr2: [5 2 3]
}
  1. Import the necessary package, in this case, "fmt".
  2. Define a main function as the entry point of the program.
  3. Create an array arr1 of type int with a length of 3 and initialize it with values 1, 2, and 3.
  4. Create another array arr2 and assign the value of arr1 to it.
  5. Modify the first element of arr2 to 5.
  6. Print the contents of arr1 and arr2 using fmt.Println.