Browse Source

map is unordered in go

master
aeris 2 years ago
parent
commit
dc63f1df01
2 changed files with 4 additions and 2 deletions
  1. +3
    -1
      identity.go
  2. +1
    -1
      main.go

+ 3
- 1
identity.go View File

@@ -53,7 +53,9 @@ func findIdentityName(config Config, prog string, args []string) string {
}
identities := config.Identities
host := extractHost(prog, args)
for match, name := range identities {
for _, identity := range identities {
match := identity.Key.(string)
name := identity.Value.(string)
if strings.Contains(host, match) {
return name
}


+ 1
- 1
main.go View File

@@ -15,7 +15,7 @@ type Config struct {
AgentsDir string
IdentitiesDir string
DefaultIdentity string `yaml:"default_identity"`
Identities map[string]string
Identities yaml.MapSlice
}

var sshOptions = map[string]map[string]string{


Loading…
Cancel
Save