Oofta
Legend
To me, the big factor in allowing the goblins to "shoot and hide" or not is two fold:
1: Terrain/lighting: A goblin can't shoot, hide behind a barrel, and then shoot again. The characters may not be able to see the goblin hidden behind the barrel, but they know he's there - behind that barrel! The goblin must be able to *re-position* between each shot so the PCs don't know where he is. If there was a pile of barrels, or darkness, that would work
2: Isn't hiding an *action*? You can't take two actions per turn, unless you have a class or racial feature that allows you to hide as a bonus action. So it would work like: Round 1: pop from cover, shoot, pop back under cover. Round 2: hide and sneak to a new position. Round 3: repeat (... I think)
Popping in and out of cover is very valid though, even if stealth isn't involved.
edit: Re-reading your post, it sounds like what you did is pretty darn close to what I posted... either way, it sounded like a fun battle!
Goblins are shifty little creatures and can hide or disengage as a bonus action.
But I also agree with what you and others are saying, as long as there's sufficient opportunities to hide they can hide every round. However, if someone can clearly see them (by walking around to see the other side of the barrel for example) they are no longer hidden.