Refactor attach loop device in pure Go