Go code snippets

The most important change to the language is the introduction of type aliases: a feature created to support gradual code repair. A type alias declaration has the form:

Type T1 = T2

Discussion

joesv always jokes, that golang is not ready for production .

Discussion

Language:

golang


Source:
package main

import "fmt"

func main(){
fmt.Println("Hello gophers")
}


Result:
Hello gophers

Discussion

Devansh has been warned (1/3)

Discussion

David banned Dream!

Discussion

package main in all files

Discussion

I run the code..

2
1
3

Discussion

My friends told to me, that the results can be 2 1 3 or 1 2 3

Discussion

I always got the results 2 1 3 too

Discussion

But I'm getting only ``2 1 3`

Discussion

But I'm only getting

2 1 3

Discussion

package main

import (
"fmt"
"sync"
"runtime"
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU() * 2)

var wg sync.WaitGroup

wg.Add(1)
go func() {
fmt.Println("1")
wg.Done()
}()


wg.Add(1)
go func() {
fmt.Println("2")
wg.Done()
}()

wg.Wait()
fmt.Println("3")
}

Discussion

This outputs both

2 1 3

and
1 2 3

Discussion

watch —interval 0.5 —differences "./main"

Discussion

Still

2 1 3

Discussion

I got

1 2 3

Discussion

Tap 🚀 has been warned (1/3)

Discussion

Yeah rollback/commit

so mutex purpose are just for locking ?

Discussion

robmans is there a way to

go get

package without the git history?

Discussion

NewPaymentGatewayImplementationServicePortType


https://golang.org/doc/effective_go.html

Discussion

Konstantin has been warned (1/3)

Discussion

Pouria banned Natnael!

Discussion

But there is time.Sleep everywhere.. is it normal??

Discussion