strconv.Itoa
is shorthand for FormatInt(int64(i), 10)
:
FormatInt returns the string representation of i in the given base,
for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z'
for digit values >= 10.
so the result of strconv.Itoa(i+64)
is string, and the board
is not (this is the error).
I think you are trying to do something like this working sample code (let me know if not):
package main
import "fmt"
func main() {
board := [8][8]string{}
for i := 0; i < 8; i++ { // initialize array
for j := 0; j < 8; j++ {
board[i][j] = string(i+65) + string(j+49) // int to char
fmt.Printf("%s ", board[i][j])
}
fmt.Println()
}
}
output:
A1 A2 A3 A4 A5 A6 A7 A8
B1 B2 B3 B4 B5 B6 B7 B8
C1 C2 C3 C4 C5 C6 C7 C8
D1 D2 D3 D4 D5 D6 D7 D8
E1 E2 E3 E4 E5 E6 E7 E8
F1 F2 F3 F4 F5 F6 F7 F8
G1 G2 G3 G4 G5 G6 G7 G8
H1 H2 H3 H4 H5 H6 H7 H8
if my guess is fine, you may do it this way too:
package main
import "fmt"
func main() {
board := [8][8]string{
{"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8"},
{"B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8"},
{"C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8"},
{"D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8"},
{"E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8"},
{"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8"},
{"G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8"},
{"H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8"},
}
// print the board:
for i := 0; i < 8; i++ {
fmt.Println(board[i])
}
}
output:
[A1 A2 A3 A4 A5 A6 A7 A8]
[B1 B2 B3 B4 B5 B6 B7 B8]
[C1 C2 C3 C4 C5 C6 C7 C8]
[D1 D2 D3 D4 D5 D6 D7 D8]
[E1 E2 E3 E4 E5 E6 E7 E8]
[F1 F2 F3 F4 F5 F6 F7 F8]
[G1 G2 G3 G4 G5 G6 G7 G8]
[H1 H2 H3 H4 H5 H6 H7 H8]