[go-nuts] Re: political fundraising on golang.org!

2020-06-14 Thread Amnon Baron Cohen
I, for one, applaud the posting of the banner. Solidarity! On Sunday, 14 June 2020 14:36:38 UTC+1, peterGo wrote: > > Recently, a political message with a fundraising link appeared as a banner > atop golang.org websites: https://golang.org/, https://pkg.go.dev/. > > content/static: add Black

[go-nuts] Re: what is the complexity of regexp.MustCompile()?

2020-06-08 Thread Amnon Baron Cohen
Should we care? Regular expressions are generally small. So the asymptotic complexity is not particularly important. But regular expressions are often used to search large amounts of input. regexp gives us fast, guaranteed linear search times. But we pay for this with slower compilation times.

[go-nuts] Re: Need help with go modules

2020-05-23 Thread Amnon Baron Cohen
of course since module is not found > I also get error: undefined: Hello > which is a function I try to call. > > Hope all of these make sense, and possibly someone wrote somewhere > something of these but so far I did not find it. And I LIKE reading > documentation, but documentation is

[go-nuts] Re: How to work with multiple environment like dev, test, staging, prod in golang ?

2020-05-17 Thread Amnon Baron Cohen
My advice is to use the same application-dev.yml, application-test.yml, application-prod.yml YAML files that you are familiar with, and have your application read its config from them. Changing language does not mean that you have to change the way you configure your application. On

[go-nuts] Re: Type Assertion on File type

2020-05-08 Thread Amnon Baron Cohen
The beautiful thing about Go is that it is statically typed, so you don't need to check if your function returned an *os.File. The compiler already did it for you On Thursday, 7 May 2020 17:57:05 UTC+1, André kouamé wrote: > > Hi, > > I want to check, if the value return by my function has

[go-nuts] Re: DisableKeepAlive not being honored in http.transport

2020-05-07 Thread Amnon Baron Cohen
In these situations I would normally use wireshark to look at the life-cycle of a single session. Which direction are the FIN and RST packets going? Are they sent from the client, or the server? If the RST packets are sent by the server - i.e. the server is slamming shut the connection, then the

[go-nuts] Re: DisableKeepAlive not being honored in http.transport

2020-05-06 Thread Amnon Baron Cohen
Connections are indeed reused where possible by default in the Go standard library. But as http (before http2) does not support multiplexing, it is not possible to reuse a connection which is still in use (i.e. which is still in the process of reading the response). These means that the body of

[go-nuts] Re: Need help with go modules

2020-05-05 Thread Amnon Baron Cohen
Interesting. At first sight this should work. You definitely don't need a go.mod file in ~HOME/src/myrepo/cmd/cmd1 Which go version are you running? What is your $GOPATH set to? What output does cd ~HOME/src/myrepo; go build give? The usual convention is to push the code in a VCS such as

Re: [go-nuts] json decode is very slow

2020-05-03 Thread Amnon Baron Cohen
Excellent advice Jesper! On Sunday, 3 May 2020 10:34:12 UTC+1, Jesper Louis Andersen wrote: > > The general rule is to run a corollary of Dijkstra: experiments can only > show the presence of problems in a system, not their absence :) > > That is, seek to validate your assumptions rather than

[go-nuts] Re: json decode is very slow

2020-05-02 Thread Amnon Baron Cohen
That was my fault too. encoding/json is slow, but not that slow. Unfortunately the title of this thread is a bit misleading. Apparently what is taking time here is reading the data off the wire, rather than decoding the data once it has arrived. So it seems that that the slowness is probably

[go-nuts] Re: json decode is very slow

2020-04-30 Thread Amnon Baron Cohen
encoding/json is quite old and not particularly fast. There are some other implementations around which use code generation rather than reflection, and which claim to give a speedup of 3x or meore I would try one of them: https://github.com/mailru/easyjson or https://github.com/pquerna/ffjson

[go-nuts] Re: the size of the files compiled in GO

