-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding my personal snippets and key bindings
- Loading branch information
1 parent
3f3c15f
commit bf12a9d
Showing
43 changed files
with
366 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# name: append | ||
# key: apn | ||
# -- | ||
$1 = append($1, $2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: cmp.Diff | ||
# key: cdif | ||
# -- | ||
if diff := cmp.Diff($1, $2); diff != "" { | ||
t.Errorf("$3() mismatch (-want +got):\n%s", diff) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# name: log an error using logrus | ||
# key: elerr | ||
# group: logrus | ||
# -- | ||
if err != nil { | ||
${1:log}.WithFields(log.Fields{ | ||
"err": err, | ||
}).Error("$2") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# name: log a fatal error using logrus | ||
# key: elfat | ||
# -- | ||
if $1 != nil { | ||
${2:log}.WithError($1).Fatal("$3") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# name: check for an error | ||
# key: erc | ||
# -- | ||
if err != nil { | ||
$0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: ginkgo after | ||
# key: gaft | ||
# -- | ||
AfterEach(func(){ | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- mode: snippet -*- | ||
# name: ginkgo before | ||
# key: gb4 | ||
# -- | ||
BeforeEach(func(){ | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- mode: snippet -*- | ||
# name: ginkgo Context | ||
# key: gct | ||
# -- | ||
|
||
Context("$1", func() { | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- mode: snippet -*- | ||
# name: ginkgo scaffolding | ||
# key: gscaf | ||
# -- | ||
|
||
var _ = Describe("$1", func() { | ||
var ( | ||
ctrl *gomock.Controller | ||
$2 | ||
) | ||
BeforeEach(func() { | ||
ctrl = gomock.NewController(GinkgoT()) | ||
$3 | ||
}) | ||
|
||
AfterEach(func() { | ||
ctrl.Finish() | ||
}) | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- mode: snippet -*- | ||
# name: new go mock | ||
# key: gmock | ||
# -- | ||
|
||
//go:generate mockgen -self_package github.com/BishopFox/`(directory-file-name (file-relative-name (file-name-directory (buffer-file-name)) "/Users/tdeeb-swihart/Documents/Projects/mss"))` -package `(file-name-nondirectory (directory-file-name (file-name-directory (buffer-file-name)) ))` -destination `(file-name-base (buffer-file-name))`_mock.go github.com/BishopFox/`(directory-file-name (file-relative-name (file-name-directory (buffer-file-name)) "/Users/tdeeb-swihart/Documents/Projects/mss/") )` $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- mode: snippet -*- | ||
# name: goblin describe | ||
# key: gdesc | ||
# -- | ||
|
||
Describe("$1", func() { | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- mode: snippet -*- | ||
# name: goblin It | ||
# key: gi | ||
# -- | ||
|
||
It("should $1", func() { | ||
$0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet -*- | ||
# name: gomega expect | ||
# key: gexp | ||
# -- | ||
Expect($1).Should($0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# name: import bishopfox pkg | ||
# key: ibf | ||
# -- | ||
"github.com/BishopFox/$1/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# name: run a function and check for an error | ||
# key: iferr | ||
# -- | ||
if ${1:err} = $2; err != nil { | ||
$3 | ||
} else { | ||
$4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# name: json tag | ||
# key: jj | ||
# -- | ||
\`json:"$1"\` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# name: log(rus) with fields | ||
# key: lwf | ||
# group: logrus | ||
# -- | ||
${1:log}.WithFields(log.Fields{ | ||
"$2": $3, | ||
}).${4:Info}($5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- mode: snippet -*- | ||
# name: wrap a gomega matcher for use with gomock | ||
# key: megamock | ||
# -- | ||
|
||
func WrapGomega(m types.GomegaMatcher) interface{} { | ||
return mock.MatchedBy(func(actual interface{}) bool { | ||
return Expect(actual).To(m) | ||
}) | ||
} |
Oops, something went wrong.