将两个文件合并,方法很多
package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
)
func main() {
buf1,_ := ioutil.ReadFile("a.go")
buf2,_ := ioutil.ReadFile("b.go")
file,_ := os.OpenFile("c.go",os.O_CREATE | os.O_RDWR | os.O_APPEND,0666)
defer file.Close()
writer := bufio.NewWriter(file)
writer.Write(buf1)
writer.Write(buf2)
writer.Flush()
}