Neugram [1] aimed to make Go a better scripting tool, but unfortunately it seems the project is dead. Although Go+ says its focus is on data science, I think it could fill this niche too.
By the way: does Go+ have shebang support?
Neugram [1] aimed to make Go a better scripting tool, but unfortunately it seems the project is dead. Although Go+ says its focus is on data science, I think it could fill this niche too.
By the way: does Go+ have shebang support?
frodo ~ $ cat t.go
//opt/go/bin/go run $0 $@ ; exit
package main
import( "fmt" )
func main() {
fmt.Printf("Hello, world\n" );
}
frodo ~ $ ./t.go
Hello, world
Otherwise there are a bunch of go-interpreters out there, which can be used for adhoc scripting. I'm sure that in some circumstances they can be useful, but I've only used them for providing extensions / scripting to host-applications, rather than trying to use them interactively.The workarounds mentioned by you and the other commenter’s linked article are sub-optional in that they require a system-wide modification, require wrapper scripts, or are non-standard hacks.
What do you mean by a main-less script? And what would be "simple and fast" about it? If I want to try out something fast, I just do everything in a main.go and run it with "go run main.go", and that works well as a scripting language.
probably something that's common in "scripting" languages, where you don't have to wrap your code in main(), it just executes from the top:
myscript.py
-----------
print('hi')
vs myscript.go
-----------
func main() {
fmt.PrintLn('hi')
}