INNER CODE UNIT · Go

mergeUsers

OWASP/wrongsecrets · scripts/sort_contibutors/main.go:425

func mergeUsers(items []Contributor) ([]Contributor, []Contributor) {
	byUser := map[string]Contributor{}
	for _, item := range items {
		current, ok := byUser[item.Username]
		if !ok {
			byUser[item.Username] = item
			continue
		}
		current.Ranking += item.Ranking
		if strings.TrimSpace(current.Name) == "" {
			current.Name = item.Name
		}
		byUser[item.Username] = current
	}

	merged := make([]Contributor, 0, len(byUser))
	for _, item := range byUser {
		merged = append(merged, item)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…