diff options
Diffstat (limited to 'vendor/github.com/stretchr/objx/codegen/array-access.txt')
-rw-r--r-- | vendor/github.com/stretchr/objx/codegen/array-access.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/stretchr/objx/codegen/array-access.txt b/vendor/github.com/stretchr/objx/codegen/array-access.txt new file mode 100644 index 000000000..306023475 --- /dev/null +++ b/vendor/github.com/stretchr/objx/codegen/array-access.txt @@ -0,0 +1,14 @@ + case []{1}: + a := object.([]{1}) + if isSet { + a[index] = value.({1}) + } else { + if index >= len(a) { + if panics { + panic(fmt.Sprintf("objx: Index %d is out of range because the []{1} only contains %d items.", index, len(a))) + } + return nil + } else { + return a[index] + } + } |