Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running golang script natively on Kestra worker #7373

Open
aballiet opened this issue Feb 12, 2025 · 1 comment
Open

Running golang script natively on Kestra worker #7373

aballiet opened this issue Feb 12, 2025 · 1 comment
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request

Comments

@aballiet
Copy link
Contributor

Feature description

Golang is a great language for small and fast scripting, would be nice to be able to use it with a dedicated plugin as it is done for python (full list)

@aballiet aballiet added area/backend Needs backend code changes area/frontend Needs frontend code changes enhancement New feature or request labels Feb 12, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Issues Feb 12, 2025
@anna-geller
Copy link
Member

anna-geller commented Feb 14, 2025

hmm tricky subject as Go-lang is not really a scripting language, right? so putting it under a script plugin just as a wrapper around Docker/Shell could be a bit misleading maybe?

Still, let's assume we would do it, what would you put under a Script task for Go? since I don't know Go, ChatGPT came up with this - is this plausible or not?

id: go_demo
namespace: company.team
tasks:
  - id: go
    type: io.kestra.plugin.scripts.go.Script
    beforeCommands:
      - go mod init script
      - go get github.com/kestra-io/kestra-go-sdk # assuming we have equivalent to kestra's pip package for Go
    script: |
      package main

      import (
          "fmt"
          "net/http"
          "io/ioutil"
          "github.com/kestra-io/kestra-go-sdk"
      )

      func main() {
          resp, err := http.Get("https://kestra.io")
          if err != nil {
              fmt.Println("Error:", err)
              return
          }
          defer resp.Body.Close()

          body, _ := ioutil.ReadAll(resp.Body)
          fmt.Println(resp.StatusCode)

          kestra.Outputs(map[string]interface{}{
              "status": resp.StatusCode,
              "text":   string(body),
          })
      }

as a workaround for you, for now, we support Go as a container task in Shell https://kestra.io/docs/how-to-guides/golang

@anna-geller anna-geller added area/plugin Plugin-related issue or feature request and removed area/backend Needs backend code changes area/frontend Needs frontend code changes labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants