golang 编译错误 : undefined: bytes in bytes. 缓冲区

标签 go

我定义了一个结构如下,但总是得到构建错误:“undefined: bytes in bytes.Buffer”

type test struct {
    id       int64
    Content    []byte
    Buffer     *bytes.Buffer
}

最佳答案

你忘记了 import 语句。

import "bytes"

关于golang 编译错误 : undefined: bytes in bytes. 缓冲区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42391898/

相关文章:

go - 与具有 interface{} 参数的方法的接口(interface)不起作用

go - 一个 Go 程序默认启动了多少个 goroutine?

go - 股票代码仍然存在于内存中

mongodb - SORT在聚合功能中不起作用

google-app-engine - GAE Go - 如何将私有(private)变量放入数据存储区?

go - 无法在浏览器中设置 cookie 但与 postman 一起工作

pointers - 隐藏 nil 值,理解为什么 Go 在这里失败

go - Memcached Ping()在无效服务器上未返回错误

unit-testing - 单元测试 os.File.Write 调用

go - 在 bluemix 上使用社区 golang buildpack 时出现编译错误