Skip to content

Commit

Permalink
Make buffer implement the fmt.Stringer interface
Browse files Browse the repository at this point in the history
  • Loading branch information
quarnster committed Sep 26, 2015
1 parent d6b8f8c commit d3174ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ func NewBuffer() Buffer {
return r
}

// implement the fmt.Stringer interface
func (b *buffer) String() string {
return fmt.Sprintf("Buffer{id: %d, name: \"%s\", filename: \"%s\"}", b.Id(), b.Name(), b.FileName())
}

func (b *buffer) modLock() error {
if !atomic.CompareAndSwapInt32(&b.inCallbacks, 0, 1) {
return ErrBufferInCallbacks
Expand Down

0 comments on commit d3174ab

Please sign in to comment.