3 ms·
This gives me hope to ease running Go code for CI jobs directly from GitHub workflow YAML files using goeval [1]. However goeval doesn't yet have direct suppor
by dolmen 2y ago
This gives me hope to ease running Go code for CI jobs directly from GitHub workflow YAML files using goeval [1].
However goeval doesn't yet have direct support for file input (only stdin), so shell tricks are needed.
So far the way is:
run: |
go run github.com/dolmen-go/goeval@v1 - <<'EOF'
fmt.Println("Hello")
EOF
but this requires a bit of boilerplate.
Disclaimer: I'm the author of goeval.
[1] https://github.com/dolmen-go/goeval https://github.com/dolmen-go/goeval
- michaelmior 2y agoWhy do you need any shell "tricks"? Wouldn't this work? go run github.com/dolmen-go/goeval@v1 - < file.go
- mdaniel 2y agoI believe the difference is that in your example file.go needs to live in the repo (or created by a previous step:) whereas reading from stdin allows writing the logic in the .yaml itself, and thus is subject to uses: or other reuse tricks
- michaelmior 2y agoSure. But the previous post seemed to suggest that tricks were needed because goeval doesn't support reading from files.
- dolmen 2y agoI'm trying to use goeval as a GitHub workflow shell, as this is the subject of the blog post. GitHub requreq {0} to be present on the shell line.
- mdaniel 2y agoI went to the repo to find out if your program automatically converted spaces into tabs but it seems it is more oriented toward oneliner expressions If you're going to plug your toy in this context, showing something more relevant than "print hello" would have saved me the click