Skip to content

Commit

Permalink
Remove possibility of a typed nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Uhl committed May 19, 2016
1 parent 2aca30a commit d8c91f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func (m *DataSet) FieldByType(dsType DataSetType) (interface{}, error) {

switch dsType {
case DataSetType_KEYWORD, DataSetType_SENTIMENT:
if m.Keyword == nil {
return nil, nil
}
return m.Keyword, nil
}

Expand Down
2 changes: 1 addition & 1 deletion dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func testDS(t *testing.T, ds *DataSet, expectNil bool) {
}

if i != nil && expectNil {
t.Errorf("got unexpected nil dataset field %v", i)
t.Errorf("got unexpected nil dataset field %#v", i)
}

if expectNil {
Expand Down

0 comments on commit d8c91f6

Please sign in to comment.