fix the go vet for go tip

This commit is contained in:
astaxie 2016-01-29 13:11:11 +08:00
parent 1bf52e8922
commit 0382146c60
2 changed files with 8 additions and 9 deletions

View File

@ -319,7 +319,7 @@ func LoadAppConfig(adapterName, configPath string) error {
} }
if !utils.FileExists(absConfigPath) { if !utils.FileExists(absConfigPath) {
return fmt.Errorf("the target config file: %s don't exist!", configPath) return fmt.Errorf("the target config file: %s don't exist", configPath)
} }
if absConfigPath == appConfigPath { if absConfigPath == appConfigPath {

View File

@ -90,16 +90,15 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
addr = ":https" addr = ":https"
} }
config := &tls.Config{} if srv.TLSConfig == nil {
if srv.TLSConfig != nil { srv.TLSConfig = &tls.Config{}
*config = *srv.TLSConfig
} }
if config.NextProtos == nil { if srv.TLSConfig.NextProtos == nil {
config.NextProtos = []string{"http/1.1"} srv.TLSConfig.NextProtos = []string{"http/1.1"}
} }
config.Certificates = make([]tls.Certificate, 1) srv.TLSConfig.Certificates = make([]tls.Certificate, 1)
config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile) srv.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
if err != nil { if err != nil {
return return
} }
@ -113,7 +112,7 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
} }
srv.tlsInnerListener = newGraceListener(l, srv) srv.tlsInnerListener = newGraceListener(l, srv)
srv.GraceListener = tls.NewListener(srv.tlsInnerListener, config) srv.GraceListener = tls.NewListener(srv.tlsInnerListener, srv.TLSConfig)
if srv.isChild { if srv.isChild {
process, err := os.FindProcess(os.Getppid()) process, err := os.FindProcess(os.Getppid())