Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Nim language bindings for golib - a library that (ab)uses gccgo to bring Go's channels and goroutines to the rest of the world

Subscribe to updates I use golib-nim

Statistics on golib-nim

Number of watchers on Github 49
Number of open issues 0
Average time to close an issue 16 days
Main language Nimrod
Average time to merge a PR 9 days
Open pull requests 0+
Closed pull requests 0+
Last commit almost 2 years ago
Repo Created over 4 years ago
Repo Last Updated almost 2 years ago
Size 67 KB
Organization / Authorstefantalpalaru
Page Updated
Do you use golib-nim? Leave a review!
View golib-nim activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating golib-nim for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Nim language bindings for golib - a library that (ab)uses gccgo to bring Go's channels and goroutines to the rest of the world.

syntax comparison

feature Go Nim
channel type
(here in a
func S(a, b chan uint) int { proc S(a, b: chan[uint]): int =
channel types
chan<- float64
<-chan int
create channel c := make(chan int)
c2 := make(chan int, 1)
var c = make_chan(int)
var c2 = make_chan(int, 1)
send value
to channel
c <- 1 c <- 1
receive value
from channel
av := <-a
av, bv := <-a, <-b
cv, ok := <-c
var av = <-a
var (av, bv) = (<-a, <-b)
var (cv, ok) = <--c
over channel
for av := range a for av in a
channel select select {
case c0 <- 0:
case <-c1:
case i2 = <-c2:
case i3, ok3 = <-c3:
case li[0] = <-c4:
case li[f()] = <-c5:
break LOOP
scase c0 <- 0: discard
scase <-c1: discard
scase (i2 = <-c2): discard
scase ((i3, ok3) = <--c3): discard
scase (li[0] = <-c4): discard
scase (li[f()] = <-c5): discard
break LOOP
declare goroutine func f(x, y int) {
println(x, y)
proc f(x, y: int) {.goroutine.} =
echo(x, " ", y)
launch goroutine go f(1, 2) go f(1, 2)
lambda goroutine go func(c chan int) { c <- 1 }(r) Unsupported. Workaround:
proc f(c: chan[int]) {.goroutine.} = c <- 1
go f(r)
time.Sleep(100 * time.Millisecond) go_sleep_ms(100)
yield to another
runtime.Gosched() go_yield()
run the goroutines
on all the available
CPU cores
runtime.GOMAXPROCS(runtime.NumCPU()) runtime_gomaxprocsfunc(runtime_ncpu)
special code
import golib

proc go_main() {.gomain.} =
# main code here

# not reached
# nim.cfg
--passC:"--std=gnu99 -fsplit-stack"
--passL:"-lgolib -lgo"
# or --gc:none

The initialization of the Go runtime (including the GC) is done in golib_main(), after which go_main() is launched as a goroutine and the main event loop is started. That's why you can't do heap memory allocation before go_main() runs and also why anything after golib_main() won't be reached - the event loop ends the program when go_main() exits.

API stability

The API is subject to change until the first version (0.0.1) is released. After this, backwards compatibility will become a priority.


  • golib
  • Nim > 0.17.0
  • gcc >= 6.3

build the benchmark and run tests


If you have a Nim repo in ../Nim/:

./configure NIM=../Nim/bin/nim

Or with the system-wide Nim and no GC (some tests and benchmarks will fail without the Go GC):

./configure --disable-gogc

Run tests:

make check

Benchmark (compare it with the ones from golib):

/usr/bin/time -v ./benchmarks/cw_nim


nimble install




golib-nim list of languages used
More projects by stefantalpalaru View all
Other projects in Nimrod