[go-nuts] Re: encoding/xml: Marshal struct field depending on value of another struct field

2022-02-26 Thread Steffen Wentzel
I'm just using pointers now, this approach seems to work fine for my purpose: https://go.dev/play/p/lMwZisTayt3 Steffen Wentzel schrieb am Samstag, 26. Februar 2022 um 11:00:49 UTC+1: > Dear community, > > how can we XML marshal a struct field depending on the value of another

[go-nuts] encoding/xml: Marshal struct field depending on value of another struct field

2022-02-26 Thread Steffen Wentzel
Dear community, how can we XML marshal a struct field depending on the value of another struct field in the same struct? Playground Example: https://go.dev/play/p/vfRB-GfzZ54 My approaches so far: - Use a custom type for the Feature field and implement xml.Marshaler. However MarshalXML

[go-nuts] golang.org/x/crypto/ssh: Error message "wait: remote command exited without exit status or exit signal

2021-02-24 Thread Steffen Wentzel
Dear community, I'm currently trying to write a simple ssh client using golang.org/x/crypto/ssh. My question is: When using ssh.Session.Stdin, which is an io.Reader interface, what triggers a call to the actual Read method? I seem to lack some fundamentals understanding of how this works, I j

Re: [go-nuts] Re: Unmarshal nested XML value from dynamic XML document

2019-02-24 Thread Steffen Wentzel
rn"` > } > type Outer struct { > XMLName struct{} `xml:"outer"` > Responses []Response `xml:",any"` > } > > > https://play.golang.org/p/j4w4-1uuYae > > > > On Sun, Feb 24, 2019 at 9:28 AM Steffen Wentzel > wrote: > >

[go-nuts] Re: Unmarshal nested XML value from dynamic XML document

2019-02-24 Thread Steffen Wentzel
Thanks for the response. I was hoping it would be possible with just xml.Unmarshal. I now have this implementation - any comments on that? (I'm okay with returning the error inline, it's just for logging purposes): Playground: https://play.golang.org/p/6J8XndWdlv_N func id2(axl []byte) string

[go-nuts] Unmarshal nested XML value from dynamic XML document

2019-02-23 Thread Steffen Wentzel
Hi all, although I'm sure this question came up already I wasn't able to find a solution for my issue. I have this example XML structure: {D4564-4564-456-4564456} I want to unmarshal the ID value contained in the XML tags. However this XML structure is dynamic, the embedding XML tag

[go-nuts] Re: DumpRequestOut output does not include "Content-Length" header when http.NewRequest was created with io.Pipe

2017-04-15 Thread Steffen Wentzel
This makes perfect sense - thank you. Actually I wasn't aware of chunked encoding at all - thanks for pointing it out. Am Samstag, 15. April 2017 21:22:03 UTC+2 schrieb Tamás Gulácsi: > > That's chunked encoding. If you want content-length, set it! -- You received this message because you are s

[go-nuts] DumpRequestOut output does not include "Content-Length" header when http.NewRequest was created with io.Pipe

2017-04-15 Thread Steffen Wentzel
Hi all, when using httputil.DumpRequestOut, the output produced does not include a "Content-Length" header, instead I see the length encoded as a hex-value. Additionally, the output produced ends with a "0" in my case. Example code (Playground: https://play.golang.org/p/GBm5D8YgjJ): package ma