Skip to content

Commit 3a98343

Browse files
committed
fix(go-mode): Introduces consistent formatting changes to Go snippets
**Summary:** This pull request introduces consistent formatting changes to various Go code snippets in the 'go-mode' directory. The changes include: - Adding spaces between function parameters and return types. - Formatting import statements to use parentheses for multiple imports. - Updating struct snippets to include a name for the struct type. - Updating the 'switch' snippet to include an expression. - Adding `type` for creating a new struct or interface. **Changes Made:** - In 'go-mode/f' and 'go-mode/func', added spaces between function parameters and return types to follow go convention. - In 'go-mode/method', added spaces between function parameters and return types to follow go convention. - In 'go-mode/imp' and 'go-mode/import', reformatted import statements to use parentheses for multiple imports. - In 'go-mode/struct', added a name for the struct type for clarity. - Add a new file `go-mode/type` for creating a new struct or interface. - In 'go-mode/switch', updated the 'switch' snippet to include an expression for better usage. These changes improve code readability and maintain consistency throughout the 'go-mode' snippets. **Related Issues:** None
1 parent d490cba commit 3a98343

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

go-mode/f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: func ...(...) ... { ... }
33
# --
4-
func ${1:name}(${2:args})${3: return type} {
4+
func ${1:name}(${2:args}) ${3:return type}{
55
`%`$0
66
}

go-mode/func

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: func ...(...) ... { ... }
33
# --
4-
func ${1:name}(${2:args})${3: return type} {
4+
func ${1:name}(${2:args}) ${3:return type}{
55
`%`$0
66
}

go-mode/imp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: import
33
# --
4-
import ${1:package}$0
4+
import (
5+
${1:package}$0
6+
)

go-mode/import

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: import
33
# --
4-
import ${1:package}$0
4+
import (
5+
${1:package}$0
6+
)

go-mode/method

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: func (target) name(args) (results) { ... }
33
# --
4-
func (${1:target}) ${2:name}(${3:args})${4: return type} {
4+
func (${1:target}) ${2:name}(${3:args}) ${4:return type} {
55
$0
66
}

go-mode/struct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- mode: snippet -*-
22
# name: type ... struct { ... }
33
# --
4-
type $1 struct {
4+
type ${1:name} struct {
55
`%`$0
66
}

go-mode/switch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# key: switch
44
# uuid: switch
55
# --
6-
switch {
7-
case ${1:cond}:
6+
switch ${1:express}{
7+
case ${2:cond}:
88
$0
99
}

go-mode/type

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: type ... ... { ... }
3+
# --
4+
type ${1:name} ${2:struct | interface} {
5+
`%`$0
6+
}

0 commit comments

Comments
 (0)