Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for atMostNJoin (0.16 sec)

  1. pilot/pkg/xds/util.go

    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    package xds
    
    import (
    	"fmt"
    	"strings"
    )
    
    func atMostNJoin(data []string, limit int) string {
    	if limit == 0 || limit == 1 {
    		// Assume limit >1, but make sure we dpn't crash if someone does pass those
    		return strings.Join(data, ", ")
    	}
    	if len(data) == 0 {
    		return ""
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jan 12 18:20:36 UTC 2024
    - 1021 bytes
    - Viewed (0)
  2. pilot/pkg/xds/util_test.go

    			0,
    			"a, b, c",
    		},
    		{
    			[]string{},
    			3,
    			"",
    		},
    	}
    	for _, tt := range tests {
    		t.Run(fmt.Sprintf("%s-%d", strings.Join(tt.data, "-"), tt.limit), func(t *testing.T) {
    			if got := atMostNJoin(tt.data, tt.limit); got != tt.want {
    				t.Errorf("got %v, want %v", got, tt.want)
    			}
    		})
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jan 12 18:20:36 UTC 2024
    - 1.2K bytes
    - Viewed (0)
Back to top