github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/debug/buildinfo/buildinfo.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package buildinfoは、Goバイナリに埋め込まれた情報にアクセスするための機能を提供します。
     6  // これには、Goツールチェーンのバージョン、および使用されたモジュールのセット(モジュールモードでビルドされたバイナリの場合)が含まれます。
     7  //
     8  // ビルド情報は、現在実行中のバイナリでruntime/debug.ReadBuildInfoを使用して利用できます。
     9  package buildinfo
    10  
    11  import (
    12  	"github.com/shogo82148/std/io"
    13  	"github.com/shogo82148/std/runtime/debug"
    14  )
    15  
    16  // ビルド情報のための型エイリアスです。
    17  // ここに型を移動することはできません。なぜなら、
    18  // runtime/debugがこのパッケージをインポートする必要があるため、
    19  // 依存関係が大きくなるためです。
    20  type BuildInfo = debug.BuildInfo
    21  
    22  // ReadFileは、指定されたパスのGoバイナリファイルに埋め込まれたビルド情報を返します。
    23  // ほとんどの情報は、モジュールサポートでビルドされたバイナリでのみ利用可能です。
    24  func ReadFile(name string) (info *BuildInfo, err error)
    25  
    26  // Readは、指定されたReaderAtを介してアクセスされるGoバイナリファイルに埋め込まれたビルド情報を返します。
    27  // ほとんどの情報は、モジュールサポートでビルドされたバイナリでのみ利用可能です。
    28  func Read(r io.ReaderAt) (*BuildInfo, error)