[go-nuts] O_DIRECT and write Array returns Invalid argument error

2017-12-28 Thread Viacheslav Biriukov
Hello, Could you please help me with the following code with O_DIRECT and array. I tried to implement direct io and stuck with weird behaviour of alignment writes created from array. Following code doesn't work: package main import ( "os" "syscall" ) func main() { var p [2 <<

Re: [go-nuts] O_DIRECT and write Array returns Invalid argument error

2017-12-29 Thread Viacheslav Biriukov
PM, Viacheslav Biriukov > wrote: > > > > Could you please help me with the following code with O_DIRECT and > array. I > > tried to implement direct io and stuck with weird behaviour of alignment > > writes created from array. > > > > > > Fo

[go-nuts] Dynamic json unmarshaling map[string]int and errors

2016-09-08 Thread Viacheslav Biriukov
Hi all, Help me please write an idiomatic golang code for api client for json rest api. In normal case api send just map[string]int and it's easy to unmarshal in map. { "string": 1, "string": 2 } But in error case it becomes: { "error": "error_string" } What is the best way to hand

[go-nuts] json murshal/unmarhsal struct that was got using custom interface type

2016-08-01 Thread Viacheslav Biriukov
Hi, I want to marshal/unmarshal object for saving in key/value storage. The question is: if I got this object using function, that accepts interface type, lets say for example: base.Pricer. And there are more than one type struct that satisfy this interface. I know while marshaling what type

[go-nuts] Re: json murshal/unmarhsal struct that was got using custom interface type

2016-08-01 Thread Viacheslav Biriukov
o the real deal. We did a similar mechanic to this on Docker > Machine at one point where the various Drivers would contain a string > indicating which type they "actually" are. > > Nathan > > On Monday, August 1, 2016 at 10:07:07 AM UTC-7, Viacheslav Biriukov wrote: &