How to convert a byte slice ([]byte) to a string in Go?
Hello everyone! I just started learning Go and encountered a problem when working with SHA-1 hashing. I have a function that computes a SHA-1 hash from a string and returns it as a byte slice ([]byte). I need to display this hash on the screen, but the fmt.Println function outputs some incomprehensible characters instead of a readable string.
Here is my code:
```go
package main
import (
"crypto/sha1"
"fmt"
)
func main() {
data := []byte("Hello, Go!")
hash := sha1.Sum(data)
fmt.Println(hash) // Outputs something like [191 142 67 219...]
}
```
I tried using string(hash), but that also doesn't give the expected result — it outputs an even stranger set of characters. How do I correctly convert a byte slice to a string? Do I need to use some special functions from the package en