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
79fe0be276b2b2573016d7d8e0aa7a09ce972c1a
main.go
main.go
package main import ( "os" "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) var log = logrus.New() func main() { app := cli.NewApp() app.Commands = Commands app.CommandNotFound = cmdNotFound app.Version = Version app.Run(os.Args) } func cmdNotFound(c *cli.Context, command string) { log.Fatalf(...
package main import ( "os" "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" ) var log = logrus.New() func main() { app := cli.NewApp() app.Usage = "A tool to easily manage your hosts file." app.Commands = Commands app.CommandNotFound = cmdNotFound app.Version = Version app.Run(os.Args) } func cm...
Add a description to the cli interface.
Add a description to the cli interface.
Go
mit
damonkelley/hostsup,damonkelley/hostsup
dd7f31d6c54a7d16fb4bc9a2b0e10899b09c08c6
main.go
main.go
package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "path - %s", r.URL.Path[1:]) fmt.Printf("GET %s\n", r.URL.Path) } func main() { fmt.Println("Server running at port 8080") http.HandleFunc("/", handler) http.ListenAndServe(":80...
Add a bit of logging
Add a bit of logging
Go
mit
RStankov/cyoa,RStankov/cyoa,RStankov/cyoa
5fab9da21eef9999d57c681322d4e27ef5e5261a
main.go
main.go
package main import ( "log" "net/http" "github.com/codegangsta/cli" "os" ) func main() { app := cli.NewApp() app.Name = "go-http-server" app.Usage = "Start web server and public your current directory." app.Version = "0.0.1" app.Authors = append(app.Authors, cli.Author{Name: "Kohei Kawasaki", Email: "myname...
package main import ( "log" "net/http" "github.com/codegangsta/cli" "os" ) func main() { app := cli.NewApp() app.Name = "go-http-server" app.Usage = "Start web server and public your current directory." app.Version = "0.0.2" app.Authors = append(app.Authors, cli.Author{Name: "Kohei Kawasaki", Email: "myname...
Make command executable without any parameters
Make command executable without any parameters
Go
mit
k-kawa/go-http-server,k-kawa/go-http-server
db7f190906b960321e79afe72fd4ff648a9c0006
main.go
main.go
package main import ( "net/http" "log" "github.com/gorilla/mux" ) const BIND_ADDRESS string = ":8000" const STATIC_DIRECTORY string = "static" const STATIC_MOUNT_POINT string = "/" func RootHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Gorilla!\n")) } func main() { log.Printf("Starting serv...
package main import ( "net/http" "log" "github.com/gorilla/mux" ) const BIND_ADDRESS string = ":8000" const STATIC_DIRECTORY string = "static" const STATIC_MOUNT_POINT string = "/" func RootHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Gorilla!\n")) } func main() { log.Printf("Starting serv...
Move code endpoint to test static index
Move code endpoint to test static index
Go
apache-2.0
hexaglow/webviz-vr,hexaglow/webviz-vr
787052dd7298862cacb84d88a850807667e4a173
main.go
main.go
package main import ( "flag" "fmt" ) func main() { tester, err := NewTTFB() if err != nil { fmt.Println(err) return } flag.Parse() results, err := tester.Report(flag.Arg(0)) if err != nil { fmt.Println(err) return } fmt.Printf("@ Testing domain '%s'\n", tester.domain) fmt.Printf(" Status: Con...
package main import ( "flag" "fmt" ) func main() { tester, err := NewTTFB() if err != nil { fmt.Println(err) return } flag.Parse() results, err := tester.Report(flag.Arg(0)) if err != nil { fmt.Println(err) return } var icon string fmt.Printf("@ Testing domain '%s'\n", tester.domain) fmt.Pri...
Add icon to represent successful and failed requests
Add icon to represent successful and failed requests
Go
mit
cixtor/webttfb
a5da770fe9d2a5850f8bd36a4ae0c20fd0b9d5a6
main.go
main.go
package main import ( "github.com/cloudtools/ssh-cert-authority/util" "github.com/codegangsta/cli" "os" ) func main() { app := cli.NewApp() app.Name = "ssh-cert-authority" app.EnableBashCompletion = true app.Version = ssh_ca_util.BuildVersion app.Commands = []cli.Command{ { Name: "request", Aliase...
package main import ( "github.com/cloudtools/ssh-cert-authority/util" "github.com/codegangsta/cli" "os" ) func main() { app := cli.NewApp() app.Name = "ssh-cert-authority" app.EnableBashCompletion = true app.Version = ssh_ca_util.BuildVersion app.Commands = []cli.Command{ { Name: "request", Aliase...
Fix busted subcommand shortcut for runserver
Fix busted subcommand shortcut for runserver
Go
bsd-2-clause
awu-platfora/ssh-cert-authority,postfix/ssh-cert-authority,awu-platfora/ssh-cert-authority,cloudtools/ssh-cert-authority,cloudtools/ssh-cert-authority,postfix/ssh-cert-authority
64edb02b81fe179d18dedcb737ecf09281a50795
runner/runner.go
runner/runner.go
package runner import ( "log" "github.com/sivel/overseer/monitor" "github.com/sivel/overseer/notifier" "github.com/sivel/overseer/status" ) type Runner struct { StatusChan chan *status.Status Monitors []monitor.Monitor Notifiers []notifier.Notifier } func NewRunner(monitors []monitor.Monitor, notifiers []...
package runner import ( "log" "github.com/sivel/overseer/monitor" "github.com/sivel/overseer/notifier" "github.com/sivel/overseer/status" ) type Runner struct { StatusChan chan *status.Status Monitors []monitor.Monitor Notifiers []notifier.Notifier } func NewRunner(monitors []monitor.Monitor, notifiers []...
Improve notification performance with some more goroutines
Improve notification performance with some more goroutines
Go
apache-2.0
sivel/overseer
ef638ee2ba371b1ff2a59155652cc16c6885c838
exercises/triangle/triangle.go
exercises/triangle/triangle.go
// This is a "stub" file. It's a little start on your solution. // It's not a complete solution though; you have to write some code. // Package twofer should have a package comment that summarizes what it's about. // https://golang.org/doc/effective_go.html#commentary package triangle // Notice KindFromSides() retu...
// This is a "stub" file. It's a little start on your solution. // It's not a complete solution though; you have to write some code. // Package triangle should have a package comment that summarizes what it's about. // https://golang.org/doc/effective_go.html#commentary package triangle // Notice KindFromSides() re...
Fix package and method names in comments
Fix package and method names in comments
Go
mit
exercism/xgo,leenipper/xgo,leenipper/xgo,exercism/xgo
fb1092583950f18375ac0dfa5ec62a9d5d9077ea
gossip/common/common_test.go
gossip/common/common_test.go
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package common import "testing" func TestNoop(t *testing.T) { // This is just to make this package included in the code-coverage statistics }
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package common import ( "testing" "github.com/stretchr/testify/assert" ) func TestIsNotSame(t *testing.T) { id := PKIidType("1") assert.True(t, id.IsNotSameFilter(PKIidType("2"))) assert.False(t, id.IsNotSameFilter(PKIidType("1...
Bring gossip/common code coverage back up
[FAB-7555] Bring gossip/common code coverage back up The code coverage % was high but dropped to 50%. This change set brings it up to 87%. Change-Id: I01af079a1f244b664a88ff1238114838368100a4 Signed-off-by: yacovm <632344b5da9bd743456189af4db4b56472defb8c@il.ibm.com>
Go
apache-2.0
lukehuangch/fabric,muralisrini/fabric,binhn/fabric,manish-sethi/fabric-sidedb,binhn/fabric,manish-sethi/fabric-sidedb,lukehuangch/fabric,ckeyer/fabric,ckeyer/fabric,xixuejia/fabric,stemlending/fabric,manish-sethi/fabric-sidedb,jimthematrix/fabric,stemlending/fabric,lukehuangch/fabric,hyperledger/fabric,ckeyer/fabric,xi...
34f0b673e632a18d4cd94c692838a4f79aeb17f8
cmd/cochonou/main.go
cmd/cochonou/main.go
package main import ( "github.com/asdine/storm" "github.com/labstack/echo" "github.com/genesor/cochonou/http" "github.com/genesor/cochonou/os" ) func main() { e := echo.New() db, err := storm.Open(os.GetEnvWithDefault("COCH_BOLT_DB_PATH", "cochonou_dev.db")) if err != nil { panic(err.Error()) } defer db...
package main import ( "github.com/asdine/storm" "github.com/labstack/echo" "github.com/genesor/cochonou/http" "github.com/genesor/cochonou/os" ) func main() { e := echo.New() db, err := storm.Open(os.GetEnvWithDefault("BOLT_DB_PATH", "cochonou_dev.db")) if err != nil { panic(err.Error()) } defer db.Clos...
Remove COCH prefix from env vars
Remove COCH prefix from env vars
Go
mit
genesor/cochonou,genesor/cochonou,genesor/cochonou
23482f307420b8369a3e0277b3d46da0f3205dd8
repl.go
repl.go
package main import ( "bufio" "flag" "fmt" "io/ioutil" "misc/calc/eval" "os" ) var version = "0.1" func main() { flag.Parse() if flag.NArg() >= 1 { data, err := ioutil.ReadFile(flag.Arg(0)) if err != nil { fmt.Println(err) } eval.EvalExpr(string(data)) } else { fmt.Println("Welcome to Calc REPL...
package main import ( "bufio" "flag" "fmt" "io/ioutil" "misc/calc/eval" "os" ) var version = "0.1" func stripCR(in []byte) []byte { out := make([]byte, len(in)) i := 0 for _, ch := range in { if ch != '\r'{ out[i] = ch i++ } } return out[:i] } func main() { flag.Parse() if flag.NArg() >= 1 { ...
Fix for line endings on all platforms in REPL
Fix for line endings on all platforms in REPL
Go
bsd-2-clause
rthornton128/gocalc
90fc1aa88eb8100117bce546aee751951cf51b2f
fs.go
fs.go
package main import ( "log" "os" "os/exec" "path/filepath" "strings" ) func rootVolPath() string { volumes, err := filepath.Glob("/Volumes/*") if err != nil || volumes == nil { log.Println("Unable to list /Volumes/*") log.Fatal(err) } for _, volume := range volumes { link_path, err := os.Readlink(volu...
package main import ( "log" "os" "os/exec" "path/filepath" "strings" ) func rootVolPath() string { volumes, err := filepath.Glob("/Volumes/*") if err != nil || volumes == nil { log.Println("Unable to list /Volumes/*") log.Fatal(err) } for _, volume := range volumes { link_path, err := os.Readlink(volu...
Fix bug in time machine logic
Fix bug in time machine logic
Go
mit
rselph/sumcheck
e992a8d75516a96dcfd718d028a58ab55d599330
main.go
main.go
package main import ( _ "expvar" "net/http" "os" "github.com/bmizerany/pat" "github.com/codegangsta/negroni" "github.com/meatballhat/negroni-logrus" "github.com/unrolled/render" ) func main() { Run() } func Run() { m := pat.New() n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets")...
package main import ( _ "expvar" "net/http" "os" "github.com/bmizerany/pat" "github.com/codegangsta/negroni" "github.com/meatballhat/negroni-logrus" "github.com/unrolled/render" ) func main() { Run() } func Run() { m := pat.New() n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets")...
Rename `r` variable to `o`
Rename `r` variable to `o` ...for `output`, which means we can use `r` for `*http.Request`.
Go
mit
mattbostock/leavediary
021f0c1b6a844b4160a06bd59076dd08adc1d1e9
main.go
main.go
package main import ( "fmt" "os" "io/ioutil" "flag" "log" ) var ( elim = flag.String("e", "", "Eliminate this (one-character) function.") ) func main() { flag.Parse() var input []byte if flag.NArg() == 0 { var err os.Error input, err = ioutil.ReadAll(os.Stdin) if err != nil { log.Exitln(err) } }...
package main import ( "fmt" "os" "io/ioutil" "flag" "log" ) var ( elim = flag.String("e", "", "Eliminate this (one-character) function.") ) func main() { flag.Parse() var input []byte if flag.NArg() == 0 { var err os.Error input, err = ioutil.ReadAll(os.Stdin) if err != nil { log.Exitln(err) } }...
Deal with multiple vars to eliminate.
Deal with multiple vars to eliminate.
Go
bsd-3-clause
anschelsc/pure,anschelsc/pure
1335b6df03f034a7a3be064f4126ad11fd520dc8
integration_tests/tests/network/ping/main.go
integration_tests/tests/network/ping/main.go
package main import "C" import ( "github.com/unigornel/go-tcpip/ethernet" "github.com/unigornel/go-tcpip/icmp" "github.com/unigornel/go-tcpip/ipv4" ) func main() {} //export Main func Main(unused int) { sourceIP := [4]byte{10, 0, 100, 2} nic := ethernet.NewNIC() eth := ethernet.NewLayer(nic) arp := ipv4.NewA...
package main import "C" import ( "fmt" "net" "github.com/unigornel/go-tcpip/ethernet" "github.com/unigornel/go-tcpip/icmp" "github.com/unigornel/go-tcpip/ipv4" ) func main() {} var ipAddress string //export Main func Main(unused int) { if ipAddress == "" { ipAddress = "10.0.100.2" fmt.Printf("[*] warning...
Use a ping test ip address that can be set at build time
Use a ping test ip address that can be set at build time
Go
bsd-2-clause
unigornel/unigornel,unigornel/unigornel
ff1954998bc49a634c3f759f0d280aa28c75108d
cmd/robot/main.go
cmd/robot/main.go
package main import "github.com/tomlanyon/toy-gobot/robot" func main() { r := robot.NewRobot(0,5,0,5) r.Dump() }
package main import "os" import "fmt" import "github.com/tomlanyon/toy-gobot/robot" func main() { r := robot.NewRobot(0,5,0,5) err := r.Place(1,1,robot.South) if err != nil { fmt.Println(err) os.Exit(1) } err = r.Move() if err != nil { fmt.Println(err) os.Exit(1) } r.Left() err = r.Move() if err...
Test new functionality in "robot" cmd tool.
Test new functionality in "robot" cmd tool.
Go
mit
tomlanyon/toy-gobot
d141ae3c35f5711fb78b9b134cdf14927a84b79c
oauto/client/authenticate.go
oauto/client/authenticate.go
package client import ( "github.com/ibrt/go-oauto/oauto/api" "net/http" "fmt" "encoding/json" "github.com/go-errors/errors" "bytes" "io/ioutil" ) func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) { body, err := json.Marshal(request) if err != nil { retur...
package client import ( "github.com/ibrt/go-oauto/oauto/api" "net/http" "fmt" "encoding/json" "github.com/go-errors/errors" "bytes" "io/ioutil" ) func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) { body, err := json.Marshal(request) if err != nil { retur...
Improve error reporting in client.
Improve error reporting in client.
Go
mit
ibrt/go-oauto,ibrt/go-oauto
6d61cab90a93a50d01842c45e8c610686fdcb5af
docker-structs.go
docker-structs.go
package dockerguard type DockerInfo struct { // Infos from docker api /version APIVersion string `json:"ApiVersion"` Arch string `json:"Arch"` Experimental bool `json:"Experimental"` GitCommit string `json:"GitCommit"` GoVersion string `json:"GoVersion"` KernelVersion string `json:"Kernel...
package dockerguard type DockerInfo struct { // Infos from docker api /version APIVersion string `json:"ApiVersion"` Arch string `json:"Arch"` Experimental bool `json:"Experimental"` GitCommit string `json:"GitCommit"` GoVersion string `json:"GoVersion"` KernelVersion string `json:"Kernel...
Add NetBandwith & CPUUsage in Container struct
Add NetBandwith & CPUUsage in Container struct
Go
mit
90TechSAS/libgo-docker-guard
66be70de94c668405564be0221c594bbfaded72c
bolus.go
bolus.go
package medtronic import ( "fmt" ) const ( bolus Command = 0x42 maxBolus = 25000 // milliUnits ) // Bolus delivers the given amount of insulin as a bolus. // For safety, this command is not attempted more than once. func (pump *Pump) Bolus(amount Insulin) { if amount < 0 { pump.SetError(fmt.Errorf("bolus amou...
package medtronic import ( "fmt" ) const ( bolus Command = 0x42 maxBolus = 25000 // milliUnits ) // Bolus delivers the given amount of insulin as a bolus. // For safety, this command is not attempted more than once. func (pump *Pump) Bolus(amount Insulin) { if amount < 0 { pump.SetError(fmt.Errorf("bolus amou...
Enforce exact multiple of milliUnits/stroke in Bolus function
Enforce exact multiple of milliUnits/stroke in Bolus function
Go
mit
ecc1/medtronic,ecc1/medtronic
4b4186c07b3fe7d00ba97423ebd6feea28e9f9c7
ws/connection.go
ws/connection.go
package ws import ( "code.google.com/p/go.net/websocket" "time" ) type Connection struct { RawConn *websocket.Conn ReceivedMessages []string Timeout time.Duration unreadMessages []string } func newConnection(conn *websocket.Conn) *Connection { connection := &Connection{ RawConn: conn, ...
package ws import ( "code.google.com/p/go.net/websocket" "time" ) type Connection struct { RawConn *websocket.Conn ReceivedMessages []string Timeout time.Duration } func newConnection(conn *websocket.Conn) *Connection { connection := &Connection{ RawConn: conn, Timeout: 1 * time.Second, ...
Remove unnecessary unreadMessages attribute on ws.Connection.
Remove unnecessary unreadMessages attribute on ws.Connection.
Go
mit
straytaoist/testflight,drewolson/testflight,Thermeon/testflight
7760ebe659fcc116bab1eaf747362e62849cd507
lb/lb.go
lb/lb.go
package lb import ( "math/rand" "time" ) // Implement a load balancer that given a set of requests distributes those // requests to an arbitrary number of weighted backends type Backend struct { Name string Weight int Handled int } type LoadBalancer struct { w map[int]*Backend } func NewLoadBalancer(back...
package lb import ( "math/rand" "time" ) // Implement a load balancer that given a set of requests distributes those // requests to an arbitrary number of weighted backends type Backend struct { Name string Weight int Handled int } type LoadBalancer struct { w map[int]*Backend } func NewLoadBalancer(back...
Remove ok assertion in loadbalancer weight map lookup
Remove ok assertion in loadbalancer weight map lookup I'd thought about raising an error if we looked up a nonexistent weight, but decided not to.
Go
apache-2.0
negz/practice
e226888544bee976cb18b25c0ae0f648f990dc22
index/persist.go
index/persist.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 index import ( "encoding/json" "io" "os" ) // PersistStore is a type which defines a simple persistence store. type PersistStore string // NewPersistStore creates a new ...
// 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 index import ( "encoding/json" "io" "os" ) // PersistStore is a type which defines a simple persistence store. type PersistStore string // NewPersistStore creates a new ...
Add godoc to Persist method.
Add godoc to Persist method.
Go
bsd-2-clause
GrahamGoudeau21/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik
1e00760623cc4e12c2cab308b0d39e600b1877e9
pkg/apis/pipeline/v1beta1/version_validation.go
pkg/apis/pipeline/v1beta1/version_validation.go
/* Copyright 2021 The Tekton 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, softw...
/* Copyright 2021 The Tekton 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, softw...
Remove field name from error returned during feature gate validation
Remove field name from error returned during feature gate validation Prior to this commit the feature gate validation returned a validation error with its field path set to "workspaces". This isn't correct - the validation can guard any field. This commit removes the "workspaces" field path from the validation error ...
Go
apache-2.0
tektoncd/pipeline,tektoncd/pipeline
d994d08664b9e1184696b2a91264f27a556afb70
sys/stat_unix.go
sys/stat_unix.go
// +build linux solaris package sys import ( "syscall" "time" ) // StatAtime returns the Atim func StatAtime(st *syscall.Stat_t) syscall.Timespec { return st.Atim } // StatCtime returns the Ctim func StatCtime(st *syscall.Stat_t) syscall.Timespec { return st.Ctim } // StatMtime returns the Mtim func StatMtime(...
// +build linux solaris package sys import ( "syscall" "time" ) // StatAtime returns the Atim func StatAtime(st *syscall.Stat_t) syscall.Timespec { return st.Atim } // StatCtime returns the Ctim func StatCtime(st *syscall.Stat_t) syscall.Timespec { return st.Ctim } // StatMtime returns the Mtim func StatMtime(...
Add time type conversion for 32bit Unix platforms
Add time type conversion for 32bit Unix platforms Ensures the time.Unix function is given int64 arguments Signed-off-by: Trevor Porter <455d864f53b09d70b2d5550c0258d6765f92444a@ucdavis.edu>
Go
apache-2.0
estesp/containerd,crosbymichael/containerd,kunalkushwaha/containerd,dmcgowan/containerd,containerd/containerd,miaoyq/containerd,dmcgowan/containerd,kunalkushwaha/containerd,vdemeester/containerd,thaJeztah/containerd,estesp/containerd,mikebrow/containerd,miaoyq/containerd,containerd/containerd,vdemeester/containerd,thaJ...
bd3fcdc8170e1d3f1ac544463e4babf2df00969f
mt.go
mt.go
package main import ( "bufio" "fmt" "log" "net" ) const PORT = "2525" func main() { server := createServer(PORT) defer server.Close() for { conn, err := server.Accept() if err != nil { log.Fatalf("Error accepting: %v\n", err) } go handleConnection(conn) } } func createServer(port string) (net...
package main import ( "bufio" "fmt" "log" "net" ) const PORT = "2525" func main() { server := createServer(PORT) defer server.Close() for { conn, err := server.Accept() if err != nil { log.Fatalf("Error accepting: %v\n", err) } go handleConnection(conn) } } func createServer(port string) (net...
Use Print instead of Printf.
Use Print instead of Printf.
Go
mit
frodsan/mat
ba437768c79289b8d84b26353b61201b3796d69a
lib/image/list.go
lib/image/list.go
package image import ( "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/lib/objectserver" ) func (image *Image) listObjects() []hash.Hash { hashes := make([]hash.Hash, 0, image.FileSystem.NumRegularInodes+2) image.forEachObject(func(hashVal hash.Hash) error { hashes = append(hashes, hashV...
package image import ( "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/lib/objectserver" ) func (image *Image) listObjects() []hash.Hash { hashes := make([]hash.Hash, 0, image.FileSystem.NumRegularInodes+2) image.forEachObject(func(hashVal hash.Hash) error { hashes = append(hashes, hashV...
Reduce transient memory consumption of lib/image.Image.ListMissingObjects().
Reduce transient memory consumption of lib/image.Image.ListMissingObjects().
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator,Symantec/Dominator
69ad5d9568b51cc5fc191a428e054b9f5128dce9
util.go
util.go
package dsbldr import ( "fmt" ) // BasicOAuthHeader spits out a basic OAuth Header based on access token func BasicOAuthHeader(consumerKey, nonce, signature, signatureMethod, timestamp, token string) string { return fmt.Sprintf(`OAuth oauth_consumer_key="%s", oauth_nonce="%s", oauth_signature="%s", oauth_sig...
package dsbldr import ( "fmt" ) // BasicOAuthHeader spits out a basic OAuth Header based on access token func BasicOAuthHeader(consumerKey, nonce, signature, signatureMethod, timestamp, token string) string { return fmt.Sprintf(`OAuth oauth_consumer_key="%s", oauth_nonce="%s", oauth_signature="%s", oauth_sig...
Modify utli.go writeStringColumn to overwrite existing columns
Modify utli.go writeStringColumn to overwrite existing columns
Go
mit
Korede-TA/dsbldr
2d9ac52ee8b32555a86662eefa8361cdf0fe02e5
doc.go
doc.go
// Gockle simplifies and mocks github.com/gocql/gocql. // // Gockle provides the basic abilities to insert, query, and mutate data, as // well as access to basic keyspace and table metadata. // // The entry point is NewSession or NewSimpleSession. Call it to get a Session. // // A Session is the connection to the datab...
// Package gockle simplifies and mocks github.com/gocql/gocql. // // Gockle provides the basic abilities to insert, query, and mutate data, as // well as access to basic keyspace and table metadata. // // The entry point is NewSession or NewSimpleSession. Call it to get a Session. // // A Session is the connection to t...
Fix to use "Package gockle..." wording
Fix to use "Package gockle..." wording
Go
apache-2.0
willfaught/gockle
82d6616b8cff53de886f1d5fc9cca64ee9e68deb
hyperlink.go
hyperlink.go
package octokit import ( "github.com/lostisland/go-sawyer" "net/url" ) type M map[string]interface{} type Hyperlink string // TODO: find out a way to not wrapping sawyer.Hyperlink like this func (l *Hyperlink) Expand(m M) (u *url.URL, err error) { link := sawyer.Hyperlink(string(*l)) sawyerM := sawyer.M{} for ...
package octokit import ( "github.com/jtacoma/uritemplates" "net/url" ) // TODO: use sawyer.Hyperlink type M map[string]interface{} type Hyperlink string func (l *Hyperlink) Expand(m M) (u *url.URL, err error) { template, e := uritemplates.Parse(string(*l)) if e != nil { err = e return } expanded, e := t...
Revert "Use sawyer.Hyperlink and sawyer.M"
Revert "Use sawyer.Hyperlink and sawyer.M" This reverts commit 52f030c42273e3a38543e1148d047523bd7fff0a.
Go
mit
calavera/go-octokit,half-ogre/go-octokit,octokit/go-octokit,pcasaretto/go-octokit,half-ogre/go-octokit,octokit/go-octokit,pcasaretto/go-octokit,calavera/go-octokit
26816a911a5e12b2b78c66b958030fbc18193b6f
secret_update.go
secret_update.go
package client import ( "net/url" "strconv" "github.com/docker/docker/api/types/swarm" "golang.org/x/net/context" ) // SecretUpdate updates a Secret. Currently, the only part of a secret spec // which can be updated is Labels. func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version,...
package client import ( "net/url" "strconv" "github.com/docker/docker/api/types/swarm" "golang.org/x/net/context" ) // SecretUpdate attempts to updates a Secret func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error { query := url.Values{} query.Se...
Add integration test for stack deploy with secrets.
Add integration test for stack deploy with secrets. Signed-off-by: Daniel Nephin <6347c07ae509164cffebfb1e2a0d6ed64958db19@docker.com>
Go
apache-2.0
e11137/cli,thaJeztah/cli,allencloud/cli,cpuguy83/cli,gdevillele/cli,riyazdf/cli,redpanda/cli,docker/cli,cpuguy83/cli,riyazdf/cli,dnephin/cli,thaJeztah/cli,Zebrilee/cli,docker/cli,e11137/cli,ashfall/cli,redpanda/cli,Zebrilee/cli,dnephin/cli,ashfall/cli,allencloud/cli
385ffd4bee9501add7c6495bbe2dd3896c248751
length_field.go
length_field.go
package sarama import "encoding/binary" // LengthField implements the PushEncoder and PushDecoder interfaces for calculating 4-byte lengths. type lengthField struct { startOffset int } func (l *lengthField) saveOffset(in int) { l.startOffset = in } func (l *lengthField) reserveLength() int { return 4 } func (l ...
package sarama import "encoding/binary" // LengthField implements the PushEncoder and PushDecoder interfaces for calculating 4-byte lengths. type lengthField struct { startOffset int } func (l *lengthField) saveOffset(in int) { l.startOffset = in } func (l *lengthField) reserveLength() int { return 4 } func (l ...
Add support for length fields encoded as varints.
Add support for length fields encoded as varints. Kafka 0.11 encodes Record length as varint.
Go
mit
remerge/sarama,Shopify/sarama,vrischmann/sarama,DataDog/sarama,mailgun/sarama,VividCortex/sarama,mailgun/sarama,vrischmann/sarama,DataDog/sarama,remerge/sarama,VividCortex/sarama,Shopify/sarama
83372e07c5f355e275822be2b47e6d0bde1b4084
test/fixedbugs/bug215.go
test/fixedbugs/bug215.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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=158 package main type A struct { a A; } // ERROR "rec...
// 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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=158 package main type A struct { a A } // ERROR "recursi...
Tweak test to work with both 6g and gccgo.
Tweak test to work with both 6g and gccgo. Pull the struct into a single line, since 6g reports the error on the last line of the struct definition and gccgo reports it on the first line. 6g: bug215.go:12: invalid recursive type A gccgo: bug215.go:12:6: error: invalid recursive type ?A? R=rsc http://codereview.apps...
Go
bsd-3-clause
sanjosh/sanjos100-tipc,webfd/go-zh,rflanagan/reginaldflanagan-project1,mhennings/marcohennings-go,scirelli/scirelli-go,d0f/go-zh,rflanagan/reginaldflanagan-project1,d0f/go-zh,glycerine/jeaten-go-arrayof-structof,rflanagan/reginaldflanagan-project1,bryanxu/go-zh,mhennings/marcohennings-go,glycerine/jeaten-go-arrayof-str...
fa51889b9816ee7456d5e98b32572cca3f32abdb
backends.go
backends.go
package stager import ( "fmt" "net/http/httputil" "net/url" ) type backend struct { proxy *httputil.ReverseProxy } type backendManager struct { backends map[string]*backend suffixLength int } func (m backendManager) get(domain string) *backend { suffix := domain[:-m.suffixLength] u, _ := url.Parse("http...
package stager import ( "fmt" "net/http/httputil" "net/url" ) type backend struct { port int proxy *httputil.ReverseProxy running bool } // This will do the setup of the backend at some point. func (b *backend) initialize() { } type backendManager struct { backends map[string]*backend suffixLength...
Make a very basic allocation of backend ports
Make a very basic allocation of backend ports
Go
mit
go-stager/stager,go-stager/stager
e0e48abada5f038dae0321969b7c0d5c682b5984
client/5_1_1_stream_identifiers.go
client/5_1_1_stream_identifiers.go
package client import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" "golang.org/x/net/http2" ) func StreamIdentifiers() *spec.ClientTestGroup { tg := NewTestGroup("5.1.1", "Stream Identifiers") // An endpoint that receives an unexpected stream identifier // MUST respond with a con...
package client import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" "golang.org/x/net/http2" ) func StreamIdentifiers() *spec.ClientTestGroup { tg := NewTestGroup("5.1.1", "Stream Identifiers") // An endpoint that receives an unexpected stream identifier // MUST respond with a con...
Correct a client test description
Correct a client test description even-numbered -> odd-numbered
Go
mit
summerwind/h2spec
92a7e3585fa8811d151f3447afecd3809645ae01
image.go
image.go
package imageproxy import ( "bytes" "encoding/gob" ) type Image struct { Type string Data []byte } func (image *Image) serialize() (serialized []byte, err error) { buffer := bytes.NewBuffer([]byte{}) encoder := gob.NewEncoder(buffer) err = encoder.Encode(image) if err != nil { return } serialized = buffe...
package imageproxy import ( "bytes" "encoding/gob" ) type Image struct { Type string Data []byte } func (image *Image) Serialize() (serialized []byte, err error) { buffer := bytes.NewBuffer([]byte{}) encoder := gob.NewEncoder(buffer) err = encoder.Encode(image) if err != nil { return } serialized = buffe...
Make public methods in Image
Make public methods in Image
Go
mit
pierrre/imageserver
ba08a5bb55dd7766417e1f7446107efd3966d038
event/modifier.go
event/modifier.go
// Copyright 2019 The Ebiten Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
// Copyright 2019 The Ebiten Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
Add a comment at Modifier
event: Add a comment at Modifier Updates #926
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
878e88e777419ad5bd69ba537c062df7db26a7d4
verbs.go
verbs.go
package beam type Verb uint32 const ( Ack Verb = iota Attach Connect Error File Get Log Ls Set Spawn Start Stop Watch )
package beam type Verb uint32 const ( Ack Verb = iota Attach Connect Error File Get Log Ls Set Spawn Start Stop Watch ) func (v Verb) String() string { switch v { case Ack: return "Ack" case Attach: return "Attach" case Connect: return "Connect" case Error: return "Error" case File: retu...
Add string representation of verb enum
Add string representation of verb enum Docker-DCO-1.1-Signed-off-by: Ben Firshman <ben@firshman.co.uk> (github: bfirsh)
Go
apache-2.0
dmcgowan/libchan,docker/libchan,wangtuanjie/libchan,beni55/libchan
b6b146241d628d7a5502c05d01f879366be69ec6
statichandler.go
statichandler.go
package kwiscale import ( "crypto/md5" "fmt" "net/http" "os" "path/filepath" ) // StaticHandler handle static files handlers. Use App.SetStatic(path) that create the static handler type staticHandler struct { RequestHandler } // Use http.FileServer to serve file after adding ETag. func (s *staticHandler) Get()...
package kwiscale import ( "crypto/md5" "fmt" "net/http" "os" "path/filepath" ) // StaticHandler handle static files handlers. Use App.SetStatic(path) that create the static handler type staticHandler struct { RequestHandler } // Use http.FileServer to serve file after adding ETag. func (s *staticHandler) Get()...
Fix prefix problem that made a 404 error
Fix prefix problem that made a 404 error
Go
bsd-3-clause
kwiscale/framework
06791dc89fd65f43d16adde568510ae1eda3e089
lib/prober/api.go
lib/prober/api.go
package prober type Prober interface { Probe() error }
package prober // Prober defines a type that can be used to run a probe. type Prober interface { Probe() error }
Add a tiny bit of documentation for lib/prober package.
Add a tiny bit of documentation for lib/prober package.
Go
apache-2.0
rgooch/health-agent,Symantec/health-agent,Symantec/health-agent,rgooch/health-agent
f15e7a6c1626b77462f266ea7e6f94384ce5ef9b
go/cmd/rulesctl/cmd/list.go
go/cmd/rulesctl/cmd/list.go
package cmd import ( "github.com/spf13/cobra" "vitess.io/vitess/go/cmd/rulesctl/common" ) func List() *cobra.Command { var listOptName string var listOptNamesOnly bool listCmd := &cobra.Command{ Use: "list", Short: "Display the rules in the config file", Args: cobra.NoArgs, } listCmd.Flags().StringV...
package cmd import ( "github.com/spf13/cobra" "vitess.io/vitess/go/cmd/rulesctl/common" ) func List() *cobra.Command { var listOptName string var listOptNamesOnly bool listCmd := &cobra.Command{ Use: "list", Short: "Display the rules in the config file", Args: cobra.NoArgs, } listCmd.Flags().StringV...
Restructure `List` command to make nil check meaningful
[rulesctl] Restructure `List` command to make nil check meaningful This is an often-surprising Go quirk, so I will explain a bit: An interface has two components: the concrete type, and the value. If both of these are `nil`, then the interface is equal to `nil`. If the concrete type is non-nil, even if the value for ...
Go
apache-2.0
mahak/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,mahak/vitess,mahak/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,mahak/vitess,vitessio/vitess
0af0f26d8af43efe804388beb50a27e6ed10ce94
edn/lexer_test.go
edn/lexer_test.go
package edn import . "testing" func TestEmptyGivesOnlyEOF(t *T) { lexer := Lex("") token, _ := lexer.Next() if token.kind != tEOF { t.Error("expecting EOF") } } // I suspect there's a potential race condition here first since // the lexer is in a different thread. If `Next()` is called while the lexer // is s...
package edn import . "testing" func assertLexerYieldsCorrectTokens( t *T, source string, types []tokenType, values []string) { tokens := make([]token, 0) for token := range Lex(source).tokens { tokens = append(tokens, token) } if len(tokens) != len(types) { t.Errorf("Got %d tokens, expecting %d", len(t...
Write test helper for testing lexer
Write test helper for testing lexer
Go
mit
bjeanes/gojure,bjeanes/gojure
f6b8e58644155275d67b069d596f1ae6ac3b46b8
buffer.go
buffer.go
package main // Split the buffer by '\n' (0x0A) characters, return an byte[][] of // indicating each metric, and byte[] of the remaining parts of the buffer func ParseBuffer(buffer []byte) ([][]byte, []byte) { metrics := make([][]byte, 0) var metricBufferCapacity uint32 = 0xff metricBuffer := make([]byte, metricBu...
package main // Split the buffer by '\n' (0x0A) characters, return an byte[][] of // indicating each metric, and byte[] of the remaining parts of the buffer func ParseBuffer(buffer []byte) ([][]byte, []byte) { metrics := make([][]byte, 8) var metricBufferCapacity uint = 0xff metricBuffer := make([]byte, metricBuff...
Reduce allocations further by not appending
Reduce allocations further by not appending
Go
mit
samgiles/graphiteauthd
e44d8f60835d14705cf459986b30876f19de3a8e
client/udp_buffer_pool.go
client/udp_buffer_pool.go
package client import ( "sync" ss "github.com/Jigsaw-Code/outline-ss-server/shadowsocks" ) var pool = sync.Pool{ New: func() interface{} { return make([]byte, ss.MaxUDPPacketSize) }, } // newBuffer retrieves a UDP buffer from the pool. func newUDPBuffer() []byte { return pool.Get().([]byte) } // freeBuffer ...
package client import ( "sync" ) // maxUDPBufferSize is the maximum UDP packet size in bytes. const maxUDPBufferSize = 16 * 1024 var pool = sync.Pool{ New: func() interface{} { return make([]byte, maxUDPBufferSize) }, } // newBuffer retrieves a UDP buffer from the pool. func newUDPBuffer() []byte { return poo...
Revert UDP buffer size to 16KiB
Revert UDP buffer size to 16KiB
Go
apache-2.0
Jigsaw-Code/outline-ss-server
c42b1214288dd32d6bcfb89ef5a9926f6228889b
newedit/default_bindings.go
newedit/default_bindings.go
package newedit // Elvish code for default bindings, assuming the editor ns as the global ns. const defaultBindingsElv = ` insert:binding = (binding-map [ &Ctrl-D= $commit-eof~ &Default= $insert:default-handler~ ]) ` // vi: set et:
package newedit // Elvish code for default bindings, assuming the editor ns as the global ns. const defaultBindingsElv = ` insert:binding = (binding-map [ &Left= $move-left~ &Right= $move-right~ &Ctrl-Left= $move-left-word~ &Ctrl-Right= $move-right-word~ &Alt-Left= $move-left-word~ &Alt-Right= $move-...
Add common buffer builtins to the default binding.
newedit: Add common buffer builtins to the default binding.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
c6c45d55bf0362253e6473038367e4e8193472ad
ntstatus.go
ntstatus.go
package ntdll import ( "fmt" ) type NtStatus uint32 func (s NtStatus) Error() error { if s == 0 { return nil } return fmt.Errorf("NtStatus %08x", s) }
package ntdll import ( "fmt" ) type NtStatus uint32 func (s NtStatus) Error() error { if s == 0 { return nil } return fmt.Errorf("NtStatus %08x", s) } func (s NtStatus) IsSuccess() bool { return 0 <= s && s <= 0x3fffffff } func (s NtStatus) IsInofmational() bool { return 0x40000000 <= s && s <= 0x7FFFFFFF ...
Add NtStatus convenience functions and some select constants
Add NtStatus convenience functions and some select constants
Go
bsd-2-clause
hillu/go-ntdll
978b79394c5c93dc9eb98c32a2bd648b6a73a28c
camera.go
camera.go
package grayt type Camera interface { MakeRay(x, y float64) ray } type RectilinearCamera struct { screenX, screenY Vect screenLoc Vect eyeLoc Vect } func NewRectilinearCamera() *RectilinearCamera { return nil } func (c *RectilinearCamera) MakeRay(x, y float64) ray { return ray{} }
package grayt // Cameras produce rays that go from an eye to a virtual screen. The rays // produced are specified via a coordiate system on the virtual screen. The // left side of the virtual screen has x coordinate -1, the right side of the // virtual screen has coordinate +1. The top of the virtual screen has y // ...
Add coordinate system comment to the Camera interface
Add coordinate system comment to the Camera interface
Go
mit
peterstace/grayt,peterstace/grayt,peterstace/grayt
fbd9b464a04e85a8dc8cad3af93060c54b038bb9
examples/getstr/getstr.go
examples/getstr/getstr.go
/* This example demonstrates reading a string from input, rather than a * single character. Note that only the 'n' versions of getstr have been * implemented in goncurses to ensure buffer overflows won't exist */ package main import gc "code.google.com/p/goncurses" func main() { stdscr, _ := gc.Init() defer gc....
/* This example demonstrates reading a string from input, rather than a * single character. Note that only the 'n' versions of getstr have been * implemented in goncurses to ensure buffer overflows won't exist */ package main import gc "code.google.com/p/goncurses" func main() { stdscr, _ := gc.Init() defer gc....
Update form example for MovePrint
Update form example for MovePrint
Go
bsd-3-clause
vkolev/goncurses-mirror,vkolev/goncurses-mirror
a1e20592162092a9c076bac666692b0786b8fe40
text/query.go
text/query.go
package text import "unicode" type Query interface { Match(string) int } // Word matches complete words only. // The "complete words" of a string s is defined as the result of // splitting the string on every single Unicode whitespace character. type Word struct { W string } func (q Word) Match(s string) int { i...
package text import ( "unicode" ) type Query interface { Match(string) int } // Word matches complete words only. // The "complete words" of a string s is defined as the result of // splitting the string on every single Unicode whitespace character. type Word struct { W string } func (q Word) Match(s string) int...
Fix comma and newline text.Word matching
Fix comma and newline text.Word matching
Go
mit
kayex/sirius
b0e269039696dee572daf065f323b6f3f3007ee4
src/server/pkg/worker/worker.go
src/server/pkg/worker/worker.go
package worker import ( "github.com/pachyderm/pachyderm/src/client/pps" ) // MatchDatum checks if a datum matches a filter. To match each string in // filter must correspond match at least 1 datum's Path or Hash. Order of // filter and data is irrelevant. func MatchDatum(filter []string, data []*pps.Datum) bool { ...
package worker import ( "encoding/hex" "github.com/pachyderm/pachyderm/src/client/pps" ) // MatchDatum checks if a datum matches a filter. To match each string in // filter must correspond match at least 1 datum's Path or Hash. Order of // filter and data is irrelevant. func MatchDatum(filter []string, data []*pps...
Convert datum hash to hex before comparing it with request filter
Convert datum hash to hex before comparing it with request filter
Go
apache-2.0
pachyderm/pfs,pachyderm/pfs,pachyderm/pfs
c6b62311e4e894cea470aa1e52265df8ffde316d
client-v1/api_test.go
client-v1/api_test.go
package client
package client import ( "testing" "github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1" "github.com/stretchr/testify/assert" ) type Test struct { Resource Foo string `json:"foo"` } func (test *Test) PreMarshalJSON() error { test.Foo = "bat" return nil } func TestResourceUnmarshal(t *testing.T) { bod...
Add some basic tests for the base `Resource`
Add some basic tests for the base `Resource`
Go
apache-2.0
akamai-open/AkamaiOPEN-edgegrid-golang
e778dd4714d9b9cd2c69ca7b8437cbda94328ce6
errors.go
errors.go
// Copyright 2013 Apcera Inc. All rights reserved. package graft import ( "errors" ) var ( ClusterNameErr = errors.New("grafty: Cluster name can not be empty") ClusterSizeErr = errors.New("grafty: Cluster size can not be 0") HandlerReqErr = errors.New("grafty: Handler is required") RpcDriverReqErr = errors....
// Copyright 2013 Apcera Inc. All rights reserved. package graft import ( "errors" ) var ( ClusterNameErr = errors.New("graft: Cluster name can not be empty") ClusterSizeErr = errors.New("graft: Cluster size can not be 0") HandlerReqErr = errors.New("graft: Handler is required") RpcDriverReqErr = errors.New...
Move prefix to graft vs grafty
Move prefix to graft vs grafty
Go
apache-2.0
nats-io/graft,nats-io/graft,glycerine/graft
3506051d9948eb6d3c0c75d62fbf7e097c5da392
combined_test.go
combined_test.go
package regressions import ( "math" "testing" ) func TestMaxCombinedLogExp(t *testing.T) { r := NewCombined(math.Max, NewLogarithmic(), NewExponential()) err := r.Fit(testDataPoints...) if err != nil { t.Fatal(err) } t.Logf("R-squared: %+v", r.GetR2()) evaluateRegression(t, r) }
package regressions import ( "math" "testing" ) func TestMaxCombinedLogExp(t *testing.T) { r := NewCombined(math.Max, NewLogarithmic(), NewExponential()) err := r.Fit(testDataPoints...) if err != nil { t.Fatal(err) } t.Logf("R-squared: %+v", r.GetR2()) evaluateRegression(t, r) } func TestMeanCombinedLogLo...
Add test for another combination
Add test for another combination
Go
mit
nubbel/go-regressions
8c0792e5bd75542088bef7d5c65b98d431d11be3
commands/stat.go
commands/stat.go
package commands import ( "fmt" "github.com/evandbrown/dm/googlecloud" "github.com/evandbrown/dm/util" "github.com/spf13/cobra" ) var statCmd = &cobra.Command{ Use: "stat", Short: "Stat a deployment, listing its resources", } func init() { statCmd.PreRun = func(cmd *cobra.Command, args []string) { requir...
package commands import ( "fmt" "os" "text/tabwriter" "github.com/evandbrown/dm/googlecloud" "github.com/evandbrown/dm/util" "github.com/spf13/cobra" ) var statCmd = &cobra.Command{ Use: "stat", Short: "Stat a deployment, listing its resources", } func init() { statCmd.PreRun = func(cmd *cobra.Command, a...
Write deployment resources in tab format
Write deployment resources in tab format
Go
apache-2.0
evandbrown/dm,evandbrown/dm,evandbrown/dm
d962d51677f56f8b81f4d8d2d6428ead848f3e11
fizzbuzz/fizzbuzz/fizzbuzz.go
fizzbuzz/fizzbuzz/fizzbuzz.go
package fizzbuzz const ( fizz = "Fizz" buzz = "Buzz" ) func Run(limit int) []string { v := make([]string, 0) for i := 1; i <= limit; i++ { threes := i%3 == 0 fives := i%5 == 0 switch { case threes && fives: v = append(v, fizz+buzz) case threes: v = append(v, fizz) case fives: v = append(v, bu...
package fizzbuzz const ( fizz = "Fizz" buzz = "Buzz" ) func Run(limit int) []string { v := []string{} for i := 1; i <= limit; i++ { threes := i%3 == 0 fives := i%5 == 0 switch { case threes && fives: v = append(v, fizz+buzz) case threes: v = append(v, fizz) case fives: v = append(v, buzz) }...
Remove unnecessary make to create a slice
Remove unnecessary make to create a slice
Go
mit
devinschulz/experiments
8fa523b125135bbd6f7965798f7fd33f0cfbff26
crc32_field.go
crc32_field.go
package sarama import ( "encoding/binary" "hash/crc32" ) // crc32Field implements the pushEncoder and pushDecoder interfaces for calculating CRC32s. type crc32Field struct { startOffset int } func (c *crc32Field) saveOffset(in int) { c.startOffset = in } func (c *crc32Field) reserveLength() int { return 4 } f...
package sarama import ( "encoding/binary" "github.com/klauspost/crc32" ) // crc32Field implements the pushEncoder and pushDecoder interfaces for calculating CRC32s. type crc32Field struct { startOffset int } func (c *crc32Field) saveOffset(in int) { c.startOffset = in } func (c *crc32Field) reserveLength() int...
Use an optimized crc32 library which is faster
Use an optimized crc32 library which is faster
Go
mit
vrischmann/sarama,Shopify/sarama,DataDog/sarama,crast/sarama,Neuw84/sarama,HelixEducation/sarama,raisemarketplace/sarama,kmiku7/sarama,scalingdata/sarama,cep21/sarama,Neuw84/sarama,Shopify/sarama,DataDog/sarama,HelixEducation/sarama,cep21/sarama,raisemarketplace/sarama,remerge/sarama,jimmykuo/sarama,jepst/sarama,VividC...
de6d1b848f0245955467fb6e0fe9a38748cebe13
metadata/metadata_dell_linux.go
metadata/metadata_dell_linux.go
package metadata // Restrict to Linux because, although omreport runs fine on Windows, the // Windows metadata uses WMI to fetch this information. import ( "strings" "bosun.org/util" ) func init() { metafuncs = append(metafuncs, collectMetadataOmreport) } func collectMetadataOmreport() { _ = util.ReadCommand(f...
package metadata // Restrict to Linux because, although omreport runs fine on Windows, the // Windows metadata uses WMI to fetch this information. import ( "strings" "bosun.org/util" ) func init() { metafuncs = append(metafuncs, collectMetadataOmreport) } func collectMetadataOmreport() { _ = util.ReadCommand(f...
Change dell svctag metakey to be serialNumber
metadata: Change dell svctag metakey to be serialNumber This way it matches the windows machines that get the same info from WMI
Go
mit
Dieterbe/bosun,Dieterbe/bosun,vimeo/bosun,vimeo/bosun,Dieterbe/bosun,vimeo/bosun,Dieterbe/bosun,vimeo/bosun
5850ab9d5aaa2265553f943ba57b3f4bb6d89fcd
container/lxc/test.go
container/lxc/test.go
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package lxc // SetContainerDir allows tests in other packages to override the // containerDir. func SetContainerDir(dir string) (old string) { old, containerDir = containerDir, dir return } // SetLxcContainerDir allows tes...
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // Functions defined in this file should *ONLY* be used for testing. These // functions are exported for testing purposes only, and shouldn't be called // from code that isn't in a test file. package lxc // SetContainerDir ...
Add a file level comment.
Add a file level comment.
Go
agpl-3.0
axw/juju,wwitzel3/juju,frankban/juju-tmp,sinzui/juju,anastasiamac/juju,ericsnowcurrently/juju,alesstimec/juju,tasdomas/juju,makyo/juju,thomnico/juju,cmars/juju,bz2/juju,marcmolla/juju,Altoros/juju-vmware,marcmolla/juju,bogdanteleaga/juju,bac/juju,kat-co/juju,tasdomas/juju,AdamIsrael/juju,mikemccracken/juju,bz2/juju,eri...
5ed85c6b3ffa1a647cda61b7ce3aa0c7ec2f372e
src/chess/main.go
src/chess/main.go
package main import ( "board" "color" "fmt" "point" ) func scanMove() (*point.Move, error) { var file byte var rank int _, err := fmt.Scanf("%c%d", &file, &rank) return point.NewMove(file, rank), err } func main() { chessboard := board.NewBoard() finish := false now := color.White for finish == false {...
package main import ( "board" "color" "fmt" "point" ) func scanMove() (*point.Move, error) { var file byte var rank int _, err := fmt.Scanf("%c%d", &file, &rank) return point.NewMove(file, rank), err } func main() { chessboard := board.NewBoard() finish := false now := color.White for finish == false {...
Print a warning if your king is checked
Print a warning if your king is checked
Go
mit
Roadagain/Chess
d7c29acdf0691d2cd6d8b9ce13c485f524c6747c
fcal.go
fcal.go
package main import ( "flag" "github.com/phss/fcal/calendar" "log" "time" ) func main() { date := parseOptions() c := calendar.CalendarMonthFrom(date) calendar.PrintMonth(c) } func parseOptions() time.Time { var dateStr string flag.StringVar(&dateStr, "d", time.Now().Format("2006-01-02"), "ISO date of the d...
package main import ( "flag" "github.com/phss/fcal/calendar" "log" "strings" "time" ) func main() { date := parseOptions() c := calendar.CalendarMonthFrom(date) calendar.PrintMonth(c) } func parseOptions() time.Time { format := "2006-01-02" var dateStr string flag.StringVar(&dateStr, "d", time.Now().Form...
Allow date to be year and month
Allow date to be year and month
Go
mit
phss/fcal
36f181474e42aa9c82ab8f63a2bfdbf3986e1736
server/middleware/logger.go
server/middleware/logger.go
package middleware import ( "time" log "github.com/sirupsen/logrus" "gopkg.in/gin-gonic/gin.v1" ) func Logger() gin.HandlerFunc { return func(c *gin.Context) { requestID, _ := c.Get("request_id") logger := log.WithField("request_id", requestID) c.Set("logger", logger) start := time.Now() c.Next() en...
package middleware import ( "time" "github.com/sirupsen/logrus" "gopkg.in/gin-gonic/gin.v1" ) func Logger() gin.HandlerFunc { return func(c *gin.Context) { requestID, _ := c.Get("request_id") logger := logrus.WithField("request_id", requestID) c.Set("logger", logger) start := time.Now() c.Next() end...
Use `logrus` instead of `log` in import
Use `logrus` instead of `log` in import
Go
mit
jingweno/jqplay,jingweno/jqplay,jingweno/jqplay
250721a2cd531adef4273270934c3ec07d248dfa
executor/nsinit/nsinit_executor_test.go
executor/nsinit/nsinit_executor_test.go
package nsinit import ( "os" "testing" . "github.com/smartystreets/goconvey/convey" "polydawn.net/repeatr/executor/tests" "polydawn.net/repeatr/testutil" ) func Test(t *testing.T) { Convey("Spec Compliance: nsinit Executor", t, testutil.Requires( testutil.RequiresRoot, testutil.WithTmpdir(func() { ...
package nsinit import ( "os" "testing" . "github.com/smartystreets/goconvey/convey" "polydawn.net/repeatr/executor/tests" "polydawn.net/repeatr/testutil" ) func Test(t *testing.T) { Convey("Spec Compliance: nsinit Executor", t, testutil.Requires( testutil.RequiresRoot, testutil.RequiresNamespaces, t...
Disable nsinit tests in travis.
Disable nsinit tests in travis. Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
Go
apache-2.0
kkroening/repeatr,polydawn/repeatr,subuser-security/repeatr,kkroening/repeatr,polydawn/repeatr,subuser-security/repeatr
1b77ec6c018fe09f29bebf556e9ac0a5d6d09faa
cmds/dmesg/dmesg_test.go
cmds/dmesg/dmesg_test.go
package main import ( "os/exec" "testing" ) func TestDmesg(t *testing.T) { out, err := exec.Command("go", "run", "dmesg.go", "-c").Output() if err != nil { t.Fatalf("can't run dmesg: %v", err) } out, err = exec.Command("go", "run", "dmesg.go").Output() if err != nil { t.Fatalf("can't run dmesg: %v", err...
// Copyright 2016-2017 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "os/exec" "os/user" "testing" ) // Test reading from the buffer. // dmesg func TestDmesg(t *testing.T) { _, err := exec.Comm...
Allow dmesg tests to pass
Allow dmesg tests to pass As they stand, these tests are really bad for the following reasons: - Tests are non-deterministic (cannot predict the contents of dmesg) - The second test requires root permissions to run. When uid != 0, the second test is skipped to allow the build to pass in travis. These issues result...
Go
bsd-3-clause
u-root/u-root,GanShun/u-root,u-root/u-root,u-root/u-root,hugelgupf/u-root,GanShun/u-root,rminnich/u-root,hugelgupf/u-root,hugelgupf/u-root,rminnich/u-root,hugelgupf/u-root,rminnich/u-root,rminnich/u-root,GanShun/u-root
8ed5e483884e6af524b0447a30b6911d33dad172
json_formatter.go
json_formatter.go
package logmatic import ( "encoding/json" "fmt" "time" log "github.com/Sirupsen/logrus" "os" ) const defaultTimestampFormat = time.RFC3339 var markers = [2]string{"sourcecode", "golang"} type JSONFormatter struct { } func (f *JSONFormatter) Format(entry *log.Entry) ([]byte, error) { data := make(log.Fields, ...
package logmatic import ( "encoding/json" "fmt" "time" log "github.com/Sirupsen/logrus" ) const defaultTimestampFormat = time.RFC3339 var markers = [2]string{"sourcecode", "golang"} type JSONFormatter struct { } func (f *JSONFormatter) Format(entry *log.Entry) ([]byte, error) { data := make(log.Fields, len(en...
Revert "adding source code compatibility"
Revert "adding source code compatibility"
Go
mit
logmatic/logmatic-go
e4fdba6ce8ecb4148d639c412e35990b96afc332
pkg/skaffold/config/options.go
pkg/skaffold/config/options.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 label for tail usage
Add label for tail usage 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
49d01b6090743bec555987680eba18b776ad76f8
holux-dl/main.go
holux-dl/main.go
package main import ( "fmt" "holux" ) func main() { c, err := holux.Connect() if err != nil { // TODO LOG fmt.Println(err) return } c.Hello() defer c.Bye() index, err := c.GetIndex() if err != nil { fmt.Printf("Got error %v, arborting", err) } for _, row := range index { fmt.Println(row) } }...
package main import ( "fmt" "holux" "log" ) func main() { c, err := holux.Connect() if err != nil { log.Println(err) return } c.Hello() defer c.Bye() index, err := c.GetIndex() if err != nil { log.Fatalf("Got error %v, arborting", err) } for _, row := range index { fmt.Println(row) } }
Use log for debug printing
Use log for debug printing
Go
bsd-2-clause
arsatiki/gpsport260tool
5991d1e01fdc036109313223b99c9bac29529bfc
hw.go
hw.go
// +build !appengine package main import ( "fmt" "net/http" ) func helloWorld(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello World!") } func startPage(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello, test server started on 8080 port.\n - /helloworld - show title page\n - /showinf...
package main import ( "fmt" "net/http" ) func helloWorld(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello World!") } func startPage(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello, test server started on 8080 port.\n - /helloworld - show title page\n - /showinfo - show information a...
Correct version for deploy to GAE
Correct version for deploy to GAE
Go
mit
GreyLabsDev/GoTests,GreyLabsDev/GoTests
de2acc09a72eef33252c3dcc2fb0865d553dc990
gitgo/gitgo.go
gitgo/gitgo.go
package main import ( "bytes" "fmt" "io" "log" "os" "github.com/ChimeraCoder/gitgo" ) func main() { args := os.Args module := args[1] switch module { case "cat-file": hash := args[2] result, err := gitgo.CatFile(gitgo.SHA(hash)) if err != nil { log.Fatal(err) } io.Copy(os.Stdout, result) cas...
package main import ( "bytes" "fmt" "io" "log" "os" "github.com/ChimeraCoder/gitgo" ) func main() { args := os.Args module := args[1] switch module { case "cat-file": hash := args[2] result, err := gitgo.CatFile(gitgo.SHA(hash)) if err != nil { log.Fatal(err) } io.Copy(os.Stdout, result) cas...
Print error message when `git log` is not given a SHA
Print error message when `git log` is not given a SHA * This will be allowed after references are implemented
Go
apache-2.0
ChimeraCoder/gitgo,ChimeraCoder/gitgo,ChimeraCoder/gitgo
96885d09d7fb51738c42af368424911235c3b61a
api.go
api.go
package main import ( "log" "net/http" "github.com/gorilla/mux" "github.com/shurcooL/go/github_flavored_markdown" ) func DiffHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) file := vars["file"] + ".md" diff, err := Diff(file, vars["hash"]) if err != nil { log.Println("ERROR", "Faile...
package main import ( "log" "net/http" "github.com/gorilla/mux" "github.com/shurcooL/github_flavored_markdown" ) func DiffHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) file := vars["file"] + ".md" diff, err := Diff(file, vars["hash"]) if err != nil { log.Println("ERROR", "Failed t...
Update import path of github_flavored_markdown package.
Update import path of github_flavored_markdown package. It has moved out into a standalone repo recently. See https://github.com/shurcooL/go/issues/19#issuecomment-102574426 for rationale.
Go
mit
dushmis/go-wiki,dushmis/go-wiki,dushmis/go-wiki
8915665d9ce20efa9952a9d585b808452d7c6979
repo/settings.go
repo/settings.go
package repo type SettingsData struct { PaymentDataInQR *bool `json:"paymentDataInQR"` ShowNotifications *bool `json:"showNotificatons"` ShowNsfw *bool `json:"showNsfw"` ShippingAddresses *[]ShippingAddress `json:"shippingAddresses"` LocalCurrency *string...
package repo type SettingsData struct { PaymentDataInQR *bool `json:"paymentDataInQR"` ShowNotifications *bool `json:"showNotifications"` ShowNsfw *bool `json:"showNsfw"` ShippingAddresses *[]ShippingAddress `json:"shippingAddresses"` LocalCurrency *strin...
Fix typo 'showNotificatons' -> 'showNotifications'.
BUGFIX: Fix typo 'showNotificatons' -> 'showNotifications'.
Go
mit
hoffmabc/openbazaar-go,jackkleeman/openbazaar-go,cpacia/openbazaar-go,duomarket/openbazaar-test-nodes,cpacia/openbazaar-go,duomarket/openbazaar-test-nodes,gubatron/openbazaar-go,jackkleeman/openbazaar-go,gubatron/openbazaar-go,duomarket/openbazaar-test-nodes,yurizhykin/openbazaar-go,JustinDrake/openbazaar-go,OpenBazaar...
63b7488113665199259bc117e03b879a24a54a1c
src/gosubli.me/mg/meth/synchk/synchk.go
src/gosubli.me/mg/meth/synchk/synchk.go
package synchk import ( "go/parser" "go/scanner" "go/token" "gosubli.me/mg" ) type SynChk struct { Files []FileRef } type FileRef struct { Fn string Src string } type Error struct { Fn string Line int Column int Message string } type Res struct { Errors []Error } func (s *SynChk) Call() (int...
package synchk import ( "gosubli.me/mg" "gosubli.me/mg/sa" ) type SynChk struct { Files []FileRef } type FileRef struct { Fn string Src string } type Res struct { Errors []*sa.Error } func (s *SynChk) Call() (interface{}, string) { res := Res{} for _, f := range s.Files { if f, _ := sa.Parse(f.Fn, []byt...
Use pkg sa to parse the files being syntax checked. It gives us cached parsing and error lists for free.
Use pkg sa to parse the files being syntax checked. It gives us cached parsing and error lists for free.
Go
mit
DisposaBoy/GoSublime-next,DisposaBoy/GoSublime-next,DisposaBoy/GoSublime-next
9cdaaa37c68472b496f804cf5d9b72bc4e57981d
bot/bot.go
bot/bot.go
package bot import ( "regexp" ) type Bot struct { adapter Adapter Handlers map[*regexp.Regexp]func(msg *Message) } func New(adapter Adapter) *Bot { return &Bot{ adapter, map[*regexp.Regexp]func(msg *Message){}, } } func (b *Bot) Handle(expr string, handler func(msg *Message)) { b.Handlers[regexp.MustComp...
package bot import ( "regexp" ) type Bot struct { adapter Adapter Handlers map[*regexp.Regexp]func(msg *Message) } func New(adapter Adapter) *Bot { return &Bot{ adapter, map[*regexp.Regexp]func(msg *Message){}, } } func (b *Bot) Handle(expr string, handler func(msg *Message)) { b.Handlers[regexp.MustComp...
Make handlers expr case insensitive
Make handlers expr case insensitive
Go
mit
esoui/lexicon,esoui/lexicon
1c95eda2492672fa54f0d80f3816d815c5782d78
client_test.go
client_test.go
package torrent import ( "os" "bitbucket.org/anacrolix/go.torrent/testutil" "testing" ) func TestAddTorrentNoSupportedTrackerSchemes(t *testing.T) { t.SkipNow() } func TestAddTorrentNoUsableURLs(t *testing.T) { t.SkipNow() } func TestAddPeersToUnknownTorrent(t *testing.T) { t.SkipNow() } func TestPieceHash...
package torrent import ( "os" "bitbucket.org/anacrolix/go.torrent/testutil" "testing" ) func TestAddTorrentNoSupportedTrackerSchemes(t *testing.T) { t.SkipNow() } func TestAddTorrentNoUsableURLs(t *testing.T) { t.SkipNow() } func TestAddPeersToUnknownTorrent(t *testing.T) { t.SkipNow() } func TestPieceHash...
Test created torrent structure in current directory
Test created torrent structure in current directory
Go
mpl-2.0
anacrolix/torrent,oldfaust/torrent,bluepeppers/torrent,dborzov/torrent,therewillbecode/torrent,anacrolix/torrent
e9082ab817309f126a3bd623e2f1d43f0ddeea8b
commands/random.go
commands/random.go
package commands import ( "fmt" "github.com/spf13/cobra" ) var minCommits, maxCommits int var randomCmd = &cobra.Command{ Use: "random", Short: "Random will add commits throughout the past 365 days.", Long: `Random will create a git repo at the given location and create random commits, random meaning the numb...
package commands import ( "fmt" "github.com/spf13/cobra" ) var minCommits, maxCommits int var randomCmd = &cobra.Command{ Use: "random", Short: "Random will add commits throughout the past 365 days.", Long: `Random will create a git repo at the given location and create random commits, random meaning the numb...
Add TODO for actual functionality.
Add TODO for actual functionality.
Go
mit
0xfoo/punchcard
ecf3a6281a81ca8eb790bb77515627e0431ec095
doc.go
doc.go
// Copyright 2014 Vic Demuzere // // Use of this source code is governed by the MIT license. // Package irc allows your application to speak the IRC protocol. // // The Message and Prefix structs provide translation to and from raw IRC messages: // // // Parse the IRC-encoded data and store the result in a new stru...
// Copyright 2014 Vic Demuzere // // Use of this source code is governed by the MIT license. // Package irc allows your application to speak the IRC protocol. // // The Message and Prefix structs provide translation to and from raw IRC messages: // // // Parse the IRC-encoded data and store the result in a new stru...
Add Go 1.4 import comment
Add Go 1.4 import comment
Go
mit
sorcix/irc,belak/sorcix-irc,Kimau/irc,MorpheusXAUT/irc
fcc1481079908c44a58fa670e7eede6b7ed6ffba
lambda/lambda.go
lambda/lambda.go
package main import ( "fmt" "io/ioutil" "net/http" "os" "time" ) func main() { for _, arg := range os.Args[1:] { fmt.Println("address was " + arg) fetch(arg) } } func fetch(arg string) { start := time.Now() response, err := http.Get(arg) contents, err := ioutil.ReadAll(response.Body) if err != nil { ...
package main import ( "fmt" "io/ioutil" "net/http" "os" "time" ) func main() { for _, arg := range os.Args[1:] { fmt.Println("address was " + arg) fetch(arg) } } func fetch(arg string) { start := time.Now() response, err := http.Get(arg) if err != nil { fmt.Printf("ERROR %s\n", err) return } cont...
Fix segfault on invalid address
Fix segfault on invalid address
Go
mit
cwaltken-edrans/goad,betabrand/goad,goadapp/goad,cwaltken-edrans/goad,cwaltken-edrans/goad,zeph/goad,betabrand/goad,goadapp/goad,zeph/goad,goadapp/goad,zeph/goad
4781b2c2ffbb021f7a1b7311c23dfe4d76320f00
fk.go
fk.go
package read // Fk scores the Flesch-Kincaid Grade Level. // See https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests. func Fk(text string) float64 { sylCnt := float64(CntSyls(text)) wordCnt := float64(CntWords(text)) sentCnt := float64(CntSents(text)) return 0.39*(wordCnt/sentCnt) + 11.8*(sylCnt...
package read import ( "github.com/mtso/syllables" ) // Fk scores the Flesch-Kincaid Grade Level. // See https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests. func Fk(text string) float64 { syllableCount := float64(syllables.In(text)) wordCnt := float64(CntWords(text)) sentCnt := float64(CntSents...
Add better syllable counter to flesch kincaid func
Add better syllable counter to flesch kincaid func
Go
mit
BluntSporks/readability
ef5dbe3c47a240ea1c07331e206e3bab43a9074d
server/clock/clock.go
server/clock/clock.go
package clock import "time" type Clock interface { NewTicker(time.Duration) Ticker Now() time.Time } func New() Clock { return clock{} } type clock struct{} func (c clock) NewTicker(d time.Duration) Ticker { return &ticker{ ticker: time.NewTicker(d), } } func (c clock) Now() time.Time { return time.Now() ...
package clock import "time" type Clock interface { NewTicker(time.Duration) Ticker Now() time.Time } func New() Clock { return clock{} } type clock struct{} func (c clock) NewTicker(d time.Duration) Ticker { return &ticker{ ticker: time.NewTicker(d), } } func (c clock) Now() time.Time { return time.Now() ...
Fix compile error in Go 1.14 due to time.Ticker.Reset
Fix compile error in Go 1.14 due to time.Ticker.Reset
Go
mit
jeremija/peer-calls,jeremija/peer-calls,jeremija/peer-calls
80b71c1d4e233f7ea3055399f63169f447038ebf
id_test.go
id_test.go
package gorand import ( "testing" ) func TestID(t *testing.T) { id, err := ID() if err != nil { t.Error(err.Error()) } if len(id) != 128 { t.Error("Length of UUID isn't 128") } } func TestUUID(t *testing.T) { uuid, err := UUID() if err != nil { t.Error(err.Error()) } if len(uuid) != 36 { t.Error(...
package gorand import ( "testing" ) func TestID(t *testing.T) { id, err := ID() if err != nil { t.Error(err.Error()) } if len(id) != 128 { t.Error("Length of UUID isn't 128") } } func TestUUID(t *testing.T) { uuid, err := UUID() if err != nil { t.Error(err.Error()) } if len(uuid) != 36 { t.Error(...
Fix error reporting on test.
Fix error reporting on test.
Go
mit
leonelquinteros/gorand
60541d1b4958ba69a913b4d0d548bc25b4aa74f4
pkg/tunnelserver/chain.go
pkg/tunnelserver/chain.go
package tunnelserver import ( "net/http" "github.com/rancher/remotedialer" "github.com/sirupsen/logrus" ) type Authorizers struct { chain []remotedialer.Authorizer } func ErrorWriter(rw http.ResponseWriter, req *http.Request, code int, err error) { logrus.Errorf("Failed to handling tunnel request from %s: resp...
package tunnelserver import ( "fmt" "net/http" "github.com/rancher/remotedialer" "github.com/sirupsen/logrus" ) type Authorizers struct { chain []remotedialer.Authorizer } func ErrorWriter(rw http.ResponseWriter, req *http.Request, code int, err error) { fullAddress := req.RemoteAddr forwardedFor := req.Head...
Add more logging on failed tunnel requests
Add more logging on failed tunnel requests
Go
apache-2.0
rancher/rancher,rancher/rancher,rancher/rancher,rancher/rancher
e378de4981112c0d7b42aafcaaa65a316f2874e6
cliedit/completion_test.go
cliedit/completion_test.go
package cliedit import ( "testing" "github.com/elves/elvish/cli/el/codearea" "github.com/elves/elvish/edit/ui" "github.com/elves/elvish/eval" "github.com/elves/elvish/styled" "github.com/elves/elvish/util" ) func TestCompletion(t *testing.T) { _, cleanupDir := eval.InTempHome() util.ApplyDir(util.Dir{"a": ""...
package cliedit import ( "testing" "github.com/elves/elvish/cli/el/codearea" "github.com/elves/elvish/edit/ui" "github.com/elves/elvish/eval" "github.com/elves/elvish/styled" "github.com/elves/elvish/util" ) func TestCompletion(t *testing.T) { _, cleanupDir := eval.InTempHome() util.ApplyDir(util.Dir{"a": ""...
Fix the completion test case.
cliedit: Fix the completion test case.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
47e846e4b02fb137d8d237113c010206b729d210
objectserver/rpcd/addObjects.go
objectserver/rpcd/addObjects.go
package rpcd import ( "encoding/gob" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/objectserver" "io" "runtime" ) func (t *srpcType) AddObjects(conn *srpc.Conn) { defer runtime.GC() // An opportune time to take out the garbage. defer conn.Flush() decoder := gob.NewDecoder(conn)...
package rpcd import ( "encoding/gob" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/objectserver" "io" "runtime" ) func (t *srpcType) AddObjects(conn *srpc.Conn) { defer runtime.GC() // An opportune time to take out the garbage. defer conn.Flush() decoder := gob.NewDecoder(conn)...
Fix bug in AddObjects() RPC: new objects were not being counted.
Fix bug in AddObjects() RPC: new objects were not being counted.
Go
apache-2.0
Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator
5ce684ac44ad60a1880afe6e058daa7d9ffcf46e
testutils/run.go
testutils/run.go
package testutils import ( "fmt" "os/exec" "time" "github.com/onsi/ginkgo" "github.com/onsi/gomega/gexec" ) func BuildExecutable() error { return BuildExecutableForArch("") } func BuildExecutableForArch(arch string) error { buildArg := "./../bin/build" if arch != "" { buildArg = buildArg + "-" + arch } ...
package testutils import ( "fmt" "os/exec" "time" "github.com/onsi/ginkgo" "github.com/onsi/gomega/gexec" ) func BuildExecutable() error { return BuildExecutableForArch("") } func BuildExecutableForArch(arch string) error { buildArg := "./../bin/build" if arch != "" { buildArg = buildArg + "-" + arch } ...
Increase wait time for bosh-micro build
Increase wait time for bosh-micro build Times out on gocd Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
Go
apache-2.0
allomov/bosh-init,forrestsill/bosh-init,forrestsill/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init,forrestsill/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init
0882169cff2bc982773234e7f85c774a8cb015df
engine/php5.go
engine/php5.go
// +build !php7 package engine // #cgo CFLAGS: -Iinclude/php5 // #cgo LDFLAGS: -lphp5 import "C"
// +build !php7 package engine // #cgo CFLAGS: -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM // #cgo CFLAGS: -I/usr/include/Zend -Iinclude/php5 // #cgo LDFLAGS: -lphp5 import "C"
Add necessary include directives for PHP 5 path
Add necessary include directives for PHP 5 path Certain distributions, such as Debian, ship include files for version 5 of PHP in the `/usr/include/php5` directory. This commit adds directives necessary for building go-php against packages provided by such distros.
Go
mit
deuill/go-php,taowen/go-php7,deuill/go-php,deuill/go-php,taowen/go-php7
0a1aa59798140d55345c4c4484cc1962d418da62
errors_test.go
errors_test.go
package gocql import ( "testing" ) func TestErrorsParse(t *testing.T) { session := createSession(t) defer session.Close() if err := session.Query(`CREATE TABLE errors_parse (id int primary key)`).Exec(); err != nil { t.Fatal("create:", err) } if err := session.Query(`CREATE TABLE errors_parse (id int primar...
package gocql import ( "testing" ) func TestErrorsParse(t *testing.T) { session := createSession(t) defer session.Close() if err := createTable(session, `CREATE TABLE errors_parse (id int primary key)`); err != nil { t.Fatal("create:", err) } if err := createTable(session, `CREATE TABLE errors_parse (id int...
Use createTable to create tables, this test is slightly racy with > 1 node
Use createTable to create tables, this test is slightly racy with > 1 node
Go
bsd-3-clause
gus/gocql,vrischmann/gocql,maticz/gocql,brandscreen/gocql,revinate/gocql,tux21b/gocql,hackintoshrao/gocql,relops/gocql,mailgun/gocql,ChannelMeter/gocql,retailnext/gocql,nikandfor/gocql,retailnext/gocql,CrowdSurge/gocql,gus/gocql,matope/gocql,adamweiner/gocql,Zariel/gocql,gocql/gocql,tux21b/gocql,znly/gocql,Zariel/gocql...
4a0e50ddd5da0ad298b0807f3ea0cb5adc4693b5
integration/shared/isolated/set_org_role_command_test.go
integration/shared/isolated/set_org_role_command_test.go
package isolated import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gexec" "code.cloudfoundry.org/cli/integration/helpers" ) var _ = Describe("set-org-role command", func() { When("the org and user both exist", func() { var ( username...
package isolated import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gexec" "code.cloudfoundry.org/cli/integration/helpers" ) var _ = Describe("set-org-role command", func() { When("the org and user both exist", func() { var ( username...
Test that set-org-role is idempotent
Test that set-org-role is idempotent [Finishes #164089698] Signed-off-by: Tom Viehman <ef9e7682e71c138189ac51545830b782ff2b8b7d@pivotal.io>
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
2b05c7d85861e846b106e631b0dee3e614e888cb
killbrowser.go
killbrowser.go
package main import ( "log" "net/http" "github.com/gin-gonic/gin" ) func killBrowserHandler(c *gin.Context) { var data struct { Action string `json:"action"` Process string `json:"process"` URL string `json:"url"` } c.BindJSON(&data) command, err := findBrowser(data.Process) log.Println(comman...
package main import ( "log" "net/http" "github.com/gin-gonic/gin" ) func killBrowserHandler(c *gin.Context) { var data struct { Action string `json:"action"` Process string `json:"process"` URL string `json:"url"` } c.BindJSON(&data) command, err := findBrowser(data.Process) log.Println(comman...
Test without killing to see what's going wrong on windows
Test without killing to see what's going wrong on windows
Go
agpl-3.0
arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent
ac28e919d444f4a9caed968d4f0fab03bee49e44
logfile.go
logfile.go
package main import ( "bufio" "io" "log" "time" "github.com/logplex/logplexc" ) func lineWorker(die dieCh, r *bufio.Reader, cfg logplexc.Config, sr *serveRecord) { cfg.Logplex = sr.u target, err := logplexc.NewClient(&cfg) if err != nil { log.Fatalf("could not create logging client: %v", err) } for { ...
package main import ( "bufio" "io" "log" "regexp" "time" "github.com/logplex/logplexc" ) var prefix = regexp.MustCompile(`^(\[\d*\] [^-*#]+|.*)`) func lineWorker(die dieCh, r *bufio.Reader, cfg logplexc.Config, sr *serveRecord) { cfg.Logplex = sr.u target, err := logplexc.NewClient(&cfg) if err != nil { ...
Remove prefix and use name as procId.
Remove prefix and use name as procId.
Go
bsd-2-clause
heroku/pg_logplexcollector
657a9e6d12e5375a8ecf61b13cf884852d6b68fe
src/cred-alert/cmd/binaries_test.go
src/cred-alert/cmd/binaries_test.go
package main_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" "testing" ) func TestBinaries(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Binaries Suite") } var _ = AfterSuite(func() { gexec.CleanupBuildArtifacts() }) var _ = Describe("Binaries", fu...
package main_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" "testing" ) func TestBinaries(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Binaries Suite") } var _ = AfterSuite(func() { gexec.CleanupBuildArtifacts() }) var _ = Describe("Binaries", fu...
Add missing cred-alert-worker-ng build test
Add missing cred-alert-worker-ng build test Signed-off-by: Kalai Wei <920bf42fdcab8ffc364d94066818a17cd391003a@pivotal.io>
Go
apache-2.0
pivotal-cf/cred-alert,pivotal-cf/cred-alert
b65c58d2e3d2e69fe3ff88524823e6d4f486fa5c
cmd/server/main.go
cmd/server/main.go
package main import ( "github.com/itsankoff/gotcha/server" "time" "log" ) func main() { s := server.New() wss := server.NewWebSocket() s.AddTransport("127.0.0.1:9000", &wss) done := make(chan interface{}) go func() { log.Println("Will close done channel") time.Sleep(10 ...
package main import ( "github.com/itsankoff/gotcha/server" "log" ) func main() { s := server.New() wss := server.NewWebSocket() s.AddTransport("127.0.0.1:9000", &wss) done := make(chan interface{}) err := s.Start(done) if err != nil { log.Fatal("Failed to start server") } ...
Remove test code from cmd server code
Remove test code from cmd server code
Go
mit
itsankoff/gotcha,itsankoff/gotcha
e45e7692e526bd490c9f35df17cd6a9846140081
keymasterd/eventnotifier/api.go
keymasterd/eventnotifier/api.go
package eventnotifier import ( "net/http" "sync" "github.com/Symantec/Dominator/lib/log" "github.com/Symantec/keymaster/proto/eventmon" ) type EventNotifier struct { logger log.DebugLogger mutex sync.Mutex // Protected by lock. transmitChannels map[chan<- eventmon.EventV0]chan<- eventmon.EventV0 } func New...
package eventnotifier import ( "net/http" "sync" "github.com/Symantec/Dominator/lib/log" "github.com/Symantec/keymaster/proto/eventmon" ) type EventNotifier struct { logger log.DebugLogger mutex sync.Mutex // Protected by lock. transmitChannels map[chan<- eventmon.EventV0]chan<- eventmon.EventV0 } func New...
Add username to PublishServiceProviderLoginEvent() arguments.
Add username to PublishServiceProviderLoginEvent() arguments.
Go
apache-2.0
rgooch/keymaster,Symantec/keymaster,Symantec/keymaster,rgooch/keymaster,Symantec/keymaster,rgooch/keymaster
798ab6b05fa3df3c1786d582e876f3e3af837d2e
lib/technical-analysis/types.go
lib/technical-analysis/types.go
package analyze type ValidMicro struct { Micro int64 Valid bool } type ValidFloat struct { Value float64 Valid bool }
package analyze import "encoding/json" type ValidMicro struct { Micro int64 Valid bool } func (vm ValidMicro) MarshalJson() ([]byte, error) { if vm.Valid { return json.Marshal(MicrosToDollars(vm.Micro)) } return json.Marshal(nil) } type ValidFloat struct { Value float64 Valid bool } func (vf ValidFloat) M...
Add custom json marshalling for indicators
feat: Add custom json marshalling for indicators
Go
mit
t73liu/crypto-trading,t73liu/crypto-trading
3d78e31d70e89f16af82e0a0b82f802bbcb59f9a
3_5.go
3_5.go
package h2spec import ( "fmt" "io" "net" "syscall" "time" ) func Http2ConnectionPrefaceTestGroup(ctx *Context) *TestGroup { tg := NewTestGroup("3.5", "HTTP/2 Connection Preface") tg.AddTestCase(NewTestCase( "Sends invalid connection preface", "The endpoint MUST terminate the TCP connection.", func(ctx *...
package h2spec import ( "fmt" "io" "net" "syscall" "time" ) func Http2ConnectionPrefaceTestGroup(ctx *Context) *TestGroup { tg := NewTestGroup("3.5", "HTTP/2 Connection Preface") tg.AddTestCase(NewTestCase( "Sends invalid connection preface", "The endpoint MUST terminate the TCP connection.", func(ctx *...
Fix invalid connection preface as is able to process as HTTP request
Fix invalid connection preface as is able to process as HTTP request
Go
mit
shane-kearns/h2spec,summerwind/h2spec,rmoorman/h2spec
5d1982aba581815d58dcc29c288d5cd553b49c36
cgo.go
cgo.go
// Copyright © 2015-2020 Hilko Bengen <bengen@hilluzination.de> // All rights reserved. // // Use of this source code is governed by the license that can be // found in the LICENSE file. package yara // #cgo !yara_no_pkg_config,!yara_static pkg-config: yara // #cgo !yara_no_pkg_config,yara_static pkg-config: --sta...
// Copyright © 2015-2020 Hilko Bengen <bengen@hilluzination.de> // All rights reserved. // // Use of this source code is governed by the license that can be // found in the LICENSE file. package yara // #cgo !yara_no_pkg_config,!yara_static pkg-config: yara // #cgo !yara_no_pkg_config,yara_static pkg-config: --sta...
Remove -lcrypto from LDFLAGS when yara_no_pkg_config is set.
Remove -lcrypto from LDFLAGS when yara_no_pkg_config is set. Close #108
Go
bsd-2-clause
hillu/go-yara,hillu/go-yara
919f6892f2f7c1323e4cbb6696444d471b1d0247
routes/helpers.go
routes/helpers.go
package routes import ( "errors" "fmt" "strings" ) // Converts patterns like "/users/:id" to "/users/(?P<id>\d+)" func convertSimplePatternToRegexp(pattern string) string { parts := strings.Split(pattern, "/") for i, part := range parts { if len(part) != 0 && part[0] == ':' { parts[i] = fmt.Sprintf(`(?P<%s>...
package routes import ( "errors" "fmt" "strings" ) // Converts patterns like "/users/:id" to "/users/(?P<id>\d+)" func convertSimplePatternToRegexp(pattern string) string { parts := strings.Split(pattern, "/") for i, part := range parts { if len(part) != 0 && part[0] == ':' { parts[i] = fmt.Sprintf(`(?P<%s>...
Make hex object id possible in path params.
Make hex object id possible in path params.
Go
mit
DVI-GI-2017/Jira__backend
547cc7f7248672c3cbb77b890a51858f33acc2ff
environs/configstore/mem_test.go
environs/configstore/mem_test.go
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package configstore_test import ( gc "launchpad.net/gocheck" "launchpad.net/juju-core/environs/configstore" ) var _ = gc.Suite(&memInterfaceSuite{}) type memInterfaceSuite struct { interfaceSuite } func (s *memInterfac...
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package configstore_test import ( gc "launchpad.net/gocheck" "launchpad.net/juju-core/environs/configstore" ) var _ = gc.Suite(&memInterfaceSuite{}) type memInterfaceSuite struct { interfaceSuite } func (s *memInterfac...
Create memInfo from memStore in test
Create memInfo from memStore in test
Go
agpl-3.0
dimitern/juju,cherylj/juju,tsakas/juju,mikemccracken/juju,mikemccracken/juju,perrito666/juju,anastasiamac/juju,sinzui/juju,tsakas/juju,howbazaar/juju,mikemccracken/juju,frankban/juju-tmp,frankban/juju,AdamIsrael/juju,marcoceppi/juju,frobware/juju,davecheney/juju,perrito666/juju,davecheney/juju,mattyw/juju,alesstimec/ju...
f652bf726b2fde487912f21f821a7d3b3a5d8be7
forge.go
forge.go
package forge import ( "github.com/sclevine/forge/engine" ) type Loader interface { Loading(message string, progress <-chan engine.Progress) error } type Colorizer func(string, ...interface{}) string type AppConfig struct { Name string `yaml:"name"` Buildpack string `yaml:"buildpack...
package forge import ( "github.com/sclevine/forge/engine" ) type Loader interface { Loading(message string, progress <-chan engine.Progress) error } type Colorizer func(string, ...interface{}) string type AppConfig struct { Name string `yaml:"name"` Buildpack string `yaml:"buildpack...
Remove unused image mock generator
Remove unused image mock generator
Go
apache-2.0
sclevine/forge,sclevine/forge
729b63e5ec145441b226333ddd050da1a3cf0b44
hosted_zones.go
hosted_zones.go
package aws // This list is copied from // http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints // It currently cannot be generated from the API json. var hostedZoneIDsMap = map[string]string{ "us-east-1": "Z3AQBSTGFYJSTF", "us-west-2": "Z3BJ6K6RIION7M", "us-west-1": "Z...
package aws // This list is copied from // http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints // It currently cannot be generated from the API json. var hostedZoneIDsMap = map[string]string{ "us-east-1": "Z3AQBSTGFYJSTF", "us-west-2": "Z3BJ6K6RIION7M", "us-west-1": "Z...
Update Hosted Zones to fix issue with eu-central
providers/aws: Update Hosted Zones to fix issue with eu-central
Go
mpl-2.0
kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,ashinohara/terraform-provider-aws,terraform-providers/terraform-provider-aws,charles-at-geospock/terraform-provider-aws,ClementCunin/terraform-provider-aws,terraform-providers/terraform-provider-aws,Ninir/terraform-provider-aws,ashinohara/terraform-provider-aw...
60ef124bfbda07b61f52431decdba3289141aee6
app.go
app.go
package gogist import ( "fmt" "net/http" "github.com/gorilla/mux" ) const t = ` <html> <head> <meta name="go-import" content="%s git https://gist.github.com/%s.git" /> <script>window.location='https://github.com/ImJasonH/go-gist/';</script> </head> </html> ` func init() { r := mux.NewRouter() h := ...
package gogist import ( "fmt" "net/http" "github.com/gorilla/mux" ) const t = ` <html> <head> <meta name="go-import" content="%s git https://gist.github.com/%s.git" /> <script>window.location='https://github.com/ImJasonH/go-gist/';</script> </head> </html> ` func init() { r := mux.NewRouter() h := ...
Support user-defined convenience package names
Support user-defined convenience package names
Go
apache-2.0
ImJasonH/go-gist
9c4cd6ff1a565c3e294b0a72f68bd7d3c312715b
sort/isort_test.go
sort/isort_test.go
package algoholic import "testing" func TestInsertionSortSortsReversedInts(t *testing.T) { correctlySortsReversedInts(t, 1e4, func(ns []int) []int { InsertionSort(ns) return ns }) }
package algoholic import "testing" func TestInsertionSortSortsReversedInts(t *testing.T) { correctlySortsReversedInts(t, 1e4, func(ns []int) []int { // In-place sort. InsertionSort(ns) return ns }) }
Add trivial though meaningful comment.
Add trivial though meaningful comment.
Go
mit
lorenzo-stoakes/algoholic
44f65247623dfde6da09c7ccccc8b7aa8078f129
src/steps/step.go
src/steps/step.go
package steps import ( "fmt" "log" "regexp" "github.com/Originate/git-town/src/git" ) // Step represents a dedicated activity within a Git Town command. // Git Town commands are comprised of a number of steps that need to be executed. type Step interface { CreateAbortStep() Step CreateContinueStep() Step Crea...
package steps import ( "log" "os" "path" "regexp" "github.com/Originate/git-town/src/git" ) // Step represents a dedicated activity within a Git Town command. // Git Town commands are comprised of a number of steps that need to be executed. type Step interface { CreateAbortStep() Step CreateContinueStep() Ste...
Use the proper temp dir
Use the proper temp dir closes #964
Go
mit
Originate/git-town,Originate/git-town,Originate/git-town,Originate/git-town,Originate/git-town