Re: [go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-13 Thread Xiangdong Ji
Thanks Wagner. I concur that there might be a bug, or at least the documentation could CLARIFY whether analyzer's option is not supported or not, referring to the usage of 'go vet' I assume the answer would be 'no'. I tried to modify fieldalignment to turn its '-fix' option on by default, chang

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Adrian Ho
On 14/4/21 6:39 am, Orson Cart wrote: So, to clarify: 1/ I have a proxy (Fiddler) running locally on port 2/ my /etc/hosts file has an entry as follows: 127.0.0.1 fiddler 3/ My HTTP_PROXY and HTTPS_PROXY environment variables are set to http://fiddler:  and http

Re: [go-nuts] Building gollvm fails on the latest commit

2021-04-13 Thread 'Than McIntosh' via golang-nuts
Thanks for reporting. I'll look into sending a CL. Cheers, Than On Tue, Apr 13, 2021 at 6:09 PM Khanh TN wrote: > Hi, I'm building gollvm with both gollvm and LLVM on the latest commit. > It fails and the error reads: > [..]/llvm-project/llvm/tools/gollvm/passes/GoNilChecks.cpp:363:23: error:

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Orson Cart
So, to clarify: 1/ I have a proxy (Fiddler) running locally on port 2/ my /etc/hosts file has an entry as follows: 127.0.0.1 fiddler 3/ My HTTP_PROXY and HTTPS_PROXY environment variables are set to http://fiddler: and https://fiddler:

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Orson Cart
So, to clarify: With my HTTP_PROXY and HTTPS_PROXY environment variables set to http://localhost: and https://localhost: respectively, if I issue a request via curl then that request is picked up by the proxy. However if I make the same request from my go application, the request appea

[go-nuts] Building gollvm fails on the latest commit

2021-04-13 Thread Khanh TN
Hi, I'm building gollvm with both gollvm and LLVM on the latest commit. It fails and the error reads: [..]/llvm-project/llvm/tools/gollvm/passes/GoNilChecks.cpp:363:23: error: ‘NoAlias’ was not declared in this scope if (AAResult != NoAlias) ^~~ [..]/llvm-project/

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Orson Cart
Thanks for the reply. Yes I did add an alias to the /etc/hosts file and it makes no difference. The requests still bypass the proxy. As you point out it's possible to achieve the goal in code but I'd really like to do it without changing the code if at all possible. I'm also just really curio

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread 'wagner riffel' via golang-nuts
On Tue Apr 13, 2021 at 7:07 PM UTC, Orson Cart wrote: > I'm perplexed :( > Did you tried the /etc/hosts? I think that would do it, if not, something like this may do the trick: if debug { t := http.DefaultTransport.(*http.Transport) t.Proxy = func(r *http.Request) (*url.URL, error

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Orson Cart
Please accept my ay apologies. I'd misunderstood the documentation. I was looking for a reason why my go application's requests aren't being sent to the proxy that I've specified using HTTP_PROXY and HTTPS_PROXY. When I saw the comment in the documentation I thought I'd found an explanation eve

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread 'wagner riffel' via golang-nuts
On Tue Apr 13, 2021 at 2:14 PM -03, Orson Cart wrote: > Can anyone explain the reasoning behind this? It rather interferes with > debugging traffic using a local proxy like Fiddler. > My guess here it's for preventing the remote from tricking the proxy to make request to internal services that cou

[go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-13 Thread Orson Cart
>From the documentation for ProxyFromEnvironment : "As a special case, if req.URL.Host is "localhost" (with or without a port number), then a nil URL and nil error will be returned." Can anyone explain the reasoning behind this? It

[go-nuts] Why is go ignoring my HTTP_PROXY environment variable

2021-04-13 Thread Orson Cart
I am trying to use Fiddler to debug some issues in a go application. To do this I need to make the application use Fiddler's proxy endpoint (127.0.0.1:). I can do this in code but I'd rather not as it would mean updating the code just for the purpose of this debugging session. As I underst

Re: [go-nuts] Case for Cond.WaitTimeout()

2021-04-13 Thread Robert Engels
Have the channel hold a slice of objects and process them as a batch. Batch in - batch out. Typically unless your traffic is bursty - a faster producer than consumer will either cause blocking, data loss (drops) or failure (oom). > On Apr 13, 2021, at 8:00 AM, Roman Leventov wrote: > >  >

Re: [go-nuts] Case for Cond.WaitTimeout()

2021-04-13 Thread Roman Leventov
Jesper, a single channel works if I provision it with big enough capacity (1000), but this feels like an antipattern which can break. Still, this is probably the most practical option. Brian, thanks for sharing, yes this pattern solves my problem much simpler than I have. Although it doesn't feel

Re: [go-nuts] Case for Cond.WaitTimeout()

2021-04-13 Thread Brian Candler
Bryan Mill's presentation on go concurrency patterns is well worth watching all the way through: https://www.youtube.com/watch?v=5zXAHh5tJqQ There are lots of code snippets which are directly relevant to what you're trying to do, e.g. from 20:48 is a queue with Get, and 21:59 a queue with GetMa

Re: [go-nuts] Case for Cond.WaitTimeout()

2021-04-13 Thread Jesper Louis Andersen
On Tue, Apr 13, 2021 at 12:53 PM Roman Leventov wrote: > type Frame struct{} > > type Connection struct { > sem*semaphore.Weighted // from http://golang.org/x/sync/semaphore > mu sync.Mutex > frames []*Frame > } > > My immediate hunch when reading your code was: type Connection struct {

Re: [go-nuts] Give us const arrays please :)

2021-04-13 Thread tapi...@gmail.com
More immutable value proposals: https://github.com/go101/go101/wiki/Go-immutable-value-proposal-list On Sunday, April 11, 2021 at 8:47:31 PM UTC-4 Kurtis Rader wrote: > This has been formally requested several times. For example: > > https://github.com/golang/go/issues/20443 > https://github.com

[go-nuts] Case for Cond.WaitTimeout()

2021-04-13 Thread Roman Leventov
I'm trying to implement a simple Connection type: type Connection { // Puts a batch of frames into a queue which can later be read. // This method is called only from a single goroutine. PutFrames(frames []*Frame) // Returns a frame from the queue if present, with timeout. // This method

Re: [go-nuts] Why can I not install external packages?

2021-04-13 Thread Tenjin
There we go! It is now working thanks alot guys. On Tuesday, April 13, 2021 at 10:57:22 AM UTC+1 Jan Mercl wrote: > On Tue, Apr 13, 2021 at 11:40 AM Tenjin wrote: > > > So I am using WSL2 to develop using golang but for some reason I am > unable to use other peoples packages. > > For example: I

Re: [go-nuts] Why can I not install external packages?

2021-04-13 Thread Jan Mercl
On Tue, Apr 13, 2021 at 11:40 AM Tenjin wrote: > So I am using WSL2 to develop using golang but for some reason I am unable to > use other peoples packages. > For example: I am wanting to use the sql driver > https://github.com/go-sql-driver/mysql I am able to go get it and it says it > is dow

[go-nuts] Re: Why can I not install external packages?

2021-04-13 Thread Brian Candler
... Try the following: mkdir myprog cd myprog go mod init myprog ... now use your editor to create main.go which references some third-party package, here is a minimal example: -- package main import _ "github.com/go-sql-driver/mysql" func main() { } -- ... then: go mod

[go-nuts] Why can I not install external packages?

2021-04-13 Thread Tenjin
So I am using WSL2 to develop using golang but for some reason I am unable to use other peoples packages. For example: I am wanting to use the sql driver https://github.com/go-sql-driver/mysql I am able to go get it and it says it is downloading then it downloads but when I go to use it in my p