stripper

package
v0.0.0-...-669fbe5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentStripper

type CommentStripper struct {
	Comment    string
	Delimiter  byte
	Whitespace bool
	// contains filtered or unexported fields
}
Example
package main

import (
	"io"
	"os"
	"strings"

	"github.com/docker-library/go-dockerlibrary/pkg/stripper"
)

func main() {
	r := strings.NewReader(`
# opening comment
a: b
# comment!
c: d # not a comment

# another cheeky comment
e: f
`)

	comStrip := stripper.NewCommentStripper(r)

	// using CopyBuffer to force smaller Read sizes (better testing coverage that way)
	io.CopyBuffer(os.Stdout, comStrip, make([]byte, 32))

}
Output:

a: b
c: d # not a comment

e: f

func NewCommentStripper

func NewCommentStripper(r io.Reader) *CommentStripper

func (*CommentStripper) Read

func (r *CommentStripper) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL