0

Upgrade versions of vendored libs

This commit is contained in:
eleksir
2022-11-04 16:24:54 +03:00
parent 3f5f039705
commit c4fa8c07df
221 changed files with 31699 additions and 4968 deletions

View File

@@ -1,48 +0,0 @@
language: go
go:
- 1.6
- 1.7
- 1.8
- tip
install: true
script:
- go install github.com/hjson/hjson-go
- go install github.com/hjson/hjson-go/hjson-cli
- go test -v github.com/hjson/hjson-go
before_deploy:
- ./build_release.sh
deploy:
provider: releases
file:
- _dist/darwin_386.tar.gz
- _dist/darwin_amd64.tar.gz
- _dist/dragonfly_amd64.tar.gz
- _dist/freebsd_386.tar.gz
- _dist/freebsd_amd64.tar.gz
- _dist/freebsd_arm.tar.gz
- _dist/linux_386.tar.gz
- _dist/linux_amd64.tar.gz
- _dist/linux_arm.tar.gz
- _dist/linux_arm64.tar.gz
- _dist/linux_mips64.tar.gz
- _dist/linux_mips64le.tar.gz
- _dist/linux_ppc64.tar.gz
- _dist/linux_ppc64le.tar.gz
- _dist/netbsd_386.tar.gz
- _dist/netbsd_amd64.tar.gz
- _dist/netbsd_arm.tar.gz
- _dist/openbsd_386.tar.gz
- _dist/openbsd_amd64.tar.gz
- _dist/openbsd_arm.tar.gz
- _dist/plan9_386.tar.gz
- _dist/plan9_amd64.tar.gz
- _dist/solaris_amd64.tar.gz
- _dist/windows_386.zip
- _dist/windows_amd64.zip
overwrite: true
skip_cleanup: true
on:
tags: true
go: 1.7
api-key:
secure: RAnrBG7xantKdUBlIsv8Od9yZ0GTwCsJ7d1V+hSEC3JSz76+Ie4v1nJw+rD0Rp25zxDAM2qSkMfIaQJVSQ5tYg3N8C/d+/lfeRNBwLhHEsQztsaE5BU0I/qrkKq0pGMoG+cu6ZJ06xEgECPKOamwQ2wSY0IiIwVn0eNN/ufMsZUTmPgBE4+lx9eEWYDqMxy4tfgLMC/ry2fnA3zc4fQk0TboodLkI0SgwMq7cHcm95j9kHWpydbwr8IhQ6pucLM9YuKGv2fNHywlQ6Z9rhpYdiK/9KUofW20Rm4OB1MBHLLhLdQ0qCkVPswhGRdFPcBcN7lvv8Czcp3Hl4LQ4UzxOXf58mEWbh4r6VbUjZgRnpMy8Ms9CcyLjwaRbJPKA/kI53yjeEViFbDlOtBV8qdVqx5orCUrpU2ML/iEltVDL7pukhjuKd0K/2c3s8gJwH4LaGEfQjj2DvYkQgK0XsWSOXhYF4LaN0qhiQ3xiss1bhjJIIIhD3PHPy+dCsazKoJtNRHoUyP9RYz8EjcwI7BsaEEzskaXuUSvLz3+k6f6DZvPydUDXDGYqX0H2dXCT5H0IaCrSAkDVcGageXt4vkzKb45/el1W5VME/q/WpGAIPfsJ2beR7ALlm1RhXdWTJpwq6LM/YbYy/6U/HlqQCwB4x/nwKXy1ToDukCrHy57yGU=

View File

