misc: Replace sloppy use of %v with %s

This commit is contained in:
James Shubin
2017-03-16 13:18:36 -04:00
parent 3e001f9a1c
commit 028ef14cc0
4 changed files with 13 additions and 13 deletions

View File

@@ -431,7 +431,7 @@ Loop:
playback = true
log.Printf("%s[%s]: CheckApply errored: %v", v.Kind(), v.GetName(), e)
if retry == 0 {
if err := obj.Prometheus().UpdateState(fmt.Sprintf("%v[%v]", v.Kind(), v.GetName()), v.Kind(), prometheus.ResStateHardFail); err != nil {
if err := obj.Prometheus().UpdateState(fmt.Sprintf("%s[%s]", v.Kind(), v.GetName()), v.Kind(), prometheus.ResStateHardFail); err != nil {
// TODO: how to error this?
log.Printf("%s[%s]: Prometheus.UpdateState() errored: %v", v.Kind(), v.GetName(), err)
}
@@ -444,7 +444,7 @@ Loop:
if retry > 0 { // don't decrement the -1
retry--
}
if err := obj.Prometheus().UpdateState(fmt.Sprintf("%v[%v]", v.Kind(), v.GetName()), v.Kind(), prometheus.ResStateSoftFail); err != nil {
if err := obj.Prometheus().UpdateState(fmt.Sprintf("%s[%s]", v.Kind(), v.GetName()), v.Kind(), prometheus.ResStateSoftFail); err != nil {
// TODO: how to error this?
log.Printf("%s[%s]: Prometheus.UpdateState() errored: %v", v.Kind(), v.GetName(), err)
}

View File

@@ -39,7 +39,7 @@ func (g *Graph) addEdgesByMatchingUIDS(v *Vertex, uids []resources.ResUID) []boo
continue
}
if g.Flags.Debug {
log.Printf("Compile: AutoEdge: Match: %v[%v] with UID: %v[%v]", vv.Kind(), vv.GetName(), uid.Kind(), uid.GetName())
log.Printf("Compile: AutoEdge: Match: %s[%s] with UID: %s[%s]", vv.Kind(), vv.GetName(), uid.Kind(), uid.GetName())
}
// we must match to an effective UID for the resource,
// that is to say, the name value of a res is a helpful
@@ -48,12 +48,12 @@ func (g *Graph) addEdgesByMatchingUIDS(v *Vertex, uids []resources.ResUID) []boo
if resources.UIDExistsInUIDs(uid, vv.UIDs()) {
// add edge from: vv -> v
if uid.Reversed() {
txt := fmt.Sprintf("AutoEdge: %v[%v] -> %v[%v]", vv.Kind(), vv.GetName(), v.Kind(), v.GetName())
log.Printf("Compile: Adding %v", txt)
txt := fmt.Sprintf("AutoEdge: %s[%s] -> %s[%s]", vv.Kind(), vv.GetName(), v.Kind(), v.GetName())
log.Printf("Compile: Adding %s", txt)
g.AddEdge(vv, v, NewEdge(txt))
} else { // edges go the "normal" way, eg: pkg resource
txt := fmt.Sprintf("AutoEdge: %v[%v] -> %v[%v]", v.Kind(), v.GetName(), vv.Kind(), vv.GetName())
log.Printf("Compile: Adding %v", txt)
txt := fmt.Sprintf("AutoEdge: %s[%s] -> %s[%s]", v.Kind(), v.GetName(), vv.Kind(), vv.GetName())
log.Printf("Compile: Adding %s", txt)
g.AddEdge(v, vv, NewEdge(txt))
}
found = true
@@ -74,14 +74,14 @@ func (g *Graph) AutoEdges() {
}
autoEdgeObj := v.AutoEdges()
if autoEdgeObj == nil {
log.Printf("%v[%v]: Config: No auto edges were found!", v.Kind(), v.GetName())
log.Printf("%s[%s]: Config: No auto edges were found!", v.Kind(), v.GetName())
continue // next vertex
}
for { // while the autoEdgeObj has more uids to add...
uids := autoEdgeObj.Next() // get some!
if uids == nil {
log.Printf("%v[%v]: Config: The auto edge list is empty!", v.Kind(), v.GetName())
log.Printf("%s[%s]: Config: The auto edge list is empty!", v.Kind(), v.GetName())
break // inner loop
}
if g.Flags.Debug {

View File

@@ -364,7 +364,7 @@ func (obj *BaseRes) Init() error {
// TODO: this StatefulBool implementation could be eventually swappable
//obj.refreshState = &DiskBool{Path: path.Join(dir, refreshPathToken)}
if err := obj.Prometheus().AddManagedResource(fmt.Sprintf("%v[%v]", obj.Kind(), obj.GetName()), obj.Kind()); err != nil {
if err := obj.Prometheus().AddManagedResource(fmt.Sprintf("%s[%s]", obj.Kind(), obj.GetName()), obj.Kind()); err != nil {
return errwrap.Wrapf(err, "could not increase prometheus counter!")
}
@@ -385,7 +385,7 @@ func (obj *BaseRes) Close() error {
close(obj.stopped)
obj.waitGroup.Done()
if err := obj.Prometheus().RemoveManagedResource(fmt.Sprintf("%v[%v]", obj.Kind(), obj.GetName()), obj.kind); err != nil {
if err := obj.Prometheus().RemoveManagedResource(fmt.Sprintf("%s[%s]", obj.Kind(), obj.GetName()), obj.kind); err != nil {
return errwrap.Wrapf(err, "could not decrease prometheus counter!")
}

View File

@@ -183,7 +183,7 @@ func (c *GraphConfig) NewGraphFromConfig(hostname string, world resources.World,
if matched {
// we've already matched this resource, should we match again?
log.Printf("Config: Warning: Matching %v[%v] again!", kind, res.GetName())
log.Printf("Config: Warning: Matching %s[%s] again!", kind, res.GetName())
}
matched = true
@@ -196,7 +196,7 @@ func (c *GraphConfig) NewGraphFromConfig(hostname string, world resources.World,
res.CollectPattern(t.Pattern) // res.Dirname = t.Pattern
}
log.Printf("Collect: %v[%v]: collected!", kind, res.GetName())
log.Printf("Collect: %s[%s]: collected!", kind, res.GetName())
// XXX: similar to other resource add code:
if _, exists := lookup[kind]; !exists {