Skip to content
This repository has been archived by the owner on Jan 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #126 from SscSPs/master
Browse files Browse the repository at this point in the history
Use the username provided in GCP address to ssh
  • Loading branch information
deansheather authored Aug 23, 2019
2 parents 1b15b2b + 7015331 commit 940305f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions sshcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,17 +552,6 @@ func parseGCPSSHCmd(instance string) (ip, sshFlags string, err error) {

// E.g. [email protected].
userIP := toks[len(toks)-1]
toks = strings.Split(userIP, "@")
// Assume the '<user>@' is missing.
if len(toks) < 2 {
ip = strings.TrimSpace(toks[0])
} else {
ip = strings.TrimSpace(toks[1])
}

if net.ParseIP(ip) == nil {
return "", "", xerrors.Errorf("parsed invalid ip address %v", ip)
}

return ip, sshFlags, nil
return strings.TrimSpace(userIP), sshFlags, nil
}

0 comments on commit 940305f

Please sign in to comment.