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
42f2186cd3ba22bec9d91fa8db313dce0fdc126a
worker/main.go
worker/main.go
package main import ( "fmt" worker "github.com/contribsys/faktory_worker_go" keycloak "github.com/kindlyops/mappamundi/havenapi/keycloak" ) // CreateUser creates a new user with keycloak func CreateUser(ctx worker.Context, args ...interface{}) error { fmt.Println("Working on job", ctx.Jid()) err := keycloak.Key...
package main import ( "fmt" worker "github.com/contribsys/faktory_worker_go" keycloak "github.com/kindlyops/mappamundi/havenapi/keycloak" ) // CreateUser creates a new user with keycloak func CreateUser(ctx worker.Context, args ...interface{}) error { fmt.Println("Working on job", ctx.Jid()) err := keycloak.Key...
Refactor to properly pull arg as a string.
Refactor to properly pull arg as a string. Issue #HAV-133 Signed-off-by: Christopher Mundus <711c73f64afdce07b7e38039a96d2224209e9a6c@kindlyops.com>
Go
apache-2.0
kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi
3233719aec01f5b9e40421ea30f3feeab5bd5113
connection.go
connection.go
/* Package dexcom provides functions to access a Dexcom CGM receiver over a USB or BLE connection. Based on the Python version at github.com/bewest/decoding-dexcom */ package dexcom import ( "log" ) type Connection interface { Frame([]byte) []byte Send([]byte) error Receive([]byte) error } var conn Connection ...
/* Package dexcom provides functions to access a Dexcom CGM receiver over a USB or BLE connection. Based on the Python version at github.com/bewest/decoding-dexcom */ package dexcom import ( "fmt" "log" ) type Connection interface { Frame([]byte) []byte Send([]byte) error Receive([]byte) error } var conn Conne...
Make error messages from Open more consistent
Make error messages from Open more consistent
Go
mit
ecc1/dexcom
9e6d298502bf2888503b0146e8812c51ce62799e
connection/connection.go
connection/connection.go
package connection import ( "fmt" "sync" ) import "github.com/octoblu/vulcand-job-logger/pool" var redisPool *pool.Pool var redisPoolOnce sync.Once // Connection connects to redis and type Connection struct { redisURI, redisQueueName string } // New constructs a new Connection func New(redisURI, redisQueueName ...
package connection import ( "fmt" "sync" ) import "github.com/octoblu/vulcand-job-logger/pool" var redisPool *pool.Pool var redisPoolOnce sync.Once // Connection connects to redis and type Connection struct { redisURI, redisQueueName string } // New constructs a new Connection func New(redisURI, redisQueueName ...
Make sure all log messages are non blocking, v1.3.0
Make sure all log messages are non blocking, v1.3.0
Go
mit
octoblu/vulcand-job-logger
1af42dd4e0968133f3254d1b952b5b214072266d
go-shorten.go
go-shorten.go
package main import ( "fmt" ) /* Reverse an array of digits. Implemented natively for now, although there might be an in-built library function that does this already */ func reverse(digits []uint16) (reversed []uint16) { for i := len(digits) - 1; i >= 0; i-- { reversed = append(reversed, digits[i]) } return...
/* Implement a URL shortening algorithm in GoLang based on a tutorial on Stack Overflow */ package main import ( "fmt" ) /* Reverse an array of digits. Implemented natively for now, although there might be an in-built library function that does this already */ func reverse(digits []uint16) (reversed []uint16) { ...
Add stub code for the mapping between digits and the alphabet
Add stub code for the mapping between digits and the alphabet
Go
bsd-2-clause
ambidextrousTx/go-shorten
783d2cd6c71db72b198219bf9b627822bead736b
common.go
common.go
package main import ( "encoding/json" "io/ioutil" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) const Thumbnails = map[string][]int{ "small": []int{100, 100}, "large": []int{500, 500}, } type Config struct { SourceFolderPath string `json:"source_folder_path"` DestinationFolderPath string `json...
package main import ( "encoding/json" "io/ioutil" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) type ThumbnailSize struct { Width uint Height uint } var ThumbnailSizes = map[string]ThumbnailSize{ "small": ThumbnailSize{100, 100}, "large": ThumbnailSize{500, 500}, } type Config struct { SourceFolderPat...
Change thumbnails types to be map of structs
Change thumbnails types to be map of structs
Go
mit
jaischeema/panorma,jaischeema/panorma,jaischeema/panorma
7a05e6f9e27d0e950de5b28621cd6e201e058abc
pkg/http/request/ip.go
pkg/http/request/ip.go
package request import ( "fmt" "net" "net/http" ) // IpAddress returns client ip address from request // Will check X-Real-IP and X-Forwarded-For header. // Unless you have a trusted reverse proxy, you shouldn't use this function, the client can set headers to any arbitrary value it wants func IpAddress(r *http.Re...
package request import ( "fmt" "net" "net/http" "strings" ) // IpAddress returns client ip address from request // Will check X-Real-IP and X-Forwarded-For header. // Unless you have a trusted reverse proxy, you shouldn't use this function, the client can set headers to any arbitrary value it wants func IpAddress...
Split host port only if collon present
Split host port only if collon present
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
0197835acc0edd0bd82ea80b92055d85c1566bc4
raw_action.go
raw_action.go
package main import ( "errors" "fmt" "io/ioutil" "os" "path" "strconv" ) type RawAction struct { BaseAction `yaml:",inline"` Offset string Source string Path string } func (raw *RawAction) Verify(context *YaibContext) error { if raw.Source != "rootdir" { return errors.New("Only suppport so...
package main import ( "errors" "fmt" "io/ioutil" "os" "path" "strconv" ) type RawAction struct { BaseAction `yaml:",inline"` Offset string Source string Path string } func (raw *RawAction) Verify(context *YaibContext) error { if raw.Source != "filesystem" { return errors.New("Only suppport...
Change source naming in the raw action
Change source naming in the raw action To be consistent with the filesystem deploy action, change the source identifier from rootdir to filesystem. In general the intended jargon is that the "filesystem" is the filesystem being created by the tool (by unpacking a tarball or debootstrap or deploying an ostree or whatev...
Go
apache-2.0
go-debos/debos,d4s/debos
5e9e22d4fd8c11ad3560ab75cdbf093fd1e31add
builtin/providers/google/provider_test.go
builtin/providers/google/provider_test.go
package google import ( "os" "testing" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) var testAccProviders map[string]terraform.ResourceProvider var testAccProvider *schema.Provider func init() { testAccProvider = Provider().(*schema.Provider) testAccProviders = ma...
package google import ( "io/ioutil" "os" "testing" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) var testAccProviders map[string]terraform.ResourceProvider var testAccProvider *schema.Provider func init() { testAccProvider = Provider().(*schema.Provider) testAccP...
Allow acctests to set credentials via file
provider/google: Allow acctests to set credentials via file Makes things easier on Travis.
Go
mpl-2.0
HotelsDotCom/terraform,mkuzmin/terraform,vancluever/terraform,rhyas/terraform,maxenglander/terraform,ericwestfall/terraform,mattray/terraform,BobVanB/terraform,Zordrak/terraform,glerchundi/terraform,hooklift/terraform,rjeczalik/terraform,zero-below/terraform,foragerr/terraform,billyschmidt/terraform,AlexanderEkdahl/ter...
9d3f40a51327bdd01573d061b5e26442fd33df25
helper/resource/error.go
helper/resource/error.go
package resource import ( "fmt" "strings" ) type NotFoundError struct { LastError error LastRequest interface{} LastResponse interface{} Message string Retries int } func (e *NotFoundError) Error() string { if e.Message != "" { return e.Message } return "couldn't find resource" } // Unexp...
package resource import ( "fmt" "strings" ) type NotFoundError struct { LastError error LastRequest interface{} LastResponse interface{} Message string Retries int } func (e *NotFoundError) Error() string { if e.Message != "" { return e.Message } return "couldn't find resource" } // Unexp...
Fix bad message from TimeoutError
Fix bad message from TimeoutError Before: Error creating IAM Role my-role: timeout while waiting for state to become 'success'. last error: %!s(<nil>)
Go
mpl-2.0
crunchywelch/terraform,superseb/terraform,TimeIncOSS/terraform,huydinhle/terraform,evandbrown/terraform,jammycakes/terraform,Zordrak/terraform,GrayCoder/terraform,rhyas/terraform,vancluever/terraform,catsby/terraform,GannettDigital/terraform,elblivion/terraform,jamtur01/terraform,TimeIncOSS/terraform,whiskeyjay/terrafo...
8afbc525e3d5bd02f87a6ae09c53bb737e3a4e36
dev/model_cisco_apic.go
dev/model_cisco_apic.go
package dev import ( "time" "github.com/udhos/jazigo/conf" ) func registerModelCiscoAPIC(logger hasPrintf, t *DeviceTable) { a := conf.NewDevAttr() promptPattern := `\S+#\s*$` a.DisabledPromptPattern = promptPattern a.EnabledPromptPattern = promptPattern a.CommandList = []string{"show ver", "conf", "termina...
package dev import ( "time" "github.com/udhos/jazigo/conf" ) func registerModelCiscoAPIC(logger hasPrintf, t *DeviceTable) { a := conf.NewDevAttr() promptPattern := `\S+#\s*$` a.DisabledPromptPattern = promptPattern a.EnabledPromptPattern = promptPattern a.CommandList = []string{"show ver", "conf", "termina...
Increase default match timeout for Cisco APIC model. 'sh run' is slow.
Increase default match timeout for Cisco APIC model. 'sh run' is slow.
Go
mit
udhos/jazigo,udhos/jazigo
cd4217d2d57aba84245fa80b331f3c23a7cfa889
services/httpServer/state/mutate/mutate.go
services/httpServer/state/mutate/mutate.go
package mutate import ( "errors" "github.com/synw/microb/services/httpServer" "github.com/synw/microb/services/httpServer/state" "github.com/synw/terr" ) func StartHttpServer() *terr.Trace { if state.HttpServer.Running == true { err := errors.New("Http server is already running") tr := terr.New("state.mutate...
package mutate import ( "errors" "github.com/synw/microb/services/httpServer" "github.com/synw/microb/services/httpServer/state" "github.com/synw/terr" ) func StartHttpServer() *terr.Trace { if state.HttpServer.Running == true { err := errors.New("Http server is already running") tr := terr.New("state.mutate...
Fix state mutation for http server
Fix state mutation for http server
Go
mit
synw/microb
dadf097c0c5f7dec5a451c34464b8c5994d1f596
output.go
output.go
package main import ( "fmt" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/filters" "github.com/fatih/color" "github.com/urfave/cli" "golang.org/x/net/context" ) func output(c *cli.Context) error { stacks, err := getStacks(c) if err != nil { ...
package main import ( "fmt" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/filters" "github.com/fatih/color" "github.com/urfave/cli" "golang.org/x/net/context" ) func output(c *cli.Context) error { stacks, err := getStacks(c) if err != nil { ...
Print targe and published for all ports of a service
Print targe and published for all ports of a service
Go
mit
mantika/whaleprint
609a2e8e8787a7bfbba7070b88376d9f2edb5803
async.go
async.go
/* Simplistic ansynchronous routines for the masses. */ package async /* Done types are used for shorthand definitions of the functions that are passed into each Routine to show that the Routine has completed. An example a Done function would be: func ImDone(err error, args ...interface{}) { if err ...
/* Simplistic asynchronous routines for the masses. */ package async /* Done types are used for shorthand definitions of the functions that are passed into each Routine to show that the Routine has completed. An example a Done function would be: func ImDone(err error, args ...interface{}) { if err !...
Fix typo in godoc synopsis
Fix typo in godoc synopsis
Go
mit
Southern/async
fe06051ad3acc48b6d386ae0d3308765f4520027
virtualboxclient/storage_controller.go
virtualboxclient/storage_controller.go
package virtualboxclient type StorageController struct { virtualbox *VirtualBox managedObjectId string }
package virtualboxclient import ( "github.com/appropriate/go-virtualboxclient/vboxwebsrv" ) type StorageController struct { virtualbox *VirtualBox managedObjectId string } func (sc *StorageController) GetName() (string, error) { request := vboxwebsrv.IStorageControllergetName{This: sc.managedObjectId} res...
Add GetName() and GetPortCount() to StorageController
Add GetName() and GetPortCount() to StorageController
Go
mit
appropriate/go-virtualboxclient
c5e052ffcee4389934b9fee7848f16c2f70f7b79
src/sample/closing_channel.go
src/sample/closing_channel.go
package main import ( "fmt" ) func main() { output := make(chan int, 1) // create channel write(output, 1) close(output) // close channel write(output, 2) } // how to write on possibly closed channel func write(out chan int, i int) { defer func() { // recover from panic caused by writing to a closed cha...
package main import ( "fmt" ) func main() { output := make(chan int, 1) // create channel write(output, 1) close(output) // close channel write(output, 2) } // how to write on possibly closed channel func write(out chan int, i int) (err error) { defer func() { // recover from panic caused by writing to ...
Return error writing on closed channel.
Return error writing on closed channel.
Go
mit
udhos/nexthop,udhos/nexthop
dad2fcb1993d9cd7c513db10965aa37d7f9a542d
integration-cli/docker_cli_search_test.go
integration-cli/docker_cli_search_test.go
package main import ( "fmt" "os/exec" "strings" "testing" ) // search for repos named "registry" on the central registry func TestSearchOnCentralRegistry(t *testing.T) { searchCmd := exec.Command(dockerBinary, "search", "stackbrew/busybox") out, exitCode, err := runCommandWithOutput(searchCmd) errorOut(err, t...
package main import ( "fmt" "os/exec" "strings" "testing" ) // search for repos named "registry" on the central registry func TestSearchOnCentralRegistry(t *testing.T) { searchCmd := exec.Command(dockerBinary, "search", "busybox") out, exitCode, err := runCommandWithOutput(searchCmd) errorOut(err, t, fmt.Spri...
Fix search test for busybox image
Fix search test for busybox image Signed-off-by: Michael Crosby <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@docker.com>
Go
apache-2.0
SophiaGitHub/newGitHub,duglin/docker,jwuwork/docker,mtrmac/docker,kyle-wang/docker,Gobella/docker,coolsvap/docker,tianon/docker,rhuss/docker,majst01/docker,DBCDK/docker,mikebrow/docker,rillig/docker.github.io,jamesmarva/docker,bleuchtang/docker,boucher/docker,johnstep/docker.github.io,hristozov/docker,clintonskitson/do...
b4173a6d7fb6f10afb3d49dbca479a9e9ad85b52
src/provisioner/provisioner/commands/close_all_ports.go
src/provisioner/provisioner/commands/close_all_ports.go
package commands import ( "provisioner/provisioner" ) type CloseAllPorts struct { CmdRunner provisioner.CmdRunner } func (c *CloseAllPorts) Run() error { err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-p", "tcp", "-j", "DROP") if err != nil { return err } return c.CmdRunner.Run("iptables", "-I", "INPUT",...
package commands import ( "provisioner/provisioner" ) type CloseAllPorts struct { CmdRunner provisioner.CmdRunner } func (c *CloseAllPorts) Run() error { err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "eth0", "-p", "tcp", "-j", "DROP") if err != nil { return err } err = c.CmdRunner.Run("iptables", ...
Allow traffic from app containers to PCF Dev
Allow traffic from app containers to PCF Dev [#130758953] Signed-off-by: Chhavi Kankaria <a45f933d80ef78816bcf302f872972e3887e5115@pivotal.io>
Go
apache-2.0
pivotal-cf/micropcf,pivotal-cf/micropcf
5d2ac799eb93152298b275639609e1a1a91e1527
integration-cli/docker_cli_oom_killed_test.go
integration-cli/docker_cli_oom_killed_test.go
// +build !windows package main import ( "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { testRequires(c, DaemonIsLinux, memoryLimitSupport) name := "testoomkilled" _, exitCode, _ := dockerCmdWithError("run", "--name",...
// +build !windows package main import ( "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { testRequires(c, DaemonIsLinux, memoryLimitSupport) name := "testoomkilled" _, exitCode, _ := dockerCmdWithError("run", "--name",...
Increase integration cli test memory
Increase integration cli test memory Signed-off-by: Euan <82ce0a5f500076a0414f27984d8e19adc458729b@amazon.com>
Go
apache-2.0
aditirajagopal/docker,aditirajagopal/docker,aditirajagopal/docker
213b1848284b005629208dd5b8ca4f154232d4f9
src/cf/manifest/manifest.go
src/cf/manifest/manifest.go
package manifest import ( "cf" "generic" ) type Manifest struct { data generic.Map Applications cf.AppSet } func NewEmptyManifest() (m *Manifest) { m, _ = NewManifest(generic.NewMap()) return m } func NewManifest(data generic.Map) (m *Manifest, errs ManifestErrors) { m = &Manifest{} m.data = data ...
package manifest import ( "cf" "generic" ) type Manifest struct { Applications cf.AppSet } func NewEmptyManifest() (m *Manifest) { m, _ = NewManifest(generic.NewMap()) return m } func NewManifest(data generic.Map) (m *Manifest, errs ManifestErrors) { m = &Manifest{} components, errs := newManifestComponents...
Remove private data from Manifest struct
Remove private data from Manifest struct Signed-off-by: Max Brunsfeld <8ee73e75b50cc292b5052b11f2ca25336d3e974e@pivotallabs.com>
Go
apache-2.0
nimbus-cloud/cli,srikanth88infy/cli,pishro-cc/cli,HuaweiTech/cli,EngineerBetter/cli,cgvarela/cli,xingzhou/cli,mcintyred/cli,mcintyred/cli,hyenaspots/cli,pishro-cc/cli,markstgodard/cli,saravana76/cli,carnell69/cli,zhang-hua/cli,nttlabs/cli,cgvarela/cli,nttlabs/cli,srikanth88infy/cli,AmitRoushan/cli,saurabhguptasg/cli,hy...
2b46b0fbb8986f30543239c4edd861bdaf112bb5
storesMap.go
storesMap.go
package tokay import ( "sync" ) type ( // routeStore stores route paths and the corresponding handlers. routeStore interface { Add(key string, data interface{}) int Get(key string, pvalues []string) (data interface{}, pnames []string) String() string } storesMap struct { sync.RWMutex M map[string]rout...
package tokay import ( "sync" ) type ( // routeStore stores route paths and the corresponding handlers. routeStore interface { Add(key string, data interface{}) int Get(key string, pvalues []string) (data interface{}, pnames []string) String() string } storesMap struct { sync.RWMutex M map[string]rout...
Add Count method to StoresMap object
Add Count method to StoresMap object
Go
bsd-3-clause
night-codes/tokay
aba5e8ece4b430bb78cd4337634487cc891d4c0a
gpsutil.go
gpsutil.go
package gpsutil import ( "math" ) type LatLng struct { lat float64 lng float64 } type GeohashDecoded struct { lat float64 lng float64 error struct { lat float64 lgn float64 } } type BBox struct { Southwest LatLng Northeast LatLng } func toRad(decDegrees float64) float64 { return decDegrees * math...
package gpsutil import ( "math" ) type LatLng struct { lat float64 lng float64 } type GeohashDecoded struct { lat float64 lng float64 err struct { lat float64 lgn float64 } } type BBox struct { Southwest LatLng Northeast LatLng } func toRad(decDegrees float64) float64 { return decDegrees * math.P...
Rename to err instead of error
Rename to err instead of error
Go
mit
vanng822/gpsutil
8110fd0448b9ab1da5ba9c7909276177e739b9d2
task2/main.go
task2/main.go
package main import ( "image" "image/color" "image/png" "os" ) func main() { // load file old_img_raw, _ := os.Open("img.png") // decode png image old_img, _ := png.Decode(old_img_raw) // get image bounds rectangle := old_img.Bounds() // create new file new_img_raw, _ := os.Create("new.png") // crea...
package main import ( "flag" "image" "image/color" "image/png" "os" ) func main() { input_img_ptr := flag.String("i", "input.png", "Input PNG image.") output_img_ptr := flag.String("o", "output.png", "Output PNG image.") flag.Parse() // load file input_img_raw, _ := os.Open(*input_img_ptr) // decode png ...
Add flags for input and output image.
Add flags for input and output image.
Go
mit
TeaTracer/mipt-cg-tasks
5a5d6af6ba1d256e8f0d3220dea078736abe4389
helpers/config.go
helpers/config.go
package helpers import ( "encoding/json" "os" ) type IntegrationConfig struct { AppsDomain string `json:"apps_domain"` PersistentAppHost string `json:"persistent_app_host"` } func LoadConfig() (config IntegrationConfig) { path := os.Getenv("CONFIG") if path == "" { panic("Must set $CONFIG to point to ...
package helpers import ( "encoding/json" "os" ) type IntegrationConfig struct { AppsDomain string `json:"apps_domain"` PersistentAppHost string `json:"persistent_app_host"` } func LoadConfig() (config IntegrationConfig) { path := os.Getenv("CONFIG") if path == "" { panic("Must set $CONFIG to point to ...
Rename for clarity and stop exporting
Rename for clarity and stop exporting Signed-off-by: Eric Malm <f38766f3ef0e8328064f8aa2a19c8805448432f2@pivotallabs.com>
Go
apache-2.0
matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests
1fc2ccf786406c313426fc5da77976201d30f801
examples/clock/main.go
examples/clock/main.go
package main import ( "fmt" "github.com/voxelbrain/pixelpixel/pixelutils" "time" ) func main() { c := pixelutils.PixelPusher() pixel := pixelutils.NewPixel() bigPixel := pixelutils.DimensionChanger(pixel, 5*4, 18) textPixel := pixelutils.NewImageWriter(bigPixel, pixelutils.Green) colon := ":" for { pixelu...
package main import ( "fmt" "github.com/voxelbrain/pixelpixel/pixelutils" "time" ) func main() { wall, _ := pixelutils.PixelPusher() pixel := pixelutils.NewPixel() bigPixel := pixelutils.DimensionChanger(pixel, 5*4, 18) textPixel := pixelutils.NewImageWriter(bigPixel, pixelutils.Green) colon := ":" for { ...
Adjust clock to new API
Adjust clock to new API
Go
mit
voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel,voxelbrain/pixelpixel
2c2734b57f5b39bd737e4a86c5f3d1a76f4b5d3d
style_test.go
style_test.go
package xlsx import ( . "gopkg.in/check.v1" ) type StyleSuite struct{} var _ = Suite(&StyleSuite{}) func (s *StyleSuite) TestNewStyle(c *C) { style := NewStyle() c.Assert(style, NotNil) } func (s *StyleSuite) TestMakeXLSXStyleElements(c *C) { style := NewStyle() font := *NewFont(12, "Verdana") style.Font = f...
package xlsx import ( . "gopkg.in/check.v1" ) type StyleSuite struct{} var _ = Suite(&StyleSuite{}) func (s *StyleSuite) TestNewStyle(c *C) { style := NewStyle() c.Assert(style, NotNil) } func (s *StyleSuite) TestMakeXLSXStyleElements(c *C) { style := NewStyle() font := *NewFont(12, "Verdana") style.Font = f...
Add Fill data to TestMakeXLSXStyleElements.
Add Fill data to TestMakeXLSXStyleElements.
Go
bsd-3-clause
ryho/xlsx
964099155bc6e7c91b81299ace4ed40336ad280b
cmd/kops/secrets_expose.go
cmd/kops/secrets_expose.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, ...
Fix typo: export -> expose
Fix typo: export -> expose
Go
apache-2.0
tsupertramp/kops,aledbf/kops,mad01/kops,reactiveops/kops,robinpercy/kops,blakebarnett/kops,MadDogTechnology/kops,pdh/kops,faraazkhan/kops,BradErz/kops,mad01/kops,andrewsykim/kops,pdh/kops,kubernetes/kops,faraazkhan/kops,chrislovecnm/kops,gambol99/kops,andrewsykim/kops,MadDogTechnology/kops,BradErz/kops,robinpercy/kops,...
de97f13658dc19bf141e5e3bed280c2278f936ea
lockfile_test.go
lockfile_test.go
package lockfile_test import ( lockfile "." "fmt" ) func ExampleLockfile() { lock, err := lockfile.New("/tmp/lock.me.now.lck") if err != nil { fmt.Println("Cannot init lock. reason: %v", err) panic(err) } err = lock.TryLock() // Error handling is essential, as we only try to get the lock. if err != nil {...
package lockfile_test import ( lockfile "." "fmt" "os" "path/filepath" ) func ExampleLockfile() { lock, err := lockfile.New(filepath.Join(os.TempDir(), "lock.me.now.lck")) if err != nil { fmt.Println("Cannot init lock. reason: %v", err) panic(err) } err = lock.TryLock() // Error handling is essential, a...
Use OS specific temporary directory
Use OS specific temporary directory
Go
mit
nightlyone/lockfile
57b5447199763a6b50195d9900f8fe70a1849f03
indices/deleteIndex.go
indices/deleteIndex.go
// Copyright 2013 Matthew Baird // 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 2013 Matthew Baird // 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...
Add support for indices Delete
Add support for indices Delete
Go
apache-2.0
ramin/elastigo,weberr13/elastigo,dimroc/elastigo,zaphod-concur/elastigo,donnanicolas/elastigo,barnslig/elastigo,ramin/elastigo,otiai10/elastigo,Kaidence/elastigo,jiangjin/elastigo,origami/elastigo,splicers/elastigo,mattbaird/elastigo,sammi/elastigo,sammi/elastigo,allgeek/elastigo,sammi/elastigo,splicers/elastigo,otiai1...
11e3263a8c99e1a56e6fa7d6779728d3bf786151
alpinepass.go
alpinepass.go
package main import ( "fmt" "io/ioutil" //"github.com/go-yaml/yaml" ) func main() { fmt.Printf("Readin input.yaml!\n") data, err := ioutil.ReadFile("input.yaml") if err != nil { panic(err) } fmt.Print(string(data)) }
package main import ( //"flag" "fmt" "io/ioutil" //"github.com/go-yaml/yaml" ) func readFile() string { fmt.Printf("Readin input.yaml!\n") data, err := ioutil.ReadFile("input.yaml") if err != nil { panic(err) } return string(data) } func filter() { } func convert() { } func writeFile() { } func main...
Use a function for reading the file
Use a function for reading the file
Go
apache-2.0
appPlant/alpinepass,appPlant/alpinepass
444d3b0904aca36fd000db277829d3a5cc8e618f
package_test.go
package_test.go
package main import ( "testing" ) var sourceURITests = []struct { src string dst string }{ //Full URI { "https://github.com/sunaku/vim-unbundle", "https://github.com/sunaku/vim-unbundle", }, //Short GitHub URI { "Shougo/neobundle.vim", "https://github.com/Shougo/neobundle.vim", }, { "thinca/vim-q...
package main import ( "fmt" "os" "path/filepath" "testing" "github.com/mitchellh/go-homedir" ) var ( home, errInit = homedir.Dir() dotvim = filepath.Join(home, ".vim") ) func TestMain(m *testing.M) { if errInit != nil { fmt.Fprintln(os.Stderr, "vub:", errInit) os.Exit(1) } os.Exit(m.Run()) } v...
Add variable in test for search ~/.vim
Add variable in test for search ~/.vim
Go
mit
kusabashira/vub
2bab6b0768e6e4ebc68487196a10a04d5dbaaa4f
pkg/controllers/util.go
pkg/controllers/util.go
package controllers import "k8s.io/client-go/tools/cache" var ( KeyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc )
package controllers import ( "reflect" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" ) var ( KeyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc ) type QueuingEventHandler struct { Queue workqueue.RateLimitingInterface } func (q *QueuingEventHandler)...
Add QueueingEventHandler and BlockingEventHandler types
Add QueueingEventHandler and BlockingEventHandler types
Go
apache-2.0
jetstack/navigator,jetstack/navigator
5bfebe965af2f669a87e85aff2952a11a3edfa96
cmd/tracks.go
cmd/tracks.go
package cmd import ( "fmt" "log" "github.com/codegangsta/cli" "github.com/exercism/cli/api" "github.com/exercism/cli/config" "github.com/exercism/cli/user" ) // Tracks lists available tracks. func Tracks(ctx *cli.Context) { c, err := config.New(ctx.GlobalString("config")) if err != nil { log.Fatal(err) } ...
package cmd import ( "fmt" "log" "github.com/codegangsta/cli" "github.com/exercism/cli/api" "github.com/exercism/cli/config" "github.com/exercism/cli/user" ) // Tracks lists available tracks. func Tracks(ctx *cli.Context) { c, err := config.New(ctx.GlobalString("config")) if err != nil { log.Fatal(err) } ...
Add more helpful output to the user
Add more helpful output to the user
Go
mit
lcowell/cli,zabawaba99/cli,yeah-right/cli,Tonkpils/cli,zabawaba99/cli,arvidsaur/cli,lcowell/cli,exercism/cli,neslom/cli,neslom/cli,arvidsaur/cli,zabawaba99/cli,yeah-right/cli,arvidsaur/cli,Tonkpils/cli,Tonkpils/cli,exercism/cli,yeah-right/cli,lcowell/cli,neslom/cli
87ee43de38b82be1a5e5e21b8930cfb70620275e
filesystem_windows_test.go
filesystem_windows_test.go
// +build windows package gps import ( "os/exec" "testing" ) // setupUsingJunctions inflates fs onto the host file system, but uses Windows // directory junctions for links. func (fs filesystemState) setupUsingJunctions(t *testing.T) { fs.setupDirs(t) fs.setupFiles(t) fs.setupJunctions(t) } func (fs filesystem...
// +build windows package gps import ( "os/exec" "testing" ) // setupUsingJunctions inflates fs onto the host file system, but uses Windows // directory junctions for links. func (fs filesystemState) setupUsingJunctions(t *testing.T) { fs.setupDirs(t) fs.setupFiles(t) fs.setupJunctions(t) } func (fs filesystem...
Create junction to an absolute path
Create junction to an absolute path
Go
mit
sdboyer/gps,sdboyer/vsolver
8d077c0d0a97cbd3e9c2d00c638898a2c2819236
remote-opend/main.go
remote-opend/main.go
package main import ( "bufio" "flag" "fmt" "log" "net" "github.com/skratchdot/open-golang/open" ) func main() { var port int var host string flag.IntVar(&port, "port", 2489, "TCP port number") flag.StringVar(&host, "host", "localhost", "Remote hostname") flag.Parse() l, err := net.Listen("tcp", fmt.Spri...
package main import ( "bufio" "flag" "fmt" "log" "net" "github.com/skratchdot/open-golang/open" ) func main() { var port int flag.IntVar(&port, "port", 2489, "TCP port number") flag.Parse() l, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) if err != nil { panic(err) } defer l.Close() for { co...
Enable to connect from remote
Enable to connect from remote
Go
mit
pocke/remote-open
2dc24e2646f6b63e315c7932c5476d6379fa9a86
discount.go
discount.go
package stripe import "encoding/json" // DiscountParams is the set of parameters that can be used when deleting a discount. type DiscountParams struct { Params `form:"*"` } // Discount is the resource representing a Stripe discount. // For more details see https://stripe.com/docs/api#discounts. type Discount struct...
package stripe import "encoding/json" // DiscountParams is the set of parameters that can be used when deleting a discount. type DiscountParams struct { Params `form:"*"` } // Discount is the resource representing a Stripe discount. // For more details see https://stripe.com/docs/api#discounts. type Discount struct...
Add support for `CheckoutSession` on `Discount`
Add support for `CheckoutSession` on `Discount`
Go
mit
stripe/stripe-go,stripe/stripe-go
e922b582bf6d77901d5655ef32a15c78160693b5
bot/logging.go
bot/logging.go
package bot import ( "os" "time" ) // LogLevel for determining when to output a log entry type LogLevel int // Definitions of log levels in order from most to least verbose const ( Trace LogLevel = iota Debug Info Warn Error Fatal ) // Log logs messages whenever the connector log level is // less than the g...
package bot // LogLevel for determining when to output a log entry type LogLevel int // Definitions of log levels in order from most to least verbose const ( Trace LogLevel = iota Debug Info Warn Error Fatal ) // Log logs messages whenever the connector log level is // less than the given level func (b *robot)...
Use log.Fatalln to guarantee the final gasp is written to the log file
Use log.Fatalln to guarantee the final gasp is written to the log file
Go
mit
parsley42/gopherbot,uva-its/gopherbot,uva-its/gopherbot,uva-its/gopherbot,parsley42/gopherbot,uva-its/gopherbot,parsley42/gopherbot,parsley42/gopherbot
426af272e5395404521d3d27a19b9e56b38430e4
attachments.go
attachments.go
package slack // https://api.slack.com/docs/attachments // It is possible to create more richly-formatted messages using Attachments. type AttachmentField struct { Title string `json:"title"` Value string `json:"value"` Short bool `json:"short"` } type Attachment struct { Color string `json:"color,omitempty"...
package slack // https://api.slack.com/docs/attachments // It is possible to create more richly-formatted messages using Attachments. type AttachmentField struct { Title string `json:"title"` Value string `json:"value"` Short bool `json:"short"` } type Attachment struct { Color string `json:"color,omitempty"...
Add unix timestamp field to Attachment struct
Add unix timestamp field to Attachment struct By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer. -https://api.slack.com/docs/message-attachments
Go
mit
bluele/slack
04424fcb68e0e22159d396b7d3223b9c3ffce001
cmd/ym/main.go
cmd/ym/main.go
package main import ( "fmt" "os" "log" "io/ioutil" "github.com/ghodss/yaml" ) func main() { byteArray, _ := ioutil.ReadAll(os.Stdin) y, err := yaml.YAMLToJSON(byteArray) if err != nil { log.Fatalf("error: %v", err) } fmt.Println(string(y)) }
package main import ( "fmt" "os" "io/ioutil" "github.com/ghodss/yaml" "encoding/json" ) func main() { byteArray, _ := ioutil.ReadAll(os.Stdin) var o interface{} var y []byte err := json.Unmarshal(byteArray, &o) if err == nil { // JSON decoding succeeded, it's JSON y, err = yaml....
Convert from YAML to JSON and back.
Convert from YAML to JSON and back.
Go
unlicense
iameli/ym
032b2913a2229596905e937c5bfaf4ae541c9a07
perrin.go
perrin.go
package main import "fmt" func perrin() func() int { a, b, c := 3, 0, 2 return func() int { a, b, c = b, c, a+b return a } } func perrin_max(max int) func() int { a, b, c := 3, 0, 2 return func() int { if a >= max { return a } a, b, c = b, c, a+b return a } } func perrin_reset(max int) func(...
package goperrin import "fmt" func perrin() func() int { a, b, c := 3, 0, 2 return func() int { a, b, c = b, c, a+b return a } } func perrin_max(max int) func() int { a, b, c := 3, 0, 2 return func() int { if a >= max { return a } a, b, c = b, c, a+b return a } } func perrin_reset(max int) f...
Fix package namespace and remove main
Fix package namespace and remove main
Go
apache-2.0
doublerr/goperrin
e05259e391d6d62afe5f166c9d05c5933b9b86d8
notifier.go
notifier.go
// Copyright 2015, David Howden // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "log" "sort" "time" ) type Notifier interface { Notify(map[string]time.Time) error } type logNotifier struct{} func (logNotifier) Notify(repos map[string...
// Copyright 2015, David Howden // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "log" "sort" "time" ) type Notifier interface { Notify(map[string]time.Time) error } type logNotifier struct{} func (logNotifier) Notify(repos map[string...
Update changesNotifier to only call underlying Notifier if repos is non-empty
Update changesNotifier to only call underlying Notifier if repos is non-empty
Go
bsd-2-clause
dhowden/ghnotify
8e54018c90eec6bf7218262ff54454c6e93415e0
cmd/pkg/mc/errors.go
cmd/pkg/mc/errors.go
package mc import "errors" var ( ErrInvalidProjectFilePath = errors.New("path not in project") ErrFileNotUploaded = errors.New("existing file not uploaded") ErrFileVersionNotUploaded = errors.New("existing file with new version not uploaded") )
package mc import "errors" var ( ErrInvalidProjectFilePath = errors.New("path not in project") ErrFileNotUploaded = errors.New("existing file not uploaded") ErrFileVersionNotUploaded = errors.New("existing file has changes that haven't been uploaded") )
Make ErrFileVersionNotUploaded error message more understandable.
Make ErrFileVersionNotUploaded error message more understandable.
Go
mit
materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore
538315817baca5005b9eea0604ecddbebdfa4d66
example/evaluator.go
example/evaluator.go
package main import ( "os" "exec" "bytes" "io" "strings" "clingon" ) type ShellEvaluator struct{} func (eval *ShellEvaluator) Run(console *clingon.Console, command string) os.Error { out, err := system(command, exec.DevNull, exec.Pipe, exec.MergeWithStdout) if err != nil { return err } console.Print(out)...
package main import ( "bytes" "exec" "os" "clingon" ) type ShellEvaluator struct{} func (eval *ShellEvaluator) Run(console *clingon.Console, command string) os.Error { var buf bytes.Buffer cmd := exec.Command(os.Getenv("SHELL"), "-c", command) cmd.Stdout = &buf cmd.Stderr = &buf err := cmd.Run() console....
Update in response to Go weekly.2011-06-02
Update in response to Go weekly.2011-06-02
Go
mit
remogatto/clingon
a8190d917573989235fc9db76d495ce87f3485b7
script.go
script.go
package main import ( "bytes" "os/exec" ) const script = ` tell application "System Events" set frontApp to name of first application process whose frontmost is true set activeURL to "" if frontApp is "Google Chrome" then tell application "Google Chrome" set normalWindows to (windows whose mode is ...
package main import ( "bytes" "os/exec" "strings" ) const script = ` tell application "System Events" set frontApp to name of first application process whose frontmost is true set activeURL to "" if frontApp is "Google Chrome" then tell application "Google Chrome" set normalWindows to (windows who...
Fix a small bug with new line
Fix a small bug with new line
Go
mit
lucapette/tracker
4ba47bc9e4e1b7b0a0c8d656a18c73f623f74010
server.go
server.go
package main import ( "fmt" "html/template" "log" "net/http" "os" "sort" "github.com/eknkc/amber" ) //template map var templateMap map[string]*template.Template //initialization of the template map func init() { templateMap, _ = amber.CompileDir("views", amber.DirOptions{Ext: ".amber", Recursive: true}, ...
package main import ( "html/template" "net/http" "sort" "github.com/eknkc/amber" "google.golang.org/appengine" ) //template map var templateMap map[string]*template.Template //initialization of the template map func init() { templateMap, _ = amber.CompileDir("views", amber.DirOptions{Ext: ".amber", Recursiv...
Switch to google app engine
Switch to google app engine
Go
mit
gagizagi/Axolotl-GO,gagizagi/Axolotl-GO
59ed9b2707fd5f71b3995be41e61673629361ace
request/request.go
request/request.go
package request import ( "io/ioutil" "net/http" "strings" ) func NewRequest(url, bearerToken string) (*http.Response, error) { client := &http.Client{} request, err := http.NewRequest("GET", url, nil) if err != nil { return nil, err } request.Header.Add("Authorization", "Bearer "+bearerToken) return clie...
package request import ( "io/ioutil" "net/http" "strings" ) func NewRequest(url, bearerToken string) (*http.Response, error) { client := &http.Client{} request, err := http.NewRequest("GET", url, nil) if err != nil { return nil, err } request.Header.Add("Authorization", "Bearer "+bearerToken) request.Hea...
Set the `Accept` header to allow JSON responses
Set the `Accept` header to allow JSON responses
Go
mit
alphagov/metadata-api,alphagov/metadata-api
f9595f0434c83b43b2eaf4bbc47e7bdd95727e82
gm/tri/draw.go
gm/tri/draw.go
// Copyright 2016 The Gosl 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 tri import "github.com/cpmech/gosl/plt" func Draw(V [][]float64, C [][]int, style *plt.A) { if style == nil { style = &plt.A{C: "b", M: "o", Ms: ...
// Copyright 2016 The Gosl 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 tri import "github.com/cpmech/gosl/plt" func Draw(V [][]float64, C [][]int, style *plt.A) { if style == nil { style = &plt.A{C: "b", M: "o", Ms: ...
Fix use of style in tri.Draw
Fix use of style in tri.Draw
Go
bsd-3-clause
cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl
1eb832dcbcf7929bfb3fbf351855c90d5f341083
inmem/copy.go
inmem/copy.go
package inmem import ( "io" "fmt" ) type ReceiverFrom interface { ReceiveFrom(Receiver) (int, error) } type SenderTo interface { SendTo(Sender) (int, error) } func Copy(dst Sender, src Receiver) (int, error) { if senderTo, ok := src.(SenderTo); ok { return senderTo.SendTo(dst) } if receiverFrom, ok := dst....
package inmem import ( "fmt" ) type ReceiverFrom interface { ReceiveFrom(Receiver) (int, error) } type SenderTo interface { SendTo(Sender) (int, error) } func Copy(dst Sender, src Receiver) (int, error) { if senderTo, ok := src.(SenderTo); ok { return senderTo.SendTo(dst) } if receiverFrom, ok := dst.(Recei...
Copy requires either SenderTo or ReceiverFrom
inmem: Copy requires either SenderTo or ReceiverFrom Signed-off-by: Solomon Hykes <510d74b69d9d43b60b6f6aa9d95e9f9c9497f815@docker.com>
Go
apache-2.0
gdevillele/docker.github.io,menglingwei/denverdino.github.io,jzwlqx/denverdino.github.io,polyverse-security/swarm,ezrasilvera/SwarmACLs,ezrasilvera/swarm,linecheng/swarm,pssahi/swarm,xFragger/swarm,beni55/swarm-1,gradywang/swarm,mountkin/swarm,denverdino/docker.github.io,fugr/swarm,thaJeztah/docker.github.io,rillig/doc...
9fab1cef57e952f415e05c1f84e1ed3dc4f8257c
dockerfile.go
dockerfile.go
package main type From struct { Image string Tag string Digest string } type Maintainer struct { Name string } type Run struct { Tokens []string } type Cmd struct { Tokens []string } type Lable struct { Labels map[string]string } type Expose struct { Ports []int } type Env struct { Variables map[str...
package main type Statement interface { statement() } type Dockerfile []*Statement type From struct { Image string Tag string Digest string } type Maintainer struct { Name string } type Run struct { Tokens []string } type Cmd struct { Tokens []string } type Lable struct { Labels map[string]string } ...
Make interfaces of the statements
Make interfaces of the statements
Go
mit
y-taka-23/voicepipe,y-taka-23/voicepipe
01c842bf40ca91acf82f64b7e1e665524d5fb8cf
clipper.go
clipper.go
package main import( "io" "log" "net" ) func main() { log.Print("Starting the server") listener, err := net.Listen("tcp", "127.0.0.1:8377") if err != nil { log.Fatal(err.Error()) } for { conn, err := listener.Accept() if err != nil { log.Print(err.Error()) return } go handleConnection(conn) ...
package main import( "io" "log" "net" "os/exec" ) func main() { _, err := exec.LookPath("pbcopy") if err != nil { log.Fatal(err.Error()) } log.Print("Starting the server") listener, err := net.Listen("tcp", "127.0.0.1:8377") if err != nil { log.Fatal(err.Error()) } for { conn, err := listener.Acce...
Check for presence of `pbcopy` executable at boot
Check for presence of `pbcopy` executable at boot Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
Go
bsd-2-clause
wincent/clipper
39898ea8e78dcfad8c7ec4902f8fbdd231f3cf49
format_test.go
format_test.go
package main import "testing" func TestNopFormatterDoesNothing(t *testing.T) { src := []byte{68, 68, 68} fmted, err := NopFormatter().Format(src) if err != nil { t.Fatal(err) } if !same(fmted, src) { t.Errorf("want %v, got: %v\n", src, fmted) } } func TestJSONFormatter(t *testing.T) { src := []byte(`{"js...
package main import "testing" func TestNopFormatterDoesNothing(t *testing.T) { src := []byte{68, 68, 68} fmted, err := NopFormatter().Format(src) if err != nil { t.Fatal(err) } if !same(fmted, src) { t.Errorf("want %v, got: %v\n", src, fmted) } } func TestJSONFormatter(t *testing.T) { src := []byte(`{"js...
Revert "Brake tests for demo purposes"
Revert "Brake tests for demo purposes" This reverts commit b032050baba4f04d7acaec8f95cbe98c7e68949f.
Go
apache-2.0
Bo0mer/dp,Bo0mer/dp
29b6f2416266f5408a47d2d87e2c2b5c8b5d5411
go/src/socialapi/workers/sitemap/sitemapfeeder/feeder/filenamefetcher.go
go/src/socialapi/workers/sitemap/sitemapfeeder/feeder/filenamefetcher.go
package feeder import "socialapi/workers/sitemap/models" type FileNameFetcher interface { Fetch(i *models.SitemapItem) string } type SimpleNameFetcher struct{} func (s SimpleNameFetcher) Fetch(i *models.SitemapItem) string { // TODO implement this return "firstfile" }
package feeder import ( "fmt" "math" "socialapi/workers/sitemap/models" ) type FileNameFetcher interface { Fetch(i *models.SitemapItem) string } type SimpleNameFetcher struct{} func (r SimpleNameFetcher) Fetch(i *models.SitemapItem) string { return "sitemap" } type ModNameFetcher struct{} func (r ModNameFetc...
Add ModNameFetcher for fething file names with respect to their id modulo
Sitemap: Add ModNameFetcher for fething file names with respect to their id modulo
Go
agpl-3.0
jack89129/koding,usirin/koding,cihangir/koding,rjeczalik/koding,rjeczalik/koding,usirin/koding,sinan/koding,drewsetski/koding,alex-ionochkin/koding,gokmen/koding,kwagdy/koding-1,usirin/koding,acbodine/koding,alex-ionochkin/koding,szkl/koding,koding/koding,szkl/koding,kwagdy/koding-1,koding/koding,rjeczalik/koding,cihan...
225e571a588b723034ac28e13294daa9a5ccf58c
src/qpm.io/qpm/core/context.go
src/qpm.io/qpm/core/context.go
package core import ( "google.golang.org/grpc" "log" "os" msg "qpm.io/common/messages" "google.golang.org/grpc/credentials" ) const ( Version = "0.0.1" PackageFile = "qpm.json" SignatureFile = "qpm.asc" Vendor = "vendor" Address = "pkg.qpm.io:7000" LicenseFile = "LICENSE" ) type Con...
package core import ( "google.golang.org/grpc" "log" "os" msg "qpm.io/common/messages" "google.golang.org/grpc/credentials" ) const ( Version = "0.0.1" PackageFile = "qpm.json" SignatureFile = "qpm.asc" Vendor = "vendor" Address = "pkg.qpm.io:7000" LicenseFile = "LICENSE" ) type Con...
Add an environment variable to override the server backend instance
Add an environment variable to override the server backend instance This is useful for testing.
Go
artistic-2.0
benlau/qpm,benlau/qpm
0b68164f9588bb86aed0842e55bf8589a69a532a
examples/simple/simple.go
examples/simple/simple.go
package main import ( "os" "golang.org/x/net/context" "github.com/BeepBoopHQ/go-slackbot" "github.com/nlopes/slack" ) func main() { bot := slackbot.New(os.Getenv("SLACK_TOKEN")) toMe := bot.Messages(slackbot.DirectMessage, slackbot.DirectMention).Subrouter() toMe.Hear("(?i)(hi|hello).*").MessageHandler(Hell...
package main import ( "os" "golang.org/x/net/context" "github.com/BeepBoopHQ/go-slackbot" "github.com/nlopes/slack" ) func main() { bot := slackbot.New(os.Getenv("SLACK_TOKEN")) toMe := bot.Messages(slackbot.DirectMessage, slackbot.DirectMention).Subrouter() toMe.Hear("(?i)(hi|hello).*").MessageHandler(Hell...
Update Example to include attachment functionality.
Update Example to include attachment functionality.
Go
mit
BeepBoopHQ/go-slackbot
f16a505002ae151768a0003d50374330d1a79e66
backend/commons/manager.go
backend/commons/manager.go
package commons import ( "encoding/json" "log" "os" ) type Manager interface { Commit() error GetSaveFilePath() (fullPath string, dirPath string, fileName string) GetConfig() interface{} } func LoadFromDB(manager Manager) { f, err := OpenSaveFile(manager, os.O_RDONLY) defer f.Close() Check(err) err = json....
package commons import ( "encoding/json" "log" "os" ) type Manager interface { Commit() error GetSaveFilePath() (fullPath string, dirPath string, fileName string) GetConfig() interface{} } func LoadFromDB(manager Manager) { f, err := OpenSaveFile(manager, os.O_RDONLY) defer f.Close() Check(err) err = json....
Fix empty file at boot of backend
:bug: Fix empty file at boot of backend
Go
mit
Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL
33fcb45f6150000444a7925fe382e77868d81ad6
integration/integration_suite_test.go
integration/integration_suite_test.go
package integration_test import ( "io/ioutil" "os" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils" ) var testCpiFilePath string func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) BeforeSuite(func() { err := bmtestu...
package integration_test import ( "io/ioutil" "os" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils" ) var testCpiFilePath string func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) BeforeSuite(func() { err := bmtestu...
Check for errors for operations in BeforeEach and AfterEach/Suite.
Check for errors for operations in BeforeEach and AfterEach/Suite. Signed-off-by: Phan Le <f2c5995718b197bbd6f63c99e8aab6ee2af1c495@pivotallabs.com>
Go
apache-2.0
forrestsill/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init,forrestsill/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init,forrestsill/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init
0b5655bc3a67160c85bc15b6b8dd39b65ea7d2af
handlers/game_handler.go
handlers/game_handler.go
package handlers import ( "net/http" "github.com/gorilla/websocket" "github.com/sirupsen/logrus" ) const URLRouteGame = "/game/{id}" var upgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, } type gameHandler struct { logger *logrus.Logger } func NewGameHandler(logger *logrus.Logger)...
package handlers import ( "net/http" "github.com/gorilla/mux" "github.com/gorilla/websocket" "github.com/sirupsen/logrus" ) const URLRouteGameByID = "/game/{id}" const MethodGame = http.MethodDelete var upgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, } type gameHandler struct { ...
Create debug info for GameHandler
Create debug info for GameHandler
Go
bsd-2-clause
ivan1993spb/clever-snake
0b84771a1f449b8242958befc3de3caae75f4c1d
lib/dumpers.go
lib/dumpers.go
package vegeta import ( "bytes" "encoding/json" "fmt" ) // Dumper is an interface defining Results dumping. type Dumper interface { Dump(*Result) ([]byte, error) } // DumperFunc is an adapter to allow the use of ordinary functions as // Dumpers. If f is a function with the appropriate signature, DumperFunc(f) //...
package vegeta import ( "bytes" "encoding/json" "fmt" ) // Dumper is an interface defining Results dumping. type Dumper interface { Dump(*Result) ([]byte, error) } // DumperFunc is an adapter to allow the use of ordinary functions as // Dumpers. If f is a function with the appropriate signature, DumperFunc(f) //...
Use double quote for error wraping
Use double quote for error wraping
Go
mit
tsenart/vegeta,tsenart/vegeta
9392b64be713a848aa23bd9010dd2e82280a79d6
main.go
main.go
package main import ( "io/ioutil" "os" slackreporter "github.com/ariarijp/horenso-reporter-slack/reporter" "github.com/bluele/slack" ) func main() { token := os.Getenv("SLACK_TOKEN") groupName := os.Getenv("SLACK_GROUP") stdin, err := ioutil.ReadAll(os.Stdin) if err != nil { panic(err) } api := slack.N...
package main import ( "io/ioutil" "os" slackreporter "github.com/ariarijp/horenso-reporter-slack/reporter" "github.com/bluele/slack" ) func main() { token := os.Getenv("SLACK_TOKEN") groupName := os.Getenv("SLACK_GROUP") stdin, err := ioutil.ReadAll(os.Stdin) if err != nil { panic(err) } api := slack.N...
Change notify when exit code is not 0
Change notify when exit code is not 0
Go
mit
ariarijp/horenso-reporter-slack
f479e81e55890e3620b51068ed9230c42b1030e8
main.go
main.go
package main // import "github.com/CenturyLinkLabs/panamax-kubernetes-adapter" import ( "github.com/CenturyLinkLabs/panamax-kubernetes-adapter/adapter" "github.com/CenturyLinkLabs/pmxadapter" ) func main() { adapter := adapter.KubernetesAdapter{} server := pmxadapter.NewServer(adapter) server.Start() }
package main // import "github.com/CenturyLinkLabs/panamax-kubernetes-adapter-go" import ( "github.com/CenturyLinkLabs/panamax-kubernetes-adapter-go/adapter" "github.com/CenturyLinkLabs/pmxadapter" ) func main() { adapter := adapter.KubernetesAdapter{} server := pmxadapter.NewServer(adapter) server.Start() }
Rename package to reflect its Github repo name.
Rename package to reflect its Github repo name.
Go
apache-2.0
rupakg/panamax-kubernetes-adapter-go,CenturyLinkLabs/panamax-kubernetes-adapter-go
57bb15e2e6919c39a040d44fea004d2fbcb8cea8
main.go
main.go
package main import ( "os" "github.com/taylorskalyo/stno/action" "gopkg.in/urfave/cli.v1" ) func main() { app := cli.NewApp() app.Flags = []cli.Flag{ cli.StringFlag{ Name: "journal, j", Usage: "Load the journal titled `JOURNAL`", }, cli.StringFlag{ Name: "config, c", Usage: "Load configura...
package main import ( "os" "github.com/taylorskalyo/stno/action" "gopkg.in/urfave/cli.v1" ) func main() { app := cli.NewApp() app.Flags = []cli.Flag{ cli.StringFlag{ Name: "journal, j", Usage: "load the journal titled `JOURNAL`", }, cli.StringFlag{ Name: "config, c", Usage: "load configura...
Update help text to match default style
Update help text to match default style
Go
mit
taylorskalyo/stno
ab0af593aef9a398ba2797af7a30cc6db7d0c7c0
main.go
main.go
package main import ( "os" "strings" ) func main() { clients := strings.Split(os.Getenv("XLANG_CLIENTS"), ",") servers := strings.Split(os.Getenv("XLANG_SERVERS"), ",") behaviors := strings.Split(os.Getenv("XLANG_BEHAVIORS"), ",") matrix := Matrix{ Clients: clients, Servers: servers, Behaviors: beha...
package main import ( "os" "strings" "time" ) func main() { clients := strings.Split(os.Getenv("XLANG_CLIENTS"), ",") servers := strings.Split(os.Getenv("XLANG_SERVERS"), ",") behaviors := strings.Split(os.Getenv("XLANG_BEHAVIORS"), ",") matrix := Matrix{ Clients: clients, Servers: servers, Behavio...
Add a sleep because distributed systems are hard
Add a sleep because distributed systems are hard
Go
mit
crossdock/crossdock,yarpc/crossdock,yarpc/crossdock,crossdock/crossdock,yarpc/crossdock,crossdock/crossdock
055725820cb45e9a3783b00ce6ad2bb89ab7b9e3
openflow/common.go
openflow/common.go
package openflow import "io" const MinimumHeaderLength = 8 type Packetizable interface { io.ReadWriter Len() uint } type Message interface { Packetizable Header() *Header } type Header struct { Version uint8 Type MessageType Length uint16 Xid uint32 } func (h *Header) GetHeader() *Header { return...
package openflow import "io" const MinimumHeaderLength = 8 type Packetizable interface { io.ReadWriter Len() uint } type Message interface { Packetizable GetHeader() *Header } type Header struct { Version uint8 Type MessageType Length uint16 Xid uint32 } func (h *Header) GetHeader() *Header { ret...
Apply Message interface protocol to Header struct
Apply Message interface protocol to Header struct
Go
mit
oshothebig/goflow
f2e5dc605070f7c385ae8f632a11f1ae52a92c45
samples/upload/tests/multipletest.go
samples/upload/tests/multipletest.go
package tests import ( "net/url" "github.com/revel/revel/samples/upload/app/routes" "github.com/revel/revel" ) type MultipleTest struct { revel.TestSuite } func (t *MultipleTest) TestThatMultipleFilesUploadWorks() { // Make sure it is not allowed to submit less than 2 files. t.PostFile(routes.Multiple.Handle...
package tests import ( "net/url" "github.com/revel/revel/samples/upload/app/routes" "github.com/revel/revel" ) type MultipleTest struct { revel.TestSuite } func (t *MultipleTest) TestThatMultipleFilesUploadWorks() { // Make sure it is not allowed to submit less than 2 files. t.PostFile(routes.Multiple.Handle...
Remove debug info from upload tests sample
Remove debug info from upload tests sample
Go
mit
cokeboL/revel,veliamsli/revel,w4ngyi/revel,trigrass2/revel,folpindo/revel,metafex/revel,revel/revel,lili2311/revel,revel/revel,roblillack/revel,runner-mei/revel,jenalgit/revel,jmptrader/revel,ggerman/revel,notzippy/revel,roblillack/revel,lgscofield/revel,marklap/revel,w4ngyi/revel,nubleer/revel,lgscofield/revel,zacklin...
edbebd560ac24a011d66ca39f7d7e0654c478e44
model/page.go
model/page.go
package model // Accounts is used to unmarshal the /me/accounts response // // https://developers.facebook.com/docs/graph-api/reference/v2.3/user/accounts#fields type Accounts struct { Data []Page `json:"data"` } // Page represents a Facebook Page // // https://developers.facebook.com/docs/graph-api/reference/v2.3/p...
package model // Accounts is used to unmarshal the /me/accounts response // // https://developers.facebook.com/docs/graph-api/reference/v2.3/user/accounts#fields type Accounts struct { Data []Page `json:"data"` } // Page represents a Facebook Page // // https://developers.facebook.com/docs/graph-api/reference/v2.3/p...
Add emails to Page model
Add emails to Page model
Go
mit
deiwin/facebook
07087392149ed02dd00fc19497a9e5a149edf2d3
src/functorama.com/demo/libgodelbrot/libgodelbrot.go
src/functorama.com/demo/libgodelbrot/libgodelbrot.go
package libgodelbrot import ( "image" ) // Draw the Mandelbrot set. This is the main entry point to libgodelbrot func AutoRender(req *Request) (*image.NRGBA, error) { info, configErr := AutoConf(req) if configErr == nil { return Render(info) } else { return nil, configErr } } func Render(info *Info) (*ima...
package libgodelbrot import ( "image" ) func Render(info *Info) (*image.NRGBA, error) { context, err := MakeRenderer(info) if err == nil { return context.Render() } else { return nil, err } } func AutoConf(req *Request) (*Info, error) { // Configure uses panic when it encounters an error condition. // He...
Remove non-orthogonal helper method from API
Remove non-orthogonal helper method from API
Go
mit
johnny-morrice/webdelbrot-static,johnny-morrice/webdelbrot,johnny-morrice/webdelbrot-static,johnny-morrice/webdelbrot,johnny-morrice/godelbrot
ab30b9640bf308b322654248f67979727b744722
unmarshal_test.go
unmarshal_test.go
package main import ( "testing" ) func TestParseMaintainer(t *testing.T) { cases := []struct { in []byte want *Maintainer }{ {[]byte("JohnDoe"), &Maintainer{Name: "JohnDoe"}}, {[]byte("John Doe"), &Maintainer{Name: "John Doe"}}, {[]byte(" John Doe"), &Maintainer{Name: "John Doe"}}, {[]byte("John Doe ...
package main import ( "testing" ) func TestParseMaintainer(t *testing.T) { cases := []struct { in []byte want *Maintainer }{ {[]byte("JohnDoe"), &Maintainer{Name: "JohnDoe"}}, {[]byte("John Doe"), &Maintainer{Name: "John Doe"}}, {[]byte(" John Doe"), &Maintainer{Name: "John Doe"}}, {[]byte("John Doe ...
Add tests for USER parsing
Add tests for USER parsing
Go
mit
y-taka-23/voicepipe,y-taka-23/voicepipe
4b8422240a86b030481acdd4a965b363e4dbf0a5
metar_test.go
metar_test.go
// Copyright (c) 2016-2017 Eric Barkie. All rights reserved. // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package main import ( "fmt" "time" ) func Examplemetar() { l := loop{Timestamp: time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)} fmt.Println(met...
// Copyright (c) 2016-2017 Eric Barkie. All rights reserved. // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package main import ( "fmt" "time" ) func ExampleMetar() { l := loop{Timestamp: time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)} fmt.Println(met...
Make metar example actually run
Make metar example actually run
Go
mit
ebarkie/davis-station,ebarkie/davis-station
e5bc938a4566443ec30dc3b0a9d738c5eabc2249
queue_test.go
queue_test.go
package gamq import ( "testing" ) const ( TEST_QUEUE_NAME = "TestQueue" ) func TestQueue_initialize_completesSuccessfully(t *testing.T) { underTest := Queue{Name: TEST_QUEUE_NAME} underTest.Initialize() // Queue should be named correctly if underTest.Name != TEST_QUEUE_NAME { t.Fail() } // Messages chan...
package gamq import ( "bufio" "bytes" "testing" "github.com/onsi/gomega" ) const ( TEST_QUEUE_NAME = "TestQueue" ) // Check that messages sent to a queue are eventually sent to consumers func TestQueue_sendMessage_messageReceivedSuccessfully(t *testing.T) { // Need gomega for async testing gomega.RegisterTes...
Add async test for queues.
Add async test for queues. Assert that messages are actually delivered to consumers.
Go
mit
FireEater64/gamq
cb7ef9b9eec4469facd22e2a7114f93564cf8b5d
src/stackdriver-nozzle/scripts/firehose-to-stdout.go
src/stackdriver-nozzle/scripts/firehose-to-stdout.go
package main import ( "os" "github.com/cloudfoundry-community/gcp-tools-release/src/stackdriver-nozzle/firehose" "github.com/cloudfoundry-community/go-cfclient" "github.com/cloudfoundry/sonde-go/events" "gopkg.in/alecthomas/kingpin.v2" ) func main() { kingpin.Parse() apiEndpoint := os.Getenv("FIREHOSE_ENDPOI...
package main import ( "os" "github.com/cloudfoundry-community/gcp-tools-release/src/stackdriver-nozzle/firehose" "github.com/cloudfoundry-community/go-cfclient" "github.com/cloudfoundry/sonde-go/events" ) func main() { apiEndpoint := os.Getenv("FIREHOSE_ENDPOINT") username := os.Getenv("FIREHOSE_USERNAME") pa...
Remove last vestiges of kingpin
Remove last vestiges of kingpin
Go
apache-2.0
cloudfoundry-community/stackdriver-tools,cloudfoundry-community/stackdriver-tools,cloudfoundry-community/stackdriver-tools,cloudfoundry-community/stackdriver-tools
190f4e33b720b21bbe98847ad506fd4ae446bc6b
hpack/2_3_3_index_address_space.go
hpack/2_3_3_index_address_space.go
package hpack import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" "golang.org/x/net/http2" ) func IndexAddressSpace() *spec.TestGroup { tg := NewTestGroup("2.3.3", "Index Address Space") // Indices strictly greater than the sum of the lengths of both // tables MUST be treated as ...
package hpack import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" "golang.org/x/net/http2" ) func IndexAddressSpace() *spec.TestGroup { tg := NewTestGroup("2.3.3", "Index Address Space") // Indices strictly greater than the sum of the lengths of both // tables MUST be treated as ...
Use index 126 instead of 70
Revert: Use index 126 instead of 70
Go
mit
summerwind/h2spec
81d1346bf815b714e5929dc6e9d1bec8c346003f
because.go
because.go
package mint import "testing" // Because is context printer. func Because(t *testing.T, context string, wrapper func(*testing.T)) { Log(" Because:", context, "\n") wrapper(t) } // When is an alternative of `Because` func When(t *testing.T, context string, wrapper func(*testing.T)) { Log(" When:", context, "\n")...
package mint import "testing" // Because is context printer. func Because(t *testing.T, context string, wrapper func(*testing.T)) { Log(" Because ", context, "\n") wrapper(t) } // When is an alternative of `Because` func When(t *testing.T, context string, wrapper func(*testing.T)) { Log(" When ", context, "\n")...
Change context message output a bit
Change context message output a bit
Go
mit
otiai10/mint
8d1aa53fd920b6c8c879f4979c153c98c229e72b
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\"]"} // EGL...
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_...
Add flag to work around the GL calls in CreatePlatformGLTestContext_egl.cpp.
[fiddle] Add flag to work around the GL calls in CreatePlatformGLTestContext_egl.cpp. Bug: skia: Change-Id: Icbf76346cb8ea9ce6fbf31922d599f4846ff2f22 Reviewed-on: https://skia-review.googlesource.com/74500 Reviewed-by: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com> Commit-Queue: Joe Gregorio <b9cf24...
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
7a9e26edeafc4c2f52faccefaa71c6c92a0d8b33
templates.go
templates.go
package main const dockerUnitTemplate = ` [Unit] Description={{.Name}} After=docker.service [Service] EnvironmentFile=/etc/environment User=core TimeoutStartSec=0 ExecStartPre=/usr/bin/docker pull mmmhm/{{.Name}}:{{.Version}} ExecStartPre=-/usr/bin/docker rm -f {{.Name}}-{{.Version}}-%i ExecStart=/usr/bin/docker run ...
package main const dockerUnitTemplate = ` [Unit] Description={{.Name}} After=docker.service [Service] EnvironmentFile=/etc/environment User=core TimeoutStartSec=0 ExecStartPre=/usr/bin/docker pull {{.DockerHubUsername}}/{{.Name}}:{{.Version}} ExecStartPre=-/usr/bin/docker rm -f {{.Name}}-{{.Version}}-%i ExecStart=/us...
Fix bug with un-renamed Docker Hub username.
Fix bug with un-renamed Docker Hub username.
Go
mit
bmorton/deployster
c545cc8938facf35da12069d81461e04779a5274
thrift_nats/nats_server_transport.go
thrift_nats/nats_server_transport.go
package thrift_nats import ( "errors" "time" "git.apache.org/thrift.git/lib/go/thrift" "github.com/nats-io/nats" ) type natsServerTransport struct { conn *nats.Conn accepted chan struct{} transport thrift.TTransport listening bool } func newNATSServerTransport(conn *nats.Conn) *natsServerTransport { ...
package thrift_nats import ( "errors" "time" "git.apache.org/thrift.git/lib/go/thrift" "github.com/nats-io/nats" ) type natsServerTransport struct { conn *nats.Conn listening bool } func newNATSServerTransport(conn *nats.Conn) *natsServerTransport { return &natsServerTransport{conn: conn} } func (n *na...
Remove unused fields from server transport
Remove unused fields from server transport
Go
apache-2.0
tylertreat/thrift-nats,Workiva/thrift-nats
3a6a322cc8fd953e272c764fc585c03eb4b71db4
commands/blockstoragecommands/commands.go
commands/blockstoragecommands/commands.go
package blockstoragecommands import ( "github.com/jrperritt/rack/commands/blockstoragecommands/snapshotcommands" "github.com/jrperritt/rack/commands/blockstoragecommands/volumecommands" "github.com/jrperritt/rack/internal/github.com/codegangsta/cli" ) // Get returns all the commands allowed for a `block-storage` r...
package blockstoragecommands import ( "github.com/jrperritt/rack/commands/blockstoragecommands/snapshotcommands" "github.com/jrperritt/rack/commands/blockstoragecommands/volumecommands" "github.com/jrperritt/rack/internal/github.com/codegangsta/cli" ) // Get returns all the commands allowed for a `block-storage` r...
Clarify meaning of block storage volumes.
Clarify meaning of block storage volumes. Addresses https://github.com/jrperritt/rack/pull/157#discussion_r33795007
Go
apache-2.0
ryanvz/rack,brint/rack,rackspace/rack,jrperritt/rack,jrperritt/rack,jarosser06/rack,dolph/rack,DonNateR/rack,annegentle/rack,ryanvz/rack,pratikmallya/rack,rackspace/rack,pratikmallya/rack,nelsnelson/rack,jarosser06/rack,annegentle/rack,nelsnelson/rack,brint/rack,dolph/rack,DonNateR/rack
5404a4242f3423f7309d11eb21b100d3c1339916
test/utils/config.go
test/utils/config.go
package utils import "time" var ( Interval = 10 * time.Second Timeout = 5 * time.Minute )
package utils import "time" var ( Interval = 10 * time.Second Timeout = 10 * time.Minute )
Increase e2e poll timeout to 10min
Increase e2e poll timeout to 10min Set e2e poll timeout to 10 min to avoid flakes like ``` tektonconfigs.go:122: TektonConfigCR "config" failed to get to the READY status: tektonconfig config is not in desired state, got: <nil>: timed out waiting for the condition ``` Signed-off-by: Nikhil Thomas <06117e966d0391...
Go
apache-2.0
tektoncd/operator,tektoncd/operator,tektoncd/operator
33968ddbdb9b48a2396a7c8a486f3bf89c9295f4
snmpqueries.go
snmpqueries.go
package main import ( "fmt" "math/rand" "strconv" "time" "github.com/eferro/go-snmpqueries/pkg/snmpquery" ) func generateRandomQueries() <-chan snmpquery.Query { out := make(chan snmpquery.Query) go func() { queryId := 0 for { query := snmpquery.Query{ Id: queryId, Query: "Fake q...
package main import ( "fmt" "math/rand" "strconv" "time" "github.com/eferro/go-snmpqueries/pkg/snmpquery" ) func generateRandomQueries(input chan snmpquery.Query) { queryId := 0 for { query := snmpquery.Query{ Id: queryId, Query: "Fake query " + strconv.Itoa(queryId), Destination: "F...
Refactor (to clarify the flow)
Refactor (to clarify the flow)
Go
mit
aleasoluciones/gosnmpquerier,aleasoluciones/gosnmpquerier
d0dcd885d0234d7a8bc7ded3eca8182c87aa1a51
thunderbolt.go
thunderbolt.go
package main import ( "fmt" "log" "github.com/jessevdk/go-flags" "github.com/k0kubun/go-readline" ) type Options struct { ScreenName string `short:"a" long:"account" description:"login as an account of selected screen_name"` } func main() { account := loadAccount() startUserStream(account) invokeInteractiv...
package main import ( "fmt" "log" "github.com/jessevdk/go-flags" "github.com/k0kubun/go-readline" ) type Options struct { ScreenName string `short:"a" long:"account" description:"login as an account of selected screen_name"` } func main() { options := new(Options) if _, err := flags.Parse(options); err != ni...
Move option parsing outside of loadAccount
Move option parsing outside of loadAccount
Go
mit
k0kubun/thunderbolt
663198fd530e12ef0d627bba7ebdc2779d080d0c
lib/flagutil/stringList.go
lib/flagutil/stringList.go
package flagutil import ( "strings" ) func (sl *StringList) String() string { return `"` + strings.Join(*sl, ",") + `"` } func (sl *StringList) Set(value string) error { *sl = strings.Split(value, ",") return nil }
package flagutil import ( "strings" ) func (sl *StringList) String() string { return `"` + strings.Join(*sl, ",") + `"` } func (sl *StringList) Set(value string) error { if value == "" { *sl = make(StringList, 0) } else { *sl = strings.Split(value, ",") } return nil }
Fix bug handling empty string in lib/flagutil.StringList.Set().
Fix bug handling empty string in lib/flagutil.StringList.Set().
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator
474e241cd74bfc856c1fbfa6894afe3be32018e5
internal/sys/owner_plan9.go
internal/sys/owner_plan9.go
package sys import ( "syscall" ) func fileOwner(v interface{}) (uid, gid, muid string) { uid = DefaultUid gid = DefaultGid //muid = DefaultMuid muid = "" stat, ok := v.(*syscall.Dir) if !ok { return } // This is pretty easy, it's almost like this OS // was made for 9P :D return stat.Uid, stat.Gid, stat...
package sys import ( "syscall" ) func fileOwner(v interface{}) (uid, gid, muid string) { uid = DefaultUid gid = DefaultGid muid = DefaultMuid stat, ok := v.(*syscall.Dir) if !ok { return } // This is pretty easy, it's almost like this OS // was made for 9P :D return stat.Uid, stat.Gid, stat.Muid }
Use the default value we set in the main owner.go
Use the default value we set in the main owner.go
Go
mit
droyo/styx
a7da9bcf5a3479d959364cd8b79f3e93c1673080
internal/sessmgr/session.go
internal/sessmgr/session.go
package sessmgr import ( "sync" "time" ) type Session struct { id string Last time.Time mu sync.RWMutex Val map[string]interface{} prov Provider } func NewSession(id string, provider Provider) *Session { v := make(map[string]interface{}, 0) return &Session{ id: id, Last: time.Now(), Val: v, pr...
package sessmgr import ( "sync" "time" ) type Session struct { id string Last time.Time mu sync.RWMutex Val map[string]interface{} prov Provider } func NewSession(id string, provider Provider) *Session { v := make(map[string]interface{}) return &Session{ id: id, Last: time.Now(), Val: v, prov:...
Remove cap from map def.
Remove cap from map def.
Go
mit
codemodus/formlark,codemodus/formlark,codemodus/formlark
2c6257b4c0882c4b254bf9112115743c8194d076
interfaces/sdk.go
interfaces/sdk.go
package interfaces import ( pickle "github.com/hydrogen18/stalecucumber" "github.com/pkg/errors" ) type SDK struct { Name string `json:"name" pickle:"name"` Version string `json:"version" pickle:"version"` ClientIP string `json:"clientIP" pickle:"client_ip"` Upstream Upstream `json:"upstream" pickle:...
package interfaces type SDK struct { Name string `json:"name" node:"name"` Version string `json:"version" node:"version"` ClientIP string `json:"clientIP" node:"client_ip"` Upstream Upstream `json:"upstream"` } type Upstream struct { Name string `json:"name"` URL string `json:"url"` IsNewer b...
Switch SDK from pickle mapper to mapstructure
Switch SDK from pickle mapper to mapstructure
Go
mit
diyan/assimilator,diyan/assimilator,diyan/assimilator
0f6027ac32c2afbd2b5a1d2532550f5b66c11204
pkg/remotedialer/wsconn.go
pkg/remotedialer/wsconn.go
package remotedialer import ( "io" "sync" "time" "github.com/gorilla/websocket" ) type wsConn struct { sync.Mutex conn *websocket.Conn } func newWSConn(conn *websocket.Conn) *wsConn { w := &wsConn{ conn: conn, } w.setupDeadline() return w } func (w *wsConn) WriteMessage(messageType int, data []byte) er...
package remotedialer import ( "io" "sync" "time" "github.com/gorilla/websocket" ) type wsConn struct { sync.Mutex conn *websocket.Conn } func newWSConn(conn *websocket.Conn) *wsConn { w := &wsConn{ conn: conn, } w.setupDeadline() return w } func (w *wsConn) WriteMessage(messageType int, data []byte) er...
Set write deadline in client/agent connections
Set write deadline in client/agent connections
Go
apache-2.0
rancherio/rancher,rancherio/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,cjellick/rancher
59ef0a66be61cec303c0fc557971e42f0a5e8fbd
rfc3797.go
rfc3797.go
package rfc3797 import ( "math" ) func main() { } func Entropy(n int, p int) float64 { i := 0 result := 0.0 if (n < 1) || (n >= p) { return 0.0 } for i = p; i > (p - n); i-- { result += math.Log(float64(i)) } for i = n; i > 1; i-- { result -= math.Log(float64(i)) } result /= 0.69315 return res...
package rfc3797 import ( "math" ) func main() { } func Entropy(n int, p int) float64 { i := 0 result := 0.0 // These cases represent invalid input values. if (n < 1) || (n >= p) { return 0.0 } for i = p; i > (p - n); i-- { result += math.Log(float64(i)) } for i = n; i > 1; i-- { result -= math.Log...
Use actual value of log_e(2) rather than five digit approximation.
Use actual value of log_e(2) rather than five digit approximation.
Go
isc
kyleroot/go-sortition
bb30b6f3c402e8081320e413535131472a695c04
src/unittest/testing.go
src/unittest/testing.go
package unittest import ( "testing" ) type Any interface{} func Failure(t *testing.T, x, y Any, mid string) { t.Fail() t.Log(x, mid, y) } func CheckEqual(t *testing.T, x, y Any) { if x != y { Failure(t, x, y, "!=") } } func CheckNotEqual(t *testing.T, x, y Any) { if x == y { ...
package unittest import ( "testing" ) type Any interface{} func Failure(t *testing.T, msg ...Any) { t.Fail() t.Log(msg) } func CheckEqual(t *testing.T, x, y Any) { if x != y { Failure(t, x, y, "!=") } } func CheckNotEqual(t *testing.T, x, y Any) { if x == y { Failure(t, x, y...
Add Check, CheckFalse, and tweak Failure message
Add Check, CheckFalse, and tweak Failure message
Go
mit
quintenpalmer/attempt,quintenpalmer/attempt,quintenpalmer/attempt,quintenpalmer/attempt
becb2e364d0373ba51cdffceafeda648ce928e87
far/far.go
far/far.go
package far import ( "bufio" "os" "strings" ) func FileExists(path string) bool { _, err := os.Stat(path) if err != nil { return false } else { return true } } func FindAndReplace(path, current, update string) (int, error) { file, _ := os.Open(path) defer file.Close() var lines []string scanner := b...
package far import ( "bufio" "os" "strings" ) func FileExists(path string) bool { _, err := os.Stat(path) if err != nil { return false } else { return true } } func FindAndReplace(path, current, update string) (int, error) { file, _ := os.Open(path) defer file.Close() var lines []string scanner := b...
Update replaceCount to handle multiple instances
Update replaceCount to handle multiple instances The previous implementation assumed that the word being replaced was only on a line once. This updates it to count the number of times the old string was present.
Go
mit
brettchalupa/far,brettchalupa/far
6cf1e5227d99c62935fde20cf7f21689bd3e5de5
src/todolist/todolist.go
src/todolist/todolist.go
// Provides a simple REST API implementing a basic to-do list package main import ( "expvar" "log" "net/http" "sync" "todolist/repo" "todolist/spi" ) var repository spi.Repo // Starts two HTTP services: // one at port 8080 for exposing the ToDoList REST service, // one at port 8081 for exposing the expvar ser...
// Provides a simple REST API implementing a basic to-do list package main import ( "expvar" "log" "net/http" "sync" "todolist/repo" "todolist/spi" ) var repository spi.Repo // Starts two HTTP services: // one at port 8080 for exposing the ToDoList REST service, // one at port 8081 for exposing the expvar ser...
Remove duplicate call to repo.Init()
Remove duplicate call to repo.Init()
Go
mit
peppelan/ToDoList,peppelan/ToDoList
3d2822b139183fb030861dc9a016fcd0f6e42d71
engines/native/config.go
engines/native/config.go
package nativeengine import schematypes "github.com/taskcluster/go-schematypes" type config struct { Groups []string `json:"groups,omitempty"` } var configSchema = schematypes.Object{ MetaData: schematypes.MetaData{ Title: "Native Engine Config", Description: "Configuration for the native engine, this engines ...
package nativeengine import schematypes "github.com/taskcluster/go-schematypes" type config struct { Groups []string `json:"groups,omitempty"` } var configSchema = schematypes.Object{ MetaData: schematypes.MetaData{ Title: "Native Engine Config", Description: "Configuration for the native engine, this engines ...
Add dot for the list of allowed group names. r=jonasfj
Add dot for the list of allowed group names. r=jonasfj MacOSX indeed has group names with dots. The particular case I found was com.apple.sharepoint.group.1.
Go
mpl-2.0
walac/taskcluster-worker,walac/taskcluster-worker
3c3b8dd9949dc34cee495bb7050d510f912599b0
directory/currency.go
directory/currency.go
// Copyright 2015, Cyrill @ Schumacher.fm and the CoreStore contributors // // 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 ...
// Copyright 2015, Cyrill @ Schumacher.fm and the CoreStore contributors // // 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 ...
Move AllowedCurrencies from store into directory package
directory: Move AllowedCurrencies from store into directory package
Go
apache-2.0
joao-parana/csfw,corestoreio/csfw,corestoreio/csfw
200c04ac515bce92fe32756555633878588865b4
map/map.go
map/map.go
package mapper import ( "git.aviuslabs.net/golang/async" "reflect" ) func Map(data interface{}, routine async.Routine, callbacks ...async.Done) error { var ( routines []async.Routine results []interface{} ) d := reflect.ValueOf(data) for i := 0; i < d.Len(); i++ { v := d.Index(i).Interface(...
package mapper import ( "git.aviuslabs.net/golang/async" "reflect" ) func Map(data interface{}, routine async.Routine, callbacks ...async.Done) { var ( routines []async.Routine results []interface{} ) d := reflect.ValueOf(data) for i := 0; i < d.Len(); i++ { v := d.Index(i).Interface() ...
Remove error return from Map; it's most likely not going to be used
Remove error return from Map; it's most likely not going to be used
Go
mit
Southern/async
f66c3dbe9c7a9606415e1918c9c6e6232fb64c59
building/build-debs/homeworld-keyserver/src/keycommon/knc/knc.go
building/build-debs/homeworld-keyserver/src/keycommon/knc/knc.go
package knc import ( "fmt" "os/exec" "encoding/json" "keycommon/reqtarget" ) type KncServer struct { Hostname string } func (k KncServer) kncRequest(data []byte) ([]byte, error) { cmd := exec.Command("/usr/bin/knc", fmt.Sprintf("host@%s", k.Hostname), "20575") stdin, err := cmd.StdinPipe() if err != nil { ...
package knc import ( "fmt" "os/exec" "encoding/json" "keycommon/reqtarget" ) type KncServer struct { Hostname string } func (k KncServer) kncRequest(data []byte) ([]byte, error) { cmd := exec.Command("/usr/bin/knc", fmt.Sprintf("host@%s", k.Hostname), "20575") stdin, err := cmd.StdinPipe() if err != nil { ...
Make sure number of responses matches number of requests
Make sure number of responses matches number of requests
Go
mit
sipb/homeworld,sipb/homeworld,sipb/homeworld,sipb/homeworld
63a647620e5319d3fb2849e085fe2184c734e3bd
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/assert" "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", } fun...
Use assert instead of require for fixture tests
Use assert instead of require for fixture tests
Go
mit
justincampbell/lastpost
1bdf3df835853714ad321f56b7618b66e6f9b4b4
pkg/skaffold/build/local/bazel_test.go
pkg/skaffold/build/local/bazel_test.go
/* Copyright 2018 The Skaffold Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
/* Copyright 2018 The Skaffold Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
Add a few unit tests
Add a few unit tests Signed-off-by: David Gageot <aa743a0aaec8f7d7a1f01442503957f4d7a2d634@gageot.net>
Go
apache-2.0
GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold
95990453f05457ce3d7cc29ea3f32d149e5ee202
cmd/gns/main.go
cmd/gns/main.go
package main import ( "github.com/gnamma/server" "log" ) func main() { s := server.New(server.Options{ Name: "Bar", Description: "Yeah. This seems appropriate?", Address: ":3000", }) log.Println("Starting Gnamma server...") log.Printf("Name: %v, Description: %v\n", s.Opts.Name, s.Opts.Descrip...
package main import ( "flag" "log" "github.com/gnamma/server" ) var ( name = flag.String("name", "server", "The name of the server which you want to host") description = flag.String("description", "Greetings, traveller!", "A short description of the server") address = flag.String("address", ":3000",...
Add flags to GNS cli
Add flags to GNS cli
Go
mit
gnamma/server
f1b061d99e7405d5f83e0b437fac0e1689f8852f
conversation.go
conversation.go
package slack // Conversation is the foundation for IM and BaseGroupConversation type conversation struct { ID string `json:"id"` Created JSONTime `json:"created"` IsOpen bool `json:"is_open"` LastRead string `json:"last_read,omitempty"` Latest ...
package slack // Conversation is the foundation for IM and BaseGroupConversation type conversation struct { ID string `json:"id"` Created JSONTime `json:"created"` IsOpen bool `json:"is_open"` LastRead string `json:"last_read,omitempty"` Latest ...
Remove num_members as it's not exposed anymore
Remove num_members as it's not exposed anymore
Go
bsd-2-clause
james-lawrence/slack,178inaba/slack,nlopes/slack
5491b9bf0412373fc78ca70452db3ce552d7b094
lib/randstr/randstr_bm_test.go
lib/randstr/randstr_bm_test.go
package randstr import "testing" func BenchmarkNew(b *testing.B) { for i := 0; i < b.N; i++ { New(50, ASCIIRunes) } }
package randstr import "testing" func BenchmarkNewSmallSource(b *testing.B) { runes := ASCIIRunes for i := 0; i < b.N; i++ { New(50, runes) } } func BenchmarkNewLargeSource(b *testing.B) { runesLit := [9999999]rune{} runes := runesLit[:] for i := 0; i < b.N; i++ { New(50, runes) } }
Add additional benchmarks with larges sources.
Add additional benchmarks with larges sources. What === Add additional benchmarks with larges sources. Why === Tests
Go
mit
leighmcculloch/randstr
809e04f2d16c4bac5b7d38f13537d3debfe0d914
similarity/similarity_examples_test.go
similarity/similarity_examples_test.go
package similarity import ( "fmt" "github.com/mcroydon/goplayground/similarity" ) func ExampleUse() { // Create a similarity engine sim := similarity.New() // Create some items critic1 := "critic1" critic2 := "critic2" rating1 := similarity.Item{"In a World", 3.5} rating2 := similarity.Item{"In a World", 2....
package similarity import ( "fmt" "github.com/mcroydon/goplayground/similarity" ) func Example() { // Create a similarity engine sim := similarity.New() // Create some items critic1 := "critic1" critic2 := "critic2" rating1 := similarity.Item{"In a World", 3.5} rating2 := similarity.Item{"In a World", 2.0} ...
Use Example while there is a single example.
Use Example while there is a single example.
Go
bsd-3-clause
mcroydon/goplayground
1c761da744e8672d92310a6d2f12db9ca61136a7
audit/audit.go
audit/audit.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package audit import ( "gopkg.in/juju/charm.v6-unstable" "time" ) // Operation represents the type of an entry. type Operation string const ( // OpSetPerm represents the setting of ACLs on an entity. // Required fields:...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package audit import ( "gopkg.in/juju/charm.v6-unstable" "time" ) // Operation represents the type of an entry. type Operation string const ( // OpSetPerm represents the setting of ACLs on an entity. // Required fields:...
Use ops only instead of ops + boolean.
Use ops only instead of ops + boolean.
Go
agpl-3.0
ericsnowcurrently/juju-charmstore,wallyworld/charmstore,ericsnowcurrently/juju-charmstore,ericsnowcurrently/juju-charmstore,frankban/charmstore,fabricematrat/charmstore,fabricematrat/charmstore,jrwren/charmstore,jrwren/charmstore,juju/charmstore,frankban/charmstore,jrwren/charmstore,fabricematrat/charmstore,wallyworld/...
f41d106ca24e93710b469dce1cd9786c4716d25d
cli/version.go
cli/version.go
package cli // The git commit that was compiled. This will be filled in by the compiler. var GitCommit string var GitDescribe string // The main version number that is being run at the moment. const Version = "0.3.1" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a ...
package cli // The git commit that was compiled. This will be filled in by the compiler. var GitCommit string var GitDescribe string // The main version number that is being run at the moment. const Version = "0.3.1" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a ...
Tag with dev for builds
Tag with dev for builds
Go
mpl-2.0
joelthompson/vault,hartsock/vault,hashicorp/vault,tallpauley/vault,lemondrank/vault,lirao/vault,Aloomaio/vault,quixoten/vault,rnaveiras/vault,andrewstuart/vault,memory/vault,jmhardison/vault,ryon/vault,peteryhwong/vault,ryon/vault,quixoten/vault,deverton/hashicorp-vault,pradeepchhetri/vault,kingland/vault,jam-pot/vault...
a993ac3696c8d38c06fe68279c5325b7b60e6aad
buildbox/version.go
buildbox/version.go
package buildbox import "fmt" // buildVersion can be overriden at compile time by using: // // go run -ldflags "-X github.com/buildbox/agent/buildbox.buildVersion abc" *.go --version var baseVersion string = "1.0-beta.6" var buildVersion string = "" func Version() string { if buildVersion != "" { return fmt.Spr...
package buildbox import "fmt" // buildVersion can be overriden at compile time by using: // // go run -ldflags "-X github.com/buildbox/agent/buildbox.buildVersion abc" *.go --version var baseVersion string = "1.0-beta.6" var buildVersion string = "" func Version() string { if buildVersion != "" { return fmt.Spr...
Switch to using a . for the buildVersion.
Switch to using a . for the buildVersion.
Go
mit
grosskur/agent,joelmoss/agent,Jasperswaagman/agent,es/agent,joelmoss/agent,Jasperswaagman/agent,Shopify/agent,buildkite/agent,tommeier/agent,Jasperswaagman/agent,joelmoss/agent,buildkite/agent,Shopify/agent,buildkite/agent,es/agent,es/agent,grosskur/agent,tommeier/agent,tommeier/agent,Shopify/agent,grosskur/agent