Browse Source

map is unordered in go

master
aeris 4 years ago
parent
commit
dc63f1df01
  1. 4
      identity.go
  2. 2
      main.go

4
identity.go

@ -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
}

2
main.go

@ -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