Skip to content

Repository files navigation

go scripting

  • beautified Go syntax
  • embedded gos.* common sense mini framework to facilitate operations
  • supports full Go code

how to run

  • cat ./samples/01/hello-world.gos | gos
  • gos ./samples/01/hello-world.gos
  • chmod +x ./samples/01/hello-world.gos && ./samples/01/hello-world.gos

how to install

  • go: go install github.com/codemodify/gos@latest
  • curl: curl -LkO https://raw.github.com/codemodify/gos@v1.0.0 && chmod +x gos

where to start

  • check the samples folder
  • start at samples/01/hello-world.gos
  • move to next sample, they build incrementatlly on each other
  • check samples/05/pcp.gos it shows a parallelized version of the CP

beautified Go syntax

  • it is a mix of best parts from Go / JS / Rust
  • below is everything-in-one showcase
#!/usr/bin/envgosfuncmain() {
vara="hello world"varb=1varc=2.0vard=truevare= {
"a": a,
"b": b,
"c": c,
"d": d,
}
varf= [
a,
b,
c,
d,
]
varg=gos.Helpers.Strings.Format("%s", "hello world")
varh= [
a,
b,
c,
d,
]
// first runs BLOCK-A then BLOCK-Bgos.Flow.Run(()=>{
//// BLOCK-A//gos.Terminal.Println(a)
gos.Terminal.Println(b)
gos.Terminal.Println(c)
gos.Terminal.Println(d)
}).Run(()=>{
//// BLOCK-B//gos.Terminal.Println(e)
gos.Terminal.Println(f)
gos.Terminal.Println(g)
gos.Terminal.Println(h)
})
// runs BLOCK-A at the same time with BLOCK-Bgos.Flow.RunParallel(()=>{
//// BLOCK-A//gos.Terminal.Println(a)
gos.Terminal.Println(b)
gos.Terminal.Println(c)
gos.Terminal.Println(d)
}).RunParallel(()=>{
//// BLOCK-B//gos.Terminal.Println(e)
gos.Terminal.Println(f)
gos.Terminal.Println(g)
gos.Terminal.Println(h)
}).OnDone(()=>{
gos.Terminal.Println("PARALLEL CODE DONE")
})
gos.Terminal.Println("POST PARALLEL continue")
}

dox - embedded common sense mini framework

gos.Flowgos.Terminalgos.Execgos.Helpers

About

Go lang scripting

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages