commit
stringlengths
40
40
old_file
stringlengths
4
264
new_file
stringlengths
4
264
old_contents
stringlengths
0
4.24k
new_contents
stringlengths
1
5.44k
subject
stringlengths
14
778
message
stringlengths
15
9.92k
lang
stringclasses
277 values
license
stringclasses
13 values
repos
stringlengths
5
127k
6ad82e5a30471a7421beb58242839cb835743fc1
pkg/kubelet/dockershim/cm/container_manager_unsupported.go
pkg/kubelet/dockershim/cm/container_manager_unsupported.go
// +build !linux /* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agre...
// +build !linux /* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agre...
Fix build break on non-Linux OS introduced in 87aaf4c0
Fix build break on non-Linux OS introduced in 87aaf4c0
Go
apache-2.0
derekwaynecarr/kubernetes,weijinxu/kubernetes,njuicsgz/kubernetes-1,k82cn/kubernetes,gaocegege/kubernetes,Hui-Zhi/kubernetes,mkumatag/kubernetes,qiujian16/kubernetes,hartsock/kubernetes,medinatiger/kubernetes,marun/kubernetes,iterion/kubernetes,saad-ali/kubernetes,chrislovecnm/kubernetes,bluebreezecf/kubernetes,houming...
9382cee6ae2d57c8b6f9e159f7ea88c7f7b4eac9
nico/mail.go
nico/mail.go
package nico import "strings" type Mail struct { Is184 bool } func (m Mail) String() string { var strs []string if m.Is184 { strs = append(strs, "184") } return strings.Join(strs, " ") }
package nico import "strings" // Mail is a structure that specifies comment options. type Mail struct { Is184 bool } func (m Mail) String() string { var strs []string if m.Is184 { strs = append(strs, "184") } return strings.Join(strs, " ") }
Add godoc for the Mail struct
Add godoc for the Mail struct
Go
mit
178inaba/lv-barrage
4466a860c1e8c59d5d866e8d1165c15273d52d90
examples/rpc/rpc-client/main.go
examples/rpc/rpc-client/main.go
package main import ( "bufio" "fmt" "log" "os" "strconv" "gopkg.in/jcelliott/turnpike.v2" ) func main() { turnpike.Debug() c, err := turnpike.NewWebsocketClient(turnpike.JSON, "ws://localhost:8000/", nil) if err != nil { log.Fatal(err) } _, err = c.JoinRealm("turnpike.examples", nil) if err != nil { ...
package main import ( "bufio" "fmt" "log" "os" "strconv" "gopkg.in/jcelliott/turnpike.v2" ) func main() { turnpike.Debug() c, err := turnpike.NewWebsocketClient(turnpike.JSON, "ws://localhost:8000/", nil) if err != nil { log.Fatal(err) } _, err = c.JoinRealm("turnpike.examples", nil) if err != nil { ...
Fix Call to pass in options
Fix Call to pass in options
Go
mit
jcelliott/turnpike,dcarbone/turnpike
6ffdaa50bb51c6fe78e0634a316c468a29f31941
slug.go
slug.go
package slug import ( "code.google.com/p/go.text/unicode/norm" "regexp" "strings" "unicode" ) // don't even quote these var _SKIP = []*unicode.RangeTable{ unicode.Mark, unicode.Sk, unicode.Lm, } var _SAFE = []*unicode.RangeTable{ unicode.Letter, unicode.Number, } func safe(r rune) rune { switch { case un...
package slug import ( "golang.org/x/text/unicode/norm" "regexp" "strings" "unicode" ) // don't even quote these var _SKIP = []*unicode.RangeTable{ unicode.Mark, unicode.Sk, unicode.Lm, } var _SAFE = []*unicode.RangeTable{ unicode.Letter, unicode.Number, } func safe(r rune) rune { switch { case unicode.Is...
Use new golang.org/x/ import paths
Use new golang.org/x/ import paths
Go
mit
tv42/slug
abbe90686d8f9b9a35097c07235e52259ea0f453
example_test.go
example_test.go
package kvlog_test import ( "bytes" "fmt" log "github.com/Sirupsen/logrus" "github.com/gwatts/kvlog" ) func Example() { var buf bytes.Buffer log.SetOutput(&buf) log.SetFormatter( kvlog.New( kvlog.IncludeCaller(), kvlog.WithPrimaryFields("action", "status"))) log.WithFields(log.Fields{ "action": ...
package kvlog_test import ( "bytes" "fmt" "regexp" log "github.com/Sirupsen/logrus" "github.com/gwatts/kvlog" ) func Example() { var buf bytes.Buffer log.SetOutput(&buf) log.SetFormatter( kvlog.New( kvlog.IncludeCaller(), kvlog.WithPrimaryFields("action", "status"))) log.WithFields(log.Fields{ "...
Make test less sensitive to line numbers
Make test less sensitive to line numbers
Go
mit
gwatts/kvlog
3b19428baf38b7687fafca985d1ba2929e59e18f
search/new_search.go
search/new_search.go
package search import ( "net/url" "strconv" ) type search struct { Keyword string Pagenation int Sort string } func New(keyword string, sort string) *search { return &search{ Keyword: keyword, Pagenation: 0, Sort: sort, } } func (s *search) GetURL() string { q := url.Values{} q.Set(...
package search import ( "net/url" "strconv" ) type search struct { Keyword string Pagenation int Sort string } func New(keyword string, sort string) *search { return &search{ Keyword: keyword, Pagenation: 0, Sort: sort, } } func (s *search) GetURL() string { q := url.Values{} q.Set(...
Add search next page method
Add search next page method
Go
apache-2.0
wataru0225/sreq
2c0d6ad1e5b2a44a377e378f5f46d6313a17defd
template.go
template.go
// Copyright 2013 Jesse Allen. All rights reserved // Released under the MIT license found in the LICENSE file. package main import ( "flag" "html/template" ) var ( LayoutTemplateGlob = flag.String("layouts", "templates/layouts/*.html", "Pattern for layout templates") HelperTemplateGlob = flag.String("helpers", ...
// Copyright 2013 Jesse Allen. All rights reserved // Released under the MIT license found in the LICENSE file. package main import ( "flag" "github.com/russross/blackfriday" "html/template" ) var ( LayoutTemplateGlob = flag.String("layouts", "templates/layouts/*.html", "Pattern for layout templates") HelperTem...
Add support for Markdown Processing
Add support for Markdown Processing Adds support using the github.com/russross/blackfriday package as functions available within the globally available templates.
Go
mit
lazyengineering/gobase,lazyengineering/gobase,lazyengineering/gobase
0482410d9d3e8b3c113872d5f97f1d79921d84d9
ami/agent.go
ami/agent.go
package ami // Agents lists agents and their status. func Agents(client Client, actionID string) ([]Response, error) { return requestList(client, "Agents", actionID, "AgentsEntry", "AgentsComplete") } // AgentLogoff sets an agent as no longer logged in. func AgentLogoff(client Client, actionID, agent string, soft bo...
package ami // Agents lists agents and their status. func Agents(client Client, actionID string) ([]Response, error) { return requestList(client, "Agents", actionID, "Agents", "AgentsComplete") } // AgentLogoff sets an agent as no longer logged in. func AgentLogoff(client Client, actionID, agent string, soft bool) (...
Change event type name for Agents
Change event type name for Agents Signed-off-by: Jefferson Silva <15c75df8c3b4799f2b1f746f01a0718fb2f0c042@assertivasolucoes.com.br>
Go
mit
heltonmarx/goami
1d1fe1050df8b666fe0f79be61b93338129977da
notifier/notifier.go
notifier/notifier.go
// Package notifier contains types and methods for sending notifications // that a job has completed. package notifier import ( "io" "net/http" ) // To create notifications, an object has to have a destination in mind // and be able to serialize itself into a JSON message. type Notifiable interface { Recipient() s...
// Package notifier contains types and methods for sending notifications // that a job has completed. package notifier import ( "io" "fmt" "net/http" ) // To create notifications, an object has to have a destination in mind // and be able to serialize itself into a JSON message. type Notifiable interface { Recipi...
Use auth and check response
Use auth and check response
Go
mit
PeopleAdmin/pdfcombiner,PeopleAdmin/pdfcombiner,PeopleAdmin/pdfcombiner
4ebb48349da687c59cc37206f681a3c2aca2cae9
funcs.go
funcs.go
package main import ( "fmt" "strings" ) var defaultFuncs = map[string]interface{}{ "str": String, "dec": Decimal, "eq": Equal, } func String(v interface{}) string { switch x := v.(type) { case string: x = strings.Replace(x, `\`, `\\`, -1) x = strings.Replace(x, `"`, `\"`, -1) return fmt.Sprintf("\"%s\"...
package main import ( "fmt" "strings" ) var defaultFuncs = map[string]interface{}{ "str": String, "dec": Decimal, "eq": Equal, "eq_igncase": EqualIgnoreCase, } func String(v interface{}) string { switch x := v.(type) { case string: x = strings.Replace(x, `\`, `\\`, -1) x = strings.R...
Add function for string compare ignoring case
Add function for string compare ignoring case
Go
bsd-3-clause
voxelbrain/jsonformat
a2cf0568e853a22a50110e43d5185a096f3145c6
test/fixedbugs/issue10607.go
test/fixedbugs/issue10607.go
// +build linux // +build !ppc64,!ppc64le // run // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that a -B option is passed through when using both internal // and external linking mode. package mai...
// +build linux // run // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that a -B option is passed through when using both internal // and external linking mode. package main import ( "fmt" "os" ...
Revert "test: do not run external linking test on ppc64le"
Revert "test: do not run external linking test on ppc64le" Broke most builders. This reverts commit a60c5366f91934a36793bde74556f4b637954665. Change-Id: Iae952cfcc73ef5da621616a0b3d586b60d1ce9c9 Reviewed-on: https://go-review.googlesource.com/12684 Reviewed-by: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@gola...
Go
bsd-3-clause
NunoEdgarGub1/go,constantine001/go,NichoZhang/go,gohin/go,danielsoro/go,vsekhar/elastic-go,vsekhar/elastic-go,zcwfeng/go,joshsammut/go,ifagnosticism/go,dafyddcrosby/go,Stan-Lin-/go,gdey/go,arschles/go-1,AALEKH/go,stormltf/go,yangzhongj/go,cainiaocome/go,greyhwndz/go,gohin/go,NunoEdgarGub1/go,chinanjjohn2012/go,JioCloud...
fd6c0068aaccaf0757e61c41424434890cbab2aa
src/io.mhlg/fortunes/fortunereader/fortunereader_test.go
src/io.mhlg/fortunes/fortunereader/fortunereader_test.go
package fortunereader import ( "testing" "reflect" ) func TestFortunes(t *testing.T) { var tests = []struct { input string expected []string } { { "fortune", []string{"fortune"} }, { "fortune\n", []string{"fortune\n"} }, { "fortune\n%\n", []string{"fortune\n"} }...
package fortunereader import ( "testing" "reflect" ) func TestFortunes(t *testing.T) { var tests = []struct { input string expected []string } { { "", []string{} }, { "fortune", []string{"fortune"} }, { "fortune\n", []string{"fortune\n"} }, { "fortune\n%...
Add test for empty string
Add test for empty string
Go
mit
mhaligowski/fortunes-server
348063da18fd9396bb0de1595fb4278c9c5a0a24
core/types/location_metadata.go
core/types/location_metadata.go
// Copyright © 2016 The Things Network // Use of this source code is governed by the MIT license that can be found in the LICENSE file. package types // LocationMetadata contains GPS coordinates type LocationMetadata struct { Altitude int32 `json:"altitude,omitempty"` Longitude float32 `json:"longitude,omitempty...
// Copyright © 2016 The Things Network // Use of this source code is governed by the MIT license that can be found in the LICENSE file. package types // LocationMetadata contains GPS coordinates type LocationMetadata struct { Latitude float32 `json:"latitude,omitempty"` Longitude float32 `json:"longitude,omitempty...
Change order of Location metadata
Change order of Location metadata
Go
mit
TheThingsNetwork/ttn,mgranberry/ttn,mgranberry/ttn,mgranberry/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,jvanmalder/ttn
41789c7104c75923441b5d34d6ce544e7df6eeed
model/ts.go
model/ts.go
package model import "time" type TimeSeriesPayload struct { Thing string `json:"thing"` ThingType string `json:"thingType"` Promoted bool `json:"promoted"` Device string `json:"device"` Channel string ...
package model import "time" type TimeSeriesPayload struct { Thing string `json:"thing"` ThingType string `json:"thingType"` Promoted bool `json:"promoted"` Device string `json:"device"` Channel string `json:"cha...
Remove ReportingZones from model object.
Remove ReportingZones from model object. Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com>
Go
mit
ninjasphere/go-ninja,ninjasphere/go-ninja
b39571d9fdd81e86328031ceb7b98e4fe477dd64
example_test.go
example_test.go
package machineid_test import ( "fmt" "log" "github.com/denisbrodbeck/machineid" ) func Example() { id, err := machineid.ID() if err != nil { log.Fatal(err) } fmt.Println(id) }
package machineid_test import ( "fmt" "log" "github.com/denisbrodbeck/machineid" ) func Example() { id, err := machineid.ID() if err != nil { log.Fatal(err) } fmt.Println(id) } func ExampleProtected() { appID := "Corp.SomeApp" id, err := machineid.ProtectedID(appID) if err != nil { log.Fatal(err) } ...
Add example for protected id.
Add example for protected id.
Go
mit
denisbrodbeck/machineid
2dd289ac5b57a508437299ac72b1528c3f89b2b8
handler/main.go
handler/main.go
package handler import ( "github.com/Sirupsen/logrus" "github.com/unrolled/render" ) var ( l *logrus.Logger output = render.New(render.Options{Layout: "layout"}) ) func SetLogger(logger *logrus.Logger) { l = logger }
package handler import ( "github.com/Sirupsen/logrus" "github.com/unrolled/render" ) var ( log *logrus.Logger output = render.New(render.Options{Layout: "layout"}) ) func SetLogger(l *logrus.Logger) { log = l }
Rename `l` to `log` for readability
Rename `l` to `log` for readability
Go
mit
mattbostock/leavediary
2c47d6ab1b9edc503d7a4513c8e7671b897a7505
adfs_config.go
adfs_config.go
package main import ( "fmt" "os" "gopkg.in/ini.v1" ) type ADFSConfig struct { Username string `ini:"user"` Password string `ini:"pass"` Hostname string `ini:"host"` } func newADFSConfig() *ADFSConfig { configPath := fmt.Sprintf("%s/.config/auth-aws/config.ini", os.Getenv("HOME")) adfsConfig := new(ADFSConf...
package main import ( "bufio" "fmt" "os" "strings" "github.com/howeyc/gopass" "gopkg.in/ini.v1" ) type ADFSConfig struct { Username string `ini:"user"` Password string `ini:"pass"` Hostname string `ini:"host"` } func newADFSConfig() *ADFSConfig { configPath := fmt.Sprintf("%s/.config/auth-aws/config.ini"...
Add failover to CLI if missing any values
Add failover to CLI if missing any values
Go
mit
tmiller/auth-aws,tmiller/auth-aws
808f26b9d76c0ed690a6256559c0dd0aa1c906f7
src/fullerite/collector/http_generic.go
src/fullerite/collector/http_generic.go
package collector import ( "fullerite/metric" "net/http" ) type errorHandler func(error) type responseHandler func(*http.Response) []metric.Metric type baseHTTPCollector struct { baseCollector rspHandler responseHandler errHandler errorHandler endpoint string } // Collect first queries the config'd endpoin...
package collector import ( "fullerite/metric" "time" "net/http" ) type errorHandler func(error) type responseHandler func(*http.Response) []metric.Metric type baseHTTPCollector struct { baseCollector rspHandler responseHandler errHandler errorHandler endpoint string } // Collect first queries the config'd...
Make http request with a default timeout
Make http request with a default timeout If no timeout specified a connection can hang forever
Go
apache-2.0
qnib/QNIBCollect,qnib/QNIBCollect,qnib/QNIBCollect,qnib/QNIBCollect
d131b74b0a3b0555e251eda3c490a0b92660c5d3
src/onestepback.org/gotags/tag_test.go
src/onestepback.org/gotags/tag_test.go
package main import ( "testing" "onestepback.org/assert" ) import "strconv" type StringIo struct { data string } func (self *StringIo) WriteString(s string) (int, error) { self.data += s return 0, nil } func TestTag(t *testing.T) { tag := NewTag("file.go") tag.Add("fun", "def fun", Location { 10, 123 }) tag...
package main import ( "testing" "onestepback.org/assert" ) import "strconv" type StringIo struct { data string } func (self *StringIo) WriteString(s string) (int, error) { self.data += s return 0, nil } func TestTag(t *testing.T) { tag := NewTag("file.go") tag.Add("fun", "def fun", Location { 10, 123 }) tag...
Test for empty definitions in tag
Test for empty definitions in tag
Go
mit
jimweirich/gotags,jimweirich/gotags
2928ede0960ce66901d418165558d66de38b5625
models/fileservice/link_test.go
models/fileservice/link_test.go
package fileservice import "testing" func TestPlaceholder(t *testing.T) {}
package fileservice import ( "testing" "time" ) func TestNewLink(t *testing.T) { now := time.Now() uri := "http://example.com" link := NewLink(uri, now) if link.Uri != uri { t.FailNow() } if link.Expire != now { t.FailNow() } }
Add test for NewLink() in fileservice package.
Add test for NewLink() in fileservice package.
Go
apache-2.0
pasinskim/deployments,pasinskim/deployments,pasinskim/deployments,pasinskim/deployments
93c5d186aa05632dfc3671bd9989befe9cf17637
scaffold.go
scaffold.go
package main import ( "os" ) func AddRightScriptMetadata(path string) error { script, err := os.Open(path) if err != nil { return err } defer script.Close() // check if metadata already exists // Load script // Add metadata to buffer version // write to file return nil }
package main import ( "bufio" "fmt" "os" ) func AddRightScriptMetadata(path string) error { script, err := os.Open(path) if err != nil { return err } defer script.Close() // check if metadata section set by delimiters already exists scanner := bufio.NewScanner(script) inMetadata := false metadataExists ...
Add check if metadata already exists in AddRightScriptMetadata
Add check if metadata already exists in AddRightScriptMetadata
Go
mit
rightscale/right_st,rightscale/right_st
d86ceae7b1095c323eff4a4acd19462c32d7c987
cloud/examples/basic_auth/main.go
cloud/examples/basic_auth/main.go
package main import ( "context" "fmt" jira "github.com/andygrunwald/go-jira/v2/cloud" ) func main() { jiraURL := "https://go-jira-opensource.atlassian.net/" // Jira docs: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ // Create a new API token: https://id.at...
package main import ( "context" "fmt" jira "github.com/andygrunwald/go-jira/v2/cloud" ) func main() { jiraURL := "https://go-jira-opensource.atlassian.net/" // Jira docs: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ // Create a new API token: https://id.at...
Fix "GetSelf" method to get the current user
Cloud/Examples: Fix "GetSelf" method to get the current user
Go
mit
andygrunwald/go-jira
f826c4bc4981d44eeecbf4c9e4d2dcdc182ef496
cmd/skaffold/app/skaffold_test.go
cmd/skaffold/app/skaffold_test.go
/* Copyright 2019 The Skaffold Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
/* Copyright 2019 The Skaffold Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
Add test for unknown command
Add test for unknown command Signed-off-by: David Gageot <aa743a0aaec8f7d7a1f01442503957f4d7a2d634@gageot.net>
Go
apache-2.0
GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold
db6bcc601d9e052dba286ea470489375a491012e
env/env.go
env/env.go
package env import ( "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/postgres" _ "github.com/lib/pq" "github.com/mattes/migrate" "github.com/mattes/migrate/database/postgres" _ "github.com/mattes/migrate/source/file" ) var DB *gorm.DB func init() { var err error DB, err = gorm.Open("postgres", Co...
package env import ( "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/postgres" _ "github.com/lib/pq" "github.com/mattes/migrate" "github.com/mattes/migrate/database/postgres" _ "github.com/mattes/migrate/source/file" ) var DB *gorm.DB func init() { var err error DB, err = gorm.Open("postgres", Co...
Add Drop() and Reset() functions for database
Add Drop() and Reset() functions for database
Go
mit
droptheplot/rand_chat,droptheplot/rand_chat,droptheplot/rand_chat,droptheplot/rand_chat
5a937ec7881ac63392293330853418f61912f110
src/chat/server_conn_test.go
src/chat/server_conn_test.go
package chat_test import ( "testing" "github.com/spring1843/chat-server/src/chat" "github.com/spring1843/chat-server/src/drivers/fake" ) func TestInterviewUser(t *testing.T) { t.Skipf("Racy!") var ( server = chat.NewServer() connection = fake.NewFakeConnection() ) server.Listen() input := "newuser\...
package chat_test import ( "testing" "github.com/spring1843/chat-server/src/chat" "github.com/spring1843/chat-server/src/drivers/fake" ) func TestInterviewUser(t *testing.T) { var ( server = chat.NewServer() connection = fake.NewFakeConnection() ) server.Listen() input := "newuser\n" n, err := conn...
Remove skip no longer racy
Remove skip no longer racy
Go
mit
spring1843/chat-server
b723a92979418d95e9ee9f575f9a81038f3cbe32
memsearch/procMems_test.go
memsearch/procMems_test.go
package memsearch import ( "os" "testing" ) var needle []byte = []byte("Find This!") func TestFindString(t *testing.T) { pid := uint(os.Getpid()) res, err := memoryGrep(pid, needle) if err != nil { t.Fatal(err) } else if !res { t.Fatalf("memoryGrep failed, searching for %s, should be True", needle) } }
package memsearch import ( "fmt" "os" "os/exec" "testing" ) var needle []byte = []byte("Find This!") var buffersToFind = [][]byte{ []byte{0xc, 0xa, 0xf, 0xe}, []byte{0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf}, []byte{0xb, 0xe, 0xb, 0xe, 0xf, 0xe, 0x0}, } func TestSearchInOtherProcess(t *testing.T) { //TODO(mva...
Add test for known byte sequences.
[memsearch] Add test for known byte sequences. This tests for the known byte sequences added in cb0996871bc2 The C file has to be manually compiled, right now the name is hardcoded.
Go
mpl-2.0
mozilla/masche,mozilla/masche
b3b5e935e841193fb4656167f4af6d6fed7043e9
cmd/bytemark/generate_help.go
cmd/bytemark/generate_help.go
package main import ( "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app" "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/commands/admin" "github.com/urfave/cli" ) func generateHelp([]cli.Command) { for idx, cmd := range commands { switch cmd.Name { case "admin": commands[idx].Descriptio...
package main import ( "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app" "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/commands/admin" "github.com/urfave/cli" ) func generateHelp([]cli.Command) { for idx, cmd := range commands { switch cmd.Name { case "admin": commands[idx].Descriptio...
Fix lint issue with generateHelp
Fix lint issue with generateHelp
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
5dc838ca8c7100e44290ed77640a57da23a6aa7a
test/helpers.go
test/helpers.go
package test import ( "bytes" "encoding/json" "io" "net/http" "github.com/labstack/echo" ) type testForm struct { Name string Desc string } func Context(req *http.Request, res http.ResponseWriter, r interface{}) (c *echo.Context) { c = echo.NewContext(req, echo.NewResponse(res), echo.New()) if r != nil { ...
package test import ( "bytes" "encoding/json" "io" "net/http" "strings" "github.com/labstack/echo" ) type testForm struct { Name string Desc string } func Context(req *http.Request, res http.ResponseWriter, r interface{}) (c *echo.Context) { c = echo.NewContext(req, echo.NewResponse(res), echo.New()) if ...
Add NewStringReader-factory to test package
Add NewStringReader-factory to test package
Go
mit
konjoot/reeky
7865a018b5c3a4e1ea66cf27dc41c78a3de1c3dd
tempfile.go
tempfile.go
package tempfile import ( "io/ioutil" "os" "github.com/stretchr/testify/require" ) // TempFile is a temporary file that can be used with unit tests. TempFile // reduces the boilerplate setup required in each test case by handling // setup errors. type TempFile struct { File *os.File } // NewTempFile returns a n...
package tempfile import ( "io/ioutil" "os" "github.com/stretchr/testify/require" ) // TempFile is a temporary file that can be used with unit tests. TempFile // reduces the boilerplate setup required in each test case by handling // setup errors. type TempFile struct { File *os.File } // NewTempFile returns a n...
Fix copy when used with scratch and images with empty RootFS
Fix copy when used with scratch and images with empty RootFS Commit the rwLayer to get the correct DiffID Refacator copy in thebuilder move more code into exportImage cleanup some windows tests Release the newly commited layer. Set the imageID on the buildStage after exporting a new image. Move archiver to BuildManage...
Go
apache-2.0
gotestyourself/gotestyourself,gotestyourself/gotestyourself
ccdf7a7c68492c624fbb4de6378230d9a5ff59ed
proto/eventmon/messages.go
proto/eventmon/messages.go
package eventmon const ( ConnectString = "200 Connected to keymaster eventmon service" HttpPath = "/eventmon/v0" EventTypeSSHCert = "SSHCert" EventTypeX509Cert = "X509Cert" ) // Client sends no data. Server sends a sequence of events. type EventV0 struct { Type string CertData []byte `json:",omitemp...
package eventmon const ( ConnectString = "200 Connected to keymaster eventmon service" HttpPath = "/eventmon/v0" AuthTypePassword = "Password" AuthTypeSymantecVIP = "SymantecVIP" AuthTypeU2F = "U2F" EventTypeSSHCert = "SSHCert" EventTypeWebLogin = "WebLogin" EventTypeX509Cert = "X509Cert" ) ...
Add Web login events to eventmon protocol.
Add Web login events to eventmon protocol.
Go
apache-2.0
rgooch/keymaster,Symantec/keymaster,rgooch/keymaster,Symantec/keymaster,Symantec/keymaster,rgooch/keymaster
ba1e8ad5e4b20b92684f9b7c4bf3efb35a2fe0e1
flagutil/env.go
flagutil/env.go
package flagutil import ( "flag" "fmt" "os" "strings" ) // SetFlagsFromEnv parses all registered flags in the given flagset, // and if they are not already set it attempts to set their values from // environment variables. Environment variables take the name of the flag but // are UPPERCASE, and any dashes are re...
package flagutil import ( "flag" "fmt" "os" "strings" ) // SetFlagsFromEnv parses all registered flags in the given flagset, // and if they are not already set it attempts to set their values from // environment variables. Environment variables take the name of the flag but // are UPPERCASE, and any dashes are re...
Move declaration into func definition
flagutil: Move declaration into func definition
Go
apache-2.0
dgonyeo/pkg,barakmich/pkg,ecnahc515/pkg,jonboulle/pkg,sym3tri/pkg,sym3tri/pkg,coreos/pkg,coreos/pkg,bobbyrullo/pkg,jonboulle/pkg,bobbyrullo/pkg,ecnahc515/pkg,dgonyeo/pkg,barakmich/pkg
3311aaf8030e9ed62347b2127b6c66e2406c200e
tor/exec.go
tor/exec.go
// Package process supplies helper functions to start a tor binary as a slave process. package tor import ( "os/exec" // "bufio" // "regexp" ) // Cmd represents an tor executable to be run as a slave process. type Cmd struct { Config *Config Cmd *exec.Cmd // TODO: We probably shouldn't expose the exec.Cmd } ...
// Package tor supplies helper functions to start a tor binary as a slave process. package tor import ( "os/exec" // "bufio" // "regexp" ) // Cmd represents an tor executable to be run as a slave process. type Cmd struct { Config *Config Cmd *exec.Cmd // TODO: We probably shouldn't expose the exec.Cmd } // N...
Fix package name in doc.
Fix package name in doc.
Go
bsd-3-clause
sycamoreone/orc
e37e1e4db476d391eb88c15bf4ae19f35d957bf1
changroup.go
changroup.go
package main import ( "fmt" "time" metrics "github.com/rcrowley/go-metrics" ) type ChanGroup struct { Name string points []chan []interface{} depthGauges []metrics.Gauge } func NewChanGroup(name string, chanCap int) *ChanGroup { group := &ChanGroup{Name: name} group.points = make([]chan []interf...
package main import ( "fmt" "time" metrics "github.com/rcrowley/go-metrics" ) type ChanGroup struct { Name string points []chan []interface{} depthGauges []metrics.Gauge } func NewChanGroup(name string, chanCap int) *ChanGroup { group := &ChanGroup{Name: name} group.points = make([]chan []interf...
Clean this up a little.
Clean this up a little. Needs name as well to differentiate torgets
Go
apache-2.0
akkakks/lumbermill,octanner/lumbermill,getlantern/lumbermill,heroku/lumbermill,msiebuhr/lumbermill-prometheus
092b69717b5acd4bda7beecd12cca2465caf73bb
softlayer/provider_test.go
softlayer/provider_test.go
package softlayer import ( "os" "testing" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) var testAccProviders map[string]terraform.ResourceProvider var testAccProvider *schema.Provider func init() { testAccProvider = Provider().(*schema.Provider) testAccProviders =...
package softlayer import ( "testing" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) var testAccProviders map[string]terraform.ResourceProvider var testAccProvider *schema.Provider func init() { testAccProvider = Provider().(*schema.Provider) testAccProviders = map[s...
Update provider test to ensure default credentials were found.
Update provider test to ensure default credentials were found.
Go
mpl-2.0
softlayer/terraform-provider-softlayer,softlayer/terraform-provider-softlayer
c782b8a68a1b8bd70e98c11167e1a761adca7cba
ast/token.go
ast/token.go
package ast // TokenType is the type of tokem that will be returned by the Scanner. type TokenType int // The following are the token types that are recognized by the scanner const ( EOF TokenType = iota Comment Section WhiteSpace NLine Ident Assign // = LBrace // [ RBrace // ] LBracket // ) RBracket...
package ast // TokenType is the type of tokem that will be returned by the Scanner. type TokenType int // The following are the token types that are recognized by the scanner const ( EOF TokenType = iota Comment Section WhiteSpace NLine Ident Assign // = LBrace // [ RBrace // ] LBracket // ) RBracket...
Add Begin and End fields to Token
Add Begin and End fields to Token The fields helps to track the position of the token inside the source text stream ( []byte )
Go
mit
FarmRadioHangar/fessboxconfig,FarmRadioHangar/fessboxconfig
fa85ea50e9b5af18a4633da1d016aa44f05882e1
fbmodelsend/letter.go
fbmodelsend/letter.go
package fbmodelsend /* Letter is a complete message to a Facebook user. We use this name to refer a old letter because your message to be delivered it needed a sender, a reciever not only text in order to the mail company be able to find the reciever (or recipient). In this case our mail company is Facebook */ type Le...
package fbmodelsend /* Letter is a complete message to a Facebook user. We use this name to refer a old letter because your message to be delivered it needed a sender, a reciever not only text in order to the mail company be able to find the reciever (or recipient). In this case our mail company is Facebook */ type Le...
Add tag field to Letter struct
Add tag field to Letter struct
Go
apache-2.0
novatrixtech/go-fbmessenger
fae6ed236a31c146f8e5eb8dc09ef7b703a1389f
rtfblog.go
rtfblog.go
package main import ( "github.com/hoisie/web" "github.com/russross/blackfriday" "io/ioutil" "log" "os" ) func handler(ctx *web.Context, path string) { input, err := ioutil.ReadFile("testdata/foo.md") if err != nil { ctx.NotFound("File Not Found\n" + err.Error()) return ...
package main import ( "github.com/hoisie/web" "github.com/russross/blackfriday" "io/ioutil" "log" "os" ) func handler(ctx *web.Context, path string) { if path == "" { ctx.WriteString("foo") return } else { input, err := ioutil.ReadFile(path) if err != nil { ...
Split handler into two code paths
Split handler into two code paths
Go
bsd-2-clause
rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog
d3a6757d5ec57df5fb7b7ffc1f29451693d3162e
utils.go
utils.go
package main import ( "fmt" "runtime" "time" ) const MEGABYTE = 1024 * 1024 func startRuntimeProfiler() { m := &runtime.MemStats{} for { runtime.ReadMemStats(m) fmt.Println("-----------------------") fmt.Println("Goroutines:", runtime.NumGoroutine()) fmt.Println("Memory acquired:", m.Sys, "bytes,", m....
package main import ( "fmt" "runtime" "time" ) const MEGABYTE = 1024 * 1024 func startRuntimeProfiler() { m := &runtime.MemStats{} for { runtime.ReadMemStats(m) fmt.Println("-----------------------") fmt.Println("Goroutines:", runtime.NumGoroutine()) fmt.Println("Memory acquired:", m.Sys, "bytes,", m....
Set profiler sleep time to 30 seconds
Set profiler sleep time to 30 seconds
Go
mit
trigrass2/pgweb,w4ngyi/pgweb,freeformz/pgweb,adamjaso/pgweb,w4ngyi/pgweb,akarki15/pgweb,xiongjungit/pgweb,w4ngyi/pgweb,trigrass2/pgweb,freeformz/pgweb,beni55/pgweb,cmabastar/pgweb,sosedoff/pgweb,sosedoff/pgweb,akarki15/pgweb,brianlow/pgweb,trigrass2/pgweb,cmabastar/pgweb,cmabastar/pgweb,brianlow/pgweb,hardware/pgweb,ni...
040945562fe7d0502a38043f18fcd135b69603d1
sel/sel.go
sel/sel.go
package sel import ( "encoding/json" "os" "flag" "fmt" "link-select/types" ) func SelectLink(arg *flag.Flag) { fmt.Fprintf(os.Stdout, "Selecting %s from json file\n", arg.Value) readFile, err := os.Open("files/read.json") if err != nil { fmt.Fprintf(os.Stderr, "Error while opening read.json") os.Exit(-1)...
package sel import ( "os" "flag" "fmt" "log" "encoding/json" "link-select/types" ) func SelectLink(arg *flag.Flag) { fmt.Fprintf(os.Stdout, "Selecting %s from json file\n", arg.Value) readFile, err := os.Open("files/read.json") if err != nil { fmt.Fprintf(os.Stderr, "Error while opening read JSON file\n")...
Implement read.json parsing and proper error messages
Implement read.json parsing and proper error messages
Go
mit
danielkocher/link-select
4575d2c544f98590bc75fb019536adde973859c0
base_post.go
base_post.go
package gotumblr type BasePost struct { Blog_name string Id int64 Post_url string PostType string `json:"type"` Timestamp int64 Date string Format string Reblog_key string Tags []string Bookmarklet bool Mobile bool Source_url string Source_title str...
package gotumblr type BasePost struct { Blog_name string Id int64 Post_url string PostType string `json:"type"` Timestamp int64 Date string Format string Reblog_key string Tags []string Bookmarklet bool Mobile bool Source_url string Source_title str...
Add Note_count field to BasePost
Add Note_count field to BasePost
Go
apache-2.0
MariaTerzieva/gotumblr
9a3d826cd39063bf06e42f3bdf93505a58b3e710
cloudwatch_test.go
cloudwatch_test.go
package cloudwatch import ( "math/rand" "testing" "time" "github.com/Pallinder/go-randomdata" "github.com/gliderlabs/logspout/router" ) const NumMessages = 25000000 func TestCloudWatchAdapter(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode.") } route := &router.Route{...
package cloudwatch import ( "math/rand" "testing" "time" "github.com/Pallinder/go-randomdata" "github.com/gliderlabs/logspout/router" ) const NumMessages = 250000 func TestCloudWatchAdapter(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode.") } route := &router.Route{Ad...
Fix empty message case in integration test.
Fix empty message case in integration test.
Go
mit
bradgignac/logspout-cloudwatch,bradgignac/logspout-cloudwatch
4ac8b346023ea66a442fc23d5c47089b9909fef0
go/robot-name/robot_name.go
go/robot-name/robot_name.go
package robotname
package robotname type Robot struct { name string } func (r *Robot) Name() (name string, err error) { return r.name, nil } func (r *Robot) Reset() { r.name = generateName() } func generateName() string { return "AA111" }
Define methods needed on Robot
Define methods needed on Robot
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
b101f3a69614b9ad11616d4ab0dd72b066b99bd2
config/config.go
config/config.go
package config import ( "flag" "github.com/vharitonsky/iniflags" ) var ( Name = flag.String("name", "tad", "Nick to use in IRC") Server = flag.String("server", "127.0.0.1:6668", "Host:Port to connect to") Channels = flag.String("chan", "#tad", "Channels to join") Ssl = flag.Bool("ssl", false, "Use S...
package config import ( "flag" "github.com/vharitonsky/iniflags" ) var ( Name = flag.String("name", "tad", "Nick to use in IRC") Server = flag.String("server", "127.0.0.1:6668", "Host:Port to connect to") Channels = flag.String("chan", "#tad", "Channels to join") Ssl = flag.Bool("ssl", false, "Use S...
Fix paths to data files
Fix paths to data files
Go
unlicense
smotti/cfengine-tad
f5d17571e3cfe8bd2b41367ff231ab2c7a738e00
timeout.go
timeout.go
package typhon import ( "context" "strconv" "time" "github.com/monzo/terrors" ) func TimeoutFilter(defaultTimeout time.Duration) Filter { return func(req Request, svc Service) Response { timeout := defaultTimeout if t, err := strconv.Atoi(req.Header.Get("Timeout")); err == nil { timeout = time.Duration(t...
package typhon import ( "context" "strconv" "time" "github.com/monzo/terrors" ) // TimeoutFilter returns a Filter which will cancel a Request after the given timeout func TimeoutFilter(defaultTimeout time.Duration) Filter { return func(req Request, svc Service) Response { timeout := defaultTimeout if t, err...
Fix a potential goroutine leak in TimeoutFilter
Fix a potential goroutine leak in TimeoutFilter
Go
mit
monzo/typhon
0beef6dce9e593adc213ee9493669a18bc64cc2f
datalayer/datalayer.go
datalayer/datalayer.go
package datalayer import ( "os" "path/filepath" "regexp" ) const MAX_VOLUME_NAME_LENGTH int = 40 // ClusterHQ data layer, naive vfs (directory-based) implementation func ValidVolumeName(volumeName string) bool { var validVolumeRegex = regexp.MustCompile(`^[a-zA-Z]+[a-zA-Z0-9-]*$`) return validVolumeRegex.Match...
package datalayer import ( "os" "path/filepath" "regexp" ) const MAX_VOLUME_NAME_LENGTH int = 40 // ClusterHQ data layer, naive vfs (directory-based) implementation func ValidVolumeName(volumeName string) bool { var validVolumeRegex = regexp.MustCompile(`^[a-zA-Z]+[a-zA-Z0-9-]*$`) return validVolumeRegex.Match...
Return the error result of MkdirAll to be handled by the caller.
Return the error result of MkdirAll to be handled by the caller.
Go
apache-2.0
ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol
ee372f5cd446777a7a64b65af98f7b8fc8f8caf9
src/app/backend/console.go
src/app/backend/console.go
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
Use pflag and glog packages in go server code
Use pflag and glog packages in go server code This is per gmarek's recommendation.
Go
apache-2.0
vin/dashboard,cheld/dashboard,batikanu/dashboard,digitalfishpond/dashboard,tangfeixiong/dashboard,luxas/dashboard,cheld/dashboard,rf232/dashboard,SebastianM/dashboard,taimir/dashboard,batikanu/dashboard,f-higashi/dashboard,floreks/dashboard,floreks/dashboard,cnwalker/dashboard,floreks/dashboard,vlal/dashboard,titilambe...
fa9efe82f9ace4e3f11325e527c2d8759afc7101
nsinit/main.go
nsinit/main.go
package main import ( "os" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { app := cli.NewApp() app.Name = "nsinit" app.Version = "2" app.Author = "libcontainer maintainers" app.Flags = []cli.Flag{ cli.StringFlag{Name: "root", Value: ".", Usage: "root directory for containers"}...
package main import ( "os" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { app := cli.NewApp() app.Name = "nsinit" app.Version = "2" app.Author = "libcontainer maintainers" app.Flags = []cli.Flag{ cli.StringFlag{Name: "root", Value: "/var/run/nsinit", Usage: "root directory fo...
Change nsinit root to /var/run/nsinit
Change nsinit root to /var/run/nsinit Signed-off-by: Michael Crosby <951f4c7b5d47e32d0112c78d14a98eaa23e6b5ef@gmail.com>
Go
apache-2.0
keloyang/libcontainer,HuKeping/runc,ycaihua/runc,stefanberger/runc,BrickXu/libcontainer,boucher/runc,wcwxyz/runc,LK4D4/runc,willmtemple/runc,adrianreber/runc,kimh/runc,navidshaikh/runc,talwai/runc,ZJU-SEL/libcontainer,crosbymichael/libcontainer,albertoleal/runc,rhatdan/runc,mheon/runc,clnperez/runc,balajibr/runc,calave...
514f40674ef0599f4821583800f225290129e698
rulehunter_windows_test.go
rulehunter_windows_test.go
package main import "testing" func TestSubMain_interrupt(t *testing.T) { t.Skip("This test isn't implemented for Windows yet") } /************************************* * Helper functions *************************************/ func startService(t *testing.T, serviceName string) { runCmd(t, "net", "start", servi...
package main import "testing" func TestSubMain_interrupt(t *testing.T) { t.Skip("This test isn't implemented for Windows yet") } /************************************* * Helper functions *************************************/ func startService(t *testing.T, serviceName string) { runOSCmd(t, "net", "start", ser...
Fix windows service tests s/runCmd/runOSCmd/
Fix windows service tests s/runCmd/runOSCmd/
Go
unknown
vlifesystems/rulehunter,vlifesystems/rulehuntersrv,vlifesystems/rulehuntersrv,vlifesystems/rulehunter
d0e1e21719889d671bf5a0a682ff8d2d87a0e9fa
main_test.go
main_test.go
package main import ( "fmt" "os" "testing" "github.com/nicksnyder/go-i18n/i18n" mylog "github.com/patrickalin/GoMyLog" "github.com/spf13/viper" ) func TestSomething(t *testing.T) { viper.SetConfigName("config") viper.AddConfigPath(".") if err := viper.ReadInConfig(); err != nil { fmt.Printf("%v", err) } ...
package main import ( "fmt" "testing" "github.com/spf13/viper" ) func TestSomething(t *testing.T) { viper.SetConfigName("config") viper.AddConfigPath(".") if err := viper.ReadInConfig(); err != nil { fmt.Printf("%v", err) } } /* func TestMain(m *testing.M) { i18n.MustLoadTranslationFile("lang/en-US.all.js...
Test + travis = error
Test + travis = error
Go
apache-2.0
patrickalin/bloomsky-client-go,patrickalin/bloomsky-client-go,patrickalin/bloomsky-client-go
4d034e0a38dc64bf5b5e776217638442e70b0e31
cmd/donna.go
cmd/donna.go
// Copyright (c) 2013-2014 by Michael Dvorkin. All Rights Reserved. // Use of this source code is governed by a MIT-style license that can // be found in the LICENSE file. package main import ( `github.com/michaeldv/donna` `os` ) func main() { // Default engine settings are: 128MB transposition table, 5s per move...
// Copyright (c) 2013-2014 by Michael Dvorkin. All Rights Reserved. // Use of this source code is governed by a MIT-style license that can // be found in the LICENSE file. package main import ( `github.com/michaeldv/donna` `os` `runtime` ) func main() { // Default engine settings are: 128MB transposition table, ...
Enable fancy notation on Mac only
Enable fancy notation on Mac only
Go
mit
michaeldv/donna,michaeldv/donna
86099237bd8a792bbc2a88b9cdd1210a71276b1d
conn_test.go
conn_test.go
package pqx import ( "testing" ) func TestConnect(t *testing.T) { conn, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"}) if err != nil { t.Fatal("Unable to establish connection") } if _, present := conn.runtimeParams["server_version"]; !present { t.Error("Runtime parameters not stor...
package pqx import ( "testing" ) func TestConnect(t *testing.T) { conn, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"}) if err != nil { t.Fatal("Unable to establish connection") } if _, present := conn.runtimeParams["server_version"]; !present { t.Error("Runtime parameters not stor...
Add failing test for Conn.Query
Add failing test for Conn.Query
Go
mit
plopik/pgx,plopik/pgx,deoxxa/pgx,silviucm/pgx,rsto/pgx,plopik/pgx,silviucm/pgx,kelvich/pgx,silviucm/pgx,jackc/tern,jackc/tern-deb,jackc/pgx,josephglanville/pgx,jackc/pgx,jackc/pgx,jonasi/pgx,axsy-dev/tern,jackc/pgx
a6130d7d09ee064b54975ca8518c2f00d5e9424f
watch/watch.go
watch/watch.go
// Package watch detects raw changes to files. package watch import ( "context" ) // Watcher watches a file at the given path for changes. type Watcher interface { // Read blocks and returns the next update for a file. An error is returned // when the file cannot be read. Subsequent calls block until the underlyin...
// Package watch detects raw changes to files. package watch import ( "context" ) // Watcher watches files at the given paths for changes. type Watcher interface { // Read blocks and returns the next update for a file. An error is returned // when the file cannot be read. Subsequent calls block until the underlyin...
Allow addition and removal of Watcher paths.
Allow addition and removal of Watcher paths. PiperOrigin-RevId: 235241642
Go
apache-2.0
openconfig/gnmi,openconfig/gnmi,openconfig/gnmi
161a2bf9bf0bf6024d3ee4a9b9eb74fb07c915cf
db.go
db.go
package main import ( "database/sql" _ "github.com/go-sql-driver/mysql" "log" ) func dbConnection() { db, err := sql.Open("mysql", "root:@tcp(127.0.0.1:3306)/blog") if err != nil { log.Fatal(err) } defer db.Close() err = db.Ping() if err != nil { log.Fatal(err) } }
package main import ( "database/sql" _ "github.com/go-sql-driver/mysql" "log" ) func dbConnection() *sql.DB { db, err := sql.Open("mysql", "root:@tcp(127.0.0.1:3306)/blog") if err != nil { log.Fatal(err) } return db }
Add logic for connecting to database
Add logic for connecting to database
Go
mit
nicholasrucci/blog,nicholasrucci/blog,nicholasrucci/blog
cac520a197bd3ff01f6b52a1983f0f2edcfa9776
pkg/skaffold/build/acr/azure_storage.go
pkg/skaffold/build/acr/azure_storage.go
package acr import ( "bufio" "bytes" "github.com/pkg/errors" "io" "net/http" "time" ) const VERSION = "2018-03-28" type AzureBlobStorage struct { UploadUrl string Bytes bytes.Buffer } func NewBlobStorage(url string) AzureBlobStorage { return AzureBlobStorage{ UploadUrl: url, } } func (s AzureBlobSt...
package acr import ( "bufio" "bytes" "fmt" "github.com/pkg/errors" "io" "net/http" "time" ) const VERSION = "2018-03-28" type AzureBlobStorage struct { UploadUrl string Bytes *bytes.Buffer } func NewBlobStorage(url string) AzureBlobStorage { return AzureBlobStorage{ UploadUrl: url, Bytes: new(...
Use buffer pointer instead of buffer in azure blob storage
Use buffer pointer instead of buffer in azure blob storage
Go
apache-2.0
GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold
6bca9aec95a06f95086551a25814c703835ba0f1
garagebot.go
garagebot.go
package main import ( "fmt" "github.com/stianeikeland/go-rpio" "net/http" "os" ) var ( pin = rpio.Pin(23) ) func main() { // Open and map memory to access gpio, check for errors if err := rpio.Open(); err != nil { fmt.Println(err) os.Exit(1) } // Pull up pin pin.PullUp() // Unmap gpio memory when do...
package main import ( "fmt" "github.com/stianeikeland/go-rpio" "net/http" ) type DoorStatus int const ( OPEN DoorStatus = iota CLOSED ) type StatusRequest struct { resultChan chan DoorStatus } func main() { statusChan := make(chan *StatusRequest) go doorMonitor(statusChan) http.Handle("/", &StatusPage{st...
Put door monitoring in a function, use channels.
Put door monitoring in a function, use channels.
Go
mit
cghawthorne/garagebot,cghawthorne/garagebot,cghawthorne/garagebot
3504b0ade51d44e6116fa2cf708082abdd95cc08
gosick.go
gosick.go
package main import ( "bufio" "fmt" "github.com/k0kubun/gosick/scheme" "log" "os" ) func printShellPrompt(indentLevel int) { if indentLevel == 0 { fmt.Print("gosick> ") } else if indentLevel > 0 { fmt.Print("gosick* ") for length := indentLevel; length > 0; length-- { fmt.Print(" ") } } else { ...
package main import ( "fmt" "github.com/GeertJohan/go.linenoise" "github.com/k0kubun/gosick/scheme" "log" "strings" ) func shellPrompt(indentLevel int) string { if indentLevel == 0 { return "gosick> " } else if indentLevel > 0 { return fmt.Sprintf("gosick* %s", strings.Repeat(" ", indentLevel)) } else { ...
Use linenoise to support cursor control
Use linenoise to support cursor control
Go
mit
k0kubun/gosick
0cbd47541910c6c89879c745a535c0fa6dd78460
execution.go
execution.go
package sirius import ( "time" ) type Execution struct { Ext Extension Msg Message Cfg ExtensionConfig } type ExecutionResult struct { Err error Action MessageAction } type ExtensionRunner interface { Run([]Execution, chan<- ExecutionResult, time.Duration) } type AsyncRunner struct{} func NewExecution(x...
package sirius import ( "time" ) type Execution struct { Ext Extension Msg Message Cfg ExtensionConfig } type ExecutionResult struct { Err error Action MessageAction } type ExtensionRunner interface { Run([]Execution, chan<- ExecutionResult, time.Duration) } type AsyncRunner struct{} func NewExecution(x...
Use copied instead of captured Msg and Cfg variables
Use copied instead of captured Msg and Cfg variables
Go
mit
kayex/sirius
f615bf6e5eaab01707c0caa175a268bdaf084eac
search/create_or_update_search_service.go
search/create_or_update_search_service.go
package search import "github.com/jen20/riviera/azure" type CreateOrUpdateSearchServiceResponse struct { ID *string `mapstructure:"id"` Name *string `mapstructure:"name"` Location *string `mapstructure:"location"` Tags *map[string]*string `mapstructure:"tags"` } ...
package search import "github.com/jen20/riviera/azure" type CreateOrUpdateSearchServiceResponse struct { ID *string `mapstructure:"id"` Name *string `mapstructure:"name"` Location *string `mapstructure:"location"` Tags *map[...
Change the CreateOrUpdateSearchService and it's response
search: Change the CreateOrUpdateSearchService and it's response
Go
mpl-2.0
jen20/riviera
1aed977f833b1b7376d8e4083b821c8b47192dd7
platform_test.go
platform_test.go
package main import ( "reflect" "testing" ) func TestSupportedPlatforms(t *testing.T) { var ps []Platform ps = SupportedPlatforms("go1.0") if !reflect.DeepEqual(ps, Platforms_1_0) { t.Fatalf("bad: %#v", ps) } ps = SupportedPlatforms("go1.1") if !reflect.DeepEqual(ps, Platforms_1_1) { t.Fatalf("bad: %#v"...
package main import ( "reflect" "testing" ) func TestSupportedPlatforms(t *testing.T) { var ps []Platform ps = SupportedPlatforms("go1.0") if !reflect.DeepEqual(ps, Platforms_1_0) { t.Fatalf("bad: %#v", ps) } ps = SupportedPlatforms("go1.1") if !reflect.DeepEqual(ps, Platforms_1_1) { t.Fatalf("bad: %#v"...
Add test for go 1.2
Add test for go 1.2
Go
mpl-2.0
mitchellh/gox
a5341f77a21a3ca96be63a92e81395cd7a2270a2
main_test.go
main_test.go
package main import ( "testing" ) func TestTruth(t *testing.T) { if t == nil { t.Fatalf("truth fails") } }
package main import ( "testing" ) func TestTruth(t *testing.T) { if t == nil { t.Fatalf("truth fails") } main() }
Add runtime data to test output.
Add runtime data to test output.
Go
mit
bpo/travis-testing
073293c7b5f879c112c0e46b62f506c7e4cd833e
mesh/peerinfo.go
mesh/peerinfo.go
package mesh import ( "fmt" "time" ) type PeerInfo struct { ID string Protocols map[string][]string } type peerInfoProtocol struct { PeerID string Name string Address string LastUpdated time.Time Pinned bool } // TODO maybe a better or just faster hash function? func (p *peerInf...
package mesh import ( "fmt" "time" ) type PeerInfo struct { ID string `json:"id"` Protocols map[string][]string `json:"protocols"` } type peerInfoProtocol struct { PeerID string `json:"peer_id"` Name string `json:"name"` Address string `json:"address"` LastUpdated...
Add peer info json attrs
Add peer info json attrs
Go
mit
nimona/go-nimona,nimona/go-nimona,nimona/go-nimona,nimona/go-nimona
441991d2f73ee9761b32c750d06e5c0410bce09e
reauth.go
reauth.go
package gophercloud import ( "github.com/racker/perigee" ) // WithReauth wraps a Perigee request fragment with logic to perform re-authentication // if it's deemed necessary. // // Do not confuse this function with WithReauth()! Although they work together to support reauthentication, // WithReauth() actually conta...
package gophercloud import ( "github.com/racker/perigee" ) // WithReauth wraps a Perigee request fragment with logic to perform re-authentication // if it's deemed necessary. // // Do not confuse this function with WithReauth()! Although they work together to support reauthentication, // WithReauth() actually conta...
Add ResponseWithReauth to do WithReauth that returns a perigee.Response
Add ResponseWithReauth to do WithReauth that returns a perigee.Response
Go
apache-2.0
sti-jans/gophercloud,larsbutler/gophercloud,clintonskitson/gophercloud,feiskyer/gophercloud,rackspace/gophercloud,mitchellh/gophercloud-fork-40444fb,DSpeichert/gophercloud,timbyr/gophercloud,mitchellh/gophercloud-fork-40444fb,larsbutler/gophercloud,rgbkrk/gophercloud,clintonskitson/gophercloud,trumant/gophercloud,jamie...
dcaff1f4b88c6a5c8300484767ba68b9c4283cfd
fontdirs_unix.go
fontdirs_unix.go
// +build dragonfly freebsd linux nacl netbsd openbsd solaris // Copyright 2016 Florian Pigorsch. All rights reserved. // // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package findfont import ( "os" "path/filepath" ) func getFontDirectories() (paths []stri...
// +build dragonfly freebsd linux nacl netbsd openbsd solaris // Copyright 2016 Florian Pigorsch. All rights reserved. // // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package findfont import ( "os" "path/filepath" ) func getFontDirectories() (paths []stri...
Fix system font dirs for *nix
Fix system font dirs for *nix
Go
mit
flopp/go-findfont
25be4d08fe6a1ff50e85e6a2c09a213e2c87953c
host/host_posix.go
host/host_posix.go
// +build linux freebsd openbsd darwin solaris package host import ( "golang.org/x/sys/unix" ) func kernelArch() (string, error) { var utsname unix.Utsname err := unix.Uname(&utsname) return string(utsname.Machine[:]), err }
// +build linux freebsd openbsd darwin solaris package host import ( "bytes" "golang.org/x/sys/unix" ) func kernelArch() (string, error) { var utsname unix.Utsname err := unix.Uname(&utsname) return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), err }
Trim null bytes from kernel arch
Trim null bytes from kernel arch
Go
bsd-3-clause
influxdb/gopsutil,influxdb/gopsutil
e6a76b4efa8de9d0a20e8bd5523675ca7eb1e184
db.go
db.go
package main import ( "database/sql" _ "github.com/go-sql-driver/mysql" "log" ) func dbConnection() *sql.DB { db, err := sql.Open("mysql", "root:@tcp(127.0.0.1:3306)/blog") if err != nil { log.Fatal(err) } return db }
package main import ( "database/sql" _ "github.com/go-sql-driver/mysql" "log" ) // dbConnection opens a new database connection and // returns a pointer to the sql.DB func dbConnection() *sql.DB { db, err := sql.Open("mysql", "root:@tcp(127.0.0.1:3306)/blog") if err != nil { log.Fatal(err) } return db }
Add documentation comments to methods
Add documentation comments to methods
Go
mit
nicholasrucci/blog,nicholasrucci/blog,nicholasrucci/blog
7bc992b822685f53c7cbf122fddf0dab03f55a23
translations/french_test.go
translations/french_test.go
package translations_test import ( "github.com/cloudfoundry/jibber_jabber" . "github.com/cloudfoundry-incubator/cf-test-helpers/cf" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" ) var _ = Describe("i18n support and language detection", func() { BeforeEach(func() { us...
package translations_test import ( "github.com/cloudfoundry/jibber_jabber" . "github.com/cloudfoundry-incubator/cf-test-helpers/cf" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" ) var _ = Describe("i18n support and language detection", func() { BeforeEach(func() { us...
Update french test per updated translations
Update french test per updated translations Signed-off-by: Muhammad Altaf <62c4feecf50ce9eaca6c8296bee7297f5ed184af@gmail.com>
Go
unknown
cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests,cloudfoundry/GATS,cloudfoundry/GATS,cloudfoundry/GATS,cloudfoundry/cli-acceptance-tests
84494e3ce36f35807ca004f44b0c8936f78ed835
wats/output_volume_test.go
wats/output_volume_test.go
package wats import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" ) var _ = Describe("An application printing a bunch of output", func() { BeforeEach(fu...
package wats import ( "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" ) var _ = Describe("An application printing a bunch of output", func() { Befo...
Increase the timeout for the logspew test
Increase the timeout for the logspew test It seems that changing the Nora to only have 1g of memory might be causing this endpoint to be slower than the 45s timeout we had previously Signed-off-by: David Morhovich <1d2e5394c2c3adc275fab845f5e23fc4a9634ec0@pivotal.io>
Go
apache-2.0
cloudfoundry-incubator/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry-incubator/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry/wats
c4305645df453d526f18fe5ca776344840ad47de
cmd/root.go
cmd/root.go
package cmd import ( "fmt" "os" "runtime" "github.com/exercism/cli/api" "github.com/spf13/cobra" ) var BinaryName string // RootCmd represents the base command when called without any subcommands. var RootCmd = &cobra.Command{ Use: BinaryName, Short: "A friendly command-line interface to Exercism.", Long:...
package cmd import ( "fmt" "os" "runtime" "github.com/exercism/cli/api" "github.com/spf13/cobra" ) // BinaryName is the name of the app. // By default this is exercism, but people // are free to name this however they want. // The usage examples and help strings should reflect // the actual name of the binary. ...
Fix another missed linting issue
Fix another missed linting issue
Go
mit
exercism/cli,exercism/cli
9cf66af6fdf5ccd6312014071e7eb6f631812a99
api.go
api.go
package hummingbird import ( "encoding/json" "github.com/parnurzeal/gorequest" ) type API struct { endpoint string token string request *gorequest.SuperAgent } func (api *API) UserAuthenticate(username, email, password string) (errs []error, body string) { type UserAuthenticateData struct { Username st...
package hummingbird import ( "encoding/json" "github.com/parnurzeal/gorequest" ) type API struct { endpoint string token string request *gorequest.SuperAgent } func (api *API) UserAuthenticate(username, email, password string) (errs []error, body string) { data := map[string]string{ "username": username...
Simplify data object for authentication
Simplify data object for authentication
Go
mit
MiLk/hummingbird-go
d71c56ec372cca2ad812250854efcc68da0e718e
turnstile.go
turnstile.go
package main import ( "errors" "fmt" ) type Action int const ( coin Action = iota push Action = iota ) type TurnstileState interface { Handle() (TurnstileState, error) } type TurnstileContext struct { action Action currentState TurnstileState } type UnlockedState struct { context TurnstileContext } ...
package main import ( "errors" "fmt" ) type Action int const ( coin Action = iota push Action = iota ) type TurnstileState interface { Handle() (TurnstileState, error) } type TurnstileContext struct { action Action currentState TurnstileState } type UnlockedState struct { context TurnstileContext } ...
Add String() funcion to States
Add String() funcion to States
Go
mit
0xfoo/turnstile
cb7f0c5db00f51a4c7c5e90390fddec9c25251fe
doc.go
doc.go
// (c) Copyright 2015 JONNALAGADDA Srinivas // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
// (c) Copyright 2015 JONNALAGADDA Srinivas // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
Introduce code for opening a database connection
Introduce code for opening a database connection
Go
apache-2.0
js-ojus/flow,js-ojus/flow
be93f20db6069f6197f50daa76844717b4233151
utils_test.go
utils_test.go
package adeptus import ( "testing" ) func Test_in(t *testing.T) { cases := []struct { in string slice []string out bool }{ { in: "", slice: []string{}, out: false, }, { in: "a", slice: []string{"b", "c"}, out: false, }, { in: "a", slice: []string{"a", "b", ...
package adeptus import ( "testing" ) func Test_in(t *testing.T) { cases := []struct { in string slice []string out bool }{ { in: "a", slice: []string{}, out: false, }, { in: "a", slice: []string{"b", "c"}, out: false, }, { in: "a", slice: []string{"a", "b",...
Add more tests to the in() utility
Add more tests to the in() utility
Go
unlicense
elwinar/adeptus
a4dd8cd08d76ad0ec6cd690493e0bb1cc5a8b4fb
document.go
document.go
package deje type Document struct { Channel IRCLocation Events EventSet Syncs SyncSet Timestamps TimestampSet `json:""` } func NewDocument() Document { return Document{ Events: make(EventSet), Syncs: make(SyncSet), } }
package deje // A document is a single managed DEJE object, associated with // a single immutable IRCLocation, and self-describing its // actions and permissions as part of the content. // // The content of a Document is the result of applying the // "official" chain of history, in much the same way that the // Bitcoi...
Split off DocumentFile type for serialization/deserialization
Split off DocumentFile type for serialization/deserialization
Go
lgpl-2.1
DJDNS/go-deje,DJDNS/go-deje,DJDNS/go-deje,DJDNS/go-deje
c4ac2626e0f731de4cd1177ed5407ec0943856e9
decoder/main.go
decoder/main.go
package main import ( "encoding/base64" "fmt" "io/ioutil" "log" "strings" ) func main() { raw, err := ioutil.ReadFile("activity.dat") if err != nil { log.Fatal(err) } encoded := strings.Split(string(raw), "\\n") var decoded []byte for _, line := range encoded { b, err := base64.StdEncoding.DecodeStr...
package main import ( "bytes" "encoding/base64" "encoding/binary" "fmt" "io" "io/ioutil" "log" "strings" "time" ) type trackPoint struct { Longitude float32 Latitude float32 Elevation float32 Time time.Time } func read(r io.Reader) (trackPoint, error) { var point trackPoint var timestamp int64 ...
Add GPS trace decoding code
Add GPS trace decoding code
Go
mit
Metalnem/runtastic
69b70fc86ecf34bdee61e7e0a0f4a4574dde2c3d
defaults.go
defaults.go
package socket import ( "time" "github.com/neliseev/logger" ) // Defaults const maxTCPQueries int = 256 const tcpIdleTimeout time.Duration = 60 * time.Second const rtimeout time.Duration = 2 * time.Second // Socket read timeout const msgSep []byte = []byte(":") const udpMsgSize ...
package socket import ( "time" "github.com/neliseev/logger" ) // Defaults vars var msgSep = byte(":") // Constants const maxTCPQueries int = 256 const tcpIdleTimeout time.Duration = 60 * time.Second const rtimeout time.Duration = 2 * time.Second // Socket read timeout const udpMsgSize int ...
Fix errors with types in conditions
Fix errors with types in conditions
Go
mit
neliseev/socket
0dd2b40f0894f2001ae32c3f5ed1851098343a33
terraform/vsphere/template_generator.go
terraform/vsphere/template_generator.go
package vsphere import "github.com/cloudfoundry/bosh-bootloader/storage" type TemplateGenerator struct{} func NewTemplateGenerator() TemplateGenerator { return TemplateGenerator{} } func (t TemplateGenerator) Generate(state storage.State) string { return "" }
package vsphere import "github.com/cloudfoundry/bosh-bootloader/storage" type TemplateGenerator struct{} func NewTemplateGenerator() TemplateGenerator { return TemplateGenerator{} } func (t TemplateGenerator) Generate(state storage.State) string { return `output "dummy" { value = "dummy" }` }
Add dummy terraform output because terraform output -json exits 1
Add dummy terraform output because terraform output -json exits 1 - When there are no outputs: https://github.com/hashicorp/terraform/pull/11721 [#152866137] Signed-off-by: Genevieve LEsperance <1b6a7b865633211adcfeed81fa254bd2ba36f0db@pivotal.io>
Go
apache-2.0
niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader
0488d71f48c3d68991cd2d55ee9a7171752e9395
models/config.go
models/config.go
package models type Config struct { Id string `rethink:"id,omitempty"` Guild string `rethink:"guild"` Prefix string `rethink:"prefix"` CleanupEnabled bool `rethink:"cleanup_enabled"` AutoRepliesEnabled bool `rethink:"auto_replies_e...
package models type Config struct { Id string `rethink:"id,omitempty"` Guild string `rethink:"guild"` Prefix string `rethink:"prefix"` CleanupEnabled bool `rethink:"cleanup_enabled"` AnnouncementsEnabled bool `rethink:"announcements_...
Remove autoreplies from db template
Remove autoreplies from db template
Go
agpl-3.0
Seklfreak/Robyul2,Seklfreak/Robyul2,Seklfreak/Robyul2,Seklfreak/Robyul2
72195c7881a4fd9486c95fca4bef323c8c8ae51a
ops/interface.go
ops/interface.go
package ops import ( "bsearch/index" ) type HeaderCollector interface { Add(key, value string) } // QueryOp is the interface for search queries implemented by everything // that will return documents. Each QueryOp is assumed to define access // to a sorted set of documents sorted on IbDoc.order. type QueryOp inter...
package ops import ( "bsearch/index" ) type HeaderCollector interface { Add(key, value string) } // QueryOp is the interface for search queries implemented by everything // that will return documents. Each QueryOp is assumed to define access // to a sorted set of documents sorted on IbDoc.order. type QueryOp inter...
Document that CurrentDoc is not callable on invalid ops.
Document that CurrentDoc is not callable on invalid ops.
Go
isc
art4711/bsearch
ca5cf3b8df11c647b0f317c7e363fcdc5ccd06ae
go/src/koding/kites/kloud/koding/helper.go
go/src/koding/kites/kloud/koding/helper.go
package koding import ( "koding/kites/kloud/klient" "time" ) type infoFunc func(format string, formatArgs ...interface{}) // GetInfoLogger returns a customized logger with a another prefix. Usually for // user based logging. func (p *Provider) GetInfoLogger(prefix string) infoFunc { return func(format string, for...
package koding import ( "koding/kites/kloud/klient" "time" ) type infoFunc func(format string, formatArgs ...interface{}) // GetInfoLogger returns a customized logger with a another prefix. Usually for // user based logging. func (p *Provider) GetInfoLogger(prefix string) infoFunc { return func(format string, for...
Remove temporary hack that disables klient connection check when on test mode.
kloud: Remove temporary hack that disables klient connection check when on test mode.
Go
agpl-3.0
usirin/koding,sinan/koding,mertaytore/koding,szkl/koding,kwagdy/koding-1,usirin/koding,jack89129/koding,andrewjcasal/koding,mertaytore/koding,drewsetski/koding,mertaytore/koding,rjeczalik/koding,jack89129/koding,mertaytore/koding,drewsetski/koding,rjeczalik/koding,mertaytore/koding,gokmen/koding,usirin/koding,mertaytor...
f53e12216c70c4fc0a423cd873eb76d50e2a1e2f
main/cmd-help.go
main/cmd-help.go
package main import ( "fmt" "strings" ) // HelpForHelp shows overall usage information for the BigV client, including a list of available commands. func (cmds *CommandSet) HelpForHelp() { // TODO(telyn): write real usage information fmt.Println("bigv command-line client (the new, cool one)") fmt.Println() fmt.P...
package main import ( "fmt" "strings" ) // HelpForHelp shows overall usage information for the BigV client, including a list of available commands. func (cmds *CommandSet) HelpForHelp() { fmt.Println("bigv command-line client (the new, cool one)") fmt.Println() fmt.Println("Usage") fmt.Println() fmt.Println(" ...
Write some real-ish usage information
Write some real-ish usage information
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
e782236bee81800676d2a04fa14ae8b086fe42d8
2016/day8/day8.go
2016/day8/day8.go
package day8 import ( "fmt" "github.com/domdavis/adventofcode/2016/day8/display" ) func Solution() string { return fmt.Sprintf("Part 1: %d, Part 2: %s", part1(data), "Not yet done") } func part1(input string) int { s := display.New(50, 6) s.BulkTransform(input) return s.Count() }
package day8 import ( "fmt" "github.com/domdavis/adventofcode/2016/day8/display" ) func Solution() string { s := display.New(50, 6) s.BulkTransform(data) return fmt.Sprintf("Part 1: %d, Part 2:\n%s", s.Count(), s) }
Add day 8 part 2 solution
Add day 8 part 2 solution
Go
mit
domdavis/adventofcode
128b8b36b9e356ce8bb23bd9680212dfc1449f76
btrees/lca.go
btrees/lca.go
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package btrees // LCA returns the lowest common ancestor in // the binary tree t for the nodes n0, n1. func LCA(t, n0, n1 *BTree) *BTree { var findLCA ...
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package btrees // LCA returns the lowest common ancestor in // the binary tree t for the nodes n0, n1. func LCA(t, n0, n1 *BTree) *BTree { var findLCA ...
Remove unnecessary variable passing to function literal
Remove unnecessary variable passing to function literal
Go
mit
mrekucci/epi,mrekucci/epi
1924b9935c166ccbf046e2d0f6d52cc3870965c8
task/task_test.go
task/task_test.go
package task import ( "reflect" "testing" ) func TestTaskState(t *testing.T) { dummyTask := NewTask("dummy", "foo", "bar") got := dummyTask.State want := TaskStateUnknown if want != got { t.Errorf("Incorrect task state: want %q, got %q", want, got) } } func TestTaskCommand(t *testing.T) { dummyTask := NewT...
package task import ( "reflect" "testing" ) func TestTaskState(t *testing.T) { dummyTask := NewTask("dummy", "foo", "bar") got := dummyTask.State want := TaskStateUnknown if want != got { t.Errorf("Incorrect task state: want %q, got %q", want, got) } } func TestTaskCommand(t *testing.T) { dummyTask := NewT...
Add unit test for task time processed
Add unit test for task time processed
Go
mit
ranjithamca/gru
421a2b9f324795e1b153d394786e126ab7abe43b
autocomplete/cache/cache.go
autocomplete/cache/cache.go
package cache import ( "encoding/json" "github.com/centurylinkcloud/clc-go-cli/state" "time" ) const ( LONG_AUTOCOMPLETE_REFRESH_TIMEOUT = 30 // seconds ) func Put(key string, opts []string) { data, err := json.Marshal(opts) if err == nil { state.WriteToFile(data, key, 0666) } } func Get(key string) ([]str...
package cache import ( "encoding/json" "github.com/centurylinkcloud/clc-go-cli/state" "time" ) var ( LONG_AUTOCOMPLETE_REFRESH_TIMEOUT = 30 // seconds ) func Put(key string, opts []string) { data, err := json.Marshal(opts) if err == nil { state.WriteToFile(data, key, 0666) } } func Get(key string) ([]strin...
Make a variable out of the refresh timeout for testing purposes
Make a variable out of the refresh timeout for testing purposes
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
f9702473c30c878bfa846440246b1dfb13261c7c
app.go
app.go
package main import ( "fmt" "net" "os" "sync" "time" ) var ( host string // The host address to scan ) func init() { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %s host\n", os.Args[0]) os.Exit(1) } host = os.Args[1] } func main() { d := net.Dialer{Timeout: 10 * time.Second} p := make(chan s...
package main import ( "fmt" "net" "os" "sync" "time" ) var ( host string // The host address to scan ) func init() { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %s host\n", os.Args[0]) os.Exit(1) } host = os.Args[1] } func main() { d := net.Dialer{Timeout: 2 * time.Second} p := make(chan st...
Move package spork/life to github.com/redforks/life
Move package spork/life to github.com/redforks/life
Go
mit
redforks/portscan
fbe89f5f9bbe33485a8735d2a171576f251d8d94
pkg/server/signal.go
pkg/server/signal.go
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Remove useless named return value
Remove useless named return value This cleans up the useless named return value stopCh at SetupSignalHandler(). Kubernetes-commit: 2e560e797e22c44ac628581486d847c2d5bdbd59
Go
apache-2.0
kubernetes/apiserver,kubernetes/apiserver
b21105fe597a351ec24cbf435bb6147df3ddca80
database/schema_manager/local/callbacks.go
database/schema_manager/local/callbacks.go
package local import ( db_schema "github.com/creativesoftwarefdn/weaviate/database/schema" ) func (l *LocalSchemaManager) RegisterSchemaUpdateCallback(callback func(updatedSchema db_schema.Schema)) { l.callbacks = append(l.callbacks, callback) } func (l *LocalSchemaManager) triggerCallbacks() { schema := l.GetSch...
package local import ( db_schema "github.com/creativesoftwarefdn/weaviate/database/schema" ) func (l *localSchemaManager) RegisterSchemaUpdateCallback(callback func(updatedSchema db_schema.Schema)) { l.callbacks = append(l.callbacks, callback) } func (l *localSchemaManager) triggerCallbacks() { schema := l.GetSch...
Extend schema to also be able to store state for a connector.
Extend schema to also be able to store state for a connector. - Introduce two interfaces "database/connector_state".StateManager and "database/connector_state".Connector - Make the database initialization connect those two. - Convert local schema storage from struct to interface. Closes gh-552.
Go
bsd-3-clause
weaviate/weaviate,weaviate/weaviate
045c36fb1d794deccda9b755cd87609e55a6cebd
assignments/go/accumulate/accumulate_test.go
assignments/go/accumulate/accumulate_test.go
package accumulate import ( "fmt" "strings" "testing" ) func echo(c string) string { return c } var tests = []struct { expected []string slice []string converter func(string) string }{ {[]string{}, []string{}, echo}, {[]string{"HELLO", "WORLD"}, []string{"hello", "world"}, strings.ToUpper}, } func Tes...
package accumulate import ( "fmt" "strings" "testing" ) func echo(c string) string { return c } var tests = []struct { expected []string given []string converter func(string) string description string }{ {[]string{}, []string{}, echo, "echo"}, {[]string{"HELLO", "WORLD"}, []string{"hello", "worl...
Tweak test output for accumulate in Go
Tweak test output for accumulate in Go
Go
agpl-3.0
RaptorRCX/exercism.io,colinrubbert/exercism.io,nathanbwright/exercism.io,k4rtik/exercism.io,copiousfreetime/exercism.io,mhelmetag/exercism.io,tejasbubane/exercism.io,praveenpuglia/exercism.io,bmulvihill/exercism.io,hanumakanthvvn/exercism.io,k4rtik/exercism.io,IanDCarroll/exercism.io,nathanbwright/exercism.io,IanDCarro...
67d792b9039bf57f47368d3edb9816971eff7ee1
gohr.go
gohr.go
package gohr import ( "fmt" "os" "golang.org/x/crypto/ssh/terminal" ) //get number of columns of terminal from crypto subdirectory ssh/terminal func getCols() int { c, _, err := terminal.GetSize(int(os.Stdout.Fd())) if err != nil { panic(err) } return c } // DrawHr fills a row with '#' by default (if no ar...
package gohr import ( "fmt" "log" "os" "golang.org/x/crypto/ssh/terminal" ) // getWidth gets number of width of terminal from crypto subdirectory ssh/terminal func getWidth() (int, error) { w, _, err := terminal.GetSize(int(os.Stdout.Fd())) if err != nil { return -1, err } return w, nil } // Draw fills a ...
Return appropriate error from getWidth()
Return appropriate error from getWidth()
Go
mit
hasit/gohr
2500594011319f680c08a1f7e15dfcac88a8b523
static/static.go
static/static.go
package static import ( "github.com/gin-gonic/gin" "net/http" "os" "path" "path/filepath" ) func exists(name string) bool { _, err := os.Stat(name) return !os.IsNotExist(err) } // Static returns a middleware handler that serves static files in the given directory. func Serve(directories ...interface{}) gin.Ha...
package static import ( "github.com/gin-gonic/gin" "net/http" "os" "path" "path/filepath" ) func exists(name string) bool { _, err := os.Stat(name) return !os.IsNotExist(err) } // Static returns a middleware handler that serves static files in the given directory. func Serve(directories ...interface{}) gin.Ha...
Delete argument "-1" from Abort()
Delete argument "-1" from Abort()
Go
mit
gin-contrib/cache,gin-contrib/cache
97540772a7d43894f764f06ca768caca364d2467
src/lib/std/y.go
src/lib/std/y.go
package std import "github.com/tisp-lang/tisp/src/lib/core" // Y is Y combinator which takes a function whose first argument is itself // applied to the combinator. var Y = core.NewLazyFunction( core.NewSignature( []string{"function"}, nil, "", nil, nil, "", ), func(ts ...*core.Thunk) core.Value { if len(ts)...
package std import "github.com/tisp-lang/tisp/src/lib/core" // Y is Y combinator which takes a function whose first argument is itself // applied to the combinator. var Y = core.NewLazyFunction( core.NewSignature( []string{"function"}, nil, "", nil, nil, "", ), func(ts ...*core.Thunk) core.Value { xfxx := co...
Delete unuseful check of number of arguments
Delete unuseful check of number of arguments
Go
mit
raviqqe/tisp,raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp
cf61cd3a920809f6a0be44a584f365544acaf1a9
api/client/service/remove.go
api/client/service/remove.go
package service import ( "fmt" "strings" "github.com/docker/docker/api/client" "github.com/docker/docker/cli" "github.com/spf13/cobra" "golang.org/x/net/context" ) func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "rm [OPTIONS] SERVICE", Aliases: []string...
package service import ( "fmt" "strings" "github.com/docker/docker/api/client" "github.com/docker/docker/cli" "github.com/spf13/cobra" "golang.org/x/net/context" ) func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "rm [OPTIONS] SERVICE [SERVICE...]", Alia...
Fix the usage for `service rm` command
Fix the usage for `service rm` command Signed-off-by: Yi EungJun <d8a05a153c80bfd80b76dd9b85a05eebcec2ca4e@navercorp.com>
Go
apache-2.0
konstruktoid/docker-1,tagomoris/docker,dims/docker,13W/docker,konstruktoid/docker-upstream,POLJM242/docker,maxamillion/docker,sarnautov/moby,tonistiigi/docker,duglin/docker,crosbymichael/docker,xiekeyang/docker,mike1729/docker,duglin/docker,akira-baruah/docker,dongjoon-hyun/docker,mahak/docker,KarthikNayak/docker,ndelo...
a457ed3f0d7dd15ad9b1ee360e4c9445cc52f6e2
db/record_core_offer.go
db/record_core_offer.go
package db import sq "github.com/lann/squirrel" // CoreOfferRecordSelect is a sql fragment to help select form queries that // select into a CoreOfferRecord var CoreOfferRecordSelect = sq.Select( "co.accountid", "co.offerid", ).From("offers co") // CoreOfferRecord is row of data from the `offers` table from stella...
package db import sq "github.com/lann/squirrel" // CoreOfferRecordSelect is a sql fragment to help select form queries that // select into a CoreOfferRecord var CoreOfferRecordSelect = sq.Select( "co.accountid", "co.offerid", "co.paysalphanumcurrency", "co.paysissuer", "co.getsalphanumcurrency", "co.getsissuer"...
Add additional columns to CoreOfferRecord
Add additional columns to CoreOfferRecord
Go
apache-2.0
FredericHeem/go-horizon,nullstyle/go-horizon,irisli/horizon,masonforest/go-horizon,masonforest/go-horizon,FredericHeem/go-horizon,stellar/horizon,lackac/horizon,masonforest/horizon,irisli/horizon,irisli/horizon,FredericHeem/go-horizon,masonforest/horizon,masonforest/horizon,lackac/horizon,nullstyle/go-horizon,stellar/h...
81c5d8a9689114d3b25758a45096cef78ea49749
cmd/restic/cmd_autocomplete.go
cmd/restic/cmd_autocomplete.go
package main import ( "github.com/spf13/cobra" ) var autocompleteTarget string var cmdAutocomplete = &cobra.Command{ Use: "autocomplete", Short: "Generate shell autocompletion script", Long: `The "autocomplete" command generates a shell autocompletion script. NOTE: The current version supports Bash only. ...
package main import ( "github.com/spf13/cobra" ) var cmdAutocomplete = &cobra.Command{ Use: "autocomplete", Short: "Generate shell autocompletion script", Long: `The "autocomplete" command generates a shell autocompletion script. NOTE: The current version supports Bash only. This should work for *nix sys...
Correct bash completion file path
Correct bash completion file path
Go
bsd-2-clause
ar-jan/restic,restic/restic,kurin/restic,fawick/restic,fawick/restic,ar-jan/restic,kurin/restic,middelink/restic,middelink/restic,restic/restic
33beb7569c13d185e9603d56b2f3268ff591d0c1
creational/object_pool.go
creational/object_pool.go
package creational
package creational import "sync" // PoolObject represents the object to be stored in the Pool. type PoolObject struct { } // Pool represents the pool of objects to use. type Pool struct { *sync.Mutex inuse []*PoolObject available []*PoolObject } // NewPool creates a new pool. func NewPool() *Pool { return &...
Add initial version of object pool
Add initial version of object pool
Go
mit
bvwells/go-patterns,bvwells/go-patterns
a6a4aadcd0ac587442df2b36bdb72924e2cc6b5f
frame/option_windows.go
frame/option_windows.go
package frame import ( "fmt" "os" "strings" "github.com/zetamatta/go-windows-netresource" "github.com/zetamatta/go-windows-subst" ) func optionNetUse(arg string) { piece := strings.SplitN(arg, "=", 2) if len(piece) >= 2 { _, err := netresource.NetUse(piece[0], piece[1]) if err != nil { fmt.Fprintf(os.S...
package frame import ( "strings" "github.com/zetamatta/go-windows-netresource" "github.com/zetamatta/go-windows-subst" ) func optionNetUse(arg string) { piece := strings.SplitN(arg, "=", 2) if len(piece) >= 2 { netresource.NetUse(piece[0], piece[1]) } } func optionSubst(arg string) { piece := strings.Split...
Revert "If option --netuse fails, print error"
Revert "If option --netuse fails, print error" This reverts commit c9dbb41c3eb7f5041ee423ae2451c6e4c07daa12. because surpress `The local device name is already in use.`
Go
bsd-3-clause
tsuyoshicho/nyagos,zetamatta/nyagos
8ad9c74623a2fb3f91a7a82f92a92aeecb1230ce
ginkgo/notifications.go
ginkgo/notifications.go
package main import ( "fmt" "github.com/onsi/ginkgo/ginkgo/testsuite" "os" "os/exec" ) func verifyNotificationsAreAvailable() { _, err := exec.LookPath("terminal-notifier") if err != nil { fmt.Printf(`--notify requires terminal-notifier, which you don't seem to have installed. To remedy this: brew insta...
package main import ( "fmt" "github.com/onsi/ginkgo/ginkgo/testsuite" "os" "os/exec" ) func verifyNotificationsAreAvailable() { _, err := exec.LookPath("terminal-notifier") if err != nil { fmt.Printf(`--notify requires terminal-notifier, which you don't seem to have installed. To remedy this: brew insta...
Fix typo in 'terminal-notifier' instructions
Fix typo in 'terminal-notifier' instructions
Go
mit
onsi/ginkgo,ixdy/ginkgo,onsi/ginkgo,yaoshipu/ginkgo,alvinvarghese/ginkgo,justintung/ginkgo,fschl/ginkgo
955ae7a459447257e4c88bdd1b7a8252744af020
jobsupervisor/testdata/StartStop/main.go
jobsupervisor/testdata/StartStop/main.go
package main import ( "fmt" "os" "strings" "time" ) func Usage() { fmt.Fprintf(os.Stderr, "Usage: %s [STOP|START] [STOPFILE]\n", os.Args[0]) os.Exit(1) } func main() { if len(os.Args) != 3 { Usage() } mode := strings.ToLower(os.Args[1]) filename := os.Args[2] switch mode { case "start": if _, err := ...
package main import ( "fmt" "os" "strings" "time" ) func Usage() { fmt.Fprintf(os.Stderr, "Usage: %s [STOP|START] [STOPFILE]\n", os.Args[0]) os.Exit(1) } func main() { if len(os.Args) != 3 { Usage() } mode := strings.ToLower(os.Args[1]) filename := os.Args[2] switch mode { case "start": if _, err := ...
Update for to be for range.
Update for to be for range. It pleases the linter. Signed-off-by: Stu Pollock <f92a33a5576f99e8c458f20aa3ed76c650ba4a5c@pivotal.io>
Go
apache-2.0
cloudfoundry/bosh-agent,cloudfoundry/bosh-agent,mattcui/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent,mattcui/bosh-agent,mattcui/bosh-agent,gu-bin/bosh-agent
02c8e40d7595dffbc9e353d3f566e6e1e12ea82b
lxd-agent/main.go
lxd-agent/main.go
package main import ( "crypto/x509" "flag" "log" "path/filepath" "github.com/lxc/lxd/lxd/vsock" "github.com/lxc/lxd/shared" "github.com/pkg/errors" ) var tlsClientCertFile = filepath.Join("/", "media", "lxd_config", "server.crt") var tlsServerCertFile = filepath.Join("/", "media", "lxd_config", "agent.crt") v...
package main import ( "crypto/x509" "flag" "log" "github.com/lxc/lxd/lxd/vsock" "github.com/lxc/lxd/shared" "github.com/pkg/errors" ) func main() { var debug bool var cert *x509.Certificate flag.BoolVar(&debug, "debug", false, "Enable debug mode") flag.Parse() l, err := vsock.Listen(8443) if err != nil...
Load certs from current dir
lxd-agent: Load certs from current dir Signed-off-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>
Go
apache-2.0
mjeanson/lxd,lxc/lxd,mjeanson/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,atxwebs/lxd,hallyn/lxd,lxc/lxd,lxc/lxd,lxc/lxd,stgraber/lxd,atxwebs/lxd,hallyn/lxd,atxwebs/lxd,stgraber/lxd,mjeanson/lxd,hallyn/lxd,hallyn/lxd,Skarlso/lxd,Skarlso/lxd,atxwebs/lxd,stgraber/lxd,Skarlso/lxd,Skarlso/lxd,lxc/lxd,stgraber/lxd,lxc/lxd,stgraber/...
59a72a76a0067729aa62002a15ea88fb789e8efe
internal/sh/builtin/exit.go
internal/sh/builtin/exit.go
package builtin import ( "fmt" "os" "strconv" "github.com/NeowayLabs/nash/errors" "github.com/NeowayLabs/nash/sh" ) type ( exitFn struct { status int } ) func newExit() *exitFn { return &exitFn{} } func (e *exitFn) ArgNames() []string { return []string{"status"} } func (e *exitFn) Run() (sh.Obj, error)...
package builtin import ( "fmt" "os" "strconv" "github.com/NeowayLabs/nash/errors" "github.com/NeowayLabs/nash/sh" ) type ( exitFn struct { status int } ) func newExit() *exitFn { return &exitFn{} } func (e *exitFn) ArgNames() []string { return []string{"status"} } func (e *exitFn) Run() (sh.Obj, error)...
Remove unnecessary linux on error message
Remove unnecessary linux on error message
Go
apache-2.0
NeowayLabs/nash,NeowayLabs/nash