mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
package-directory-mismatch: ignore mismatch in root directory (#1548)
This commit is contained in:
committed by
GitHub
parent
91147bf0b5
commit
26d803fc96
@@ -412,3 +412,27 @@ func TestExportedType(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mkdirTempDotGit adds a temporary .git directory to the given root directory in testdata.
|
||||
// We can't commit .git directly because of the Git restrictions.
|
||||
func mkdirTempDotGit(t *testing.T, root string) {
|
||||
t.Helper()
|
||||
|
||||
baseDir := filepath.Join("..", "testdata", root)
|
||||
dir, err := filepath.Abs(baseDir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to resolve abs path: %v", err)
|
||||
}
|
||||
|
||||
gitDir := filepath.Join(dir, ".git")
|
||||
if err := os.MkdirAll(gitDir, 0o755); err != nil {
|
||||
t.Fatalf("Failed to create .git directory: %v", err)
|
||||
}
|
||||
|
||||
t.Cleanup(func() {
|
||||
err = os.RemoveAll(gitDir)
|
||||
if err != nil {
|
||||
t.Logf("Failed to remove %v: %v", gitDir, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user