如何在golang中实现类似于unix中的cat的文本流?

I would like to implement a version of cat and golang, and modify it to make other useful programs

You should take a look at os.Open(...) and io.Copy(...) -- but, there's a lot more to it than just that.

Maybe you should really start with the tutorials on https://tour.golang.org/welcome/1

A cool project you can draw inspiration from is go-coreutils. It has Go implementations of the core GNU command-line utilities like cat and many others. Here is cat, for example.

Here is a start u can continue like that and manage flags etc ..

package main

import (
    "fmt"
    "io/ioutil"
    "os"
)

func main() {
    if len(os.Args) == 2 {
        c, err := ioutil.ReadFile(os.Args[1])
        if err != nil {
            fmt.Println(err)
            os.Exit(1)
        }
        fmt.Printf("%s
", string(c))
    } else {
        for {
            var newText string
            fmt.Scanf("%s", &newText)
            fmt.Println(newText)
        }
    }
}