A spawner with a goat in doesn't spawn goats
/setblock ~ ~ ~ spawner{SpawnRange:0s,MinSpawnDelay:3s,MaxSpawnDelay:3s,SpawnData:{id:"minecraft:goat"},SpawnCount:1s} destroy