fmt中的fmt.Println()是默认输出到stdout(standard output)的,而println是输出到stderr(standard error)

println

// The println built-in function formats its arguments in an
// implementation-specific way and writes the result to standard error.
// Spaces are always added between arguments and a newline is appended.
// Println is useful for bootstrapping and debugging; it is not guaranteed
// to stay in the language.
func println(args ...Type)

fmt.Println

// Println formats using the default formats for its operands and writes to standard output.
// Spaces are always added between operands and a newline is appended.
// It returns the number of bytes written and any write error encountered.
func Println(a ...any) (n int, err error) {
    return Fprintln(os.Stdout, a...)
}

发表回复

您的电子邮箱地址不会被公开。

Captcha Code