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
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
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
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