Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,4 @@
func main() {
inf:
goto inf
}

View file

@ -0,0 +1,18 @@
import "os"
func processFile() {
f, err := os.Open("file")
if err != nil {
// (probably do something with the error)
return // no need to close file, it didn't open
}
defer f.Close() // file is open. no matter what, close it on return
var lucky bool
// some processing
if (lucky) {
// f.Close() will get called here
return
}
// more processing
// f.Close() will get called here too
}

View file

@ -0,0 +1,16 @@
package main
import "fmt"
func printOnes() {
for {
fmt.Println("1")
}
}
func main() {
go printOnes()
for {
fmt.Println("0")
}
}

View file

@ -0,0 +1,8 @@
func answer(phone1, phone2 chan int) {
select {
case <-phone1:
// talk on phone one
case <-phone2:
// talk on phone two
}
}