@@ -1,6 +1,6 @@
# hjson-go
[![Build Status](https://img.shields.io/travis/hjson/hjson-go.svg?style=flat-square)](https://travis-ci.org/hjson/hjson-go)
[![Build Status](https://github.com/hjson/hjson-go/workflows/test/badge.svg)](https://github.com/hjson/hjson-go/actions)
[![Go Pkg](https://img.shields.io/github/release/hjson/hjson-go.svg?style=flat-square&label=go-pkg)](https://github.com/hjson/hjson-go/releases)
[![Go Report Card](https://goreportcard.com/badge/github.com/hjson/hjson-go?style=flat-square)](https://goreportcard.com/report/github.com/hjson/hjson-go)
[![coverage](https://img.shields.io/badge/coverage-ok-brightgreen.svg?style=flat-square)](http://gocover.io/github.com/hjson/hjson-go/)

View File

@@ -20,12 +20,16 @@ type EncoderOptions struct {
Eol string
// Place braces on the same line
BracesSameLine bool
// Deprecated: Hjson always emits braces
// Emit braces for the root object
EmitRootBraces bool
// Always place string in quotes
QuoteAlways bool
// Place string in quotes if it could otherwise be a number, boolean or null
QuoteAmbiguousStrings bool
// Indent string
IndentBy string
// Base indentation string
BaseIndentation string
// Allow the -0 value (unlike ES6)
AllowMinusZero bool
// Encode unknown values as 'null'
@@ -39,7 +43,9 @@ func DefaultOptions() EncoderOptions {
opt.BracesSameLine = false
opt.EmitRootBraces = true
opt.QuoteAlways = false
opt.QuoteAmbiguousStrings = true
opt.IndentBy = " "
opt.BaseIndentation = ""
opt.AllowMinusZero = false
opt.UnknownAsNull = false
return opt
@@ -97,9 +103,8 @@ func (e *hjsonEncoder) quote(value string, separator string, isRootObject bool)
if len(value) == 0 {
e.WriteString(separator + `""`)
} else if e.QuoteAlways ||
needsQuotes.MatchString(value) ||
startsWithNumber([]byte(value)) ||
startsWithKeyword.MatchString(value) {
needsQuotes.MatchString(value) || (e.QuoteAmbiguousStrings && (startsWithNumber([]byte(value)) ||
startsWithKeyword.MatchString(value))) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
@@ -178,6 +183,7 @@ func (s sortAlpha) Less(i, j int) bool {
func (e *hjsonEncoder) writeIndent(indent int) {
e.WriteString(e.Eol)
e.WriteString(e.BaseIndentation)
for i := 0; i < indent; i++ {
e.WriteString(e.IndentBy)
}
@@ -207,8 +213,7 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
e.WriteString("null")
return nil
}
value = value.Elem()
kind = value.Kind()
return e.str(value.Elem(),noIndent,separator,isRootObject)
}
if value.Type().Implements(marshaler) {
@@ -296,20 +301,25 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
}
indent1 := e.indent
e.indent++
if !noIndent && !e.BracesSameLine {
e.writeIndent(indent1)
} else {
e.WriteString(separator)
if !isRootObject || e.EmitRootBraces {
if !noIndent && !e.BracesSameLine {
e.writeIndent(e.indent)
} else {
e.WriteString(separator)
}
e.indent++
e.WriteString("{")
}
e.WriteString("{")
keys := value.MapKeys()
sort.Sort(sortAlpha(keys))
// Join all of the member texts together, separated with newlines
for i := 0; i < len; i++ {
e.writeIndent(e.indent)
if i > 0 || !isRootObject || e.EmitRootBraces {
e.writeIndent(e.indent)
}
e.WriteString(e.quoteName(keys[i].String()))
e.WriteString(":")
if err := e.str(value.MapIndex(keys[i]), false, " ", false); err != nil {
@@ -317,8 +327,10 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
}
}
e.writeIndent(indent1)
e.WriteString("}")
if !isRootObject || e.EmitRootBraces {
e.writeIndent(indent1)
e.WriteString("}")
}
e.indent = indent1
case reflect.Struct:
@@ -331,13 +343,16 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
}
indent1 := e.indent
e.indent++
if !noIndent && !e.BracesSameLine {
e.writeIndent(indent1)
} else {
e.WriteString(separator)
if !isRootObject || e.EmitRootBraces {
if !noIndent && !e.BracesSameLine {
e.writeIndent(e.indent)
} else {
e.WriteString(separator)
}
e.indent++
e.WriteString("{")
}
e.WriteString("{")
// Join all of the member texts together, separated with newlines
for i := 0; i < l; i++ {
@@ -367,11 +382,15 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
}
if len(jsonComment) > 0 {
for _, line := range strings.Split(jsonComment, e.Eol) {
e.writeIndent(e.indent)
if i > 0 || !isRootObject || e.EmitRootBraces {
e.writeIndent(e.indent)
}
e.WriteString(fmt.Sprintf("# %s", line))
}
}
e.writeIndent(e.indent)
if i > 0 || !isRootObject || e.EmitRootBraces {
e.writeIndent(e.indent)
}
e.WriteString(e.quoteName(name))
e.WriteString(":")
if err := e.str(curField, false, " ", false); err != nil {
@@ -382,8 +401,10 @@ func (e *hjsonEncoder) str(value reflect.Value, noIndent bool, separator string,
}
}
e.writeIndent(indent1)
e.WriteString("}")
if !isRootObject || e.EmitRootBraces {
e.writeIndent(indent1)
e.WriteString("}")
}
e.indent = indent1
@@ -457,10 +478,13 @@ func MarshalWithOptions(v interface{}, options EncoderOptions) ([]byte, error) {
e.indent = 0
e.Eol = options.Eol
e.BracesSameLine = options.BracesSameLine
e.EmitRootBraces = options.EmitRootBraces
e.QuoteAlways = options.QuoteAlways
e.QuoteAmbiguousStrings = options.QuoteAmbiguousStrings
e.IndentBy = options.IndentBy
e.BaseIndentation = options.BaseIndentation
err := e.str(reflect.ValueOf(v), true, "", true)
err := e.str(reflect.ValueOf(v), true, e.BaseIndentation, true)
if err != nil {
return nil, err
}