If you controlled a creature with power 4 or greater when you declared Courageous Goblin as an attacker, it doesn't matter whether you still control one as its ability resolves. Courageous Goblin will still get +1/+0 and gain menace until end of turn.