github.com/docker-library/go-dockerlibrary@v0.0.0-20200821205225-669fbe5c1d52/pkg/stripper/comments_example_test.go (about) 1 package stripper_test 2 3 import ( 4 "io" 5 "os" 6 "strings" 7 8 "github.com/docker-library/go-dockerlibrary/pkg/stripper" 9 ) 10 11 func ExampleCommentStripper() { 12 r := strings.NewReader(` 13 # opening comment 14 a: b 15 # comment! 16 c: d # not a comment 17 18 # another cheeky comment 19 e: f 20 `) 21 22 comStrip := stripper.NewCommentStripper(r) 23 24 // using CopyBuffer to force smaller Read sizes (better testing coverage that way) 25 io.CopyBuffer(os.Stdout, comStrip, make([]byte, 32)) 26 27 // Output: 28 // a: b 29 // c: d # not a comment 30 // 31 // e: f 32 }