remove unused code from vendor
This commit is contained in:
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"delete": {
|
||||
"l0o": {
|
||||
"l1s": "abcd",
|
||||
"l1o": {
|
||||
"l2s": "efed"
|
||||
}
|
||||
},
|
||||
"l0a": [
|
||||
"abcd",
|
||||
[
|
||||
"efcg"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"add": {
|
||||
"l0o": {
|
||||
"l1s": "abcd",
|
||||
"l1o": {
|
||||
"l2s": "efed"
|
||||
}
|
||||
},
|
||||
"l0a": [
|
||||
"abcd",
|
||||
[
|
||||
"efcg"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
[
|
||||
1,
|
||||
2,
|
||||
6,
|
||||
{
|
||||
"str": "bcded",
|
||||
"arr": [ "a", "b", 37.8 ]
|
||||
},
|
||||
"string"
|
||||
]
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
[
|
||||
1,
|
||||
2,
|
||||
6,
|
||||
{
|
||||
"str": "bcdef",
|
||||
"arr": [ "a", "b", 37.8 ]
|
||||
},
|
||||
"string"
|
||||
]
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"str": "abcde",
|
||||
"num_int": 13,
|
||||
"num_float": 39.39,
|
||||
"bool": true,
|
||||
"arr": ["arr0", 21, {"str": "pek3f", "num": 1}, [0, "1"]],
|
||||
"obj": {
|
||||
"str": "bcded",
|
||||
"num": 19,
|
||||
"arr": [17, "str", {"str": "eafeb"}],
|
||||
"obj": {"str": "efj3", "num": 14}
|
||||
},
|
||||
"null": null
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"str": "abcde",
|
||||
"num_int": 13,
|
||||
"num_float": 39.39,
|
||||
"bool": true,
|
||||
"arr": ["arr0", 21, {"str": "changed", "num": 1}, [0, "changed"]],
|
||||
"obj": {
|
||||
"str": "bcded",
|
||||
"new": "added",
|
||||
"arr": [17, "str", {"str": "changed"}],
|
||||
"obj": {"str": "changed", "num": 9999}
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"str": "true",
|
||||
"num_int": 3,
|
||||
"num_float": 99.99,
|
||||
"num_int_float": 5,
|
||||
"bool": true,
|
||||
"obj": {
|
||||
"0": "i0",
|
||||
"1": "i1"
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"str": true,
|
||||
"num_int": "3",
|
||||
"num_float": "99.99",
|
||||
"num_int_float": 5.0,
|
||||
"bool": "true",
|
||||
"obj": [
|
||||
"i0",
|
||||
"i1"
|
||||
]
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
{
|
||||
"name": "South America",
|
||||
"summary": "South America (Spanish: América del Sur, Sudamérica or \nSuramérica; Portuguese: América do Sul; Quechua and Aymara: \nUrin Awya Yala; Guarani: Ñembyamérika; Dutch: Zuid-Amerika; \nFrench: Amérique du Sud) is a continent situated in the \nWestern Hemisphere, mostly in the Southern Hemisphere, with \na relatively small portion in the Northern Hemisphere. \nThe continent is also considered a subcontinent of the \nAmericas.[2][3] It is bordered on the west by the Pacific \nOcean and on the north and east by the Atlantic Ocean; \nNorth America and the Caribbean Sea lie to the northwest. \nIt includes twelve countries: Argentina, Bolivia, Brazil, \nChile, Colombia, Ecuador, Guyana, Paraguay, Peru, Suriname, \nUruguay, and Venezuela. The South American nations that \nborder the Caribbean Sea—including Colombia, Venezuela, \nGuyana, Suriname, as well as French Guiana, which is an \noverseas region of France—are also known as Caribbean South \nAmerica. South America has an area of 17,840,000 square \nkilometers (6,890,000 sq mi). Its population as of 2005 \nhas been estimated at more than 371,090,000. South America \nranks fourth in area (after Asia, Africa, and North America) \nand fifth in population (after Asia, Africa, Europe, and \nNorth America). The word America was coined in 1507 by \ncartographers Martin Waldseemüller and Matthias Ringmann, \nafter Amerigo Vespucci, who was the first European to \nsuggest that the lands newly discovered by Europeans were \nnot India, but a New World unknown to Europeans.",
|
||||
"surface": 17840000,
|
||||
"timezone": [
|
||||
-4,
|
||||
-2
|
||||
],
|
||||
"demographics": {
|
||||
"population": 385742554,
|
||||
"largestCities": [
|
||||
"São Paulo",
|
||||
"Buenos Aires",
|
||||
"Rio de Janeiro",
|
||||
"Lima",
|
||||
"Bogotá"
|
||||
]
|
||||
},
|
||||
"languages": [
|
||||
"spanish",
|
||||
"portuguese",
|
||||
"english",
|
||||
"dutch",
|
||||
"french",
|
||||
"quechua",
|
||||
"guaraní",
|
||||
"aimara",
|
||||
"mapudungun"
|
||||
],
|
||||
"countries": [
|
||||
{
|
||||
"name": "Argentina",
|
||||
"capital": "Buenos Aires",
|
||||
"independence": "1816-07-09T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Bolivia",
|
||||
"capital": "La Paz",
|
||||
"independence": "1825-08-06T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Brazil",
|
||||
"capital": "Brasilia",
|
||||
"independence": "1822-09-07T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Chile",
|
||||
"capital": "Santiago",
|
||||
"independence": "1818-02-12T08:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Colombia",
|
||||
"capital": "Bogotá",
|
||||
"independence": "1810-07-20T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Ecuador",
|
||||
"capital": "Quito",
|
||||
"independence": "1809-08-10T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Guyana",
|
||||
"capital": "Georgetown",
|
||||
"independence": "1966-05-26T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Paraguay",
|
||||
"capital": "Asunción",
|
||||
"independence": "1811-05-14T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Peru",
|
||||
"capital": "Lima",
|
||||
"independence": "1821-07-28T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Suriname",
|
||||
"capital": "Paramaribo",
|
||||
"independence": "1975-11-25T08:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Uruguay",
|
||||
"capital": "Montevideo",
|
||||
"independence": "1825-08-25T07:00:00.000Z",
|
||||
"unasur": true
|
||||
},
|
||||
{
|
||||
"name": "Venezuela",
|
||||
"capital": "Caracas",
|
||||
"independence": "1811-07-05T07:00:00.000Z",
|
||||
"unasur": true
|
||||
}
|
||||
]
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"str": "aaefijaeufq2093jfaunfa;oij40fjq048hfbgvz;lxkcmz;ldkjfm48q9p8qfhqn4gbqqq4qp94hqnfaaso;dfj3n"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"str": "aaefijaeufq2093jfaunfa;oij40fjnafefeabgvz;lxkcmz;ldkjfm48qa39p8qfhnafe94hqnfaaso;dfj3n"
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"arr": [
|
||||
3,
|
||||
5,
|
||||
7,
|
||||
9,
|
||||
11,
|
||||
13
|
||||
]
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"arr": [
|
||||
3,
|
||||
9,
|
||||
5,
|
||||
13,
|
||||
7,
|
||||
11
|
||||
]
|
||||
}
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
{
|
||||
"ImportPath": "github.com/yudai/gojsondiff",
|
||||
"GoVersion": "go1.6",
|
||||
"GodepVersion": "v74",
|
||||
"Packages": [
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "github.com/codegangsta/cli",
|
||||
"Comment": "1.2.0-95-g9b2bd2b",
|
||||
"Rev": "9b2bd2b3489748d4d0a204fa4eb2ee9e89e0ebc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mattn/go-colorable",
|
||||
"Comment": "v0.0.6",
|
||||
"Rev": "ed8eb9e318d7a84ce5915b495b7d35e0cfe7b5a8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mattn/go-isatty",
|
||||
"Rev": "66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/config",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/codelocation",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/containernode",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/failer",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/leafnodes",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/remote",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/spec",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/specrunner",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/suite",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/testingtproxy",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/internal/writer",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/reporters",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/reporters/stenographer",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/ginkgo/types",
|
||||
"Comment": "v1.1.0-41-g38caab9",
|
||||
"Rev": "38caab951a9ff39f0e61294a1dbaaa074a39228b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/format",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/internal/assertion",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/internal/asyncassertion",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/internal/testingtsupport",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/matchers",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/matchers/support/goraph/edge",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/matchers/support/goraph/node",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/matchers/support/goraph/util",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/onsi/gomega/types",
|
||||
"Comment": "v1.0-35-g4dfabf7",
|
||||
"Rev": "4dfabf7db2e4147ec99a86db32b2f2a3484cfee8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/sergi/go-diff/diffmatchpatch",
|
||||
"Rev": "97b2266dfe4bd4ea1b81a463322f04f8b724801e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/yudai/golcs",
|
||||
"Rev": "d1c525dea8ce39ea9a783d33cf08932305373f2c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/yudai/pp",
|
||||
"Comment": "v2.0.1-5-gbe83154",
|
||||
"Rev": "be8315415630515a106fd60e6c73e81737218851"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/unix",
|
||||
"Rev": "a646d33e2ee3172a661fc09bca23bb4889a41bc8"
|
||||
}
|
||||
]
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
This directory tree is generated automatically by godep.
|
||||
|
||||
Please do not edit.
|
||||
|
||||
See https://github.com/tools/godep for more information.
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
diff "github.com/yudai/gojsondiff"
|
||||
"github.com/yudai/gojsondiff/formatter"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "jd"
|
||||
app.Usage = "JSON Diff"
|
||||
app.Version = "0.0.2"
|
||||
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "format, f",
|
||||
Value: "ascii",
|
||||
Usage: "Diff Outpu Format (ascii, delta)",
|
||||
EnvVar: "DIFF_FORMAT",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "coloring, c",
|
||||
Usage: "Enable coloring in the ASCII mode (not available in the delta mode)",
|
||||
EnvVar: "COLORING",
|
||||
},
|
||||
}
|
||||
|
||||
app.Action = func(c *cli.Context) {
|
||||
if len(c.Args()) < 2 {
|
||||
fmt.Println("Not enough arguments.\n")
|
||||
fmt.Printf("Usage: %s json_file another_json_file\n", app.Name)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
aFilePath := c.Args()[0]
|
||||
bFilePath := c.Args()[1]
|
||||
|
||||
// Prepare your JSON string as `[]byte`, not `string`
|
||||
aString, err := ioutil.ReadFile(aFilePath)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to open file '%s': %s\n", aFilePath, err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// Another JSON string
|
||||
bString, err := ioutil.ReadFile(bFilePath)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to open file '%s': %s\n", bFilePath, err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// Then, compare them
|
||||
differ := diff.New()
|
||||
d, err := differ.Compare(aString, bString)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to unmarshal file: %s\n", err.Error())
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
// Output the result
|
||||
format := c.String("format")
|
||||
var diffString string
|
||||
if format == "ascii" {
|
||||
var aJson map[string]interface{}
|
||||
json.Unmarshal(aString, &aJson)
|
||||
|
||||
config := formatter.AsciiFormatterConfig{
|
||||
ShowArrayIndex: true,
|
||||
Coloring: c.Bool("coloring"),
|
||||
}
|
||||
|
||||
formatter := formatter.NewAsciiFormatter(aJson, config)
|
||||
diffString, err = formatter.Format(d)
|
||||
if err != nil {
|
||||
// No error can occur
|
||||
}
|
||||
} else if format == "delta" {
|
||||
formatter := formatter.NewDeltaFormatter()
|
||||
diffString, err = formatter.Format(d)
|
||||
if err != nil {
|
||||
// No error can occur
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Unknown Foramt %s\n", format)
|
||||
os.Exit(4)
|
||||
}
|
||||
|
||||
fmt.Print(diffString)
|
||||
}
|
||||
|
||||
app.Run(os.Args)
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
diff "github.com/yudai/gojsondiff"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "jd"
|
||||
app.Usage = "JSON Diff"
|
||||
app.Version = "0.0.2"
|
||||
|
||||
app.Flags = []cli.Flag{}
|
||||
|
||||
app.Action = func(c *cli.Context) {
|
||||
if len(c.Args()) < 2 {
|
||||
fmt.Println("Not enough arguments.\n")
|
||||
fmt.Printf("Usage: %s diff json_file\n", app.Name)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
diffFilePath := c.Args()[0]
|
||||
jsonFilePath := c.Args()[1]
|
||||
|
||||
// Diff file
|
||||
diffFile, err := ioutil.ReadFile(diffFilePath)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to open file '%s': %s\n", diffFilePath, err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// Load Diff file
|
||||
um := diff.NewUnmarshaller()
|
||||
diffObject, err := um.UnmarshalBytes(diffFile)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to load diff file '%s': %s\n", diffFilePath, err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// JSON file
|
||||
jsonFile, err := ioutil.ReadFile(jsonFilePath)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to open file '%s': %s\n", jsonFilePath, err.Error())
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
// Load JSON
|
||||
var jsonObject map[string]interface{}
|
||||
json.Unmarshal(jsonFile, &jsonObject)
|
||||
|
||||
// Apply
|
||||
differ := diff.New()
|
||||
differ.ApplyPatch(jsonObject, diffObject)
|
||||
|
||||
pachedJson, _ := json.MarshalIndent(jsonObject, "", " ")
|
||||
fmt.Println(string(pachedJson))
|
||||
}
|
||||
|
||||
app.Run(os.Args)
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func LoadFixture(file string) map[string]interface{} {
|
||||
content, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
Fail("Fixture file '" + file + "' not found.")
|
||||
}
|
||||
var result map[string]interface{}
|
||||
err = json.Unmarshal(content, &result)
|
||||
if err != nil {
|
||||
Fail("Unmarshaling JSON of '" + file + "' failed: " + err.Error())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func LoadFixtureAsArray(file string) []interface{} {
|
||||
content, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
Fail("Fixture file '" + file + "' not found.")
|
||||
}
|
||||
var result []interface{}
|
||||
err = json.Unmarshal(content, &result)
|
||||
if err != nil {
|
||||
Fail("Unmarshaling JSON of '" + file + "' failed: " + err.Error())
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user