The Shootist by Glendon Swarthout

An aging, legendary gunfighter learns he has terminal cancer and retreats to a small town to live out his remaining days with dignity, befriending a sympathetic doctor, an innkeeper and a young admirer while confronting the legacy of violence that has defined him; as his health fails he struggles with mortality, changing times, and a final confrontation engineered by men who want to test him, choosing to meet death on his own terms and reflecting on honor, courage, and the end of the Old West.

Purchase from Bookshop.org