以高效的方式递归列出目录和文件

go's filepath.Walk says that

The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.

What are the other efficient ways to do the same?

There is no "efficient" way to do the same (walk in lexical order). You either have to sort (which is "inefficient") or walk in random order (which is not the same).

Until you measured and using filepath.Walk really is your bottleneck you should not worry about the little word "inefficient". Especially as it does not state "it will be inefficient", just "can be". Can in the sense of: It is possible to craft 100k file names and put the into a manually crafted directory so that sorting them will take a long time.