Skip to content

deependujha/go-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Codes

  • Document you go code using godoc

Basic Go features

Go pass arguments to file
for i, val := range os.Args{
        fmt.Println!("i", i, "; val", val)
    }
Yield in go
func YieldFunction() <-chan int {
    ch := make(chan int)
    go func() {
        defer close(ch)
        for i := 0; i < 10; i++ {
            ch <- i // Yield data to the consumer
        }
    }()
    return ch
}

func main() {
    data := YieldFunction()
    for val := range data {
        // Process data concurrently
        fmt.Println(val)
    }
}

Cool CLI projects


libraries


CLI


WebDev (Backend)

Publish Go package (cli/ library)