I have a dedicated outdoor 20 amp circuit (GFCI breaker) in my yard that was for a pool we got rid of. 2-gang box w/weatherproof cover. I want to install a GFCI outlet that is controlled by a switch. I plan on adding an underground extension of the circuit to my barn and I want the switch to control everything downstream as well. What is the proper way to wire this? Thanks very much.
GFCIs do not work that way. GFCIs are not a kind of receptacle. They are a system of protection that takes hot and neutral in ; and provides conditioned hot and neutral out. They also make these systems in a receptacle form-factor, and it also provides a couple of convenience sockets right on them. It looks an awful lot like a receptacle. This has misconfused people into thinking GFCIs are merely some sort of rather expensive receptacle. No. Receptacles are still $3.
GFCI protection modules do not like to be downstream of switches. You need to do what you did before; have the GFCI protection module upstream of the switch, so the switch is switching conditioned hot and passing conditioned neutral thru to the outdoor outlet.
You can do this either with another GFCI breaker (price, I know) or a GFCI module such as a deadface upstream of the switch. I really don't care if you buy a deadface which also has a couple convenience sockets on its front, also called a liveface.
Find the circuit's wire inside, cut it apart, install a 1-gang box for the light switch at the cut & install a switch. Then, go outside & run a new underground rated wire from the existing outlet out to the barn. You'll need conduit to go down to the ground from the outlet & to come back up from the ground to the other outlet, but not for under the ground.
The switch will switch everything & the GFCI will provide protection to both or more outdoor outlets or lights. Or, run all new wire for everything to be fully legal. The switch box wouldn't be "legal" because it wouldn't have 6"s of wire slack to pull out of that box.