Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/excoriate/daggerx
DaggerX is a Go package 📦 that helps you avoid DRY while developing Dagger modules.
https://github.com/excoriate/daggerx
cli devops ecs example sre tooling
Last synced: 3 days ago
JSON representation
DaggerX is a Go package 📦 that helps you avoid DRY while developing Dagger modules.
- Host: GitHub
- URL: https://github.com/excoriate/daggerx
- Owner: Excoriate
- License: apache-2.0
- Created: 2024-05-15T10:22:24.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-04T15:38:21.000Z (3 months ago)
- Last Synced: 2024-11-04T15:50:56.473Z (3 months ago)
- Topics: cli, devops, ecs, example, sre, tooling
- Language: Go
- Size: 777 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
A collection of utility functions that works well when using Dagger and Go
---
[![Go Reference](https://pkg.go.dev/badge/github.com/Excoriate/daggerx.svg)](https://pkg.go.dev/github.com/Excoriate/daggerx)
[![Contributors](https://img.shields.io/github/contributors/badges/shields)](https://github.com/Excoriate/daggerx/graphs/contributors)
[![Activity](https://img.shields.io/github/commit-activity/m/Excoriate/daggerx)](https://github.com/Excoriate/daggerx/pulse)## Why 🤔
This library is a set of reusable functions that can be used when developing [Dagger](https://www.dagger.io/) modules or functions using [Go](https://golang.org/). 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](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
```bash
go get github.com/Excoriate/daggerx
```### Pre-requisites 📋
- [Go](https://golang.org/doc/install) >= ~1.22
>**NOTE**: For the tools used in this project, please check the [Makefile](./Makefile), and the [Taskfile](./Taskfile.yml) files. You'll also need [pre-commit](https://pre-commit.com/) installed.
---
## Usage 🚀
### Convert map to slice of DaggerEnvVars
```go
package mainimport (
"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
```go
package mainimport (
"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
```go
package mainimport (
"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](./CONTRIBUTING.md).