Sucksβ

Nota Bene.

This page is a draft, because it covers very few aspects of Go.

Currently missing parts: correct page structure, perfomance section, types section, missing features section, references to related benchmarks, libraries, RFCs, etc.. Feel free to add information yourself with Edit on GitHub link.
We don't serve ads
and don't ask you to buy shit, because that sucks. If you want, be our patron ( patreon, paypal, liberapay ), that's it.

Core language

func randomNumber() *int {
	return nil
}

func main() {
	a := 1
	b := randomNumber()
	fmt.Printf("%d\n", a+*b) // Runtime panic due to nil pointer
}
if v, err := otherFunc(); err != nil {
	return nil, err
} else {
	return doSomethingWith(v), nil
}
d := loadData()

for i := range d {
	// if d is a channel, i is an element read from the channel
	// if d is a map, i is a map key
	// otherwise, i is an array/slice/string index
}

for i, j := range d {
	// if d is a channel, this is illegal!
	// (even though when receiving normally from a channel,
	//  you can get a second boolean value indicating whether it is closed)
	// if d is a string, i is an index and j is a rune (not necessarily d[i])
	// otherwise, i is an array/slice index or map key and j is d[i]
}
func foo1(i bool) (r int) {
	if i {
		r := 12
		fmt.Println(r)
	}
	return  // returns 0
}

func foo2(i bool) (r int) {
	if i {
		r = 12
		fmt.Println(r)
		return  // returns 12
	}
	return  // returns 0
}

func foo3(i bool) (r int) {
	if i {
		r := 12
		fmt.Println(r)
		return  // ERROR: r is shadowed during return
	}
	return
}
func dogma() (i int) {
	defer func() {
		i++
	}()
	return 2 + 2
}

func main() {
	fmt.Println(dogma())  // prints 5
}
func returnsError() error {
	var p *MyError = nil
	if bad() {
		p = ErrBad
	}
	return p // Will always return a non-nil error.
}

Concurrency

select {
case <-chan1:
	doSomething()
default:
	select {
	case <-chan1:
		doSomething()
	case <-chan2:
		doSomethingElse()
	}
}

Standard library

Toolchain

Community

Go sucks, here is why. We hope, that article will help you to choose the perfect programming language for you. Go sucks, here is why. 2020 Your Language Sucks Go Go
We don't serve ads
and don't ask you to buy shit, because that sucks. If you want, be our patron ( patreon, paypal, liberapay ), that's it.