如何为包含Google自动生成的lib的切片的结构初始化

I'm trying to make a Google Analytics Go library based off the auto generated package generated here

I have authenticated, got account summaries etc. so all is well until I try to construct a reporting request.

I am trying to init a struct ReportRequest that has the following:

type ReportRequest struct {

    DateRanges []*DateRange `json:"dateRanges,omitempty"`

    ...etc
}

How can I made a function that wraps this struct so I can pass in the values? Consulting the DateRange struct it seems simple enough, but I get messages about not passing in a slice pointer to DateRange which I can't figure out how to construct.

I have tried this:

func makeRequest(
    start, end string) *ga.GetReportsRequest {

    daterangep := &ga.DateRange{StartDate: start, EndDate: end}

    requests := ga.ReportRequest{}
    requests.DateRanges = daterangep

But get a compiler error:

cannot use daterangep (type *analyticsreporting.DateRange) as type []*analyticsreporting.DateRange in assignment

Is it possible to send in JSON? I see some MarshalJSON functions that I don't know if I can use,and the json declaration in the object but I'd prefer to be able to use Go objects.

Can anyone point to what I'm doing wrong?

To initialize a slice you can use a literal:

daterangep := []*ga.DateRange{{StartDate: start, EndDate: end}}

You can use make:

daterangep := make([]*ga.DateRange, 1)
daterangep[0] = &ga.DateRange{StartDate: start, EndDate: end}

Or you can declare it and then use append:

var daterangep []*ga.DateRange
daterangep = append(daterangep, &ga.DateRange{StartDate: start, EndDate: end})