我正在开发一个Go应用程序,其中我想使用mount-utils包:https://pkg.go.dev/k8s.io/utils/mount
在这里,该程序包解析/proc/mount文件,而不是/proc/self/mount信息.
我如何使用这个包计算出源代码的价值?与/proc/self/mount信息相比,/proc/mount文件中缺少此信息.
我正在开发一个Go应用程序,其中我想使用mount-utils包:https://pkg.go.dev/k8s.io/utils/mount
在这里,该程序包解析/proc/mount文件,而不是/proc/self/mount信息.
我如何使用这个包计算出源代码的价值?与/proc/self/mount信息相比,/proc/mount文件中缺少此信息.
mount.ParseMountInfo解析/proc/<pid>/mountinfo
.
package main
import (
"fmt"
"k8s.io/utils/mount"
)
func main() {
mounts, err := mount.ParseMountInfo("/proc/self/mountinfo")
if err != nil {
panic(err)
}
for _, m := range mounts {
fmt.Printf("%-100s%s\n", m.MountPoint, m.Source)
}
}
顺便说一句,包裹k8s.io/utils/mount
已经被移到了新的位置.用k8s.io/mount-utils
代替.