mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-08 14:11:09 -06:00
Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
This commit is contained in:
parent
329a5e8144
commit
98263a7de6
2677 changed files with 1090869 additions and 219 deletions
63
vendor/github.com/go-fed/activity/streams/values/langString/gen_langString.go
generated
vendored
Normal file
63
vendor/github.com/go-fed/activity/streams/values/langString/gen_langString.go
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package langstring
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// SerializeLangString converts a langString value to an interface representation
|
||||
// suitable for marshalling into a text or binary format.
|
||||
func SerializeLangString(this map[string]string) (interface{}, error) {
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// DeserializeLangString creates langString value from an interface representation
|
||||
// that has been unmarshalled from a text or binary format.
|
||||
func DeserializeLangString(this interface{}) (map[string]string, error) {
|
||||
if m, ok := this.(map[string]interface{}); ok {
|
||||
r := make(map[string]string)
|
||||
for k, v := range m {
|
||||
if s, ok := v.(string); ok {
|
||||
r[k] = s
|
||||
} else {
|
||||
return nil, fmt.Errorf("value %v cannot be interpreted as a string for rdf:langString", v)
|
||||
}
|
||||
}
|
||||
return r, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("%v cannot be interpreted as a map[string]interface{} for rdf:langString", this)
|
||||
}
|
||||
}
|
||||
|
||||
// LessLangString returns true if the left langString value is less than the right
|
||||
// value.
|
||||
func LessLangString(lhs, rhs map[string]string) bool {
|
||||
var lk []string
|
||||
var rk []string
|
||||
for k := range lhs {
|
||||
lk = append(lk, k)
|
||||
}
|
||||
for k := range rhs {
|
||||
rk = append(rk, k)
|
||||
}
|
||||
sort.Strings(lk)
|
||||
sort.Strings(rk)
|
||||
for i := 0; i < len(lk) && i < len(rk); i++ {
|
||||
if lk[i] < rk[i] {
|
||||
return true
|
||||
} else if rk[i] < lk[i] {
|
||||
return false
|
||||
} else if lhs[lk[i]] < rhs[rk[i]] {
|
||||
return true
|
||||
} else if rhs[rk[i]] < lhs[lk[i]] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(lk) < len(rk) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue