Brake lights turning off and on in the driveway

I had a master cylinder cause the brake lights to stay on. After a while it would release while setting.