code: func (path *Path) RemoveCommunities(communities []uint32) int {
  
  	if len(communities) == 0 {
  		// do nothing
  		return 0
  	}
  
  	find := func(val uint32) bool {
  		for _, com := range communities {
  			if com == val {
  				return true
  			}
  		}
  		return false
  	}
  
  	count := 0
  	attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_COMMUNITIES)
  	if attr != nil {
  		newList := make([]uint32, 0)
  		c := attr.(*bgp.PathAttributeCommunities)
  
  		for _, value := range c.Value {
  			if find(value) {
  				count += 1
  			} else {
  				newList = append(newList, value)
  			}
  		}
  
  		if len(newList) != 0 {
  			path.setPathAttr(bgp.NewPathAttributeCommunities(newList))
  		} else {
  			path.delPathAttr(bgp.BGP_ATTR_TYPE_COMMUNITIES)
  		}
  	}
  	return count
  }
docs: // RemoveCommunities removes specific communities.
  // If the length of communities is 0, it does nothing.
  // If all communities are removed, it removes Communities path attribute itself.