How to declare a constant array (slice) in Go?
Hello everyone! I just started learning Go, and I ran into a problem declaring arrays as constants. In other languages (e.g., C++ or Java), I'm used to writing something like `const int arr[] = {1, 2, 3};`, and it works. But when I try to do the same in Go, the compiler gives an error.
Here's what I'm trying:
```go
const arr = [3]int{1, 2, 3}
```
The compiler complains: `const initializer [3]int literal is not a constant`. I understand that Go is stricter about constants, but I need an immutable list of values that will be accessible throughout the package. How do I do this correctly?
I've tried different options: using `var` instead of `const`, but then the array can be accidentally modified. I tried making a constant slice — `const slice = []int{1, 2, 3}` — but that doesn't work either.