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(
On Tue, Apr 12, 2022 at 9:53 AM Rory Campbell-Lange
wrote:
> Attempting to write to a named file panics on go 1.17 on Linux with:
>
> panic: runtime error: invalid memory address or nil pointer dereference
> [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x46123d]
Not prov
> output, err := os.Create(o)
The short variable declaration you used to create `err` also shadows
`output`.
var err error
output, err = os.Create(o)
On Tue, Apr 12, 2022 at 8:53 AM Rory Campbell-Lange
wrote:
> I have a command line programme that can output to either stdout or a
> named file.
I have a command line programme that can output to either stdout or a named
file. Output to stdout, as commented out in the small example below, works
fine, but not to a named file.
Attempting to write to a named file panics on go 1.17 on Linux with:
panic: runtime error: invalid memory add