code: func setObjectSelfLink(ctx context.Context, obj runtime.Object, req *http.Request, namer ScopeNamer) error {
  	// We only generate list links on objects that implement ListInterface - historically we duck typed this
  	// check via reflection, but as we move away from reflection we require that you not only carry Items but
  	// ListMeta into order to be identified as a list.
  	if !meta.IsListType(obj) {
  		requestInfo, ok := request.RequestInfoFrom(ctx)
  		if !ok {
  			return fmt.Errorf("missing requestInfo")
  		}
  		return setSelfLink(obj, requestInfo, namer)
  	}
  
  	uri, err := namer.GenerateListLink(req)
  	if err != nil {
  		return err
  	}
  	if err := namer.SetSelfLink(obj, uri); err != nil {
  		klog.V(4).Infof("Unable to set self link on object: %v", err)
  	}
  	requestInfo, ok := request.RequestInfoFrom(ctx)
  	if !ok {
  		return fmt.Errorf("missing requestInfo")
  	}
  
  	count := 0
  	err = meta.EachListItem(obj, func(obj runtime.Object) error {
  		count++
  		return setSelfLink(obj, requestInfo, namer)
  	})
  
  	if count == 0 {
  		if err := meta.SetList(obj, []runtime.Object{}); err != nil {
  			return err
  		}
  	}
  
  	return err
  }
docs: // setObjectSelfLink sets the self link of an object as needed.
  // TODO: remove the need for the namer LinkSetters by requiring objects implement either Object or List
  //   interfaces