From f069c2ca2d7a1072c4029294a91bfa0f5ae043d5 Mon Sep 17 00:00:00 2001 From: nabim777 Date: Mon, 28 Aug 2023 14:22:31 +0545 Subject: [PATCH] trying to fix git lint --- main.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/main.go b/main.go index 257430c..6cd2025 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,8 @@ import ( "io/ioutil" "log" "os" + "fmt" + "io" "path/filepath" "strings" @@ -237,6 +239,37 @@ func checkAnd(out io.Writer) int { } func main() { + file, err := os.Create("example.txt") + if err != nil { + fmt.Println("Error creating file:", err) + return + } + defer file.Close() + + message := "Hello, world!" + + _, err = io.WriteString(file, message) + if err != nil { + fmt.Println("Error writing to file:", err) + return + } + + source := "Source content." + destFile, err := os.Create("copy.txt") + if err != nil { + fmt.Println("Error creating destination file:", err) + return + } + defer destFile.Close() + + _, err = io.Copy(destFile, file) + if err != nil { + fmt.Println("Error copying data:", err) + return + } + + fmt.Println("Write and copy operations completed successfully.") + out := new(bytes.Buffer) exitStatus := 0 if len(os.Args) < 2 {