Skip to content

Commit

Permalink
fix: redundant if ...; err != nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz committed May 31, 2019
1 parent 09dd239 commit d1e3dac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var versionCmd = &cobra.Command{
},
}

// Main is the main entry of gorse.
func Main() {
rootCmd.AddCommand(commandTest)
rootCmd.AddCommand(commandImportFeedback)
Expand Down
10 changes: 2 additions & 8 deletions engine/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ func UpdateItemPop(cacheSize int, dataSet core.DataSetInterface, db *DB) error {
recommends[i].ItemId = items[i]
recommends[i].Score = scores[i]
}
if err := db.SetPopular(recommends); err != nil {
return err
}
return nil
return db.SetPopular(recommends)
}

// UpdateNeighbors updates neighbors for the database.
Expand Down Expand Up @@ -87,8 +84,5 @@ func Update(config TomlConfig, metaData toml.MetaData, db *DB) error {
return err
}
// Generate popular items
if err = UpdateItemPop(config.Recommend.CacheSize, dataSet, db); err != nil {
return err
}
return nil
return UpdateItemPop(config.Recommend.CacheSize, dataSet, db)
}

0 comments on commit d1e3dac

Please sign in to comment.