Re: [go-nuts] [Macos/Apple M1] HTTP client requests to ".local" domain adds 5 seconds overhead

2021-03-31 Thread Jonathan Hedrén
Thanks! I added the IPv6 loopback address to all my host names in /etc/hosts (i.e. "::1 mydomain.local") and it now works as expected. I guess Go's DNS resolver was timing out at the first attempt, that's why I consistently had that 5 second delay. torsdag 1 april 2021 kl. 07:40:10 UTC+2 skrev

[go-nuts] Re: Design patterns. builder ?

2021-03-31 Thread alex-coder
I apologize for being so intrusive. I will only provide links to educational resources, in case it would be interesting for anyone. GitHub - AlexanderGrom/go-patterns: Design patterns in Golang (in russian) Go Patterns · GitBook (tmrts.com)

Re: [go-nuts] [Macos/Apple M1] HTTP client requests to ".local" domain adds 5 seconds overhead

2021-03-31 Thread Shulhan
On Wed, 31 Mar 2021 01:47:43 -0700 (PDT) Jonathan Hedrén wrote: > I've set up a development environment on my MacBook Pro M1 (running > Big Sur 11.2.3, Go 1.16.2) with a number of small Go/.Net HTTP APIs > that are communication with each other. To replicate our production > infrastructure I've s

Re: [go-nuts] Transferring host's go-mod-download cache into docker container

2021-03-31 Thread Andrew Walker
There are a couple ways I know of that you can do this. You can vendor or copy as you mention. Another approach is to create a "build" image that contains relevant credentials and a few `go env -w` directives to set up your build environment, which you build separately and derive other project

Re: [go-nuts] [Macos/Apple M1] HTTP client requests to ".local" domain adds 5 seconds overhead

2021-03-31 Thread Wojciech S. Czarnecki
Dnia 2021-03-31, o godz. 01:47:43 Jonathan Hedrén napisał(a): > Whenever an HTTP request is sent from a Go application to any of the > ".local" APIs, 5 seconds are added to the response time. https://www.bram.us/2011/12/12/mamp-pro-slow-name-resolving-with-local-vhosts-in-lion-fix/ TL;DR do NO

Re: [go-nuts] Can I import a package from a git submodule?

2021-03-31 Thread Marcin Romaszewicz
It's really annoying to deal with when you have private repositories, but try to simply `import RepoB/bar` from ModuleA, and don't bother with the submodule stuff. Module SHAs will replicate submodule functionality in a way that's more compatible with the language. On Wed, Mar 31, 2021 at 1:46 PM

Re: [go-nuts] Can I import a package from a git submodule?

