This is a creation in Article, where the information may have evolved or changed.
The process of converting the generated MD5 to string using Golang has the following compilation error:
Error Resolution:
It is important to note that the Func Sum (data []byte) [Size]byte] Returns the result of the array instead of the slice (slice).
The following example shows that the compiler error line is because [3]int{1,2,3} is not assigned to any variable, the compiler does not know its address, so compiling to [:] will cause an error. The workaround is to assign [3]int{1,2,3} to a variable and then slice the variable.
dill$ Go run test.go# command-line-arguments./test.go:5: -: Invalid operation [3]intliteral[:] (slice of unaddressable value)dill$ cat Test.gopackage mainimport"FMT"Func Main () {b:= [3]int{1,2,3}[:]//Compile Error//B: = [3]int{1,2,3}//Worksc: = b[:]//WorksFmt. Println (c[0])}