You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
559 B
Go
30 lines
559 B
Go
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
|
// Use of this source code is governed by the Parity Public License
|
|
// that can be found in the LICENSE file.
|
|
|
|
package manifest
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
)
|
|
|
|
func diff(file string) (string, error) {
|
|
a, err := ParseFile(file)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
d, err := ioutil.ReadFile(file + ".golden")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
b := new(Manifest)
|
|
err = json.Unmarshal(d, b)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return cmp.Diff(a, b), nil
|
|
}
|