src/server/auth/server/api_server.go
func (a *apiServer) canonicalizeSubjects(ctx context.Context, subjects []string) ([]string, error) {
	if subjects == nil {
		return []string{}, nil
	}

	eg := &errgroup.Group{}
	canonicalizedSubjects := make([]string, len(subjects))
	for i, subject := range subjects {
		i, subject := i, subject
		eg.Go(func() error {
			subject, err := a.canonicalizeSubject(ctx, subject)
			if err != nil {
				return err
			}
			canonicalizedSubjects[i] = subject
			return nil
		})
	}
	if err := eg.Wait(); err != nil {
		return nil, err
	}

	return canonicalizedSubjects, nil
}
func (a *apiServer) canonicalizeSubjects(ctx context.Context, subjects []string) ([]string, error) {
	if subjects == nil {
		return []string{}, nil
	}

	eg := &errgroup.Group{}
	canonicalizedSubjects := make([]string, len(subjects))
	for i, subject := range subjects {
		i, subject := i, subject
		eg.Go(func() error {
			subject, err := a.canonicalizeSubject(ctx, subject)
			if err != nil {
				return err
			}
			canonicalizedSubjects[i] = subject
			return nil
		})
	}
	if err := eg.Wait(); err != nil {
		return nil, err
	}

	return canonicalizedSubjects, nil
}
func ( a * apiServer ) canonicalizeSubjects ( ctx context . Context , subjects [ ] string ) ( [ ] string , error ) { if subjects == nil { return [ ] string { } , nil } eg := & errgroup . Group { } canonicalizedSubjects := make ( [ ] string , len ( subjects ) ) for i , subject := range subjects { i , subject := i , subject eg . Go ( func ( ) error { subject , err := a . canonicalizeSubject ( ctx , subject ) if err != nil { return err } canonicalizedSubjects [ i ] = subject return nil } ) } if err := eg . Wait ( ) ; err != nil { return nil , err } return canonicalizedSubjects , nil }
// canonicalizeSubjects applies canonicalizeSubject to a list
canonicalizeSubjects applies canonicalizeSubject to a list