Re: [go-nuts] Representing Optional/Variant Types Idiomatically (or not)

2021-06-19 Thread Henry
Instead of exposing the fields in a struct like that, you may consider using constructor function to have better control over what the user can set into the struct. That way you don't need to worry about the user setting invalid values. For instance, ```Go type EmailEvent struct{ id string

Re: [go-nuts] Re: Help me troubleshoot this missing value problem

2021-06-19 Thread Tong Sun
Ah, thanks a lot Sean! On Sat, Jun 19, 2021 at 6:52 PM Sean Liao wrote: > You're accessing .SecondKS when it should be .Shortcut.SecondKS (as you > correctly do for .Shortcut.FirstKS) > > https://play.golang.org/p/Jzxws3JaTSQ > > side note: I think it's easier to read if you also use indenting

[go-nuts] Re: Help me troubleshoot this missing value problem

2021-06-19 Thread Sean Liao
You're accessing .SecondKS when it should be .Shortcut.SecondKS (as you correctly do for .Shortcut.FirstKS) https://play.golang.org/p/Jzxws3JaTSQ side note: I think it's easier to read if you also use indenting in your templates and use `{{- -}}` to trim leading/trailing whitespace On Sunday,

[go-nuts] Re: Convert json to css for golang

2021-06-19 Thread Tong Sun
Can you express your converting from json to css using Golang template rule? On Saturday, June 19, 2021 at 3:51:32 AM UTC-4 muhorto...@gmail.com wrote: > Hi everyone, I need a converter from json to css.I use > https://github.com/ysugimoto, it translates css to json, then I connect > some

[go-nuts] Help me troubleshoot this missing value problem

2021-06-19 Thread Tong Sun
Please take a look at https://play.golang.org/p/k_CM_cJgSvJ line 77 tries to output .FirstKS then .SecondKS if it is not nil However, there are two cases, the debug output shows there is .SecondKS field but the template thinks there is ``: alt MINUS map[Id:EditorCutLineBackward

[go-nuts] Re: how to consume API using Golang

2021-06-19 Thread Brian Candler
You don't need to build and encode the Authorization header yourself - you can use Request.SetBasicAuth . Building it yourself is fine too, if you do it right - google "go http authorization basic" for some examples. Your code has a lot

[go-nuts] Re: unexpected behavior http.MaxBytesReader & streaming response

2021-06-19 Thread Brian Candler
Ah I get it now: it's due to application starting to send a response before the request has been completely received, as per the response to your ticket which links to https://github.com/golang/go/issues/15527 On Saturday, 19 June 2021 at 11:15:34 UTC+1 Brian Candler wrote: > Here is a

[go-nuts] Re: unexpected behavior http.MaxBytesReader & streaming response

2021-06-19 Thread Brian Candler
Here is a variation on your program, removing json.Encoder from the equation: https://play.golang.org/p/ACS_n1yNJfQ It works as shown, but if you uncomment the commented-out fmt.Fprintf, it fails. (macOS, go1.16.5) This is indeed weird. As far as I can see, the only way MaxBytesReader

[go-nuts] Convert json to css for golang

2021-06-19 Thread Денис Мухортов
Hi everyone, I need a converter from json to css.I use https://github.com/ysugimoto, it translates css to json, then I connect some plugins that change the json, and after that I need to recreate it back to css. Do not advise Postcss because I'm just trying to make it similar to Golang --