[go-nuts] No time.Duration#UnmarshalText; is there a good reason?

2022-01-17 Thread Corin Lawson
It seems obvious (to me) that the encoding.TextUnmarshaler interface could be implemented for time.Duration (it is implemented for time.Time, afterall). The fact that it is not gives me pause... is there a good reason that the stdlib has not done this? What issues am I facing if I do this:

Re: [go-nuts] Not used var error

2022-01-17 Thread Ian Lance Taylor
On Mon, Jan 17, 2022 at 7:07 PM Paulo Júnior wrote: > > I'm studying about if statement and comma ok construction and I'm not sure > why the piece of code (https://go.dev/play/p/ScFJsih6lwR) bellow does not > work. The compiler says that: x declared but not used. However, x is used in > the

[go-nuts] Not used var error

2022-01-17 Thread Paulo Júnior
Hi all. I'm studying about *if statement* and *comma ok construction* and I'm not sure why the piece of code (https://go.dev/play/p/ScFJsih6lwR) bellow does not work. The compiler says that: *x declared but not used*. However, *x* is used in the second *if statement *of the *main function*, as

Re: [go-nuts] Add to existing Go Package

2022-01-17 Thread Richard Masci
OK Thanks!! On Mon, Jan 17, 2022 at 1:03 PM Axel Wagner wrote: > On Mon, Jan 17, 2022 at 6:57 PM Rich wrote: > >> What I am worried about is that my version of log will diverge from the >> Go standard log package. Is there a way to extend an existing package so >> that my adds to the log

[go-nuts] Re: Add to existing Go Package

2022-01-17 Thread Uli Kunitz
> server.Version, server.Address, server.Port) > > That would print to both stdout and to the logfile lgOut is configured for. > Ex: > 20220117-13:45 | Server Version 1.0.1 Started and listens on > 127.0.0.1:8080" > > What I am worried about is that my version of log w

Re: [go-nuts] Add to existing Go Package

2022-01-17 Thread 'Axel Wagner' via golang-nuts
On Mon, Jan 17, 2022 at 6:57 PM Rich wrote: > What I am worried about is that my version of log will diverge from the Go > standard log package. Is there a way to extend an existing package so > that my adds to the log package pulls from whatever happens to be the most > current version of

[go-nuts] Add to existing Go Package

2022-01-17 Thread Rich
er.Version, server.Address, server.Port) That would print to both stdout and to the logfile lgOut is configured for. Ex: 20220117-13:45 | Server Version 1.0.1 Started and listens on 127.0.0.1:8080" What I am worried about is that my version of log will diverge from the Go standard log package.