2016-10-18 21:49:45 +03:00
[
{
"repoUrl" : "https://github.com/joshvera/go.git" ,
"language" : "go" ,
2016-11-01 19:48:15 +03:00
"fileExt" : ".go" ,
2016-10-18 23:10:22 +03:00
"templateText" : "package main\n" ,
2016-10-18 21:49:45 +03:00
"syntaxes" : [
2016-11-02 04:36:43 +03:00
{
"syntax" : "imports" ,
"repoFilePath" : "imports" ,
"insert" : "import \"net/http\"\nimport . \"some/dsl\"\nimport alias \"some/package\"" ,
"testCaseFilePath" : "test/corpus/diff-summaries/go/imports.json" ,
"replacement" : "import \"foo/bar\"\nimport . \"types/dsl\"\nimport alias \"awesome/packages\""
} ,
2016-11-01 23:33:43 +03:00
{
"syntax" : "int-literal" ,
"insert" : "const (\na = 1, b = 2, c = 3\n)" ,
"replacement" : "const (\na = 4, b = 5, c = 6\n)"
} ,
2016-10-18 21:49:45 +03:00
{
2016-10-18 21:52:48 +03:00
"syntax" : "assignment" ,
2016-10-18 21:49:45 +03:00
"insert" : "var foo int = 42" ,
"replacement" : "var bar string = \"hello\""
2016-11-01 01:22:10 +03:00
} ,
{
2016-11-02 17:47:56 +03:00
"syntax" : "call-expressions.go" ,
2016-11-01 01:22:10 +03:00
"insert" : "a()" ,
"replacement" : "b()"
2016-11-01 02:23:25 +03:00
} ,
2016-11-01 21:36:23 +03:00
{
"syntax" : "function-literal" ,
"insert" : "const s1 = func(s string) (int, int) {\nreturn 1, 2\n}" ,
"replacement" : "const s1 = func(b int) (string, string) {\nreturn 1, 2\n}"
} ,
2016-11-01 02:23:25 +03:00
{
2016-11-01 19:48:15 +03:00
"syntax" : "const-declarations" ,
2016-11-01 02:23:25 +03:00
"insert" : "const zero = 0" ,
"replacement" : "const one, two = 1, 2"
2016-11-02 04:41:49 +03:00
} ,
{
"syntax" : "var-declarations" ,
"insert" : "var zero = 0" ,
"replacement" : "var one, two = 1, 2"
2016-11-02 05:05:43 +03:00
} ,
{
"syntax" : "var-declarations" ,
"insert" : "var zero = 0" ,
"replacement" : "var one, two = 1, 2"
} ,
{
"syntax" : "switch-statements" ,
"insert" : "switch { case x < y: f1()\ncase x < z: g()\ncase x == 4: h()\n}" ,
"replacement" : "switch { case a < b: f1()\ncase c < d: g()\ncase e == 4: f()\n}"
} ,
{
"syntax" : "for-statements" ,
"insert" : "for { case x < y: f1()\ncase x < z: g()\ncase x == 4: h()\n}" ,
"replacement" : "func main() { for { a() goto loop }\nloop: for i := 0; i < 5; i++\n{ a()\nbreak loop\n}\nloop2: for ; i < 10; i++ \n{ \na()\ncontinue loop2\n}\nfor ;; { a() continue }\nfor x := range y { a(x)\nbreak }\n}"
} ,
2016-11-02 17:47:56 +03:00
{
"syntax" : "function-declarations" ,
"insert" : "func f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}" ,
"replacement" : "func fa() {}\nfunc fb(a int, b, c, d string) int {}\nfunc fc() (int, error) {}\nfunc fd() (result int, err error) {}"
} ,
2016-11-02 05:05:43 +03:00
{
"syntax" : "function-declarations" ,
"repoFilePath" : "function-declarations.go" ,
"insert" : "func f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}" ,
"replacement" : "func fa() {}\nfunc fb(a int, b, c, d string) int {}\nfunc fc() (int, error) {}\nfunc fd() (result int, err error) {}"
2016-11-02 17:47:56 +03:00
} ,
{
"syntax" : "method-declarations" ,
"insert" : "func (self Person) Equals(other Person) bool {}" ,
"replacement" : "func (self Num) Equals(other Num) bool {}"
} ,
{
"syntax" : "type-declarations" ,
"insert" : "type a b\ntype (\n a b\n c d\n )" ,
"replacement" : "type a' b'\ntype (\n a' b'\n c' d'\n )"
} ,
{
"syntax" : "type-declarations" ,
"insert" : "type a b\ntype (\n a b\n c d\n )" ,
"replacement" : "type a' b'\ntype (\n a' b'\n c' d'\n )"
} ,
{
"syntax" : "const-with-implicit-values" ,
"insert" : "const (\n zero = iota\n one\n two\n )" ,
"replacement" : "const (\n a = iota\n b\n c\n )"
} ,
{
"syntax" : "const-with-implicit-values" ,
"insert" : "const (\n zero = iota\n one\n two\n )" ,
"replacement" : "const (\n a = iota\n b\n c\n )"
} ,
{
"syntax" : "constructors" ,
"insert" : "make(chan<- int)\nmake(chan<- int, (new - old))\nmake(chan<- int, 5, 10)\n new(map[string]string)" ,
"replacement" : "make(chan<- string)\nmake(chan<- string, (new - old))\nmake(chan<- string, 7, 11)\n new(map[int]int)"
} ,
{
"syntax" : "selector expressions" ,
"insert" : "a.b.c()" ,
"replacement" : "x.y.z()"
} ,
{
"syntax" : "indexing expressions" ,
"insert" : "a[1]\n b[:]\n c[1:]\n d[1:2]\n e[:2:3]\n f[1:2:3]" ,
"replacement" : "z[:2]\n y[:1]\n x[1:]\n d[1:2]\n e[:2:3]\n f[1:2:3]"
2016-11-02 17:50:05 +03:00
} ,
2016-11-02 17:47:56 +03:00
{
"syntax" : "type-assertion-expression" ,
"insert" : "x.(z.Person)" ,
"replacement" : "b.(c.Dog)"
} ,
{
"syntax" : "type-conversion-expression" ,
"insert" : "[]a.b(c.d)\n ([]a.b)(c.d)\n e.f(g)\n (e.f)(g)" ,
"replacement" : "[]x.y(z.e)\n ([]f.g)(h.i)\n j.k(l)\n (m.n)(o)"
} ,
{
"syntax" : "unary-expressions" ,
"insert" : "!<-a\n*foo()" ,
"replacement" : "!<-b\n*bar()"
2016-11-02 17:50:05 +03:00
} ,
{
"syntax" : "float-literals" ,
"insert" : "f1 = 1.5\nf2 = 1.5e100\nf3 = 1.5e+50\nf4 = 1.5e-5\nf5 = .5e-50" ,
"replacement" : "f2 = 1.5\nf3 = 1.5e100\nf4 = 1.5e+50\nf5 = 1.5e-5\nf6 = .5e-50"
2016-11-02 18:02:00 +03:00
} ,
{
"syntax" : "rune-literals" ,
"insert" : "const (\na = '0'\nb = '\\''\nc = '\\\\'\nc = '\\n'\nc = '\\u0000'\nc = '\\U01234567'\n)" ,
"replacement" : "const (\na = '1'\nb = '\\n''\nc = '\\u0011'\nc = '\\\\'\nc = '\\u0022'\nc = '\\U01234568'\n)"
2016-10-18 21:49:45 +03:00
}
]
}
]