cleaned go vet stuff

This commit is contained in:
Radu Ioan Fericean
2012-09-30 14:05:55 +03:00
parent 394033e5d2
commit 7dd14f9038
11 changed files with 14 additions and 15 deletions

View File

@@ -166,7 +166,7 @@ func main() {
}
if err != nil {
log.Fatal("Could not open database connection: %v", err)
log.Fatalf("Could not open database connection: %v", err)
}
// writing to database

View File

@@ -208,7 +208,7 @@ func startMediator(responder *timespans.Responder, loggerDb timespans.DataStorag
timespans.Logger.Crit(fmt.Sprintf("Could not connect to rater: %v", err))
exitChan <- true
}
connector = &timespans.RPCClientConnector{client}
connector = &timespans.RPCClientConnector{Client: client}
}
if _, err := os.Stat(mediator_cdr_path); err != nil {
timespans.Logger.Crit(fmt.Sprintf("The input path for mediator does not exist: %v", mediator_cdr_path))
@@ -251,13 +251,13 @@ func startSessionManager(responder *timespans.Responder, loggerDb timespans.Data
timespans.Logger.Crit(fmt.Sprintf("Could not connect to rater: %v", err))
exitChan <- true
}
connector = &timespans.RPCClientConnector{client}
connector = &timespans.RPCClientConnector{Client: client}
}
switch sm_switch_type {
case FS:
sm := sessionmanager.NewFSSessionManager(loggerDb)
dp, _ := time.ParseDuration(fmt.Sprintf("%vs", sm_debit_period))
sm.Connect(&sessionmanager.SessionDelegate{connector, dp}, freeswitch_server, freeswitch_pass)
sm.Connect(&sessionmanager.SessionDelegate{Connector: connector, DebitPeriod: dp}, freeswitch_server, freeswitch_pass)
default:
timespans.Logger.Err(fmt.Sprintf("Cannot start session manger of type: %s!", sm_switch_type))
exitChan <- true

View File

@@ -67,7 +67,7 @@ func unregisterFromBalancer() {
return
}
var reply int
timespans.Logger.Info(fmt.Sprintf("Unregistering from balancer ", rater_balancer))
timespans.Logger.Info(fmt.Sprintf("Unregistering from balancer %s", rater_balancer))
client.Call("Responder.UnRegisterRater", rater_listen, &reply)
if err := client.Close(); err != nil {
timespans.Logger.Crit("Could not close balancer unregistration!")
@@ -81,12 +81,12 @@ Connects to the balancer and rehisters the rater to the server.
func registerToBalancer() {
client, err := rpc.Dial("tcp", rater_balancer)
if err != nil {
timespans.Logger.Crit(fmt.Sprintf("Cannot contact the balancer!", err))
timespans.Logger.Crit(fmt.Sprintf("Cannot contact the balancer: %v", err))
exitChan <- true
return
}
var reply int
timespans.Logger.Info(fmt.Sprintf("Registering to balancer ", rater_balancer))
timespans.Logger.Info(fmt.Sprintf("Registering to balancer %s", rater_balancer))
client.Call("Responder.RegisterRater", rater_listen, &reply)
if err := client.Close(); err != nil {
timespans.Logger.Crit("Could not close balancer registration!")

View File

@@ -132,7 +132,7 @@ func (m *Mediator) TrackCDRFiles(cdrPath string) (err error) {
}
}
case err := <-watcher.Error:
timespans.Logger.Err(fmt.Sprintf("Inotify error: ", err))
timespans.Logger.Err(fmt.Sprintf("Inotify error: %v", err))
}
}
return

View File

@@ -67,7 +67,7 @@ func resetTriggersAction(ub *UserBalance, a *Action) (err error) {
}
func setPostpaidAction(ub *UserBalance, a *Action) (err error) {
ub.Type = UB_TYPE_POSTPAID
ub.Type = UB_TYPE_POSTPAID
return
}

View File

@@ -208,7 +208,7 @@ func (at *ActionTiming) Execute() (err error) {
at.resetStartTimeCache()
aac, err := at.getActions()
if err != nil {
Logger.Err(fmt.Sprintf("Failed to get actions: ", err))
Logger.Err(fmt.Sprintf("Failed to get actions: %v", err))
return
}
for _, a := range aac {

View File

@@ -42,7 +42,7 @@ func (at *ActionTrigger) Execute(ub *UserBalance) (err error) {
aac, err = storageGetter.GetActions(at.ActionsId)
aac.Sort()
if err != nil {
Logger.Err(fmt.Sprintf("Failed to get actions: ", err))
Logger.Err(fmt.Sprintf("Failed to get actions: %v", err))
return
}
for _, a := range aac {

View File

@@ -300,7 +300,7 @@ func (csvr *CSVReader) LoadRatingProfiles(fn string, comma rune) (err error) {
for _, d := range csvr.destinations {
ap, exists := csvr.activationPeriods[record[5]]
if !exists {
return errors.New(fmt.Sprintf("Could not load ratinTiming for tag: ", record[5]))
return errors.New(fmt.Sprintf("Could not load ratinTiming for tag: %v", record[5]))
}
newAP := &ActivationPeriod{ActivationTime: at}
//copy(newAP.Intervals, ap.Intervals)

View File

@@ -92,7 +92,7 @@ func (rp *RatingProfile) GetActivationPeriodsForPrefix(destPrefix string) (found
for k, v := range rp.DestinationMap {
d, err := GetDestination(k)
if err != nil {
Logger.Err(fmt.Sprintf("Cannot find destination with id: ", k))
Logger.Err(fmt.Sprintf("Cannot find destination with id: %s", k))
continue
}
if precision, ok := d.containsPrefix(destPrefix); ok && precision > bestPrecision {

View File

@@ -94,7 +94,6 @@ func (rs *RedisStorage) SetActions(key string, as []*Action) (err error) {
func (rs *RedisStorage) GetUserBalance(key string) (ub *UserBalance, err error) {
if values, err := rs.db.Get(USER_BALANCE_PREFIX + key).Bytes(); err == nil {
Logger.Debug(fmt.Sprintf("Got: %v", values, err))
ub = &UserBalance{Id: key}
err = rs.ms.Unmarshal(values, ub)
} else {

View File

@@ -54,7 +54,7 @@ func (uc *UnitsCounter) addMinutes(amount float64, prefix string) {
for _, mb := range uc.MinuteBuckets {
d, err := GetDestination(mb.DestinationId)
if err != nil {
Logger.Err(fmt.Sprintf("Minutes counter: unknown destination: ", mb.DestinationId))
Logger.Err(fmt.Sprintf("Minutes counter: unknown destination: %s", mb.DestinationId))
continue
}
if _, ok := d.containsPrefix(prefix); ok {