Skip to content

Commit

Permalink
Allow nil progress
Browse files Browse the repository at this point in the history
Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
  • Loading branch information
vmarkovtsev committed Oct 8, 2019
1 parent 2342911 commit 8cd68fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions file.go
Expand Up @@ -46,6 +46,9 @@ func OpenFile(fileName string, progress ProgressCallback) (*File, error) {
// Open reads ASDF from a seekable reader.
func Open(reader io.ReadSeeker, progress ProgressCallback) (*File, error) {
file := &File{}
if progress == nil {
progress = func(_, _ int) {}
}
progress(0, 2)
var err error
file.FormatVersion, file.StandardVersion, err = parseHeader(reader)
Expand Down
3 changes: 1 addition & 2 deletions file_test.go
Expand Up @@ -9,8 +9,7 @@ import (

func TestOpenFile(t *testing.T) {
req := require.New(t)
asdfFile, err := OpenFile("testdata/default.asdf",
func(done, total int) {})
asdfFile, err := OpenFile("testdata/default.asdf", nil)
req.NoError(err)
req.NotNil(asdfFile)
}
Expand Down

0 comments on commit 8cd68fe

Please sign in to comment.