You can pass an entity table:
local e = nearestEntity_get("minecraft:zombie") gol.attackAt(e)
gol.attackAt("minecraft:zombie")
Targets the nearest entity of that type.