| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. | 1 // Copyright 2017 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // applied to an error directly with the Apply method. | 31 // applied to an error directly with the Apply method. |
| 32 // | 32 // |
| 33 // Usually tag implementations will have a typesafe With method that gen
erates | 33 // Usually tag implementations will have a typesafe With method that gen
erates |
| 34 // these. Avoid constructing these ad-hoc so that a given tag definition
can | 34 // these. Avoid constructing these ad-hoc so that a given tag definition
can |
| 35 // control the type safety around these. | 35 // control the type safety around these. |
| 36 TagValue struct { | 36 TagValue struct { |
| 37 Key TagKey | 37 Key TagKey |
| 38 Value interface{} | 38 Value interface{} |
| 39 } | 39 } |
| 40 | 40 |
| 41 » // A TagValueGenerator generates (TagKey, value) pairs, for use with Ann
oatator.Tag | 41 » // TagValueGenerator generates (TagKey, value) pairs, for use with Annoa
tator.Tag |
| 42 // and New(). | 42 // and New(). |
| 43 TagValueGenerator interface { | 43 TagValueGenerator interface { |
| 44 GenerateErrorTagValue() TagValue | 44 GenerateErrorTagValue() TagValue |
| 45 } | 45 } |
| 46 ) | 46 ) |
| 47 | 47 |
| 48 var _ sort.Interface = tagKeySlice(nil) | 48 var _ sort.Interface = tagKeySlice(nil) |
| 49 | 49 |
| 50 func (s tagKeySlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } | 50 func (s tagKeySlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } |
| 51 func (s tagKeySlice) Len() int { return len(s) } | 51 func (s tagKeySlice) Len() int { return len(s) } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 for k, v := range ctx.tags { | 161 for k, v := range ctx.tags { |
| 162 if _, ok := ret[k]; !ok { | 162 if _, ok := ret[k]; !ok { |
| 163 ret[k] = v | 163 ret[k] = v |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 return true | 167 return true |
| 168 }) | 168 }) |
| 169 return ret | 169 return ret |
| 170 } | 170 } |
| OLD | NEW |