Merge pull request #356 from Icinga/bugfix/mustpackany

Clarify what MustPackAny() does
This commit is contained in:
Alexander Aleksandrovič Klimov 2021-09-21 16:16:56 +02:00 committed by GitHub
commit 4371d04d5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -11,11 +11,11 @@ import (
"sort"
)
// MustPackAny calls PackAny using in and panics if there was an error.
func MustPackAny(in ...interface{}) []byte {
// MustPackSlice calls PackAny using items and panics if there was an error.
func MustPackSlice(items ...interface{}) []byte {
var buf bytes.Buffer
if err := PackAny(in, &buf); err != nil {
if err := PackAny(items, &buf); err != nil {
panic(err)
}

View file

@ -72,7 +72,7 @@ func FlattenCustomvars(ctx context.Context, cvs <-chan contracts.Entity) (<-chan
IdMeta: IdMeta{
// TODO(el): Schema comment is wrong.
// Without customvar.Id we would produce duplicate keys here.
Id: utils.Checksum(objectpacker.MustPackAny(customvar.EnvironmentId, customvar.Id, flatname, flatvalue)),
Id: utils.Checksum(objectpacker.MustPackSlice(customvar.EnvironmentId, customvar.Id, flatname, flatvalue)),
},
},
EnvironmentMeta: EnvironmentMeta{