Rename packages
This commit is contained in:
parent
49b8760527
commit
ef1243ea39
47 changed files with 524 additions and 369 deletions
42
pkg/envreader/envreader_test.go
Normal file
42
pkg/envreader/envreader_test.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// Package envreader
|
||||
package envreader
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ExampleNewScanner() {
|
||||
scanner := NewScanner(strings.NewReader(`
|
||||
lines without an equal sign are ignored
|
||||
|
||||
// this line is a comment, even with an = sign
|
||||
KEY=VALUE
|
||||
|
||||
# this is also a comment =
|
||||
spaces in keys = spaces in values
|
||||
multiple=equal=signs
|
||||
CaSe = SenSitiVe
|
||||
empty value=
|
||||
=empty key
|
||||
`))
|
||||
|
||||
for scanner.Scan() {
|
||||
key, value := scanner.Data()
|
||||
fmt.Printf("%q %q\n", key, value)
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
fmt.Println(scanner.Err())
|
||||
} else {
|
||||
fmt.Println("no error")
|
||||
}
|
||||
|
||||
// Output: "KEY" "VALUE"
|
||||
// "spaces in keys" "spaces in values"
|
||||
// "multiple" "equal=signs"
|
||||
// "CaSe" "SenSitiVe"
|
||||
// "empty value" ""
|
||||
// "" "empty key"
|
||||
// no error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue