Skip to content

Instantly share code, notes, and snippets.

View aurimasbachanovicius's full-sized avatar
🎯
Reaching out my goals

Aurimas Bachanovičius aurimasbachanovicius

🎯
Reaching out my goals
  • Lithuania, Vilnius
View GitHub Profile
func main() {
f := func(int x) {
fmt.Printf("x is %d\n", x)
}
y := 2
x = y
f(y)
}
@aurimasbachanovicius
aurimasbachanovicius / _test.go
Created December 25, 2018 17:25
golang simple response test
func simpleTestResponse(t *testing.T, want string, url string, method string) {
request, _ := http.NewRequest(method, url, nil)
response := httptest.NewRecorder()
PlayerServer(response, request)
got := response.Body.String()
if got != want {
t.Errorf("got '%s', want '%s'", got, want)
@aurimasbachanovicius
aurimasbachanovicius / function.groovy
Last active October 19, 2018 07:13
Jenkins Pipeline Groovy function to execute a command with changed files as argument. Can be used for linters which must check only changed files between stages.
@NonCPS
def executeCommandWithFiles(command) {
def changeLogSets = currentBuild.changeSets
def filesString = ""
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]