mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-23 21:34:47 +02:00
20 lines
377 B
Go
20 lines
377 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
firstText := "Пей, и дьявол тебя доведет до конца,\n"
|
|
secondText := "Йо-хо-хо, и бутылка рома!"
|
|
file, err := os.OpenFile("pirates2.txt", os.O_WRONLY, 0666)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer file.Close()
|
|
|
|
file.WriteString(firstText)
|
|
file.WriteString(secondText)
|
|
}
|