mirror of
https://github.com/yudai/gotty.git
synced 2026-02-21 07:24:07 +01:00
Change to go1.6.1 and vendoring
This commit is contained in:
parent
b1c5226875
commit
a350994aa2
164 changed files with 17 additions and 1383 deletions
40
vendor/github.com/yudai/hcl/json/parse.go
generated
vendored
Normal file
40
vendor/github.com/yudai/hcl/json/parse.go
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package json
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/yudai/hcl/hcl"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
)
|
||||
|
||||
// jsonErrors are the errors built up from parsing. These should not
|
||||
// be accessed directly.
|
||||
var jsonErrors []error
|
||||
var jsonLock sync.Mutex
|
||||
var jsonResult *hcl.Object
|
||||
|
||||
// Parse parses the given string and returns the result.
|
||||
func Parse(v string) (*hcl.Object, error) {
|
||||
jsonLock.Lock()
|
||||
defer jsonLock.Unlock()
|
||||
jsonErrors = nil
|
||||
jsonResult = nil
|
||||
|
||||
// Parse
|
||||
lex := &jsonLex{Input: v}
|
||||
jsonParse(lex)
|
||||
|
||||
// If we have an error in the lexer itself, return it
|
||||
if lex.err != nil {
|
||||
return nil, lex.err
|
||||
}
|
||||
|
||||
// Build up the errors
|
||||
var err error
|
||||
if len(jsonErrors) > 0 {
|
||||
err = &multierror.Error{Errors: jsonErrors}
|
||||
jsonResult = nil
|
||||
}
|
||||
|
||||
return jsonResult, err
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue