Of Noah it is written (Genesis 6:9): "Noah walked with God." And it is written concerning the fathers of the world (Genesis 48:15): "The God before whom my fathers walked." Rabbi Yochanan said: To what were the fathers comparable before the Holy One, blessed be He? To a shepherd who walks along while his flock walks before him. Resh Laqish said to him: Until now the flock has had need of the shepherd. Rather, to what were the fathers comparable before the Holy One, blessed be He? To a prince who walks along while his elders walk before him, and the elders make known the honor of the prince. So did the fathers of the world walk before Him, as it is stated (Genesis 48:15): "before whom my fathers walked." Hence (Genesis 17:1): "Walk before Me and be perfect."
Why the Patriarchs Walked Before God While Noah Walked With Him
Midrash Tanchuma Buber, Lech Lecha 26:2
בנח כתיב את האאלהים התהלך נח, וכתיב באבות העולם האלהים אשר התהלכו אבותי לפניו (בראשית מח טו), אמר ר' יוחנן למה היו האבות דומין לפני הקב"ה, לרועה שהוא מהלך וצאנו מהלכת לפניו, א"ל ריש לקיש עד עכשיו הצאן היו צריכים לרועה, אלא למה היו האבות דומין לפני הקב"ה, לנשיא שהוא מהלך וזקניו מהלכין לפניו, והקנים מודיעין כבודו של נשיא, כך היו אבות העולם הולכים לפניו, שנאמר אשר התהלכו אבותי לפניו, הוי התהלך לפני והיה תמים.