rewrite in Go