merge.ThreeWay() is now willing to merge Structs as well as Maps, as long
as the Structs are all named the name thing. Other rules are the same
as for Map.
Toward #148
This prepends a prefix to every dataset ID written by perf tests. It
will be used for namespacing the test results for different PRs.
Currently they're written to different databases, which isn't as good.
fix misspellings; fix code that was not gofmt'd - plus take advantage of gofmt -s too; couple of unreachable golint reported fixes; reference go report card results and tests
Make the name of the Noms struct start with a capital letter.
When unmarshalling a struct we now ignore the case.
This is a breaking change. If you previously marshalled a Go struct with a lower case name (ie "abc") the Noms struct we generate now has the name "Abc" (previously the name was "abc")
Towards #2376
When unmarshalling onto interface{}` the following rules are used:
- `types.Bool` -> `bool`
- `types.List` -> `[]T`, where `T` is determined recursively using the same rules.
- `types.Map` -> `map[T]V`, where `T` and `V` is determined recursively using the same rules.
- `types.Number` -> `float64`
- `types.String` -> `string`
- `types.Union` -> `interface`
- Everything else an error
Towards #2376
Add the Go 'merge' package, which exports one function called ThreeWay().
ThreeWay() attempts a three-way merge between two candidates and a common
ancestor. It considers the three of them recursively, applying some simple rules:
- If any of the three nodes are different kinds: conflict
- If we are dealing with a map:
- If the same key is both removed and inserted wrt parent: conflict
- If the same key is inserted wrt parent, but with different values: conflict
- If we are dealing with a struct:
- same as map
- If we are dealing with a list:
- Same as map but substitute "index" for "key"
- If we are dealing with a set:
- If the same object is both removed and inserted wrt parent: conflict
... otherwise, the concurrent modification is allowed.
Currently, ThreeWay() only works on types.Map.
Towards #148
You can run these yourself using the -perf flag, e.g.
> noms serve &
> go test -v -perf http://localhost:8000 ./samples/go/csv/csv-import
> noms ds http://localhost:8000
Though you'll need to go-get github.com/attic-labs/testdata.
Note that all of this only records test results, it doesn't have any
concept of failing perf (unless test assertsions themselves fail). It
will be the job of some other Noms client (work in progress) to do that.
I will be setting this up to run continuously momentarily.
This isn't triggering any problem in particular, I just noticed it. All
it meant was that noms log might take unnecessarily long with list diff
when there are a lot of changes.
When we create JS struct classes we no longer creates properties for
`chunks`, `hash` or `type` (nor for `toString`, `hashOwnProperty` etc)
If you are using structs with field names that clashes with these then
use a `StructMirror`.
Fixes#2332
Basic support for creating Noms value from Go values as well as reading
Noms values onto Go values.
Typical usage:
```
// Go to Noms
type T struct {
S string
N int32
}
nomsVal, err := marshal.Marshal(T{"Hi", 42})
// Noms to Go
var goVal T
err = marshal.Unmarshal(types.NewStruct("T", types.StructData{
"S": types.String("Bye"),
"N": types.Number(555),
}, &goVal)
```
Fixes#1591