daggerx

module
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0

README ΒΆ

logo

A collection of utility functions that works well when using Dagger and Go


Go Reference Contributors Activity

Why πŸ€”

This library is a set of reusable functions that can be used when developing Dagger modules or functions using Go. The objective is to speed up the development process and make it easier to write Dagger modules using Go.

Installation πŸ› οΈ

Install it using Go get:

go get github.com/Excoriate/daggerx

Pre-requisites πŸ“‹

  • Go >= ~1.22

NOTE: For the tools used in this project, please check the Makefile, and the Taskfile files. You'll also need pre-commit installed.


Usage πŸš€

Convert map to slice of DaggerEnvVars

package main

import (
    "fmt"
    "github.com/Excoriate/daggerx/pkg/envvars"
    "github.com/Excoriate/daggerx/pkg/types"
)

func main() {
    envVarsMap := map[string]string{
        "key1": "value1",
        "key2": "value2",
        "key3": "value3",
    }

    envVarsSlice, err := envvars.ToDaggerEnvVarsFromMap(envVarsMap)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Environment Variables Slice:", envVarsSlice)
}

Generate validated Dagger commands

package main

import (
    "fmt"
    "github.com/Excoriate/daggerx/pkg/execmd"
)

func main() {
    cmd, err := execmd.GenerateCommand("terraform", "plan", "-var", "foo=bar")
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Generated Command:", *cmd)
}

Convert slice of key=value strings to slice of DaggerEnvVars

package main

import (
    "fmt"
    "github.com/Excoriate/daggerx/pkg/envvars"
    "github.com/Excoriate/daggerx/pkg/types"
)

func main() {
    envVarsSlice := []string{"key1=value1", "key2=value2", "key3=value3"}

    daggerEnvVarsSlice, err := envvars.ToDaggerEnvVarsFromSlice(envVarsSlice)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Dagger Environment Variables Slice:", daggerEnvVarsSlice)
}

Contributing

Please read our contributing guide.

Directories ΒΆ

Path Synopsis
pkg
apkox
Package apkox provides tools and utilities for building and managing APKO (Alpine Package Keeper for OCI) images.
Package apkox provides tools and utilities for building and managing APKO (Alpine Package Keeper for OCI) images.
cleaner
Package cleaner provides utilities for cleaning and sanitizing strings.
Package cleaner provides utilities for cleaning and sanitizing strings.
cloudaws
Package cloudaws provides a set of interfaces and implementations for interacting with various AWS services.
Package cloudaws provides a set of interfaces and implementations for interacting with various AWS services.
cmdx
Package cmdx provides utilities for generating and managing command-line commands in a structured and efficient manner.
Package cmdx provides utilities for generating and managing command-line commands in a structured and efficient manner.
containerx
Package containerx provides utilities for managing container images and their versions.
Package containerx provides utilities for managing container images and their versions.
envvars
Package envvars provides utilities for converting environment variables between different formats.
Package envvars provides utilities for converting environment variables between different formats.
filex
Package filex provides utility functions for working with files and directories, including validation of file extensions, existence, content, and structure.
Package filex provides utility functions for working with files and directories, including validation of file extensions, existence, content, and structure.
fixtures
Package fixtures provides a set of utilities and constants that are used for managing and handling fixtures in the context of containerized environments.
Package fixtures provides a set of utilities and constants that are used for managing and handling fixtures in the context of containerized environments.
githubx
Package githubx provides utilities for interacting with GitHub's API, specifically for fetching information about releases in a GitHub repository.
Package githubx provides utilities for interacting with GitHub's API, specifically for fetching information about releases in a GitHub repository.
golangx
Package golangx provides utility functions for working with Go modules and validating Go project structures.
Package golangx provides utility functions for working with Go modules and validating Go project structures.
installerx
Package installerx provides utilities for installing various software packages in a streamlined and automated manner.
Package installerx provides utilities for installing various software packages in a streamlined and automated manner.
logger
Package logger provides a structured logging interface for Go applications.
Package logger provides a structured logging interface for Go applications.
merger
Package merger provides utilities for merging slices of strings.
Package merger provides utilities for merging slices of strings.
parser
Package parser provides utilities for parsing and converting data types within Directed Acyclic Graphs (DAGs).
Package parser provides utilities for parsing and converting data types within Directed Acyclic Graphs (DAGs).
workdir
Package workdir provides utilities for managing and validating working directories within the context of the Excoriate DaggerX project.
Package workdir provides utilities for managing and validating working directories within the context of the Excoriate DaggerX project.

Jump to

Keyboard shortcuts

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