// Truncate file to size 100 bytes err := os.Truncate("myfile.txt", 100) if err != nil { fmt.Println("Error truncating file:", err) } // Truncate file to zero size (empty file) err = os.Truncate("myfile.txt", 0) if err != nil { fmt.Println("Error truncating file:", err) } // Truncate file to its current size (no effect) fi, err := os.Stat("myfile.txt") if err != nil { fmt.Println("Error getting file info:", err) } err = os.Truncate("myfile.txt", fi.Size()) if err != nil { fmt.Println("Error truncating file:", err) }Package Library: `os` package.