(address []string)
| 3 | import "strings" |
| 4 | |
| 5 | func formatAddr(address []string) []string { |
| 6 | ra := make([]string, 0, len(address)) |
| 7 | for _, a := range address { |
| 8 | if a != "" { |
| 9 | if !strings.HasPrefix(a, "http://") && !strings.HasPrefix(a, "https://") { |
| 10 | a = "http://" + a |
| 11 | } |
| 12 | |
| 13 | ra = append(ra, strings.TrimSuffix(a, "/")+"/") |
| 14 | } |
| 15 | } |
| 16 | return ra |
| 17 | } |