cleanup printlns

Change-Id: I49a48446029ba2e66b09f138a1477b837d55766a
This commit is contained in:
Han Kang 2022-10-12 09:47:49 -07:00
parent 658d7a184e
commit f3cb904618

View File

@ -443,7 +443,6 @@ func (c *metricDecoder) decodeUint32(expr ast.Expr) (uint32, error) {
func (c *metricDecoder) decodeInt64(expr ast.Expr) (int64, error) { func (c *metricDecoder) decodeInt64(expr ast.Expr) (int64, error) {
switch v := expr.(type) { switch v := expr.(type) {
case *ast.BasicLit: case *ast.BasicLit:
println("BasicLit")
if v.Kind != token.FLOAT && v.Kind != token.INT { if v.Kind != token.FLOAT && v.Kind != token.INT {
print(v.Kind) print(v.Kind)
} }
@ -454,10 +453,8 @@ func (c *metricDecoder) decodeInt64(expr ast.Expr) (int64, error) {
} }
return value, nil return value, nil
case *ast.SelectorExpr: case *ast.SelectorExpr:
println("SelectorExpr")
variableName := v.Sel.String() variableName := v.Sel.String()
importName, ok := v.X.(*ast.Ident) importName, ok := v.X.(*ast.Ident)
println(variableName)
if ok && importName.String() == c.kubeMetricsImportName { if ok && importName.String() == c.kubeMetricsImportName {
if variableName == "DefMaxAge" { if variableName == "DefMaxAge" {
// hardcode this for now. This is a duration but we'll output it as // hardcode this for now. This is a duration but we'll output it as
@ -479,19 +476,16 @@ func (c *metricDecoder) decodeInt64(expr ast.Expr) (int64, error) {
} }
case *ast.CallExpr: case *ast.CallExpr:
println("CallExpr")
_, ok := v.Fun.(*ast.SelectorExpr) _, ok := v.Fun.(*ast.SelectorExpr)
if !ok { if !ok {
return 0, newDecodeErrorf(v, errDecodeInt64) return 0, newDecodeErrorf(v, errDecodeInt64)
} }
return 0, nil return 0, nil
case *ast.BinaryExpr: case *ast.BinaryExpr:
i, err2, done := c.extractTimeExpression(v) i, err2, done := c.extractTimeExpression(v)
if done { if done {
return i, err2 return i, err2
} }
} }
return 0, newDecodeErrorf(expr, errDecodeInt64) return 0, newDecodeErrorf(expr, errDecodeInt64)
} }