fix `go vet` identified issues

This commit is contained in:
Billie Cleek 2015-05-02 17:50:07 -07:00 committed by Billie H. Cleek
parent 5366393f9f
commit 2dc9e0af3f
2 changed files with 6 additions and 7 deletions

View File

@ -52,6 +52,7 @@ func (c *adapter) Serve() {
conn, err := c.l.Accept()
select {
case <-c.done:
close(errc)
return
default:
if err != nil {
@ -62,8 +63,6 @@ func (c *adapter) Serve() {
}(conn)
}
}
close(errc)
}
func (c *adapter) Handle(conn net.Conn, errc chan<- error) error {
@ -83,9 +82,9 @@ func (c *adapter) Handle(conn net.Conn, errc chan<- error) error {
continue
}
go func(errc chan<- error) {
errc <- c.handleSession(newChannel)
}(errc)
go func(errc chan<- error, ch ssh.NewChannel) {
errc <- c.handleSession(ch)
}(errc, newChannel)
}
return nil

View File

@ -115,8 +115,8 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
keyChecker := ssh.CertChecker{
UserKeyFallback: func(conn ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
if conn.User() != "packer-ansible" {
ui.Say(fmt.Sprintf("%s is not a valid user"))
if user := conn.User(); user != "packer-ansible" {
ui.Say(fmt.Sprintf("%s is not a valid user", user))
return nil, errors.New("authentication failed")
}