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
07a04f22530e038f734a98c7f30702b869479527
input/filecompare.go
input/filecompare.go
// +build !windows package input import ( "os" "syscall" "github.com/elastic/libbeat/logp" ) func IsSameFile(path string, info os.FileInfo, state *FileState) bool { fstat := info.Sys().(*syscall.Stat_t) return (fstat.Ino == state.Inode && fstat.Dev == state.Device) } // Checks if the two files are the same. ...
// +build !windows package input import ( "os" "syscall" "github.com/elastic/libbeat/logp" ) func IsSameFile(path string, info os.FileInfo, state *FileState) bool { fstat := info.Sys().(*syscall.Stat_t) return (fstat.Ino == state.Inode && fstat.Dev == state.Device) } // Checks if the two files are the same. ...
Use os.SameFile for file comparison
Use os.SameFile for file comparison
Go
mit
yapdns/yapdnsbeat,yapdns/yapdnsbeat
24ab4dace4fe2f6b0d96d6d7db576b84bfda31eb
config_test.go
config_test.go
package consumergroup import "testing" func TestConfigValidate(t *testing.T) { conf := NewConfig() conf.ZkList = []string{} conf.TopicList = []string{} if err := conf.validate(); err == nil { t.Fatal("config invalidate is expected") } conf.ZkList = []string{"127.0.0.1:2181", "127.0.0.1:2181"} if err := conf....
package consumergroup import ( "testing" ) func TestConfigValidate(t *testing.T) { conf := NewConfig() conf.ZkList = []string{} conf.TopicList = []string{} if err := conf.validate(); err == nil { t.Fatal("config invalidate is expected") } conf.ZkList = []string{"127.0.0.1:2181", "127.0.0.1:2181"} if err := ...
Fix config unit test failed
FIX: Fix config unit test failed
Go
mit
meitu/go-consumergroup,meitu/go-consumergroup
e1ee8637064c4adaad191fc0bfb0485d6bdb5985
core/writer.go
core/writer.go
package core // Writer describes an object that tuples can be written to // as the output for a Box. Note that this interface was chosen // because it also allows a Box to write multiple (or none) // output tuples. It is expected that the ctx pointer passed in // points to the same Context that was used by the Box tha...
package core // Writer describes an object that tuples can be written to // as the output for a Box. Note that this interface was chosen // because it also allows a Box to write multiple (or none) // output tuples. It is expected that the ctx pointer passed in // points to the same Context that was used by the Box tha...
Add WriterFunc to convert a function to core.Writer
Add WriterFunc to convert a function to core.Writer
Go
mit
sensorbee/sensorbee,sensorbee/sensorbee
e2bd4261796d40a3bb47ce84cb30c72e328c483d
go/anagrams.go
go/anagrams.go
package main import ( "fmt" "os" "strings" ) func main() { word := os.Args[1] if len(os.Args) != 2 { fmt.Println("Exactly one argument is required") os.Exit(1) } s := strings.Split(word, "") generatePermutations(len(word)-1, s) } func generatePermutations(n int, a []string) { if n == 0 { fmt.Println(s...
package main import ( "fmt" "os" "strings" ) func main() { if len(os.Args) != 2 { fmt.Println("Exactly one argument is required") os.Exit(1) } word := os.Args[1] generatePermutations(len(word)-1, strings.Split(word, "")) } func generatePermutations(n int, a []string) { if n == 0 { fmt.Println(strings.J...
Check that there are command line args before accessing
Check that there are command line args before accessing
Go
mit
rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal...
71be56d5afecfb3a4d837203a5b429dd5dd18337
prgs/prgs.go
prgs/prgs.go
package prgs // Prg is a Program, with all its data (no behavior) type prg struct { name string } // Prg defines what kind of service a program has to provide type Prg interface { // Name is the name of a program to install, acts as an id Name() string } // PGetter gets programs (from an internal config) type PGe...
package prgs import "github.com/VonC/senvgo/envs" import "github.com/VonC/senvgo/paths" // Prg is a Program, with all its data (no behavior) type prg struct { name string } // Prg defines what kind of service a program has to provide type Prg interface { // Name is the name of a program to install, acts as an id ...
Add Prgs Get() starts using envs.Prgsenv()
Add Prgs Get() starts using envs.Prgsenv()
Go
mit
VonC/senvgo,VonC/senvgo
993224ed2c05c8589d07f201bfe509d42913e6f2
github/user.go
github/user.go
package github type User struct { Id int `json:"id"` Login string `json:"login"` }
package github type User struct { ID int `json:"id"` Login string `json:"login"` }
Rename Id field to ID
Rename Id field to ID
Go
mit
jaggs6/rebasebot,chrisledet/rebasebot
59efa7609d196dd3e026473172df99dd75be19b1
lib/image/api.go
lib/image/api.go
package image import ( "github.com/Symantec/Dominator/lib/filesystem" "github.com/Symantec/Dominator/lib/filter" "github.com/Symantec/Dominator/lib/triggers" ) type Image struct { Filter *filter.Filter FileSystem *filesystem.FileSystem Triggers *triggers.Triggers }
package image import ( "github.com/Symantec/Dominator/lib/filesystem" "github.com/Symantec/Dominator/lib/filter" "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/lib/triggers" ) type Annotation struct { Object *hash.Hash // These are mutually exclusive. URL string } type Image struct ...
Add ReleaseNotes and BuildLog fields to image.Image.
Add ReleaseNotes and BuildLog fields to image.Image.
Go
apache-2.0
Symantec/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator
4e23fb8503bb991abeaae25cf4849f7b08638cab
web/emergencyshutdown.go
web/emergencyshutdown.go
package web import ( "github.com/control-center/serviced/dao" rest "github.com/zenoss/go-json-rest" ) type EmergencyShutdownRequest struct { Operation int // 0 is emergency shutdown, 1 is clear emergency shutdown status TenantID string } func restEmergencyShutdown(w *rest.ResponseWriter, r *rest.Request, ctx *r...
package web import ( "github.com/control-center/serviced/dao" rest "github.com/zenoss/go-json-rest" ) type EmergencyShutdownRequest struct { Operation int // 0 is emergency shutdown, 1 is clear emergency shutdown status TenantID string } func restEmergencyShutdown(w *rest.ResponseWriter, r *rest.Request, ctx *r...
Update to emergency shutdown endpoint for tests
Update to emergency shutdown endpoint for tests
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
ef0841a2efe46ed2626407e34ec1153c8eedc83c
cmd/mockery/mockery_test.go
cmd/mockery/mockery_test.go
package main import ( "testing" "github.com/stretchr/testify/assert" ) func TestUnderscoreCaseName(t *testing.T) { assert.Equal(t, "notify_event", underscoreCaseName("NotifyEvent")) assert.Equal(t, "repository", underscoreCaseName("Repository")) assert.Equal(t, "http_server", underscoreCaseName("HTTPServer")) ...
package main import ( "testing" "github.com/stretchr/testify/assert" ) func TestUnderscoreCaseName(t *testing.T) { assert.Equal(t, "notify_event", underscoreCaseName("NotifyEvent")) assert.Equal(t, "repository", underscoreCaseName("Repository")) assert.Equal(t, "http_server", underscoreCaseName("HTTPServer")) ...
Add tests around filename function. Leaving bug.
Add tests around filename function. Leaving bug.
Go
bsd-3-clause
tehleach/mockery,vektra/mockery,codeactual/mockery,vektra/mockery
229c2e18633d06d14ad9e9cbb012b75ca69317b2
message_bus.go
message_bus.go
package main import ( "time" ) type Bus struct { queue chan *Message } type Subscriber interface { onMessage(message *Message) error } var MessageBus = &Bus{ queue: make(chan *Message), } func (b Bus) Publish(message *Message) { b.queue <- message } func (b Bus) Subscribe(subscriber Subscriber) { go func() ...
package main import ( "time" ) type Bus struct { queue chan *Message } type Subscriber interface { onMessage(message *Message) error } var MessageBus = &Bus{ queue: make(chan *Message), } func (b Bus) Publish(message *Message) { b.queue <- message } func (b Bus) Subscribe(subscriber Subscriber) { go func() ...
Add URL of API limit doc
Add URL of API limit doc
Go
mit
ackintosh/takosan,kentaro/takosan,dojineko/takosan
29bf0102df0c3c8844ae296826d1a9e7302f26df
number/doc.go
number/doc.go
// Copyright 2017 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. // Package number formats numbers according to the customs of different locales. // // The number formats of this package allow for greater formatting flexibili...
// Copyright 2017 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. // Package number formats numbers according to the customs of different locales. // // The number formats of this package allow for greater formatting flexibili...
Revert "number: match input example to be Dutch as in the output"
Revert "number: match input example to be Dutch as in the output" This reverts commit c2d28a6ddf6cb833e996ccb00cbb4206394958d2. Reason for revert: This change was incorrect. The examples were supposed to demonstrate that the API can provide translations. Change-Id: I247d5509136d34ce4c82a8ac2de50dad3f652a78 Reviewed-...
Go
bsd-3-clause
golang/text
46d79400e1ac5818a81fcbd7794bf38401f3195c
main.go
main.go
package main import ( "flag" "log" "net" "os" "github.com/sirupsen/logrus" ) func main() { configFileName := flag.String("config", "", "config file") flag.Parse() cfg, err := getConfig(*configFileName) if err != nil { log.Fatalln("Failed to get config:", err) } sshServerConfig := cfg.createSSHServerCo...
package main import ( "flag" "log" "net" "os" "github.com/sirupsen/logrus" ) func main() { configFileName := flag.String("config", "", "config file") jsonLogging := flag.Bool("json_logging", false, "enable JSON logging") flag.Parse() cfg, err := getConfig(*configFileName) if err != nil { log.Fatalln("Fa...
Add the -json_logging flag to enable logging in JSON
Add the -json_logging flag to enable logging in JSON
Go
apache-2.0
jaksi/sshesame
1b80d9bec952c3231479cc7ff3fc80a3ea30addb
puddle/cli.go
puddle/cli.go
package puddle import ( "bufio" "fmt" "github.com/nlopes/slack" "os" ) // RunCLI Starts the command line input shell func RunCLI() { fmt.Println("Starting Puddle CLI Input...\n") scanner := bufio.NewScanner(os.Stdin) fmt.Print("Puddle> ") for scanner.Scan() { line := scanner.Text() msg := slack.Msg{ Te...
package puddle import ( "bufio" "fmt" "github.com/nlopes/slack" "os" ) // RunCLI Starts the command line input shell func RunCLI() { fmt.Println("Starting Puddle CLI Input...\n") scanner := bufio.NewScanner(os.Stdin) fmt.Print("Puddle> ") for scanner.Scan() { line := scanner.Text() msg := slack.Msg{ Te...
Fix up comments & delete redundant function
Fix up comments & delete redundant function
Go
mit
perthgophers/puddle,perthgophers/puddle,perthgophers/puddle
25bdefd5a5c5a1d35e1d49d3ff1912451ac128fc
process/plugin/details.go
process/plugin/details.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package plugin import ( "encoding/json" "github.com/juju/errors" ) // LaunchDetails represents information about a process launched by a plugin. type LaunchDetails struct { // ID is a unique string identifying the proces...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package plugin import ( "encoding/json" "github.com/juju/errors" ) // LaunchDetails represents information about a process launched by a plugin. type LaunchDetails struct { // ID is a unique string identifying the proces...
Add a missing doc comment.
Add a missing doc comment.
Go
agpl-3.0
bz2/juju,ericsnowcurrently/juju,mikemccracken/juju,alesstimec/juju,wwitzel3/juju,bz2/juju,AdamIsrael/juju,waigani/juju,kat-co/juju,makyo/juju,mikemccracken/juju,makyo/juju,bac/juju,perrito666/juju,perrito666/juju,mjs/juju,kat-co/juju,ericsnowcurrently/juju,ericsnowcurrently/juju,macgreagoir/juju,dooferlad/juju,mikemccr...
94455aa016c880b914cf6d9a61902014d6c175c6
reader_test.go
reader_test.go
package proof import ( "bytes" "ioutil" "testing" ) func TestCRC(t *testing.T) { data := []byte("Hello, World!") cases := []struct { csum uint32 err error }{ {0xec4ac3d0, nil}, {0xdeadbeef, EHASHFAIL}, } for _, c := range cases { buf := bytes.Buffer(data) h := crc32.NewIEEE() r = NewReader32(b...
package proof import ( "bytes" "hash/crc32" "io/ioutil" "testing" ) func TestCRC(t *testing.T) { data := []byte("Hello, World!") cases := []struct { csum uint32 err error }{ {0xec4ac3d0, nil}, {0xdeadbeef, EHASHFAIL}, } for _, c := range cases { buf := bytes.NewBuffer(data) h := crc32.NewIEEE()...
Fix bugs in test case
Fix bugs in test case
Go
bsd-2-clause
arsatiki/proof
e4c46e36f4edc0b864c3df2fe07ae782aedd6238
exiters.go
exiters.go
// +build linux darwin openbsd freebsd netbsd package main const EXITERS = "EOF (Ctrl-D), or SIGINT (Ctrl-C)"
// +build !windows // +build !plan9 package main const EXITERS = "EOF (Ctrl-D), or SIGINT (Ctrl-C)"
Exclude the different OSes instead of trying to list all the 'normal' ones
Exclude the different OSes instead of trying to list all the 'normal' ones
Go
epl-1.0
candid82/joker,candid82/joker,candid82/joker
a781391752ed7339e8ae7d298aafe1b4ee6be5b9
cursormode.go
cursormode.go
// Copyright 2019 The Ebiten 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...
// Copyright 2019 The Ebiten 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...
Add an explicit type to CursorModeType consts for pkg.go.dev
ebiten: Add an explicit type to CursorModeType consts for pkg.go.dev
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
8cc746de7f9a633ec1314779c965fd56b2184044
reporters/diff_reporter.go
reporters/diff_reporter.go
package reporters import ( "os/exec" "github.com/approvals/go-approval-tests/utils" ) // NewFrontLoadedReporter creates the default front loaded reporter. func NewFrontLoadedReporter() Reporter { return NewFirstWorkingReporter( NewContinuousIntegrationReporter(), ) } // NewDiffReporter creates the default dif...
package reporters import ( "os/exec" "github.com/approvals/go-approval-tests/utils" ) // NewFrontLoadedReporter creates the default front loaded reporter. func NewFrontLoadedReporter() Reporter { return NewFirstWorkingReporter( NewContinuousIntegrationReporter(), ) } // NewDiffReporter creates the default dif...
Add real diff reporter to list of defaults
Add real diff reporter to list of defaults
Go
apache-2.0
approvals/go-approval-tests
8c4d260e7f5ec71bb2ccf787dedc49b30b700261
src/lib/ir/switch_test.go
src/lib/ir/switch_test.go
package ir import ( "testing" "github.com/tisp-lang/tisp/src/lib/core" ) func TestNewSwitch(t *testing.T) { NewSwitch(0, []Case{NewCase(core.Nil, 1)}) } func TestNewSwitchNoPattern(t *testing.T) { defer func() { if r := recover(); r == nil { t.Fail() } }() NewSwitch(0, []Case{}) } func TestSwitchComp...
package ir import ( "testing" "github.com/stretchr/testify/assert" "github.com/tisp-lang/tisp/src/lib/core" ) func TestNewSwitch(t *testing.T) { NewSwitch(0, []Case{NewCase(core.Nil, 1)}) } func TestNewSwitchNoPattern(t *testing.T) { defer func() { if r := recover(); r == nil { t.Fail() } }() NewSwit...
Test switch expression in a function
Test switch expression in a function
Go
mit
raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp
c441b37e8b1f2fbffda6c88f5af3086a7d6b4c26
level_test.go
level_test.go
package logger import ( "fmt" "testing" ) func TestLogLevelString(t *testing.T) { t.Parallel() tests := []struct { lvl LogLevel expected string }{ {Debug, "Debug"}, {Thumb, "Thumb"}, {Info, "Info"}, {Warn, "Warn"}, {Error, "Error"}, {Fatal, "Fatal"}, } for _, test := range tests { got ...
package logger import ( "fmt" "testing" ) func TestLogLevelString(t *testing.T) { t.Parallel() tests := []struct { lvl LogLevel expected string }{ {Debug, "Debug"}, {Thumb, "Thumb"}, {Info, "Info"}, {Warn, "Warn"}, {Error, "Error"}, {Fatal, "Fatal"}, } for _, test := range tests { got,...
Test both LogLevel.String and .Bytes
Test both LogLevel.String and .Bytes
Go
mit
Thomasdezeeuw/logger
5ed6c7d15b285dc3006b9db8bb62fb8fb73ac33c
server/units_resource.go
server/units_resource.go
package server import ( "log" "net/http" "net/url" "github.com/bmorton/deployster/fleet" ) type UnitsResource struct { Fleet fleet.Client } type UnitsResponse struct { Units []VersionedUnit `json:"units"` } func (ur *UnitsResource) Index(u *url.URL, h http.Header, req interface{}) (int, http.Header, *UnitsRe...
package server import ( "log" "net/http" "net/url" "github.com/bmorton/deployster/fleet" ) // UnitsResource is the HTTP resource responsible for getting basic information // on all units that exist for a given service. type UnitsResource struct { Fleet fleet.Client } // UnitsResponse is the wrapper struct for ...
Add documentation for UnitsResource in the server package.
Add documentation for UnitsResource in the server package.
Go
mit
bmorton/deployster
9232b96188407fda25c061d05fb0eadd1848676c
_examples/http-listening/listen-letsencrypt/main.go
_examples/http-listening/listen-letsencrypt/main.go
// Package main provide one-line integration with letsencrypt.org package main import ( "github.com/kataras/iris" "github.com/kataras/iris/context" ) func main() { app := iris.New() app.Get("/", func(ctx context.Context) { ctx.Writef("Hello from SECURE SERVER!") }) app.Get("/test2", func(ctx context.Context...
// Package main provide one-line integration with letsencrypt.org package main import ( "github.com/kataras/iris" "github.com/kataras/iris/context" ) func main() { app := iris.New() app.Get("/", func(ctx context.Context) { ctx.Writef("Hello from SECURE SERVER!") }) app.Get("/test2", func(ctx context.Context...
Update `iris.AutoTLS` example, read description.
Update `iris.AutoTLS` example, read description. Iris devs should declare all the information now, there is no option to "leave something out" anymore, it's for your own good. Version is not changed yet, giving you time to see that changelog and do the necessary changes to your codebase, it will written to HISTORY.md ...
Go
bsd-3-clause
kataras/gapi,kataras/iris,kataras/iris,kataras/iris,kataras/gapi,kataras/iris
b63f2273d15509238a4665db0acb1f2c76f8b24f
go/src/test_service/test_serviced/main.go
go/src/test_service/test_serviced/main.go
// Command test_serviced is an implementation of the test_service service. package main import ( "fmt" "log" "veyron.io/veyron/veyron/lib/signals" _ "veyron.io/veyron/veyron/profiles" "veyron.io/veyron/veyron2/rt" ) func main() { // Create the runtime r := rt.Init() defer r.Cleanup() s, endpoint, err := St...
// Command test_serviced is an implementation of the test_service service. package main import ( "fmt" "log" "veyron.io/veyron/veyron/lib/signals" _ "veyron.io/veyron/veyron/profiles" "veyron.io/veyron/veyron2/rt" ) func main() { // Create the runtime r := rt.Init() defer r.Cleanup() s, endpoint, err := St...
Add runtime arg to ShutdownOnSignals.
veyron.js: Add runtime arg to ShutdownOnSignals. Change-Id: Ib773c40e7cb7f7c5df3b5cf5fea73a03dd709cb5
Go
bsd-3-clause
vanadium/js,vanadium/js,vanadium/js,vanadium/js
f22f47badaffa9d94aa74c82f653562f4565b9a2
pkg/slinga/server/server.go
pkg/slinga/server/server.go
package server import ( "fmt" "github.com/Frostman/aptomi/pkg/slinga" "net/http" ) func endpointsHandler(w http.ResponseWriter, r *http.Request) { // Load the previous usage state state := slinga.LoadServiceUsageState() endpoints := state.Endpoints() writeJSON(w, endpoints) } func Serve(host string, port in...
package server import ( "fmt" "github.com/Frostman/aptomi/pkg/slinga" "net/http" ) func endpointsHandler(w http.ResponseWriter, r *http.Request) { // Load the previous usage state state := slinga.LoadServiceUsageState() endpoints := state.Endpoints() writeJSON(w, endpoints) } // Serve starts http server on ...
Fix warning from go lint
Fix warning from go lint
Go
apache-2.0
Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi
12fb313a21a42b5658b855dcada19f02ba1e5830
pkg/manager/grpc_client.go
pkg/manager/grpc_client.go
// Copyright 2018 The OpenPitrix Authors. All rights reserved. // Use of this source code is governed by a Apache license // that can be found in the LICENSE file. package manager import ( "context" "fmt" "google.golang.org/grpc" "openpitrix.io/openpitrix/pkg/logger" ) func NewClient(ctx context.Context, host ...
// Copyright 2018 The OpenPitrix Authors. All rights reserved. // Use of this source code is governed by a Apache license // that can be found in the LICENSE file. package manager import ( "context" "fmt" "time" "google.golang.org/grpc" "google.golang.org/grpc/keepalive" "openpitrix.io/openpitrix/pkg/logger" ...
Optimize gRPC connection keepalive between services
Optimize gRPC connection keepalive between services
Go
apache-2.0
openpitrix/openpitrix,openpitrix/openpitrix,openpitrix/openpitrix
e0f69f17369f6abf54fca972da3271eb6dcf687e
run/repeat.go
run/repeat.go
package run import ( "gopkg.in/workanator/go-floc.v2" ) const locRepeat = "Repeat" /* Repeat repeats running jobs for N times. Jobs start sequentially. Summary: - Run jobs in goroutines : NO - Wait all jobs finish : YES - Run order : SEQUENCE Diagram: NO +----------...
package run import ( "gopkg.in/workanator/go-floc.v2" ) const locRepeat = "Repeat" /* Repeat repeats running the job for N times. Summary: - Run jobs in goroutines : NO - Wait all jobs finish : YES - Run order : SEQUENCE Diagram: NO +-----------[JOB]<---------+ ...
Change parameter name and fix comment
Change parameter name and fix comment
Go
mit
workanator/go-floc
43717a41825746fcab9e5d6861ee1244b25718b5
backend/commons/commons.go
backend/commons/commons.go
package commons import ( "math/rand" "strconv" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } func GetUID() string { s := 6 return randomString(s) } func randomString(l int) string { r := strconv.Itoa(rand.Intn(10000)) bytes := make([]byte, l) for i := 0; i < l; i++ { bytes[i] = byte(randInt(...
package commons import ( "math/rand" "strconv" "time" "net/http" "log" ) func init() { rand.Seed(time.Now().UnixNano()) } func GetUID() string { s := 6 return randomString(s) } func randomString(l int) string { r := strconv.Itoa(rand.Intn(10000)) bytes := make([]byte, l) for i := 0; i < l; i++ { bytes...
Make WriteResponseWithError and Check(err) common
[Improve] Make WriteResponseWithError and Check(err) common
Go
mit
Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL
d6c661c61f14aef2bd6a39ed5eb7bd81ee3c59c4
cluster-autoscaler/version.go
cluster-autoscaler/version.go
/* 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 agreed to in writing, ...
/* 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 agreed to in writing, ...
Mark Cluster Autoscaler as GA (1.0.0)
Mark Cluster Autoscaler as GA (1.0.0)
Go
apache-2.0
mmerrill3/autoscaler,kgrygiel/autoscaler,kubernetes/autoscaler,bskiba/autoscaler,bskiba/autoscaler,aleksandra-malinowska/autoscaler,kubernetes/autoscaler,KarolKraskiewicz/autoscaler,mmerrill3/autoscaler,KarolKraskiewicz/autoscaler,kubernetes/autoscaler,kgrygiel/autoscaler,KarolKraskiewicz/autoscaler,kgrygiel/autoscaler...
46688a6f88fdf54ed64b0669386cda3024c080c7
action/catalog_services.go
action/catalog_services.go
package action import ( "flag" ) type catalogServices struct { *config } func CatalogServicesAction() Action { return &catalogServices{ config: &gConfig, } } func (c *catalogServices) CommandFlags() *flag.FlagSet { return newFlagSet() } // addDatacenterOption(cmd) // addTemplateOption(cmd) // addConsistency...
package action import ( "flag" ) type catalogServices struct { *config } func CatalogServicesAction() Action { return &catalogServices{ config: &gConfig, } } func (c *catalogServices) CommandFlags() *flag.FlagSet { f := newFlagSet() c.addDatacenterFlag(f) c.addOutputFlags(f, false) c.addConsistencyFlags(...
Fix catalog services command line flags
Fix catalog services command line flags
Go
apache-2.0
CiscoCloud/consul-cli,mantl/consul-cli,mantl/consul-cli
7df4b2578b1da6aa0d833a7930211c43ae1c972d
cmd/hr/main.go
cmd/hr/main.go
package main import "github.com/hasit/gohr" func main() { gohr.DrawHr("-0-") gohr.DrawHr("-", "#") gohr.DrawHr(".", "\\", "/") }
package main import ( "os" "github.com/hasit/gohr" ) func main() { args := os.Args[1:] gohr.Draw(args...) }
Complete tool to match LuRsT/hr
Complete tool to match LuRsT/hr
Go
mit
hasit/gohr
bb62f72e4363f9a364b0c83488d71bfa2be59b19
src/lib/core/function.go
src/lib/core/function.go
package core import "github.com/tisp-lang/tisp/src/lib/systemt" type functionType struct { signature Signature function func(...*Thunk) Value } func (f functionType) call(args Arguments) Value { ts, err := f.signature.Bind(args) if err != nil { return err } return f.function(ts...) } // NewLazyFunction c...
package core import "github.com/tisp-lang/tisp/src/lib/systemt" type functionType struct { signature Signature function func(...*Thunk) Value } func (f functionType) call(args Arguments) Value { ts, err := f.signature.Bind(args) if err != nil { return err } return f.function(ts...) } // NewLazyFunction c...
Fix wrong use of loop variables
Fix wrong use of loop variables
Go
mit
tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp
b5067c6d5701fe5081f4c5258cfd3926446e039f
screen/terminal/terminal.go
screen/terminal/terminal.go
package terminal import ( "bytes" "io" "strconv" "github.com/mattn/go-runewidth" ) type Terminal struct { w io.Writer buf *bytes.Buffer msg string } func New(w io.Writer) *Terminal { return &Terminal{ w: w, buf: bytes.NewBuffer(make([]byte, 0, 32)), } } func (t *Terminal) Refresh(prompt string, s ...
package terminal import ( "bufio" "io" "strconv" "github.com/mattn/go-runewidth" ) type Terminal struct { w *bufio.Writer msg string } func New(w io.Writer) *Terminal { return &Terminal{ w: bufio.NewWriterSize(w, 32), } } func (t *Terminal) Refresh(prompt string, s []rune, pos int) { t.w.WriteString("...
Use bufio.Writer instead of io.Writer & bytes.Buffer
Use bufio.Writer instead of io.Writer & bytes.Buffer name old time/op new time/op delta Terminal-4 1.69µs ± 2% 1.64µs ± 1% -2.69% (p=0.000 n=9+10)
Go
mit
elpinal/coco3
14496a7fed1e9ef222ec25a39574eb03e05e6c55
src/github.com/getlantern/launcher/launcher_windows.go
src/github.com/getlantern/launcher/launcher_windows.go
// Package launcher configures Lantern to run on system start package launcher import ( "github.com/kardianos/osext" "github.com/luisiturrios/gowin" "github.com/getlantern/golog" ) const ( runDir = `Software\Microsoft\Windows\CurrentVersion\Run` ) var ( log = golog.LoggerFor("launcher") ) func CreateLaunchFil...
// Package launcher configures Lantern to run on system start package launcher import ( "fmt" "github.com/kardianos/osext" "github.com/luisiturrios/gowin" "github.com/getlantern/golog" ) const ( runDir = `Software\Microsoft\Windows\CurrentVersion\Run` ) var ( log = golog.LoggerFor("launcher") ) func CreateLa...
Use either -startup or -clear-proxy-settings on the Lantern HKCU/.../CurrentVersion/Run registry key.
Use either -startup or -clear-proxy-settings on the Lantern HKCU/.../CurrentVersion/Run registry key.
Go
apache-2.0
pialin/lantern,dodopeng/lantern,imcoddy/lantern,ykelvis/lantern,nuan-nuan/lantern,MinFu/lantern,Batterfii/lantern,TNTest/lantern,kmingee/lantern,ubuntuvim/lantern,hhua/lantern,nikedog/lantern,abhishekgahlot/lantern,fsxchen/lantern,blindlf/lantern,lfckop/lantern,wangdongming007/lantern,Denniskevin/lantern,ywzw2013/lante...
376e150ab4de7365232b447e3333080047a3d17c
controller/examples/config.go
controller/examples/config.go
package main import ( "fmt" "io" "os" ) type config struct { controllerKey string ourPort string logOut io.Writer } func loadConfigFromEnv() (*config, error) { c := &config{} c.controllerKey = os.Getenv("CONTROLLER_KEY") if c.controllerKey == "" { return nil, fmt.Errorf("CONTROLLER_KEY is req...
package main import ( "fmt" "io" "log" "os" ) type config struct { controllerKey string ourPort string logOut io.Writer } func init() { log.SetFlags(log.Lshortfile | log.Lmicroseconds) } func loadConfigFromEnv() (*config, error) { c := &config{} c.controllerKey = os.Getenv("CONTROLLER_KEY") ...
Add file/line to log messages
controller/examples: Add file/line to log messages Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>
Go
bsd-3-clause
tonicbupt/flynn,flynn/flynn,kgrz/flynn,GrimDerp/flynn,kgrz/flynn,felixrieseberg/flynn,josephglanville/flynn,ozum/flynn,lmars/flynn,jzila/flynn,jzila/flynn,shads196770/flynn,benbjohnson/flynn,josephglanville/flynn,whouses/flynn,ozum/flynn,arekkas/flynn,clifff/flynn,TribeMedia/flynn,TribeMedia/flynn,supermario/flynn,Trib...
356ee8aa443df281beb8889eb7b97f05c87ebc8b
cmd/word-server/main.go
cmd/word-server/main.go
/* word-server creates an HTTP server which exports endpoints for querying a word2vec model. */ package main import ( "flag" "fmt" "log" "net/http" "os" "github.com/sajari/word2vec" ) var listen, modelPath string func init() { flag.StringVar(&listen, "listen", "localhost:1234", "bind `address` for HTTP serve...
/* word-server creates an HTTP server which exports endpoints for querying a word2vec model. */ package main import ( "flag" "fmt" "log" "net/http" "os" "github.com/sajari/word2vec" ) var listen, modelPath string func init() { flag.StringVar(&listen, "listen", "localhost:1234", "bind `address` for HTTP serve...
Update help message to use -model.
Update help message to use -model.
Go
mit
sajari/word2vec
3314043096c6a1d72f4484e8a98e6d0f039b3562
create_issue.go
create_issue.go
package main import ( "encoding/json" "log" "net/http" "time" "github.com/go-martini/martini" ) // CreateIssueType ... type CreateIssueType struct { Title string `json:"title"` Body string `json:"body"` Org string `json:"owner"` Repo string `json:"repo"` } // CreateIssueMsg ... type CreateIssueMsg stru...
package main import ( "encoding/json" "net/http" "github.com/go-martini/martini" "github.com/supu-io/messages" ) // CreateAttr json to create an issue type CreateAttr struct { Title string `json:"title"` Body string `json:"body"` Org string `json:"org"` Repo string `json:"repo"` } // CreateIssue is the ...
Use messages library on issues.create
Use messages library on issues.create
Go
mit
supu-io/api
6a1221968544358a98b106045d83e915abd34575
sigchld.go
sigchld.go
package main import ( "os" "os/signal" "syscall" ) func sigChld() { var sigs = make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGCHLD) for { select { case <-sigs: go reap() default: } } } func reap() { var wstatus syscall.WaitStatus pid, err := syscall.Wait4(-1, &wstatus, 0, nil) switch ...
package main import ( "os" "os/signal" "syscall" ) func sigChld() { var sigs = make(chan os.Signal, 10) // TODO(miek): buffered channel to fix races? signal.Notify(sigs, syscall.SIGCHLD) for { select { case <-sigs: go reap() } } } func reap() { var wstatus syscall.WaitStatus pid, err := syscall.W...
Remove default and increase channel size
Remove default and increase channel size
Go
bsd-3-clause
miekg/dinit
0f81fc87f193ce12bf44bdbef149514ced6ad36e
user_parser/user_parser.go
user_parser/user_parser.go
package user_parser import ( "log" "os" ) func ParseUsername() ([]string, error) { args := os.Args if len(args) < 1 { log.Fatal("Please supply at least one GitHub username") } // username := args[0] // return username, nil return args, nil }
package user_parser import ( "log" "os" ) // ParseUsername returns an array of user strings or an error if no arguments provided func ParseUsername() ([]string, error) { args := os.Args if len(args) < 1 { log.Fatal("Please supply at least one GitHub username") } return args, nil }
Add comment, remove dead code
Add comment, remove dead code
Go
mit
seanknox/git-pair,seanknox/git-pair
d76b903aa47b1256f210390b0911a17af06aebb6
fbmessenger_suite_test.go
fbmessenger_suite_test.go
package fbmessenger_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/ginkgo/reporters" "testing" "os" "path/filepath" ) func TestWebhooks(t *testing.T) { RegisterFailHandler(Fail) testReportsPath, _ := filepath.Abs("./test-reports") os.MkdirAll(testReportsPath, 0777) ju...
package fbmessenger_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/ginkgo/reporters" "testing" "os" "path/filepath" ) func TestWebhooks(t *testing.T) { RegisterFailHandler(Fail) testReportsPath, _ := filepath.Abs("./test-reports") os.MkdirAll(testReportsPath, 0777) ju...
Change the test report file name.
Change the test report file name.
Go
mit
ekyoung/fbmessenger
09a6ffcca93aae97689c401de2fab6289a2c82ba
queue.go
queue.go
package queue import ( "time" "golang.org/x/time/rate" ) type Storager interface { Exists(key string) bool } type Limiter interface { AllowRate(name string, limit rate.Limit) (delay time.Duration, allow bool) } type Queuer interface { Name() string Add(msg *Message) error Call(args ...interface{}) error Ad...
package queue import ( "time" "golang.org/x/time/rate" ) type Storager interface { Exists(key string) bool } type Limiter interface { AllowRate(name string, limit rate.Limit) (delay time.Duration, allow bool) } type Queuer interface { Name() string Add(msg *Message) error Call(args ...interface{}) error Ca...
Add missing methods to interface.
Add missing methods to interface.
Go
bsd-2-clause
go-msgqueue/msgqueue
73b613edfc38d760bd8891f6b77dcfe6892d2f8c
worker/util.go
worker/util.go
package worker import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs" ) // NewSQSClient returns a SQS Client and a Queue URL for you you to connect to func NewSQSClient(queueName string) (*sqs.SQS, string) { sess, err := session.NewSession(...
package worker import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs" ) // NewSQSClient returns a SQS Client and a Queue URL for you you to connect to func NewSQSClient(queueName string, cfgs ...*aws.Config) (*sqs.SQS, string) { sess, err :...
Add the ability to pass in the an aws.Config object when creating a NewSQSClient
Add the ability to pass in the an aws.Config object when creating a NewSQSClient
Go
mit
h2ik/go-sqs-poller
a550ddca9302f2009037648cfaec5e04be2b55c4
src/simplejsondb/dbio/data_block.go
src/simplejsondb/dbio/data_block.go
package dbio import ( "fmt" ) type DataBlock struct { ID uint16 Data []byte } func (db *DataBlock) ReadUint16(startingAt int) uint16 { return DatablockByteOrder.Uint16(db.Data[startingAt : startingAt+2]) } func (db *DataBlock) ReadUint32(startingAt int) uint32 { return DatablockByteOrder.Uint32(db.Data[start...
package dbio import ( "fmt" ) type DataBlock struct { ID uint16 Data []byte } func (db *DataBlock) ReadUint8(startingAt int) uint8 { return uint8(db.Data[startingAt]) } func (db *DataBlock) ReadUint16(startingAt int) uint16 { return DatablockByteOrder.Uint16(db.Data[startingAt : startingAt+2]) } func (db *D...
Add support for reading / writing uint8 from blocks (AKA a single byte, methods was introduced for consistency)
Add support for reading / writing uint8 from blocks (AKA a single byte, methods was introduced for consistency)
Go
mit
fgrehm/pucrs-metadata-db,fgrehm/pucrs-simple-json-db
73eead127a02f4073b35c21c2454caf15ef43824
tool/xtab/tmpl_data_user.go
tool/xtab/tmpl_data_user.go
// Copyright 2014 The goyy Authors. 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 var tmplDataUser = ` insert into {{case "SYS_USER (ID, NAME, CODE, PASSWD, GENRE, EMAIL, TEL, MOBILE, AREA_ID, ORG_ID, LOGIN_NAME, LOGIN_IP, LO...
// Copyright 2014 The goyy Authors. 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 var tmplDataUser = ` insert into {{case "SYS_USER (ID, NAME, CODE, PASSWD, GENRE, EMAIL, TEL, MOBILE, AREA_ID, ORG_ID, DIMISSION_TIME, FREEZE_T...
Add support to new project on xgen
Add support to new project on xgen
Go
mit
goyy/goyy,goyy/goyy,goyy/goyy,goyy/goyy
01f5f2a41fb22de3b0c4329754682af46d303ffc
drivers/amazon/utils.go
drivers/amazon/utils.go
// Copyright 2015 The Cockroach 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 ag...
// Copyright 2015 The Cockroach 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 ag...
Fix use of AWS library
Fix use of AWS library
Go
apache-2.0
bdarnell/cockroach-prod
09ab10250b455db8c7b017f7f19c4c3f5b67050b
test/bugs/bug126.go
test/bugs/bug126.go
// errchk $G $D/$F.go // Copyright 2009 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. package main const none = 0 // same const identifier declared twice should not be accepted const none = 1 // ERROR "redeclared"
// errchk $G $D/$F.go // Copyright 2009 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. package main // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1 //...
Tweak comments so that this test passes with gccgo.
Tweak comments so that this test passes with gccgo. bug126.go:7:7: error: redefinition of 'none' bug126.go:6:7: note: previous definition of 'none' was here R=gri DELTA=3 (1 added, 0 deleted, 2 changed) OCL=20563 CL=20723
Go
bsd-3-clause
pombredanne/go-deleteme,tianon/debian-golang,gnanderson/go,nightlyone/golang,wesolows/golang,firebitsbr/golang-old,bdwalton/debian-golang,wesolows/golang,tv42/old-go,bdwalton/debian-golang,gnanderson/go,wesolows/golang,dsriram/golang,gnanderson/go,wesolows/golang,wesolows/golang-old,apparentlymart/golang,wesolows/golan...
7d83e25ab4ca4428438f39a50a6474bdf81a7901
network/interface_test.go
network/interface_test.go
package network import ( "net" "testing" ) func TestDeviceCreate(t *testing.T) { iface := "tun0" _, err := CreateTunInterface(iface) if err != nil { t.Error(err) } } func TestCreateDeviceWithIpAddr(t *testing.T) { iface := "tun0" IpAddr := "10.0.0.1/24" _, err := CreateTunInterfaceWithIp(iface, IpAddr) i...
package network import ( "net" "strings" "testing" ) func TestDeviceCreate(t *testing.T) { iface := "tun0" _, err := CreateTunInterface(iface) if err != nil { t.Error(err) } niface, err := net.InterfaceByName(iface) if err != nil { t.Error(err) } if !strings.Contains(niface.Flags.String(), "up") { t....
Test if we create interface with UP status
Test if we create interface with UP status
Go
apache-2.0
meshbird/meshbird
bebebb1e317e272e982e6b9a892e4eafdcfdabed
apis/v1alpha1/constants.go
apis/v1alpha1/constants.go
package v1alpha1 import "time" const ( RoleMaster = "master" RoleNode = "node" RoleKeyPrefix = "node-role.kubernetes.io/" RoleMasterKey = RoleKeyPrefix + RoleMaster RoleNodeKey = RoleKeyPrefix + RoleNode KubeadmVersionKey = "cloud.appscode.com/kubeadm-version" NodePoolKey = "cloud.appscode.com...
package v1alpha1 import "time" const ( RoleMaster = "master" RoleNode = "node" RoleKeyPrefix = "node-role.kubernetes.io/" RoleMasterKey = RoleKeyPrefix + RoleMaster RoleNodeKey = RoleKeyPrefix + RoleNode KubeadmVersionKey = "cloud.appscode.com/kubeadm-version" NodePoolKey = "cloud.appscode.com...
Update admission controller list order
Update admission controller list order
Go
apache-2.0
appscode/pharmer,appscode/pharmer,appscode/pharmer,appscode/pharmer
7b1a0575a66f7112cfd67b3df0a0020a5d98573b
fiddle/go/config/config.go
fiddle/go/config/config.go
package config import "go.skia.org/infra/go/buildskia" const ( // BUILD_TYPE is the type of build we use throughout fiddle. BUILD_TYPE = buildskia.RELEASE_BUILD ) var ( // GN_FLAGS are the flags to pass to GN. GN_FLAGS = []string{"is_debug=false", "skia_use_egl=true", "extra_cflags_cc=[\"-Wno-error\" \"-DEGL_NO_...
package config import "go.skia.org/infra/go/buildskia" const ( // BUILD_TYPE is the type of build we use throughout fiddle. BUILD_TYPE = buildskia.RELEASE_BUILD ) var ( // GN_FLAGS are the flags to pass to GN. GN_FLAGS = []string{"is_debug=false", "skia_use_egl=true", "extra_cflags_cc=[\"-Wno-error\"]"} // EGL...
Revert "[fiddle] Add flag to work around the GL calls in CreatePlatformGLTestContext_egl.cpp."
Revert "[fiddle] Add flag to work around the GL calls in CreatePlatformGLTestContext_egl.cpp." This reverts commit 8d1aa53fd920b6c8c879f4979c153c98c229e72b. Reason for revert: Crashes on run. Original change's description: > [fiddle] Add flag to work around the GL calls in CreatePlatformGLTestContext_egl.cpp. > > B...
Go
bsd-3-clause
google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot
f49c8b100116e7051165cc9e5324a87cb571824d
bot/waitquit.go
bot/waitquit.go
package bot // Handle SIGINT and SIGTERM with a graceful shutdown import ( "fmt" "os" "os/signal" "syscall" "time" ) func init() { sigs := make(chan os.Signal, 1) // `signal.Notify` registers the given channel to // receive notifications of the specified signals. signal.Notify(sigs, syscall.SIGINT, syscall...
package bot // Handle SIGINT and SIGTERM with a graceful shutdown import ( "fmt" "os" "os/signal" "syscall" "time" ) func init() { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) go func() { sig := <-sigs shutdownMutex.Lock() shuttingDown = true shutdownMutex.Un...
Remove bogus comments from sample code
Remove bogus comments from sample code
Go
mit
parsley42/gopherbot,uva-its/gopherbot,uva-its/gopherbot,uva-its/gopherbot,parsley42/gopherbot,uva-its/gopherbot,parsley42/gopherbot,parsley42/gopherbot
ab410f4943fca756da19a3eb86ad94d999ae2167
testhelpers/io/io_test.go
testhelpers/io/io_test.go
package io_test import ( "os" "strings" . "github.com/cloudfoundry/cli/testhelpers/io" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("io helpers", func() { It("will never overflow the pipe", func() { characters := make([]string, 0, 75000) for i := 0; i < 75000; i++ { character...
package io_test import ( "os" "strings" . "github.com/cloudfoundry/cli/testhelpers/io" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("io helpers", func() { It("will never overflow the pipe", func() { str := strings.Repeat("z", 75000) output := CaptureOutput(func() { os.Stdout....
Speed up this test by a factor of a little bit more
Speed up this test by a factor of a little bit more Shoutout to @fraenkel for suggesting this stdlib function that's wicked fast. Turns out that byte slices are ... really fast. Who knew??? Also, for interested parties :: this test just went from 0.003 seconds to 0.001 seconds.
Go
apache-2.0
diatmpravin/cli,ReachingOut/cli,HuaweiTech/cli,ReachingOut/cli,cgvarela/cli,18F/cli,xingzhou/cli,saravana76/cli,simonleung8/cli,AmitRoushan/cli,hyenaspots/cli,hyenaspots/cli,EngineerBetter/cli,evanfarrar/cli,SrinivasChilveri/cli,diatmpravin/cli,diatmpravin/cli,TomG713/cli,HuaweiTech/cli,cgvarela/cli,pishro-cc/cli,Engin...
659b15e37a9111074e9b0ec008b989912ec4dafe
models/desire_app_messages.go
models/desire_app_messages.go
package models import "encoding/json" type DesireAppRequestFromCC struct { AppId string `json:"app_id"` AppVersion string `json:"app_version"` DropletUri string `json:"droplet_uri"` Stack string `json:"stack"` StartCommand ...
package models import "encoding/json" type DesireAppRequestFromCC struct { ProcessGuid string `json:"process_guid"` DropletUri string `json:"droplet_uri"` Stack string `json:"stack"` StartCommand string `json:"start_command"` Envir...
Change NATS desire app message format.
Change NATS desire app message format. Signed-off-by: Momchil Atanasov <32dfc64aa82b4a16510185529922b8f0a0c3fedb@gmail.com>
Go
apache-2.0
cloudfoundry-incubator/runtime-schema
e42125b3b8f6b51d24f1a5cacf3f44f76f75ea56
pkg/errors/example_test.go
pkg/errors/example_test.go
package errors_test import ( "fmt" "github.com/vardius/go-api-boilerplate/pkg/errors" ) func ExampleNew() { err := errors.New("example") fmt.Printf("%s\n", err) } func ExampleWrap() { subErr := errors.New("example") err := errors.Wrap(subErr) fmt.Printf("%s\n", err) }
package errors_test import ( "fmt" "github.com/vardius/go-api-boilerplate/pkg/errors" ) func ExampleNew() { err := errors.New("example") fmt.Printf("%s\n", err) // Output: // example: // /home/travis/gopath/src/github.com/vardius/go-api-boilerplate/pkg/errors/example_test.go:10 } func ExampleWrap() { sub...
Fix example tests for travis
Fix example tests for travis
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
d1d27cccd1df27afc49874cc9408e301dc94f971
goslow.go
goslow.go
// goslow is a slow HTTP server that responds with errors. // Visit https://github.com/alexandershov/goslow for more details. package main import ( "log" "runtime" ) // main starts a slow HTTP server that responds with errors. func main() { // GOMAXPROCS call is ignored if NumCPU returns 1 (GOMAXPROCS(0) doesn't c...
// goslow is a slow HTTP server that responds with errors. // Visit https://github.com/alexandershov/goslow for more details. package main import ( "log" "runtime" ) // main starts a server. func main() { useSeveralCPU() config := NewConfigFromArgs() server := NewServer(config) log.Fatal(server.ListenAndServe...
Move parallelism decision to a separate function
Move parallelism decision to a separate function
Go
mit
alexandershov/goslow,alexandershov/goslow
b680299ebed34d40f038ff46dc5da650cb8594b3
helper.go
helper.go
package machineid import ( "crypto/hmac" "crypto/sha256" "fmt" "io" "os" "os/exec" ) // run wraps `exec.Command` with easy access to stdout and stderr. func run(stdout, stderr io.Writer, cmd string, args ...string) error { c := exec.Command(cmd, args...) c.Stdin = os.Stdin c.Stdout = stdout c.Stderr = stder...
package machineid import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "io" "os" "os/exec" ) // run wraps `exec.Command` with easy access to stdout and stderr. func run(stdout, stderr io.Writer, cmd string, args ...string) error { c := exec.Command(cmd, args...) c.Stdin = os.Stdin c.Stdout = stdout c.Stder...
Make output encoding more specific by using hex encoding.
Make output encoding more specific by using hex encoding.
Go
mit
denisbrodbeck/machineid
e1703c078b1f27f02645a8dc0282abb6087013b3
srpc/marshal-unmarshal.go
srpc/marshal-unmarshal.go
/* For license and copyright information please see LEGAL file in repository */ package srpc import "../syllab" /* ********************PAY ATTENTION:******************* We don't suggest use these 2 func instead use chaparkhane to autogenerate needed code before compile time and reduce runtime proccess to improve ...
/* For license and copyright information please see LEGAL file in repository */ package srpc import "../syllab" /* ********************PAY ATTENTION:******************* We don't suggest use these 2 func instead use chaparkhane to autogenerate needed code before compile time and reduce runtime proccess to improve ...
Fix logic and typo in sRPC
Fix logic and typo in sRPC
Go
apache-2.0
SabzCity/Go-Library
4bdbbf96cfc2ebdd95785d714e614af409df6bed
numbers_test.go
numbers_test.go
package numbers import ( "errors" "reflect" "testing" ) // TestFactorsList unit test FactorsList function. func TestFactorsList(t *testing.T) { testCases := []struct { input int expected []int err error }{ {2, []int{2}, nil}, {15, []int{3, 5}, nil}, {26, []int{2, 13}, nil}, {37, []int{37}, ...
package numbers import ( "errors" "reflect" "testing" ) // TestFactorsList unit test FactorsList function. func TestFactorsList(t *testing.T) { testCases := []struct { input int expected []int err error }{ {2, []int{2}, nil}, {15, []int{3, 5}, nil}, {26, []int{2, 13}, nil}, {37, []int{37}, ...
Add benchmark test for FactorsList function
Add benchmark test for FactorsList function
Go
mit
alesr/numbers
51870c87146b68ef2184494b0617118468871481
enforcer.go
enforcer.go
package main import ( "os" "fmt" ) func main() { oauth_key := os.Getenv("BITBUCKET_ENFORCER_KEY") oauth_pass := os.Getenv("BITBUCKET_ENFORCER_PASS") fmt.Println("key:", oauth_key) fmt.Println("pass:", oauth_pass) }
package main import ( "os" "fmt" "io/ioutil" "log" "encoding/json" "flag" ) type RepositorySettings struct { LandingPage string // TODO unmarshal into enum like type Private bool MainBranch string Forks string // TODO: Unmarshal 'forks' into an enum like type DeployKeys []struct { Name strin...
Add struct that should represent the repo setting JSON format
Add struct that should represent the repo setting JSON format
Go
mit
jumoel/bitbucket-enforcer
fe1acb3930164d1002bfd84cfe4682d6b24a38f6
logger.go
logger.go
package logger import ( "os" "strconv" "github.com/Sirupsen/logrus" "github.com/polds/logrus/hooks/papertrail" ) var __l *logrus.Logger // Logger returns an instance of // a logger or creates a new one. func Logger() *logrus.Logger { if __l == nil { __l = NewLogger() } return __l } // NewLogger creates a...
package logger import ( "os" "strconv" "github.com/Sirupsen/logrus" "github.com/polds/logrus/hooks/papertrail" ) var __l *logrus.Logger type Config struct { Appname string Host string Port int *logrus.Logger } // Logger returns an instance of // a logger or creates a new one. func Logger() *logrus.L...
Add a "New()" function that allows for custom conf
Add a "New()" function that allows for custom conf Signed-off-by: Peter Olds <f516c8e349fcaee4098dbef1ab3f4b8dc00e321e@kyanicorp.com>
Go
mit
kyani-inc/logger
9334c8db212d2f96fe2783d870b9bc8929cac575
util/normalizename_test.go
util/normalizename_test.go
package util import ( "testing" ) func TestNormalizeName(t *testing.T) { packages := map[string]string{ "github.com/Masterminds/cookoo/web/io/foo": "github.com/Masterminds/cookoo", `github.com\Masterminds\cookoo\web\io\foo`: "github.com/Masterminds/cookoo", "golang.org/x/crypto/ssh": "golang....
package util import ( "testing" ) func TestNormalizeName(t *testing.T) { packages := []struct { input string root string extra string }{ { input: "github.com/Masterminds/cookoo/web/io/foo", root: "github.com/Masterminds/cookoo", extra: "web/io/foo", }, { input: `github.com\Masterminds\coo...
Rewrite test so it tests the right thing.
Rewrite test so it tests the right thing. Since both return values are now checked explicitly, remove check that the concatinated package path matches the original input, since it won't always (the point of this function is to normalize input).
Go
mit
avvmoto/glide,franciscocpg/glide,cmars/tools,cmars/tools,franciscocpg/glide,avvmoto/glide,cmars/tools,cmars/tools
5be1bb8184a70273850a1321e16459da29db69f9
hpack/header.go
hpack/header.go
package hpack // TODO: headers of arbitrary length with integer encoding algorithm // TODO: hpack test cases https://github.com/http2jp/hpack-test-case func Decode(headers string, table *HeaderTable) ([]HeaderField, int) { var decodedHeaders []HeaderField return decodedHeaders, 0 }
package hpack func Decode(headers string, table *HeaderTable) ([]HeaderField, int) { var decodedHeaders []HeaderField return decodedHeaders, 0 }
Remove TODOs that have been done or moved to Github issues
Remove TODOs that have been done or moved to Github issues
Go
mit
tildedave/go-hpack-impl,tildedave/go-http2-impl
4c03fe8513893c27815430a9ff4ef1c3abad8236
server.go
server.go
// Copyright 2016 Marcel Gotsch. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package goserv import ( "net/http" ) type TLS struct { CertFile, KeyFile string } type Server struct { *Router Addr string TLS *TLS } func (s *Server) ...
// Copyright 2016 Marcel Gotsch. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package goserv import ( "net/http" ) type TLS struct { CertFile, KeyFile string } type Server struct { *Router Addr string TLS *TLS } func (s *Server) ...
Use Request and ResponseWriter creators in Server
Use Request and ResponseWriter creators in Server
Go
bsd-3-clause
gotschmarcel/goserv
1de96bcca4b036775e0bad3f71a79379bd0b2751
filters/FilterSkeleton.go
filters/FilterSkeleton.go
// Copyright (c) 2010 AFP Authors // This source code is released under the terms of the // MIT license. Please see the file LICENSE for license details. //This is not a legal Go program, rather it provides a skeletal //filter to serve as a minimal base for developing filters. package <packagename> import ( "afp" ...
// Copyright (c) 2010 AFP Authors // This source code is released under the terms of the // MIT license. Please see the file LICENSE for license details. //This is not a legal Go program, rather it provides a skeletal //filter to serve as a minimal base for developing filters. package <packagename> import ( "afp" ...
Make flag parsing example a bit more idiomatic
Make flag parsing example a bit more idiomatic
Go
mit
jesusaurus/afp,jesusaurus/afp,jesusaurus/afp,jesusaurus/afp
e68fc68fc4427e636879e569dc8946675982f04a
doc.go
doc.go
/* jwthelper is a Golang package that provides JWT(JSON Web Token) functions based on jwt-go. */ package jwthelper
/* Package jwthelper is a Golang package that provides JWT(JSON Web Token) functions based on jwt-go. */ package jwthelper
Insert 'Package' before package description to remove golint warnings.
Insert 'Package' before package description to remove golint warnings.
Go
mit
northbright/jwthelper
8368e64133213c5406b4d3a82a16f777096b6723
utils/utils.go
utils/utils.go
package utils import ( "regexp" "strings" "unicode" "unicode/utf8" ) const ( RE_NOT_SEPARATORS = `[^[\s\.,:\*\+;\?\\\-\(\)\[\]{}<>'"#«»№\/!]+` ) var ( re = regexp.MustCompile(RE_NOT_SEPARATORS) ) func UpperInitial(str string) string { if len(str) > 0 { process := strings.ToLower(...
package utils import ( "regexp" "strings" "unicode" "unicode/utf8" ) const ( RE_NOT_SEPARATORS = `[^[\s\.,:\*\+;\?\\\-—_\(\)\[\]{}<>'"#«»№\/!]+` ) var ( re = regexp.MustCompile(RE_NOT_SEPARATORS) ) func UpperInitial(str string) string { if len(str) > 0 { process := strings.ToLowe...
Add more dividers to the regexp
Add more dividers to the regexp
Go
apache-2.0
alxeg/flibooks
e289089052968b838b895e0d9f1df984772970b5
orm/model_map.go
orm/model_map.go
package orm import ( "github.com/go-pg/pg/v10/types" ) type mapModel struct { hookStubs ptr *map[string]interface{} m map[string]interface{} } var _ Model = (*mapModel)(nil) func newMapModel(ptr *map[string]interface{}) *mapModel { return &mapModel{ ptr: ptr, } } func (mapModel) Init() error { return ni...
package orm import ( "github.com/go-pg/pg/v10/types" ) type mapModel struct { hookStubs ptr *map[string]interface{} m map[string]interface{} } var _ Model = (*mapModel)(nil) func newMapModel(ptr *map[string]interface{}) *mapModel { model := &mapModel{ ptr: ptr, } if ptr != nil { model.m = *ptr } retu...
Fix map update and insert
Fix map update and insert
Go
bsd-2-clause
go-pg/pg,vmihailenco/pg,go-pg/pg
40b452e637b863e5b056d405407bd4e429ff9ad8
plist/main.go
plist/main.go
package main import ( "os" "github.com/jason0x43/go-plist" ) func main() { if len(os.Args) != 2 { println("usage:", os.Args[0], "PLIST") os.Exit(1) } pl, err := plist.UnmarshalFile(os.Args[1]) if err != nil { println("error unmarshalling plist:", err.Error()) os.Exit(1) } println("Read plist of ver...
/* The plist command parses a plist file and indicates whether the parse was successful. */ package main import ( "os" "github.com/jason0x43/go-plist" ) func main() { if len(os.Args) != 2 { println("usage:", os.Args[0], "PLIST") os.Exit(1) } pl, err := plist.UnmarshalFile(os.Args[1]) if err != nil { p...
Add description for plist command.
Add description for plist command.
Go
mit
jason0x43/go-plist
42271b7c7bb2d83627f0e09990f670ac32b8d311
clair/health.go
clair/health.go
package clair import ( "fmt" "net/http" "os" "strconv" "strings" ) func IsHealthy() bool { Config() healthUri := strings.Replace(uri, "6060", strconv.Itoa(healthPort), 1) response, err := http.Get(healthUri + "/health") if err != nil { fmt.Fprintf(os.Stderr, "requesting Clair health: %v", err) return f...
package clair import ( "fmt" "net/http" "os" "strconv" "strings" ) func IsHealthy() bool { Config() healthURI := strings.Replace(uri, "6060/v1", strconv.Itoa(healthPort), 1) + "/health" response, err := http.Get(healthURI) if err != nil { fmt.Fprintf(os.Stderr, "requesting Clair health: %v", err) return...
Fix Healthcheck, by removing v1 in url
Fix Healthcheck, by removing v1 in url closes #52
Go
mit
murat1985/hyperclair,wemanity-belgium/hyperclair,wemanity-belgium/hyperclair,murat1985/hyperclair
9c0f4c53b87110abff873992ca79ad6b722ebb52
jwt_test.go
jwt_test.go
package jwt import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestVerifyExp(t *testing.T) { assert := assert.New(t) now := time.Now() { exp := now.Unix() assert.False(VerifyExp(0, exp), "False if now == exp") } { exp := now.Add(time.Second).Unix() assert.True(VerifyExp(0, exp), "...
package jwt import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestVerifyExp(t *testing.T) { assert := assert.New(t) now := time.Now() { exp := now.Unix() assert.False(verifyExp(now, 0, exp), "False if now == exp") } { exp := now.Add(time.Second).Unix() assert.True(verifyExp(now, ...
Use verifyExp to inject now
Use verifyExp to inject now
Go
bsd-3-clause
nabeken/jwt.go
9c71e06535ecb979a539091be77f6758ac291996
base/evaluated_candidate.go
base/evaluated_candidate.go
package base import "fmt" // EvaluatedCandidate is an immutable wrapper for associating a candidate // solution with its fitness score. type EvaluatedCandidate struct { candidate Candidate fitness float64 } // NewEvaluatedCandidate returns an EvaluatedCandidate func NewEvaluatedCandidate(candidate Candidate, fit...
package base import "fmt" // EvaluatedCandidate is an immutable wrapper for associating a candidate // solution with its fitness score. type EvaluatedCandidate struct { candidate Candidate fitness float64 } // NewEvaluatedCandidate returns an EvaluatedCandidate func NewEvaluatedCandidate(candidate Candidate, fit...
Add comparison method to EvaluatedCandidate
Add comparison method to EvaluatedCandidate
Go
mit
aurelien-rainone/evolve,aurelien-rainone/evolve
84e92d5a027e0524e47ddd42840b3c2a41165712
vault/barrier_access.go
vault/barrier_access.go
package vault // BarrierEncryptorAccess is a wrapper around BarrierEncryptor that allows Core // to expose its barrier encrypt/decrypt operations through BarrierEncryptorAccess() // while restricting the ability to modify Core.barrier itself. type BarrierEncryptorAccess struct { barrierEncryptor BarrierEncryptor } v...
package vault import "context" // BarrierEncryptorAccess is a wrapper around BarrierEncryptor that allows Core // to expose its barrier encrypt/decrypt operations through BarrierEncryptorAccess() // while restricting the ability to modify Core.barrier itself. type BarrierEncryptorAccess struct { barrierEncryptor Bar...
Add context to barrier encryptor access
Add context to barrier encryptor access
Go
mpl-2.0
rnaveiras/vault,Aloomaio/vault,mgk/vault,naunga/vault,mgk/vault,quixoten/vault,hashicorp/vault,hashicorp/vault,hartsock/vault,Aloomaio/vault,joelthompson/vault,quixoten/vault,mgk/vault,rnaveiras/vault,naunga/vault,rnaveiras/vault,hartsock/vault,Aloomaio/vault,kingland/vault,hashicorp/vault,hashicorp/vault,hashicorp/vau...
8c014d5a9b52f4cc5da4e1b131039f8c21c0fe39
logger_test.go
logger_test.go
package qb import ( "github.com/stretchr/testify/assert" "log" "os" "testing" ) func TestLogger(t *testing.T) { db, err := New("sqlite3", ":memory:") actors := Table("actors", Column("id", BigInt().NotNull()), PrimaryKey("id"), ) db.Metadata().AddTable(actors) db.CreateAll() defer db.DropAll() db.Engin...
package qb import ( "github.com/stretchr/testify/assert" "io/ioutil" "log" "testing" ) func TestLogger(t *testing.T) { db, err := New("sqlite3", ":memory:") actors := Table("actors", Column("id", BigInt().NotNull()), PrimaryKey("id"), ) db.Metadata().AddTable(actors) db.CreateAll() defer db.DropAll() d...
Test logger on ioutil.Discard (not stdout)
[tests] Test logger on ioutil.Discard (not stdout)
Go
lgpl-2.1
aacanakin/qb,cdevienne/qb,slicebit/qb
740a3152c643c91c371a12d81b3c21e937d694ba
p/srv/examples/ufs/ufs.go
p/srv/examples/ufs/ufs.go
// Copyright 2009 The go9p Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "log" "github.com/lionkov/go9p/p/srv/ufs" "github.com/lionkov/go9p/p/clnt" ) var ( debug = flag.Int("d", 0, "print debug...
// Copyright 2009 The go9p Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "log" "github.com/lionkov/go9p/p/srv/ufs" ) var ( debug = flag.Int("d", 0, "print debug messages") addr = flag.String("a...
Fix an error that made it not go-buildable.
Fix an error that made it not go-buildable. Signed-off-by: Ronald G. Minnich <f569d0af9a3481c4007b95c7180d6c41009f2513@gmail.com>
Go
bsd-3-clause
edahlgren/go9p,lionkov/ninep
78cfb92db3eb1459216b243e749d05b646332a65
example/main.go
example/main.go
package main import ( "flag" "io/ioutil" "log" "os" "os/signal" "strings" "github.com/localhots/satan" "github.com/localhots/satan/example/daemons" "github.com/localhots/satan/example/kafka" ) func main() { var debug bool var brokers string flag.BoolVar(&debug, "v", false, "Verbose mode") flag.StringVa...
package main import ( "flag" "io/ioutil" "log" "os" "os/signal" "strings" "github.com/localhots/satan" "github.com/localhots/satan/example/daemons" "github.com/localhots/satan/example/kafka" "github.com/localhots/satan/stats" ) func main() { var debug bool var brokers string flag.BoolVar(&debug, "v", f...
Use statistics logger in example app
Use statistics logger in example app
Go
mit
localhots/satan,localhots/satan,localhots/satan,localhots/satan
5209babfa1cec876c5798c6a4d6b396d7a4c4615
grid.go
grid.go
package grid type Square bool type Clue []int const ( White Square = iota Black ) type Grid struct { rowClues, columnClues []Clue squares []Square }
package grid type Square bool type Clue []int const ( White Square = false Black Square = true ) type Grid struct { rowClues, columnClues []Clue squares []Square }
Change Squares from ints to bools
Change Squares from ints to bools `go test` was complaining
Go
mit
ccouzens/gridsolver
8891b4bc492ab8af6790723f26469167352c3ec3
stream/notifs.go
stream/notifs.go
package stream import "github.com/synapse-garden/sg-proto/store" // Removed is a notification Resourcer that can inform a user they have // been removed from the Stream without informing them of any other // information about the Stream. type Removed string // Resource implements Resourcer.Resource on Removed. func ...
package stream import "github.com/synapse-garden/sg-proto/store" // Removed is a notification Resourcer that can inform a user they have // been removed from the Stream without informing them of any other // information about the Stream. type Removed string // Resource implements Resourcer.Resource on Removed. func ...
Add stream Deleted and Disconnected Resourcers
Add stream Deleted and Disconnected Resourcers
Go
agpl-3.0
synapse-garden/sg-proto
452d9957ab4f61b1387a9a28b91e87acaab8bb5d
src/main.go
src/main.go
package main import "fmt" func main() { fmt.Println("Ding!") }
package main import "fmt" import "os/exec" func main() { fmt.Println("Ding!") cmd := exec.Command("paplay", "/usr/share/sounds/freedesktop/stereo/complete.oga") cmd.Start() }
Use os/exec and paplay to play sound
Use os/exec and paplay to play sound
Go
mit
Cosiek/ding
f89d9d946c0a8ff028c617d843dac153b405f0fa
sprockets/null_sprockets.go
sprockets/null_sprockets.go
package sprockets import ( "html/template" ) func NullSprockets() ViewHelper { return ViewHelper{nullSprockets{}} } type nullSprockets struct{} func (s nullSprockets) GetAssetUrl(name string) (template.HTMLAttr, error) { panic("Null sprockets in use, cannot get asset urls") } func (s nullSprockets) GetAssetCont...
package sprockets import ( "html/template" ) func NullSprockets() ViewHelper { return ViewHelper{nullSprockets{}} } type nullSprockets struct{} func (s nullSprockets) GetAssetUrl(name string) (template.HTMLAttr, error) { return "", nil } func (s nullSprockets) GetAssetContents(name string) ([]byte, error) { re...
Allow null sprockets to be used for templating
Allow null sprockets to be used for templating
Go
mit
99designs/goodies
268c74b4327c9ca77c73ce60f2bbec01a0bef5ef
main.go
main.go
package main import ( ccli "github.com/codegangsta/cli" "github.com/myodc/go-micro/cmd" "github.com/myodc/micro/api" "github.com/myodc/micro/car" "github.com/myodc/micro/cli" ) func main() { app := ccli.NewApp() app.Name = "micro" app.Usage = "A microservices toolchain" app.Version = "0.0.1" app.Commands = ...
package main import ( ccli "github.com/codegangsta/cli" "github.com/myodc/go-micro/cmd" "github.com/myodc/micro/api" "github.com/myodc/micro/car" "github.com/myodc/micro/cli" ) func main() { app := ccli.NewApp() app.Name = "micro" app.Usage = "A microservices toolchain" app.HideVersion = true app.Commands =...
Fix panic caused by redeclaration of v flag
Fix panic caused by redeclaration of v flag
Go
apache-2.0
micro/micro,myodc/micro,micro/micro,jmptrader/micro,micro/micro
e5e8c1000c19345975a5c2b896e9fd44d6b03b0f
main.go
main.go
package main import ( "github.com/alex1sz/shotcharter-go/db" _ "github.com/lib/pq" ) func main() { // fmt.Printf("Hello, world.\n") db.Init() }
package main import ( "github.com/alex1sz/shotcharter-go/db" ) func main() { db.Db.Ping() }
Move lib/pq into db package
Move lib/pq into db package
Go
mit
Alex1sz/shotcharter-go-api
3a4500fa63451b8c7d647d2de6ebeb77b63eda00
main.go
main.go
package main import ( "fmt" "os" "github.com/open-falcon/falcon-plus/cmd" "github.com/spf13/cobra" flag "github.com/spf13/pflag" ) var versionFlag bool var RootCmd = &cobra.Command{ Use: "open-falcon", } func init() { RootCmd.AddCommand(cmd.Start) RootCmd.AddCommand(cmd.Stop) RootCmd.AddCommand(cmd.Restar...
package main import ( "fmt" "os" "github.com/open-falcon/falcon-plus/cmd" "github.com/spf13/cobra" ) var versionFlag bool var RootCmd = &cobra.Command{ Use: "open-falcon", Run: func(cmd *cobra.Command, args []string) { if versionFlag { fmt.Printf("Open-Falcon version %s, build %s\n", Version, GitCommit) ...
Fix the flags of subcommands
Fix the flags of subcommands
Go
apache-2.0
jojohappy/falcon-plus,taomaree/falcon-plus,open-falcon/falcon-plus,jojohappy/falcon-plus,open-falcon/falcon-plus,open-falcon/falcon-plus,jojohappy/falcon-plus,open-falcon/falcon-plus,taomaree/falcon-plus,jojohappy/falcon-plus,jojohappy/falcon-plus,taomaree/falcon-plus,taomaree/falcon-plus,open-falcon/falcon-plus,jojoha...
a7c971795e8c7c45015c436381a6c67ee53e9f78
basic_limiter.go
basic_limiter.go
package ratelimit import "time" type basicLimiter struct { t *time.Ticker bc ByteCount cbc chan ByteCount } func (bl *basicLimiter) Start() { for { <-bl.t.C bl.cbc <- bl.bc } } func (bl basicLimiter) GetLimit() <-chan ByteCount { return bl.cbc } const timeSlice = 20 * time.Millisecond //BasicLimiter ...
package ratelimit import "time" type basicLimiter struct { t *time.Ticker bc ByteCount cbc []chan ByteCount } func (bl *basicLimiter) Start() { for { <-bl.t.C perChan := bl.bc / ByteCount(len(bl.cbc)) for i := range bl.cbc { go func(i int) { bl.cbc[i] <- perChan }(i) } } } func (bl *basi...
Update BasicLimiter to spread limit across many readers
Update BasicLimiter to spread limit across many readers
Go
mit
andrewstuart/limio
be4b84d151c1e625baf53b3b01976a730726ae30
listenfilter.go
listenfilter.go
package main import ( "github.com/dimfeld/glog" "net" ) const ( WhiteList = iota BlackList ) type ListenFilter struct { net.Listener // BlackList or WhiteList. Behavior int FilterAddr map[string]bool } func (f *ListenFilter) Accept() (c net.Conn, err error) { for { c, err = f.Accept() if err != nil {...
package main import ( "github.com/dimfeld/glog" "net" ) const ( WhiteList = iota BlackList ) type ListenFilter struct { net.Listener // BlackList or WhiteList. Behavior int FilterAddr map[string]bool } func (f *ListenFilter) Accept() (c net.Conn, err error) { for { c, err = f.Listener.Accept() if err...
Fix infinite recursion. Compare addresses properly.
Fix infinite recursion. Compare addresses properly.
Go
mit
dimfeld/unwebhook,poikilotherm/unwebhook
80d7192bb18c64645925b8844738a041051ba5c6
internal/util/blackhole.go
internal/util/blackhole.go
package util import "io" // A BlackHole is an io.ReadWriter that accepts an infinite // amount of input and produces no output. type BlackHole struct{} func (BlackHole) Read(p []byte) (int, error) { return 0, io.EOF } func (BlackHole) Write(p []byte) (int, error) { return len(p), nil }
package util import "io" // A BlackHole is an io.ReadWriteCloser that accepts an infinite // amount of input and produces no output. type BlackHole struct{} func (BlackHole) Read(p []byte) (int, error) { return 0, io.EOF } func (BlackHole) Write(p []byte) (int, error) { return len(p), nil } func (BlackHole) Close()...
Implement the `io.ReadWriteCloser` interface for `util.Blackhole`
Implement the `io.ReadWriteCloser` interface for `util.Blackhole`
Go
mit
droyo/styx
4912d9036a1b970b5bc6ceb0298e4b7307004b27
mem_textproto_test.go
mem_textproto_test.go
package memalpha import ( "bufio" "bytes" "strings" "testing" ) func TestHandleServerError(t *testing.T) { errorMessage := "test fake" response := bytes.NewReader([]byte("SERVER_ERROR " + errorMessage)) request := bytes.NewBuffer([]byte{}) serverReadWriter := bufio.NewReadWriter(bufio.NewReader(response), bu...
package memalpha import ( "bufio" "bytes" "strings" "testing" "github.com/stretchr/testify/assert" ) func TestServerError(t *testing.T) { errorMessage := "test fake" response := bytes.NewReader([]byte("SERVER_ERROR " + errorMessage)) request := bytes.NewBuffer([]byte{}) serverReadWriter := bufio.NewReadWri...
Add test of ClientError and ReplyError
Add test of ClientError and ReplyError
Go
mit
ttakezawa/memalpha,ttakezawa/memalpha
22c48f61fb3b859f51afb0351094ea8537f186f9
cmd/ustat/main.go
cmd/ustat/main.go
package main import ( "gopkg.in/urfave/cli.v1" "os" ) const version = "0.2.0" func main() { app := cli.NewApp() app.Name = "ustat" app.Version = version app.Usage = "Unified system statistics collector" app.Authors = []cli.Author{ cli.Author{ Name: "Pekka Enberg", Email: "penberg@iki.fi", }, } ap...
package main import ( "fmt" "gopkg.in/urfave/cli.v1" "os" ) const version = "0.2.0" func main() { app := cli.NewApp() app.Name = "ustat" app.Version = version app.Usage = "Unified system statistics collector" app.Authors = []cli.Author{ cli.Author{ Name: "Pekka Enberg", Email: "penberg@iki.fi", },...
Exit proces with error message and error code
cmd/ustat: Exit proces with error message and error code If the command returns an error, exit the process with an error message and error code.
Go
mit
penberg/ustat
b3cdbaae1a084863577c839dc9fc862cbe445d07
selector/strategy.go
selector/strategy.go
package selector import ( "math/rand" "sync" "time" "github.com/micro/go-micro/registry" ) func init() { rand.Seed(time.Now().UnixNano()) } // Random is a random strategy algorithm for node selection func Random(services []*registry.Service) Next { var nodes []*registry.Node for _, service := range services...
package selector import ( "math/rand" "sync" "time" "github.com/micro/go-micro/registry" ) func init() { rand.Seed(time.Now().UnixNano()) } // Random is a random strategy algorithm for node selection func Random(services []*registry.Service) Next { var nodes []*registry.Node for _, service := range services...
Use random starting index for roundrobin
Use random starting index for roundrobin
Go
apache-2.0
Taik/go-micro,divisionone/go-micro,myodc/go-micro,uffy/go-micro,micro/go-micro
f7482ff73bee2fa60920b56db88e1aa086087964
doc.go
doc.go
// Package id is an authentication package that is // sessionless, and passwordless. package id
// Copyright 2015 Ben Tranter. All rights reserved. // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. /* Package id is an authentication package that is sessionless, and passwordless. */ package id
Add copyright notice to see if renders on GoDoc.org
Add copyright notice to see if renders on GoDoc.org
Go
apache-2.0
bentranter/id
017f7bd8562b3019304a0980cc947a3788b5859f
services/labels/service.go
services/labels/service.go
package projects import ( "github.com/DVI-GI-2017/Jira__backend/models" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) const collection = "labels" func CheckExistence(mongo *mgo.Database, label *models.Label) (bool, error) { c, err := mongo.C(collection).Find(bson.M{"name": label.Name}).Count() return c != 0, err }...
package labels import ( "github.com/DVI-GI-2017/Jira__backend/models" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) const collection = "labels" func CheckExistence(mongo *mgo.Database, label *models.Label) (bool, error) { c, err := mongo.C(collection).Find(bson.M{"name": label.Name}).Count() return c != 0, err } ...
Fix typo in package name.
Fix typo in package name.
Go
mit
DVI-GI-2017/Jira__backend
0568253b9a0df9dd3075c2c8ad826ddfebc1bfe6
application.go
application.go
package main import ( "os" "github.com/urfave/cli" ) func runApp() { app := cli.NewApp() app.Name = "alpinepass" app.Version = "0.0.0" app.Author = "appPlant GmbH" app.Usage = "Manage system environment information." app.Flags = []cli.Flag{ cli.StringSliceFlag{ Name: "filter, f", Usage: "Filter co...
package main import ( "os" a "github.com/appPlant/alpinepass/app" "github.com/urfave/cli" ) func runApp() { app := cli.NewApp() app.Name = "alpinepass" app.Version = "0.0.0" app.Author = "appPlant GmbH" app.Usage = "Manage system environment information." app.Flags = []cli.Flag{ cli.StringSliceFlag{ ...
Use commands defined in app package
Use commands defined in app package
Go
apache-2.0
appPlant/alpinepass,appPlant/alpinepass
89594c065262f298d8efe7079e67edc74d24548e
command/today.go
command/today.go
package command import ( "fmt" "time" "github.com/igungor/tlbot" ) func init() { register(cmdToday) } var cmdToday = &Command{ Name: "bugun", ShortLine: "bugun gunlerden ne?", Run: runToday, } type weekday time.Weekday var days = [...]string{ "pazar", "pazartesi", "sali", "carsamba", "perse...
package command import ( "fmt" "time" "github.com/igungor/tlbot" ) func init() { register(cmdToday) } var cmdToday = &Command{ Name: "bugun", ShortLine: "bugün günlerden ne?", Run: runToday, } type weekday time.Weekday var days = [...]string{ "pazar", "pazartesi", "sali", "carsamba", "perse...
Use proper characters for command descriptions
Use proper characters for command descriptions
Go
mit
igungor/ilberbot,igungor/ilber
d0046e18c7a22762460465eeb57f163dfc1d6297
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...
Add missing flags for reports
Add missing flags for reports
Go
unlicense
smotti/cfengine-tad
885b633d61c859138a206a4134d148d5ee70c836
musicbrainz.go
musicbrainz.go
package musicbrainz import ( "encoding/xml" "io/ioutil" "log" "net/http" "net/url" ) func MakeQuery(url string) []byte { res, err := http.Get(url) if err != nil { log.Fatal(err) } bytes, err := ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { log.Fatal(err) } return bytes } func SearchArt...
package musicbrainz import ( "encoding/xml" "io/ioutil" "log" "net/http" "net/url" ) func MakeQuery(url string) []byte { log.Printf("Getting URL %s", url) res, err := http.Get(url) if err != nil { log.Fatal(err) } bytes, err := ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { log.Fatal(err) ...
Add logging of the url.
Add logging of the url.
Go
apache-2.0
colinramsay/go-musicbrainz
ec42fc2fa7ad740f6c4e4ec95230e1ddfd5934ca
group.go
group.go
package flow // Group represents a specified collection of users. // // A user belongs to zero or more groups. Groups can have associated // privileges, too. type Group struct { id uint16 name string privs []*Privilege }
package flow import "fmt" // Group represents a specified collection of users. // // A user belongs to zero or more groups. Groups can have associated // privileges, too. type Group struct { id uint16 name string privs []*Privilege } // NewGroup creates and initialises a group. // // Usually, all available g...
Add convenience methods to `Group`
Add convenience methods to `Group`
Go
apache-2.0
js-ojus/flow,js-ojus/flow
4e3bf4bad4df87f447678dd675b5f44de0ff8c58
docs/storage/layerreader.go
docs/storage/layerreader.go
package storage import ( "time" "github.com/docker/distribution" "github.com/docker/distribution/digest" ) // layerReadSeeker implements Layer and provides facilities for reading and // seeking. type layerReader struct { fileReader digest digest.Digest } var _ distribution.Layer = &layerReader{} func (lrs *l...
package storage import ( "time" "github.com/docker/distribution" "github.com/docker/distribution/digest" ) // layerReadSeeker implements Layer and provides facilities for reading and // seeking. type layerReader struct { fileReader digest digest.Digest } var _ distribution.Layer = &layerReader{} func (lrs *l...
Update notification event Target fields
Update notification event Target fields Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Go
apache-2.0
thaJeztah/distribution,thaJeztah/distribution
c25a755feab0436630bdff3d7877d03e2a489b3d
pkg/controllers/management/clusterupstreamrefresher/gke_upstream_spec.go
pkg/controllers/management/clusterupstreamrefresher/gke_upstream_spec.go
package clusterupstreamrefresher import ( "context" gkecontroller "github.com/rancher/gke-operator/controller" gkev1 "github.com/rancher/gke-operator/pkg/apis/gke.cattle.io/v1" mgmtv3 "github.com/rancher/rancher/pkg/generated/norman/management.cattle.io/v3" wranglerv1 "github.com/rancher/wrangler/pkg/generated/c...
package clusterupstreamrefresher import ( "context" gkecontroller "github.com/rancher/gke-operator/controller" gkev1 "github.com/rancher/gke-operator/pkg/apis/gke.cattle.io/v1" mgmtv3 "github.com/rancher/rancher/pkg/generated/norman/management.cattle.io/v3" wranglerv1 "github.com/rancher/wrangler/pkg/generated/c...
Add Imported field to GKE upstream spec builder
Add Imported field to GKE upstream spec builder Without this patch, if a GKE cluster is imported to Rancher, and then a change from GKE is synced back to the cluster in Rancher, "imported" will flip back to false, and the guard in gke-operator that prevents sending a DELETE request to imported clusters that are remove...
Go
apache-2.0
rancherio/rancher,rancherio/rancher,rancher/rancher,rancher/rancher,rancher/rancher,rancher/rancher
bac060e3e6365d60edf1939cb913bedbd14d4df0
global/Global.go
global/Global.go
// Copyright 2013-2016 Adam Presley. All rights reserved // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package global import "github.com/mailslurper/libmailslurper/storage" const ( // Version of the MailSlurper Server application SERVER_VERSION string = "1.9" ...
// Copyright 2013-2016 Adam Presley. All rights reserved // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package global import "github.com/mailslurper/libmailslurper/storage" const ( // Version of the MailSlurper Server application SERVER_VERSION string = "1.11.1...
Update to version string for 1.11.1
Update to version string for 1.11.1
Go
mit
mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper
52188a1213c3ed67e0700fedd3c6630e5dc09902
htpasswd_test.go
htpasswd_test.go
package main import ( "bytes" "github.com/bmizerany/assert" "testing" ) func TestHtpasswd(t *testing.T) { file := bytes.NewBuffer([]byte("testuser:{SHA}PaVBVZkYqAjCQCu6UBL2xgsnZhw=\n")) h, err := NewHtpasswd(file) assert.Equal(t, err, nil) valid := h.Validate("testuser", "asdf") assert.Equal(t, valid, true) ...
package main import ( "bytes" "github.com/stretchr/testify/assert" "testing" ) func TestHtpasswd(t *testing.T) { file := bytes.NewBuffer([]byte("testuser:{SHA}PaVBVZkYqAjCQCu6UBL2xgsnZhw=\n")) h, err := NewHtpasswd(file) assert.Equal(t, err, nil) valid := h.Validate("testuser", "asdf") assert.Equal(t, valid,...
Use the testify assert lib.
Use the testify assert lib.
Go
mit
tappleby/slack_auth_proxy,tappleby/slack_auth_proxy
9e6a862b9af55bceb71ea9cfd260b9a71943e5cf
eventsource.go
eventsource.go
package eventsource import ( "fmt" "net/http" ) var header string = `HTTP/1.1 200 OK Content-Type: text/event-stream Cache-Control: no-cache Connection: keep-alive Access-Control-Allow-Origin: %s Access-Control-Allow-Credentials: true retry: 2000 ` func Handler (res http.ResponseWriter, req *http.Request) { h...
package eventsource import ( "bytes" "fmt" "net/http" ) const header string = `HTTP/1.1 200 OK Content-Type: text/event-stream Cache-Control: no-cache Connection: keep-alive Access-Control-Allow-Credentials: true` const body string = "\n\nretry: 2000\n" func Handler (res http.ResponseWriter, req *http.Request...
Write initial response using bytes.Buffer
Write initial response using bytes.Buffer
Go
mit
luizbranco/eventsource
1e5d8c8871e28166eb7b51fc38bcce6cda47978d
test/helper/helper.go
test/helper/helper.go
package helper import ( "fmt" "io/ioutil" "os" ) func WithDummyCredentials(fn func(dir string)) { if _, err := ioutil.ReadDir("temp"); err != nil { if err := os.Mkdir("temp", 0755); err != nil { panic(err) } } dir, err := ioutil.TempDir("temp", "dummy-credentials") if err != nil { panic(err) } //...
package helper import ( "fmt" "io/ioutil" "os" ) func WithDummyCredentials(fn func(dir string)) { dir, err := ioutil.TempDir("", "dummy-credentials") if err != nil { panic(err) } // Remove all the contents in the dir including *.pem.enc created by ReadOrUpdateCompactTLSAssets() // Otherwise we end up with...
Stop polluting git workspace with temporary files created while running unit tests
Stop polluting git workspace with temporary files created while running unit tests fix #156
Go
apache-2.0
everpeace/kube-aws,camilb/kube-aws,c-knowles/kube-aws,iflix-letsplay/kube-aws,HotelsDotCom/kube-aws,AlmogBaku/kube-aws,AlmogBaku/kube-aws,danielfm/kube-aws,kubernetes-incubator/kube-aws,mumoshu/kube-aws,camilb/kube-aws,mumoshu/kube-aws,iflix-letsplay/kube-aws,HotelsDotCom/kube-aws,everpeace/kube-aws,danielfm/kube-aws,c...
8c72fca2c9450ef242b81b118d68d6ebb9a62aec
cmd/emp/certs.go
cmd/emp/certs.go
package main import ( "os" "github.com/remind101/empire/pkg/heroku" ) var cmdCertAttach = &Command{ Run: runCertAttach, Usage: "cert-attach <aws_cert_name>", NeedsApp: true, Category: "certs", Short: "attach a certificate to an app", Long: ` Attaches an SSL certificate to an applications web proce...
package main import ( "os" "github.com/remind101/empire/pkg/heroku" ) var cmdCertAttach = &Command{ Run: runCertAttach, Usage: "cert-attach <aws_cert_arn>", NeedsApp: true, Category: "certs", Short: "attach a certificate to an app", Long: ` Attaches an SSL certificate to an applications web proces...
Update to indicate the ARN is used
Update to indicate the ARN is used
Go
bsd-2-clause
mhahn/empire,remind101/empire,remind101/empire,mhahn/empire,remind101/empire,mhahn/empire,iserko/empire,iserko/empire,iserko/empire