2020-04-20 Thread Amnon Baron Cohen
Executable size for small programs is not a top priority in gc. So if you care about executable size (e.g. if your code runs on microcontrollers, or WASM), you may want to have a look at https://tinygo.org/ . On Sunday, 19 April 2020 21:18:29 UTC+1, serhat...@gmail.com wrote: > > It is one of

[go-nuts] Re: [ANN] Go Brain Teasers (book)

2020-04-18 Thread Amnon Baron Cohen
give us a few samples to whet our appetite! On Saturday, 18 April 2020 10:15:57 UTC+1, Miki Tebeka wrote: > > Hi, > > I'm happy to announce that my book is finally out. It contains 25 brain > teasers to tickle your mind. > - Gumroad (ePub & PDF) https://gum.co/Qkmou > - Amazon (mobi & dead tree)

[go-nuts] Re: "Timers rely on the network poller", why is that?

2020-04-17 Thread Amnon Baron Cohen
The go runtime does its waiting (both for timers and network events) in netpoll. On Friday, 17 April 2020 11:10:58 UTC+1, Vincent Blanchon wrote: > > Hi everyone, > > From what I understand, timers are ran by: > - the P holding them > - other P if timer-stealing happen (thanks to the async

Re: [go-nuts] testing code that uses ioutil.ReadDir?

2020-04-13 Thread Amnon Baron Cohen
"Coverage is a proxy for testing quality, but not a guarantee of it. Getting to 100% coverage is a better indicator of chasing metrics than of actually writing good tests" Wise words indeed. I'm going to print out this quote and frame it. Thanks Rob! On Monday, 13 April 2020 17:07:25 UTC+1, K

[go-nuts] Re: Intercepting field access and method call

2020-04-12 Thread Amnon Baron Cohen
Go is a simple language. Code in Go does what it says. No magic. That is its beauty. That is its power. On Sunday, 12 April 2020 03:59:08 UTC+1, Tanmay Das wrote: > > Say you have a struct Foo and you access fields and call methods on it as > you normally would. But is it possible to execute

Re: [go-nuts] Go course

2020-03-29 Thread Amnon Baron Cohen
Thanks! A great write-up. On Friday, 27 March 2020 16:32:51 UTC, Owen Waller wrote: > > Hi Dave, > > As the original author of the post that Dan has referenced, I can say that > Go does indeed make IMHO a good first programming language. It all comes > down to how you explain things. Thanks Dan

Re: [go-nuts] Go course

2020-03-26 Thread Amnon Baron Cohen
The println and print builtin may be removed from the language in the future. On Thursday, 26 March 2020 19:18:50 UTC, David Riley wrote: > > And since I'm a fan of lifelong learning, I have to admit to not having > known that println() was a builtin until this post. Thanks! That does >

Re: [go-nuts] Go course

2020-03-26 Thread Amnon Baron Cohen
Go is not C. C programmers have to master explicit memory management, which is a challenge to new and experience programmers alike. C is a beautiful language. But very low level. Having spent several years programming in Python, I would say that it is much more complicated than Go. It has a

[go-nuts] Re: json to golang struct definition lib

2020-03-26 Thread Amnon Baron Cohen
An interesting approach. Slightly surprised you did not use "encodeing/json" to parse the json input, which would have been much easier. On Thursday, 26 March 2020 00:05:01 UTC, sanye wrote: > > Hello gophers, > > I found an interesting project: https://github.com/mholt/json-to-go , > which

[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-09 Thread Amnon Baron Cohen
Also worth adding some unit tests, including one which reproduces your 404 error. See https://www.youtube.com/watch?v=hVFEV-ieeew for a great video about how to add these tests. On Monday, 9 March 2020 14:53:20 UTC, anderso...@blacklane.com wrote: > > please post the code as text. Either in a

[go-nuts] Re: Changing source code in order code to be supported from older Golang versions e.g. Go 1.10

2020-03-08 Thread Amnon Baron Cohen
Friday, March 6, 2020 at 1:20:38 PM UTC-5, Amnon Baron Cohen wrote: >> >> Anyone who is able to put up with a 20 year old OS >> will be able to tolerate a 2 year old Go version... >> > > Dimitrios' question is a perfectly legitimate one. Your response does > no

Re: [go-nuts] Changing source code in order code to be supported from older Golang versions e.g. Go 1.10

2020-03-07 Thread Amnon Baron Cohen
also https://stackoverflow.com/questions/52137098/go-after-1-10-and-support-of-windows-xp/52137703#52137703 On Saturday, 7 March 2020 13:38:17 UTC, Amnon Baron Cohen wrote: > > https://github.com/golang/go/issues/23380 > > > -- You received this message because you are subscribe

Re: [go-nuts] Changing source code in order code to be supported from older Golang versions e.g. Go 1.10

2020-03-07 Thread Amnon Baron Cohen
https://github.com/golang/go/issues/23380 On Saturday, 7 March 2020 11:42:28 UTC, Jesper Louis Andersen wrote: > > While it isn't supported, it might be there are not that much work needed > to make 1.14 run on Windows XP. At least you should consider that path as > well in addition to program

Re: [go-nuts] Connection Refused while scraping the data

2020-03-07 Thread Amnon Baron Cohen
You might get better results if you at a www to the beginning of the hostname. curl https://www.indeed.co.in/browsejobs/Engineering does download a page whereas curl https://indeed.co.in/browsejobs/Engineering does give a connection refused error. On Saturday, 7 March 2020 04:36:04 UTC,

[go-nuts] Re: Changing source code in order code to be supported from older Golang versions e.g. Go 1.10

2020-03-06 Thread Amnon Baron Cohen
Anyone who is able to put up with a 20 year old OS will be able to tolerate a 2 year old Go version... On Thursday, 5 March 2020 11:08:07 UTC, Dimitrios Trechas wrote: > > Dear colleagues, > > There are even now cases that a Windows XP is needed. The latest Golang > compiler that could target XP

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Amnon Baron Cohen
That does not sound like a scalable architecture! The number of simultaneous user connections the architecture can support is limited to the number of processes your server can run. The resources required by a process are orders of magnitude more than those required for a goroutine. And the Go

[go-nuts] Re: Many instances question - shared library

2020-02-28 Thread Amnon Baron Cohen
> However, due to the nature of the application, there maybe 100 or 200 instances Interesting... Could you elaborate the nature of the application, and why a single instance is not enough... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
somebody beat us to it: https://github.com/torden/go-strutil#reversestr But for some strange reason, they seem to have made the this a method of a StringProc class. Perhaps they used to code in Java. On Friday, 28 February 2020 13:07:54 UTC, Himanshu Makkar wrote: > > Hi > > I think we can

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
rog wrote: > > > > On Fri, 28 Feb 2020 at 08:23, Amnon Baron Cohen > wrote: > >> Here is a dumb version, that wastes loads of memory. >> >> func reverse(in string) string { >>out := strings.Builder{} >>out.Grow(len(in)) >>runes

[go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-28 Thread Amnon Baron Cohen
Here is a dumb version, that wastes loads of memory. func reverse(in string) string { out := strings.Builder{} out.Grow(len(in)) runes:= make([]rune, 0, len(in)) for _, r := range in { runes = append(runes, r) } for i := len(runes) -1; i >= 0; i-- {

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-27 Thread Amnon Baron Cohen
lol! Where are you rob? We miss you! On Thursday, 27 February 2020 23:23:57 UTC, Rob 'Commander' Pike wrote: > > Once bytten, twice shy. > > -rob > > > On Fri, Feb 28, 2020 at 10:17 AM Jesper Louis Andersen < > jesper.lo...@gmail.com > wrote: > >> The key observation is that you only look at a

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-27 Thread Amnon Baron Cohen
ade up front and then > a linear time walk along the encoded runes with truncation after each > rune. > > On Thu, 2020-02-27 at 13:05 -0800, Amnon Baron Cohen wrote: > > O(n^2) > > > > On Thursday, 27 February 2020 18:53:01 UTC, rog wrote: > > > If you r

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-27 Thread Amnon Baron Cohen
O(n^2) On Thursday, 27 February 2020 18:53:01 UTC, rog wrote: > > If you really just want to reverse rune-by-rune, it's pretty > straightforward: > > func Reverse(s string) string { > r := make([]byte, 0, len(s)) > for len(s) > 0 { > _, n :=

Re: [go-nuts] Re: Lot's of test errors in package zmq4 with Go version 1.14, no errors with earlier versions

2020-02-26 Thread Amnon Baron Cohen
from https://www.jwz.org/doc/worse-is-better.html Two famous people, one from MIT and another from Berkeley (but working on Unix) once met to discuss operating system issues. The person from MIT was knowledgeable about ITS (the MIT AI Lab operating system) and had been reading the Unix

Re: [go-nuts] setting up a hardened https server in go 1.13

2020-02-21 Thread Amnon Baron Cohen
On Friday, 21 February 2020 17:49:06 UTC, Kevin Chadwick wrote: > > On 2020-02-21 16:13, Amnon Baron Cohen wrote: > > > Default connection limits suggest it isn't production ready by default and > so is > the main reason...so define properly hardened, but also. har

Re: [go-nuts] setting up a hardened https server in go 1.13

2020-02-21 Thread Amnon Baron Cohen
Interesting. What vulnerabilities does OpenBSDs httpd protect against, which a properly hardened net/http does not? The problem with proxying through OpenBSD's server, nginx or any other server is that there is another moving part that you need to master, configure, monitor, and which may

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Amnon Baron Cohen
https://github.com/golang/go/issues/33714 is related. The problem you describe is far greater when decoding. On Friday, 21 February 2020 05:06:58 UTC, Jérôme LAFORGE wrote: > > Thank you both. > > When I am the designer of API that must stream json array, I use JSONL. > And it is much easier to

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Amnon Baron Cohen
Unfortunately there is not a more elegant way. Unless you change the protocol, and dispense with the idea of returning a single json object, and instead return line delimited streaming json. Then you can dispense with injecting brackets into your stream, and just call enc.Encode(doc)

Re: [go-nuts] Re: [Proposal] Change how gofmt formats struct fields

2020-02-20 Thread Amnon Baron Cohen
> > Gofmt's style is no one's favorite, yet gofmt is everyone's favorite. > >From Go Proverbs. https://www.youtube.com/watch?v=PAAkCSZUG1c=8m43s Rob Pike answered this proposal in advance back in 2015. Wise words... -- You received

[go-nuts] Re: Why Discord is switching from Go to Rust

2020-02-07 Thread Amnon Baron Cohen
https://twitter.com/_rsc/status/1224802726774812672?s=20 https://twitter.com/_rsc/status/1224802727773065221?s=20 On Friday, 7 February 2020 12:24:50 UTC, Everton Marques wrote: > > I think Go is way better than Rust, but it is amusing to see why people > pick one over another. > > "Remarkably,

[go-nuts] Re: Any chance of not deprecating GOPATH ?

2020-02-02 Thread Amnon Baron Cohen
Kill GOPATH! It was a terrible idea. Thankfully no longer needed. But it causes no end of confusion. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: [Proposal] Change how gofmt formats struct fields

2020-02-01 Thread Amnon Baron Cohen
The indent man page (for formatting C code) has dozens of options to allow the user to tweak the output format. The greatest thing about gofmt great thing about gofmt is that it has no such options. No style options. No new vs old mode. Gofmt just produces a

[go-nuts] Re: [Proposal] Change how gofmt formats struct fields

2020-01-29 Thread Amnon Baron Cohen
On Wednesday, 29 January 2020 17:56:35 UTC, Manlio Perillo wrote: > > Is this reasonable? > > Not really, as it would generate many gratuitous changes to existing code. This is one thing gofmt avoids. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Go mindshare is low & ~flat, per Google Trends

2020-01-26 Thread Amnon Baron Cohen
Maybe Go is too stable and boring. Perhaps we should add wacky new features in each release, remove old features, and change the way everything else works in surprising and undocumented ways. This way all our users will be forced to google like crazy to figure out how to port their code to

Re: [go-nuts] Re: Go mindshare is low & ~flat, per Google Trends

2020-01-16 Thread Amnon Baron Cohen
https://www.benfrederickson.com/ranking-programming-languages-by-github-users/ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Re: Go mindshare is low & ~flat, per Google Trends

2020-01-16 Thread Amnon Baron Cohen
Go was originally conceived as a niche language. And if it does what we need, then I don't think we need to be particularly bothered if other languages are more "popular". But when looking at language popularity, I am not sure that the number of google searches is the most meaningful metric.

[go-nuts] Re: How to make a server being server and client simultaneously

2020-01-15 Thread Amnon Baron Cohen
Is this homework? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit

[go-nuts] Re: About the change for default "-mod=vendor" in Go 1.14

2020-01-09 Thread Amnon Baron Cohen
On Thursday, 9 January 2020 08:38:56 UTC, T L wrote: > > Yes, when I change the "go 1.13" directive to "go 1.14", it suggests I > need to run 'go mod vendor' to sync. > After the sync, it works. Thanks for the help. > > So if the directive is 1.13, no default "-mod=vendor" compiler flag is >

Re: [go-nuts] Re: A question !

2020-01-07 Thread Amnon Baron Cohen
On Tuesday, 7 January 2020 09:44:28 UTC, Motaz Hejaze wrote: > > > May i ask what is the best deployment for more performance ?? > >> >> Do whatever is easiest. If you have come from the Python/Django world then you will be blown away by Go's speed, whatever deployment you use. I would also

Re: [go-nuts] Publishing and using go module from tarball?

2020-01-06 Thread Amnon Baron Cohen
> Go modules tooling does not seem to support http at > all and as for the https I did not find any way to allow use of self-signed > certificate... In Go 1.14 (available as in beta) you can set the GOINSECURE env var to allow http download.

Re: [go-nuts] Publishing and using go module from tarball?

2020-01-06 Thread Amnon Baron Cohen
In Go 1.14 (available as in beta) you can set the GOINSECURE env var to allow http download. https://tip.golang.org/cmd/go/#hdr-Environment_variables On Sunday, 5 January 2020 17:34:50 UTC, volf...@gmail.com wrote: > > > > On Sunday, January 5, 2020 at 11:02:52 AM UTC, Amnon Baron

Re: [go-nuts] Publishing and using go module from tarball?

2020-01-05 Thread Amnon Baron Cohen
If you are happy publishing a zip archive rather than a tarball, then you can server the module download protocol directly. See https://research.swtch.com/vgo-module#download_protocol On Sunday, 5 January 2020 05:11:32 UTC, wgr wrote: > > On 2020-01-04 15:54, volf...@gmail.com wrote: > >

[go-nuts] Re: A question !

2020-01-05 Thread Amnon Baron Cohen
> 1 - Is there really a big performance ( speed ) difference between using Python OR Golang in backend web development ? Python suffers from poor performance, so moving to Go should give you a speedup of well over an order of magnitude. (See https://www.techempower.com/benchmarks/ for example

[go-nuts] Re: How to fill a map with requests from client

2020-01-03 Thread Amnon Baron Cohen
I have copied the problematic lines of your code into a tiny programme on the Go playground. https://play.golang.org/p/9vMrdtC-2zX If you run it you will see the problem. I would play around with the code to get a feel for what is happening. If you want to append job names, then you probably

[go-nuts] Re: How to fill a map with requests from client

2020-01-03 Thread Amnon Baron Cohen
all := make(map[string]string) // create the map all["client request"] = clientJob.name// append the client requests on map gets called each time a request arrives. So a new empty map gets created each time a request arrives. The comment on the second line is wrong. The

[go-nuts] Re: Question regarding a very tricky build set up

2019-12-26 Thread Amnon Baron Cohen
On Sunday, 22 December 2019 08:08:56 UTC, christoph...@gmail.com wrote: > > Oh my gosh. You could have saved all the time for writing that long long > question if someone had told you before that GOPATH is a thing of the past. > > Go has a new package dependency management system called Go

[go-nuts] Re: Storing test cases in array of struct vs slice of struct

2019-12-24 Thread Amnon Baron Cohen
Array and slice are pretty much equivalent. Slices require (three characters) less typing. And arrays save a couple of bytes at run-time by not allocating a slice header. Maps, on the other hand, will execute the tests in a randomised order. In a properly written test, this should not matter.

[go-nuts] Re: Getting Gobot package fails

2019-09-22 Thread Amnon Baron Cohen
try go get -u github.com/hybridgroup/gobot and change the import paths in your program. On Sunday, 22 September 2019 16:14:48 UTC+1, Arie van Wingerden wrote: > > When I issue this command (as instructed on Gobot site): > go get -d -u gobot.io/x/gobot/... > > I get this message: >

Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Amnon Baron Cohen
https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=vs-2019 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-15 Thread Amnon Baron Cohen
I would add that engineering is the art of tradeoffs. The language authors decided to route all network scheduling through netpoll, and launch a new goroutine for every incoming http request. These decisions carry a significant overhead. But they mean that users of the language can effortlessly

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-11 Thread Amnon Baron Cohen
For those interested, you can find some web benchmarks here https://www.techempower.com/benchmarks/ For the trivial http ping type server, you would expect latency to be dominated by system time. strace'ing your code will give you an idea what it is doing. Go allows you to have multiple

[go-nuts] Re: Go Module Mirror and Checksum Database in Beta!

2019-05-31 Thread Amnon Baron Cohen
Not really. You need the list feature of GOPROXY, which is only available in 1.13 (or tip). > > Is there a way to test proxy.golang.org with go1.12 if we have private > dependencies ? > > -- > William Dodé > > -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Go Module Mirror and Checksum Database in Beta!

2019-05-31 Thread Amnon Baron Cohen
See https://go.googlesource.com/proposal/+/master/design/25530-sumdb.md The current behavior is not ideal from a security point of view. So it is good that 1.13 is fixing this. And unless the fix is default, most users will not get the benefit. Anyone who wants to old behavior just needs to set

[go-nuts] Re: Interesting public commentary on Go...

2019-05-28 Thread Amnon Baron Cohen
If it aint broke, don't fix it. On Thursday, 23 May 2019 14:18:25 UTC+1, lgo...@gmail.com wrote: > > https://utcc.utoronto.ca/~cks/space/blog/programming/GoIsGooglesLanguage > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] Http Handler to produce static content

2019-05-20 Thread Amnon Baron Cohen
When web-apps are implemented in scripting languages which suffer from poor performance, it is common practice to proxy them behind a "real" web server such as nginx, and offload SSL termination, caching, handling of static components, etc to it. In Go http.ListenAndServe is an industrial

Re: [go-nuts] Any way to prevent gc emitting AVX256 and AVX512 instructions for amd64?

2019-05-14 Thread Amnon Baron Cohen
OK. Thanks for the explanation and pointers. On Tuesday, 14 May 2019 15:15:46 UTC+1, Ian Lance Taylor wrote: > > On Tue, May 14, 2019 at 7:03 AM Amnon Baron Cohen > wrote: > > > > go version > > go version go1.12.5 linux/amd64 > > > GODEBUG=cpu.avx=off

Re: [go-nuts] Any way to prevent gc emitting AVX256 and AVX512 instructions for amd64?

2019-05-14 Thread Amnon Baron Cohen
vmovdqu 0x20(%rdi),%ymm5 but the sledgehammer GOARCH=386 does work > GOARCH=386 go build hello.go > objdump -d hello | grep '%ymm' > I'll keep digging. - Amnon On Tuesday, 14 May 2019 14:30:32 UTC+1, Ian Lance Taylor wrote: > > On Tue, May 14, 2019 at 2:18 AM Amnon Baron Cohe

[go-nuts] Re: Any way to prevent gc emitting AVX256 and AVX512 instructions for amd64?

2019-05-14 Thread Amnon Baron Cohen
apart from GOARCH=386 ? On Tuesday, 14 May 2019 10:17:46 UTC+1, Amnon Baron Cohen wrote: > > I am trying to avoid running any AVX instructions in order to prevent > Intel's dynamic frequency scaling > reducing my CPU base frequency. > > Thanks, >Amnon > > --

[go-nuts] Any way to prevent gc emitting AVX256 and AVX512 instructions for amd64?

2019-05-14 Thread Amnon Baron Cohen
I am trying to avoid running any AVX instructions in order to prevent Intel's dynamic frequency scaling reducing my CPU base frequency. Thanks, Amnon -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread Amnon Baron Cohen
The idiomatic Go way is to write defer ifDB.Close() Simple is better than clever. + Readability does matter. And in situations where you really need to check that the connection was successfully closed, and you have a workable scheme for recovering from this situation, then write a

[go-nuts] Re: Implementing an EventBus in Go

2019-03-11 Thread Amnon Baron Cohen
https://github.com/nats-io/go-nats On Monday, 11 March 2019 04:41:25 UTC, Kasun Vithanage wrote: > > Hi all, > > I've experience implementing event buses in Java. > In Java, I used a singleton where I can register callbacks to methods and > fire event from a publisher(maybe from another thread)

[go-nuts] Re: What is the future of go mod vendoring?

2019-02-15 Thread Amnon Baron Cohen
https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away On Thursday, 14 February 2019 02:26:35 UTC, Paul A. Fortin wrote: > > I have heard that the vendir dirctory is here to stay and also that it is > going away - can someone from the goteam give us

[go-nuts] Re: Contributors wanted: Quantitative performance improvement study

2019-02-06 Thread Amnon Baron Cohen
https://www.techempower.com/benchmarks/#section=data-r15=ph=json > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.

[go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Amnon Baron Cohen
If you like these kind of benchmarks https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-gpp.html may be what you are looking for. In these results Go is generally half the speed of C, but 50 times faster than python. Go does not attempt to generate the fastest code at all

[go-nuts] Re: Patch method

2019-01-09 Thread Amnon Baron Cohen
try https://golang.org/pkg/net/http/ and https://golang.org/pkg/encoding/json/ On Tuesday, 8 January 2019 14:24:37 UTC, afriyie...@gmail.com wrote: > > Hi, > > Am new in Go programming and need help to write a PATCH method for my > go-server. > my data field look like these > > type NFProfile

Re: [go-nuts] Re: go language sensitive editor?

2018-11-22 Thread Amnon Baron Cohen
https://www.gnu.org/fun/jokes/ed-msg.html On Thursday, 22 November 2018 13:49:09 UTC, Anirudh Vyas wrote: > > Could never get this one - Ed is the standard editor, is there a > historical context of this? Did people say this a lot back when there were > vim emacs and Ed only as choices of

Re: [go-nuts] Re: Large (binary or text) File transfers over rpc

2018-11-04 Thread Amnon Baron Cohen
And don't forget the bit-torrent class of solutions. On Friday, 2 November 2018 16:56:17 UTC, Tom Mitchell wrote: > > Moving files is a solved, non trivial problem > Have you looked at tools like scp (ssh), rsync, kermit, ftp, sftp, tftp > and network filesystems (nfs and samba)? > Even git

[go-nuts] Re: non-standard json

2018-11-03 Thread Amnon Baron Cohen
Try something like https://play.golang.org/p/eHEjKINz9aW func extract(r io.Reader) { dec := json.NewDecoder(r) for { var el s err := dec.Decode() if err == io.EOF { break } log.Println(el) } } On Thursday, 1 November 2018 16:14:17 UTC, Alex

[go-nuts] Re: Go 1.11 and 1.10.4 are Released

2018-08-28 Thread Amnon Baron Cohen
Any plans to upgrade https://play.golang.org/ to 1.11? On Friday, 24 August 2018 23:24:25 UTC+1, Andrew Bonventre wrote: > > Hello gophers, > > We just released Go 1.11 and 1.10.4. > > You can read the announcement blog post here: > https://blog.golang.org/go1.1

Re: [go-nuts] Re: http Transport dies too slowly

2018-05-27 Thread Amnon Baron Cohen
No, just get rid of the clients map, and instead, just create a single global client. Http Clients are designed to be used by multiple goroutines. On Sun, May 27, 2018 at 4:33 PM, Tamás Gulácsi wrote: > Map is not concurrency safe, you have to synchronize access. For

[go-nuts] Re: http Transport dies too slowly

2018-05-27 Thread Amnon Baron Cohen
As Tamas said, reuse the client. Just make the client into a global variable. On Sunday, 27 May 2018 11:29:47 UTC+1, Vadim Lesich wrote: > > Do you have an example? > > воскресенье, 27 мая 2018 г., 8:39:50 UTC+3 пользователь Tamás Gulácsi > написал: >> >> Just reuse the created http.Client. >

[go-nuts] Re: vgo with package path without dot

2018-02-24 Thread Amnon Baron Cohen
On Friday, 23 February 2018 > > > I work with GOPATH per project. > > Then I use to give them a one word path directly under src: > > $GOPATH/src/myapp > > Go is a highly opinionated language assumes that you lay out your code as described in https://golang.org/doc/code.html If you decide

[go-nuts] Re: ListenAndServ and channels

2018-01-06 Thread Amnon Baron Cohen
GrHQxPhy1qu > > Using a buffered channel will keep the history of ticks and not block but > may run out of buffer space if the handler isn't called enough. > > Amnon's global var should work if you are just looking for the current > tick value. > > Matt > > On Friday,

[go-nuts] Re: ListenAndServ and channels

2018-01-05 Thread Amnon Baron Cohen
try using a global var. something like https://play.golang.org/p/05-xBDh5rgn On Thursday, 4 January 2018 15:09:41 UTC, Keith Brown wrote: > > I am trying to Serve a webpage while running a ticker in the background. I > am trying to generate a random number, genRandom() , periodically and >

[go-nuts] Re: net/http Server Shutdown does not free up the port upon return

2017-12-08 Thread Amnon Baron Cohen
netstat is your friend On Wednesday, 29 November 2017 04:53:48 UTC, Albert Tedja wrote: > > net/http's Shutdown() does not free up the port upon return, or rather it > seems a bit undefined how long it takes for the port to be reusable again. > > server := { > Addr:

[go-nuts] Re: Variable JSON format parsing, any best practice?

2017-09-29 Thread Amnon Baron Cohen
No silver bullet. But you can try defining value as json.RawMessage in order to delay the parsing till you know what you have got. See http://eagain.net/articles/go-dynamic-json/ On Friday, 29 September 2017 00:41:53 UTC+1, Yaroslav Molochko wrote: > > I have following json messages: > >

[go-nuts] Re: Bytconv where art thou

2017-09-25 Thread Amnon Baron Cohen
https://github.com/golang/go/issues/2632 > >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] Re: Newbie How to read unmarshall a varient struct in Json

2017-06-04 Thread Amnon Baron Cohen
Thanks for bringing the article to my attention. The final section "*Encoding and decoding generics*" was exactly what I was looking for. On Sunday, 4 June 2017 12:53:42 UTC+1, Jon Calhoun wrote: > > See the last section of this article where it talks about generics - >