mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-19 22:28:45 +05:00
more go vet
This commit is contained in:
@@ -22,13 +22,14 @@ import (
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -239,7 +240,6 @@ func (cdre *CdrExporter) metaHandler(tag, arg string) (string, error) {
|
||||
default:
|
||||
return "", fmt.Errorf("Unsupported METATAG: %s", tag)
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Compose and cache the header
|
||||
|
||||
@@ -121,7 +121,7 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Println("Welcome to CGRateS console!")
|
||||
fmt.Println("Type `help` for a list of commands\n")
|
||||
fmt.Print("Type `help` for a list of commands\n\n")
|
||||
|
||||
line := liner.NewLiner()
|
||||
defer line.Close()
|
||||
|
||||
@@ -424,7 +424,7 @@ func main() {
|
||||
cdrStats.AddQueue(engine.NewCdrStatsFromCdrStatsCfg(cfg.CDRStatConfig), nil)
|
||||
}
|
||||
server.RpcRegister(cdrStats)
|
||||
server.RpcRegister(&v1.CDRStatsV1{cdrStats}) // Public APIs
|
||||
server.RpcRegister(&v1.CDRStatsV1{CdrStats: cdrStats}) // Public APIs
|
||||
}
|
||||
|
||||
responder := &engine.Responder{ExitChan: exitChan}
|
||||
|
||||
@@ -116,7 +116,14 @@ func main() {
|
||||
if *tpid == "" {
|
||||
log.Fatal("TPid required, please define it via *-tpid* command argument.")
|
||||
}
|
||||
csvImporter := engine.TPCSVImporter{*tpid, storDb, *dataPath, ',', *verbose, *runId}
|
||||
csvImporter := engine.TPCSVImporter{
|
||||
TPId: *tpid,
|
||||
StorDb: storDb,
|
||||
DirPath: *dataPath,
|
||||
Sep: ',',
|
||||
Verbose: *verbose,
|
||||
ImportId: *runId,
|
||||
}
|
||||
if errImport := csvImporter.Run(); errImport != nil {
|
||||
log.Fatal(errImport)
|
||||
}
|
||||
@@ -218,7 +225,17 @@ func main() {
|
||||
if *flush {
|
||||
dstIds, rplIds, rpfIds, rpAliases, lcrIds = nil, nil, nil, nil, nil // Should reload all these on flush
|
||||
}
|
||||
if err = rater.Call("ApierV1.ReloadCache", utils.ApiReloadCache{dstIds, rplIds, rpfIds, actIds, shgIds, rpAliases, accAliases, lcrIds, dcs}, &reply); err != nil {
|
||||
if err = rater.Call("ApierV1.ReloadCache", utils.ApiReloadCache{
|
||||
DestinationIds: dstIds,
|
||||
RatingPlanIds: rplIds,
|
||||
RatingProfileIds: rpfIds,
|
||||
ActionIds: actIds,
|
||||
SharedGroupIds: shgIds,
|
||||
RpAliases: rpAliases,
|
||||
AccAliases: accAliases,
|
||||
LCRIds: lcrIds,
|
||||
DerivedChargers: dcs,
|
||||
}, &reply); err != nil {
|
||||
log.Printf("WARNING: Got error on cache reload: %s\n", err.Error())
|
||||
}
|
||||
actTmgIds, _ := loader.GetLoadedIds(engine.ACTION_TIMING_PREFIX)
|
||||
|
||||
@@ -109,7 +109,7 @@ func durRemoteRater(cd *engine.CallDescriptor) (time.Duration, error) {
|
||||
result := engine.CallCost{}
|
||||
client, err := rpc.Dial("tcp", *raterAddress)
|
||||
if err != nil {
|
||||
return nilDuration, fmt.Errorf("Could not connect to engine: ", err.Error())
|
||||
return nilDuration, fmt.Errorf("Could not connect to engine: %s", err.Error())
|
||||
}
|
||||
defer client.Close()
|
||||
start := time.Now()
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestExecuteActions(t *testing.T) {
|
||||
} else if len(acnt.BalanceMap) != 2 {
|
||||
t.Error("Account does not have enough balances: ", acnt.BalanceMap)
|
||||
} else if acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value != 40 {
|
||||
t.Errorf("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
t.Error("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
} else if acnt.BalanceMap[engine.CREDIT+engine.OUTBOUND][0].Value != 10 {
|
||||
t.Error("Account does not have enough monetary balance", acnt.BalanceMap[engine.CREDIT+engine.OUTBOUND][0].Value)
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestExecuteActions2(t *testing.T) {
|
||||
} else if len(acnt.BalanceMap) != 2 {
|
||||
t.Error("Account does not have enough balances: ", acnt.BalanceMap)
|
||||
} else if acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value != 40 {
|
||||
t.Errorf("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
t.Error("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
} else if acnt.BalanceMap[engine.CREDIT+engine.OUTBOUND][0].Value != 0 {
|
||||
t.Error("Account does not have enough monetary balance", acnt.BalanceMap[engine.CREDIT+engine.OUTBOUND][0].Value)
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func TestExecuteActions3(t *testing.T) {
|
||||
} else if len(acnt.BalanceMap) != 1 {
|
||||
t.Error("Account does not have enough balances: ", acnt.BalanceMap)
|
||||
} else if acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value != 40 {
|
||||
t.Errorf("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
t.Error("Account does not have enough minutes in balance", acnt.BalanceMap[engine.MINUTES+engine.OUTBOUND][0].Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package sessionmanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/osipsdagram"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -61,9 +61,10 @@ func (osipsev *OsipsEvent) AsEvent(evStr string) utils.Event {
|
||||
return osipsev
|
||||
}
|
||||
|
||||
func (osipsev *OsipsEvent) String() string {
|
||||
// arg osipsev for printf causes recursive call to String method
|
||||
/*func (osipsev *OsipsEvent) String() string {
|
||||
return fmt.Sprintf("%+v", osipsev)
|
||||
}
|
||||
}*/
|
||||
|
||||
func (osipsev *OsipsEvent) GetName() string {
|
||||
return osipsev.osipsEvent.Name
|
||||
|
||||
@@ -22,12 +22,13 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/osipsdagram"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewOSipsSessionManager(cfg *config.CGRConfig, rater, cdrsrv engine.Connector) (*OsipsSessionManager, error) {
|
||||
@@ -133,7 +134,6 @@ func (osm *OsipsSessionManager) SubscribeEvents(evStop chan struct{}) error {
|
||||
time.Sleep(osm.cgrCfg.OsipsEvSubscInterval)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (osm *OsipsSessionManager) OnOpensipsStart(cdrDagram *osipsdagram.OsipsEvent) {
|
||||
|
||||
Reference in New Issue
Block a user