golang with compile error: undefined: bytes in bytes.Buffer

huangapple go评论74阅读模式
英文:

golang with compile error: undefined: bytes in bytes.Buffer

问题

我定义了一个如下的结构体,但是一直得到构建错误:"undefined: bytes in bytes.Buffer"

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

I defined a struct as below, but always get the build error: “undefined: bytes in bytes.Buffer”

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

答案1

得分: 18

你忘记了导入语句。

导入 "bytes"
英文:

You forgot about import statement.

import "bytes"

huangapple
  • 本文由 发表于 2017年2月22日 20:46:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/42391898.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定