<p>I am working on a go application where I want to use the the mount-utils package: <a href="https://pkg.go.dev/k8s.io/utils/mount" rel="nofollow noreferrer">https://pkg.go.dev/k8s.io/utils/mount</a></p>
<p>Here, this package parses /proc/mounts file instead of /proc/self/mountinfo.</p>
<p>How do I figure out value for source using this package? This piece of information is missing in /proc/mounts file as compared to /proc/self/mountinfo.</p>

codego123
<p><a href="https://pkg.go.dev/k8s.io/utils/mount#ParseMountInfo" rel="nofollow noreferrer">mount.ParseMountInfo</a> parses <code>/proc/&lt;pid&gt;/mountinfo</code>.</p>
<pre class="lang-golang prettyprint-override"><code>package main

import (
    &quot;fmt&quot;

    &quot;k8s.io/utils/mount&quot;
)

func main() {
    mounts, err := mount.ParseMountInfo(&quot;/proc/self/mountinfo&quot;)
    if err != nil {
        panic(err)
    }

    for _, m := range mounts {
        fmt.Printf(&quot;%-100s%s\n&quot;, m.MountPoint, m.Source)
    }
}
</code></pre>
<p>BTW, The package <code>k8s.io/utils/mount</code> has been moved to new location. Use <code>k8s.io/mount-utils</code> instead.</p>
