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
In 7c103344 I changed noms log to use left-right diff so that it
completes faster, but it changed noms diff to use left-right as well.
Noms diff is supposed to use best diff.
* Fix noms_sync status message to indicate when new dataset is created
Originally, syncing a commit to a non-existent dataset and an already sync'ed dataset resulted in the same message: "<src> is up to date"
This fix distinguishes 2 cases:
- Syncing to a new dataset prints "<dest> created"
- Syncing to an identical dataset prints "<dest> already up to date"
Resolves: #2053
* Make message when noms sync creates new dataset more fun
Addresses: #2053
This is a breaking change to the JS API. HashSpec and parseObjectSpec
have been removed in favour of PathSpec, and parse errors now throw
SyntaxError instead of silently failing (this matches JSON.parse).