golangx

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGoCgoDisabled

func WithGoCgoDisabled() types.DaggerEnvVars

WithGoCgoDisabled returns a DaggerEnvVars struct that sets the CGO_ENABLED environment variable to "0", disabling CGO for Go builds.

Returns:

  • A DaggerEnvVars struct with CGO_ENABLED set to "0".

Example:

envVar := WithGoCgoDisabled()
fmt.Println(envVar) // Output: {Name: "CGO_ENABLED", Value: "0", Expand: false}

func WithGoCgoEnabled

func WithGoCgoEnabled() types.DaggerEnvVars

WithGoCgoEnabled returns a DaggerEnvVars struct that sets the CGO_ENABLED environment variable to "1", enabling CGO for Go builds.

Returns:

  • A DaggerEnvVars struct with CGO_ENABLED set to "1".

Example:

envVar := WithGoCgoEnabled()
fmt.Println(envVar) // Output: {Name: "CGO_ENABLED", Value: "1", Expand: false}

func WithGoPlatform

func WithGoPlatform(platform string) []types.DaggerEnvVars

WithGoPlatform returns a slice of DaggerEnvVars structs that set the GOOS, GOARCH, and optionally GOARM environment variables based on the provided platform string.

Parameters:

  • platform: A string representing the target platform in the format "os/arch[/variant]".

Returns:

  • A slice of DaggerEnvVars structs with GOOS, GOARCH, and optionally GOARM set.

Example:

envVars := WithGoPlatform("linux/amd64")
for _, envVar := range envVars {
    fmt.Println(envVar)
}
// Output:
// {Name: "GOOS", Value: "linux", Expand: false}
// {Name: "GOARCH", Value: "amd64", Expand: false}

envVars = WithGoPlatform("linux/arm/v7")
for _, envVar := range envVars {
    fmt.Println(envVar)
}
// Output:
// {Name: "GOOS", Value: "linux", Expand: false}
// {Name: "GOARCH", Value: "arm", Expand: false}
// {Name: "GOARM", Value: "v7", Expand: false}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL