I am using Goland for golang code and the convert check seems working with a bug while I transfer a "string" type to a "[]byte" type.
It can be complied correctly with a expecting result, but the tip still shows in the editor. Maybe there is something wrong in my setting? Anyone can help me?
package main
import (
"crypto/sha1"
"encoding/hex"
"fmt"
)
func Sha1(data string) string {
encrypts := sha1.New()
encrypts.Write([]byte(data)) // Cannot convert expression of type string to type []byte
return hex.EncodeToString(encrypts.Sum([]byte("")))
}
func main() {
fmt.Println(Sha1("123456"))
}