Have had this issue and Andy is right, it's a known problem but an easy...ish fix.
You have to remove all the upper trim on the inside of the boot lid to allow access to the switch which sits inside of the external chrome strip. Water gets in from the seal of that strip and corrodes some of the wiring loom. If you feel competent enough, you can repair the loom but sometimes it is the actual switch. A new loom with the switch isn't expensive, but be careful when ordering, the hatchback version won't fit, I had to butcher that one!
I added a waterproof tape to the upper side of the switch when installing again and put more sealant around the chrome strip too, hopefully stops future leaks.
Good Luck.