Is there anything wrong with this code or what needs to be improved?
Yes. Read the documentation.
func ReadDir(dirname string) (fs.FileInfo, error)
As of Go 1.16, os.ReadDir is a ...
Perhaps it would be useful to look at the linux function with the same name.
flock() places advisory locks only; given suitable permissions on a file, a process is free to ignore the use of flock() ...
Is there a better approach than parsing the output of mount using a regex?
You care about machine legibility, not human legibility; so if you were sticking to a basic mountpoint search you ...