Many golf courses do have dress codes and you might not be allowed to play if you show up wearing something other than what the course calls proper attire.
What to Wear to a Golf Course, Golf Etiquette
Dress code – Stockport Golf Club
Should Golf Clubs Have Dress Codes? - Golf Monthly Debate
Etiquette Made Easy: What to Wear on the Golf Course
What Country Club Attire You Should Wear At A Country Club
Cracking the Golf Dress Code - Mizzen+Main
Why do Golf Courses Have Dress Codes
Dress Code Policy Dress Code Policy in the Clubhouse in the
3 Features of the Best Golf Clothes – tasc Performance