diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
index 453b37285f20dc3531bc6b86d8fe9ffa30fd45e8..62f9693210230ad46a22cc277b1fcbc23e0ebc9e 100644
--- a/src/cmd/dist/buildtool.go
+++ b/src/cmd/dist/buildtool.go
@@ -113,6 +113,8 @@ var ignoreSuffixes = []string{
 	// with PGO. And as it is not a text file the import path
 	// rewrite will break it.
 	".pgo",
+	// Skip editor backup files.
+	"~",
 }
 
 var tryDirs = []string{