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
a5a2e7a8d09bdc1ce3eff0634cbac6b6c2ddcb8e
core/dbServices/indexHelper.go
core/dbServices/indexHelper.go
package dbServices import ( "github.com/DanielRenne/GoCore/core/extensions" "reflect" ) //GetIndexes provides a way to reflect on your structure to get structs tagged with `dbIndex`. //This function is used to generate Indexes for MongoDB and other databases. func GetDBIndexes(x interface{}) map[string]string { ke...
package dbServices import ( "github.com/DanielRenne/GoCore/core/extensions" "reflect" ) //GetIndexes provides a way to reflect on your structure to get structs tagged with `dbIndex`. //This function is used to generate Indexes for MongoDB and other databases. func GetDBIndexes(x interface{}) map[string]string { ke...
Fix for building indexes for MongoDB
Fix for building indexes for MongoDB
Go
mit
DanielRenne/GoCore,DanielRenne/GoCore
5eb90cd6f2d564fae0ba13901e3c0fe1d0ffccf2
browser_engine/dom.go
browser_engine/dom.go
package dom // Node - Node interface type Node interface{} // TextNode - a basic dom node type TextNode struct { children string } // ElementNode - an html element consists of tagName and attributes type ElementNode struct { children []Node tagName string attributes AttrMap } // AttrMap - an attribute map ...
package dom // ElementNodeType - constant for element node const ElementNodeType = "DOM/ELEMENT_NODE" // TextNodeType - constant for element node const TextNodeType = "DOM/TEXT_NODE" // Node - Node interface type Node interface { getChildren() []*Node getNodeType() string } // TextNode - a dom text node type Text...
Refactor data structure using interface
[broswer_engine] Refactor data structure using interface
Go
mit
Rhadow/go_toy
8884885a3d96d79a9f0cfae1d807233f53f32f67
utils/nsinit.go
utils/nsinit.go
package utils import ( "io/ioutil" "os" "syscall" ) var BASH_SCRIPT = ` DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" COMMAND="$@" trap "rm -f ${DIR}/$$.stderr" EXIT for i in {1..10}; do SEEN=0 ${COMMAND} 2> >(tee ${DIR}/$$.stderr >&2) RESULT=$? [ "${RESULT}" == 0 ] && exit 0 grep setns ${DIR}/$$.stde...
package utils import ( "io/ioutil" "os" "syscall" "github.com/zenoss/glog" ) var BASH_SCRIPT = ` DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" COMMAND="$@" #trap "rm -f ${DIR}/$$.stderr" EXIT for i in {1..10}; do SEEN=0 ${COMMAND} 2> >(tee ${DIR}/$$.stderr >&2) RESULT=$? [ "${RESULT}" == 0 ] && exit ...
Add some logging, leave files around for debugging
Add some logging, leave files around for debugging
Go
apache-2.0
control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced
329221c95484d5d9e1e382a8537bfd1d959f0803
text_serializer.go
text_serializer.go
package logged import ( "bufio" "io" "sync" ) func NewTextSerializer(w io.Writer) Serializer { return &textSerializer{ w: bufio.NewWriter(w), } } type textSerializer struct { w *bufio.Writer mu sync.Mutex } func (s *textSerializer) Write(e *Entry) error { s.mu.Lock() s.w.WriteString(e.Timestamp) s.w....
package logged import ( "bufio" "io" "sync" ) func NewTextSerializer(w io.Writer) Serializer { return &textSerializer{ w: bufio.NewWriter(w), } } type textSerializer struct { w *bufio.Writer mu sync.Mutex } func (s *textSerializer) Write(e *Entry) error { s.mu.Lock() s.w.WriteRune('[') s.w.WriteString...
Put level first for text
Put level first for text
Go
mit
andrewhare/logged
5e40b28fedbeabbdf4b1bad804f6c72bb1f33ffa
src/words/generator.go
src/words/generator.go
package words import ( "math/rand" "strings" "time" ) type WordGenerator interface { Babble() string } type wordGenerator struct { source rand.Source adjectives []string nouns []string } func (wg wordGenerator) Babble() (word string) { idx := int(wg.source.Int63()) % len(wg.adjectives) word = wg.a...
package words import ( "math/rand" "strings" "time" ) type WordGenerator interface { Babble() string } type wordGenerator struct { numberGenerator *rand.Rand adjectives []string nouns []string } func (wg wordGenerator) Babble() (word string) { idx := int(wg.numberGenerator.Int()) % len(wg.adjective...
Use random int, not int64 to select random words
Use random int, not int64 to select random words [#66747516]
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
12a6d86a2f7fc26d100cbb6118e91c7f2eab6b67
token.go
token.go
package main import ( "errors" "flag" "io/ioutil" "os" "strings" ) // a function that provides a means to retrieve a token type TokenGetter func() (string, error) // goes through the provided TokenGetter chain and stops once one reports // a non-"" value. If any produce errors it'll wrap those up and return 'em...
package main import ( "errors" "flag" "io/ioutil" "os" "strings" ) // Token Getter is a function that can retrieve a token type tokenGetter func() (string, error) // goes through the provided TokenGetter chain and stops once one reports // a non-"" value. If any produce errors it'll wrap those up and return 'em...
Fix bug in flag parsing
Fix bug in flag parsing
Go
isc
ciarand/sinkship
31e378cda07d03d37511665a9e8cc3cf4d17c62e
utils.go
utils.go
package vlc // #cgo LDFLAGS: -lvlc // #include <vlc/vlc.h> // #include <stdlib.h> import "C" import "errors" func getError() error { msg := C.libvlc_errmsg() if msg != nil { return errors.New(C.GoString(msg)) } return nil } func boolToInt(value bool) int { if value { return 1 } return 0 }
package vlc // #cgo LDFLAGS: -lvlc // #include <vlc/vlc.h> // #include <stdlib.h> import "C" import "errors" func getError() error { msg := C.libvlc_errmsg() if msg == nil { return nil } err := errors.New(C.GoString(msg)) C.libvlc_clearerr() return err } func boolToInt(value bool) int { if value { return...
Clear error thread after reading error
Clear error thread after reading error
Go
mit
adrg/libvlc-go
d7c0ed9885faf74b55c08fd68dc466434818ebcd
route_trace_test.go
route_trace_test.go
package gobrake import ( "time" "github.com/jonboulle/clockwork" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var fakeClock = clockwork.NewFakeClock() func init() { clock = fakeClock } var _ = Describe("RouteTrace", func() { It("supports nested spans", func() { trace := &RouteTrace{ Start: cl...
package gobrake import ( "time" "github.com/jonboulle/clockwork" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var fakeClock = clockwork.NewFakeClock() func init() { clock = fakeClock } var _ = Describe("RouteTrace", func() { It("supports nested spans", func() { trace := &RouteTrace{ Start: cl...
Add test for other group
Add test for other group
Go
mit
airbrake/gobrake
6a209ba3a8c283fb2ffe78182675ad00be22c878
rpc/core/mempool.go
rpc/core/mempool.go
package core import ( "fmt" ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/tendermint/tendermint/types" tmsp "github.com/tendermint/tmsp/types" ) //----------------------------------------------------------------------------- // NOTE: tx must be signed func BroadcastTxAsync(tx types.Tx) (*c...
package core import ( "fmt" ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/tendermint/tendermint/types" tmsp "github.com/tendermint/tmsp/types" ) //----------------------------------------------------------------------------- // NOTE: tx must be signed func BroadcastTxAsync(tx types.Tx) (*c...
Fix a block condition where cb is called immediately
Fix a block condition where cb is called immediately
Go
apache-2.0
tendermint/tendermint,tendermint/tendermint,tendermint/tendermint,tendermint/tendermint
4f658348d5d5c920968b77c24b7d402f52b7f87c
sms.go
sms.go
package gotwilio type SmsResponse struct { Sid string DateCreated string // TODO: Change this to date type if possible DateUpdate string // TODO: Change this to date type if possible DateSent string // TODO: Change this to date type if possible AccountSid string To string From strin...
package gotwilio type SmsResponse struct { Sid string DateCreated string // TODO: Change this to date type if possible DateUpdate string // TODO: Change this to date type if possible DateSent string // TODO: Change this to date type if possible AccountSid string To string From strin...
Change method name to better reflect file organization.
Change method name to better reflect file organization.
Go
bsd-2-clause
metcalf/gotwilio,sfreiberg/gotwilio
28aa55fd38a22e22480db8b9e1bd539462f128b1
schema/switch_schema.go
schema/switch_schema.go
package schema // TODO: copy disco schema here. // Meta contains the archive and parse metadata. type Meta struct { FileName string `json:"task_filename,string" bigquery:"task_filename"` TestName string `json:"test_id,string" bigquery:"test_id"` ParseTime int64 `json:"parse_time,int64" bigquery:"parse_time"` } ...
package schema // Sample is an individual measurement taken by DISCO. type Sample struct { Timestamp int64 `json:"timestamp,int64" bigquery:"timestamp"` Value float32 `json:"value,float32" bigquery:"value"` } // SwitchStats represents a row of data taken from the raw DISCO export file. type SwitchStats struct...
Update switch schema to eliminate Meta and add standard top-level fields
Update switch schema to eliminate Meta and add standard top-level fields
Go
apache-2.0
m-lab/etl,m-lab/etl,m-lab/etl
dfd3eb053dc713e73698d633e36e34d1ae6247a2
api/system.go
api/system.go
package api // Status is used to query the status-related endpoints. type System struct { client *Client } // System returns a handle on the system endpoints. func (c *Client) System() *System { return &System{client: c} } func (s *System) GarbageCollect() error { var req struct{} _, err := s.client.write("/v1/s...
package api // Status is used to query the status-related endpoints. type System struct { client *Client } // System returns a handle on the system endpoints. func (c *Client) System() *System { return &System{client: c} } func (s *System) GarbageCollect() error { var req struct{} _, err := s.client.write("/v1/s...
Add missing ReconcileSummaries API method
Add missing ReconcileSummaries API method References https://www.nomadproject.io/api/system.html#reconcile-summaries
Go
mpl-2.0
nak3/nomad,dvusboy/nomad,frundh/nomad,frundh/nomad,dvusboy/nomad,nak3/nomad,nak3/nomad,burdandrei/nomad,dvusboy/nomad,Ashald/nomad,hashicorp/nomad,nak3/nomad,hashicorp/nomad,Ashald/nomad,dvusboy/nomad,dvusboy/nomad,dvusboy/nomad,frundh/nomad,hashicorp/nomad,frundh/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/noma...
2c82db3a6fb84129c47b4a4cfbfbea449fd9c1fb
bootstrap/gen_random_action.go
bootstrap/gen_random_action.go
package bootstrap import "github.com/flynn/flynn/pkg/random" type GenRandomAction struct { ID string `json:"id"` Length int `json:"length"` Data string `json:"data"` ControllerKey bool `json:"controller_key"` } func init() { Register("gen-random", &GenRandomAction{}) } type RandomData struct { Data ...
package bootstrap import ( "encoding/base64" "fmt" "github.com/flynn/flynn/pkg/random" ) type GenRandomAction struct { ID string `json:"id"` Length int `json:"length"` Data string `json:"data"` Encoding string `json:"encoding"` ControllerKey bool `json:"controller_key"` } func init() { Regi...
Add support for multiple random key encodings
bootstrap: Add support for multiple random key encodings Added support for base64 and base64safe (as well as the existing hex). Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>
Go
bsd-3-clause
Brandywine2161/flynn,whouses/flynn,felixrieseberg/flynn,GrimDerp/flynn,rikur/flynn,justintung/flynn,kgrz/flynn,Brandywine2161/flynn,Brandywine2161/flynn,felixrieseberg/flynn,felixrieseberg/flynn,ozum/flynn,jzila/flynn,TribeMedia/flynn,GrimDerp/flynn,flynn/flynn,felixrieseberg/flynn,technosophos/flynn,josephglanville/fl...
422d0a134cbd5e6ae2e2c62a9789a4820b3b894c
coreutil/response.go
coreutil/response.go
package coreutil import ( "net/http" "reflect" ) // ResponseStatus returns the HTTP response status. // Remember that the status is only set by the server after "ResponseWriter.WriteHeader()"" has been called. func ResponseStatus(w http.ResponseWriter) int { return int(httpResponseStruct(reflect.ValueOf(w)).FieldB...
package coreutil import ( "io" "net/http" "reflect" "github.com/volatile/core" ) type responseWriterBinder struct { io.Writer http.ResponseWriter before []func([]byte) } func (w responseWriterBinder) Write(p []byte) (int, error) { for _, f := range w.before { f(p) } return w.Writer.Write(p) } // BindRe...
Write back ResponseWriterBinder into BindResponseWriter func
Write back ResponseWriterBinder into BindResponseWriter func
Go
mit
volatile/core
b226e70fe599e7548a1cc934fed12523011b01bd
websocket_reactions.go
websocket_reactions.go
package slack // reactionItem is a lighter-weight item than is returned by the reactions list. type reactionItem struct { Type string `json:"type"` Channel string `json:"channel,omitempty"` File string `json:"file,omitempty"` FileComment string `json:"file_comment,omitempty"` Timestamp string ...
package slack // reactionItem is a lighter-weight item than is returned by the reactions list. type reactionItem struct { Type string `json:"type"` Channel string `json:"channel,omitempty"` File string `json:"file,omitempty"` FileComment string `json:"file_comment,omitempty"` Timestamp string ...
Add ItemUser to reactions event
Add ItemUser to reactions event
Go
bsd-2-clause
nlopes/slack,james-lawrence/slack,178inaba/slack
cad18db860c9488a41f0807b580876df428b4ad5
configuration/configuration.go
configuration/configuration.go
package configuration import ( "encoding/json" "io/ioutil" ) type Configuration struct { TestObjects []TestObject `json:"testObjects"` } type TestObject struct { URL string `json:"url"` MatchString string `json:"matchString"` Status int `json:"status"` } func NewConfiguration(filePath string) ...
package configuration import ( "encoding/json" "io/ioutil" ) type Configuration struct { TestObjects []TestObject `json:"testObjects"` MailSetting Mail `json:"mailSetting"` } type TestObject struct { URL string `json:"url"` MatchString string `json:"matchString"` Status int `json:"stat...
Allow setting mail settings in config file
Allow setting mail settings in config file
Go
mit
jvikstedt/alarm-bot
a3d9a99c0e92797b30909fe2bb4d8922bba65abe
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> (cherry picked from commit cf61cd3a920809f6a0be44a584f365544acaf1a9) Signed-off-by: Tibor Vass <3f1326dff4d85ad4ec938fb33f64575ace96db26@docker.com>
Go
apache-2.0
gdevillele/docker.github.io,gdevillele/docker.github.io,denverdino/denverdino.github.io,docker/docker.github.io,denverdino/denverdino.github.io,joeuo/docker.github.io,denverdino/docker.github.io,stainboy/docker,troy0820/docker.github.io,medallia/docker,docker/docker.github.io,troy0820/docker.github.io,aduermael/docker....
701f7b7b6277eb9fe98e16a3a01478fd0e8f917e
plugins/expr.go
plugins/expr.go
package plugins //go:generate go tool yacc -o expr_y.go expr.y import ( "github.com/belak/irc" "github.com/belak/seabird/bot" "github.com/belak/seabird/mux" ) func init() { bot.RegisterPlugin("math", NewMathPlugin) } func NewMathPlugin(m *mux.CommandMux) error { m.Event("math", mathExpr) return nil } func ma...
package plugins //go:generate go tool yacc -o expr_y.go expr.y import ( "github.com/belak/irc" "github.com/belak/seabird/bot" "github.com/belak/seabird/mux" ) func init() { bot.RegisterPlugin("math", NewMathPlugin) } func NewMathPlugin(m *mux.CommandMux) error { m.Event("math", mathExpr) return nil } func ma...
Fix display of floats for !math
Fix display of floats for !math
Go
unknown
belak/seabird,belak/go-seabird
b5cf04e6709bca6c29d1b42d4ae9a0fa6d02c222
cache_test.go
cache_test.go
package negronicache
package negronicache func TestCache_NewMemoryCache(t testing.T) { c := NewMemoryCache() assert.NotNil(t, c.fs) assert.NotNil(t, c.stale) } func TestCache_NewDiskCache(t testing.T) { c, err := NewDiskCache("./cache") assert.Nil(t, err) assert.NotNil(t, c.fs) assert.NotNil(t, c.stale) }
Add test functions for allocate a cache instance.
Add test functions for allocate a cache instance.
Go
apache-2.0
trumanw/negroni-cache,trumanw/negroni-cache
b98147f60ac2de7dc2ee77b21d252eafae1af9dc
command/clean/command.go
command/clean/command.go
package clean import ( "flag" "os" "github.com/tueftler/doget/command" "github.com/tueftler/doget/config" "github.com/tueftler/doget/dockerfile" ) // CleanCommand allows to remove the vendor directory and all of its contents type CleanCommand struct { command.Command flags *flag.FlagSet } // NewCommand creat...
package clean import ( "flag" "os" "github.com/tueftler/doget/command" "github.com/tueftler/doget/config" "github.com/tueftler/doget/dockerfile" ) // CleanCommand allows to remove the vendor directory and all of its contents type CleanCommand struct { command.Command flags *flag.FlagSet } // NewCommand creat...
Clean should remove vendor dir, not cache
Clean should remove vendor dir, not cache
Go
bsd-3-clause
tueftler/doget,tueftler/doget
4a0da1a38f4a6e698de2e443003cc04da69839c6
button.go
button.go
package medtronic const ( button Command = 0x5B ) // PumpButton represents a key on the pump keypad. type PumpButton byte //go:generate stringer -type PumpButton // Pump button codes. const ( BolusButton PumpButton = 0 EscButton PumpButton = 1 ActButton PumpButton = 2 UpButton PumpButton = 3 DownButton...
package medtronic const ( button Command = 0x5B ) // PumpButton represents a key on the pump keypad. type PumpButton byte //go:generate stringer -type PumpButton // Pump button codes. const ( BolusButton PumpButton = 0 EscButton PumpButton = 1 ActButton PumpButton = 2 UpButton PumpButton = 3 DownButton...
Make sure Button command is not repeated
Make sure Button command is not repeated
Go
mit
ecc1/medtronic,ecc1/medtronic
2b3880458f679539bca35bc1f3d98b82258606df
src/main.go
src/main.go
package main import "fmt" import "os" import "os/exec" import "strconv" func main() { fmt.Println("Ding!") cmd := exec.Command("paplay", "/usr/share/sounds/freedesktop/stereo/complete.oga") cmd.Start() interval, _ := strconv.Atoi(os.Args[1]) fmt.Println(interval) }
package main import "fmt" import "os" import "os/exec" import "strconv" import "time" func main() { cmd := exec.Command("paplay", "/usr/share/sounds/freedesktop/stereo/complete.oga") cmd.Start() interval, _ := strconv.Atoi(os.Args[1]) counter := 0 for true { fmt.Println("Ding!", counter...
Make it go ding in an infinite loop
Make it go ding in an infinite loop
Go
mit
Cosiek/ding
8a139b3b78298bca28de8e558297800413eaf186
mount_gcsfuse/main.go
mount_gcsfuse/main.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...
Make it easy to see what mount is giving us.
Make it easy to see what mount is giving us.
Go
apache-2.0
GoogleCloudPlatform/gcsfuse,jacobsa/ratelimit,BanzaiMan/gcsfuse,jacobsa/timeutil,GoogleCloudPlatform/gcsfuse,GoogleCloudPlatform/gcsfuse,kahing/gcsfuse,BanzaiMan/gcsfuse,mbrukman/gcsfuse
0ef7b331fbab892b121fa51f7ddd82dbcd040e3f
server/interpreter/interpreter_test.go
server/interpreter/interpreter_test.go
package interpreter import ( "fmt" "testing" ) const onePlusOne = `{"type":"Program","start":0,"end":5,"body":[{"type":"ExpressionStatement","start":0,"end":5,"expression":{"type":"BinaryExpression","start":0,"end":5,"left":{"type":"Literal","start":0,"end":1,"value":1,"raw":"1"},"operator":"+","right":{"type":"Lit...
package interpreter import ( // "fmt" "CodeCity/server/interpreter/object" "testing" ) const onePlusOne = `{"type":"Program","start":0,"end":5,"body":[{"type":"ExpressionStatement","start":0,"end":5,"expression":{"type":"BinaryExpression","start":0,"end":5,"left":{"type":"Literal","start":0,"end":1,"value":1,"raw"...
Make "1+1" test actually check result
Make "1+1" test actually check result
Go
apache-2.0
NeilFraser/CodeCity,google/CodeCity,google/CodeCity,NeilFraser/CodeCity,NeilFraser/CodeCity,google/CodeCity,NeilFraser/CodeCity,google/CodeCity
927939dfc6d6612f488da7a189b4f2299e99eea7
octokit/git_trees.go
octokit/git_trees.go
package octokit import ( "net/url" ) var GitTreesURL = Hyperlink("repos/{owner}/{repo}/git/trees/{/sha}{?recursive}") func (c *Client) GitTrees(url *url.URL) (trees *GitTreesService) { trees = &GitTreesService{client: c, URL: url} return } type GitTreesService struct { client *Client URL *url.URL } // Get ...
package octokit import ( "net/url" ) var GitTreesURL = Hyperlink("repos/{owner}/{repo}/git/trees/{sha}{?recursive}") func (c *Client) GitTrees(url *url.URL) (trees *GitTreesService) { trees = &GitTreesService{client: c, URL: url} return } type GitTreesService struct { client *Client URL *url.URL } // Get a...
Fix double slash in link relation
Fix double slash in link relation
Go
mit
calavera/go-octokit,pcasaretto/go-octokit,calavera/go-octokit,pcasaretto/go-octokit,octokit/go-octokit,half-ogre/go-octokit,half-ogre/go-octokit,octokit/go-octokit
53f6a1995204a3ed0ebcf4fc428e1061cf05056d
main_test.go
main_test.go
package bongo import ( . "github.com/smartystreets/goconvey/convey" "testing" ) // For test usage func getConnection() *Connection { conf := &Config{ ConnectionString: "localhost", Database: "bongotest", } conn, err := Connect(conf) if err != nil { panic(err) } return conn } func TestConnect...
package bongo import ( "testing" . "github.com/smartystreets/goconvey/convey" ) // For test usage func getConnection() *Connection { conf := &Config{ ConnectionString: "localhost", Database: "bongotest", } conn, err := Connect(conf) if err != nil { panic(err) } return conn } func TestFailSS...
Add test that throws out connection string error
Add test that throws out connection string error
Go
mit
go-bongo/bongo,ilijamt/bongo,maxwellhealth/bongo
1ac1147ccd6b09879f25b880ae6572f19015c3da
main_test.go
main_test.go
package main import ( "fmt" "io/ioutil" "testing" rss "github.com/jteeuwen/go-pkg-rss" "github.com/stretchr/testify/require" ) var items []*rss.Item var fixtures = []string{ "aws-ec2-us-east-1", "crossfitwc", "github-status", "heroku-status", "weather.gov-KPHL", } func Test_formatContent(t *testing.T) { ...
package main import ( "fmt" "io/ioutil" "testing" rss "github.com/jteeuwen/go-pkg-rss" "github.com/stretchr/testify/require" ) var items []*rss.Item var fixtures = []string{ "aws-ec2-us-east-1", "crossfitwc", "github-status", "heroku-status", "weather.gov-KPHL", } func Test_formatContent(t *testing.T) { ...
Check err from feed.FetchBytes in test
Check err from feed.FetchBytes in test
Go
mit
justincampbell/lastpost
d4d62d20819a4d9b6356de7ad57ba9b8093cbdcb
generator/convert.go
generator/convert.go
package main import ( "bufio" "fmt" "os" "strings" "github.com/linkosmos/gotldmap" ) func lastMark() (last int) { for _, mark := range gotldmap.Map { if mark > last { last = mark } } return last } func main() { file, err := os.Open("input.txt") if err != nil { panic(err) } defer file.Close() c...
package main import ( "bufio" "fmt" "os" "strings" "github.com/linkosmos/gotldmap" ) func lastMark() (last int) { for _, mark := range gotldmap.Map { if mark > last { last = mark } } return last } func main() { file, err := os.Open("input.txt") if err != nil { panic(err) } defer file.Close() c...
Exclude -- domains from generator
Exclude -- domains from generator
Go
bsd-3-clause
linkosmos/gotldmap,linkosmos/gotldmap
9e7d5f315253b777df669e3a27048b303027bcaa
import_aws_opsworks_stack_test.go
import_aws_opsworks_stack_test.go
package aws import ( "os" "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSOpsWorksStack_importBasic(t *testing.T) { oldvar := os.Getenv("AWS_DEFAULT_REGION") os.Setenv("AWS_DEFAULT_REGION", "us-west-2") defer os.Setenv("AWS_DEFAULT_RE...
package aws import ( "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSOpsworksStackImportBasic(t *testing.T) { name := acctest.RandString(10) resourceName := "aws_opsworks_stack.tf-acc" resource.Test(t, resource.TestCase{ PreCheck: ...
Rename the Import aws_opsworks_stack import test
provider/aws: Rename the Import aws_opsworks_stack import test The casing on the test name was causing it not to run with the entire test suite ``` % make testacc TEST=./builtin/providers/aws % TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go gene...
Go
mpl-2.0
terraform-providers/terraform-provider-aws,kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,ashinohara/terraform-provider-aws,nbaztec/terraform-provider-aws,charles-at-geospock/terraform-provider-aws,terraform-providers/terraform-provider-aws,nbaztec/terraform-provider-aws,charles-at-geospock/terraform-provi...
c9997b4721e100cb7bb28962e624ed5f18dccd76
internal/sctp/chunk_cookie_ack.go
internal/sctp/chunk_cookie_ack.go
package sctp import ( "github.com/pkg/errors" ) /* chunkCookieAck represents an SCTP Chunk of type chunkCookieAck 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type...
package sctp import ( "github.com/pkg/errors" ) /* chunkCookieAck represents an SCTP Chunk of type chunkCookieAck 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type...
Fix method shadowing for marshal in Cookie ack
Fix method shadowing for marshal in Cookie ack Sneaky beaky golan not complaining about the missing marshal because it was fulfilled by a composed struct
Go
mit
pion/webrtc,pion/webrtc,pion/webrtc,pion/webrtc
a509444d94771ec26e898e266368d050705c23e7
web_test.go
web_test.go
package main import ( "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "net/http/httptest" "strings" "testing" ) func testServer() *httptest.Server { db := MockDatabase() s := NewServer(db) r := s.BuildRouter() return httptest.NewServer(r) } func TestServeIndexHtml(t *testing.T) { assert := ass...
package main import ( "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "net/http/httptest" "strings" "testing" ) func testServer() *httptest.Server { db := MockDatabase() s := NewServer(db) r := s.BuildRouter() return httptest.NewServer(r) } func TestServeIndexHtml(t *testing.T) { assert := ass...
Make check of HTML rendering use Contains() rather than HasPrefix()
Make check of HTML rendering use Contains() rather than HasPrefix() Since we now use templates, there might be spaces noising up the start of the line.
Go
mit
thiderman/drunkenfall,thiderman/drunkenfall,thiderman/drunkenfall
0a5463a7c54d2cd359430433cb7bb56effa3680d
pkg/store/ram_directory.go
pkg/store/ram_directory.go
package store import ( "bytes" "fmt" ) // ramDirectory is a implementation that stores index // files in RAM type ramDirectory struct { files map[string]*bytes.Buffer } // NewRAMDirectory returns a new instance of RAM Directory func NewRAMDirectory() Directory { return &ramDirectory{ files: make(map[string]*by...
package store import ( "bytes" "fmt" ) // ramDirectory is a implementation that stores index // files in RAM type ramDirectory struct { files map[string]*bytes.Buffer } // NewRAMDirectory returns a new instance of RAM Directory func NewRAMDirectory() Directory { return &ramDirectory{ files: make(map[string]*by...
Fix error: Errorf format %w has arg name of wrong type string
Fix error: Errorf format %w has arg name of wrong type string
Go
mit
alldroll/suggest
d758ff96e486afc2359f5b958cc213d76c56f89c
pkg/a8rcloud/apikeys.go
pkg/a8rcloud/apikeys.go
package a8rcloud import ( "github.com/telepresenceio/telepresence/rpc/v2/manager" ) // API key descriptions to use when requesting API keys from Ambassador Cloud. const ( KeyDescWorkstation = "laptop" KeyDescTrafficManager = "manager" ) func KeyDescAgent(spec *manager.InterceptSpec) string { return "agent-" +...
package a8rcloud import ( "github.com/telepresenceio/telepresence/rpc/v2/manager" ) // API key descriptions to use when requesting API keys from Ambassador Cloud. const ( KeyDescWorkstation = "telepresence:workstation" KeyDescTrafficManager = "telepresence:traffic-manager" ) func KeyDescAgent(spec *manager.Int...
Use slightly more explicit API key descriptions
pkg/a8rcloud: Use slightly more explicit API key descriptions Signed-off-by: Luke Shumaker <1abe3165bcc8c29e8b31e5c88636540fb9350004@datawire.io>
Go
apache-2.0
datawire/telepresence,datawire/telepresence,datawire/telepresence
6d58e94977400501c09fc1c7ceaa29bc524583ef
checkers/move.go
checkers/move.go
package checkers // Move describes move for checker type Move struct { Target Point CapturedChecker *Checker BecomeQueen bool } // IsCapture reports whether the move caused capture. func (m Move) IsCapture() bool { return m.CapturedChecker != nil }
package checkers // Move describes move for checker type Move struct { Target Point CapturedChecker *Checker BecomeQueen bool } // IsCapture reports whether the move caused capture. func (m Move) IsCapture() bool { return m.CapturedChecker != nil } // CapturedPos returns position of captured checker...
Add captured checker position accessor for Move
Add captured checker position accessor for Move
Go
apache-2.0
cl0ne/go-checkers
ea246948308d86f7578445f8902db301a4c2b6ad
cmd/rkvd/ltfhook.go
cmd/rkvd/ltfhook.go
package main import ( "os" "github.com/Sirupsen/logrus" ) var defaultFormater = &logrus.TextFormatter{DisableColors: true} // LogToFileHook saves log entries to a file after applying the Formatter. type LogToFileHook struct { Formatter logrus.Formatter LogFile *os.File } // NewLogToFileHook creates a new hoo...
package main import ( "os" "time" "github.com/Sirupsen/logrus" ) var defaultFormater = &logrus.TextFormatter{ DisableColors: true, TimestampFormat: time.RFC3339Nano, } // LogToFileHook saves log entries to a file after applying the Formatter. type LogToFileHook struct { Formatter logrus.Formatter LogFile ...
Set logger time format to RFC3339Nano
rkvd: Set logger time format to RFC3339Nano
Go
mit
s111/rkv,s111/rkv
52a44356b05d459b48a749522560f1d37ea74206
packet.go
packet.go
package medtronic import ( "fmt" ) func (pump *Pump) DecodePacket(packet []byte) []byte { data, err := Decode6b4b(packet) if err != nil { pump.err = err pump.DecodingErrors++ return data } crc := Crc8(data[:len(data)-1]) if data[len(data)-1] != crc { pump.err = fmt.Errorf("CRC should be %X, not %X", crc...
package medtronic import ( "fmt" ) func (pump *Pump) DecodePacket(packet []byte) []byte { data, err := Decode6b4b(packet) if err != nil { pump.err = err pump.DecodingErrors++ return data } last := len(data) - 1 pktCrc := data[last] data = data[:last] // without CRC calcCrc := Crc8(data) if pktCrc != ca...
Remove CRC from data returned by DecodePacket
Remove CRC from data returned by DecodePacket
Go
mit
ecc1/medtronic,ecc1/medtronic
ae3b73467cdd648021244446c76662f06981fea8
server/logger/logger.go
server/logger/logger.go
package logger import ( "io" "os" "github.com/uber-go/zap" ) var ( AccessLogger = zap.New(zap.NewJSONEncoder(zap.RFC3339Formatter("ts")), zap.Output(os.Stdout)) AppLogger = zap.New(zap.NewJSONEncoder(zap.RFC3339Formatter("ts")), zap.Output(os.Stderr)) ) func InitializeAccessLogger(writer io.Writer) { Acces...
package logger import ( "io" "os" "github.com/oinume/lekcije/server/config" "github.com/uber-go/zap" ) var ( AccessLogger = zap.New(zap.NewJSONEncoder(zap.RFC3339Formatter("ts")), zap.Output(os.Stdout)) AppLogger = zap.New(zap.NewJSONEncoder(zap.RFC3339Formatter("ts")), zap.Output(os.Stderr)) ) func init()...
Enable debug log on non production env
Enable debug log on non production env
Go
mit
oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/dmm-eikaiwa-fft,oinume/lekcije,oinume/lekcije,oinume/lekcije,oinume/dmm-eikaiwa-fft
d857b040e0385c7afde0dab6511be01b2fcfdd0d
app/profile/common.go
app/profile/common.go
package profile import ( "time" ) const ( HeaderName = "X-Gondola-Profile" Salt = "gnd.la/app/profile.salt" ) type Event struct { Started time.Time Ended time.Time Notes []string } func (e *Event) Elapsed() time.Duration { return e.Ended.Sub(e.Started) } type Timing struct { Name string Events...
package profile import ( "time" ) const ( HeaderName = "X-Gondola-Profile" Salt = "gnd.la/app/profile.salt" ) type Event struct { Started time.Time `json:"s"` Ended time.Time `json:"e"` Notes []string `json:"n"` } func (e *Event) Elapsed() time.Duration { return e.Ended.Sub(e.Started) } type Timi...
Add JSON tags for fields
Add JSON tags for fields Creates a more compact output
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
2e4ab8f277393b8d445a3d2dbeca2be3acb75a48
exit.go
exit.go
package cog import "sync" // Exit is useful for terminating a group of goroutines that run in a // for{select{}}. Be sure to `Exit.Add(n)` before starting goroutines, and // `defer Exit.Done()` in the goroutine. type Exit struct { sync.WaitGroup C <-chan struct{} c chan struct{} once sync.Once } // Exiter ...
package cog import "sync" // Exit is useful for terminating a group of goroutines that run in a // for{select{}}. Be sure to `Exit.Add(n)` before starting goroutines, and // `defer Exit.Done()` in the goroutine. type Exit struct { *GExit c chan struct{} once sync.Once } // GExit (short for "goroutine exit") is...
Add GExit: the obj to pass around that can only be waited on, not .Exit()ed
Add GExit: the obj to pass around that can only be waited on, not .Exit()ed
Go
mit
thatguystone/cog,thatguystone/assert,thatguystone/assert,thatguystone/assert
c878e1edcb5c5217bb9d4abaf6abf393233335d5
fly/ui/colors.go
fly/ui/colors.go
package ui import "github.com/fatih/color" var PendingColor = color.New(color.FgWhite) var StartedColor = color.New(color.FgYellow) var SucceededColor = color.New(color.FgGreen) var FailedColor = color.New(color.FgRed) var ErroredColor = color.New(color.FgWhite, color.BgRed, color.Bold) var BlinkingErrorColor = color...
package ui import "github.com/fatih/color" var PendingColor = color.New(color.FgWhite) var StartedColor = color.New(color.FgYellow) var SucceededColor = color.New(color.FgGreen) var FailedColor = color.New(color.FgRed) var ErroredColor = color.New(color.FgRed, color.Bold) var BlinkingErrorColor = color.New(color.Blin...
Update error color to match web UI
Update error color to match web UI
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
c2c4fc3a8fadd34a46de2c50686e95b1a1548754
src/cf/commands/set_env.go
src/cf/commands/set_env.go
package commands import ( "cf/api" "cf/configuration" term "cf/terminal" "github.com/codegangsta/cli" ) type SetEnv struct { ui term.UI appRepo api.ApplicationRepository } func NewSetEnv(ui term.UI, appRepo api.ApplicationRepository) (se SetEnv) { se.ui = ui se.appRepo = appRepo return } func (se SetE...
package commands import ( "cf/api" "cf/configuration" term "cf/terminal" "github.com/codegangsta/cli" ) type SetEnv struct { ui term.UI appRepo api.ApplicationRepository } func NewSetEnv(ui term.UI, appRepo api.ApplicationRepository) (se SetEnv) { se.ui = ui se.appRepo = appRepo return } func (se SetE...
Add a note about repushing app for env to take effect
Add a note about repushing app for env to take effect Signed-off-by: Damien Le Berrigaud <99e6b749acbfbe2a596df99e91d24d6e1fdbee00@pivotallabs.com>
Go
apache-2.0
srikanth88infy/cli,xingzhou/cli,kavoj/cli,markstgodard/cli,rastasheep/trash-can,mcintyred/cli,hyenaspots/cli,nttlabs/cli,cf-routing/cli,mcintyred/cli,evanfarrar/cli,simonleung8/cli,saravana76/cli,cgvarela/cli,SrinivasChilveri/cli,saurabhguptasg/cli,HuaweiTech/cli,simonleung8/cli,evanfarrar/cli,nttlabs/cli,rastasheep/tr...
9e8c81033d66ccda8160d025b05492ad4d2eb31f
future/future.go
future/future.go
package future import ( "time" ) func Fuel(initial float32, elap time.Duration) float32 { rate := float32(1.0 / 3.0) // 1 unit every 3 seconds fuel := initial + rate*float32(int64(elap))/1000000000 if fuel > 10 { fuel = 10 } return fuel } func CannonX(initial float32, rate float32, elap time.Duration) (float...
package future import ( "time" ) // Fuel calculates new value after elap delta time interval. func Fuel(initial float32, elap time.Duration) float32 { rate := float32(1.0 / 3.0) // 1 unit every 3 seconds fuel := initial + rate*float32(int64(elap))/1000000000 if fuel > 10 { fuel = 10 } return fuel } // Cannon...
Document shared delta-time based update helpers.
Document shared delta-time based update helpers.
Go
mit
udhos/fugo,udhos/fugo
934ae47555809fc6ea8b70aa68639cf671cd2520
main.go
main.go
package main import ( "os" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { for _, f := range os.Args { if f == "-D" || f == "--debug" || f == "-debug" { os.Setenv("DEBUG", "1") initLogging(log.DebugLevel) } } app := cli.NewApp() app.Name = os.Args[0] app.Commands = Co...
package main import ( "os" "path" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { for _, f := range os.Args { if f == "-D" || f == "--debug" || f == "-debug" { os.Setenv("DEBUG", "1") initLogging(log.DebugLevel) } } app := cli.NewApp() app.Name = path.Base(os.Args[0])...
Use binary file name instead of full path
Use binary file name instead of full path Signed-off-by: Radek Simko <c0f89f684c2e56811603206eabe5a4cea7f58f3e@gmail.com>
Go
apache-2.0
tpires/machine,tpires/machine,wzymaster/machine,Herbis/machine,pragkent/machine,surgeforward/machine,jgsqware/machine,menglingwei/machine,joelea/machine,jzwlqx/denverdino.github.io,jmelis/machine,brandoncc/machine,bgokden/machine,CenturyLinkLabs/machine,wenlock/machine,aduermael/docker.github.io,13W/machine,askb/machin...
b672e0fe2a92ddfb5f692469e2097c06f8dab202
main.go
main.go
/* http://www.apache.org/licenses/LICENSE-2.0.txt Copyright 2015 Intel Corporation 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 ...
/* http://www.apache.org/licenses/LICENSE-2.0.txt Copyright 2015 Intel Corporation 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 ...
Increment version with update to snap dependency to v0.11.0-beta
Increment version with update to snap dependency to v0.11.0-beta
Go
apache-2.0
intelsdi-x/snap-plugin-collector-ceph,intelsdi-x/snap-plugin-collector-ceph,intelsdi-x/snap-plugin-collector-ceph,intelsdi-x/snap-plugin-collector-ceph
417b08e81290471a26c03e4acaefc9d90c93c5d8
main.go
main.go
package main import ( "os" "flag" "fmt" ) func warn(format string, a ...interface{}) (n int, err error) { return fmt.Fprintf(os.Stderr, format, a...) } func usage() { program := os.Args[0] warn("usage: %s [SUMS]\n", program) flag.PrintDefaults() os.Exit(2) } func main() { flag.Usage = usage flag.Parse() ...
package main import ( "os" "flag" "fmt" ) func warn(format string, a ...interface{}) (n int, err error) { return fmt.Fprintf(os.Stderr, format, a...) } func croak(e error) (n int, err error) { return fmt.Fprintf(os.Stderr, "%s\n", e) } func usage() { program := os.Args[0] warn("usage: %s [SUMS]\n", program) ...
Add a croak function for dumping errors
Add a croak function for dumping errors
Go
mit
kourge/hv
663e01e49cf03fff20eb9a8cf6781c002299027c
misc.go
misc.go
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) cmdReader, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer cmdReader.Close() scanner := bufio...
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) cmdReader, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer cmdReader.Close() scanner := bufio...
Add logging of command failure when not generate err
Add logging of command failure when not generate err
Go
mit
go-playground/generate
2b3f0f8c7c9384f73ac29c8e6d9618b256ccc862
main.go
main.go
package main import ( "flag" "fmt" "os" "path/filepath" "strings" "github.com/calavera/dkvolume" ) const glusterfsId = "_glusterfs" var ( defaultDir = filepath.Join(dkvolume.DefaultDockerRootDirectory, glusterfsId) serversList = flag.String("servers", "", "List of glusterfs servers") restAddress = flag.St...
package main import ( "flag" "fmt" "os" "path/filepath" "strings" "github.com/docker/go-plugins-helpers/volume" ) const glusterfsId = "_glusterfs" var ( defaultDir = filepath.Join(volume.DefaultDockerRootDirectory, glusterfsId) serversList = flag.String("servers", "", "List of glusterfs servers") restAddr...
Move from dkvolume to go-plugins-helpers/volume
Move from dkvolume to go-plugins-helpers/volume
Go
mit
hjdr4/docker-volume-glusterfs,tomcsi/docker-volume-glusterfs,watson81/docker-volume-glusterfs,calavera/docker-volume-glusterfs
12fb98ca05f56e5009cc92dc5eb0ae6f0b1a6d71
main.go
main.go
// Package main initializes a web server. package main import ( "net/http" _ "net/http/pprof" // import for side effects "os" log "github.com/Sirupsen/logrus" "github.com/hack4impact/transcribe4all/config" "github.com/hack4impact/transcribe4all/web" ) func init() { log.SetOutput(os.Stderr) if config.Config.D...
// Package main initializes a web server. package main import ( "fmt" "net/http" _ "net/http/pprof" // import for side effects "os" log "github.com/Sirupsen/logrus" "github.com/hack4impact/transcribe4all/config" "github.com/hack4impact/transcribe4all/web" ) func init() { log.SetOutput(os.Stderr) if config.C...
Add debug information when server starts
Add debug information when server starts
Go
mit
hack4impact/audio-transcription-service,hack4impact/transcribe4all,hack4impact/transcribe4all,hack4impact/transcribe4all
13fd5f07a36d333d0626764ac27f2cca3bd1cc5f
main.go
main.go
package main import ( "os" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { for _, f := range os.Args { if f == "-D" || f == "--debug" || f == "-debug" { os.Setenv("DEBUG", "1") initLogging(log.DebugLevel) } } app := cli.NewApp() app.Name = "machine" app.Commands = Com...
package main import ( "os" log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) func main() { for _, f := range os.Args { if f == "-D" || f == "--debug" || f == "-debug" { os.Setenv("DEBUG", "1") initLogging(log.DebugLevel) } } app := cli.NewApp() app.Name = os.Args[0] app.Commands = Co...
Use actual binary name instead of hardcoding it
Use actual binary name instead of hardcoding it Signed-off-by: Radek Simko <c0f89f684c2e56811603206eabe5a4cea7f58f3e@gmail.com>
Go
apache-2.0
jeanlaurent/machine,StackPointCloud/machine,anweiss/docker.github.io,LaynePeng/machine,ehazlett/machine,LuisBosquez/docker.github.io,legal90/machine,asalhamed/machine,aidora/yont,denverdino/docker.github.io,kunalkushwaha/machine,pragkent/machine,wenlock/machine,jkingyens/machine,sanscontext/docker.github.io,ehazlett/ma...
8a51aa5909bab38a448e6b75058f87da6964d66e
main.go
main.go
package main import ( "flag" "time" "github.com/Sirupsen/logrus" ) const ( gameTick = time.Millisecond statsTick = time.Second ) var addr = flag.String("addr", ":25200", "service address") var debug = flag.Bool("debug", false, "debug mode") var log = logrus.New() func init() { flag.Parse() if *debug { lo...
package main import ( "flag" "time" "github.com/Sirupsen/logrus" ) const ( gameTick = time.Millisecond statsTick = time.Second ) var addr = flag.String("addr", ":25200", "service address") var debug = flag.Bool("debug", false, "debug mode") var log = logrus.New() func init() { flag.Parse() if *debug { lo...
Change the start up message
Change the start up message
Go
mit
etheriqa/crescent
90cbfacacf4d0e6a5d4ce65ccf3e861883b9aeb2
pkg/setting/setting_smtp.go
pkg/setting/setting_smtp.go
package setting type SmtpSettings struct { Enabled bool Host string User string Password string CertFile string KeyFile string FromAddress string SkipVerify bool SendWelcomeEmailOnSignUp bool TemplatesPattern string } func readSmtpSettings() { sec := Cfg.Section("smtp"...
package setting type SmtpSettings struct { Enabled bool Host string User string Password string CertFile string KeyFile string FromAddress string FromName string SkipVerify bool SendWelcomeEmailOnSignUp bool TemplatesPattern string } func readSmtpSettings() { sec :...
Add `FromName` to SmtpSettings struct
Add `FromName` to SmtpSettings struct Updates the `SmtpSettings` struct to include a value for setting the name of the email sender.
Go
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
9e8973fe8cf9204eaed3eb3c754e4aeb8bce2769
init.go
init.go
package main import ( "github.com/deshboard/boilerplate-service/app" "github.com/kelseyhightower/envconfig" "gopkg.in/airbrake/gobrake.v2" logrus_airbrake "gopkg.in/gemnasium/logrus-airbrake-hook.v2" ) func init() { err := envconfig.Process("app", config) if err != nil { logger.Fatal(err) } // Initialize A...
package main import ( "github.com/deshboard/boilerplate-service/app" "github.com/kelseyhightower/envconfig" "gopkg.in/airbrake/gobrake.v2" logrus_airbrake "gopkg.in/gemnasium/logrus-airbrake-hook.v2" ) func init() { err := envconfig.Process("app", config) if err != nil { logger.Fatal(err) } // Initialize A...
Add commit hash to errbit
Add commit hash to errbit
Go
mit
deshboard/boilerplate-crondaemon,deshboard/boilerplate-service,deshboard/boilerplate-model-service,deshboard/boilerplate-grpc-service
9152646855d907c37c3dade6efba0bd7cea18dd2
eos/option/option.go
eos/option/option.go
package option import "net/http" type EOSSettings struct { HTTPClient *http.Client } func DefaultSettings() *EOSSettings { return &EOSSettings{ HTTPClient: http.DefaultClient, } } ////////////////////////////////////// type Option interface { Apply(*EOSSettings) }
package option import ( "net/http" "time" "github.com/itchio/wharf/timeout" ) type EOSSettings struct { HTTPClient *http.Client } func DefaultSettings() *EOSSettings { return &EOSSettings{ HTTPClient: defaultHTTPClient(), } } func defaultHTTPClient() *http.Client { client := timeout.NewClient(time.Second*...
Use a timeout client for eos
Use a timeout client for eos
Go
mit
itchio/wharf,itchio/wharf,itchio/wharf.proto,itchio/wharf.proto
8ddbf5a852e5090c3060f32ec92113b1a62bf342
pending-requests.go
pending-requests.go
package torrent type pendingRequests struct { m []int } func (p *pendingRequests) Dec(r RequestIndex) { prev := p.m[r] if prev <= 0 { panic(prev) } p.m[r]-- } func (p *pendingRequests) Inc(r RequestIndex) { p.m[r]++ } func (p *pendingRequests) Init(maxIndex RequestIndex) { p.m = make([]int, maxIndex) } fu...
package torrent import ( rbm "github.com/RoaringBitmap/roaring" roaring "github.com/RoaringBitmap/roaring/BitSliceIndexing" ) type pendingRequests struct { m *roaring.BSI } func (p *pendingRequests) Dec(r RequestIndex) { _r := uint64(r) prev, _ := p.m.GetValue(_r) if prev <= 0 { panic(prev) } p.m.SetValue(...
Revert "Use a flat slice for pending request counts"
Revert "Use a flat slice for pending request counts" This reverts commit dfc421824ce6c146ff9d9062ad25748c0f8c9990.
Go
mpl-2.0
anacrolix/torrent,anacrolix/torrent
2b4e36ba074cdea3154c4c4ef919178b0a877e06
core/mem.go
core/mem.go
package core type Addr int type Memory interface { ReadData(Addr) byte WriteData(Addr, byte) ReadProgram(Addr) uint16 LoadProgram(Addr) byte }
package core type Addr int type Memory interface { ReadData(Addr) byte WriteData(Addr, byte) ReadProgram(Addr) uint16 LoadProgram(Addr) byte } type MemRead func(Addr) byte type MemWrite func(Addr, byte)
Add MemRead/MemWrite types to core
Add MemRead/MemWrite types to core
Go
mit
edmccard/avr-sim
5b01fd9897a871c52ce6b24dfb85aec0a2beea99
coreinit.go
coreinit.go
package main import ( "github.com/coreos/coreinit/agent" "github.com/coreos/coreinit/machine" "github.com/coreos/coreinit/registry" "github.com/coreos/coreinit/scheduler" ) func main() { m := machine.New(machine.ReadLocalBootId()) r := registry.New() a := agent.New(r, m, "") // Push the initial state to the ...
package main import ( "os" "flag" "github.com/coreos/coreinit/agent" "github.com/coreos/coreinit/machine" "github.com/coreos/coreinit/registry" "github.com/coreos/coreinit/scheduler" ) func main() { var bootId string f := flag.NewFlagSet(os.Args[0], 1) f.StringVar(&bootId, "bootid", "", "Provide a user-gen...
Allow client to pass in -bootid flag
feat(main): Allow client to pass in -bootid flag The -bootid flag will override the system-level boot ID, which is necessary for running multiple copies of coreinit on a single logical server.
Go
apache-2.0
thepwagner/fleet,jonboulle/fleet,mwitkow-io/fleet,wuqixuan/fleet,paveltiunov/fleet,esatterwhite/fleet,bcwaldon/fleet,ecnahc515/fleet,coreos/fleet,flandr/fleet,jonboulle/fleet,coreos/fleet,WPMedia/fleet,mwitkow/fleet,bviswana101/fleet,giantswarm/fleet,mischief/fleet,hhoover/fleet,giantswarm/fleet,mwhooker/fleet,webwlson...
f0ca0bf4deb9ddd9ff92cc5e94b642725440c5e4
bases/subscriptor.go
bases/subscriptor.go
package bases import "time" // Subscriptor is an interface type which Subscription implements. type Subscriptor interface { Dispose() Subscriptor Subscribe() Subscriptor Unsubscribe() Subscriptor UnsubscribeIn(time.Duration) <-chan Subscriptor UnsubscribeOn(chan struct{}, time.Duration) <-chan Subscriptor }
package bases import "time" // Subscriptor is an interface type which Subscription implements. type Subscriptor interface { Dispose() Subscribe() Subscriptor SubscribeAt() time.Time Unsubscribe() Subscriptor UnsubscribeAt() time.Time UnsubscribeIn(time.Duration) <-chan Subscriptor UnsubscribeOn(chan struct{}, ...
Edit Dispose to return nothing and add subscribeAt/unsubscribeAt getters
Edit Dispose to return nothing and add subscribeAt/unsubscribeAt getters
Go
mit
jochasinga/grx,ReactiveX/RxGo
f956aeb065658c4621b60324de86f1e1e0bbe344
logger/logger.go
logger/logger.go
// Copyright 2013 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 applicabl...
// Copyright 2013 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 applicabl...
Use iota at log level enumeration.
Use iota at log level enumeration.
Go
apache-2.0
rakyll/drivefuse,odeke-em/drivefuse-clone,rakyll/drivefuse
cd644a4615d04793cb8e8ddae859413fabfc5585
router/middleware/config.go
router/middleware/config.go
package middleware import ( "github.com/TeaMeow/KitSvc/model" "github.com/codegangsta/cli" "github.com/gin-gonic/gin" ) const configKey = "config" func Config(cli *cli.Context) gin.HandlerFunc { return func(c *gin.Context) { c.Set(configKey, &model.Config{ JWTSecret: cli.String("jwt-secret"), }) } }
package middleware import ( "github.com/TeaMeow/KitSvc/model" "github.com/codegangsta/cli" "github.com/gin-gonic/gin" ) const ConfigKey = "config" func Config(cli *cli.Context) gin.HandlerFunc { v := setupConfig(cli) return func(c *gin.Context) { c.Set(ConfigKey, v) } } func setupConfig(c *cli.Context) *mod...
Put the whole cli in gin
Put the whole cli in gin
Go
mit
TeaMeow/KitSvc
205cdabcfb9632ea2f8482e13fba3e1e2c8fd60f
bleed.go
bleed.go
package main import ( bleed "github.com/FiloSottile/Heartbleed/bleed" "log" "os" ) func main() { out, err := bleed.Heartbleed(os.Args[1], []byte("heartbleed.filippo.io")) if err == bleed.ErrPayloadNotFound { log.Printf("%v - SAFE", os.Args[1]) os.Exit(1) } else if err != nil { log.Printf("%v - ERROR: %v",...
package main import ( bleed "github.com/FiloSottile/Heartbleed/bleed" "log" "os" ) func main() { out, err := bleed.Heartbleed(os.Args[1], []byte("heartbleed.filippo.io")) if err == bleed.ErrPayloadNotFound { log.Printf("%v - SAFE", os.Args[1]) os.Exit(0) } else if err != nil { log.Printf("%v - ERROR: %v",...
Use standard *nix status errors
Use standard *nix status errors In *nix standards, `0` means the process exited successfully, which makes more sense when a site is SAFE.
Go
mit
mozilla-services/Heartbleed,behzad88/Heartbleed,FiloSottile/Heartbleed,FiloSottile/Heartbleed,saisai/Heartbleed,saisai/Heartbleed,behzad88/Heartbleed,FiloSottile/Heartbleed,mozilla-services/Heartbleed,saisai/Heartbleed,behzad88/Heartbleed
a1a9ecd3814854b08d58e8c44e40ca0e94b3d0a7
integration/runner/defaults.go
integration/runner/defaults.go
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package runner import ( "time" "github.com/hyperledger/fabric/integration/helpers" ) const DefaultStartTimeout = 30 * time.Second // DefaultNamer is the default naming function. var DefaultNamer NameFunc = helpers.UniqueName // ...
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package runner import ( "time" "github.com/hyperledger/fabric/integration/helpers" ) const DefaultStartTimeout = 45 * time.Second // DefaultNamer is the default naming function. var DefaultNamer NameFunc = helpers.UniqueName // ...
Increase integration runner start timeout
Increase integration runner start timeout Since moving to the official couchdb image, there have been numerous unit test failures due to the couchdb container not starting within the 30 second start timeout. Increasing to 45 seconds seems to be a sufficient amount of time. FAB-15396 #done Change-Id: I11e0ae84a39786d...
Go
apache-2.0
stemlending/fabric,jimthematrix/fabric,binhn/fabric,muralisrini/fabric,manish-sethi/fabric-sidedb,manish-sethi/fabric,binhn/fabric,manish-sethi/fabric-sidedb,stemlending/fabric,manish-sethi/fabric-sidedb,muralisrini/fabric,binhn/fabric,stemlending/fabric,hyperledger/fabric,manish-sethi/fabric,manish-sethi/fabric-sidedb...
80e338a18db0acce00653a176d82a567eafb0c79
pkg/homedir/homedir_unix.go
pkg/homedir/homedir_unix.go
// +build !windows,cgo !windows,osusergo package homedir // import "github.com/docker/docker/pkg/homedir" import ( "os" "os/user" ) // Key returns the env var name for the user's home dir based on // the platform being run on func Key() string { return "HOME" } // Get returns the home directory of the current us...
// +build !windows package homedir // import "github.com/docker/docker/pkg/homedir" import ( "os" "os/user" ) // Key returns the env var name for the user's home dir based on // the platform being run on func Key() string { return "HOME" } // Get returns the home directory of the current user with the help of //...
Revert "homedir: add cgo or osusergo buildtag constraints for unix"
Revert "homedir: add cgo or osusergo buildtag constraints for unix" TL;DR: there is no way to do this right. We do know that in some combination of build tags set (or unset), linker flags, environment variables, and libc implementation, this package won't work right. In fact, there is one specific combination: 1. `C...
Go
apache-2.0
Mokolea/docker,nawawi/docker,konstruktoid/docker-upstream,cpuguy83/docker,vdemeester/docker,gnailuy/docker,bearstech/moby,pradipd/moby,ibuildthecloud/docker,Ramzec/docker,jvanz/docker,estesp/docker,paralin/docker,dims/docker,trebonian/docker,flavio/docker,moby/moby,estesp/docker,jimjag/docker,bearstech/moby,nawawi/dock...
e3803f94b09f41e361bb67ad12d9b68d9806385a
pkg/inspector/cmd/common.go
pkg/inspector/cmd/common.go
package cmd import ( "fmt" "io" "strings" "github.com/apprenda/kismatic/pkg/inspector/rule" ) func getNodeRoles(commaSepRoles string) ([]string, error) { roles := strings.Split(commaSepRoles, ",") for _, r := range roles { if r != "etcd" && r != "master" && r != "worker" && r != "ingress" { return nil, fm...
package cmd import ( "fmt" "io" "strings" "github.com/apprenda/kismatic/pkg/inspector/rule" ) func getNodeRoles(commaSepRoles string) ([]string, error) { roles := strings.Split(commaSepRoles, ",") for _, r := range roles { if r != "etcd" && r != "master" && r != "worker" && r != "ingress" && r != "storage" {...
Add storage role to inspector
Add storage role to inspector
Go
apache-2.0
apprenda/kismatic,apprenda/kismatic,apprenda/kismatic
75e1284b2c13a1ab3423964c804df1688c9a6dbe
messages/message.go
messages/message.go
package messages import ( "code.google.com/p/go-uuid/uuid" "github.com/qp/go/utils" ) // Message is the standard QP messaging object. // It is used to facilitate all communication between // QP nodes, as well as containing the metadata // necessary to implement the pipeline functionality. type Message struct { To ...
package messages import ( "encoding/json" "code.google.com/p/go-uuid/uuid" "github.com/qp/go/utils" ) // Message is the standard QP messaging object. // It is used to facilitate all communication between // QP nodes, as well as containing the metadata // necessary to implement the pipeline functionality. type Mess...
Add pretty print for msg object
Add pretty print for msg object
Go
mit
qp/go,qp/go
665b74e4781ac853bce4919b5ec3987ba862d1fb
src/staticfile/integration/fake_supply_before_staticfile_test.go
src/staticfile/integration/fake_supply_before_staticfile_test.go
package integration_test import ( "path/filepath" "github.com/cloudfoundry/libbuildpack/cutlass" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("running supply buildpacks before the staticfile buildpack", func() { var app *cutlass.App AfterEach(func() { if app != nil { app.Destr...
package integration_test import ( "path/filepath" "github.com/cloudfoundry/libbuildpack/cutlass" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("running supply buildpacks before the staticfile buildpack", func() { var app *cutlass.App AfterEach(func() { if app != nil { app.Destr...
Change multi-buildpack test from develop to master
Change multi-buildpack test from develop to master Co-authored-by: Don Nguyen <1487e49252176236e14c0d247a7bbbd5e8c39a5d@pivotal.io>
Go
apache-2.0
cloudfoundry/staticfile-buildpack,cloudfoundry/staticfile-buildpack,cloudfoundry/staticfile-buildpack,cloudfoundry/staticfile-buildpack
ed3c0fc68e43dc3a300b56b20845046875de8883
bolus.go
bolus.go
package medtronic const ( bolus Command = 0x42 ) // Bolus delivers the given amount of insulin as a bolus. func (pump *Pump) Bolus(amount Insulin) { newer := pump.Family() >= 23 if newer { panic("unimplemented") } n := byte(amount / 100) pump.Execute(bolus, n) }
package medtronic const ( bolus Command = 0x42 ) // Bolus delivers the given amount of insulin as a bolus. // For safety, this command is not attempted more than once. func (pump *Pump) Bolus(amount Insulin) { newer := pump.Family() >= 23 if newer { panic("unimplemented") } b := byte(amount / 100) n := pump.R...
Make sure Bolus command is not repeated
Make sure Bolus command is not repeated
Go
mit
ecc1/medtronic,ecc1/medtronic
1df497d057f42493911fab7251a7b5fef5e529f7
lib/config/config.go
lib/config/config.go
package config import ( "os" // "github.com/pkg/errors" ) type config struct { Host string Port string Debug bool } const ( DefaultHost = "localhost" DefaultPort = "8000" ) // Config is set from the environment variables var Config = &config{} func Load() error { Config.Host = os.Getenv("DIAMONDB_HOST") ...
package config import ( "os" "strconv" "github.com/pkg/errors" ) type config struct { Host string Port string RedisAddr string RedisPassword string RedisDB int Debug bool } const ( DefaultHost = "localhost" DefaultPort = "8000" DefaultRedisAddr = "local...
Add DIAMONDB_REDIS_ADDR DIAMONDB_REDIS_PASSWORD DIAMONDB_REDIS_DB as new parameters
Add DIAMONDB_REDIS_ADDR DIAMONDB_REDIS_PASSWORD DIAMONDB_REDIS_DB as new parameters
Go
apache-2.0
yuuki/diamondb,yuuki/diamondb
cee759beac301264582b4b5a1aaf777d24ad6fef
db/testutils_test.go
db/testutils_test.go
package db import ( "log" rdb "github.com/dancannon/gorethink" ) func init() { var err error TestConn, err = NewConnection("test", "localhost:28015") if err != nil { log.Fatalln("Could not create a connection for testing. Exiting.") } Database = "testing" rdb.DbCreate(Database).Exec(TestConn.Session) rd...
package db import ( "log" "os" rdb "github.com/dancannon/gorethink" ) func init() { var err error TestConn, err = NewConnection("test", os.Getenv("RETHINKDB_URL")) if err != nil { log.Fatalln("Could not create a connection for testing. Exiting.") } Database = "testing" rdb.DbCreate(Database).Exec(TestCo...
Use RETHINKDB_URL to connect to test database
Use RETHINKDB_URL to connect to test database
Go
unlicense
nylar/miru
680fddfd2f363bb2d249659caec3a41ccdb3a4d6
cmd/atlas/cmd_credits.go
cmd/atlas/cmd_credits.go
package main import ( "github.com/urfave/cli" "os" "log" "fmt" ) // init injects our key-related commands func init() { cliCommands = append(cliCommands, cli.Command{ Name: "credits", Aliases: []string{ "c", }, Usage: "credits-related keywords", Description: "All the commands for credits", A...
package main import ( "fmt" "github.com/urfave/cli" "log" ) // init injects our key-related commands func init() { cliCommands = append(cliCommands, cli.Command{ Name: "credits", Aliases: []string{ "c", }, Usage: "credits-related keywords", Description: "All the commands for credits", Action:...
Use log.Fatalf instead of Printf/Exit.
Use log.Fatalf instead of Printf/Exit.
Go
mit
keltia/ripe-atlas
cb3a51bd38548a67a0d28a57523c98536cd23c5e
example-usage/main.go
example-usage/main.go
package main import ( "github.com/Sirupsen/logrus" "github.com/rogierlommers/logrus-redis-hook" ) func init() { hook, err := logredis.NewHook("localhost", "my_redis_key", // key to use "v0", // logstash format (v0, v1 or custom) "my_app_name", // your application name "my_hostname", // your hos...
package main import ( "io/ioutil" "github.com/Sirupsen/logrus" "github.com/rogierlommers/logrus-redis-hook" ) func init() { hook, err := logredis.NewHook("localhost", "my_redis_key", // key to use "v0", // logstash format (v0, v1 or custom) "my_app_name", // your application name "my_hostname"...
Add example to stop logging to stdout
Add example to stop logging to stdout
Go
mit
rogierlommers/logrus-redis-hook
453e13c6271b70f9c7f1f8b92a2ca2d620cd13d5
filehandler/dirmaker.go
filehandler/dirmaker.go
package filehandler import ( "fmt" "os" "path/filepath" ) // SetUp will create the needed directories func SetUp() error { errMsg := "Cannot create resources dir. Consider -checkdir=false.\n" // get current path path, error := filepath.Abs(filepath.Dir(os.Args[0])) if error != nil { return fmt.Errorf(errMs...
package filehandler import ( "fmt" "os" "path/filepath" ) // SetUp will create the needed directories func SetUp() error { errMsg := "Cannot create resources dir. Consider -checkdir=false.\n" // get current path path, error := filepath.Abs(filepath.Dir(os.Args[0])) if error != nil { return fmt.Errorf(errMs...
Check if file exists before making new one
Check if file exists before making new one
Go
apache-2.0
gale93/swebs
8a1586e75805ea2f9e4ffdab9269a19410e97e96
termination/generation_count.go
termination/generation_count.go
package termination import "github.com/aurelien-rainone/evolve/framework" // GenerationCount terminates evolution after a set number of generations have // passed. type GenerationCount struct { generationCount int } // NewGenerationCount creates a GenerationCoun termination condition. func NewGenerationCount(genera...
package termination import "github.com/aurelien-rainone/evolve/framework" // GenerationCount terminates evolution after a set number of generations have // passed. type GenerationCount int // NewGenerationCount creates a GenerationCoun termination condition. func NewGenerationCount(generationCount int) GenerationCou...
Refactor GenerationCount (alias to int)
Refactor GenerationCount (alias to int)
Go
mit
aurelien-rainone/evolve,aurelien-rainone/evolve
b4a85849423f59f443e6d2006960d4b759d7cab9
schedule/commits.go
schedule/commits.go
package schedule import ( "time" ) type Commit struct { dateTime time.Time message string } // RandomCommits returns a channel of random commits for a given day. func RandomCommits(day time.Time, rnd int) chan Commit { commitChannel := make(chan Commit) go func() { for i := 0; i < rnd; i++ { commitChannel...
package schedule import ( "time" ) const ( COMMIT_MESSAGE_BASE = "commit_message_base.txt" ) type Commit struct { dateTime time.Time message string }
Move random logic to random.go
Move random logic to random.go
Go
mit
0xfoo/punchcard
b0cf394a358729674f7b366828483b4745925d45
requests.go
requests.go
package gowebutils import ( "io" "io/ioutil" "net/http" ) const MaxRequestSize = 1048576 * 5 func PrepareRequestBody(r *http.Request) ([]byte, error) { body, err := ioutil.ReadAll(io.LimitReader(r.Body, MaxRequestSize)) if err != nil { return body, err } err = r.Body.Close() return body, err }
package gowebutils import ( "encoding/json" "io" "io/ioutil" "net/http" ) const MaxRequestSize = 1048576 * 5 func PrepareRequestBody(r *http.Request) ([]byte, error) { body, err := ioutil.ReadAll(io.LimitReader(r.Body, MaxRequestSize)) if err != nil { return body, err } err = r.Body.Close() return body, e...
Add helper for unmarshaling the request body.
Add helper for unmarshaling the request body.
Go
mit
wangjohn/gowebutils
db0d847e03cc94323b4db3f41d6f8b174bb6ec4a
internal/execext/exec.go
internal/execext/exec.go
package execext import ( "context" "errors" "io" "strings" "mvdan.cc/sh/interp" "mvdan.cc/sh/syntax" ) // RunCommandOptions is the options for the RunCommand func type RunCommandOptions struct { Context context.Context Command string Dir string Env []string Stdin io.Reader Stdout io.Writer St...
package execext import ( "context" "errors" "io" "os" "strings" "mvdan.cc/sh/interp" "mvdan.cc/sh/syntax" ) // RunCommandOptions is the options for the RunCommand func type RunCommandOptions struct { Context context.Context Command string Dir string Env []string Stdin io.Reader Stdout io.Writ...
Fix compilation after updating mvdan/sh
Fix compilation after updating mvdan/sh
Go
mit
go-task/task,go-task/task
76d8e4d2c9fd0ce957a253ea2a972b9423938301
lib/output/default_fields_haver.go
lib/output/default_fields_haver.go
package output type DefaultFieldsHaver interface { DefaultFields(f Format) string }
package output // DefaultFieldsHaver is an interface that must be implemented in order to pass objects to output.Write type DefaultFieldsHaver interface { // DefaultFields must return a string of valid field names (according to github.com/BytemarkHosting/row - i.e. they must be in the list output by row.FieldsFrom) f...
Add documentation comment to DefaultFieldsHaver
Add documentation comment to DefaultFieldsHaver
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
bc7ed292d2ab30a56442bb8f4ee7bc0e54ce48ff
server/server.go
server/server.go
package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("../ui/"))) http.ListenAndServe(":8080", nil) }
package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("../ui/"))) http.HandleFunc("/edit", EditPageHandler) http.HandleFunc("/save", SavePageHandler) http.HandleFunc("/delete", DeletePageHandler) http.ListenAndServe(":8080", nil) } func EditPageHandler(rw http.ResponseWrite...
Add stubs for various request handlers
Add stubs for various request handlers
Go
bsd-2-clause
ambidextrousTx/RWiki,ambidextrousTx/RWiki
cee85ea466d597f1471fc612c5717540e8ee1208
shell/shell_test.go
shell/shell_test.go
package shell import ( "testing" ) func TestGuessFish(t *testing.T) { if Guess("/usr/local/bin/fish") != Fish { t.Errorf("Expected /usr/local/bin/fish to match the fish shell") } } func TestFishCompiles(t *testing.T) { defer func() { if r := recover(); r != nil { t.Errorf("Expected Fish to be a valid temp...
package shell import ( "testing" "github.com/gsamokovarov/assert" ) func TestGuessFish(t *testing.T) { assert.Equal(t, Fish, Guess("/usr/local/bin/fish")) } func TestFishCompiles(t *testing.T) { Fish.MustCompile("j") } func TestGuessZsh(t *testing.T) { assert.Equal(t, Zsh, Guess("/usr/zsh")) } func TestZshCo...
Use gsamokovarov/assert in the shell testing
Use gsamokovarov/assert in the shell testing
Go
mit
gsamokovarov/jump
77932bc098850f81c831551f7e05969246cb66e0
filter/pos.go
filter/pos.go
package filter import ( "github.com/ikawaha/kagome/v2/tokenizer" ) type ( POS = []string ) type POSFilter struct { filter *FeaturesFilter } // NewPOSFilter returns a part of speech filter. func NewPOSFilter(stops ...POS) *POSFilter { return &POSFilter{ filter: NewFeaturesFilter(stops...), } } // Match retur...
package filter import ( "github.com/ikawaha/kagome/v2/tokenizer" ) type ( POS = []string ) type POSFilter struct { filter *FeaturesFilter } // NewPOSFilter returns a part of speech filter. func NewPOSFilter(stops ...POS) *POSFilter { return &POSFilter{ filter: NewFeaturesFilter(stops...), } } // Match retur...
Simplify (POSFilter).apply() by replacing if-else by a comparison expression.
Simplify (POSFilter).apply() by replacing if-else by a comparison expression.
Go
mit
ikawaha/kagome,ikawaha/kagome
d104ebdf619fd589c1e69edcdb1086e65e28c64d
discounts.go
discounts.go
package stripe // DiscountParams is the set of parameters that can be used when deleting a discount. type DiscountParams struct { Params } // Discount is the resource representing a Stripe discount. // For more details see https://stripe.com/docs/api#discounts. type Discount struct { Coupon *Coupon `json:"coupon...
package stripe // DiscountParams is the set of parameters that can be used when deleting a discount. type DiscountParams struct { Params } // Discount is the resource representing a Stripe discount. // For more details see https://stripe.com/docs/api#discounts. type Discount struct { Coupon *Coupon `json:"coupon"...
Fix go fmt errors on new type
Fix go fmt errors on new type
Go
mit
ChannelMeter/stripe-go,stripe/stripe-go,ChannelMeter/stripe-go,stripe/stripe-go
70b886dd5a25a2507624496d5ac5815cad14476f
third_party/react/fileembed.go
third_party/react/fileembed.go
/* Copyright 2013 Google Inc. 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, software di...
/* Copyright 2013 Google Inc. 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, software di...
Add a better package comment
react: Add a better package comment Change-Id: I427bcc0e8554323def325bf2d15707963299e45e
Go
apache-2.0
toshnix/camlistore,kbajey/testrepo,angelcabo/camlistore,henrylee2cn/camlistore,mpl/camlistore,colemickens/camlistore,angelcabo/camlistore,raff/camlistore,stevearm/camlistore,colemickens/camlistore,edrex/camlistore,fgeller/camlistore,pombredanne/camlistore,ginabythebay/camlistore,nimbus/camlistore,minusnine/camlistore,e...
bb49895e476c574dc306269bffe41f4ae28845e8
gozer/http.go
gozer/http.go
package main import ( "encoding/json" "fmt" "log" "net/http" ) var taskIndex = 0 func startHTTP() { http.HandleFunc("/api/addtask", addTaskHandler) log.Printf("api listening on port %d", *port) if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil { log.Fatalf("failed to start listening ...
package main import ( "encoding/json" "fmt" "net/http" ) var taskIndex = 0 func startHTTP() { http.HandleFunc("/api/addtask", addTaskHandler) log.Info.Printf("API listening on port %d", *port) if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil { log.Error.Fatalf("Failed to start listen...
Add new logging style logs
Add new logging style logs
Go
apache-2.0
twitter/gozer,twitter/gozer
2a5fc0f02f7586f75281bf435a8d2ee71833823d
commands/user_mode_warning.go
commands/user_mode_warning.go
package commands import ( "os" "runtime" "github.com/Sirupsen/logrus" ) func userModeWarning(withRun bool) { // everything is supported on windows if runtime.GOOS == "windows" { return } systemMode := os.Getuid() == 0 // We support services on Linux, Windows and Darwin noServices := runtime.GOOS != "l...
package commands import ( "os" "runtime" "github.com/Sirupsen/logrus" ) func userModeWarning(withRun bool) { logrus.WithFields(logrus.Fields{ "GOOS": runtime.GOOS, "uid": os.Getuid(), }).Debugln("Checking runtime mode") // everything is supported on windows if runtime.GOOS == "windows" { return } s...
Remove user-mode warning when runned in system-mode
Remove user-mode warning when runned in system-mode
Go
mit
ayufan/gitlab-ci-multi-runner,soiff/gitlab-ci-multi-runner,ayufan/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner,soiff/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner,ayufan/gitlab-ci-multi-runner,soiff/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner
8221732e3d9e1db8dad0c521b9239af1de42f4ad
service/http/protocol.go
service/http/protocol.go
package httpservicse import ( "net/http" "github.com/gourd/kit/store" ) // Request contains all common fields needed for a usual API request type Request struct { // Request stores the raw *http.Request Request *http.Request // Query stores the parsed Query information Query store.Query // Previous stores,...
package httpservice import ( "net/http" "github.com/gourd/kit/store" ) // Request contains all common fields needed for a usual API request type Request struct { // Request stores the raw *http.Request Request *http.Request // Query stores the parsed Query information Query store.Query // Previous stores, ...
Fix different package name mistake
[service/http] Fix different package name mistake
Go
mit
gourd/kit
0a937b01d154fbef7b450892399356bbe342b642
gtf.go
gtf.go
package gtf import ( "html/template" "strings" ) var GtfFuncMap = template.FuncMap { "stringReplace": func(s1 string, s2 string) string { return strings.Replace(s2, s1, "", -1) }, "stringDefault": func(s1 string, s2 string) string { if len(s2) > 0 { return s2 } return s1 }, "stringLength": func(s...
package gtf import ( "html/template" "strings" ) var GtfFuncMap = template.FuncMap { "stringReplace": func(s1 string, s2 string) string { return strings.Replace(s2, s1, "", -1) }, "stringDefault": func(s1 string, s2 string) string { if len(s2) > 0 { return s2 } return s1 }, "stringLength": func(s...
Add a comment for New.
Add a comment for New.
Go
mit
leekchan/gtf,Parkayun/gtf,RichardKnop/gtf
932adbff70a86fd1e79359d8323761ef569e5ca0
log.go
log.go
package wrapplog import ( "os" "strings" "github.com/Sirupsen/logrus" ) var jsonFormatter = logrus.JSONFormatter{} type WrappFormatter struct{} func init() { logrus.SetFormatter(&WrappFormatter{}) logrus.SetOutput(os.Stdout) } // Format logs according to WEP-007 func (f *WrappFormatter) Format(entry *logrus....
package wrapplog import ( "os" "github.com/Sirupsen/logrus" ) func init() { logrus.SetFormatter(&logrus.JSONFormatter{}) logrus.SetOutput(os.Stdout) }
Update according to wep changes
Update according to wep changes
Go
mit
wrapp/wrapplog
b6a4ce4e292367cb9a88e4ca9eab925ab1c49b71
context.go
context.go
package goapi import ( "errors" "net/http" "strings" ) type Context struct { Params map[string]string Route Route } func fromRequest(r *route, req *http.Request) (*Context, error) { paths := strings.Split(strings.Trim(req.URL.Path, "/"), "/") route, params := r.getRoute(paths) if route != nil { return &C...
package goapi import ( "errors" "net/http" "strings" ) type Context struct { Params map[string]string Route Route } func fromRequest(r *route, req *http.Request) (*Context, error) { var paths []string if path := strings.Trim(req.URL.Path, "/"); path != "" { paths = strings.Split(path, "/") } route, para...
Fix routes for path /
Fix routes for path /
Go
mit
vardius/goserver,vardius/goserver
efbe9b05d89b33e8296e163fa84ffcf43152f3bf
cobra/cmd/project_test.go
cobra/cmd/project_test.go
package cmd import ( "path/filepath" "testing" ) func TestFindExistingPackage(t *testing.T) { path := findPackage("github.com/spf13/cobra") if path == "" { t.Fatal("findPackage didn't find the existing package") } if !hasGoPathPrefix(path) { t.Fatal("%q is not in GOPATH, but must be", path) } } func hasGo...
package cmd import ( "path/filepath" "testing" ) func TestFindExistingPackage(t *testing.T) { path := findPackage("github.com/spf13/cobra") if path == "" { t.Fatal("findPackage didn't find the existing package") } if !hasGoPathPrefix(path) { t.Fatalf("%q is not in GOPATH, but must be", path) } } func hasG...
Use Fatalf instead of Fatal
cmd: Use Fatalf instead of Fatal
Go
apache-2.0
spf13/cobra,anthonyfok/cobra,liggitt/cobra,eparis/cobra
0b59164c1bd4ac11a9622d9703dbafb8cd0dabf1
actor/middleware/propagator/middlewarepropagation_test.go
actor/middleware/propagator/middlewarepropagation_test.go
package propagator import ( "github.com/AsynkronIT/protoactor-go/actor" "github.com/stretchr/testify/assert" "sync" "testing" ) func TestPropagator(t *testing.T) { mutex := &sync.Mutex{} spawningCounter := 0 propagator := New(). WithItselfForwarded(). WithSpawnMiddleware(func(next actor.SpawnFunc) actor....
package propagator import ( "github.com/AsynkronIT/protoactor-go/actor" "github.com/stretchr/testify/assert" "sync" "testing" ) func TestPropagator(t *testing.T) { mutex := &sync.Mutex{} spawningCounter := 0 propagator := New(). WithItselfForwarded(). WithSpawnMiddleware(func(next actor.SpawnFunc) actor....
Add spawn middleware & MiddlewarePropagation
Add spawn middleware & MiddlewarePropagation - Spawn Middleware lets the system tap in between an actor and spawning childs. This allows building in propagation of middleware, tracing and other stuff - The MiddlewarePropagation middleware addition supports getting middleware spread out to full actor trees, with nothin...
Go
apache-2.0
rogeralsing/gam,AsynkronIT/gam,AsynkronIT/gam,AsynkronIT/protoactor-go,AsynkronIT/protoactor-go
ce26ce7488864dec155dc1805a33e0e89b3651eb
ext/singularity/dummy_name_cache.go
ext/singularity/dummy_name_cache.go
package singularity import ( "github.com/opentable/sous/ext/docker" "github.com/opentable/sous/lib" ) // DummyNameCache implements the Builder interface by returning a // computed image name for a given source version type DummyNameCache struct { } // NewDummyNameCache builds a new DummyNameCache func NewDummyName...
package singularity import ( "github.com/opentable/sous/ext/docker" "github.com/opentable/sous/lib" ) // DummyNameCache implements the Builder interface by returning a // computed image name for a given source version type DummyNameCache struct { } // NewDummyNameCache builds a new DummyNameCache func NewDummyName...
Delete Insert method from DummyNameCache
Delete Insert method from DummyNameCache
Go
mit
samsalisbury/sous,opentable/sous,opentable/sous,nyarly/sous,opentable/sous,opentable/sous,nyarly/sous,samsalisbury/sous,samsalisbury/sous,opentable/sous,samsalisbury/sous,nyarly/sous,samsalisbury/sous
e4be389a3f47b64e3877a42e0124db41c98856ea
helpers.go
helpers.go
package money import ( "math" "strings" ) func separateThousands(value, separator string) string { s := len(value) / 3 m := int(math.Mod(float64(len(value)), 3)) if m > 0 { s++ } if s == 0 { return value } r := make([]string, s) for i := 0; i < len(r); i++ { if i == 0 && m > 0 { r[i] = value[i ...
package money import ( "fmt" "math" "strings" ) func separateThousands(value, separator string) string { s := len(value) / 3 m := int(math.Mod(float64(len(value)), 3)) if m > 0 { s++ } if s == 0 { return value } r := make([]string, s) for i := 0; i < len(r); i++ { if i == 0 && m > 0 { r[i] = v...
Add splitValue helper to get integer and fractional parts
Add splitValue helper to get integer and fractional parts
Go
mit
jmptrader/money-1,joiggama/money
62609d66d06a963036bc368a72f0524559d55dc2
defaults/defaults.go
defaults/defaults.go
/* Copyright The containerd 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...
/* Copyright The containerd 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...
Fix typo in description comment
Fix typo in description comment Signed-off-by: Phil Estes <dbac1f450dc8326caa7ba104b384a0eca642250c@linux.vnet.ibm.com>
Go
apache-2.0
mikebrow/containerd,containerd/containerd,estesp/containerd,thaJeztah/containerd,vdemeester/containerd,estesp/containerd,containerd/containerd,vdemeester/containerd,crosbymichael/containerd,mikebrow/containerd,dmcgowan/containerd,dmcgowan/containerd,thaJeztah/containerd,crosbymichael/containerd
e12b29759cd9b9a3ad94b2ad76694dc89ec2cce7
tracing/spanError.go
tracing/spanError.go
package tracing import "bytes" // SpanError is a simple slice of Spans that implements error. To be meaningful, // at least (1) Span in the slice must have an error. type SpanError []Span func (se SpanError) String() string { return se.Error() } func (se SpanError) Error() string { var output bytes.Buffer for _...
package tracing import "bytes" // SpanError is a simple slice of Spans that implements error. To be meaningful, // at least (1) Span in the slice must have an error. type SpanError []Span func (se SpanError) String() string { return se.Error() } // Spans implements the Spanned interface, making it convenient for ...
Use interface{} instead of error
Use interface{} instead of error
Go
apache-2.0
Comcast/webpa-common,Comcast/webpa-common
693b4f75d6e87fe1b227be37cb07cb9e3676efe9
sqlstore/sqlstorage_test.go
sqlstore/sqlstorage_test.go
package sqlstore
package sqlstore import ( "fmt" "github.com/jinzhu/gorm" _ "github.com/mattn/go-sqlite3" "os" "testing" "time" ) type Client struct { ID int `gorm:"primary_key"` Secret string RedirectUri string UserID string } func (c Client) TableName() string { return "clients" } type AuthorizeData ...
Set up basic test infrastructure
Set up basic test infrastructure
Go
mit
DarinM223/osin-sql-storage
13c39cb5100567bf8a504100cc6e16b6b3289d26
integration/helpers/fake_data.go
integration/helpers/fake_data.go
package helpers import ( "fmt" "io/ioutil" "net/http" "os" "path/filepath" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) func AddFiftyOneOrgs(server *ghttp.Server) { AddHandler(server, http.MethodGet, "/v3/organizations", http.StatusOK, []byte(fmt.Sprintf(string(fixtureData("fifty-orgs-...
package helpers import ( "fmt" "io/ioutil" "net/http" "os" "path/filepath" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) func AddFiftyOneOrgs(server *ghttp.Server) { AddHandler(server, http.MethodGet, "/v3/organizations?order_by=name", http.StatusOK, []byte(fmt.Sprintf(string(fixtureDat...
Fix test server to expect order_by parameter
Fix test server to expect order_by parameter [#163096814](https://www.pivotaltracker.com/story/show/163096814) Co-authored-by: Alexander Berezovsky <a12e46294a7d630b60bbba114755367d6bafe2fb@pivotal.io>
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
3c8adf08c8f68764bde178cea6e97962fe97d9f9
sqlc_test.go
sqlc_test.go
package sqlc import ( "reflect" "runtime" "strings" "testing" ) func TestBasicComposition(t *testing.T) { s := Statement{} s = s.Select("*").From("Employees").Where("name = 'Marge'").Order("id") sql, args := s.ToSQL() expect(t, args, make([]interface{}, 0)) expect(t, sql, strings.TrimSpace(` SELECT * FROM E...
package sqlc import ( "reflect" "runtime" "strings" "testing" ) func TestBasicComposition(t *testing.T) { s := Statement{} // These statements are deliberately out of order s = s.Group("role").Order("id").Limit("30") s = s.Where("name = 'Marge'") s = s.Select("*").From("Employees") sql, args := s.ToSQL() ...
Test all functions in basic composition test, deliberately misorder them.
Test all functions in basic composition test, deliberately misorder them.
Go
mit
mipearson/sqlc
24f286f82ed3999ed349372c76ccc272bc444362
bashbrew/go/src/bashbrew/cmd-push.go
bashbrew/go/src/bashbrew/cmd-push.go
package main import ( "fmt" "github.com/codegangsta/cli" ) func cmdPush(c *cli.Context) error { repos, err := repos(c.Bool("all"), c.Args()...) if err != nil { return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err) } uniq := c.Bool("uniq") namespace := c.String("namespace") if namespace ...
package main import ( "fmt" "github.com/codegangsta/cli" ) func cmdPush(c *cli.Context) error { repos, err := repos(c.Bool("all"), c.Args()...) if err != nil { return cli.NewMultiError(fmt.Errorf(`failed gathering repo list`), err) } uniq := c.Bool("uniq") namespace := c.String("namespace") if namespace ...
Correct typo in bashbrew push --namespace message
Correct typo in bashbrew push --namespace message
Go
apache-2.0
nodejs-docker-bot/official-images,pesho/docker-official-images,thresheek/official-images,docker-solr/official-images,emilevauge/official-images,nodejs-docker-bot/official-images,docker-library/official-images,dinogun/official-images,infosiftr/stackbrew,docker-solr/official-images,docker-solr/official-images,thresheek/o...
79daec8f5956f6f8511c9e5519b85ac51ce0fbd6
sudoblock.go
sudoblock.go
package sudoblock import ( "fmt" "github.com/shamsher31/goisroot" "github.com/shiena/ansicolor" "os" ) func Is() { if root.Is() { w := ansicolor.NewAnsiColorWriter(os.Stdout) message := "%sYou are not allowed to run this app with root permissions.%s\n" fmt.Fprintf(w, message, "\x1b[31m", "\x1b[0m") os.Ex...
package sudoblock import ( "fmt" "github.com/shamsher31/goisroot" "github.com/shamsher31/gosymbol" "github.com/ttacon/chalk" "os" ) func Is() { if root.Is() { fmt.Println(symbol.Error(), chalk.Red.Color("You are not allowed to run this app with root permissions")) os.Exit(77) } }
Use chalk to simplify printing of msg
Use chalk to simplify printing of msg
Go
mit
shamsher31/gosudoblock
b4664b01c89d2b71a62936fc5bad3875177a98b5
templates.go
templates.go
package main import ( "text/template" ) var ( BANNER_TEMPLATE = template.Must(template.New("banner").Parse( `===================== goslow ==================== `)) CREATE_SITE_TEMPLATE = template.Must(template.New("create site").Parse( `Your personal goslow domain is {{ .Domain }} You can configure your domain...
package main import ( "text/template" ) var ( BANNER_TEMPLATE = template.Must(template.New("banner").Parse( `===================== goslow ==================== `)) CREATE_SITE_TEMPLATE = template.Must(template.New("create site").Parse( `Your personal goslow domain is {{ .Domain }} You can configure your domain...
Handle empty response in help texts
Handle empty response in help texts
Go
mit
alexandershov/goslow,alexandershov/goslow
42748a2c4b1307c012c5a2c2cc5bbbe5fd2bb1ba
cmd/switchconsole/switch_console.go
cmd/switchconsole/switch_console.go
package switchconsole import ( "os" log "github.com/Sirupsen/logrus" "github.com/docker/libcompose/project/options" "github.com/rancher/os/compose" "github.com/rancher/os/config" "golang.org/x/net/context" ) func Main() { if len(os.Args) != 2 { log.Fatal("Must specify exactly one existing container") } ne...
package switchconsole import ( "os" log "github.com/Sirupsen/logrus" composeConfig "github.com/docker/libcompose/config" "github.com/docker/libcompose/project/options" "github.com/rancher/os/compose" "github.com/rancher/os/config" "golang.org/x/net/context" ) func Main() { if len(os.Args) != 2 { log.Fatal(...
Fix duplicate volumes_from when switching consoles
Fix duplicate volumes_from when switching consoles
Go
apache-2.0
ibuildthecloud/os,rancherio/os,gizmotronic/os,rancher/os,SvenDowideit/os,juliengk/os,juliengk/os,gizmotronic/os,rancher/os,rancherio/os,SvenDowideit/os,rancherio/os,ibuildthecloud/os