github.com/anchore/syft@v1.38.2/syft/pkg/golang.go (about)

     1  package pkg
     2  
     3  // GolangBinaryBuildinfoEntry represents all captured data for a Golang binary
     4  type GolangBinaryBuildinfoEntry struct {
     5  	// BuildSettings contains the Go build settings and flags used to compile the binary (e.g., GOARCH, GOOS, CGO_ENABLED).
     6  	BuildSettings KeyValues `json:"goBuildSettings,omitempty" cyclonedx:"goBuildSettings"`
     7  
     8  	// GoCompiledVersion is the version of Go used to compile the binary.
     9  	GoCompiledVersion string `json:"goCompiledVersion" cyclonedx:"goCompiledVersion"`
    10  
    11  	// Architecture is the target CPU architecture for the binary (extracted from GOARCH build setting).
    12  	Architecture string `json:"architecture" cyclonedx:"architecture"`
    13  
    14  	// H1Digest is the Go module hash in h1: format for the main module from go.sum.
    15  	H1Digest string `json:"h1Digest,omitempty" cyclonedx:"h1Digest"`
    16  
    17  	// MainModule is the main module path for the binary (e.g., "github.com/anchore/syft").
    18  	MainModule string `json:"mainModule,omitempty" cyclonedx:"mainModule"`
    19  
    20  	// GoCryptoSettings contains FIPS and cryptographic configuration settings if present.
    21  	GoCryptoSettings []string `json:"goCryptoSettings,omitempty" cyclonedx:"goCryptoSettings"`
    22  
    23  	// GoExperiments lists experimental Go features enabled during compilation (e.g., "arenas", "cgocheck2").
    24  	GoExperiments []string `json:"goExperiments,omitempty" cyclonedx:"goExperiments"`
    25  }
    26  
    27  // GolangModuleEntry represents all captured data for a Golang source scan with go.mod/go.sum
    28  type GolangModuleEntry struct {
    29  	// H1Digest is the Go module hash in h1: format from go.sum for verifying module contents.
    30  	H1Digest string `json:"h1Digest,omitempty" cyclonedx:"h1Digest"`
    31  }
    32  
    33  // GolangSourceEntry represents all captured data for a Golang package found through source analysis
    34  type GolangSourceEntry struct {
    35  	// H1Digest is the Go module hash in h1: format from go.sum for verifying module contents.
    36  	H1Digest string `json:"h1Digest,omitempty" cyclonedx:"h1Digest"`
    37  
    38  	// OperatingSystem is the target OS for build constraints (e.g., "linux", "darwin", "windows").
    39  	OperatingSystem string `json:"os,omitempty" cyclonedx:"os"`
    40  
    41  	// Architecture is the target CPU architecture for build constraints (e.g., "amd64", "arm64").
    42  	Architecture string `json:"architecture,omitempty" cyclonedx:"architecture"`
    43  
    44  	// BuildTags are the build tags used to conditionally compile code (e.g., "integration,debug").
    45  	BuildTags string `json:"buildTags,omitempty" cyclonedx:"buildTags"`
    46  
    47  	// CgoEnabled indicates whether CGO was enabled for this package.
    48  	CgoEnabled bool `json:"cgoEnabled" cyclonedx:"cgoEnabled"`
    49  }