diff options
author | Cherrg <michael@gnehr.de> | 2019-07-06 17:16:43 +0200 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-07-06 16:16:43 +0100 |
commit | 86750325c76ec18c253fabd4aeed72caca0ee946 (patch) | |
tree | 96fcbcf078e9170c627f723ef6967c29b28f4b8d /vendor/gopkg.in | |
parent | 49ee9d27718c31d5ab4fe9543fefc90cd40d4405 (diff) | |
download | gitea-86750325c76ec18c253fabd4aeed72caca0ee946.tar.gz gitea-86750325c76ec18c253fabd4aeed72caca0ee946.zip |
workaround broken drone build (#7362)
* workaround broken swagger
only master brach is not working, latest release seems to work
Signed-off-by: Michael Gnehr <michael@gnehr.de>
* make vendor
Signed-off-by: Michael Gnehr <michael@gnehr.de>
* Don't export GO111MODULE
* set go-swagger to fixed release version
mentioned here: https://github.com/go-gitea/gitea/pull/7362#discussion_r300831537
Signed-off-by: Michael Gnehr <michael@gnehr.de>
Diffstat (limited to 'vendor/gopkg.in')
-rw-r--r-- | vendor/gopkg.in/yaml.v2/encode.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go index a14435e82f..0ee738e11b 100644 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ b/vendor/gopkg.in/yaml.v2/encode.go @@ -13,6 +13,19 @@ import ( "unicode/utf8" ) +// jsonNumber is the interface of the encoding/json.Number datatype. +// Repeating the interface here avoids a dependency on encoding/json, and also +// supports other libraries like jsoniter, which use a similar datatype with +// the same interface. Detecting this interface is useful when dealing with +// structures containing json.Number, which is a string under the hood. The +// encoder should prefer the use of Int64(), Float64() and string(), in that +// order, when encoding this type. +type jsonNumber interface { + Float64() (float64, error) + Int64() (int64, error) + String() string +} + type encoder struct { emitter yaml_emitter_t event yaml_event_t @@ -89,6 +102,21 @@ func (e *encoder) marshal(tag string, in reflect.Value) { } iface := in.Interface() switch m := iface.(type) { + case jsonNumber: + integer, err := m.Int64() + if err == nil { + // In this case the json.Number is a valid int64 + in = reflect.ValueOf(integer) + break + } + float, err := m.Float64() + if err == nil { + // In this case the json.Number is a valid float64 + in = reflect.ValueOf(float) + break + } + // fallback case - no number could be obtained + in = reflect.ValueOf(m.String()) case time.Time, *time.Time: // Although time.Time implements TextMarshaler, // we don't want to treat it as a string for YAML |