Closed nikhil-thomas closed 2 years ago
At present, the selector remains empty even after the sel.Add(req) call.
sel.Add(req)
fmt.Printf("%v", sel) prints empty string.
fmt.Printf("%v", sel)
This is because the mutated sel is not reveived and assigned to sel at the caller.
note: the signature of sel.Add function is Add(r ...Requirement) Selector
Add(r ...Requirement) Selector
Signed-off-by: Nikhil Thomas nikhilthomas1@gmail.com
Good catch! The Add() behavior turns out to be quite confusing!
Add()
At present, the selector remains empty even after the
sel.Add(req)
call.fmt.Printf("%v", sel)
prints empty string.This is because the mutated sel is not reveived and assigned to sel at the caller.
note: the signature of sel.Add function is
Add(r ...Requirement) Selector
Signed-off-by: Nikhil Thomas nikhilthomas1@gmail.com