pkg/daemon/action/clone.go
Method Server.Clone
has 101 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (svr *Server) Clone(req *rpc.CloneRequest, resp rpc.Daemon_CloneServer) (err error) {
defer func() {
util.InitLoggerForServer(true)
log.SetOutput(svr.LogFile)
config.Debug = false
Method Server.Clone
has 10 return statements (exceeds 4 allowed). Open
Open
func (svr *Server) Clone(req *rpc.CloneRequest, resp rpc.Daemon_CloneServer) (err error) {
defer func() {
util.InitLoggerForServer(true)
log.SetOutput(svr.LogFile)
config.Debug = false
Avoid deeply nested control flow statements. Open
Open
} else if code := status.Code(err); code == codes.AlreadyExists {
return fmt.Errorf("connect with cluster already established, disconnect required before proceeding")
} else {
return err
}