Displaying IP addresses in Go using Stringer interface
Your first variant is unnecessary detailed and hard to read:


an IPv4 address consists of exactly 4 digit groups
4 is a small number, maybe it's worth to inline the for loop
the for loop treats the case k == 0 specially
the += operator for strings allocates a new string each time
the code is much longer than the description in the task "join the four numbers with dots"


Your second variant is short, easy to grasp and probably efficient enough for all practical cases.

func (ip IPAddr) String() string {
    return fmt.Sprintf("%v.%v.%v.%v", ip[0], ip[1], ip[2], ip[3])
}


You can replace the %v with %d to make it more specific, since the arguments are integer values.

The main reason for choosing this variant is readability. The format string shows at a glance how the formatted string will look like.

If you want to write the fastest possible code, you should probably allocate a byte array of size 3+1+3+1+3+1+3 and append each number and dot individually, without using a loop at all.