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

2021-04-14 Thread Orson Cart
On Wednesday, 14 April 2021 at 18:06:53 UTC+1 Adrian Ho wrote: > The "Name Resolution" section in https://golang.org/pkg/net/ says: > > On Unix systems, the resolver has two options for resolving names. It can > use a pure Go resolver that sends DNS requests directly to the servers > listed

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

2021-04-13 Thread Orson Cart
3 April 2021 at 22:26:06 UTC+1 Orson Cart wrote: > 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 &g

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

2021-04-13 Thread Orson Cart
appears to bypass the proxy and is sent directly. Any advice would be appreciated. On Tuesday, 13 April 2021 at 22:26:06 UTC+1 Orson Cart wrote: > 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

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

2021-04-13 Thread Orson Cart
curious now as to why the go libraries aren't honouring the environment variables. Thanks for the input. On Tuesday, 13 April 2021 at 21:36:48 UTC+1 wagner riffel wrote: > On Tue Apr 13, 2021 at 7:07 PM UTC, Orson Cart wrote: > > I'm perplexed :( > > > > Did you tried th

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

2021-04-13 Thread Orson Cart
to go direct, bypassing the proxy. I'm perplexed :( On Tuesday, 13 April 2021 at 19:17:10 UTC+1 wagner riffel wrote: > 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 l

[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?

[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

Re: [go-nuts] Re: Question about "go get", modules and indirect dependencies

2021-01-06 Thread Orson Cart
files. > > In the meantime, you could try `go list all` and/or `go mod tidy` after > your `go get`..? > > > On Wed, Jan 6, 2021 at 1:27 PM Orson Cart wrote: > >> Thanks for the advice Bryan. >> >> Sadly I tried using go mod download but I'm still seeing the same >>

[go-nuts] Re: Question about "go get", modules and indirect dependencies

2021-01-06 Thread Orson Cart
probably read them less than in does today; see > https://golang.org/issue/42723 for details; > > On Tuesday, January 5, 2021 at 2:10:05 PM UTC-5 Orson Cart wrote: > >> Apologies if this is a dumb question as I don't have a great deal of >> experience with modules. &

[go-nuts] Question about "go get", modules and indirect dependencies

2021-01-05 Thread Orson Cart
Apologies if this is a dumb question as I don't have a great deal of experience with modules. So, if I use the "go get" command to download a module, when I look in the module cache the @v directory of the requested module contains at least one .info file. This isn't the case for any indirect

Re: [go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
straightforward for me. > > On Tuesday, March 24, 2020 at 9:56:19 PM UTC+1, Orson Cart wrote: >> >> On Tuesday, 24 March 2020 20:47:07 UTC, Robert Engels wrote: >>> >>> One way to handle this is to generate all of the data up front in an >>&g

Re: [go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
; for i := 0; i < count; i++ { >> > testData = append(testData, "a") >> > } >> > >> > return testData >> > } >> > >> > I get: >> > >> > goos: windows >> > goarch: amd6

[go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
should be some sort of warning in the docs? > > > > On Tuesday, March 24, 2020 at 4:01:17 PM UTC-4, Orson Cart wrote: >> >> On Tuesday, 24 March 2020 19:51:24 UTC, Jake Montgomery wrote: >>> >>> Strange. I hope someone has a real answer for you. >>>

Re: [go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
; i < count; i++ { > > testData = append(testData, "a") > > } > > > > return testData > > } > > > > I get: > > > > goos: windows > > goarch: amd64 > > Benchmark1-4 2101567 584 ns/o

[go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
On Tuesday, 24 March 2020 20:26:10 UTC, Sean Liao wrote: > > see https://github.com/golang/go/issues/27217 > Thanks, will do. > > > On Tuesday, March 24, 2020 at 5:24:08 PM UTC+1, Orson Cart wrote: >> >> I posted this earlier but I realised that the co

[go-nuts] Re: Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
} > > return testData > } > > I get: > > goos: windows > goarch: amd64 > Benchmark1-4 2101567 584 ns/op > Benchmark2-4 100 1668 ns/op > PASS > > So it appears that StopTimer() and StartTimer() are introducing some &g

Re: [go-nuts] Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
mer and StartTimer to be of any use I have to believe that they actually do stop and start the timer reliably. From those timings I'd say that this isn't the case. As always I may be wrong. I'd just like someone to explain how and I'll be a happy chappie :) > > On Tue, Mar 24, 2020 at 11:4

Re: [go-nuts] Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
ial data has to be generated from scratch on each iteration? Is the following expected to work? bench: b.N Loop stop timer generate new data start timer do test > > On Tue, Mar 24, 2020 at 10:47 AM Orson Cart > wrote: > >> >> On

Re: [go-nuts] Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
rstanding something about how b.StopTimer and b.StartTimer are intended to be used, hence my post here :) > > > On Mar 24, 2020, at 11:24 AM, Orson Cart > wrote: > >  > I posted this earlier but I realised that the code had a fundamental error > in it. I've cor

[go-nuts] Bencharking issue with b.StartTimer and b.StopTimer. Was: Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
I posted this earlier but I realised that the code had a fundamental error in it. I've corrected here it but the underlying problem still exists. I've recently started using go test's benchmarks support and I'm particularly interested in understanding the benchmark timer functions. I've been

[go-nuts] Benchmark using b.StopTimer and b.StartTimer has unexpected behaviour - to me at least

2020-03-24 Thread Orson Cart
I posted this earlier but I realised that the code had a fundamental error in it. I've corrected here it but the underlying problem still exists. I've recently started using go test's benchmarks support and I'm particularly interested in understanding the benchmark timer functions. I've been

[go-nuts] Benchmark using b.StopTimer and b.StartTimer has unexpected (to me at least) behaviour

2020-03-24 Thread Orson Cart
I've recently started using go test's benchmarks support and I'm particularly interested in understanding the benchmark timer functions. I've been getting results that I found surprising and I was wondering if anyone could explain what's going on here. The code below has three benchmarks that

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 15:50:33 UTC, Sam Whited wrote: > > Just call b.ResetTimer() after setting up your data: > https://godoc.org/testing#B.ResetTimer > Thanks, I'll take a look -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 17:53:05 UTC, Robert Engels wrote: > > The test package has methods to disable the timing - wrap the setup in > these. > Thanks. I guess you're referring to StoptTimer, StartTimer and ResetTimer? I think that in my case ResetTimer will do the trick. Unless I'm

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 15:50:33 UTC, Sam Whited wrote: > > Just call b.ResetTimer() after setting up your data: > https://godoc.org/testing#B.ResetTimer > > Thanks, I'll take a look -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Benchmarking code that mutates its input data

2020-03-18 Thread Orson Cart
We have a slice containing a mix of data items, some of which are deemed to be 'valid', some 'invalid'. We need to remove the invalid items. In the current implementation we have a function which takes the slice as input and removes the invalid' elements from it in place i.e. not from a copy.

[go-nuts] Information hiding within a package

2020-01-21 Thread Orson Cart
I'm still new to using Go so maybe I'm missing something of the 'culture' but I find that I'd often like to be able to hide implementation detail on a level that is more finely grained than the package. I'm aware that using case it's possible to define for instance struct members that are not

Re: [go-nuts] Difference with function returning struct and function returning pointer to struct

2019-11-20 Thread Orson Cart
On Wednesday, 20 November 2019 17:55:59 UTC, Ian Lance Taylor wrote: > > The other kind of answer is that if a function returns a pointer to a > struct, a value of type *employee, then it's normal for that something > else to have a copy of that pointer, perhaps some data structure or > global

Re: [go-nuts] Difference with function returning struct and function returning pointer to struct

2019-11-20 Thread Orson Cart
On Wednesday, 20 November 2019 17:55:00 UTC, Thomas Bushnell, BSG wrote: but the return value of a function is not addressable (it's not a variable, pointer, etc etc). Hi Thomas. Apologies, I said "assignable" when I meant "addressable". I was curious as to why a struct returned from a

[go-nuts] Difference with function returning struct and function returning pointer to struct

2019-11-20 Thread Orson Cart
I'm a newbie to Go having used C and C++ in the past and I'm puzzled about something I've just seen. In the following code getEmployee returns a pointer to a struct. The return value is then dereferenced. This code compiles and runs fine: package main type employee struct { ID int name