[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
On Thursday 15 February 2024 at 10:31:40 am UTC+11 Jeremy French wrote: I really think the testability issue is the biggest one. Generally, testing the main package iscumbersome at least. So it's reasonable to say, "I'm not going to test the main package, but I will keep it so simple

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
On Wednesday 14 February 2024 at 10:23:37 pm UTC+11 Mike Schinkel wrote: I cannot speak for others but I can tell you why I keep my `main()` small: 1. I prefer to put as much logic into reusable packages as I can, and `main()` is not reusable outside the current app. This is understandable.

[go-nuts] Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
I see quite a few modules out there where they seem to be putting in as little into the main package as possible. Literally they will sometimes be a few lines: ``` import foobar func main() { os.Exit(foobar.Run()) } ``` Yet then go on to do all the things I would've thought are the domain of

Re: [go-nuts] What is a ordinary and exceptional error?

2023-10-04 Thread Jerry Londergaard
On Monday, 2 October 2023 at 12:00:35 am UTC+11 Axel Wagner wrote: On Sun, Oct 1, 2023 at 2:37 PM Jerry Londergaard wrote: I've been thinking about this point as well lately. I think I understand (at least some of) the conditions under which you would call a panic(), but I still don't quite

Re: [go-nuts] What is a ordinary and exceptional error?

2023-10-01 Thread Jerry Londergaard
I've been thinking about this point as well lately. I think I understand (at least some of) the conditions under which you would call a panic(), but I still don't quite grok why it's better than returning an error if that error is properly handled. If I panic(), then no defer() statements will

Re: [go-nuts] When to share an interface, and when not to.

2023-10-01 Thread Jerry Londergaard
where it's implemented, which risks misunderstanding the purpose of it entirely. On Wednesday, 27 September 2023 at 12:56:50 am UTC+10 burak serdar wrote: > On Tue, Sep 26, 2023 at 6:18 AM Jerry Londergaard > wrote: > > > > > > Do I need to be re-defining this interface everywhere

[go-nuts] When to share an interface, and when not to.

2023-09-26 Thread Jerry Londergaard
Hello, I'm trying to understand if I'm going overboard with defining interfaces where they are used (i.e am I re-defining them nu-necessarily). Here's an example. The interface is passed down from A->B->C where C (and only C) calls the DoThing() method of the interface:

Re: [go-nuts] Ensure context timeout behaviour from caller, or callee ?

2023-09-20 Thread Jerry Londergaard
Thu, 21 Sept 2023 at 12:40, burak serdar wrote: > On Wed, Sep 20, 2023 at 5:04 PM Jerry Londergaard > wrote: > > > > Are you comfortable though, *relying* on this behaviour down the stack > to enforce the timeout that was declared > > further up the stack (leaving potent

Re: [go-nuts] Ensure context timeout behaviour from caller, or callee ?

2023-09-20 Thread Jerry Londergaard
s like a bug in that code (i.e not the callers responsibility). On Thu, 21 Sept 2023 at 05:34, burak serdar wrote: > On Wed, Sep 20, 2023 at 7:47 AM Jerry Londergaard > wrote: > > > > When using a context.WithTimeout, I always felt that it should be the > fu

[go-nuts] Ensure context timeout behaviour from caller, or callee ?

2023-09-20 Thread Jerry Londergaard
When using a context.WithTimeout, I always felt that it should be the function where the context was created should be the one that ensures that it (the current function) does not block longer than intended. That is to say, it should call context.WithTimeout(), and then run the subsequent code