-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add exmaple, add copy/license heading, improve the docs
- Loading branch information
1 parent
a43069b
commit 755c0f0
Showing
4 changed files
with
106 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Copyright (c) 2016 Konstanin Ivanov <kostyarin.ivanov@gmail.com>. | ||
// All rights reserved. This program is free software. It comes without | ||
// any warranty, to the extent permitted by applicable law. You can | ||
// redistribute it and/or modify it under the terms of the Do What | ||
// The Fuck You Want To Public License, Version 2, as published by | ||
// Sam Hocevar. See LICENSE.md file for more details or see below. | ||
// | ||
|
||
// | ||
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
// Version 2, December 2004 | ||
// | ||
// Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | ||
// | ||
// Everyone is permitted to copy and distribute verbatim or modified | ||
// copies of this license document, and changing it is allowed as long | ||
// as the name is changed. | ||
// | ||
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
// | ||
// 0. You just DO WHAT THE FUCK YOU WANT TO. | ||
// | ||
|
||
package lifo | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func Example_lifo() { | ||
b := NewBuffer(nil) | ||
|
||
b.Write([]byte("bye")) | ||
b.Write([]byte("hello")) | ||
|
||
hello := make([]byte, 5) | ||
bye := make([]byte, 3) | ||
|
||
b.Read(hello) | ||
b.Read(bye) | ||
|
||
fmt.Println(string(hello)) | ||
fmt.Println(string(bye)) | ||
|
||
// Output | ||
// hello | ||
// bye | ||
} |