Re: [go-nuts] slice pointer to type Token []byte

2019-12-25 Thread Gert
On Thursday, December 26, 2019 at 4:33:23 AM UTC+1, burak serdar wrote: > > On Wed, Dec 25, 2019 at 8:05 PM Gert > > wrote: > > > > Is there a cleaner way to write the > > > > s:= *t > > *t = s[i+1:] > > > > part? > > > > was hoping for something like *t = *t[i+1:] > > Indexing comes b

Re: [go-nuts] slice pointer to type Token []byte

2019-12-25 Thread burak serdar
On Wed, Dec 25, 2019 at 8:05 PM Gert wrote: > > Is there a cleaner way to write the > > s:= *t > *t = s[i+1:] > > part? > > was hoping for something like *t = *t[i+1:] Indexing comes before indirection, so use parens: *t=(*t)[i+1:] > > > type Token []byte > > func (t *Token) Next() bool { > if

[go-nuts] slice pointer to type Token []byte

2019-12-25 Thread Gert
Is there a cleaner way to write the s:= *t *t = s[i+1:] part? was hoping for something like *t = *t[i+1:] type Token []byte func (t *Token) Next() bool { if i := bytes.IndexByte(*t, '.'); i > -1 { s := *t *t = s[i+1:] return true } return false } func (t Token) String() string { if i := byt

[go-nuts] issue with yaml processing

2019-12-25 Thread R Srinivasan
I have the following fragment in an input yaml file: contents: [ '../etst1/date1from1' , 'var/lib/to1' , 'from2' , 'to2' ] My go struct for the above looks like: type Config struct { Contents []string `yaml:"contents"` } I use the package gopkg.in/yaml.v3 when I unmarshal a