# Go Script Package Conflict Error
Getting consistent build errors when trying to run any Go script in Windmill:
What I've tried:
-
package main
with func main()
- package inner
with func Main()
- No package declaration
- // +build ignore
directive
- Even simplest scripts fail
Example script:
Questions:
1. What's the correct package/function signature for Go in Windmill?
2. How should dependencies be declared?
3. Any working Go script examples?
The error mentions inner_main.go
and runner.go
- are these Windmill-generated? How should my script interact with them?
Context: Trying to migrate performance-critical DB connectors from TS to Go. TypeScript/Python work fine, only Go has issues.
Thanks!7 Replies
Hello this works:
Thanks but I keep on getting the error:
ExecutionErr: exit code for "go build": 1, last log lines:
job=0197ad0c-a11a-82e2-dc4c-1718aee48506 tag=go worker=wk-default-x98kj-dGNof hostname=windmill-workers-default-647755dcd8-x98kj
--- GO DEPENDENCIES SETUP ---
go: no module dependencies to download
main.go:7:5: found packages main (inner_main.go) and inner (runner.go) in /tmp/windmill/wk-default-x98kj-dGNof/0197ad0c-a11a-82e2-dc4c-1718aee48506/go/inner
main.go:7:5: import "mymod/inner" is a program, not an importable package
Can you provide the script that fails @bubusi ? The snippet I provided seems to be fully functional. (I tested on cloud)
Sure. Many thanks for looking into it
I cannot reproduce the error with this script. Can you verify this works:
^^^ should work. What is the versions you are running?
Progress! The error is now just an unused variable.
However, discovered major limitation: Windmill Go requires ALL code in single main() function - no helper functions allowed. This makes complex scripts unmaintainable.
Thanks for your help!
This seems to work @bubusi