blob: beb6cce023005d6b6491ea5593cc3480623f079f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<h1> Package buildinfo </h1> <ul id="short-nav">
<li><code>import "debug/buildinfo"</code></li>
<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
<li><a href="#pkg-index" class="indexLink">Index</a></li>
</ul> <h2 id="pkg-overview">Overview </h2> <p>Package buildinfo provides access to information embedded in a Go binary about how it was built. This includes the Go toolchain version, and the set of modules used (for binaries built in module mode). </p>
<p>Build information is available for the currently running binary in runtime/debug.ReadBuildInfo. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
<li><a href="#BuildInfo">type BuildInfo</a></li>
<li> <a href="#Read">func Read(r io.ReaderAt) (*BuildInfo, error)</a>
</li>
<li> <a href="#ReadFile">func ReadFile(name string) (info *BuildInfo, err error)</a>
</li>
</ul> <h3>Package files</h3> <p> <span>buildinfo.go</span> </p> <h2 id="BuildInfo">type <span>BuildInfo</span> <span title="Added in Go 1.18">1.18</span> </h2> <p>Type alias for build info. We cannot move the types here, since runtime/debug would need to import this package, which would make it a much larger dependency. </p>
<pre data-language="go">type BuildInfo = debug.BuildInfo</pre> <h3 id="Read">func <span>Read</span> <span title="Added in Go 1.18">1.18</span> </h3> <pre data-language="go">func Read(r io.ReaderAt) (*BuildInfo, error)</pre> <p>Read returns build information embedded in a Go binary file accessed through the given ReaderAt. Most information is only available for binaries built with module support. </p>
<h3 id="ReadFile">func <span>ReadFile</span> <span title="Added in Go 1.18">1.18</span> </h3> <pre data-language="go">func ReadFile(name string) (info *BuildInfo, err error)</pre> <p>ReadFile returns build information embedded in a Go binary file at the given path. Most information is only available for binaries built with module support. </p><div class="_attribution">
<p class="_attribution-p">
© Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
<a href="http://golang.org/pkg/debug/buildinfo/" class="_attribution-link">http://golang.org/pkg/debug/buildinfo/</a>
</p>
</div>
|