Go 编译报错: ".\temp.go:20:13: assignment mismatch: 2 variables but 1 value" 和 ".\temp.go:35:8: cannot use util.D(buf, key, nonce) (value of type []byte) as type string in assignment"
在第 20 行,变量 'sDec' 被赋值为字符串 'ddm',但 'sDec' 是一个字符串类型,而 'ddm' 是一个未声明的变量,编译器无法识别它的类型。
在第 35 行,'util.D(buf, key, nonce)' 返回一个类型为 '[]byte' 的值,但它被赋值给一个类型为 'string' 的变量,因此编译器会报错。要解决这个问题,可以使用 'string()' 函数将 '[]byte' 类型转换为 'string' 类型,或者将变量的类型改为 '[]byte'。
原文地址: https://www.cveoy.top/t/topic/lU0a 著作权归作者所有。请勿转载和采集!