| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package format | 5 package format |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "sync" | 9 "sync" |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 registry.r = nil | 57 registry.r = nil |
| 58 } | 58 } |
| 59 | 59 |
| 60 // getFormatter returns the Formatter associated with the provided Format. | 60 // getFormatter returns the Formatter associated with the provided Format. |
| 61 func getFormatter(f string) (Formatter, error) { | 61 func getFormatter(f string) (Formatter, error) { |
| 62 registry.RLock() | 62 registry.RLock() |
| 63 defer registry.RUnlock() | 63 defer registry.RUnlock() |
| 64 | 64 |
| 65 formatter := registry.r[f] | 65 formatter := registry.r[f] |
| 66 if formatter == nil { | 66 if formatter == nil { |
| 67 » » return nil, errors.Reason("unknown formatter: %(formatter)q").D(
"formatter", f).Err() | 67 » » return nil, errors.Reason("unknown formatter: %q", f).Err() |
| 68 } | 68 } |
| 69 return formatter, nil | 69 return formatter, nil |
| 70 } | 70 } |
| OLD | NEW |