我有两段代码,其中一幅有效,而另一幅则无效。您能告诉我这两者之间的区别吗?
此代码有效:
targetHash := md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", ra.User, ra.Realm, password)))
xhash := hex.EncodeToString(targetHash[:])
此代码无效:
targetHash := hex.EncodeToString(md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", ra.User, ra.Realm, password)))[:])
错误是:slice of unaddressable value