๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Sign inDemoInstall
Socket

github.com/Excoriate/daggerverse/gotoolbox

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/Excoriate/daggerverse/gotoolbox

v0.11.0
Source
Go
Version published
Created
Source

๐Ÿงฐ Gotoolbox Module for Dagger

A powerful Dagger module for Go development and CI/CD workflows.

๐Ÿ› ๏ธ Configuration

Through the Dagger CLI or within your module, you can configure:

  • โš™๏ธ ctr: Base container (default: new container created)
  • โš™๏ธ version: Go image version (default: latest)
  • โš™๏ธ image: Go image (default: golang:alpine)

๐ŸŒŸ Features

FunctionDescriptionExample
๐Ÿณ BaseSet base image and versiondagger call base --image-url golang:1.22-alpine
๐Ÿ“ฆ WithEnvironmentVariableSet environment variabledagger call with-environment-variable --name GO_ENV --value production
๐Ÿ“‚ WithSourceMount source directorydagger call with-source --src . --workdir /app
๐Ÿ”’ WithSecretAsEnvVarSet secret as env vardagger call with-secret-as-env-var --name API_KEY --secret mysecret
๐Ÿ“ฅ WithDownloadedFileDownload and mount filedagger call with-downloaded-file --url https://example.com/file.txt
๐Ÿ”„ WithClonedGitRepoClone and mount Git repodagger call with-cloned-git-repo --repo-url https://github.com/user/repo
๐Ÿ”„ WithCacheBusterAdd cache bustingdagger call with-cache-buster
๐Ÿ› ๏ธ WithGitInAlpineContainerInstall Gitdagger call with-git-in-alpine-container
๐Ÿงฐ WithUtilitiesInAlpineContainerInstall common utilitiesdagger call with-utilities-in-alpine-container
๐Ÿ–ฅ๏ธ WithGoPlatformSet Go platformdagger call with-go-platform --platform linux/amd64
๐Ÿ”ง WithGoCgoEnabledEnable CGOdagger call with-go-cgo-enabled
๐Ÿšซ WithCgoDisabledDisable CGOdagger call with-cgo-disabled
๐Ÿ’พ WithGoBuildCacheConfigure Go build cachedagger call with-go-build-cache
๐Ÿ“ฆ WithGoModCacheConfigure Go mod cachedagger call with-go-mod-cache
๐Ÿ“ฅ WithGoInstallInstall Go packagesdagger call with-go-install --pkgs github.com/user/pkg@latest
๐Ÿƒ WithGoExecExecute Go commanddagger call with-go-exec --args build --args ./...
๐Ÿ› ๏ธ WithGoBuildConfigure Go builddagger call with-go-build --pkg ./cmd/app --race
๐Ÿ”’ WithGoPrivateSet GOPRIVATEdagger call with-go-private --private-host example.com
๐Ÿ”ง WithGoGCCCompilerInstall GCC compilerdagger call with-go-gcc-compiler
๐Ÿ“Š WithGoTestSumInstall GoTestSumdagger call with-go-test-sum
๐Ÿš€ WithGoReleaserInstall GoReleaserdagger call with-go-releaser
๐Ÿ” WithGoLintInstall golangci-lintdagger call with-go-lint --version v1.60.1
๐Ÿ–ฅ๏ธ OpenTerminalOpen interactive terminaldagger call open-terminal
๐Ÿš RunShellRun shell commanddagger call run-shell --cmd "echo Hello, World!"
๐Ÿ–จ๏ธ PrintEnvVarsPrint environment variablesdagger call print-env-vars
๐Ÿ” InspectEnvVarInspect specific env vardagger call inspect-env-var --key GO_VERSION
๐Ÿƒ RunGoCMDRun Go commanddagger call run-go-cmd --cmd test --cmd ./...
๐Ÿƒ RunAnyCmdRun any commanddagger call run-any-cmd --cmd go --cmd version

Using the Gotoolbox Module ๐Ÿš€

Refer to the examples in the {{.module_name_pkg}}/examples module to see how to use the module's functions.

Usage through the Dagger CLI ๐Ÿš€

List all the functions available in the module:

# enter into the module's directory
cd gotoolbox

# list all the functions available in the module
dagger develop && dagger functions

Call a function:

# call a function
# dagger call <function-name> [arguments]
dagger call github.com/excoriate/daggerverse/gotoolbox@version <function-name> [arguments]

Testing ๐Ÿงช

This module includes a testing module that aims to test the functionality of the Gotoolbox module. The tests are written in Go and can be run using the following command:

## Run the tests using the just command
just test gotoolbox

Developer Experience ๐Ÿ› ๏ธ

If you'd like to contribute, mostly we use Just to automate tasks and Nix to manage the development environment. You can use the following commands to get started:

# initialize the pre-commit hooks
just init
# run CI or common things locally
just golint gotoolbox
# run the tests
just test gotoolbox
# Run the entire CI tasks locally
just cilocal gotoolbox

Examples (aka Recipes) ๐Ÿฒ

Additionally, this module brings a new Daggerverse functionality that allows to automatically generate the module's documentation using an special (sub) module called {{.module_name_pkg}}/examples/sdk. This module contains a set of examples hat demonstrate how to use the module's functions.

To generate the documentation It's important to notice that each example function in order to be rendered in the documentation, it must be preprocessed by module's name, in this case (camelCase) gotoolbox.

NOTE: The just command entails the use of the Justfile for task automation. If you don't have it, don't worry, you just need Nix to run the tasks using the dev-shell built-in command: nix develop --impure --extra-experimental-features nix-command --extra-experimental-features flakes

FAQs

Package last updated on 21 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts