package two import "fmt" type kind int const ( kindOfFile kind = iota kindOfEmpty ) type block struct { kind kind id int start int length int value int } func newBlock(kind kind, id, start, length, value int) *block { return &block{kind, id, start, length, value} } func (b *block) String() string { var kindStr string switch b.kind { case kindOfFile: kindStr = "file" case kindOfEmpty: kindStr = "empty" } return fmt.Sprintf("kind: %s id: %d start: %d length: %d", kindStr, b.id, b.start, b.length) }