brand new to go here and trying to set up a simple rest server to get the basics down of go. I have my routes configured and am now trying to set up some basic POST/GET calls with just storing some items in memory. I am trying to set up a struct and just push a payload into memory and fetch for example. I am not sure how to fix this error, but here is what I have so far.
The activity setup (activity.go):
package main
type Activity struct {
activityCgid string `json:"activityCgid"`
title string `json:"title"`
description string `json:"description"`
availableDate int `json:"availableDate"`
dueDate int `json:"dueDate"`
navigationTypes []string `json:"navigationTypes"`
containerCgi string `json:"containerCgi"`
position int `json:"position"`
}
type Activities []Activity
And then in my repo.go, I just have this :
func RepoCreateActivity(t Activity) Activity {
activities = append(activities, t)
return t
}
and above it, I have :
var activities Activity
To which go is pointing to and saying first argument to append must be slice; have struct
(and the struct following). Would appreciate any advice as I have just begun learning go. Thank you for reading!