A traditional door lock is not going to work on a slider for obvious reasons. If this type of hardware was installed, it may be for decorative purposes only. Regular door handles would probably look pretty silly on barn doors while messing up the whole farmhouse vibe.
Luckily, hardware has come a long way. Manufacturers have made it possible to keep sliding barn doors closed without losing style. Each of the locks work to secure the doors differently. Your choice will impact how your lock operates.