This adds the new `required_plugins` block to be nested under the packer block. Example: ```hcl packer { required_plugins { aws = { version = ">= 2.7.0" source = "azr/aws" } azure = ">= 2.7.0" } } ``` For example on darwin_amd64 Packer will install those under : * "${PACKER_HOME_DIR}/plugin/github.com/azr/amazon/packer-plugin-amazon_2.7.0_x5.0_darwin_amd64" * "${PACKER_HOME_DIR}/plugin/github.com/hashicorp/azure/packer-plugin-azure_2.7.0_x5.0_darwin_amd64_x5" + docs + tests
65 lines
1.4 KiB
Go
65 lines
1.4 KiB
Go
package jsoniter
|
|
|
|
// ReadArray read array element, tells if the array has more element to read.
|
|
func (iter *Iterator) ReadArray() (ret bool) {
|
|
c := iter.nextToken()
|
|
switch c {
|
|
case 'n':
|
|
iter.skipThreeBytes('u', 'l', 'l')
|
|
return false // null
|
|
case '[':
|
|
c = iter.nextToken()
|
|
if c != ']' {
|
|
iter.unreadByte()
|
|
return true
|
|
}
|
|
return false
|
|
case ']':
|
|
return false
|
|
case ',':
|
|
return true
|
|
default:
|
|
iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c}))
|
|
return
|
|
}
|
|
}
|
|
|
|
// ReadArrayCB read array with callback
|
|
func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
|
|
c := iter.nextToken()
|
|
if c == '[' {
|
|
if !iter.incrementDepth() {
|
|
return false
|
|
}
|
|
c = iter.nextToken()
|
|
if c != ']' {
|
|
iter.unreadByte()
|
|
if !callback(iter) {
|
|
iter.decrementDepth()
|
|
return false
|
|
}
|
|
c = iter.nextToken()
|
|
for c == ',' {
|
|
if !callback(iter) {
|
|
iter.decrementDepth()
|
|
return false
|
|
}
|
|
c = iter.nextToken()
|
|
}
|
|
if c != ']' {
|
|
iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c}))
|
|
iter.decrementDepth()
|
|
return false
|
|
}
|
|
return iter.decrementDepth()
|
|
}
|
|
return iter.decrementDepth()
|
|
}
|
|
if c == 'n' {
|
|
iter.skipThreeBytes('u', 'l', 'l')
|
|
return true // null
|
|
}
|
|
iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c}))
|
|
return false
|
|
}
|