On 12/04/22, 'Sean Liao' via golang-nuts (golang-nuts@googlegroups.com) wrote: > > output, err := os.Create(o) > The short variable declaration you used to create `err` also shadows > `output`.
Thanks very much for pointing out this shadowing problem. > > var err error > output, err = os.Create(o) > > > func main() { > > > > // o := "-" // use stdin > > o := "/tmp/output.txt" // or a file > > > > var output io.Writer > > if o == "-" { > > output = os.Stdout > > } else { > > output, err := os.Create(o) ... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/YlU7xFYNKZ9BBcEj%40campbell-lange.net.