The Go compiler is complaining about my code to append a slice to a slice. Here are relevant excerpts:
type LanidEntry struct {
lanid string
group string
contact string
}
var lanids []LanidEntry
func load_file() (lanids_loaded []LanidEntry, errormsgs string) {
// ...
}
func Load() (lanids []LanidEntry, errormessages string) {
lanids_loaded, errormsgs := load_file(filename1, contact1)
lanids = append(lanids, lanids_loaded)
// ...
}
The append
line generates this compiler message:
src\load_lanids\load_lanids.go:50: cannot use lanids_loaded (type []LanidEntry) as type LanidEntry in append
I know that appending slices to slices works fine, based on an example in a Go Blog post under the section headed Append: The built-in function.