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

2020-02-21 Thread Brian Candler
On Tuesday, 18 February 2020 18:16:57 UTC, Manlio Perillo wrote: > > Here is an example of a diff with a lot of noise, where the actual change > is very hard to see: > https://gist.github.com/perillo/c5b3bdff9e8db9c89f316670d129c0dd > > Note that using `git diff -w` is not a solution, since it

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

2020-02-21 Thread Kevin Chadwick
On 2020-02-21 01:42, DrGo wrote: > Are there more up-to-date recommendations for go 1.13? Personally I run Go behind either app engine or via fcgi behind OpenBSD httpd. I'm not sure any other https server has the same level of key protection as revamped in OpenBSDs httpd (separate to LibreSSL),

Re: [go-nuts] Re: asm/amd64: is it safe to use NO_LOCAL_POINTERS in this scenario?

2020-02-21 Thread Ian Lance Taylor
On Fri, Feb 21, 2020 at 7:38 AM Iskander Sharipov wrote: > > If the original question is not clear, I can re-phrase it like this: what > happens if a function marked with NO_LOCAL_POINTERS contains heap pointers on > its frame? > > My understanding is that these pointers will not count as

Re: [go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-21 Thread Chris Burkert
Take a Look at https://blog.golang.org/json-and-go: The json package uses map[string]interface{} and []interface{}values to store arbitrary JSON objects and arrays; it will happily unmarshal any valid JSON blob into a plain interface{} value. The default concrete Go types are: - bool for JSON

[go-nuts] Re: Experience report on a large Python-to-Go translation

2020-02-21 Thread Eric Raymond
On Thursday, January 30, 2020 at 2:05:17 AM UTC-5, Liam wrote: > > I'd suggest re-posting this on golang-dev; I almost missed it as I rarely > read -nuts. > That's a good idea. I think what I'll do is revise it lightly in view of some of the feedback I've gotten here and post it there. --

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread andrey mirtchovski
got it down to two: https://play.golang.org/p/jmTqhLGaLY_T On Fri, Feb 21, 2020 at 11:24 AM Bruno Albuquerque wrote: > > This is interesting. If I simplify the loop to something like this: > > nrgbaData := make([]byte, len(rgbData)+(len(rgbData)/3)) > > _ = nrgbaData[len(rgbData)] > >

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

2020-02-21 Thread DrGo
> > 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. > > > For an average schmuck like me, "hardened" means that I am not criminally

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread Bruno Albuquerque
[now sending to the entire group] And the plot thickens. https://play.golang.org/p/P2JPI42YJa8 Basically, this is a very simple loop iterated with different step increments. For step increments of 1, 2, 4, 5 and 10, there are no bound checks. For step increments of 3, 6, 7, 8 and 9 there are

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread Robert Engels
Curious, in the cases of where you were able to eliminate the bounds checks what was the performance difference in the overall process? I would be very surprised, even in matrix type loops, that this makes an appreciable difference given modern cpu branch predictors. I think a better area of

Re: [go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-21 Thread 'Eric Johnson' via golang-nuts
Understand all that. It doesn't help. Asking the question a different way, as concrete code always clarifies. For something like the following snippet of code: const testJSON = `{ "first_name": "first", "last_name": "last", "favorite_color": "orange", "age": 92 }` func TestUnmarshalling(t

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

2020-02-21 Thread Kevin Chadwick
>But without a list of vulnerabilities, this sounds to me like FUD. Fud implies intentional deceit, not the case. Now that you have made me think about it then if security is your priority over performance then OpenHttpd certainly provides better protection of the TLS key and various server

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

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

2020-02-21 Thread Kevin Chadwick
On 2020-02-21 16:13, Amnon Baron Cohen wrote: > Interesting. > > What vulnerabilities does OpenBSDs httpd protect against, which a properly > hardened net/http does not? > Default connection limits suggest it isn't production ready by default and so is the main reason...so define properly

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread Sebastien Binet
On Fri, Feb 21, 2020 at 5:36 PM Bruno Albuquerque wrote: > I wrote some simple code to convert a RGB24 image represented as a []byte > to a NRGBA image (also as a []byte), like so: > > https://play.golang.org/p/Y7ICg7t4_nd > > Unfortunately, the performance is lacking here and I am trying to

[go-nuts] asm/amd64: is it safe to use NO_LOCAL_POINTERS in this scenario?

2020-02-21 Thread quasilyte
Hi all. I have an asm function that is defined like this: // func f(x *T1, y *T2) TEXT ·f(SB), 0, $32-16 NO_LOCAL_POINTERS // It does call a few Go functions, this is why // I need some frame space, to put their arguments there. MOVQ , 0(SP) MOVQ , 8(SP) CALL ·gofunc1(SB) MOVQ

[go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-21 Thread 'Eric Johnson' via golang-nuts
If I've got a structure like this: type jsonData struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` } I can marshal / unmarshal JSON as: { "first_name": "first", "last_name": "last" } What if my input JSON is this: { "first_name": "first",

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread Bruno Albuquerque
This is interesting. If I simplify the loop to something like this: nrgbaData := make([]byte, len(rgbData)+(len(rgbData)/3)) _ = nrgbaData[len(rgbData)] for i := 0; i < len(rgbData); i++ { nrgbaData[i] = rgbData[i] } then the bounds check at the line

[go-nuts] Re: asm/amd64: is it safe to use NO_LOCAL_POINTERS in this scenario?

2020-02-21 Thread Iskander Sharipov
If the original question is not clear, I can re-phrase it like this: what happens if a function marked with NO_LOCAL_POINTERS contains heap pointers on its frame? My understanding is that these pointers will not count as something that is a pointer and if there will be no other pointers to

[go-nuts] Bound checks elimination hint.

2020-02-21 Thread Bruno Albuquerque
I wrote some simple code to convert a RGB24 image represented as a []byte to a NRGBA image (also as a []byte), like so: https://play.golang.org/p/Y7ICg7t4_nd Unfortunately, the performance is lacking here and I am trying to improve it. The first low hanging fruit seems to be taking advantage of

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread Bruno Albuquerque
Nope. Bound checks are still there. I am puzzled by this one. On Fri, Feb 21, 2020 at 9:34 AM Sebastien Binet wrote: > > > On Fri, Feb 21, 2020 at 5:36 PM Bruno Albuquerque wrote: > >> I wrote some simple code to convert a RGB24 image represented as a []byte >> to a NRGBA image (also as a

[go-nuts] Re: Experience report on a large Python-to-Go translation

2020-02-21 Thread Eric Raymond
This is a belated addition to my notes on the Go translation of reposurgeon. I'll be adding it to the revised version I post to golang-dev. One extremely positive thing I must say before closing. Translation from Python, which is a dreadful language to try to do concurrency in due to its

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. hardened means following

[go-nuts] [ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

2020-02-21 Thread howardcshaw
Four years ago I posted Renderview, a simple GUI wrapper that lets you take any image generation function in your code and turn it into an interactive GUI program with panning, optional zooming, and depending on backend choice, parameter editing. https://github.com/TheGrum/renderview I have

Re: [go-nuts] help with using %q in fmt

2020-02-21 Thread Ian Lance Taylor
On Fri, Feb 21, 2020 at 4:35 PM 'simon place' via golang-nuts wrote: > > basically i want to save a file name in a file (with some url styling for > human readability); > > https://play.golang.org/p/sWYbyU7nuSo > > which works, but not with a space in the name; > >

[go-nuts] help with using %q in fmt

2020-02-21 Thread 'simon place' via golang-nuts
basically i want to save a file name in a file (with some url styling for human readability); https://play.golang.org/p/sWYbyU7nuSo which works, but not with a space in the name; https://play.golang.org/p/sswqBRL8dZW it needs to be quoted, so i figure '%q' is for this; %q a