mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 08:01:26 +00:00
fix(go-client): improve go-client variable and resource handling
This commit is contained in:
@@ -124,6 +124,11 @@
|
||||
editor.insertAtBeginning('import wmill\n')
|
||||
}
|
||||
editor.insertAtCursor(`wmill.get_variable("${path}")`)
|
||||
} else if (lang == 'go') {
|
||||
if (!editor.getCode().includes('wmill "github.com/windmill-labs/windmill-go-client"')) {
|
||||
editor.insertAtBeginning('import wmill "github.com/windmill-labs/windmill-go-client"\n')
|
||||
}
|
||||
editor.insertAtCursor(`v, _ := wmill.GetVariable("${path}")`)
|
||||
}
|
||||
sendUserToast(`${name} inserted at cursor`)
|
||||
}}
|
||||
@@ -163,6 +168,11 @@
|
||||
editor.insertAtBeginning('import wmill\n')
|
||||
}
|
||||
editor.insertAtCursor(`wmill.get_resource("${path}")`)
|
||||
} else if (lang == 'go') {
|
||||
if (!editor.getCode().includes('wmill "github.com/windmill-labs/windmill-go-client"')) {
|
||||
editor.insertAtBeginning('import wmill "github.com/windmill-labs/windmill-go-client"\n')
|
||||
}
|
||||
editor.insertAtCursor(`r, _ := wmill.GetResource("${path}")`)
|
||||
}
|
||||
sendUserToast(`${path} inserted at cursor`)
|
||||
}}
|
||||
|
||||
@@ -54,11 +54,13 @@ export const GO_INIT_CODE = `package inner
|
||||
import (
|
||||
"fmt"
|
||||
"rsc.io/quote"
|
||||
// wmill "github.com/windmill-labs/windmill-go-client"
|
||||
)
|
||||
|
||||
func main(x string) (interface{}, error) {
|
||||
fmt.Println("Hello, World")
|
||||
fmt.Println(quote.Opt())
|
||||
// v, _ := wmill.GetVariable("g/all/pretty_secret")
|
||||
return x, nil
|
||||
}
|
||||
`
|
||||
|
||||
@@ -19,7 +19,7 @@ type ClientWithWorkspace struct {
|
||||
}
|
||||
|
||||
func GetClient() (ClientWithWorkspace, error) {
|
||||
base_url := os.Getenv("BASE_INTERNAL_URL")
|
||||
base_url := os.Getenv("BASE_INTERNAL_URL") + "/api"
|
||||
workspace := os.Getenv("WM_WORKSPACE")
|
||||
token := os.Getenv("WM_TOKEN")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user