if-else
块有自己的范围。在您的情况下dat
,它们在外部不可见。
您可以var dat []byte
在if (bundled == "true")
修复前声明。
文件:https://golang.org/ref/spec#Declarations_and_scope
您可能还需要阅读:Go中的声明范围
if / else条件定义变量。未定义:dat(变量)
if-else
块有自己的范围。在您的情况下dat
,它们在外部不可见。
您可以var dat []byte
在if (bundled == "true")
修复前声明。
文件:https://golang.org/ref/spec#Declarations_and_scope
您可能还需要阅读:Go中的声明范围