715 karma · joined August 9, 2009
To get a sense of it, take a look at a failing test in a language such as Python that uses asserts for testing and compare it to the equivalent written in Go. Quite often, the error message in Go will be clear and to the point. On the other hand, I've seen plenty of assertion based tests in other languages that report inane things like "1 != 2" or "true != false" when they fail.
Go encourages putting the effort into this up front. It pays off later when things go wrong and you want to know why.
Luckily, there seems to be a viable replacement for a small fraction of the cost: https://goo.gl/176cos.
If you want something light like Clojure and don't need any Java libs, try Pixie. https://github.com/pixie-lang/pixie
If you want something light not like Clojure, Go is a great choice. It's fast to compile, fast to run and doesn't gobble up your memory unless you force it to.
[1] https://www.ebiomedia.com/the-biology-classics-paramecium-be...
[2] http://www.ruf.rice.edu/~bioslabs/studies/invertebrates/micr...
package main
import "fmt"
import "runtime"
func main() {
go hog()
for i := 0; ; i++ {
fmt.Println(i)
}
}
func hog() {
for {
runtime.Gosched()
}
} package main
import "fmt"
func main() {
go hog()
for i := 0; ; i++ {
fmt.Println(i)
}
}
func hog() {
for {
}
}
It stalls after about three seconds on go version 1.6.Here's the issue on github:
Pid ! {hello, world}
receive
{hello, world} ->
io:format("Received hello.~n", [])
end package main;
import (
"fmt"
"net"
)
func main() {
hosts := []string { "www.google.com", "www.example.com", "www.python.org" }
c := make(chan string)
for _, h := range(hosts) {
go get_ip(h, c)
}
for i := 0; i < 3; i++ {
fmt.Println(<-c)
}
}
func get_ip(host string, c chan string) {
addrs, err := net.LookupHost(host)
if err != nil {
fmt.Println("Host not found:", host)
c <- host + ": <error>"
return
}
c <- host + ": " + addrs[0]
}