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
{
2016-11-02 21:37:30 +03:00
"syntax" : "single-import-declarations" ,
2016-11-02 04:36:43 +03:00
"insert" : "import \"net/http\"\nimport . \"some/dsl\"\nimport alias \"some/package\"" ,
"replacement" : "import \"foo/bar\"\nimport . \"types/dsl\"\nimport alias \"awesome/packages\""
} ,
2016-11-01 23:33:43 +03:00
{
2016-11-02 21:37:30 +03:00
"syntax" : "grouped-import-declarations" ,
"insert" : "import (\n\"net/http\"\n . \"some/dsl\"\n alias \"some/package\"\n)" ,
"replacement" : "import (\n\"net/socket\"\n . \"types/dsl\"\n alias \"awesome/package\"\n)"
} ,
{
"syntax" : "int-literals" ,
2016-11-01 23:33:43 +03:00
"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-11-02 21:37:30 +03:00
"syntax" : "assignment-statements" ,
"insert" : "a = 1\nb, c += 2, 3\nd *= 3\ne += 1" ,
"replacement" : "x = 1\ny, c += 2, 3\nz *= 3\nh += 1"
2016-11-01 01:22:10 +03:00
} ,
{
2016-11-02 21:37:30 +03:00
"syntax" : "if-statements" ,
"insert" : "if a() {\nb()\n}\nif a := b(); c {\nd()\n}\nif a() {\nb()\n} else {\nc()\n}" ,
"replacement" : "if x() {\nb()\n}\nif y := b(); c {\nd()\n}\nif z() {\nb()\n} else {\nc()\n}"
2016-11-01 02:23:25 +03:00
} ,
2016-11-01 21:36:23 +03:00
{
2016-11-02 21:37:30 +03:00
"syntax" : "short-var-declarations" ,
"insert" : "a, b := 1, 2" ,
"replacement" : "x, y := 3, 4"
} ,
{
"syntax" : "call-expressions" ,
"insert" : "x(b, c...)\ny(b, c,)\nz(b,c...,)" ,
"replacement" : "a(b, c...)\nb(b, c,)\nc(b,c...,)"
} ,
{
"syntax" : "function-literals" ,
2016-11-01 21:36:23 +03:00
"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-02 22:13:54 +03:00
"syntax" : "const-declarations-without-types" ,
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
} ,
2016-11-02 22:13:54 +03:00
{
"syntax" : "const-declarations-with-types" ,
"insert" : "const zero int = 0" ,
"replacement" : "const one, two uiint64 = 1, 2"
} ,
2016-11-02 04:41:49 +03:00
{
2016-11-02 21:37:30 +03:00
"syntax" : "var-declarations-without-types" ,
2016-11-02 04:41:49 +03:00
"insert" : "var zero = 0" ,
"replacement" : "var one, two = 1, 2"
2016-11-02 05:05:43 +03:00
} ,
{
2016-11-02 21:37:30 +03:00
"syntax" : "var-declarations-with-types" ,
"insert" : "var zero int = 0\nvar one, two uint64 = 1, 2" ,
"replacement" : "var a int = 0\n var b, c uint64 = 1, 2"
} ,
{
"syntax" : "var-declarations-with-no-expressions" ,
"insert" : "var zero int\nvar one, two uint64" ,
"replacement" : "var a int\nvar b, c uint64"
} ,
{
"syntax" : "grouped-var-declarations" ,
"insert" : "var (\nzero = 0\none = 1\n)" ,
"replacement" : "var (\na = 0\nb = 1\n)"
2016-11-02 05:05:43 +03:00
} ,
{
"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}"
} ,
2016-11-02 21:37:30 +03:00
{
"syntax" : "type-switch-statements" ,
"insert" : "switch e.(type) {\n case []Person:\n a()\n case *Dog:\n break\n}" ,
"replacement" : "switch b.(type) {\n case []Person:\n a()\n case *Dog:\n break\n}"
} ,
{
"syntax" : "select-statements" ,
"insert" : "select {\n case x := <-c:\n println(x)\n case y <- c:\n println(5)\n case <-time.After(1):\n println(6)\n default:\n return\n}" ,
"replacement" : "select {\n case a := <-c:\n println(x)\n case b <- c:\n println(5)\n case <-time.After(2):\n println(6)\n default:\n return\n}"
} ,
{
"syntax" : "go-and-defer-statements" ,
"insert" : "defer x.y()\ngo x.y()" ,
"replacement" : "defer a.b()\ngo c.d()"
} ,
{
"syntax" : "label-statements" ,
"insert" : "{\n insert_label:\n}" ,
"replacement" : "{\n replacement_label:\n}"
} ,
2016-11-02 05:05:43 +03:00
{
"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
{
2016-11-02 21:37:30 +03:00
"syntax" : "single-line-function-declarations" ,
"insert" : "func f1() { a() }\nfunc f2() { a(); b() }\nfunc f3() { a(); b(); }" ,
"replacement" : "func g1() { a() }\nfunc g2() { a(); b() }\nfunc g3() { a(); b(); }"
} ,
{
"syntax" : "variadic-function-declarations" ,
"insert" : "func f1(a ...*int) {}\nfunc f2(...int) {}\nfunc f3(a, ...bool) {}" ,
"replacement" : "func g1(a ...*int) {}\nfunc g2(...int) {}\nfunc g3(a, ...bool) {}"
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" : "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)"
} ,
{
2016-11-02 21:37:30 +03:00
"syntax" : "selector-expressions" ,
2016-11-02 17:47:56 +03:00
"insert" : "a.b.c()" ,
"replacement" : "x.y.z()"
} ,
{
2016-11-02 21:37:30 +03:00
"syntax" : "indexing-expressions" ,
2016-11-02 17:47:56 +03:00
"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
{
2016-11-02 21:37:30 +03:00
"syntax" : "type-assertion-expressions" ,
2016-11-02 17:47:56 +03:00
"insert" : "x.(z.Person)" ,
"replacement" : "b.(c.Dog)"
} ,
{
2016-11-02 21:37:30 +03:00
"syntax" : "type-conversion-expressions" ,
2016-11-02 17:47:56 +03:00
"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-11-02 18:02:55 +03:00
} ,
{
"syntax" : "imaginary-literals" ,
"insert" : "const (\na = 01i\nb = 1.e+100i\n)" ,
"replacement" : "const (\na = 02i\nb = 1.e+103i\n)"
2016-11-02 18:07:06 +03:00
} ,
{
"syntax" : "string-literals" ,
"insert" : "const (\na = \"0\"\nb = \"hello world\"\n)" ,
"replacement" : "const (\na = \"2\"\nb = \"hi\"\n)"
2016-11-02 21:37:30 +03:00
} ,
{
"syntax" : "slice-literals" ,
"insert" : "const s1 = []string{}\nconst s2 = []string{\"hi\"}\nconst s3 = []string{\n\"hi\",\n \"hello\",\n}" ,
"replacement" : "const s1 = []string{\"sup\"}\nconst s2 = []string{\"hello\"}\nconst s3 = []string{\n\"bar\",\n \"baz\",\n}"
} ,
{
"syntax" : "array-with-implicit-length" ,
"insert" : "const a1 = [...]int{1, 2, 3}" ,
"replacement" : "const a1 = [...]int{4,5,6}"
} ,
{
"syntax" : "map-literals" ,
"insert" : "const s = map[string]string{\n\"hi\": \"hello\",\n\"bye\": \"goodbye\",\n}" ,
"replacement" : "const s = map[string]int{\n\"foo\": \"bar\",\n\"baz\": \"hello\",\n}"
} ,
{
"syntax" : "struct-literals" ,
"insert" : "const s1 = Person{\nname: \"Frank\",\nAge: \"5 months\",\n}\nconst s2 = struct{i int;}{i: 5}\nconst s3 = time.Time{}" ,
"replacement" : "const s1 = Dog{\nname: \"Frank\",\nAge: \"5 months\",\n}\nconst s2 = struct{i float;}{j: 6}\nconst s3 = time.Month{}"
} ,
{
"syntax" : "send-statements" ,
"insert" : "foo <- 5" ,
"replacement" : "bar <- 6"
} ,
{
"syntax" : "increment-decrement-statements" ,
"insert" : "i++\nj--" ,
"replacement" : "foo++\nx++"
} ,
{
"syntax" : "qualified-types" ,
"insert" : "type a b.c" ,
"replacement" : "type x y.z"
} ,
{
"syntax" : "array-types" ,
"insert" : "type a [2+2]x" ,
"replacement" : "type a [1+1]y"
} ,
{
"syntax" : "slice-types" ,
"insert" : "type a []b\ntype c [][]d" ,
"replacement" : "type a [][]p\ntype c []y"
} ,
{
"syntax" : "struct-types" ,
"insert" : "type s1 struct {}\ntype s2 struct { Person }\ntype s3 struct {\nf, g int\n}\ntype s4 struct {\np.s1\n h int `json:\"h\"`\n}" ,
"replacement" : "type t1 struct {}\ntype t2 struct { Person }\ntype t3 struct {\nf, g int\n}\ntype t4 struct {\np.s1\n h int `json:\"h\"`\n}"
} ,
{
"syntax" : "interface-types" ,
"insert" : "type i1 interface {}\ntype i2 interface { io.Reader }\ntype i3 interface {\ni1\nio.Reader\n SomeMethod(s string) error\n}" ,
"replacement" : "type j1 interface {}\ntype j2 interface { io.Reader }\ntype j3 interface {\ni1\nio.Reader\n SomeMethod(s string) error\n}"
} ,
{
"syntax" : "map-types" ,
"insert" : "type m1 map[string]error" ,
"replacement" : "type m1 map[int]error"
} ,
{
"syntax" : "pointer-types" ,
"insert" : "type (\np1 *string\np2 **p1\n)" ,
"replacement" : "type (\np1 *int\np2 **p3\n)"
} ,
{
"syntax" : "channel-types" ,
"insert" : "type (\nc1 chan<- chan int\nc2 chan<- chan<- struct{}\nc3 chan<- <-chan int\n)" ,
"replacement" : "type (\nc2 chan<- chan string\nc3 chan<- chan<- struct{}\nc4 chan<- <-chan string\n)"
} ,
{
"syntax" : "function-types" ,
"insert" : "type (\na func(int) int\nb func(int, string) (bool, error)\n)" ,
"replacement" : "type (\nx func(string) string\ny func(string, int) (chan, error)\n)"
2016-10-18 21:49:45 +03:00
}
]
}
]