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
a79836fb890927a7d83234768e9b1dc80d64e934
cmd/scipipe/main_test.go
cmd/scipipe/main_test.go
package main import ( "testing" ) func TestNewCmd(t *testing.T) { initLogsTest() args := []string{"new", "/tmp/testwf.go"} err := parseFlags(args) if err != nil { t.Error("Could not parse flags:", err.Error()) } }
package main import ( "os" "testing" ) func TestNewCmd(t *testing.T) { initLogsTest() testWfPath := "/tmp/testwf.go" args := []string{"new", testWfPath} err := parseFlags(args) if err != nil { t.Error("Could not parse flags:", err.Error()) } if _, err := os.Stat(testWfPath); os.IsNotExist(err) { t.Err...
Extend test of scipipe command
Extend test of scipipe command
Go
mit
scipipe/scipipe,scipipe/scipipe,samuell/scipipe
a00015cc8eacbd990585bd2317b5623d96c6ddcd
jobs.go
jobs.go
package main import ( "fmt" ) func inspectJob(id uint64) (err error) { body, err := conn.Peek(id) stats, _ := conn.StatsJob(id) if err != nil { return fmt.Errorf("Unknown job %v", id) } printJob(id, body, stats) return } func nextJobs(state string) { for _, t := range ctubes { fmt.Printf("Next %s job i...
package main import ( "fmt" ) func inspectJob(id uint64) (err error) { body, err := conn.Peek(id) stats, _ := conn.StatsJob(id) if err != nil { return fmt.Errorf("Unknown job %v", id) } printJob(id, body, stats) return } func nextJobs(state string) { for _, t := range ctubes { fmt.Printf("Next %s job i...
Drop time-left from job stats.
Drop time-left from job stats.
Go
bsd-3-clause
davidpersson/bsa
c202a405cd88216a81f58ae2dc2a504e38be5dd6
pkg/kubelet/cm/cgroup_manager_unsupported.go
pkg/kubelet/cm/cgroup_manager_unsupported.go
// +build !linux /* Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by ap...
// +build !linux /* Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by ap...
Fix reference to linux-only struct
Fix reference to linux-only struct
Go
apache-2.0
gtank/kubernetes,tsungming/kubernetes,arashbina/kubernetes,tvansteenburgh/kubernetes,rajatchopra/kubernetes,rthallisey/kubernetes,oulinbao/kubernetes,jagosan/kubernetes,jakub-d/kubernetes,carlory/kubernetes,zhouhaibing089/kubernetes,jonboulle/kubernetes,ingvagabund/kubernetes,humblec/kubernetes,vipulsabhaya/kubernetes,...
cca1f7e051b46f517e278d9d3ea99de270e1c5b2
download/download.go
download/download.go
package download import ( "fmt" "io" "log" "net/http" "os" "github.com/srt32/hkpg/heroku" ) // DownloadUrl takes a url string, downloads it, and copies it to a local file // on disk. func DownloadUrl(url string, transfer *heroku.Transfer) (*os.File, error) { out, err := os.Create(fmt.Sprintf("backup-%d", tran...
package download import ( "fmt" "io" "log" "net/http" "os" "github.com/srt32/hkpg/heroku" ) // DownloadUrl takes a url string, downloads it, and copies it to a local file // on disk. func DownloadUrl(url string, transfer *heroku.Transfer) (*os.File, error) { out, err := os.Create(fmt.Sprintf("backup-%d", tran...
Fix go vet error on resp usage
Fix go vet error on resp usage
Go
mit
srt32/hkpg
bb9d4ade0b677d7f84deec9c354e372edba6a2ec
collector/uname_linux_int8.go
collector/uname_linux_int8.go
// Copyright 2015 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
// Copyright 2015 The Prometheus 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...
Build for 32bit MIPS too
uname_linux: Build for 32bit MIPS too Since Go 1.8 32bit MIPS Big/Little Endian are supported assuming the target runs Linux and the kernel either emulates an FPU or can access the CPU one. This allows the node_collector to build for mips and mipsle opening up the possibility of running it on things like home routers...
Go
apache-2.0
Jean-Daniel/node_exporter,derekmarcotte/node_exporter,bs-github/node_exporter,derekmarcotte/node_exporter,Jean-Daniel/node_exporter,derekmarcotte/node_exporter,chosenken/node_exporter,ema/node_exporter,prometheus/node_exporter,chosenken/node_exporter,siavashs/node_exporter,knweiss/node_exporter,prometheus/node_exporter...
eccc2f678e62451c5515ebc136d6bc0da78cd969
client.go
client.go
package main import ( "fmt" "github.com/jasonpuglisi/ircutil" ) // main requests a server and user which it uses establish a connection. It // runs a loop to keep the client alive until it is no longer active. func main() { // Request a server with the specified details. server, err := ircutil.CreateServer("...
package main import ( "fmt" "github.com/jasonpuglisi/ircutil" ) // main requests a server and user which it uses establish a connection. It // runs a loop to keep the client alive until it is no longer active. func main() { // Request a server with the specified details. server, err := ircutil.CreateServer("...
Change connection port to a secure one
Change connection port to a secure one
Go
mit
JasonPuglisi/inami-irc-bot
10735dacff0d670a47abc378c6823ee3398e9cf9
events.go
events.go
package sensu import "fmt" // GetEvents Return all the current events func (s *Sensu) GetEvents() ([]interface{}, error) { return s.GetList("events", 0, 0) } // GetEventsForClient Returns the current events for given client func (s *Sensu) GetEventsForClient(client string) ([]interface{}, error) { //return s.Get("...
package sensu import ( "encoding/json" "fmt" ) // GetEvents Return all the current events func (s *Sensu) GetEvents() ([]interface{}, error) { return s.GetList("events", 0, 0) } // GetEventsForClient Returns the current events for given client func (s *Sensu) GetEventsForClient(client string) ([]interface{}, erro...
Add ResolveEvent function that use POST instead of DELETE
Add ResolveEvent function that use POST instead of DELETE
Go
mit
bencaron/gosensu
1632f1b9f56d91e3c5df698cd9c95fefb88a4dd7
device.go
device.go
package cc1100 import ( "github.com/ecc1/gpio" "github.com/ecc1/spi" ) const ( spiSpeed = 1000000 // Hz gpioPin = 14 // Intel Edison GPIO connected to GDO0 ) type Device struct { spiDev *spi.Device rxGPIO gpio.InputPin } func Open() (*Device, error) { spiDev, err := spi.Open(spiSpeed) if err != nil { ...
package cc1100 import ( "github.com/ecc1/gpio" "github.com/ecc1/spi" ) const ( spiSpeed = 6000000 // Hz gpioPin = 14 // Intel Edison GPIO connected to GDO0 ) type Device struct { spiDev *spi.Device rxGPIO gpio.InputPin } func Open() (*Device, error) { spiDev, err := spi.Open(spiSpeed) if err != nil { ...
Increase SPI clock speed and trigger receive interrupt on both rise and fall
Increase SPI clock speed and trigger receive interrupt on both rise and fall
Go
mit
ecc1/cc1101
ce74a4d3d6e9780cfeae8675a8cfe947d97ea5c7
models/gopher.go
models/gopher.go
package models type Direction byte const ( North Direction = 1 << iota South East West ) type Coordinate struct { X, Y int } type Gopher struct { // Current direction Direction Direction X, Y int Path []Coordinate } func (g *Gopher) Increment() { }
package models type Direction byte const ( North Direction = 1 << iota South East West ) type Coordinate struct { X, Y int } type Gopher struct { // Current direction Direction Direction X, Y int Path []Coordinate Score int }
Remove (*Gopher).Increment, add Score field to struct Gopher
Remove (*Gopher).Increment, add Score field to struct Gopher
Go
mit
gophergala2016/gophertron,gophergala2016/gophertron,gophergala2016/gophertron
f557f30e6eca6f28d8833300ec532198b99deaff
osfs/os_posix.go
osfs/os_posix.go
// +build !windows package osfs import ( "syscall" ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() return syscall.Flock(int(f.File.Fd()), syscall.LOCK_EX) } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() return syscall.Flock(int(f.File.Fd()), syscall.LOCK_UN) }
// +build !windows package osfs import ( "golang.org/x/sys/unix" ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() return unix.Flock(int(f.File.Fd()), unix.LOCK_EX) } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() return unix.Flock(int(f.File.Fd()), unix.LOCK_UN) }
Change Posix File Locking to x/unix
Change Posix File Locking to x/unix syscall Flock only supports Linux. Use the experimental (not really) unix interface which supports most posix systems properly Signed-off-by: Till Wegmüller <66e0e48c0ddce54a68253eee164bd68e988b251f@gmail.com>
Go
apache-2.0
src-d/go-billy,src-d/go-billy,go-git/go-billy
d3385905181ee73971d5dbadf7566d60b285570d
release_job_manifest.go
release_job_manifest.go
package enaml type JobManifest struct { Properties map[string]JobManifestProperty `yaml:"properties"` } type JobManifestProperty struct { Description string `yaml:"description"` Default interface{} `yaml:"default"` }
package enaml type JobManifest struct { Name string `yaml:"name"` Properties map[string]JobManifestProperty `yaml:"properties"` } type JobManifestProperty struct { Description string `yaml:"description"` Default interface{} `yaml:"default"` }
Add Name to job manifest yaml struct
Add Name to job manifest yaml struct
Go
apache-2.0
xchapter7x/enaml,enaml-ops/enaml
510949fd1ab80f305779a5d1465c8c18ac1a21f2
utils/data_rate_counter.go
utils/data_rate_counter.go
package utils import ( "github.com/paulbellamy/ratecounter" "github.com/c2h5oh/datasize" "time" ) type DataRateCounter interface { GetDataRate() datasize.ByteSize CaptureEvent(rate int) } func NewRateCounter() DataRateCounter { return dataRateCounter{ rateCounter: ratecounter.NewRateCounter(10 * time.Second)...
package utils import ( "github.com/paulbellamy/ratecounter" "github.com/c2h5oh/datasize" "time" ) type DataRateCounter interface { GetDataRate() datasize.ByteSize CaptureEvent(rate int) } func NewRateCounter() DataRateCounter { counter := dataRateCounter{ rateCounter: ratecounter.NewRateCounter(10 * time...
Update data rate counter on no activity
Update data rate counter on no activity
Go
mit
selvakn/p2p-port-forward
616662aaac757337c2c3713ea2e9fabad2ac50ec
hasher.go
hasher.go
// Copyright 2017 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
// Copyright 2017 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
Add package comment and TODO
Add package comment and TODO
Go
apache-2.0
transparency-dev/merkle,transparency-dev/merkle
6ac93a38d4af760b588995c3212374b3f3441b51
api/consts.go
api/consts.go
package api const ( // Version of Rikka Version = "0.2.0" )
package api const ( // Version of Rikka Version = "0.1.9" )
Revert "update version to 0.2.0"
Revert "update version to 0.2.0" This reverts commit ce6aec180fda6da1d85af778273805f363b9609f.
Go
mit
7sDream/rikka,7sDream/rikka,7sDream/rikka
6f6284ff0459d132e8d52a30054fddd574e976ef
test/escape1.go
test/escape1.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 func out_escapes() (x int, p *int) { p = &x; // ERROR "address.*out parameter" return; } func out_escapes() (x int, p *i...
// 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 func out_escapes() (x int, p *int) { p = &x; // ERROR "address of out parameter" return; } func out_escapes_2() (x int, ...
Rename function to avoid function redefinition error. Remove .* from regexp since it confuses DejaGNU which runs gcc's testsuite.
Rename function to avoid function redefinition error. Remove .* from regexp since it confuses DejaGNU which runs gcc's testsuite. R=rsc DELTA=3 (0 added, 0 deleted, 3 changed) OCL=24435 CL=24438
Go
bsd-3-clause
tav/go,tav/go,tav/go,tav/go,tav/go,tav/go,tav/go
283874315567f7a541ad7d7898fb0b93f205663f
link_tuntap_linux.go
link_tuntap_linux.go
package netlink /* #include <sys/ioctl.h> #include <sys/socket.h> #include <linux/if.h> #include <linux/if_tun.h> #define IFREQ_SIZE sizeof(struct ifreq) */ import "C" type ifReq struct { Name [C.IFNAMSIZ]byte Flags uint16 pad [C.IFREQ_SIZE - C.IFNAMSIZ - 2]byte }
package netlink // ideally golang.org/x/sys/unix would define IfReq but it only has // IFNAMSIZ, hence this minimalistic implementation const ( SizeOfIfReq = 40 IFNAMSIZ = 16 ) type ifReq struct { Name [IFNAMSIZ]byte Flags uint16 pad [SizeOfIfReq - IFNAMSIZ - 2]byte }
Drop cgo usage for ifReq structure.
Drop cgo usage for ifReq structure. Signed-off-by: Dimitri John Ledkov <3a186048b7a8be3b43dc8ce91265b77c64654081@intel.com>
Go
apache-2.0
mcastelino/netlink,paravmellanox/netlink,axsh/netlink,vishvananda/netlink,porjo/netlink,chantra/netlink
026348035cb2a9cc885794f759f962d828c79c0b
barbench_test.go
barbench_test.go
package mpb import ( "io/ioutil" "testing" ) func BenchmarkIncrSingleBar(b *testing.B) { p := New(WithOutput(ioutil.Discard)) bar := p.AddBar(int64(b.N)) for i := 0; i < b.N; i++ { bar.Increment() } } func BenchmarkIncrSingleBarWhileIsNotCompleted(b *testing.B) { p := New(WithOutput(ioutil.Discard)) bar :=...
package mpb import ( "io/ioutil" "testing" "github.com/vbauerster/mpb/decor" ) func BenchmarkIncrSingleBar(b *testing.B) { p := New(WithOutput(ioutil.Discard)) bar := p.AddBar(int64(b.N)) for i := 0; i < b.N; i++ { bar.Increment() } } func BenchmarkIncrSingleBarWhileIsNotCompleted(b *testing.B) { p := New...
Add bench with name decorator
Add bench with name decorator
Go
unlicense
vbauerster/mpb,vbauerster/mpb
d3dd3e6baf8432622a69f31650f8119edf157fca
pkg/auth/dependency/userverify/tx_store.go
pkg/auth/dependency/userverify/tx_store.go
package userverify import ( "github.com/sirupsen/logrus" "github.com/skygeario/skygear-server/pkg/core/db" ) type safeStoreImpl struct { impl *storeImpl txContext db.SafeTxContext } func NewSafeStore( builder db.SQLBuilder, executor db.SQLExecutor, logger *logrus.Entry, txContext db.SafeTxContext, ) Sto...
package userverify import ( "github.com/sirupsen/logrus" "github.com/skygeario/skygear-server/pkg/core/db" ) type safeStoreImpl struct { impl *storeImpl txContext db.SafeTxContext } func NewSafeStore( builder db.SQLBuilder, executor db.SQLExecutor, logger *logrus.Entry, txContext db.SafeTxContext, ) Sto...
Add missing tx context for user verify tx store.
Add missing tx context for user verify tx store.
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
50f8ba0a08e810846c1a764f7fdffe8a3daf53fb
ptypes/reverseint.go
ptypes/reverseint.go
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package ptypes import "math" // ReverseInt returns reversed x digits. // 0, false is returned if x cannot be reversed because of int64 overflow. // The...
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package ptypes import "math" // ReverseInt returns reversed x digits. // 0, false is returned if x cannot be reversed because of int64 overflow. // The...
Add check for multiplication overflow in ptypes.ReverseInt function
Add check for multiplication overflow in ptypes.ReverseInt function
Go
mit
mrekucci/epi,mrekucci/epi
1883546b2f34e46d10ba146b8df17147f282b95e
device_test.go
device_test.go
package main import ( "testing" ) func TestNewK(t *testing.T) { k := NewK("iso9995") if k.Proc != "/proc/bus/input/devices" { t.Errorf("NewK() error: expected '/proc/bus/input/devices', received %q", k.Proc) } } func TestKBLookup(t *testing.T) { k := K{"./fixtures/devices", Mapper{}} kbd, err := k.Lookup() ...
package main import ( "testing" ) func TestNewK(t *testing.T) { k := NewK("iso9995") if k.Proc != "/proc/bus/input/devices" { t.Errorf("NewK() error: expected '/proc/bus/input/devices', received %q", k.Proc) } } func TestKBLookup(t *testing.T) { k := K{"./fixtures/devices", false, false, false, []Mapping{}, 0...
Create K with full intializer vals
Create K with full intializer vals
Go
mit
jspc/go-kbd
cd88e0523907a427b9d7248c0a1c37a2199a4baf
empty_test.go
empty_test.go
package gstrings import ( "github.com/wallclockbuilder/testify/assert" "testing" ) func TestEmpty(t *testing.T) { assert := assert.New(t) assert.Equal(false, Empty("hello")) assert.Equal(false, Empty(" ")) assert.Equal(true, Empty("")) }
package gstrings import ( "fmt" "github.com/wallclockbuilder/testify/assert" "testing" ) func ExampleEmpty(){ fmt.Println(Empty("hello")) fmt.Println(Empty(" ")) fmt.Println(Empty("")) // Output: false // false // true } func TestEmpty(t *testing.T) { assert := assert.New(t) assert.Equal(false, Empty("hel...
Add examples to docs for Empty()
Add examples to docs for Empty()
Go
bsd-2-clause
wallclockbuilder/gstrings,wallclockbuilder/stringutil
c3f3ad2686e443847296f86f521f4b6ba3b66494
input.go
input.go
package peco import "github.com/nsf/termbox-go" type Input struct { *Ctx } func (i *Input) Loop() { defer i.ReleaseWaitGroup() // XXX termbox.PollEvent() can get stuck on unexpected signal // handling cases. We still would like to wait until the user // (termbox) has some event for us to process, but we don't ...
package peco import "github.com/nsf/termbox-go" type Input struct { *Ctx } func (i *Input) Loop() { defer i.ReleaseWaitGroup() // XXX termbox.PollEvent() can get stuck on unexpected signal // handling cases. We still would like to wait until the user // (termbox) has some event for us to process, but we don't ...
Make sore to keep polling for events
Make sore to keep polling for events
Go
mit
dav009/peco,ken-saka/peco,peco/peco,ukitazume/peco,reiki4040/peco,r7kamura/peco,polamjag/peco
786327941ec633d34ff9c6844d01815bd75e11da
khipu.go
khipu.go
package gokhipu var ( basePath = "https://khipu.com/api/2.0" ) // Khipu implements a basic struct with revelant data to handle // khipu's API requests. type Khipu struct { Secret string ReceiverID string } // NewKhipuClient returns an instance of khipu that is the client to make payment request func NewKhipuC...
package gokhipu import ( "fmt" "net/http" ) var ( basePath = "https://khipu.com/api/2.0" ) // Khipu implements a basic struct with revelant data to handle // khipu's API requests. type Khipu struct { Secret string ReceiverID string } // NewKhipuClient returns an instance of khipu that is the client to make...
Add Banks request to Khipu
Add Banks request to Khipu
Go
mit
mtavano/ghipu
57686db26173e59898a68ac9c1631f51d0dd36be
mesos/state.go
mesos/state.go
package mesos import ( "fmt" "github.com/CiscoCloud/mesos-consul/registry" ) func (sj *StateJSON) GetFollowerById(id string) (string, error) { for _, f := range sj.Followers { if f.Id == id { return f.Hostname, nil } } return "", fmt.Errorf("Follower not found: %s", id) } // Task Methods // GetCheck(...
package mesos import ( "fmt" "strings" "github.com/CiscoCloud/mesos-consul/registry" ) func (sj *StateJSON) GetFollowerById(id string) (string, error) { for _, f := range sj.Followers { if f.Id == id { return f.Hostname, nil } } return "", fmt.Errorf("Follower not found: %s", id) } // Task Methods /...
Create a Consul check from mesos task labels
Create a Consul check from mesos task labels
Go
apache-2.0
CiscoCloud/mesos-consul,mantl/mesos-consul
ad9aa00b60b2c8f50a5ba7b3e021bd1183227e14
lib/writer.go
lib/writer.go
package fm import ( "go/ast" "go/format" "go/token" "os" ) type ASTWriter interface { Write(file *ast.File, filename string) error } type DiskASTWriter struct{} func (d *DiskASTWriter) Write(file *ast.File, filename string) error { spyFile, err := os.Create(filename) if err != nil { return err } return ...
package fm import ( "go/ast" "go/format" "go/token" "os" ) // ASTWriter writes the ast.File to the provided filename type ASTWriter interface { Write(file *ast.File, filename string) error } // DiskASTWriter saves an AST to disk type DiskASTWriter struct{} // Write outputs the ast.File to a file on disk specif...
Add missing documentation to exported types
Add missing documentation to exported types
Go
unlicense
enocom/fm,enocom/fm
17797e2cded9aeab7bf4d7a005339a4af6944d34
archive.go
archive.go
package gohandy import ( "archive/tar" "io" "os" "path/filepath" ) func Unpack(r *tar.Reader, toPath string) error { for { hdr, err := r.Next() if err == io.EOF { break } if err != nil { return err } err = nil if hdr.Typeflag == tar.TypeDir { dirpath := filepath.Join(toPath, hdr.Name) ...
package gohandy import ( "archive/tar" "io" "os" "path/filepath" ) func Unpack(r *tar.Reader, toPath string) error { for { hdr, err := r.Next() switch { case err == io.EOF: break case err != nil: return err default: if err := doOnType(hdr.Typeflag, toPath, hdr.Name, r); err != nil { return...
Refactor to make code more readable.
Refactor to make code more readable.
Go
mit
materials-commons/gohandy,materials-commons/gohandy
c0cf69fed31eebd6efcaaf40bb5788659efa818e
generator/generator_test.go
generator/generator_test.go
package generator import ( "io" "reflect" "testing" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) func TestGenerator_GenerateAllFiles(t *testing.T) { type fields struct { w io.Writer } tests := []struct { name string fields fields want *plugin.CodeG...
package generator import ( "fmt" "os" "testing" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/google/go-cmp/cmp" ) func TestGenerator_GenerateAllFiles(t *testing.T) { type fields struct { } tests := []struct { name string fields fields want ...
Change to open proto file from testdata
Change to open proto file from testdata
Go
mit
nametake/protoc-gen-gohttp
c7a917086e16dd9c2c8200ffaa156d6efc3c893f
github/util.go
github/util.go
// +build linux,darwin package github import ( "code.google.com/p/go.crypto/ssh/terminal" ) func isTerminal(fd uintptr) bool { return terminal.IsTerminal(int(fd)) }
// +build !windows package github import ( "code.google.com/p/go.crypto/ssh/terminal" ) func isTerminal(fd uintptr) bool { return terminal.IsTerminal(int(fd)) }
Use not windows build tag
Use not windows build tag
Go
mit
ASidlinskiy/hub,dongjoon-hyun/hub,elancom/hub,ASidlinskiy/hub,pankona/hub,boris-rea/hub,elancom/hub,terry2000/hub,RichardLitt/hub,AndBicScadMedia/hub,github/hub,sbp/hub,AndBicScadMedia/hub,cpick/hub,jingweno/hub,github/hub,haikyuu/hub,dev4mobile/hub,ASidlinskiy/hub,nmfzone/hub,adjohnson916/hub,hopil/hub,jpkrohling/hub,...
1de3392374d9324fe3f9aefb32b7c61d6fe684c4
movie_info.go
movie_info.go
package main // #include "types.h" import "C" import ( "fmt" "github.com/amarburg/go-lazyquicktime" ) //export MovInfo func MovInfo(path *C.char) C.MovieInfo { file, err := sourceFromCPath(path) if err != nil { fmt.Printf("Error opening path: %s", err.Error()) return C.MovieInfo{} } qtInfo, err := lazyqu...
package main // #include "types.h" import "C" import ( "fmt" "github.com/amarburg/go-lazyquicktime" ) //export MovInfo func MovInfo(path *C.char) C.MovieInfo { file, err := sourceFromCPath(path) if file == nil || err != nil { fmt.Printf("Error opening path: %s", err.Error()) return C.MovieInfo{} } qtInfo...
Check for nil file as well.
Check for nil file as well.
Go
mit
amarburg/cgo-lazyquicktime,amarburg/cgo-lazyquicktime,amarburg/cgo-lazyquicktime
a8193acb0ac722ae0817343104b529680ddaa8d9
go/ws_2/src/github.com/bdastur/aws/s3helper.go
go/ws_2/src/github.com/bdastur/aws/s3helper.go
package aws import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" ) func ListBuckets() { fmt.Println("List buckets") // Specify profile for config and region for requests sess := sessi...
package aws import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" ) func ListBuckets() { fmt.Println("List buckets") // Specify profile for config and region for requests sess := sessi...
Update the s3 api example
Update the s3 api example
Go
apache-2.0
bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes
b87b4e14909f176471fffc48fb2dab77f1d4f69a
obs.go
obs.go
package fate type bigrams map[token]*tokset func (b bigrams) Observe(tok0 token, tok1 token) { ctx, ok := b[tok0] if !ok { ctx = &tokset{} b[tok0] = ctx } ctx.Add(tok1) } type fwdrev struct { fwd *tokset rev *tokset } type trigrams map[bigram]*fwdrev func (t trigrams) Observe(tok0, tok1, tok2, tok3 token...
package fate type bigrams map[token]*tokset func (b bigrams) Observe(tok0 token, tok1 token) { ctx, ok := b[tok0] if !ok { ctx = &tokset{} b[tok0] = ctx } ctx.Add(tok1) } type fwdrev struct { fwd tokset rev tokset } type trigrams map[bigram]*fwdrev func (t trigrams) Observe(tok0, tok1, tok2, tok3 token) ...
Remove an extra layer of pointer indirection in the trigram map
Remove an extra layer of pointer indirection in the trigram map Reduces memory usage and makes learning faster. benchmark old ns/op new ns/op delta BenchmarkLearn-4 23213 20426 -12.01% BenchmarkReply-4 15738 14160 -10.03% BenchmarkLear...
Go
mit
pteichman/fate
64679af83fb76d2eae24cf491e466902cf16adc6
potcp/potcp.go
potcp/potcp.go
package potcp import ( "proboscis-go" "net" ) type HandlerFunction func(*proboscis.Request) *proboscis.Response type Handler struct { Method string Format string Function HandlerFunction } type Server struct { Handlers map[string]*Handler } func NewServer() *Server { var server *Server server = &Se...
package potcp import ( "proboscis-go" "net" ) type HandlerFunction func(*proboscis.Request) *proboscis.Response type Handler struct { Method string Format string Function HandlerFunction } type Server struct { Handlers map[string]*Handler Conn net.Conn } type Client struct { Conn net.Conn } fu...
Add connection to server; start work on clients
PoTCP: Add connection to server; start work on clients
Go
mit
dirk/proboscis-go
048af03cc80792259958aa3d1761fa6db0247f72
main.go
main.go
package main import ( "log" "os" "github.com/FiloSottile/CVE-2016-2107/LuckyMinus20" ) func main() { res, err := LuckyMinus20.Test(os.Args[1]) if err != nil { log.Fatal(err) } log.Println("Vulnerable:", res) }
package main import ( "log" "os" "github.com/FiloSottile/CVE-2016-2107/LuckyMinus20" ) func main() { res, err := LuckyMinus20.Test(os.Args[1]) if err != nil { log.Fatal(err) } log.Println("Vulnerable:", res) if res { os.Exit(1) } }
Exit with 1 when test is positive
Exit with 1 when test is positive Unix Filippo! Come on! Will someone think of the _exit codes_
Go
mit
FiloSottile/CVE-2016-2107
896dd2ce1ea1b57dae735425158226b824115121
main.go
main.go
package main import ( "bufio" "fmt" "log" "os/exec" ) func main() { cmd := exec.Command("./a.sh") stdout, err := cmd.StdoutPipe() if err != nil { log.Fatal(err) } if err := cmd.Start(); err != nil { log.Fatal(err) } scanner := bufio.NewScanner(stdout) for scanner.Scan() { fmt.Println(scanner.Text())...
package main import ( "bufio" "fmt" "log" "os/exec" "github.com/mgutz/ansi" ) func main() { cmd := exec.Command("./a.sh") err := runCommand(cmd) if err != nil { log.Fatal(err) } } func runCommand(cmd *exec.Cmd) error { stdout, err := cmd.StdoutPipe() if err != nil { return err } stderr, err := cmd....
Read stdout and stderr in real time with two goroutines
Read stdout and stderr in real time with two goroutines
Go
mit
hnakamur/execcommandexample,hnakamur/execcommandexample
3299714f51fc5cec67fb480d1a0c54164b98452b
src/poule/server/action.go
src/poule/server/action.go
package server import ( "poule/configuration" "poule/gh" "poule/runner" "github.com/Sirupsen/logrus" ) func executeAction(config *configuration.Config, action configuration.Action, item gh.Item) error { for _, opConfig := range action.Operations { logrus.WithFields(logrus.Fields{ "operation": opConfig.Typ...
package server import ( "poule/configuration" "poule/gh" "poule/runner" "github.com/Sirupsen/logrus" ) func executeAction(config *configuration.Config, action configuration.Action, item gh.Item) error { for _, opConfig := range action.Operations { logrus.WithFields(logrus.Fields{ "operation": opConfig.Typ...
Fix serve bug executing only the first operation
Fix serve bug executing only the first operation Fix a bug where only the first operation as part of a trigger was executed when running in serve mode. Signed-off-by: Arnaud Porterie (icecrime) <55258e89a8b41a46066b3a9514b15a78c1a88d17@docker.com>
Go
apache-2.0
icecrime/poule,icecrime/poule
4660d7d17f163b506ad8d8a410efe7fdc7ed06b6
mesos/util.go
mesos/util.go
package mesos import ( "log" "net" "regexp" "strconv" "strings" ) func cleanName(name string) string { reg, err := regexp.Compile("[^\\w-.\\.]") if err != nil { log.Print("[WARN] ", err) return name } s := reg.ReplaceAllString(name, "") return strings.ToLower(strings.Replace(s, "_", "", -1)) } // The...
package mesos import ( "log" "net" "regexp" "strconv" "strings" ) func cleanName(name string) string { reg, err := regexp.Compile("[^\\w-.\\.]") if err != nil { log.Print("[WARN] ", err) return name } s := reg.ReplaceAllString(name, "") return strings.ToLower(strings.Replace(s, "_", "", -1)) } // The...
Write 100 times on the board: "%s: strings, %d: ints"
Write 100 times on the board: "%s: strings, %d: ints"
Go
apache-2.0
ryane/mesos-consul,Spantree/mesos-consul,z00223295/mesos-consul,CiscoCloud/mesos-consul,mantl/mesos-consul
302d2b0c2d169d8ad898f4a6758a85fd65aa798f
model/post.go
model/post.go
package model // Post represents a Facebook Post // // https://developers.facebook.com/docs/graph-api/reference/v2.4/post type Post struct { ID string `json:"id"` Message string `json:"message,omitempty"` }
package model import "time" // Post represents a Facebook Post // // https://developers.facebook.com/docs/graph-api/reference/v2.4/post type Post struct { ID string `json:"id"` Message string `json:"message,omitempty"` Published bool `json:"published"` Schedule...
Add additional possible fields to the Post model
Add additional possible fields to the Post model
Go
mit
deiwin/facebook
d1624adb6210fab2d75f29969f2fdb7beea9792b
fs_windows.go
fs_windows.go
package fs import ( "os" "path/filepath" ) // WARN (CEV): Investigate handling of environment variables and path expansion. // Max is 255 but use 245 to be safe. const winMaxLength = 245 func longPath(p string) (string, error) { path, err := absPath(p) if err == nil && len(path) >= winMaxLength { path = `\\?\...
package fs import ( "os" "path/filepath" ) // WARN (CEV): Investigate handling of environment variables and path expansion. // Max is 255 but use 245 to be safe. const winMaxLength = 245 func absPath(path string) (string, error) { if filepath.IsAbs(path) { return filepath.Clean(path), nil } wd, err := os.Get...
Remove unused windows path functions
Remove unused windows path functions Signed-off-by: Charlie Vieth <ea3f0b85bda195c42ceb97da0f596f9d6d014e12@pivotal.io>
Go
mit
charlievieth/fs
cf62f97cbf2a46ff531142874d3f8f7a9ee65044
cpu/cpu_linux.go
cpu/cpu_linux.go
package cpu import ( "io/ioutil" "strings" "regexp" ) type Cpu struct{} func (self *Cpu) Collect() (result map[string]map[string]string, err error) { return map[string]map[string]string{ "cpu": getCpuInfo(), }, err } func getCpuInfo() (cpuinfo map[string]string) { contents, err := ioutil.ReadFile("/proc/cpu...
package cpu import ( "io/ioutil" "strings" "regexp" ) type Cpu struct{} func (self *Cpu) Collect() (result map[string]map[string]string, err error) { cpuinfo, err := getCpuInfo() return map[string]map[string]string{ "cpu": cpuinfo, }, err } func getCpuInfo() (cpuinfo map[string]string, err error) { conten...
Use err variable of getCpuInfo()
Use err variable of getCpuInfo()
Go
mit
DataDog/gohai,DataDog/gohai,urosgruber/gohai
4fb83fc9136f671c5ca5361ac9e940a5e253cdca
src/nvim-go/nvim/command.go
src/nvim-go/nvim/command.go
package nvim import "github.com/garyburd/neovim-go/vim" func Echomsg(v *vim.Vim, msg string) error { return v.Command("echomsg '" + msg + "'") } func Echoerror(v *vim.Vim, msg string) error { return v.Command("echoerr '" + msg + "'") }
package nvim import ( "fmt" "github.com/garyburd/neovim-go/vim" ) func Echomsg(v *vim.Vim, format string, args ...interface{}) error { return v.Command("echomsg '" + fmt.Sprintf(format, args...) + "'") } func Echoerror(v *vim.Vim, format string, args ...interface{}) error { return v.Command("echoerr '" + fmt.Sp...
Support fmt likes format for Echomsg & Echoerror
Support fmt likes format for Echomsg & Echoerror Signed-off-by: Koichi Shiraishi <13fbd79c3d390e5d6585a21e11ff5ec1970cff0c@zchee.io>
Go
bsd-3-clause
zchee/nvim-go,zchee/nvim-go
21e7f297b792e43ba18431951d5156a07b569c19
src/github.com/nullstyle/go-codegen/output.go
src/github.com/nullstyle/go-codegen/output.go
package codegen import ( "bytes" "fmt" "io" "io/ioutil" "path" ) func Output(ctx *Context, p string, data string) error { op := path.Join(ctx.Dir, p) var out bytes.Buffer fmt.Fprintf(&out, "package %s\n", ctx.PackageName) outputImports(ctx, &out) out.WriteString(data) return ioutil.WriteFile(op, out.Byt...
package codegen import ( "bytes" "fmt" "go/parser" "go/printer" "go/token" "io" "io/ioutil" "path" ) func Output(ctx *Context, p string, data string) error { op := path.Join(ctx.Dir, p) var ( unformatted bytes.Buffer out bytes.Buffer ) fmt.Fprintf(&unformatted, "package %s\n", ctx.PackageName...
Add pretty printing to generated code
Add pretty printing to generated code
Go
isc
nullstyle/go-codegen
2c915ae40826eea9eb6cc9f2148d4126dd11b29b
client/main.go
client/main.go
package main import ( "fmt" "io/ioutil" "runtime" "github.com/overlordtm/trayhost" ) // TODO: Factor into trayhost. func trayhost_NewSeparatorMenuItem() trayhost.MenuItem { return trayhost.MenuItem{Title: ""} } func main() { runtime.LockOSThread() menuItems := trayhost.MenuItems{ trayhost.MenuItem{ Titl...
package main import ( "fmt" "io/ioutil" "runtime" "github.com/shurcooL/trayhost" ) func main() { runtime.LockOSThread() menuItems := trayhost.MenuItems{ trayhost.MenuItem{ Title: "Instant Share", Handler: func() { fmt.Println("TODO: grab content, content-type of clipboard") fmt.Println("TODO: ...
Use fork of trayhost, where needed functionality will be added.
Use fork of trayhost, where needed functionality will be added.
Go
mit
pavben/InstantShare,pavben/InstantShare
d425954d435d1c30f3e4790c6889c6e709458b7f
client_test.go
client_test.go
package cyberark import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestNewClientHostIsRequired(t *testing.T) { _, err := NewClient() assert.NotNil(t, err) assert.Equal(t, "host is required", err.Error()) } func TestNewClientAddsProtocolWhenNotSpecified(t *testing.T) { c, err := NewClient(S...
package cyberark import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestNewClientHostIsRequired(t *testing.T) { _, err := NewClient() assert.NotNil(t, err) assert.Equal(t, "host is required", err.Error()) } func TestSetHostFailsOnBlank(t *testing.T) { _, err := NewClient(SetHost("")) asser...
Add test for setting host to blank
Add test for setting host to blank
Go
mit
hoop33/go-cyberark
c2318c34991b1bb129e6db883a0a58b140aa97f1
commands/command_base.go
commands/command_base.go
package commands import ( "github.com/centurylinkcloud/clc-go-cli/base" ) type CommandBase struct { Input interface{} Output interface{} ExcInfo CommandExcInfo } type CommandExcInfo struct { Verb string Url string Resource string Command string Brief string Help string } func (c *Comma...
package commands import ( "github.com/centurylinkcloud/clc-go-cli/base" ) type CommandBase struct { Input interface{} Output interface{} ExcInfo CommandExcInfo } type CommandExcInfo struct { Verb string Url string Resource string Command string Brief string Help string } func (c *Comma...
Return both brief help and full parameters description from ShowHelp
Return both brief help and full parameters description from ShowHelp
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
1e89060d2bab1985ea3004db09ebae075b098a1e
verify_urls.go
verify_urls.go
package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" "time" ) func main() { fmt.Println("Verifying URLs..") readmeFile, err := ioutil.ReadFile("README.md") if err != nil { fmt.Println("Could not find README!") os.Exit(1) } fileContent := string(readmeFile) urlElementRegex := regexp.MustC...
package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" "time" ) func main() { fmt.Println("Verifying URLs..") readmeFile, err := ioutil.ReadFile("README.md") if err != nil { fmt.Println("Could not find README!") os.Exit(1) } fileContent := string(readmeFile) urlElementRegex := regexp.MustC...
Use error response when request fails
Use error response when request fails
Go
mit
flyeralarm/onboarding
4b096a43a4996addb151418eceee3a595fab61d2
src/chunkymonkey/gamerules/gamerules.go
src/chunkymonkey/gamerules/gamerules.go
package gamerules import ( "os" "chunkymonkey/command" ) // GameRules is a container type for block, item and recipe definitions. var ( Blocks BlockTypeList Items ItemTypeMap Recipes *RecipeSet FurnaceReactions FurnaceData CommandFramework *command.CommandFramework ) func LoadGa...
package gamerules import ( "os" "chunkymonkey/command" "chunkymonkey/permission" ) // GameRules is a container type for block, item and recipe definitions. var ( Blocks BlockTypeList Items ItemTypeMap Recipes *RecipeSet FurnaceReactions FurnaceData CommandFramework *command.Comm...
Load JsonPermission in LoadGameRules func. Currently using the working path for loading of users.json and groups.json
Load JsonPermission in LoadGameRules func. Currently using the working path for loading of users.json and groups.json
Go
mit
huin/chunkymonkey,huin/chunkymonkey
eb97163348d88954dbacbcbc7eed71efd666dddc
integration-cli/docker_cli_attach_test.go
integration-cli/docker_cli_attach_test.go
package main import ( "os/exec" "strings" "sync" "testing" "time" ) func TestMultipleAttachRestart(t *testing.T) { cmd := exec.Command(dockerBinary, "run", "--name", "attacher", "-d", "busybox", "/bin/sh", "-c", "sleep 1 && echo hello") group := sync.WaitGroup{} group.Add(4) go func() { defer group.Don...
package main import ( "os/exec" "strings" "sync" "testing" "time" ) func TestMultipleAttachRestart(t *testing.T) { cmd := exec.Command(dockerBinary, "run", "--name", "attacher", "-d", "busybox", "/bin/sh", "-c", "sleep 2 && echo hello") group := sync.WaitGroup{} group.Add(4) defer func() { cmd = exec.C...
Increase time before exit in TestMultipleAttachRestart
Increase time before exit in TestMultipleAttachRestart Sometimes third attacher attaching to already stopped container. Also I've changed prefix to attach and fixed cleanup on Fatal. Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Go
apache-2.0
DBCDK/docker,jvgogh/docker,13W/docker,projectatomic/docker,aboch/docker,kdomanski/docker,rvesse/docker,inatatsu/docker,vdemeester/docker,docker/docker.github.io,vdemeester/docker,jecarey/docker,geekylucas/docker,ntrvic/docker,wzzrd/docker,jthelin/docker,bdwill/docker.github.io,Distrotech/docker,chenrui2014/docker,j-mra...
ff1a208dc8b4cf6dce7d584cc61d1395606d85a5
dockerv2.go
dockerv2.go
package txtdirect import ( "fmt" "regexp" "strings" ) var dockerRegexs = map[string]string{ "_catalog": "^/v2/_catalog$", "tags": "^/v2/(.*)/tags/(.*)", "manifests": "^/v2/(.*)/manifests/(.*)", "blobs": "^/v2/(.*)/blobs/(.*)", } var DockerRegex = regexp.MustCompile("^\\/v2\\/(.*\\/(tags|manifests|bl...
package txtdirect import ( "fmt" "regexp" "strings" ) var dockerRegexs = map[string]string{ "_catalog": "^/v2/_catalog$", "tags": "^/v2/(.*)/tags/(.*)", "manifests": "^/v2/(.*)/manifests/(.*)", "blobs": "^/v2/(.*)/blobs/(.*)", } var DockerRegex = regexp.MustCompile("^\\/v2\\/(.*\\/(tags|manifests|bl...
Fix the bug causing all the requests getting parsed by the path code
Fix the bug causing all the requests getting parsed by the path code
Go
apache-2.0
txtdirect/txtdirect
cffd093d62137f315b89b35ca9c4da53f46497ce
server/mcstore/uploads/processor/processor.go
server/mcstore/uploads/processor/processor.go
package processor import "github.com/materials-commons/mcstore/pkg/db/schema" // fileProcess defines an interface for processing different // types of files. Processing may include extracting data, // conversion of the file to a different type, or whatever // is deemed appropriate for the file type. type Processor in...
package processor import "github.com/materials-commons/mcstore/pkg/db/schema" // fileProcess defines an interface for processing different // types of files. Processing may include extracting data, // conversion of the file to a different type, or whatever // is deemed appropriate for the file type. type Processor in...
Format by removing extra new line.
Format by removing extra new line.
Go
mit
materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore
59da00744e990e3ce7a4467383b3d9480a215134
state/backups/metadata_windows.go
state/backups/metadata_windows.go
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build !windows package backups import ( "os" "time" ) func creationTime(fi os.FileInfo) time.Time { return time.Time{} }
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups import ( "os" "time" ) func creationTime(fi os.FileInfo) time.Time { return time.Time{} }
Drop the compile tag from the windows version (the file name covers it).
Drop the compile tag from the windows version (the file name covers it).
Go
agpl-3.0
thomnico/juju,thomnico/juju,kat-co/juju,fwereade/juju,Altoros/juju-vmware,kat-co/juju,gabriel-samfira/juju,macgreagoir/juju,ericsnowcurrently/juju,tsakas/juju,marcoceppi/juju,tasdomas/juju,cloud-green/juju,waigani/juju,howbazaar/juju,ericsnowcurrently/juju,dimitern/juju,marcmolla/juju,howbazaar/juju,perrito666/juju,mhi...
eda1e5db218aad1db63ca4642c8906b26bcf2744
handlers.go
handlers.go
package cleanhttp import ( "net/http" "strings" "unicode" ) // HandlerInput provides input options to cleanhttp's handlers type HandlerInput struct { ErrStatus int } // PrintablePathCheckHandler is a middleware that ensures the request path // contains only printable runes. func PrintablePathCheckHandler(next ht...
package cleanhttp import ( "net/http" "strings" "unicode" ) // HandlerInput provides input options to cleanhttp's handlers type HandlerInput struct { ErrStatus int } // PrintablePathCheckHandler is a middleware that ensures the request path // contains only printable runes. func PrintablePathCheckHandler(next ht...
Fix a panic if the request passed in is nil
Fix a panic if the request passed in is nil
Go
mpl-2.0
hashicorp/go-cleanhttp
b0c716ac1de7d8d75bb8b5c58efb9c3bf0d93bbd
internal/integration/integration_suite_test.go
internal/integration/integration_suite_test.go
package integration_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/sclevine/agouti/core" . "github.com/sclevine/agouti/internal/integration" "os" "testing" ) var ( phantomDriver WebDriver chromeDriver WebDriver seleniumDriver WebDriver headlessOnly bool ) func TestI...
package integration_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/sclevine/agouti/core" . "github.com/sclevine/agouti/internal/integration" "os" "testing" ) var ( phantomDriver WebDriver chromeDriver WebDriver seleniumDriver WebDriver headlessOnly = os.Getenv("HEADL...
Fix detection of HEADLESS_ONLY environment variable
Fix detection of HEADLESS_ONLY environment variable
Go
mit
sclevine/agouti,abourget/agouti,Etienne42/agouti,Etienne42/agouti,sclevine/agouti,abourget/agouti
d8df6748560f8f1aab8b9ab9f6a4f0ec6402242e
logging.go
logging.go
package main type LoggingConfig struct { ProjectID string `json:"project_id"` LogName string `json:"log_name"` Type string `json:"type"` Labels map[string]string `json:"labels"` } func (c *LoggingConfig) setup() *ConfigError { if c.ProjectID == "" { return ...
package main type LoggingConfig struct { ProjectID string `json:"project_id"` LogName string `json:"log_name"` Type string `json:"type"` Labels map[string]string `json:"labels"` } func (c *LoggingConfig) setup() *ConfigError { for name, blank := range map[str...
Use map to remove duplications
:recycle: Use map to remove duplications
Go
mit
groovenauts/magellan-gcs-proxy,groovenauts/magellan-gcs-proxy,groovenauts/magellan-gcs-proxy
2d29732f403770d281232e1b08ebe41812600903
cli/command/manifest/cmd.go
cli/command/manifest/cmd.go
package manifest import ( "fmt" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/spf13/cobra" ) // NewManifestCommand returns a cobra command for `manifest` subcommands func NewManifestCommand(dockerCli command.Cli) *cobra.Command { // use dockerCli as command.Cli cmd := &cobra.Comm...
package manifest import ( "fmt" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/spf13/cobra" ) // NewManifestCommand returns a cobra command for `manifest` subcommands func NewManifestCommand(dockerCli command.Cli) *cobra.Command { // use dockerCli as command.Cli cmd := &cobra.Comm...
Mark docker-manifest command as experimental (cli)
Mark docker-manifest command as experimental (cli) Signed-off-by: Vincent Demeester <87e1f221a672a14a323e57bb65eaea19d3ed3804@sbr.pm>
Go
apache-2.0
docker/cli,cpuguy83/cli,docker/cli,dnephin/cli,dnephin/cli,thaJeztah/cli,cpuguy83/cli,thaJeztah/cli
9bf35b01d3c75b69f851111678fb1767aeae8cdb
pkg/app/acceptance_test.go
pkg/app/acceptance_test.go
// +build acceptance package app_test import ( stdnet "net" "time" "github.com/DATA-DOG/godog" "github.com/deshboard/boilerplate-grpc-service/test" "github.com/goph/stdlib/net" "google.golang.org/grpc" ) func init() { test.RegisterFeaturePath("../features") test.RegisterFeatureContext(FeatureContext) } fun...
// +build acceptance package app_test import ( "net" "github.com/DATA-DOG/godog" "github.com/deshboard/boilerplate-grpc-service/test" "google.golang.org/grpc" ) func init() { test.RegisterFeaturePath("../features") test.RegisterFeatureContext(FeatureContext) } func FeatureContext(s *godog.Suite) { lis, err ...
Use real network interface for gRPC acceptance testing
Use real network interface for gRPC acceptance testing
Go
mit
deshboard/boilerplate-grpc-service,deshboard/boilerplate-model-service
3b690f5544505c0d20caa85be5fc1247b3561650
pkg/config/endpoint_test.go
pkg/config/endpoint_test.go
package config import ( "github.com/lifesum/configsum/pkg/errors" "testing" ) func TestLocationInvalidLocale(t *testing.T) { var ( input = []byte(`{"locale": "foobarz"}`) l = location{} ) err := l.UnmarshalJSON(input) if have, want := errors.Cause(err), errors.ErrInvalidPayload; have != want { t.Err...
package config import ( "reflect" "testing" "github.com/lifesum/configsum/pkg/errors" ) func TestLocationInvalidLocale(t *testing.T) { var ( input = []byte(`{"locale": "foobarz"}`) l = location{} ) err := l.UnmarshalJSON(input) if have, want := errors.Cause(err), errors.ErrInvalidPayload; have != wan...
Update unmarshal test for User context
Update unmarshal test for User context
Go
mit
lifesum/configsum,lifesum/configsum
aedd45d86a884cfcf6579a817e7cf8311bc9a6c4
goat/listener.go
goat/listener.go
package goat import ( "log" "net" "strconv" ) // Listener interface method Listen defines a network listener which accepts connections type Listener interface { Listen(chan bool) } // HTTPListener listens for HTTP (TCP) connections type HTTPListener struct { } // Listen and handle HTTP (TCP) connections func (h...
package goat import ( "log" "net" "os" "strconv" ) // Listener interface method Listen defines a network listener which accepts connections type Listener interface { Listen(chan bool) } // HTTPListener listens for HTTP (TCP) connections type HTTPListener struct { } // Listen and handle HTTP (TCP) connections f...
Exit on failure to listen over HTTP
Exit on failure to listen over HTTP
Go
mit
mdlayher/goat
c9de83836646dabb4214d3f0f6ff81919735453b
citadel/main.go
citadel/main.go
package main import ( "os" "github.com/Sirupsen/logrus" "github.com/citadel/citadel" "github.com/codegangsta/cli" ) var ( logger = logrus.New() registry citadel.Registry ) func main() { app := cli.NewApp() app.Usage = "mangage your docker containers across hosts" app.Name = "citadel" app.Version = "0.1"...
package main import ( "os" "github.com/Sirupsen/logrus" "github.com/citadel/citadel" "github.com/codegangsta/cli" ) var ( logger = logrus.New() registry citadel.Registry ) func main() { app := cli.NewApp() app.Usage = "mangage your docker containers across hosts" app.Name = "citadel" app.Version = "0.1"...
Add debug flag for logger
Add debug flag for logger
Go
mit
liebo/citadel
b672f67d45ce77f6bf96834d58f3bd4f3249e1f2
discovery/discover.go
discovery/discover.go
package discovery import ( "fmt" "github.com/coreos/go-etcd/etcd" ) type Service interface { Get(key string) (string, error) } type Etcd struct { client *etcd.Client } func NewEtcd(machines []string) *Etcd { return &Etcd{ client: etcd.NewClient(machines), } } func (e *Etcd) Get(key string) (string, error) ...
package discovery import ( "fmt" "github.com/coreos/go-etcd/etcd" ) type Service interface { Get(key string) (string, error) } type Etcd struct { client *etcd.Client } func NewEtcd(machines []string) *Etcd { return &Etcd{ client: etcd.NewClient(machines), } } func (e *Etcd) Get(key string) (string, error) ...
Update for last etcd interface
Update for last etcd interface
Go
apache-2.0
pquerna/vulcan,vulcand/vulcan,jinzhu/vulcan,FoxComm/vulcan,pquerna/vulcan,mailgun/vulcan
46ce29dc34b300f1b704cfcb921d109bdff7ffc4
request.go
request.go
package viber import ( "bytes" "encoding/json" "io/ioutil" "net/http" ) // PostData to viber API func (v *Viber) PostData(url string, i interface{}) ([]byte, error) { b, err := json.Marshal(i) if err != nil { return nil, err } Log.Println("Post data:", string(b)) req, err := http.NewRequest("POST", url, ...
package viber import ( "bytes" "encoding/json" "io/ioutil" "net/http" ) // PostData to viber API func (v *Viber) PostData(url string, i interface{}) ([]byte, error) { b, err := json.Marshal(i) if err != nil { return nil, err } Log.Println("Post data:", string(b)) req, err := http.NewRequest("POST", url, ...
Fix runtime error on v.client.Do()
Fix runtime error on v.client.Do() panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x96f422] When we handle webhooks from viber, we create instance by this way: v := &viber.Viber{ AppKey: token, Sender: viber.Sender{ ...
Go
mit
mileusna/viber
78df0a964c8c19d1833cd6855392bf0f37559caf
showrss.go
showrss.go
package main import ( "fmt" "log" "net/http" "os" "os/signal" "showrss/handlers" "flag" "syscall" "github.com/braintree/manners" ) const version = "1.0.0" func main() { var httpAddr = flag.String("http", "localhost:7000", "HTTP service address") flag.Parse() log.Println("Starting server ...") log.Pr...
package main import ( "fmt" "log" "net/http" "os" "os/signal" "showrss/handlers" "flag" "syscall" "github.com/braintree/manners" ) const version = "1.0.0" func main() { var httpAddr = flag.String("http", "0.0.0.0:8000", "HTTP service address") flag.Parse() log.Println("Starting server ...") log.Prin...
Change default addr for http server
Change default addr for http server
Go
mit
teambrookie/showrss,teambrookie/showrss
ea3b83d0c4b5767163fd019b3e8ad17e65d724c1
imageserver/httpd/status.go
imageserver/httpd/status.go
package httpd import ( "bufio" "fmt" "github.com/Symantec/Dominator/lib/html" "net/http" ) func statusHandler(w http.ResponseWriter, req *http.Request) { writer := bufio.NewWriter(w) defer writer.Flush() fmt.Fprintln(writer, "<title>imageserver status page</title>") fmt.Fprintln(writer, "<body>") fmt.Fprintl...
package httpd import ( "bufio" "fmt" "github.com/Symantec/Dominator/lib/html" "github.com/Symantec/Dominator/lib/srpc" "net/http" ) func statusHandler(w http.ResponseWriter, req *http.Request) { writer := bufio.NewWriter(w) defer writer.Flush() fmt.Fprintln(writer, "<title>imageserver status page</title>") f...
Add warning banner to imageserver if in insecure mode.
Add warning banner to imageserver if in insecure mode.
Go
apache-2.0
keep94/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator
f8f10d4218610490587cf7df4230bd8602f2b2c7
fre.go
fre.go
package read // Fre scores the Flesch reading-ease. // See https://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests#Flesch_reading_ease. func Fre(text string) float64 { sylCnt := float64(CntSyls(text)) wordCnt := float64(CntWords(text)) sentCnt := float64(CntSents(text)) return 206.835 - 1.015*(wordCnt/sent...
package read // Fre scores the Flesch reading-ease. // See https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFlesch%E2%80%93Kincaid_readability_tests%23Flesch_reading_ease. func Fre(text string) float64 { sylCnt := float64(CntSyls(text)) wordCnt := float64(CntWords(text)) sentCnt := float64(CntSents(text)) return 206.835 -...
Fix wikipedia url to Flesch reading-ease.
Fix wikipedia url to Flesch reading-ease.
Go
mit
BluntSporks/readability
057a6b44cfdbfc158d5ee14c92baaa1fd1a37b4c
response.go
response.go
package Yafg import ( "net/http" ) // A wrapper of http.ResponseWriter type Response struct { Response http.ResponseWriter } func NewResponse(res http.ResponseWriter) *Response { response := new(Response) response.Response = res return response }
package Yafg import ( "net/http" "time" ) // A wrapper of http.ResponseWriter type Response struct { http.ResponseWriter } func NewResponse(res http.ResponseWriter) *Response { response := new(Response) response.ResponseWriter = res return response } func (res *Response) Send(str string) { res.Write([...
Use embedded struct for request.go
Use embedded struct for request.go
Go
mit
dinever/golf
bac93c136419b0fa148c37d9b15ba7d48eb69cb4
lib/log/serverlogger/api.go
lib/log/serverlogger/api.go
package serverlogger import ( "flag" "github.com/Symantec/Dominator/lib/log/debuglogger" "github.com/Symantec/Dominator/lib/logbuf" "io" ) var ( initialLogDebugLevel = flag.Int("initialLogDebugLevel", -1, "initial debug log level") ) type Logger struct { *debuglogger.Logger circularBuffer *logbuf.LogBuffer ...
package serverlogger import ( "flag" "fmt" "github.com/Symantec/Dominator/lib/log/debuglogger" "github.com/Symantec/Dominator/lib/logbuf" "io" "os" ) var ( initialLogDebugLevel = flag.Int("initialLogDebugLevel", -1, "initial debug log level") ) type Logger struct { *debuglogger.Logger circularBuffer *logb...
Call Flush() in Fatal() methods of lib/log/serverlogger.Logger.
Call Flush() in Fatal() methods of lib/log/serverlogger.Logger.
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator
6cb95b49ee9f9d4eb6c9711611514ee23674d0d6
provider_test.go
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
hashicorp/terraform-provider-google,terraform-providers/terraform-provider-google,rosbo/terraform-provider-google,terraform-providers/terraform-provider-google,drebes/terraform-provider-google,selmanj/terraform-provider-google,drebes/terraform-provider-google,hashicorp/terraform-provider-google-beta,hashicorp/terraform...
d51ea83cdd1e57e280ae63f6f41927f9455bcbe2
pkg/reswriter/tfversions.go
pkg/reswriter/tfversions.go
// Copyright 2021 Google LLC // // 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 ...
// Copyright 2021 Google LLC // // 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 ...
Allow 4.x TPG (Terraform Provider Google)
Allow 4.x TPG (Terraform Provider Google) * additionally align minimum 3.x release with VPC module requirement
Go
apache-2.0
GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit
0c2e0491804666bb6c1302bea947eb79ee62a5cd
frontend/dockerfile/dockerignore/dockerignore.go
frontend/dockerfile/dockerignore/dockerignore.go
package dockerignore import ( "bufio" "fmt" "io" "path/filepath" "strings" ) // ReadAll reads a .dockerignore file and returns the list of file patterns // to ignore. Note this will trim whitespace from each line as well // as use GO's "clean" func to get the shortest/cleanest path for each. func ReadAll(reader ...
package dockerignore import ( "bufio" "fmt" "io" "path/filepath" "strings" ) // ReadAll reads a .dockerignore file and returns the list of file patterns // to ignore. Note this will trim whitespace from each line as well // as use GO's "clean" func to get the shortest/cleanest path for each. func ReadAll(reader ...
Fix ReadAll to run on Windows.
Fix ReadAll to run on Windows. filepath.Clean converts filenames to filenames with native path separators. Use ToSlash to normalize. Signed-off-by: Anusha Ragunathan <11258be80bf4b196e47582a3113274a53ec55793@docker.com>
Go
apache-2.0
tonistiigi/buildkit_poc,tonistiigi/buildkit_poc
8b3ccf7e2a47d2382ed8ed14cf893fb84e7e3c38
avroDecoder.go
avroDecoder.go
package tailtopic import ( avro "github.com/elodina/go-avro" kavro "github.com/elodina/go-kafka-avro" ) type avroSchemaRegistryDecoder struct { decoder *kavro.KafkaAvroDecoder } func newAvroDecoder(schemaregURI string) decoder { return &avroSchemaRegistryDecoder{kavro.NewKafkaAvroDecoder(schemaregURI)} } func (...
package tailtopic import ( avro "github.com/dejan/go-avro" kavro "github.com/dejan/go-kafka-avro" ) type avroSchemaRegistryDecoder struct { decoder *kavro.KafkaAvroDecoder } func newAvroDecoder(schemaregURI string) decoder { return &avroSchemaRegistryDecoder{kavro.NewKafkaAvroDecoder(schemaregURI)} } func (sr *...
Use my forks until NS fix is merged upstream
Use my forks until NS fix is merged upstream
Go
mit
dejan/tailtopic
3745709c57ebdda8dfb2a4f2c80d5a45ed335a9a
hackedu/middleware.go
hackedu/middleware.go
package hackedu import "net/http" func middleware(w http.ResponseWriter, r *http.Request) { allowCORS(w, r) } func allowCORS(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") }
package hackedu import "net/http" func middleware(w http.ResponseWriter, r *http.Request) { allowCORS(w, r) } func allowCORS(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept...
Add Access-Control-Allow-Headers header to responses.
Add Access-Control-Allow-Headers header to responses.
Go
mit
zachlatta/website,hackedu/website,zachlatta/website,hackedu/website,zachlatta/website,hackedu/website
4798dacafd1c94a01e4ea1471190761d38d94aee
plugins/drivers/errors.go
plugins/drivers/errors.go
package drivers import "fmt" var ErrTaskNotFound = fmt.Errorf("task not found for given id")
package drivers import "fmt" var ErrTaskNotFound = fmt.Errorf("task not found for given id") var DriverRequiresRootMessage = "Driver must run as root"
Add consistent message for requires root
plugins: Add consistent message for requires root
Go
mpl-2.0
dvusboy/nomad,dvusboy/nomad,dvusboy/nomad,hashicorp/nomad,dvusboy/nomad,dvusboy/nomad,hashicorp/nomad,hashicorp/nomad,hashicorp/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/nomad,dvusboy/nomad,hashicorp/nomad,dvusboy/nomad,burdandrei/nomad,hashicorp/nomad
0c88a2019cee0329db7c85ecdcc94860a1c7b1e7
unionfs/timedcache_test.go
unionfs/timedcache_test.go
package unionfs import ( "fmt" "log" "time" "testing" ) var _ = fmt.Print var _ = log.Print func TestTimedCache(t *testing.T) { fetchCount := 0 fetch := func(n string) interface{} { fetchCount++ i := int(n[0]) return &i } var ttl int64 ttl = 1e6 cache := NewTimedCache(fetch, ttl) v := cache.Get("n...
package unionfs import ( "fmt" "log" "time" "testing" ) var _ = fmt.Print var _ = log.Print func TestTimedCache(t *testing.T) { fetchCount := 0 fetch := func(n string) interface{} { fetchCount++ i := int(n[0]) return &i } var ttl int64 // This fails with 1e6 on some Opteron CPUs. ttl = 1e8 cache ...
Fix test for some opteron cpus.
Fix test for some opteron cpus.
Go
mit
cmars/tools,keybase/go-fuse,cmars/tools,keybase/go-fuse,cmars/tools,keybase/go-fuse,cmars/tools
fd3b39aeb7185f81f29cd66794aa980d21257b25
formatters/terminal_width.go
formatters/terminal_width.go
package formatters import ( "syscall" "unsafe" ) type winsize struct { Row uint16 Col uint16 Xpixel uint16 Ypixel uint16 } func getTerminalWidth() uint { ws := &winsize{} retCode, _, errno := syscall.Syscall(syscall.SYS_IOCTL, uintptr(syscall.Stdin), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Po...
package formatters import ( "syscall" "unsafe" ) type winsize struct { Row uint16 Col uint16 Xpixel uint16 Ypixel uint16 } func SetTerminalWidthFn(f func() uint) { getTerminalWidth = f } var getTerminalWidth = func() uint { ws := &winsize{} retCode, _, errno := syscall.Syscall(syscall.SYS_IOCTL, ui...
Add an interface for mocking the terminal width defining function
Add an interface for mocking the terminal width defining function
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
1110d9831c116eed2eb45be210e63f779fb8413a
command_relist_fixed_price_item.go
command_relist_fixed_price_item.go
package ebay import "encoding/xml" type RelistFixedPriceItem struct { ItemID string StartPrice string `xml:",omitempty"` ConditionID uint `xml:",omitempty"` Quantity uint `xml:",omitempty"` Title ...
package ebay import "encoding/xml" type RelistFixedPriceItem struct { ItemID string StartPrice string `xml:",omitempty"` ConditionID uint `xml:",omitempty"` Quantity uint `xml:",omitempty"` Title ...
Add ItemID response field to relist fixed price item command
Add ItemID response field to relist fixed price item command
Go
isc
zombor/go-ebay
6940bd44abef845b0af9b8c9916799cf3d8450d0
skeleton/controllers/app.go
skeleton/controllers/app.go
package controllers import ( "github.com/anonx/sunplate/skeleton/assets/views" "github.com/anonx/sunplate/action" ) // App is a sample controller that is used for demonstration purposes. type App struct { *Controller } // Before is a magic method that is executed before every request. func (c *App) Before(name s...
package controllers import ( v "github.com/anonx/sunplate/skeleton/assets/views" "github.com/anonx/sunplate/action" ) // App is a sample controller that is used for demonstration purposes. type App struct { *Controller } // Before is a magic method that is executed before every request. func (c *App) Before(name...
Use v as a selector arther than views
Use v as a selector arther than views
Go
bsd-2-clause
goaltools/goal,anonx/sunplate,anonx/sunplate,goaltools/goal,goaltools/goal,anonx/sunplate
b3b2f14d13a2b59da23dd3bdab55e223390bf81d
healthcheck_requests_test.go
healthcheck_requests_test.go
package main_test import ( "net/http" "net/http/httptest" . "github.com/alphagov/publishing-api" . "github.com/alphagov/publishing-api/testhelpers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("GET /healthcheck", func() { var ( testPublishingAPI *httptest.Server ) BeforeEach(...
package main_test import ( "net/http" "net/http/httptest" . "github.com/alphagov/publishing-api" . "github.com/alphagov/publishing-api/testhelpers" . "github.com/onsi/ginkgo" ) var _ = Describe("GET /healthcheck", func() { It("has a healthcheck endpoint which responds with a status of OK", func() { var test...
Use testhelpers to compact healthcheck test
Use testhelpers to compact healthcheck test
Go
mit
alphagov/publishing-api,alphagov/publishing-api
1b050e033dc330db5f31e1294573705cc6c2342f
go-ari-library.go
go-ari-library.go
package nv import ( "encoding/json" "time" ) type NV_Event struct { ServerID string Timestamp time.Time ARI_Event string } func Init(in chan []byte, out chan *NV_Event) { go func(in chan []byte, out chan *NV_Event) { for instring := range in { var e *NV_Event json.Unmarshal(...
package nv import ( "encoding/json" "time" ) type NV_Event struct { ServerID string `json:"server_id"` Timestamp time.Time `json:"timestamp"` Type string `json:"type"` ARI_Event string `json:"ari_event"` } func Init(in chan []byte, out chan *NV_Event) { go func(in chan []byte, o...
Update NV_Event struct to match proxy
Update NV_Event struct to match proxy
Go
apache-2.0
leifmadsen/go-ari-library,nvisibleinc/go-ari-library
592f52aad04c516eae45ea7d9dd670de7b7df336
type_registry.go
type_registry.go
package goldi import "fmt" type TypeRegistry map[string]*Type func NewTypeRegistry() TypeRegistry { return TypeRegistry{} } func (r TypeRegistry) RegisterType(typeID string, generatorFunction interface{}) error { t, err := NewType(generatorFunction) if err != nil { return err } return r.Register(typeID, t) ...
package goldi import "fmt" type TypeRegistry map[string]*Type func NewTypeRegistry() TypeRegistry { return TypeRegistry{} } func (r TypeRegistry) RegisterType(typeID string, generatorFunction interface{}, arguments ...interface{}) error { t, err := NewType(generatorFunction, arguments...) if err != nil { retur...
Add factory arguments to TypeRegistry.RegisterType
Add factory arguments to TypeRegistry.RegisterType
Go
mit
fgrosse/goldi
d5954744cb2752f749b0664607bd310cee3a7061
varmor/varmor.go
varmor/varmor.go
package armoredcrypt import ( "fmt" "encoding/base64" "strings" ) const ( _MAGIC_PREFIX = "saltybox" _V1_MAGIC = "saltybox1:" ) func Wrap(body []byte) string { encoded := base64.RawURLEncoding.EncodeToString(body) return fmt.Sprintf("%s%s", _V1_MAGIC, encoded) } func Unwrap(varmoredBody string) ([]byte, err...
package armoredcrypt import ( "fmt" "encoding/base64" "strings" "errors" ) const ( _MAGIC_PREFIX = "saltybox" _V1_MAGIC = "saltybox1:" ) func Wrap(body []byte) string { encoded := base64.RawURLEncoding.EncodeToString(body) return fmt.Sprintf("%s%s", _V1_MAGIC, encoded) } func Unwrap(varmoredBody string) ([...
Use errors.New() instead of fmt.Errorf() where appropriate.
Use errors.New() instead of fmt.Errorf() where appropriate.
Go
mit
scode/saltybox,scode/saltybox
f4b704df9445882e9eb414638b7fe20c7fe5f4f3
lib/backup_schedule_calls.go
lib/backup_schedule_calls.go
package lib import ( "github.com/BytemarkHosting/bytemark-client/lib/brain" "strconv" ) // CreateBackupSchedule creates a new backup schedule starting at the given date, with backups occuring every interval seconds func (c *bytemarkClient) CreateBackupSchedule(server VirtualMachineName, discLabel string, startDate ...
package lib import ( "github.com/BytemarkHosting/bytemark-client/lib/brain" "strconv" ) // CreateBackupSchedule creates a new backup schedule starting at the given date, with backups occuring every interval seconds func (c *bytemarkClient) CreateBackupSchedule(server VirtualMachineName, discLabel string, startDate ...
Fix ScheduleBackups and UnscheduleBackups not defaulting correctly
Fix ScheduleBackups and UnscheduleBackups not defaulting correctly
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
9bb682040276d4301a7530889bf3025e58b06903
web/blob/blob.go
web/blob/blob.go
package blob import ( "bytes" "compress/gzip" "io" "log" "net/http" ) const ( TemplateFiles = "templates" StaticFiles = "static" ) func GetFile(bucket string, name string) ([]byte, error) { reader := bytes.NewReader(files[bucket][name]) gz, err := gzip.NewReader(reader) if err != nil { return nil, err ...
package blob import ( "bytes" "compress/gzip" "io" "log" "net/http" "strings" ) const ( TemplateFiles = "templates" StaticFiles = "static" ) var mimeMap = map[string]string{ "css": "text/css", "js": "text/javascript", } func GetFile(bucket string, name string) ([]byte, error) { reader := bytes.NewRead...
Use filename based type if DetectContentType fails.
Use filename based type if DetectContentType fails. DetectContentType returns text/plain for our stylesheets and javascripts. That causes chrome to ignore those files.
Go
apache-2.0
brancz/prometheus,gcnonato/prometheus,gesellix/prometheus,dpatel06/prometheus,kzittritsch/prometheus,gcnonato/prometheus,slok/prometheus,alileza/prometheus,trigrass2/prometheus,rajthilakmca/prometheus,kzittritsch/prometheus,slok/prometheus,hustbill/prometheus,gcnonato/prometheus,bluecmd/prometheus,prasincs/prometheus,a...
500a68483fdd9a330ac58d8c8726d187e9e9b578
subvert.go
subvert.go
package main import ( "regexp" "strconv" "strings" ) var ( sequenses = regexp.MustCompile(`(?:[^~\\]|\\.)*`) branches = regexp.MustCompile(`(?:[^,\\]|\\.)*`) ) func newMatcher(expr string) (m *regexp.Regexp, err error) { expr = strings.Replace(expr, `\,`, `\\,`, -1) expr = strings.Replace(expr, `\~`, `\\~`, ...
package main import ( "regexp" "strconv" "strings" ) var ( sequenses = regexp.MustCompile(`(?:[^/\\]|\\.)*`) branches = regexp.MustCompile(`(?:[^,\\]|\\.)*`) ) func newMatcher(expr string) (m *regexp.Regexp, err error) { expr = strings.Replace(expr, `\,`, `\\,`, -1) expr = strings.Replace(expr, `\/`, `\\/`, ...
Change separator of sequense from tilda to slash
Change separator of sequense from tilda to slash
Go
mit
kusabashira/msub
5991bce8fcab3dc37ebe551f441ee2b4228e698c
module3rd/load.go
module3rd/load.go
package module3rd import ( "encoding/json" "fmt" "os" "github.com/cubicdaiya/nginx-build/util" ) func Load(path string) ([]Module3rd, error) { var modules []Module3rd if len(path) > 0 { if !util.FileExists(path) { return modules, fmt.Errorf("modulesConfPath(%s) does not exist.", path) } data, err := o...
package module3rd import ( "encoding/json" "fmt" "os" "github.com/cubicdaiya/nginx-build/util" ) func Load(path string) ([]Module3rd, error) { var modules []Module3rd if len(path) > 0 { if !util.FileExists(path) { return modules, fmt.Errorf("modulesConfPath(%s) does not exist.", path) } data, err := o...
Add more contextual information to error message
Add more contextual information to error message
Go
mit
cubicdaiya/nginx-build,cubicdaiya/nginx-build,cubicdaiya/nginx-build
b3e0e1a33d072b542707005f9f6da66d8de2a021
specs-go/v1/layout.go
specs-go/v1/layout.go
// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
Add regular expression for object names in 'refs'
Add regular expression for object names in 'refs' it will be used in 'image-tools' or other project for checking regular expression of 'refs', which writes as "Object names in the refs subdirectories MUST NOT include characters outside of the set of "A" to "Z", "a" to "z", "0" to "9", the hyphen -, the dot ., and the ...
Go
apache-2.0
vbatts/oci-image-spec,jonboulle/image-spec,vbatts/oci-image-spec,opencontainers/image-spec,opencontainers/image-spec,mattspencer-arm/image-spec,mattspencer-arm/image-spec,jonboulle/image-spec
a692772a0c0b78220cd6a50a76a2f57db1667b72
observers/logger_observer.go
observers/logger_observer.go
package observers import ( "github.com/sirupsen/logrus" "github.com/ivan1993spb/snake-server/world" ) type LoggerObserver struct{} func (LoggerObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) { go func() { for event := range w.Events(stop, chanSnakeObserverEventsBuffer) { s...
package observers import ( "github.com/sirupsen/logrus" "github.com/ivan1993spb/snake-server/world" ) const chanLoggerObserverEventsBuffer = 32 type LoggerObserver struct{} func (LoggerObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) { go func() { for event := range w.Events(...
Fix logger observer: create const chanLoggerObserverEventsBuffer
Fix logger observer: create const chanLoggerObserverEventsBuffer
Go
bsd-2-clause
ivan1993spb/clever-snake
ab33ddcbd734e84b273ee508d380e81cf83ae513
terminal_connectiontoken.go
terminal_connectiontoken.go
package stripe // TerminalConnectionTokenParams is the set of parameters that can be used when creating a terminal connection token. type TerminalConnectionTokenParams struct { Params `form:"*"` // This feature has been deprecated and should not be used anymore. OperatorAccount *string `form:"operator_account"` } ...
package stripe // TerminalConnectionTokenParams is the set of parameters that can be used when creating a terminal connection token. type TerminalConnectionTokenParams struct { Params `form:"*"` Location string `form:"location"` // This feature has been deprecated and should not be used anymore. OperatorAccount...
Add support for `location` on `ConnectionToken`
Add support for `location` on `ConnectionToken`
Go
mit
ChannelMeter/stripe-go,ChannelMeter/stripe-go,stripe/stripe-go,stripe/stripe-go
eafd45c022863b0ad01a61a000d0b19ea60d80a6
terminal_size_windows.go
terminal_size_windows.go
// +build windows package uilive import ( "os" "unsafe" ) func getTermSize() (int, int) { out, err := os.Open("CONOUT$") if err != nil { return 0, 0 } var csbi consoleScreenBufferInfo ret, _, _ := procGetConsoleScreenBufferInfo.Call(out.Fd(), uintptr(unsafe.Pointer(&csbi))) if ret == 0 { return 0, 0 } ...
// +build windows package uilive import ( "os" "unsafe" ) func getTermSize() (int, int) { out, err := os.Open("CONOUT$") if err != nil { return 0, 0 } defer out.Close() var csbi consoleScreenBufferInfo ret, _, _ := procGetConsoleScreenBufferInfo.Call(out.Fd(), uintptr(unsafe.Pointer(&csbi))) if ret == 0 ...
Add forgotten Close() for opened console output
Add forgotten Close() for opened console output
Go
mit
gosuri/uilive
8961b23ed64d67cb7843d54521e7c76347af7096
main_helper.go
main_helper.go
package grayt import ( "image/png" "log" "os" ) // Runner is a convenience struct to help run grayt from a main() function. type Runner struct { PxWide, PxHigh int BaseName string Quality float64 } func NewRunner() *Runner { return &Runner{ PxWide: 640, PxHigh: 480, BaseName: "default",...
package grayt import ( "image/png" "log" "os" ) // Runner is a convenience struct to help run grayt from a main() function. type Runner struct { PxWide, PxHigh int BaseName string Quality float64 } func NewRunner() *Runner { return &Runner{ PxWide: 640, PxHigh: 480, BaseName: "default",...
Fix rename of `TracerImage` to `TraceImage`
Fix rename of `TracerImage` to `TraceImage`
Go
mit
peterstace/grayt,peterstace/grayt,peterstace/grayt
894819ddaf7e9c806a0d9aae36f3a994dee21f59
main.go
main.go
package main import ( "fmt" "log" "net/http" "strings" ) type proxii struct { config *Config etcd *etcdConnector } func (p *proxii) handler(w http.ResponseWriter, r *http.Request) { host := strings.Split(r.Host, ":")[0] uri, err := p.etcd.resolve(host) if err != nil { log.Println("Error while looking u...
package main import ( "fmt" "log" "net/http" "net/http/httputil" "strings" ) type proxii struct { config *Config etcd *etcdConnector } func (p *proxii) handler(w http.ResponseWriter, r *http.Request) { host := strings.Split(r.Host, ":")[0] uri, err := p.etcd.resolve(host) if err != nil { log.Println("...
Revert "Didn't run tests before"
Revert "Didn't run tests before" This reverts commit b8abc805f0adb18ceb2aac0ee498551c5f3e9cff.
Go
mit
pierrebeaucamp/proxii
2f378df9fa0d17415866dc516f631e19e0f94de6
skeleton/win.go
skeleton/win.go
// Graceful restarts and shutdowns are not supported // on windows, so using usual http.Serve instead. // // +build windows package main import ( "net/http" ) // serve is a wrapper on standard http.Serve method. func serve(s *http.Server) error { return http.Serve(s) }
// Graceful restarts and shutdowns are not supported // on windows, so using usual http.Serve instead. // // +build windows package main import ( "net/http" ) // serve is a wrapper on standard http.Serve method. func serve(s *http.Server) error { return s.ListenAndServe() }
Fix Win's version of serve
Fix Win's version of serve
Go
bsd-2-clause
goaltools/goal,anonx/sunplate,goaltools/goal,anonx/sunplate,goaltools/goal,anonx/sunplate
0bb7b286dca6494f379e90ab7fe6e268e3d1c04f
grpcpool.go
grpcpool.go
package grpcpool import ( "sync" "google.golang.org/grpc" ) func newConnectionPool(activeCount int, dialFunc func() (*grpc.ClientConn, error)) (*ConnectionPool, error) { pool := &ConnectionPool{mu: sync.Mutex{}} for i := 0; i < activeCount; i++ { client, error := dialFunc() if error != nil { pool.Close() ...
package grpcpool import ( "sync" "google.golang.org/grpc" ) func NewConnectionPool(activeCount int, dialFunc func() (*grpc.ClientConn, error)) (*ConnectionPool, error) { pool := &ConnectionPool{mu: sync.Mutex{}} for i := 0; i < activeCount; i++ { client, error := dialFunc() if error != nil { pool.Close() ...
Fix the visibility of initialization
[Irfan] Fix the visibility of initialization
Go
apache-2.0
irfn/grpcpool
3e6cf2c8b006a454c412b0b2c3c5662a1cd522c8
doc.go
doc.go
/* Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT. The goal is to make simple to write simple adhoc XMPP clients: - For automation (like for example monitoring of an XMPP service), - For building connected "things" by plugging them on an XMPP server, - For writing simple chatbo...
/* Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT. The goal is to make simple to write simple adhoc XMPP clients: - For automation (like for example monitoring of an XMPP service), - For building connected "things" by plugging them on an XMPP server, - For writing simple chatbo...
Add link to component protocol
Add link to component protocol
Go
apache-2.0
processone/gox
6ac2d50e63133d140728b2778dacae8fccc89778
server/mcstore/database_session_filter.go
server/mcstore/database_session_filter.go
package mcstore import ( "net/http" r "github.com/dancannon/gorethink" "github.com/emicklei/go-restful" ) type databaseSessionFilter struct { session func() (*r.Session, error) } func (f *databaseSessionFilter) Filter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { if session, err :...
package mcstore import ( "net/http" r "github.com/dancannon/gorethink" "github.com/emicklei/go-restful" ) // databaseSessionFilter is a filter than creates new database sessions. It takes a // function that creates new instances of the session. type databaseSessionFilter struct { session func() (*r.Session, erro...
Add comments and documentation comments to describe what filter does.
Add comments and documentation comments to describe what filter does.
Go
mit
materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore
04b262d8f10ba9eacde041734c08f806c4685e7f
src/restic/backend/http_transport.go
src/restic/backend/http_transport.go
package backend import ( "net" "net/http" "restic/debug" "time" ) // Transport returns a new http.RoundTripper with default settings applied. func Transport() http.RoundTripper { // copied from net/http tr := &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * ti...
package backend import ( "net" "net/http" "restic/debug" "time" ) // Transport returns a new http.RoundTripper with default settings applied. func Transport() http.RoundTripper { // copied from net/http tr := &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * ti...
Allow many idle connections per host
Allow many idle connections per host Closes #985
Go
bsd-2-clause
restic/restic,fawick/restic,kurin/restic,kurin/restic,fawick/restic,ar-jan/restic,restic/restic,ar-jan/restic,middelink/restic,middelink/restic,jayme-github/restic,jayme-github/restic
fef74e2503721c58ff1ca59ba49f7b2abaf18011
utilities/encoding.go
utilities/encoding.go
package utilities import ( "errors" "unicode/utf8" ) // The string encoding options. Currently only support UTF-8. Don't really // see the merit in supporting anything else at the moment. const ( UTF8 = iota ) // ErrInvalidEncodingType is returned when the encoding type is not one that // is supported. var ErrInv...
package utilities import ( "errors" "unicode/utf8" ) // The string encoding options. Currently only support UTF-8. Don't really // see the merit in supporting anything else at the moment. const ( UTF8 = iota ) // ErrInvalidEncodingType is returned when the encoding type is not one that // is supported. var ErrInv...
Update Encode documentation for golint.
Update Encode documentation for golint.
Go
mit
mikopits/sdbot
c392f6dac2ce7f6a429fdc41365a45e708c06d2d
task.go
task.go
package celery import ( "fmt" "time" ) type Receipt interface { Reply(string, interface{}) Ack() Requeue() Reject() } type Task struct { Task string Id string Args []interface{} Kwargs map[string]interface{} Retries int Eta string Expires string Receipt Receipt } func (t *Task) Ack(result interface{})...
package celery import ( "bytes" "fmt" "time" ) const CELERY_FORMAT = "2006-01-02T15:04:05.999999999" type celeryTime struct { time.Time } var null = []byte("null") func (ct *celeryTime) UnmarshalJSON(data []byte) (err error) { if bytes.Equal(data, null) { return } t, err := time.Parse(`"`+CELERY_FORMAT+`"...
Update Task to handle timestamps from Celery
Update Task to handle timestamps from Celery
Go
bsd-3-clause
mattrobenolt/go-celery
05f69c0736ce06228b2c0d7fecb40e3cefd748f5
unix.go
unix.go
package main import ( "net" "os/exec" "strings" ) var ( socketName = "/tmp/dinit.sock" socketMaxLen = 512 ) func startCommand(c net.Conn) { buf := make([]byte, socketMaxLen) n, err := c.Read(buf) defer c.Close() if err != nil { logPrintf("socket: error reading data: %s", err) return } cmdargs := s...
package main import ( "net" "os/exec" "strings" ) var ( socketName = "/tmp/dinit.sock" socketMaxLen = 512 ) func startCommand(c net.Conn) { buf := make([]byte, socketMaxLen) n, err := c.Read(buf) defer c.Close() if err != nil { logPrintf("socket: error reading data: %s", err) return } cmdargs := s...
Add log line when we successfully created the socket
Add log line when we successfully created the socket
Go
bsd-3-clause
miekg/dinit
74efbb1aae79671ee5e397407d82172da83da0d5
internal/gps/cmd_windows.go
internal/gps/cmd_windows.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. // +build windows package gps import "os/exec" func killProcess(cmd *exec.Cmd) error { // TODO it'd be great if this could be more sophisticated... return ...
// 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. // +build windows package gps import "os/exec" func killProcess(cmd *exec.Cmd, isDone *int32) error { // TODO it'd be great if this could be more sophistica...
Update sig of killProcess() for windows
Update sig of killProcess() for windows
Go
bsd-3-clause
ibrasho-forks/dep,golang/dep,ibrasho-forks/dep,golang/dep,golang/dep
b7616cd73e9e2f38bfb022d8f1b4ff74df47874e
lib/srpc/setupclient/impl.go
lib/srpc/setupclient/impl.go
package setupclient import ( "crypto/tls" "github.com/Symantec/Dominator/lib/srpc" "os" ) func setupTls(ignoreMissingCerts bool) error { if *certDirectory == "" { return nil } // Load certificates. certs, err := srpc.LoadCertificates(*certDirectory) if ignoreMissingCerts && os.IsNotExist(err) { return nil...
package setupclient import ( "crypto/tls" "github.com/Symantec/Dominator/lib/srpc" ) func setupTls(ignoreMissingCerts bool) error { if *certDirectory == "" { return nil } // Load certificates. certs, err := srpc.LoadCertificates(*certDirectory) if err != nil { return err } if certs == nil { if ignoreMi...
Improve missing certificate handling in lib/srpc/setupclient.SetupTls().
Improve missing certificate handling in lib/srpc/setupclient.SetupTls().
Go
apache-2.0
rgooch/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator
213813baf2c1651c916ef32feab4c00ccf2ec895
py/pyobject.go
py/pyobject.go
package py /* #include "Python.h" */ import "C" import ( "runtime" ) // Object is a bind of `*C.PyObject` type Object struct { p *C.PyObject } // DecRef decrease reference counter of `C.PyObject` // This function is public for API users and // it acquires GIL of Python interpreter. func (o *Object) DecRef() { ch ...
package py /* #include "Python.h" void XDecRef(PyObject *o) { Py_XDECREF(o); } */ import "C" import ( "runtime" ) // Object is a bind of `*C.PyObject` type Object struct { p *C.PyObject } // DecRef decrease reference counter of `C.PyObject` // This function is public for API users and // it acquires GIL of Pytho...
Use Py_XDECREF instaed of Py_DecRef in DecRef
Use Py_XDECREF instaed of Py_DecRef in DecRef
Go
mit
sensorbee/py,sensorbee/py