Pushing index with go

I’m new to algolia but also new with go. I have some code that parses a few hundred text files into json. When writing the resulting json to a text file, it looks just fine.

// struct for json conversion
type algoliaObject struct {
	Field1 string			`json:"field1"`
    Field2 string		`json:"field2"`

`var algoliaObjects []algoliaObject`

algoInd := algoliaObject{
	Field1: nbr,
	Field2: strings.TrimSpace(sliceOfString[i]),

algoliaObjects = append(algoliaObjects, algoInd)

when I then use:

encoder =: json.NewEncoder(fileWriter)

I get a proper json file containing all the records i’d expect to see.
I have no idea however how to add this slice of struct to:

objects := []algoliasearch.Object {./*objects should be added here*/.}
to then use:

res, err := index.AddObjects(objects)

I tried to use json.Marshal(algoliaObjects) but that creates a of byte, which is not accepted by algoliasearch.Object()

Any ideas anybody?