Skip to content

Commit

Permalink
lib: export compare and reader funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Mar 27, 2019
1 parent eae15e3 commit b539b07
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ func TestOrder(t *testing.T) {
f, err := os.Open(cfg.LockFilePath())
assert.NoError(t, err)

current, err := protolockFromReader(f)
current, err := FromReader(f)
assert.NoError(t, err)

r, err := Commit(*cfg)
assert.NoError(t, err)
assert.NotNil(t, r)

updated, err := protolockFromReader(r)
updated, err := FromReader(r)
assert.NoError(t, err)

assert.Equal(t, current, updated)
Expand Down
8 changes: 4 additions & 4 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ func openLockFile(cfg Config) (io.ReadCloser, error) {
return f, nil
}

// protolockFromReader unmarshals a proto.lock file into a Protolock struct.
func protolockFromReader(r io.Reader) (Protolock, error) {
// FromReader unmarshals a proto.lock file into a Protolock struct.
func FromReader(r io.Reader) (Protolock, error) {
buf := bytes.Buffer{}
_, err := io.Copy(&buf, r)
if err != nil {
Expand All @@ -453,10 +453,10 @@ func protolockFromReader(r io.Reader) (Protolock, error) {
return lock, nil
}

// compare returns a Report struct and an error which indicates that there is
// Compare returns a Report struct and an error which indicates that there is
// one or more warnings to report to the caller. If no error is returned, the
// Report can be ignored.
func compare(current, update Protolock) (*Report, error) {
func Compare(current, update Protolock) (*Report, error) {
var warnings []Warning
var wg sync.WaitGroup
report := &Report{
Expand Down
2 changes: 1 addition & 1 deletion parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func TestParseWithEntryOptions(t *testing.T) {
assert.NoError(t, err)

assert.Len(t, entry.Options, 3)
assert.Equal(t, "java_multiple_files", entry.Options[0].Name, )
assert.Equal(t, "java_multiple_files", entry.Options[0].Name)
assert.Equal(t, "true", entry.Options[0].Value)
assert.Equal(t, "java_package", entry.Options[1].Name)
assert.Equal(t, "test.java.package", entry.Options[1].Value)
Expand Down
4 changes: 2 additions & 2 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func Status(cfg Config) (*Report, error) {
}
defer lockFile.Close()

current, err := protolockFromReader(lockFile)
current, err := FromReader(lockFile)
if err != nil {
return nil, err
}

return compare(current, *updated)
return Compare(current, *updated)
}

0 comments on commit b539b07

Please sign in to comment.