将字节数组转换为十六进制格式

I am hashing passwords using Sha256.Sum256 then I'm supposed to store the hashed password on the database, but what I get instead is a byte array instead of a hex value. I cannot do ("%x", hash) because that only works on fmt

I think what you are asking is "how do I make a string of the hexadecimal representation of the byte array"

package main

import (
    "crypto/sha256"
    "fmt"
)

func main() {
    password := "abc123"
    sum := sha256.Sum256([]byte(password))
    hexstring := fmt.Sprintf("%x", sum)
    fmt.Println(hexstring)
}