可以使用内置的类型转换函数将 int 类型转换为 float32 类型: varintValue int = 123 var floatValue float32 = float32(intValue)