go中的错误处理,哪个文件和一行?

I did not find a better way to show error details in long form.

log.SetFlags(log.Llongfile)

I am particularly interested which file and line error happened. Is it any way to set long format application wide rather than add to every function?

You might want to consider gin to watch and tells you where errors happened after build.