2021-03-31 Thread 'Axel Wagner' via golang-nuts
AIUI, if you nest modules (that is, a subdirectory of a module containing a directory with its own `go.mod`), the "inner" module is not considered part of the "outer" module. In particular, it would also not be included in the module zip (which is the primary way modules are distributed - *not* as

Re: [go-nuts] I'm missing godoc for local packages after converting to modules.

2021-03-31 Thread Hotei
Thanks to all for assistance with this! Got it working with (perhaps) the most recent version - though once again it looks to have moved from the path(s) mentioned above. Part of my problem was not looking specifically for the "Third Party" section since before my code had all been lumped in

[go-nuts] Can I import a package from a git submodule?

2021-03-31 Thread cpu...@gmail.com
Consider this layout: - Repo A contains module foo - Repo B contains module bar (of course ;) - Repo B is added as submodule to repo A at /baz I was expecting that I can import "foo/baz/bar" in repo A, but that leads to error ("no required module provides package..."). Shouldn't t

Re: [go-nuts] gollvm hasn't a good support to reflect and pthread?

2021-03-31 Thread 'Ugorji Nwoke' via golang-nuts
Than, Appreciate you saying that. And you're very welcome. On Tue, Mar 30, 2021 at 8:29 PM Than McIntosh wrote: > Thank you @Ugorji Nwoke , I appreciate your going > the extra mile to include gollvm in your testing. > > Cheers, Than > > > On Tue, Mar 30, 2021 at 11:17 AM Ugorji Nwoke wrote:

Re: [go-nuts] Code Review Checklist: Go Concurrency

2021-03-31 Thread John Dreystadt
As still quite the newbie at Go, I agree about the usefulness. Several years ago I ran into a paper on this subject at a blog called the Morning Paper (sadly gone quiet). The paper itself is at https://songlh.github.io/paper/go-study.pdf . It has some examples and might be a useful addition to the

Re: [go-nuts] Finding error type for `errors.As` and `errors.Is`

2021-03-31 Thread roger peppe
On Wed, 31 Mar 2021 at 18:05, 'Michael Schaller' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hi everyone, > > I often encounter deep error chains where errors are wrapped across > several Go packages and that makes it often hard to find a usable error > type to use with `errors.As` or

Re: [go-nuts] Somone knows about a good monkey patching library

2021-03-31 Thread 'Pinkesh Bardiya' via golang-nuts
https://github.com/undefinedlabs/go-mpatch On Monday, January 13, 2020 at 2:35:26 PM UTC+5:30 Jason E. Aten wrote: > If you call through an interface, you get runtime, dynamic dispatch. > -- This message contains confidential information and is intended only for the individual to whom it is

[go-nuts] [Macos/Apple M1] HTTP client requests to ".local" domain adds 5 seconds overhead

2021-03-31 Thread Jonathan Hedrén
I've set up a development environment on my MacBook Pro M1 (running Big Sur 11.2.3, Go 1.16.2) with a number of small Go/.Net HTTP APIs that are communication with each other. To replicate our production infrastructure I've set up /etc/hosts with ".local" domains pointing to 127.0.0.1. An nginx

[go-nuts] Finding error type for `errors.As` and `errors.Is`

2021-03-31 Thread 'Michael Schaller' via golang-nuts
Hi everyone, I often encounter deep error chains where errors are wrapped across several Go packages and that makes it often hard to find a usable error type to use with `errors.As` or `errors.Is`. Could it make sense to add an `errors.Chain` function to Go that returns a slice with tuples of

[go-nuts] Re: Design patterns. builder ?

2021-03-31 Thread alex-coder
Even not commercial but rather industrial. I have found at least 4 educational already. Thank you. On Wednesday, March 31, 2021 at 3:26:20 PM UTC+3 alex-coder wrote: > Hi All, > > I'm a novice to golang. > looking for a commercial example of implementing the builder pattern > in the context of

[go-nuts] Design patterns. builder ?

2021-03-31 Thread alex-coder
Hi All, I'm a novice to golang. looking for a commercial example of implementing the builder pattern in the context of the absence of dynamic dispatching in golang. Thank you. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Brian Candler
I think that in principle you are correct to perform your reads inside a goroutine, to allow them to be received asynchronously. If Read() blocks, it's not a problem unless you want to shut down the connection from the server side, and you can do that by setting a read timeout which will unbloc

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Perry Couprie
The protocol i am programming for sends a header of 8 bytes that contains a body length. My problem is dat c.Read(buf) is blocking. Can i read from the tcp connection non blocking ? On Wednesday, March 31, 2021 at 9:08:48 AM UTC+2 Brian Candler wrote: > On Wednesday, 31 March 2021 at 04:13:12

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Brian Candler
On Wednesday, 31 March 2021 at 04:13:12 UTC+1 matt@gmail.com wrote: > for i := 0; i > 5; i++ { > // handle a single message > n, err := c.Read(buf) > if err == io.EOF { > break > } > fmt.Fprintf(c, "Message Count %d, Data %s", i+1, buf[:n]) > I will point out that

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Perry Couprie
I am programming a binary protocol. The demo with telnet and the max of 5 messages was for testing this problem. I need to be able send even when not recieving data. The program now works, when de the client breaks the connection, there is no problem. When de server stops the connection it some