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 |
|---|---|---|---|---|---|---|---|---|---|
aadbde30454166a412835661a7108dbe5c7e3cb5 | order.go | order.go | package bittrex
type Order struct {
OrderUuid string `json:"OrderUuid"`
Exchange string `json:"Exchange"`
TimeStamp string `json:"TimeStamp"`
OrderType string `json:"OrderType"`
Limit float64 `json:"Limit"`
Quantity float64 `json:"Quantity"`
QuantityRema... | package bittrex
type Order struct {
OrderUuid string `json:"OrderUuid"`
Exchange string `json:"Exchange"`
TimeStamp jTime `json:"TimeStamp"`
OrderType string `json:"OrderType"`
Limit float64 `json:"Limit"`
Quantity float64 `json:"Quantity"`
QuantityRema... | Set TimeStamp field to jTime type. Run go fmt | Set TimeStamp field to jTime type. Run go fmt
| Go | mit | toorop/go-bittrex,jyap808/go-bittrex,yangou/go-bittrex |
ad6e64e4a69ff4516851354792befa874692f3c6 | cmd/client/main.go | cmd/client/main.go | package main
import (
"github.com/itsankoff/gotcha/client"
)
func main() {
c := client.New()
c.Connect("wss://127.0.0.1:9999")
}
| package main
import (
"github.com/itsankoff/gotcha/client"
"github.com/itsankoff/gotcha/common"
"log"
"time"
)
func main() {
input := make(chan *common.Message)
ws := client.NewWebSocketClient()
ws.SetReceiver(input)
c := client.New(ws)
err := c.Connect("ws://127.0.0.1:9000/websocket")
log.Println("connect... | Add simple show case of client usage | Add simple show case of client usage
| Go | mit | itsankoff/gotcha,itsankoff/gotcha |
5d23995d24b60cf3b045b690e55ed38e93d9ae26 | release/factory.go | release/factory.go | package release
import (
"path/filepath"
)
// Factory is responsible for instantiating slices
// of Releases based upon queries given from the API.
type Factory struct {
modulepath string
fileurl string
}
// NewFactory returns a new instance of Factory
// with the given modulepath.
func NewFactory(modulepath s... | package release
import (
"path/filepath"
)
// Factory is responsible for instantiating slices
// of Releases based upon queries given from the API.
type Factory struct {
modulepath string
fileurl string
}
// NewFactory returns a new instance of Factory
// with the given modulepath.
func NewFactory(modulepath s... | Return array instead of nil when no results are found | Return array instead of nil when no results are found
This commit addresses an edge case in which the Puppet agent prints an
unclear error message due to the value of the results key being set to
nil.
| Go | apache-2.0 | jolshevski/chester |
96afb454f71d4948bacc37bdca46190f28f0b891 | updater.go | updater.go | package main
import (
"fmt"
"io/ioutil"
"github.com/jeffail/gabs"
"github.com/mitchellh/packer/packer"
)
func UpdateJsonFile(file string, paths []string, value string, ui packer.Ui) error {
content, err := ioutil.ReadFile(file)
if err != nil {
return err
}
json, err := gabs.ParseJSON(content)
if err != ... | package main
import (
"fmt"
"io/ioutil"
"github.com/jeffail/gabs"
"github.com/mitchellh/packer/packer"
)
func UpdateJsonFile(file string, paths []string, newValue string, ui packer.Ui) error {
content, err := ioutil.ReadFile(file)
if err != nil {
return err
}
json, err := gabs.ParseJSON(content)
if err ... | Fix value to update to. Improve log message with old and new values. | Fix value to update to. Improve log message with old and new values.
| Go | bsd-3-clause | cliffano/packer-post-processor-json-updater |
8fb49dc9153c4593b739a5950ae2bc8cbddc758f | v1/v1.go | v1/v1.go | package v1
import (
"github.com/codegangsta/martini"
"github.com/coopernurse/gorp"
"github.com/hackedu/backend/v1/model"
"github.com/hackedu/backend/v1/route"
"github.com/martini-contrib/binding"
)
func Setup(m *martini.ClassicMartini) {
// TODO: Only apply middleware on /v1/** routes
m.Use(allowCORS)
m.MapTo... | package v1
import (
"net/http"
"time"
"github.com/codegangsta/martini"
"github.com/coopernurse/gorp"
"github.com/hackedu/backend/v1/model"
"github.com/hackedu/backend/v1/route"
"github.com/martini-contrib/binding"
"github.com/zachlatta/cors"
)
func Setup(m *martini.ClassicMartini) {
// TODO: Only apply midd... | Use Martini CORS service instead of our own. | Use Martini CORS service instead of our own.
| Go | mit | hackedu/website,hackedu/website,hackedu/website,zachlatta/website,zachlatta/website,zachlatta/website |
91f4cbc6e40d53b349eb58161771e8edbc23c2a1 | config/node_var.go | config/node_var.go | // Copyright (c) 2013 Kelsey Hightower. All rights reserved.
// Use of this source code is governed by the Apache License, Version 2.0
// that can be found in the LICENSE file.
package config
import (
"fmt"
)
// Nodes is a custom flag Var representing a list of etcd nodes.
type Nodes []string
// String returns the ... | // Copyright (c) 2013 Kelsey Hightower. All rights reserved.
// Use of this source code is governed by the Apache License, Version 2.0
// that can be found in the LICENSE file.
package config
import (
"fmt"
)
// Nodes is a custom flag Var representing a list of etcd nodes.
type Nodes []string
// String returns the ... | Fix %d should be %s according to govet | Fix %d should be %s according to govet
| Go | mit | Fitbit/confd,gautamk/confd,okushchenko/confd,kgrvamsi/confd,bacongobbler/confd,blippar/confd,mboersma/confd,Fitbit/confd,shencan/confd,nevermosby/confd,beni55/confd,RichardKnop/confd,layerhq/confd,axingblog/confd,jnummelin/confd,agilemobiledev/confd,axingblog/confd,zytek/confd,openedbox/confd,Flipkart/confd,jnummelin/c... |
6b484f8ba0ae4d4bb63492bdd11e712136cdb667 | main.go | main.go | package main
import (
"fmt"
"io"
"log"
"os"
"os/exec"
)
func main() {
SetTmuxStatusColor("yellow")
args := os.Args[1:]
if len(args) == 0 {
log.Fatalln("Not enough arguments")
}
cmd := exec.Command(args[0], args[1:]...)
stdout, err := cmd.StdoutPipe()
if err != nil {
log.Fatalln(err)
}
stderr, er... | package main
import (
"fmt"
"io"
"log"
"os"
"os/exec"
)
func main() {
SetTmuxStatusColor("yellow")
args := os.Args[1:]
if len(args) == 0 {
log.Fatalln("Not enough arguments")
}
cmd := exec.Command(args[0], args[1:]...)
stdout, err := cmd.StdoutPipe()
ExitIfErr(err)
stderr, err := cmd.StderrPipe()
... | Add better error interface and remove excess lines | ALH: Add better error interface and remove excess lines
| Go | mit | andy4thehuynh/traffic |
31d32580b8bfe64e639b08693d74532e775b3858 | daemon/registry/keyring_member.go | daemon/registry/keyring_member.go | package registry
import (
"log"
"github.com/arigatomachine/cli/daemon/envelope"
)
// KeyringMemberClient represents the `/keyring-members` registry end point for
// accessand creating memberships related to a set of Keyrings.
type KeyringMemberClient struct {
client *Client
}
// Post sends a creation requests fo... | package registry
import (
"log"
"github.com/arigatomachine/cli/daemon/envelope"
)
// KeyringMemberClient represents the `/keyring-members` registry end point for
// accessand creating memberships related to a set of Keyrings.
type KeyringMemberClient struct {
client *Client
}
// Post sends a creation requests fo... | Fix unmarshal of keyring members response | Fix unmarshal of keyring members response
| Go | bsd-3-clause | manifoldco/torus-cli,manifoldco/torus-cli,luizbranco/torus-cli,luizbranco/torus-cli,manifoldco/torus-cli,luizbranco/torus-cli |
66e0d54c023596c02e0a6e01a3a46d6e9ffcd295 | x/dclauth/types/constants.go | x/dclauth/types/constants.go | // Copyright 2020 DSR Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | // Copyright 2020 DSR Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | Add a new constant which includes vendor account approvals percent | Add a new constant which includes vendor account approvals percent
| Go | apache-2.0 | zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger |
3bb0dd0322d84fdca6405192216718b61a3cc439 | src/lib/vm/dictionary.go | src/lib/vm/dictionary.go | package vm
import "github.com/mediocregopher/seq"
type Dictionary struct{ hashMap *seq.HashMap }
func NewDictionary(ks []Object, vs []*Thunk) *Thunk {
if len(ks) == len(vs) {
return NewError("Number of keys doesn't match with number of values.")
}
d := Dictionary{seq.NewHashMap()}
for i, k := range ks {
d.... | package vm
import "github.com/mediocregopher/seq"
type Dictionary struct{ hashMap *seq.HashMap }
func NewDictionary(ks []Object, vs []*Thunk) *Thunk {
if len(ks) == len(vs) {
return NewError("Number of keys doesn't match with number of values.")
}
d := Dictionary{seq.NewHashMap()}
for i, k := range ks {
d.... | Remove type check in Dictionary.Equal() | Remove type check in Dictionary.Equal()
| Go | mit | raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp |
7b1e8908a28c702fbcac8531b98fcbd5c956e5bc | dos/netest/main.go | dos/netest/main.go | package main
import (
"fmt"
"github.com/zetamatta/nyagos/dos"
)
func main() {
indent := 1
var callback func(*dos.NetResource) bool
callback = func(node *dos.NetResource) bool {
fmt.Printf("%*s%s\n", indent*2, "", node.RemoteName())
indent++
node.Enum(callback)
indent--
return true
}
err := dos.WNetE... | package main
import (
"fmt"
"time"
"github.com/zetamatta/nyagos/dos"
)
func main() {
indent := 1
var callback func(*dos.NetResource) bool
callback = func(node *dos.NetResource) bool {
name := node.RemoteName()
now := time.Now()
fmt.Printf("%02d:%02d:%02d %*s%s\n",
now.Hour(),
now.Minute(),
now.... | Add benchmark code on dos/netest | Add benchmark code on dos/netest
| Go | bsd-3-clause | nocd5/nyagos,tsuyoshicho/nyagos,zetamatta/nyagos |
622f62c62b102a7e2a71688d9163b90fcd55326c | control_unix.go | control_unix.go | // +build !windows
package reuseport
import (
"syscall"
"golang.org/x/sys/unix"
)
func Control(network, address string, c syscall.RawConn) error {
var err error
c.Control(func(fd uintptr) {
err = syscall.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
if err != nil {
return
}
err = uni... | // +build !windows
package reuseport
import (
"syscall"
"golang.org/x/sys/unix"
)
func Control(network, address string, c syscall.RawConn) error {
var err error
c.Control(func(fd uintptr) {
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
if err != nil {
return
}
err = unix.S... | Use more constants from unix package | Use more constants from unix package
A Linux configuration I have is a lot fussier.
| Go | isc | libp2p/go-reuseport,jbenet/go-reuseport |
de3df45c55a6f7ff4dd620310a3a3afd45b90604 | subvert_test.go | subvert_test.go | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`(abc)`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTests {
expect := test.dst
actual, err :... | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`(abc)`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
{"a\\,b", regexp.MustCompile(`(a,b)`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTe... | Add case of escape branch for newMatcher | Add case of escape branch for newMatcher
| Go | mit | kusabashira/msub |
6a233b9dafc81205ba22a851ab1c2d62aba9dcba | errors.go | errors.go | package rmq
import (
"errors"
"fmt"
)
var (
ErrorNotFound = errors.New("entity not found") // entitify being connection/queue/delivery
ErrorAlreadyConsuming = errors.New("must not call StartConsuming() multiple times")
ErrorNotConsuming = errors.New("must call StartConsuming() before adding consumers... | package rmq
import (
"errors"
"fmt"
)
var (
ErrorNotFound = errors.New("entity not found") // entitify being connection/queue/delivery
ErrorAlreadyConsuming = errors.New("must not call StartConsuming() multiple times")
ErrorNotConsuming = errors.New("must call StartConsuming() before adding consumers... | Add Unwrap() methods to error types | Add Unwrap() methods to error types
To support errors.Is() and errors.As()
| Go | mit | adjust/rmq |
b2e4eb0673de9fab36c5e9e472e1079878426d1f | google/cai.go | google/cai.go | package google
// Asset is the CAI representation of a resource.
type Asset struct {
// The name, in a peculiar format: `\\<api>.googleapis.com/<self_link>`
Name string
// The type name in `google.<api>.<resourcename>` format.
Type string
Resource *AssetResource
IAMPolicy *IAMPolicy
}
// AssetResource is ... | package google
// Asset is the CAI representation of a resource.
type Asset struct {
// The name, in a peculiar format: `\\<api>.googleapis.com/<self_link>`
Name string `json:"name"`
// The type name in `google.<api>.<resourcename>` format.
Type string `json:"asset_type"`
Resource *AssetResource `js... | Add json tags to CAI asset. | [terraform-conversions] Add json tags to CAI asset.
Signed-off-by: Modular Magician <86ce7da8ad74b1c583667a2bebd347455fa06219@google.com>
| Go | apache-2.0 | GoogleCloudPlatform/terraform-google-conversion |
2522faee8cdaf4fc007f58ebd5e1b1978fbfea2f | examples/bucket.go | examples/bucket.go | package examples
import (
"fmt"
"github.com/ewilde/go-runscope"
"log"
)
var accessToken = "{your token}" // See https://www.runscope.com/applications
var teamUUID = "{your team uuid}" // See https://www.runscope.com/teams
var client = runscope.NewClient(runscope.APIURL, accessToken)
func createBucket() *runscope... | package examples
import (
"fmt"
"github.com/ewilde/go-runscope"
)
var accessToken = "{your token}" // See https://www.runscope.com/applications
var teamUUID = "{your team uuid}" // See https://www.runscope.com/teams
var client = runscope.NewClient(runscope.APIURL, accessToken)
func createBucket() *runscope.Bucket... | Fix example code compilation error | Fix example code compilation error
Signed-off-by: Edward Wilde <0bbf1c8dffb4cb8ad44cb8eb16480f0eb8bfec44@gmail.com>
| Go | mpl-2.0 | ewilde/go-runscope,ewilde/go-runscope |
0d4b18cea86547c4bc45751487ac921582c19efe | webcontact_test.go | webcontact_test.go | package nlgids
import (
"testing"
"github.com/miekg/nlgids/email"
"github.com/miekg/nlgids/webcontact"
)
func newContact() *webcontact.Contact {
return &webcontact.Contact{
Name: "Miek Gieben",
Email: "miek@miek.nl",
Phone: "07774 517 566",
Message: "Hee, hoe is het daar?",
}
}
func TestContactC... | package nlgids
import (
"testing"
"github.com/miekg/nlgids/email"
"github.com/miekg/nlgids/webcontact"
)
func newContact() *webcontact.Contact {
return &webcontact.Contact{
Name: "Miek Gieben",
Email: "miek@miek.nl",
Phone: "07774 517 566",
Message: "Hee, hoe is het daar?",
}
}
func TestContactC... | Send mail in the test | Send mail in the test
| Go | bsd-3-clause | miekg/nlgids |
c86fd3d5bd376918ba05760a19858b8692ca8d34 | cmd/wcloud/types.go | cmd/wcloud/types.go | package main
import (
"time"
)
// Deployment describes a deployment
type Deployment struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
ImageName string `json:"image_name"`
Version string `json:"version"`
Priority int `json:"priority"`
State string `json:"stat... | package main
import (
"time"
)
// Deployment describes a deployment
type Deployment struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
ImageName string `json:"image_name"`
Version string `json:"version"`
Priority int `json:"priority"`
State string `json:"stat... | Add notification config for wcloud | Add notification config for wcloud
| Go | apache-2.0 | paulbellamy/scope,alban/scope,weaveworks/scope,paulbellamy/scope,weaveworks/scope,paulbellamy/scope,weaveworks/scope,kinvolk/scope,kinvolk/scope,weaveworks/scope,kinvolk/scope,paulbellamy/scope,alban/scope,alban/scope,alban/scope,alban/scope,weaveworks/scope,kinvolk/scope,alban/scope,kinvolk/scope,kinvolk/scope,paulbel... |
cf90ef6151aa2883a9f5ae7b6f414f322f9baacf | cmd/speeldoos/cmd-check.go | cmd/speeldoos/cmd-check.go | package main
import (
"log"
"os"
)
func check_main(args []string) {
allCarr, err := allCarriersWithErrors()
if err != nil {
log.Fatalf("Unable to open library: %s", err)
}
exitStatus := 0
for _, pc := range allCarr {
if pc.Error != nil {
exitStatus = 1
log.Printf("Parse error in %s: %s", pc.Filenam... | package main
import (
"fmt"
"log"
"os"
"path"
"github.com/thijzert/speeldoos"
"github.com/thijzert/speeldoos/lib/zipmap"
)
type checkF func(*speeldoos.Carrier) []error
var allChecks []checkF = []checkF{
check_carrierID,
check_sourceFiles,
}
func check_main(args []string) {
allCarr, err := allCarriersWithE... | Check if every source file exists | Check if every source file exists
| Go | bsd-3-clause | thijzert/speeldoos |
6476d9a733cb89edb380a47f17f94eb5fc50500d | icmd/ops.go | icmd/ops.go | package icmd
// CmdOp is an operation which modified a Cmd structure used to execute commands
type CmdOp func(*Cmd)
| package icmd
import (
"io"
"time"
)
// CmdOp is an operation which modified a Cmd structure used to execute commands
type CmdOp func(*Cmd)
// WithTimeout sets the timeout duration of the command
func WithTimeout(timeout time.Duration) CmdOp {
return func(c *Cmd) {
c.Timeout = timeout
}
}
// WithEnv sets the e... | Add some CmdOps to make `RunCmd` more useful | Add some CmdOps to make `RunCmd` more useful
adding WithTimeout, WithEnv, Dir and WithStdin as I think those are
the most used/required.
Signed-off-by: Vincent Demeester <87e1f221a672a14a323e57bb65eaea19d3ed3804@sbr.pm>
| Go | apache-2.0 | gotestyourself/gotestyourself,gotestyourself/gotestyourself |
7e9605c807b950af279c2bc05dc6ab81750f5083 | handlers.go | handlers.go | package main
import (
"fmt"
"net/http"
"strings"
)
// Returns the client's IP address.
func echoRemoteAddr(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
w.WriteHeader(http.StatusOK)
// RemoteAddr is formatted as host:port, so we just trim off the port her... | package main
import (
"fmt"
"net"
"net/http"
)
// Returns the client's IP address.
func echoRemoteAddr(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
w.WriteHeader(http.StatusOK)
ip, _, _ := net.SplitHostPort(r.RemoteAddr)
fmt.Fprintf(w, "%s\n", ip)
}
//... | Use net.SplitHostPort instead of reimplementing it | Use net.SplitHostPort instead of reimplementing it
| Go | apache-2.0 | dolph/go-skeleton,dolph/go-skeleton |
71e9d0daac52cd46f365a17c2f51df71ec30733c | check/check_suite_test.go | check/check_suite_test.go | package check_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"testing"
)
var fakeBin string
func TestCheck(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "check")
}
var _ = BeforeSuite(func() {
var err error
fakeBin, err = gexec.Build("github.com/s... | package check_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"testing"
)
var fakeBin string
func TestCheck(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "check")
}
var _ = BeforeSuite(func() {
var err error
fakeBin, err = gexec.Build("./fake/comma... | Use relative package path in test | Use relative package path in test
| Go | apache-2.0 | st3v/waitfor |
71aeb6ce8986b30cf79eb0b2cae58fd0ff8a2478 | taskmq.go | taskmq.go | package taskmq
type TaskMQ struct {
config *Config
broker IBroker
}
func New(broker IBroker, config *Config) *TaskMQ {
return &TaskMQ{config: config}
}
func (r *TaskMQ) Connect() error {
return r.broker.Connect()
}
func (r *TaskMQ) Publish(queueName string, body []byte) {
err := r.broker.Push(queueName, body)... | package taskmq
type TaskMQ struct {
config *Config
broker IBroker
}
func New(broker IBroker, config *Config) *TaskMQ {
return &TaskMQ{config: config}
}
func (r *TaskMQ) Connect() error {
return r.broker.Connect()
}
func (r *TaskMQ) Publish(queueName string, body []byte) {
err := r.broker.Push(queueName, body)... | Remove concrete redis broker from base package | Remove concrete redis broker from base package
| Go | bsd-3-clause | task-queue/go-taskmq |
8da107a5245b263d3cd48fc0ff814ee8e1e89761 | Main.go | Main.go | package main
import (
"flag"
"fmt"
"os"
)
func main() {
defer func() {
if r := recover(); r != nil {
fmt.Fprint(os.Stderr, r)
}
}()
var chewing bool
var ctx BenchmarkContext
defer func() {
ctx.deinit()
}()
flag.BoolVar(&chewing, "chewing", true, "Enable libchewing benchmark")
flag.Parse()
if ... | package main
import (
"flag"
"fmt"
"os"
)
func main() {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "%s\n", r)
}
}()
var chewing bool
var ctx BenchmarkContext
defer func() {
ctx.deinit()
}()
flag.BoolVar(&chewing, "chewing", true, "Enable libchewing benchmark")
flag.Pars... | Print newline for error message | Print newline for error message
| Go | mit | zhtw/bopomofo-benchmark,zhtw/bopomofo-benchmark |
c334fba459c0facfb1aa679aed5c5dec02ebdf3d | vault/dynamic_system_view_ext.go | vault/dynamic_system_view_ext.go | // +build vault
package vault
// IsPrimary checks if this is a primary Vault instance.
func (d dynamicSystemView) IsPrimary() bool {
return true
}
| // +build vault,!ent
package vault
// IsPrimary checks if this is a primary Vault instance.
func (d dynamicSystemView) IsPrimary() bool {
return true
}
| Fix up exclusion rules for dynamic system view IsPrimary | Fix up exclusion rules for dynamic system view IsPrimary
| Go | mpl-2.0 | tallpauley/vault,wjam/vault,naunga/vault,mymercurialsky/vault,mgk/vault,lemondrank/vault,rnaveiras/vault,Aloomaio/vault,lirao/vault,MonsantoCo/vault,mymercurialsky/vault,jmhardison/vault,mgk/vault,Caiyeon/vault,jam-pot/vault,quixoten/vault,jmhardison/vault,rnaveiras/vault,lirao/vault,chrishoffman/vault,hashicorp/vault,... |
4adfea6ae976730c6b4e35c9dd606dfd37ce5f03 | src/piece/piece.go | src/piece/piece.go | package piece
import (
"chessboard"
"point"
)
type Piece struct {
movable []point.Point
white byte
black byte
}
func NewPiece(movable []point.Point, white, black byte) *Piece {
piece := new(Piece)
piece.movable = movable
piece.white = white
piece.black = black
return piece
}
func (piece Piece) CanMove... | package piece
import (
"chessboard"
"point"
)
type Piece struct {
movable []point.Point
white byte
black byte
}
func NewPiece(movable []point.Point, white, black byte) *Piece {
piece := new(Piece)
piece.movable = movable
piece.white = white
piece.black = black
return piece
}
func (piece Piece) CanMove... | Change checking movable from <= to == | Change checking movable from <= to ==
| Go | mit | Roadagain/Chess |
8c31ec3b8c7fc0083fdbea1262404e930b048f2f | terraform/utils.go | terraform/utils.go | package terraform
import (
"bufio"
"io"
"github.com/docker/machine/libmachine/log"
)
// Scan STDOUT and STDERR pipes for a process.
//
// Calls the supplied PipeHandler once for each line encountered.
func scanProcessPipes(stdioPipe io.ReadCloser, stderrPipe io.ReadCloser, pipeOutput PipeHandler) {
go scanPipe(s... | package terraform
import (
"bufio"
"io"
"github.com/docker/machine/libmachine/log"
)
// Scan STDOUT and STDERR pipes for a process.
//
// Calls the supplied PipeHandler once for each line encountered.
func scanProcessPipes(stdioPipe io.ReadCloser, stderrPipe io.ReadCloser, pipeOutput PipeHandler) {
go scanPipe(s... | Fix bug when streaming output from Terrafrm (STDERR was not being streamed, but STDOUT was being streamed twice). | Fix bug when streaming output from Terrafrm (STDERR was not being streamed, but STDOUT was being streamed twice).
| Go | mit | tintoy/docker-machine-driver-terraform,tintoy/docker-machine-driver-terraform |
b10939c3654645ec298bb6e2912f8f862307bb9c | monitoring/default_configs.go | monitoring/default_configs.go | package monitoring
func GetDefaultThresholdValues() (plugins []Plugin) {
return []Plugin{
{
Name: "df",
Enable: true,
Configs: []PluginConfig{
{Category: THRESHOLD, Type: CRITICAL, Value: "90"},
{Category: THRESHOLD, Type: WARNING, Value: "80"},
},
},
{
Name: "memory",
Enable: true... | package monitoring
func GetDefaultThresholdValues() (plugins []Plugin) {
return []Plugin{
{
Name: "df",
Enable: true,
Configs: []PluginConfig{
{Category: THRESHOLD, Type: CRITICAL, Value: "90"},
{Category: THRESHOLD, Type: WARNING, Value: "80"},
},
},
{
Name: "memory",
Enable: true... | Change monitoring interval to 10mins | monitoring: Change monitoring interval to 10mins
This patch changes the cluster monitoring interval to
10 mins.
Change-Id: If8d4914e1b30478959bef57616cd9aba1dd8034d
Signed-off-by: anmolbabu <3d38fb1e9c5ff2662fc415254efcdfedb95b84d5@gmail.com>
| Go | apache-2.0 | skyrings/skyring-common,skyrings/skyring-common |
66652fc8e443ad0d81ae50a844ce3c799be2ef0c | cmd/commit.go | cmd/commit.go | package cmd
import (
"fmt"
"github.com/s3git/s3git-go"
"github.com/spf13/cobra"
)
var message string
// commitCmd represents the commit command
var commitCmd = &cobra.Command{
Use: "commit",
Short: "Commit the changes in the repository",
Long: "Commit the changes in the repository",
Run: func(cmd *cobra.Co... | package cmd
import (
"fmt"
"github.com/s3git/s3git-go"
"github.com/spf13/cobra"
)
var message string
// commitCmd represents the commit command
var commitCmd = &cobra.Command{
Use: "commit",
Short: "Commit the changes in the repository",
Long: "Commit the changes in the repository",
Run: func(cmd *cobra.Co... | Put space between master and hash | Put space between master and hash
| Go | apache-2.0 | s3git/s3git |
336e0bd51e788c14868d695e029a703a70b39c5d | watcher.go | watcher.go | package autosignr
import (
log "github.com/Sirupsen/logrus"
"gopkg.in/fsnotify.v1"
)
func WatchDir(conf Config) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
defer watcher.Close()
done := make(chan bool)
go func() {
for {
select {
case event := <-watcher.Events:
if ev... | package autosignr
import (
log "github.com/Sirupsen/logrus"
"gopkg.in/fsnotify.v1"
)
func WatchDir(conf Config) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
defer watcher.Close()
done := make(chan bool)
go func() {
for {
select {
case event := <-watcher.Events:
if ev... | Use Write instead of Create fsnotify event | Use Write instead of Create fsnotify event
I noticed that occasionally the cert file would get created and
autosignr would pick up on it before the cert would get written out.
This would lead to a `No PEM data found in block` error, when in fact
the cert just hadn't been written to the file yet. This change now waits
... | Go | mit | jasonhancock/autosignr |
f6cf282fdcf0af6609047fa373938c3350866c7e | filter_eval_test.go | filter_eval_test.go | package main
import (
"testing"
"github.com/sachaos/todoist/lib"
"github.com/stretchr/testify/assert"
)
func TestEval(t *testing.T) {
r, _ := Eval(Filter("p1"), todoist.Item{Priority: 1})
assert.Equal(t, r, true, "they should be equal")
r, _ = Eval(Filter("p2"), todoist.Item{Priority: 1})
assert.Equal(t, r, f... | package main
import (
"testing"
"github.com/sachaos/todoist/lib"
"github.com/stretchr/testify/assert"
)
func TestEval(t *testing.T) {
r, _ := Eval(Filter("p1"), todoist.Item{Priority: 1})
assert.Equal(t, r, true, "they should be equal")
r, _ = Eval(Filter("p2"), todoist.Item{Priority: 1})
assert.Equal(t, r, f... | Add test of evaluation of BoolInfixOpExpr | :green_heart: Add test of evaluation of BoolInfixOpExpr
| Go | mit | sachaos/todoist,sachaos/todoist |
f2158018f43b9902f307bfe13b06fc8a27be1639 | examples/tpl_docker.go | examples/tpl_docker.go | package main
import "github.com/dynport/urknall"
type Docker struct {
Version string `urknall:"required=true"` // e.g. 1.1.0
CustomInstallDir string
Public bool
}
func (docker *Docker) Render(pkg urknall.Package) {
pkg.AddCommands("packages", InstallPackages("aufs-tools", "cgroup-lite", "xz-ut... | package main
import "github.com/dynport/urknall"
type Docker struct {
Version string `urknall:"required=true"` // e.g. 1.1.0
CustomInstallDir string
Public bool
}
func (docker *Docker) Render(pkg urknall.Package) {
pkg.AddCommands("packages", InstallPackages("aufs-tools", "cgroup-lite", "xz-ut... | Install kernel extensions for aufs | Install kernel extensions for aufs
| Go | apache-2.0 | rajthilakmca/urknall,megamsys/urknall,dynport/urknall |
798a94ae3e36ec9f2f67a3c6b06777efb1ca6743 | rates/rates_test.go | rates/rates_test.go | package rates
import "testing"
func TestFetch(t *testing.T) {
c, _ := Country("NL")
if r, _ := c.Rate("standard"); r != 21 {
t.Errorf("Standard VAT rate for NL is supposed to be 21. Got %.2f", r)
}
if r, _ := c.Rate("reduced"); r != 6 {
t.Errorf("Reduced VAT rate for NL is supposed to be 6. Got %.2f", r)
}... | package rates
import (
"fmt"
"testing"
)
func TestCountryRates_Rate(t *testing.T) {
c, _ := Country("NL")
if r, _ := c.Rate("standard"); r != 21 {
t.Errorf("Standard VAT rate for NL is supposed to be 21. Got %.2f", r)
}
if r, _ := c.Rate("reduced"); r != 6 {
t.Errorf("Reduced VAT rate for NL is supposed t... | Add example for `CountryRates.Rate` func. | Add example for `CountryRates.Rate` func.
| Go | mit | dannyvankooten/govat |
aa803766174db2067a263b3354f7e748de0b0037 | handlers/bootstrap_test.go | handlers/bootstrap_test.go | package handlers
import (
"testing"
"github.com/rancherio/go-rancher/client"
)
func TestBuildContainerConfig(t *testing.T) {
machine := new(client.Machine)
machine.ExternalId = "externalId"
labels := make(map[string]interface{})
labels["abc"] = "def"
labels["foo"] = "bar"
machine.Labels = labels
config :... | package handlers
import (
"testing"
"github.com/rancherio/go-rancher/client"
)
func TestBuildContainerConfig(t *testing.T) {
machine := new(client.Machine)
machine.ExternalId = "externalId"
labels := make(map[string]interface{})
labels["abc"] = "def"
labels["foo"] = "bar"
machine.Labels = labels
config :... | Make test insensitive to param order | Make test insensitive to param order
TestBuildContainerConfig checks for the existence of a certain label,
but it was sensitive to the order of the parameters in the value of the
label. This makes it insensitive to the order
| Go | apache-2.0 | rancher/go-machine-service,cloudnautique/go-machine-service,ibuildthecloud/go-machine-service,rancher/go-machine-service,cloudnautique/go-machine-service,rancherio/go-machine-service,rancherio/go-machine-service,ibuildthecloud/go-machine-service |
09ac39ffd21dabbd44f2d09c62c3142e755552b5 | consumer_test.go | consumer_test.go | package httpie
import (
"testing"
"strings"
"bufio"
"bytes"
)
var delimData = []string{
"Hello",
"World",
"This",
"Is",
"A",
"Test",
};
func TestDelim(t *testing.T) {
data := []byte(strings.Join(delimData, "\n") + "\n")
delim := Delimeter{'\n'}
reader := bufio.Ne... | package httpie
import (
"testing"
"strings"
"bufio"
"bytes"
)
var delimData = []string{
"Hello",
"World",
"This",
"Is",
"A",
"Test",
};
func TestDelim(t *testing.T) {
data := []byte(strings.Join(delimData, "\n") + "\n")
delim := NewLine
reader := bufio.NewReader(... | Use one of the defined ones | Use one of the defined ones
| Go | mit | brettbuddin/httpie |
21ab86365bed31ec75adaac42743fe1d304531ed | emu/core.go | emu/core.go | package emu
const (
memorySize = 4096
vramSize = 64 * 32
registersNumber = 16
stackSize = 16
)
// Chip8 is the main struct holding all data relevant to the emulator.
// This includes registers (V0 to VF, PC, etc.), ram and framebuffer.
type Chip8 struct {
I uint16
pc uint16
sp ui... | package emu
const (
memorySize = 4096
vramSize = 64 * 32
registersNumber = 16
stackSize = 16
)
// Chip8 is the main struct holding all data relevant to the emulator.
// This includes registers (V0 to VF, PC, etc.), ram and framebuffer.
type Chip8 struct {
I uint16
pc uint16
sp ui... | Add keypad and New comment | Add keypad and New comment
| Go | mit | valep27/GChip8 |
1b7216d434faa82ab084c6d07dbb10926009c457 | analyst/internal/config/config.go | analyst/internal/config/config.go | package config
import (
"log"
"github.com/bradylove/envstruct"
)
type Config struct {
Addr string `env:"ADDR,required"`
IntraAddr string `env:"INTRA_ADDR,required"`
TalariaNodeAddr string `env:"TALARIA_NODE_ADDR,required"`
TalariaSchedulerAddr string `env:"TALARIA_SCHEDU... | package config
import (
"log"
"github.com/bradylove/envstruct"
)
type Config struct {
Addr string `env:"ADDR,required"`
IntraAddr string `env:"INTRA_ADDR,required"`
TalariaNodeAddr string `env:"TALARIA_NODE_ADDR,required"`
TalariaSchedulerAddr string `env:"TALARIA_SCHEDU... | Set analyst default pprof port to 0 | Set analyst default pprof port to 0
| Go | mit | apoydence/loggrebutterfly,apoydence/loggrebutterfly |
2560bc5fa69e4dcbd8241f7e60a49dbc314a0cf1 | dijkstra_test.go | dijkstra_test.go | package graphs
import (
"testing"
)
func TestDijkstra(t *testing.T) {
graph := NewGraph()
graph.AddEdge("a", "b", 1)
graph.AddEdge("a", "c", 3)
graph.AddEdge("b", "g", 5)
graph.AddEdge("c", "g", 8)
graph.AddEdge("g", "h", 6)
graph.AddEdge("c", "d", 2)
graph.AddEdge("g", "f", 4)
graph.AddEdge("d", "f", 3)
... | package graphs
import (
"testing"
)
func TestDijkstra(t *testing.T) {
graph := NewGraph()
graph.AddEdge("a", "b", 1)
graph.AddEdge("a", "c", 3)
graph.AddEdge("b", "g", 5)
graph.AddEdge("c", "g", 8)
graph.AddEdge("g", "h", 6)
graph.AddEdge("c", "d", 2)
graph.AddEdge("g", "f", 4)
graph.AddEdge("d", "f", 3)
... | Check if path is complete | Check if path is complete
| Go | mit | thcyron/graphs,jacobxk/graphs |
8fb93d67c13265437003a8794ad4c54c0d93f284 | notifier.go | notifier.go | package raftor
// ClusterChangeNotifier notifies the receiver of the cluster change.
type ClusterChangeNotifier interface {
// NotifyChange sends ClusterChangeEvents over the given channel when a node joins, leaves or is updated in the cluster.
NotifyChange() <-chan ClusterChangeEvent
}
| package raftor
// ClusterChangeNotifier notifies the receiver of the cluster change.
type ClusterChangeNotifier interface {
// NotifyChange sends ClusterChangeEvents over the given channel when a node joins, leaves or is updated in the cluster.
NotifyChange() <-chan ClusterChangeEvent
// Stop stops the notifier f... | Add Stop method to ClusterChangeNotifier | Add Stop method to ClusterChangeNotifier
| Go | apache-2.0 | eliquious/raftor,blacklabeldata/raftor |
11c02cddac9251c254c2671e9698f64ca5ca081e | greyhound/main.go | greyhound/main.go | package main
import (
"flag"
"fmt"
"github.com/holizz/greyhound"
"log"
"net/http"
"time"
)
func main() {
port := flag.Int("p", 3000, "port number to listen on")
dir := flag.String("d", ".", "directory to serve")
timeout := flag.Duration("t", time.Second * 5, "timeout in milliseconds")
flag.Parse()
phpHand... | package main
import (
"flag"
"fmt"
"github.com/holizz/greyhound"
"log"
"net/http"
"time"
)
type stringslice []string
func (s *stringslice) String() string {
return "a"
}
func (s *stringslice) Set(in string) (err error) {
*s = append(*s, in)
return
}
func main() {
ignore := stringslice([]string{})
port :... | Add -i option for ignoring errors to cli tool | Add -i option for ignoring errors to cli tool
| Go | mit | holizz/greyhound,holizz/greyhound |
3c1c6a964f3d4b4f11ac0ead0008ebac2c267aec | goof.go | goof.go | package main
import (
"net/http"
)
type fileHandler struct {
filename string
times int
}
func (f fileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, f.filename)
}
func main() {
handler := fileHandler{"/home/nindalf/Pictures/wallpapers/octocats/baracktocat.jpg", 1}
http.Lis... | package main
import (
"flag"
"fmt"
"log"
"net/http"
"time"
)
var (
filename = flag.String("f", "", "The name of the file to be shared")
n = flag.Int("n", 1, "The number of times the file should be shared")
t = flag.Int("t", 0, "Server timeout")
)
type fileHandler struct {
filename string
n ... | Add ability to specify params on command line | Add ability to specify params on command line
| Go | mit | nindalf/goof |
6c8f01d85b89bd09aca011b16204e4a83b0c1aca | doc.go | doc.go | /*
conch0 collects file info from the "testfiles" directory and concurrently
processes the files by decompressing the contents and then printing the
data or related error.
The "width" of concurrency is set by the constant "width". Parallelism is
scheduled properly regardless of CPUs available, and the processing will... | /*
conch0 collects file info from the "testfiles" directory and concurrently
processes the files by decompressing the contents and then printing the
data or related error.
The "width" of concurrency is set by the constant "width". Parallelism is
scheduled properly regardless of CPUs available, and the processing will... | Add space to package comment. | Add space to package comment.
| Go | mit | daved/conch0 |
a278e6f0b814a2321151e65b737f9013041d7033 | src/example_spec.go | src/example_spec.go | package main
func init() {
initSpec();
spec.Describe("Math", func() {
spec.It("adds", func() {
spec.That(1 + 1).Should.Be(2);
});
spec.It("multiplies", func() {
spec.That(3 * 3).Should.Be(9);
spec.That(2 * 4).ShouldNot.Be(6);
});
});
spec.Describe("String", func() {
spec.It("concatenates", fu... | package main
func init() {
initSpec();
spec.Describe("Math", func() {
spec.It("adds", func() {
spec.That(1 + 1).Should().Be(3);
});
spec.It("multiplies", func() {
spec.That(3 * 3).Should().Be(9);
spec.That(2 * 4).ShouldNot().Be(6);
});
});
spec.Describe("String", func() {
spec.It("concatenate... | Fix up example spec to have some failures again. | Fix up example spec to have some failures again.
| Go | mit | stesla/gospecify,stesla/gospecify |
a42fa7207b8e82ea80d9d36bf8ce5de3a4f5f776 | dawa.go | dawa.go | // The dawa package can be used to de-serialize structures received from "Danmarks Adressers Web API (DAWA)" (Addresses of Denmark Web API).
//
// This package allows to de-serialize JSON responses from the web api into typed structs.
// The package also allows importing JSON or CSV downloads from the official web page... | // The dawa package can be used to de-serialize structures received from "Danmarks Adressers Web API (DAWA)" (Addresses of Denmark Web API).
//
// This package allows to de-serialize JSON responses from the web api into typed structs.
// The package also allows importing JSON or CSV downloads from the official web page... | Disable strict struct checks by default. | Disable strict struct checks by default.
| Go | mit | klauspost/dawa |
948b79df876ba58858656feb9fd5426236190816 | ql/src/experimental/Security/CWE-643/XPathInjection.go | ql/src/experimental/Security/CWE-643/XPathInjection.go | package main
import (
"net/http"
"github.com/moovweb/gokogiri"
)
func processRequest(r *http.Request, doc *XmlDocument) {
r.parseForm()
username := r.Form.Get("username")
password := r.Form.Get("password")
root := doc.Root()
// BAD: User input used directly in an XPath expression
doc, _ := root.Sea... | package main
import (
"fmt"
"net/http"
"github.com/ChrisTrenkamp/goxpath"
"github.com/ChrisTrenkamp/goxpath/tree"
)
func main() {}
func processRequest(r *http.Request, doc tree.Node) {
r.ParseForm()
username := r.Form.Get("username")
password := r.Form.Get("password")
// BAD: User input used directly in an... | Update xpath example, use goxpath package | Update xpath example, use goxpath package
| Go | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql-go,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql |
65d96f196b6bc1a593f3785c2c6be428bd64cb57 | seaweed-banking-account-updater/database/connection.go | seaweed-banking-account-updater/database/connection.go | package database
import (
"log"
"github.com/ChristianNorbertBraun/seaweed-banking/seaweed-banking-account-updater/config"
mgo "gopkg.in/mgo.v2"
)
var session *mgo.Session
// Configure establish connection to mongodb
func Configure() {
s, err := mgo.Dial(config.Configuration.Db.URL)
if err != nil {
log.Fatal... | package database
import (
"log"
weedharvester "github.com/ChristianNorbertBraun/Weedharvester"
"github.com/ChristianNorbertBraun/seaweed-banking/seaweed-banking-account-updater/config"
mgo "gopkg.in/mgo.v2"
)
var session *mgo.Session
var filer weedharvester.Filer
// Configure establish connection to mongodb
fun... | Add configuration for filer to account-updater | Add configuration for filer to account-updater
| Go | mit | ChristianNorbertBraun/seaweed-banking,ChristianNorbertBraun/seaweed-banking |
5add9e9b7e2ce675fa7f0160ce7d6a7693d43854 | doc.go | doc.go | /*
Package mysqldriver is a driver for MySQL database
Concurrency
DB struct manages pool of connections to MySQL. Connection itself
isn't thread-safe, so it should be obtained per every go-routine.
It's important to return a connection back to the pool
when it's not needed for further reuse.
db := mysqldriver.NewDB... | /*
Package mysqldriver is a driver for MySQL database
Concurrency
DB struct manages pool of connections to MySQL. Connection itself
isn't thread-safe, so it should be obtained per every go-routine.
It's important to return a connection back to the pool
when it's not needed for further reuse.
db := mysqldriver.NewDB... | Add note about sequential way to read rows | Add note about sequential way to read rows
| Go | mit | pubnative/mysqldriver-go |
83bc89466f52b370b47f92e896dd56040b683ebf | main.go | main.go | package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
var content []byte
var err error
if len(os.Args) == 1 {
content, err = ioutil.ReadAll(os.Stdin)
} else {
content, err = ioutil.ReadFile(os.Args[1])
}
if err != nil {
if os.IsNotExist(err) {
fmt.Println("Gopl: the file... | package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
var content []byte
var err error
if len(os.Args) == 1 {
content, err = ioutil.ReadAll(os.Stdin)
} else {
content, err = ioutil.ReadFile(os.Args[1])
}
if err != nil {
if os.IsNotExist(err) {
fmt.Println("Gopl: the file... | Exit with non-zero status code on error | Exit with non-zero status code on error | Go | mit | MrGosti/gopl |
33aed2c0e0e630d2d2b50cddcb9abfb0fe2df14e | main.go | main.go | package main
import (
"bytes"
"container/list"
"encoding/json"
"log"
"os/exec"
"strings"
"time"
)
// Stat represents stats to send to graphite
type Stat struct {
Key string `json:"key"`
Value string `json:"value"`
DT int64 `json:"dt"`
}
func main() {
stats := list.New()
var out bytes.Buffer
cmd :... | package main
import (
"bytes"
"encoding/json"
"log"
"os/exec"
"strings"
"time"
)
// Stat represents stats to send to graphite
type Stat struct {
Key string `json:"key"`
Value string `json:"value"`
DT int64 `json:"dt"`
}
func main() {
var stats []Stat
var out bytes.Buffer
cmd := exec.Command("typep... | Remove container/list as per suggestions from @pnelson | Remove container/list as per suggestions from @pnelson
| Go | mit | halkeye/go_windows_stats |
3eedefb57fe9d71efec7c24be8b5e9dff8eb8f61 | main.go | main.go | package main;func main(){print(p,string(96),p,string(96))};var p string=`package main;func main(){print(p,string(96),p,string(96))};var p string=`
| package main
func main(){print(p,string(96),p,string(96))}
var p string=`package main
func main(){print(p,string(96),p,string(96))}
var p string=`
| Update with newlines, as they are equal to ; in char count. | Update with newlines, as they are equal to ; in char count. | Go | unlicense | adamryman/go-quine |
6747228be9a805edc8d52d797e759afcfcdc9c50 | main.go | main.go | package main
import (
"flag"
"fmt"
"log"
"time"
"github.com/publicgov/spain-boe-reader/net"
"github.com/publicgov/spain-boe-reader/params"
"github.com/publicgov/spain-boe-reader/summary"
)
var currentDate string
func main() {
// parse command line argument
flag.StringVar(¤tDate, "date", defaultTime()... | package main
import (
"flag"
"fmt"
"log"
"time"
"github.com/publicgov/spain-boe-reader/net"
"github.com/publicgov/spain-boe-reader/params"
"github.com/publicgov/spain-boe-reader/summary"
)
var currentDate string
func main() {
// parse command line argument
flag.StringVar(¤tDate, "date", defaultTime()... | Check if the summary have diaries | Check if the summary have diaries
| Go | agpl-3.0 | publicgov/spain-boe-reader |
07579f7f9fe29c1cc08fbe2616a063b44bc6fa72 | store/store_suite_test.go | store/store_suite_test.go | package store_test
import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"
"os"
"os/signal"
"testing"
)
var etcdRunner *etcdstorerunner.ETCDClusterRunner
func TestStore(t *testing.T) {
registerSignalHa... | package store_test
import (
"io/ioutil"
"net/http"
"os"
"os/signal"
"testing"
"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/gomega"
)
var (
etcdRunner *etcdstorerunner.ETCDClusterRunner
etcdVersion = "2.1.0... | Add test for verifying etcd server used under test is the correct version | Add test for verifying etcd server used under test is the correct version
[#98993568]
| Go | apache-2.0 | cloudfoundry/hm9000 |
f1ae5f6220fe612a75a465f5519c713d90feda88 | challenge47_test.go | challenge47_test.go | package cryptopals
import (
"crypto/rand"
"crypto/rsa"
"testing"
)
func TestDecryptRsaPaddingOracleSimple(t *testing.T) {
c := challenge47{}
priv, _ := rsa.GenerateKey(rand.Reader, 1024)
pub := priv.PublicKey
expected := "Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption Standard PKCS #... | package cryptopals
import (
"crypto/rand"
"crypto/rsa"
"testing"
)
func TestDecryptRsaPaddingOracleSimple(t *testing.T) {
c := challenge47{}
priv, _ := rsa.GenerateKey(rand.Reader, 768)
pub := priv.PublicKey
expected := "kick it, CC"
ciphertext, err := rsa.EncryptPKCS1v15(rand.Reader, &pub, []byte(expected)... | Update test to use 768 key size and different message | Update test to use 768 key size and different message
| Go | mit | Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go |
cbec6b0f74c6ce48926c4beee7e8424d79ddf028 | player_helpers.go | player_helpers.go | package omxplayer
import (
"fmt"
)
// dbusCall calls a D-Bus method that has no return value.
func dbusCall(path string) error {
return fmt.Errorf("omxplayer: %s not implemented yet", path)
}
// dbusGetBool calls a D-Bus method that will return a boolean value.
func dbusGetBool(path string) (bool, error) {
return... | package omxplayer
import (
"fmt"
)
// dbusCall calls a D-Bus method that has no return value.
func dbusCall(path string) error {
return fmt.Errorf("omxplayer: %s not implemented yet", path)
}
// dbusGetBool calls a D-Bus method that will return a boolean value.
func dbusGetBool(path string) (bool, error) {
return... | Use path in string helper error messages. | Use path in string helper error messages.
| Go | mit | jleight/omxplayer |
661bcd3e4d95e6d55f42b3bedbc18c6f8b8e5793 | client_unix_test.go | client_unix_test.go | // +build !windows
package containerd
const (
defaultRoot = "/var/lib/containerd-test"
defaultAddress = "/run/containerd-test/containerd.sock"
testImage = "docker.io/library/alpine:latest"
)
func platformTestSetup(client *Client) error {
return nil
}
| // +build !windows
package containerd
import (
"runtime"
)
const (
defaultRoot = "/var/lib/containerd-test"
defaultAddress = "/run/containerd-test/containerd.sock"
)
var (
testImage string
)
func platformTestSetup(client *Client) error {
return nil
}
func init() {
switch runtime.GOARCH {
case "386":
t... | Change test image based on platform | Change test image based on platform
This changes testImage so it can be run on other platforms.
Signed-off-by: Christopher Jones <da8482a61c3a314f69bc15b69175fd62d9234b97@linux.vnet.ibm.com>
| Go | apache-2.0 | estesp/containerd,containerd/containerd,kunalkushwaha/containerd,AkihiroSuda/containerd,estesp/containerd,vdemeester/containerd,miaoyq/containerd,dmcgowan/containerd,vdemeester/containerd,thaJeztah/containerd,mikebrow/containerd,kunalkushwaha/containerd,thaJeztah/containerd,dmcgowan/containerd,mikebrow/containerd,crosb... |
ef9b86dd9dd00b1ff3de304f3260e868b0a888e9 | search/lsearch.go | search/lsearch.go | package algoholic
func LinearSearch(ns []int, n int) int {
for i, m := range ns {
if m == n {
return i
}
}
return -1
}
| package algoholic
// Linear Search - Given an input slice and a sought value, return the index of that value in
// the slice or -1 if it can't be found.
// Linear Search, O(n) worst-case.
func LinearSearch(ns []int, n int) int {
// Simply iterate through every item in the slice, short-circuiting and returning should... | Add commentary to linear search. | Add commentary to linear search.
| Go | mit | lorenzo-stoakes/algoholic |
87e9ff5f6556ad8f3bf06d4053c8e5832364b3be | default_template.go | default_template.go | package main
var defaultTemplate = `
[vars]
ignoreDirs = [".git", "Godeps", "vendor"]
stopLoadingParent = [".git"]
buildFlags = ["."]
artifactsEnv = "CIRCLE_ARTIFACTS"
testReportEnv = "CIRCLE_TEST_REPORTS"
[gotestcoverage]
timeout = "10s"
cpu = "4"
parallel = 8
race = true
covermode = "atomic"
[i... | package main
var defaultTemplate = `
[vars]
ignoreDirs = [".git", "Godeps", "vendor"]
stopLoadingParent = [".git"]
buildFlags = ["."]
artifactsEnv = "CIRCLE_ARTIFACTS"
testReportEnv = "CIRCLE_TEST_REPORTS"
[gotestcoverage]
timeout = "10s"
cpu = "4"
parallel = 8
race = true
covermode = "atomic"
[i... | Add install for junit report generator | Add install for junit report generator
| Go | apache-2.0 | cep21/gobuild,cep21/gobuild |
f7fb39be298640a05189f01612ee4df09c023971 | command.go | command.go | package main
import (
"bufio"
"github.com/kr/pty"
"io"
"os"
"os/exec"
)
type Cmd struct {
*exec.Cmd
Pty *os.File
output io.Reader
Output chan []byte
}
func Command(prog string, args ...string) *Cmd {
return &Cmd{exec.Command(prog, args...), nil, nil, nil}
}
func (c *Cmd) Start() error {
pterm, err := ... | package main
import (
"io"
"os"
"bufio"
"github.com/chrisseto/pty"
"os/exec"
)
type Cmd struct {
*exec.Cmd
Pty *os.File
output io.Reader
Output chan []byte
}
func Command(prog string, args ...string) *Cmd {
return &Cmd{exec.Command(prog, args...), nil, nil, nil}
}
func (c *Cmd) Start(width, height int)... | Switch to my fork of pty which supports SetSize | Switch to my fork of pty which supports SetSize
| Go | mit | chrisseto/Sux |
729cec51a106f17529d6e848a3d98c2f0bebd7fd | freetype/main.go | freetype/main.go | package freetype
import (
"code.google.com/p/freetype-go/freetype"
"image"
)
var img = image.NewNRGBA64(image.Rectangle{image.Point{0, 0}, image.Point{59, 39}})
func Fuzz(data []byte) int {
f, err := freetype.ParseFont(data)
if err != nil {
if f != nil {
panic("font is not nil on error")
}
return 0
}
... | package freetype
import (
"github.com/golang/freetype"
"image"
)
var img = image.NewNRGBA64(image.Rectangle{image.Point{0, 0}, image.Point{59, 39}})
func Fuzz(data []byte) int {
f, err := freetype.ParseFont(data)
if err != nil {
if f != nil {
panic("font is not nil on error")
}
return 0
}
ctx := freet... | Update to the current location of the freetype library | Update to the current location of the freetype library | Go | apache-2.0 | dvyukov/go-fuzz-corpus,dvyukov/go-fuzz-corpus |
c55229389f9aeee220b5e731e2b0cf8e132625c2 | go/src/summa/api_profile.go | go/src/summa/api_profile.go | package summa
import (
"database/sql"
_ "go-sqlite3"
"strings"
)
func apiProfile(db *sql.DB, req apiRequest, resp apiResponseData) apiError {
u, err := userFetch(db, req.Username)
if err != nil {
return &internalServerError{"Could not fetch user", err}
}
resp["user"] = u
return nil
}
func apiProfileUpdat... | package summa
import (
"database/sql"
_ "go-sqlite3"
"strings"
)
func apiProfile(db *sql.DB, req apiRequest, resp apiResponseData) apiError {
username, _ := req.Data["username"].(string)
if username == "" {
username = req.Username
}
u, err := userFetch(db, username)
if err != nil {
return &internalServe... | Update profile API to accept either the request's username or username in the data field | Update profile API to accept either the request's username or username in the data field
| Go | mit | jbrimeyer/Summa,jbrimeyer/Summa |
22d4a84c24acc9d603d006936ac3a76ebd4f58a1 | test/aws_helpers.go | test/aws_helpers.go | package test
import (
"github.com/gruntwork-io/terratest/modules/aws"
"testing"
)
// Get the IP address from a randomly chosen EC2 Instance in an Auto Scaling Group of the given name in the given
// region
func getIpAddressOfAsgInstance(t *testing.T, asgName string, awsRegion string) string {
instanceIds := aws.Ge... | package test
import (
"github.com/gruntwork-io/terratest/modules/aws"
"testing"
)
// Get the IP address from a randomly chosen EC2 Instance in an Auto Scaling Group of the given name in the given
// region
func getIpAddressOfAsgInstance(t *testing.T, asgName string, awsRegion string) string {
instanceIds := aws.Ge... | Fix missing method in terratest | Fix missing method in terratest
| Go | apache-2.0 | MatthiasScholz/terraform-aws-nomad,MatthiasScholz/terraform-aws-nomad |
23c6b0c8b61e4b502e14e090c52107a0987e85bd | watcher/lib/util.go | watcher/lib/util.go | package lib
import (
"context"
"time"
log "github.com/Sirupsen/logrus"
"github.com/gravitational/trace"
)
func OneOf(value string, values []string) bool {
for _, v := range values {
if v == value {
return true
}
}
return false
}
type APIClient interface {
Health() error
}
// WaitForAPI spins until t... | package lib
import (
"context"
"time"
log "github.com/Sirupsen/logrus"
"github.com/gravitational/trace"
)
// OneOf returns true if the value is present in the list of values
func OneOf(value string, values []string) bool {
for _, v := range values {
if v == value {
return true
}
}
return false
}
// AP... | Add a couple of comments | Add a couple of comments
| Go | apache-2.0 | gravitational/monitoring-app,gravitational/monitoring-app |
0fc397ada9bc194d12428ea607c53c9cf1925ed6 | cmd/bbs/main_test.go | cmd/bbs/main_test.go | package main_test
import (
"code.cloudfoundry.org/bbs/cmd/bbs/testrunner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
var _ = Describe("BBS main test", func() {
JustBeforeEach(func() {
bbsRunner = testrunner.New(bbsBinPath, bbsConfig)
})
Context("when sql is not configu... | package main_test
import (
"code.cloudfoundry.org/bbs/cmd/bbs/testrunner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
var _ = Describe("BBS main test", func() {
JustBeforeEach(func() {
bbsRunner = testrunner.New(bbsBinPath, bbsConfig)
})
Context("when sql is not configu... | Revert "Revert "assert the bbs won't start if it cannot connect to the loggretor agent"" | Revert "Revert "assert the bbs won't start if it cannot connect to the loggretor agent""
This reverts commit 1cbd0d0f06372f0b5109b38ba862988362abdf0f.
| Go | apache-2.0 | cloudfoundry-incubator/bbs,cloudfoundry-incubator/bbs |
e0cc29b12d2e17a838899b3a74caab48109c772f | go/largest-series-product/largest_series_product.go | go/largest-series-product/largest_series_product.go | package lsproduct
func LargestSeriesProduct(digits string, span int) (int64, error) {
panic("Please implement the LargestSeriesProduct function")
}
| package lsproduct
import (
"fmt"
"log"
"strconv"
)
func LargestSeriesProduct(digits string, span int) (largestProduct int64, err error) {
fmt.Printf("LargestSeriesProduct(%v, %v)\n", digits, span)
for i := 0; i <= len(digits)-span; i++ {
product := getProduct(digits[i : i+span])
if product > largestProduct {... | Solve first few test cases | Solve first few test cases
| Go | mit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism |
3b945ae65a30a7ad0cb193b8b34489fdda0a2fe6 | cmd/version_test.go | cmd/version_test.go | // khan
// https://github.com/topfreegames/khan
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license
// Copyright © 2016 Top Free Games <backend@tfgco.com>
package cmd
import (
"fmt"
"os/exec"
"testing"
. "github.com/franela/goblin"
"github.com/topfreegames/khan/api"
)
func r... | // khan
// https://github.com/topfreegames/khan
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license
// Copyright © 2016 Top Free Games <backend@tfgco.com>
package cmd
// import (
// "fmt"
// "os/exec"
// "testing"
//
// . "github.com/franela/goblin"
// "github.com/topfreegames... | Remove cmd test temporarily so we have a build. | Remove cmd test temporarily so we have a build.
| Go | mit | topfreegames/khan,topfreegames/khan,topfreegames/khan |
a44d02678933f7e538a6b123444bcd723cbab7d1 | models/test_task.go | models/test_task.go | package models
import (
"testing"
)
func TestNewTaskModel(t *testing.T) {
}
| package models
import (
"testing"
)
func TestNewTaskModel(t *testing.T) {
}
func TestSaveAndFind(t *testing.T) {
}
| Add test of save and find task | Add test of save and find task
| Go | mit | alice02/go-todoapi,alice02/go-todoapi,alice02/go-todoapi |
0674669d32f7ea3de194ec8d9c68fc4a7ebbd17f | benchmark_test.go | benchmark_test.go | // Copyright (C) 2015 Thomas de Zeeuw.
//
// Licensed under the MIT license that can be found in the LICENSE file.
package logger
import "testing"
var (
benchmarkResultTagString string
benchmarkResultTagBytes []byte
benchmarkResultTagJSON []byte
)
func BenchmarkTags_String(b *testing.B) {
b.ReportAllocs()
... | // Copyright (C) 2015 Thomas de Zeeuw.
//
// Licensed under the MIT license that can be found in the LICENSE file.
package logger
import "testing"
// go test -run none -bench . -benchmem -benchtime 10s
var (
benchmarkResultTagString string
benchmarkResultTagBytes []byte
benchmarkResultTagJSON []byte
)
func B... | Remove report allocs from benchmark | Remove report allocs from benchmark
Also add the command to run the benchmarks.
| Go | mit | Thomasdezeeuw/logger |
94057549958ead7b7450d57b846578be402b88b6 | config.go | config.go | package tempredis
import "fmt"
// Config is a key-value map of Redis config settings.
type Config map[string]string
// Host returns the host for a Redis server configured with this Config as
// "host:port".
func (c Config) Host() string {
bind, ok := c["bind"]
if !ok {
bind = "127.0.0.1"
}
port, ok := c["port... | package tempredis
import "fmt"
// Config is a key-value map of Redis config settings.
type Config map[string]string
// Host returns the host for a Redis server configured with this Config as
// "host:port".
func (c Config) Host() string {
bind, ok := c["bind"]
if !ok {
bind = "127.0.0.1"
}
port, ok := c["port... | Include trailing slash in URL. | Include trailing slash in URL.
| Go | mit | stvp/tempredis |
2a1d3b6d6408df98f095497c8555bd111d60e1d8 | gimbal.go | gimbal.go | package main
import (
"github.com/datamaglia/gimbal/spinner"
)
func main() {
config := spinner.LoadJsonConfig("test.json")
spinner.ExecuteTestConfig(config)
}
| package main
import (
"flag"
"github.com/datamaglia/gimbal/spinner"
)
var filename = flag.String("f", "", "Read the config from a file")
func main() {
flag.Parse()
config := spinner.LoadJsonConfig(*filename)
spinner.ExecuteTestConfig(config)
}
| Set input file from the command line. | Set input file from the command line.
| Go | mit | Datamaglia/gimbal |
5bae0dc0e2e7121b67aa8b91311d4c82b30bb2eb | rotate_test.go | rotate_test.go | // +build linux
package lumberjack_test
import (
"log"
"os"
"os/signal"
"syscall"
"github.com/natefinch/lumberjack.v2"
)
// Example of how to rotate in response to SIGHUP.
func ExampleLogger_Rotate() {
l := &lumberjack.Logger{}
log.SetOutput(l)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP)
... | // +build linux
package lumberjack_test
import (
"log"
"os"
"os/signal"
"syscall"
"gopkg.in/natefinch/lumberjack.v2"
)
// Example of how to rotate in response to SIGHUP.
func ExampleLogger_Rotate() {
l := &lumberjack.Logger{}
log.SetOutput(l)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP)
... | Use gopkg.in provider instead of github | Use gopkg.in provider instead of github | Go | mit | natefinch/lumberjack |
c8cb29649076f1215cc0aea696219ff8c88839c6 | kaylee.go | kaylee.go | package main
import (
"github.com/codegangsta/cli"
"github.com/monder/kaylee/command"
"os"
)
func main() {
app := cli.NewApp()
app.Version = "0.1.0"
app.Usage = "Container orchestration system for fleet"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
Value: "http://127.0.0.1:4001,htt... | package main
import (
"github.com/codegangsta/cli"
"github.com/monder/kaylee/command"
"os"
)
func main() {
app := cli.NewApp()
app.Version = "0.1.0"
app.Usage = "Container orchestration system for fleet"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
Value: "http://127.0.0.1:4001,h... | Use env variable for etcd endpoinst | Use env variable for etcd endpoinst | Go | mit | monder/kaylee |
cde0d6ca780553b280359991026e415e49fd88d6 | core/image_png.go | core/image_png.go | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... | Use the fastest speed for png | Use the fastest speed for png
| Go | mit | lotrekagency/piuma,lotrekagency/piuma |
d298c01f3b6449144502041b54651bc7ab6e43dc | generator/util.go | generator/util.go | package generator
import (
"sort"
"strings"
"unicode"
)
func ToPublicName(name string) string {
if name == "" {
return ""
}
return strings.ToUpper(name[0:1]) + name[1:]
}
func concatSortedMap(m map[string]string, sep string) string {
keys := make([]string, 0)
for k := range m {
keys = append(keys, k)
}
... | package generator
import (
"sort"
"unicode"
"github.com/serenize/snaker"
)
// ToPublicName returns a go-idiomatic public name
func ToPublicName(name string) string {
return snaker.SnakeToCamel(name)
}
func concatSortedMap(m map[string]string, sep string) string {
keys := make([]string, 0)
for k := range m {
... | Update ToPublicName to be go-idiomatic | Update ToPublicName to be go-idiomatic
| Go | mit | alanctgardner/gogen-avro,alanctgardner/gogen-avro |
ad4a901c1cbb6af959bd58717d6fb0255fc12422 | examples/mdns-publisher/publisher.go | examples/mdns-publisher/publisher.go | package main
import (
"net"
"github.com/davecheney/mdns"
)
func main() {
// A simple example. Publish an A record for my router at 192.168.1.254.
mdns.PublishA("router.local.", 3600, net.IPv4(192, 168, 1, 254))
// A more compilcated example. Publish a SVR record for ssh running on port
// 22 for my home NAS.... | package main
import (
"net"
"dns"
)
func main() {
// A simple example. Publish an A record for my router at 192.168.1.254.
mdns.PublishA("router.local.", 3600, net.IPv4(192, 168, 1, 254))
// A more compilcated example. Publish a SVR record for ssh running on port
// 22 for my home NAS.
// Publish an A recor... | Update the package for godns | Update the package for godns
| Go | bsd-2-clause | homburg/mdns,brianm/mdns,davecheney/mdns |
e2a811a0566a0bbaf4a1fdc5e1d59fae2a1b746e | fetch/github_test.go | fetch/github_test.go | package fetch
import (
"testing"
log "github.com/Sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func TestFetchPublicKeys(t *testing.T) {
log.SetLevel(log.DebugLevel)
keys, err := GitHubKeys("devopsfinland", GithubFetchParams{PublicMembersOnly: true})
assert.NoError(t, err, "Fetch GitHub keys return... | package fetch
import (
"os"
"testing"
log "github.com/Sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func TestFetchPublicKeys(t *testing.T) {
log.SetLevel(log.DebugLevel)
keys, err := GitHubKeys("devopsfinland", GithubFetchParams{
// Use token if it's available to avoid hitting API rate limits wit... | Use GITHUB_TOKEN in tests if available | Use GITHUB_TOKEN in tests if available
Previously we were running tests against Github API as unauthorized.
Problem is that we hit the API rate limits. So updated test to
use GITHUB_TOKEN if it's available and Travis we do have token.
| Go | apache-2.0 | ernoaapa/fetch-ssh-keys,arnested/fetch-ssh-keys |
df27a95446fb4d7d40871d70648e44265b38a4d8 | onedrive/types.go | onedrive/types.go | package onedrive
type OnedriveId struct {
Id string `json:"id"`
}
type OnedriveAuth struct {
Token_type string `json:"token_type"`
Expires_in string `json:"expires_in"`
Scope string `json:"scope"`
Access_token string `json:"access_token"`
Refresh_token string `json:"refresh_token"`
}
| package onedrive
type OnedriveId struct {
Id string `json:"id"`
}
type OnedriveAuth struct {
Token_type string `json:"token_type"`
Expires_in int `json:"expires_in"`
Scope string `json:"scope"`
Access_token string `json:"access_token"`
Refresh_token string `json:"refresh_token"`
}
| Fix wrong type in Onedrive response | Fix wrong type in Onedrive response
| Go | mit | ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos |
186cf60b9b7108b3850edd824a2f3973ab9f233d | state/metadata.go | state/metadata.go | package state
import "encoding/json"
type Metadata struct {
Name string // Unique name to associate with a state
Type string // The type of state "package", "file", etc.
State string // The desired state "installed", "rendered", etc.
}
func (md *Metadata) Equal(metadata *Metadata) bool {
return metadata.Name =... | package state
import "encoding/json"
type Metadata struct {
Name string // Unique name to associate with a state
Type string // The type of state "package", "file", etc.
State string // The desired state "installed", "rendered", etc.
}
func (md *Metadata) Equal(metadata *Metadata) bool {
return metadata.Name =... | Fix incorrect operators on Metadata.Equal method | Fix incorrect operators on Metadata.Equal method
| Go | mit | vektorlab/otter,vektorlab/otter,vektorlab/otter |
712b6578b62e50af8632f006a311c0f0a68ec010 | kakfa_test.go | kakfa_test.go | package main
import (
"testing"
"github.com/Shopify/sarama/mocks"
"github.com/Shopify/sarama"
"github.com/docker/docker/daemon/logger"
"time"
"encoding/json"
"github.com/stretchr/testify/assert"
)
func TestWriteMessage(t *testing.T) {
config := sarama.NewConfig()
producer := mocks.NewAsyncProducer(t, con... | package main
import (
"testing"
"github.com/Shopify/sarama/mocks"
"github.com/Shopify/sarama"
"github.com/docker/docker/daemon/logger"
"time"
"encoding/json"
"github.com/stretchr/testify/assert"
)
func TestWriteMessage(t *testing.T) {
config := sarama.NewConfig()
config.Producer.Return.Successes = true
... | Set the mock producer in kafka_test to return successes | Set the mock producer in kafka_test to return successes
| Go | mit | MickayG/moby-kafka-logdriver |
3e9f3ef907b96934280363a3fc8f3356497ea6d9 | brands/model.go | brands/model.go | package brands
// Brand structure used by API
type Brand struct {
UUID string `json:"uuid"`
PrefLabel string `json:"prefLabel"`
Description string `json:"description"`
ParentUUID string `json:"parentUUID"`
Strapline string `json:"strapline"`
DescriptionXML string `json:"descriptionXML"... | package brands
// Brand structure used by API
type Brand struct {
UUID string `json:"uuid"`
PrefLabel string `json:"prefLabel"`
Description string `json:"description"`
ParentUUID string `json:"parentUUID"`
Strapline string `json:"strapline"`
DescriptionXML string `json:"descriptionXML"... | Remove references to authorities / identifiers (will raise issue with Guy) | Remove references to authorities / identifiers (will raise issue with Guy)
| Go | mit | Financial-Times/brands-rw-neo4j |
4e44e276df3ff74fb1736a418784a39b25862a8f | dvol.go | dvol.go | package main
import (
"fmt"
"github.com/clusterhq/dvol/cmd"
"os"
// "github.com/ClusterHQ/dvol/dockercontainers"
// "github.com/ClusterHQ/dvol/plugin"
)
func main() {
if err := cmd.RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
}
}
| package main
import (
"fmt"
"github.com/ClusterHQ/dvol/cmd"
"os"
// "github.com/ClusterHQ/dvol/dockercontainers"
// "github.com/ClusterHQ/dvol/plugin"
)
func main() {
if err := cmd.RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
}
}
| Revert "lowercase import for godep - godep will treat ClusterHQ and clusterhq as two seperate paths and include the lowercased one in dependancies" | Revert "lowercase import for godep - godep will treat ClusterHQ and clusterhq as two seperate paths and include the lowercased one in dependancies"
This reverts commit 159d8ec22e8fff2069f1d0370e9ec81fb10816d0.
| Go | apache-2.0 | ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol |
39594e7a537755b6ecc313ef29740ad8a7e7820d | cmd/geoipupdate/defaults_windows.go | cmd/geoipupdate/defaults_windows.go | package main
import (
"os"
)
var (
// I'm not sure these make sense. However they can be overridden at runtime
// and in the configuration, so we have some flexibility.
defaultConfigFile = os.Getenv("SYSTEMDRIVE") + `\ProgramData\GeoIP.conf`
defaultDatabaseDirectory = os.Getenv("SYSTEMDRIVE") + `\ProgramD... | package main
import (
"os"
)
var (
// I'm not sure these make sense. However they can be overridden at runtime
// and in the configuration, so we have some flexibility.
defaultConfigFile = os.Getenv("SYSTEMDRIVE") + `\ProgramData\MaxMind\GeoIP.conf`
defaultDatabaseDirectory = os.Getenv("SYSTEMDRIVE") + `\... | Put config in a different directory for Windows | Put config in a different directory for Windows
| Go | apache-2.0 | maxmind/geoipupdate,maxmind/geoipupdate,maxmind/geoipupdate |
9e5e66da598121e08526de41d7fb7b0e956a0cb5 | nom/object.go | nom/object.go | package nom
// Object is the interface of all structs in the network object model.
type Object interface {
// GOBDecode decodes the object from a byte array using the GOB encoding.
GOBDecode(b []byte) error
// GOBEncode encodes the object into a byte array using the GOB encoding.
GOBEncode() ([]byte, error)
// JS... | package nom
import (
"bytes"
"encoding/gob"
"reflect"
"github.com/golang/glog"
"github.com/soheilhy/beehive/bh"
)
// Object is the interface of all structs in the network object model.
type Object interface {
// GobDecode decodes the object from a byte array using the Gob encoding.
GobDecode(b []byte) error
... | Add generic methods for nom.Object | Add generic methods for nom.Object
This commit refactors the code for GobEncode/GobDecode and getting/putting
objects from dictionaries.
| Go | apache-2.0 | kandoo/beehive-netctrl,soheilhy/beehive-netctrl |
351e79a723d28b1ea9dc04e2813bd2be4f5b339e | json_test.go | json_test.go | package goat
| package goat
import (
"bytes"
"net/http/httptest"
"testing"
)
func TestWriteError(t *testing.T) {
// In
code := 500
err := "foo"
// Expected
json := `{
"error": "` + err + `"
}
`
buf := bytes.NewBufferString(json)
w := httptest.NewRecorder()
WriteError(w, code, err)
// Test code
if w.Code != code {
... | Add better tests for json | Add better tests for json
| Go | mit | bahlo/goat |
7b8803a317794afd4337f9da1e5de740a97c13a2 | eliminate.go | eliminate.go | package main
//simple is a simple function, with no combinators.
type simple interface {
Func
contains(char) bool
}
func (c char) contains(other char) bool { return c == other }
func (p pair) contains(c char) bool {
var first, second bool
if s, ok := p[0].(simple); ok {
first = s.contains(c)
}
if s, ok := p[... | package main
//simple is a simple function, with no combinators.
type simple interface {
Func
contains(char) bool
}
func (c char) contains(other char) bool { return c == other }
func (p pair) contains(c char) bool {
return p[0].(simple).contains(c) || p[1].(simple).contains(c)
}
func dumbParse(raw []byte) simple... | Change pair.contains() to panic if combinators are involved. | Change pair.contains() to panic if combinators are involved.
| Go | bsd-3-clause | anschelsc/pure,anschelsc/pure |
a075c2ce8e86410d3eea87ffb39b48ae2b19549d | cmd/metrics-provider/main.go | cmd/metrics-provider/main.go | package main
import (
log "github.com/Sirupsen/logrus"
logx "github.com/mistifyio/mistify-logrus-ext"
"github.com/mistifyio/mistify/provider"
"github.com/mistifyio/mistify/providers/metrics"
flag "github.com/spf13/pflag"
)
func main() {
log.SetFormatter(&logx.MistifyFormatter{})
config := provider.NewConfig(n... | package main
import (
log "github.com/Sirupsen/logrus"
"github.com/cerana/cerana/provider"
"github.com/cerana/cerana/providers/metrics"
logx "github.com/mistifyio/mistify-logrus-ext"
flag "github.com/spf13/pflag"
)
func main() {
log.SetFormatter(&logx.MistifyFormatter{})
config := provider.NewConfig(nil, nil)... | Fix import path for metrics provider cmd | Fix import path for metrics provider cmd
| Go | mit | cerana/cerana,cerana/cerana,cerana/cerana,cerana/cerana |
68e8a57429c4221defb6c24b04aafec4108a4d4a | formatter.go | formatter.go | // Package logrusx is a logrus formatter that adds better error value handling
// to the logrus.JSONFormatter
package logrusx
import (
log "github.com/Sirupsen/logrus"
)
type (
// MistifyFormatter is a custom logrus formatter extending JSONFormatter
MistifyFormatter struct {
log.JSONFormatter
}
// FieldError ... | // Package logrusx is a logrus formatter that adds better error value handling
// to the logrus.JSONFormatter
package logrusx
import (
"fmt"
"runtime"
"strings"
log "github.com/Sirupsen/logrus"
)
type (
// MistifyFormatter is a custom logrus formatter extending JSONFormatter
MistifyFormatter struct {
log.JSO... | Add the callstack to error fields | Add the callstack to error fields
Omit from the callstack the logrus package function calls and the
formatter call so that the stack begins where the logging is called
| Go | mit | mistifyio/mistify-logrus-ext |
e1d649b029930cd0df4625277d37b7abb04fc2db | bufferpool_test.go | bufferpool_test.go | // Copyright 2013 The Bufferpool Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package bufferpool_test
import (
"bytes"
"fmt"
"testing"
"github.com/pushrax/bufferpool"
)
func TestTakeFromEmpty(t *testing.T) {
bp := b... | // Copyright 2013 The Bufferpool Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package bufferpool_test
import (
"bytes"
"fmt"
"testing"
"github.com/pushrax/bufferpool"
)
func TestTakeFromEmpty(t *testing.T) {
bp := b... | Make the example reflect a normal use-case | Make the example reflect a normal use-case | Go | bsd-2-clause | pushrax/bufferpool |
9109ec19082bfdd7e9bb0211746fe20a339f045b | example_test.go | example_test.go | package httpstat
import (
"io"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/tcnksm/go-httpstat"
)
func Example() {
req, err := http.NewRequest("GET", "http://deeeet.com", nil)
if err != nil {
log.Fatal(err)
}
// Create go-httpstat powered
var result httpstat.Result
ctx := httpstat.WithHTTPStat(req.... | package httpstat_test
import (
"io"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/tcnksm/go-httpstat"
)
func Example() {
req, err := http.NewRequest("GET", "http://deeeet.com", nil)
if err != nil {
log.Fatal(err)
}
// Create go-httpstat powered
var result httpstat.Result
ctx := httpstat.WithHTTPStat... | Change package name for example | Change package name for example
| Go | mit | tcnksm/go-httpstat,JoseIgnacioTamayo/go-httpstat |
eae28e37654089792133385b5b0df697beddb098 | api/serializer/user.go | api/serializer/user.go | package serializer
import (
"github.com/jinzhu/gorm"
"github.com/mingrammer/meetup-api/api/model"
)
type ParticipantSerialzer struct {
ID uint `json:"id"`
Name string `json:"name"`
}
func SerializeParticipant(db *gorm.DB, participant *model.User) *ParticipantSerialzer {
owner := model.User{}
db.Find(&owner, ... | package serializer
import (
"github.com/jinzhu/gorm"
"github.com/mingrammer/meetup-api/api/model"
)
type ParticipantSerialzer struct {
ID uint `json:"id"`
Name string `json:"name"`
AvatarURL string `json:"avatar"`
}
func SerializeParticipant(db *gorm.DB, participant *model.User) *ParticipantSerialze... | Add avatar url to participant serializer | Add avatar url to participant serializer
| Go | mit | mingrammer/meetup-api |
45da7e9021b72bfec610f98d24ae40c5284963c7 | lowring/package.go | lowring/package.go | //go:generate got valueorderedkeys.got zzz_desirednodes.go p=lowring new=newDesiredNodes T=desiredNodes K=byDesire k=Node V=toDesire v=int32
//go:generate got valueorderedkeys_test.got zzz_desirednodes_test.go p=lowring new=newDesiredNodes T=desiredNodes K=byDesire k=Node V=toDesire v=int32
//go:genera... | // got can be found at github.com/gholt/got
//go:generate got valueorderedkeys.got zzz_desirednodes.go p=lowring new=newDesiredNodes T=desiredNodes K=byDesire k=Node V=toDesire v=int32
//go:generate got valueorderedkeys_test.got zzz_desirednodes_test.go p=lowring new=newDesiredNodes T=desiredNodes K=by... | Add a note about where got can be got | Add a note about where got can be got
| Go | bsd-3-clause | gholt/ring |
34a8a447d17052cbcfafae7bdb4d9594011495e6 | generate_bot.go | generate_bot.go | package twitterbot
import (
"fmt"
"time"
"github.com/ChimeraCoder/anaconda"
)
type TBot struct {
api *anaconda.TwitterApi
keys *Keys
}
func NewBot(config string) (*TBot, error) {
keys, err := ReadConfig(config)
if err != nil {
return nil, err
}
anaconda.SetConsumerKey(keys.consumerPublic)
anaconda.Set... | package twitterbot
import (
"fmt"
"time"
"github.com/ChimeraCoder/anaconda"
)
type TBot struct {
api *anaconda.TwitterApi
keys *Keys
}
func New(config string) (*TBot, error) {
keys, err := ReadConfig(config)
if err != nil {
return nil, err
}
anaconda.SetConsumerKey(keys.consumerPublic)
anaconda.SetCon... | Change names to not include `Bot`. | Change names to not include `Bot`.
The invocation in client code will include the twitterbot prefix,
so including Bot in the name is redundant. Calls now look like
`t := twitterbot.New(config)`.
| Go | mit | timwilkens/twitterbot |
7e5939556e7a6c9435fc67fb2a4e7337d74cfd1e | model/assertion.go | model/assertion.go | // Copyright 2017 The casbin 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 a... | // Copyright 2017 The casbin 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 a... | Set the RBAC role hierarchy to 10 levels by default. | Set the RBAC role hierarchy to 10 levels by default.
| Go | apache-2.0 | hsluoyz/casbin,casbin/casbin,faceless-saint/casbin |
69320522a2d1e7bf434913cebe79195753e7e8be | examples_test.go | examples_test.go | package geoip_test
import (
"fmt"
"geoip"
)
func ExampleOpen() {
db, err := geoip.Open("GeoLite2-City.mmdb.gz")
if err != nil {
panic(err)
}
res, err := db.Lookup("17.0.0.1")
if err != nil {
panic(err)
}
fmt.Println(res.Country.Name)
fmt.Println(res.City.Name)
// Output:
// United States
// Cupertino... | package geoip_test
import (
"fmt"
"github.com/rainycape/geoip"
)
func ExampleOpen() {
db, err := geoip.Open("GeoLite2-City.mmdb.gz")
if err != nil {
panic(err)
}
res, err := db.Lookup("17.0.0.1")
if err != nil {
panic(err)
}
fmt.Println(res.Country.Name)
fmt.Println(res.City.Name)
// Output:
// Unite... | Fix import path in example | Fix import path in example
| Go | mpl-2.0 | rainycape/geoip,rainycape/geoip |
399651fc66737e35c78482c2c433873370aed48d | bench_test.go | bench_test.go | package magick
import (
"github.com/nfnt/resize"
"image"
_ "image/png"
"os"
"testing"
)
func BenchmarkResizePng(b *testing.B) {
im := decodeFile(b, "wizard.png")
b.ResetTimer()
for ii := 0; ii < b.N; ii++ {
_, _ = im.Resize(240, 180, FLanczos)
}
}
func BenchmarkResizePngNative(b *testing.B) {
f, err := o... | package magick
import (
"github.com/nfnt/resize"
"image"
_ "image/png"
"os"
"testing"
)
func BenchmarkResizePng(b *testing.B) {
im := decodeFile(b, "wizard.png")
b.ResetTimer()
for ii := 0; ii < b.N; ii++ {
_, _ = im.Resize(240, 180, FLanczos)
}
}
func BenchmarkResizePngNative(b *testing.B) {
f, err := o... | Use Lanczos2Lut for the native resize test | Use Lanczos2Lut for the native resize test
This should make the native method a bit faster
| Go | mit | etix/magick,rainycape/magick,rainycape/magick,etix/magick,zuriu/magick,500px/magick,zuriu/magick,etix/magick,rainycape/magick,500px/magick,500px/magick,zuriu/magick |
6556ef062b4f674faab17b04f2ace2484cb90494 | api/middlewares.go | api/middlewares.go | package api
import (
"fmt"
"bitbucket.org/mundipagg/boletoapi/log"
gin "gopkg.in/gin-gonic/gin.v1"
)
//RequestLogger faz o log no SEQ para toda request
func RequestLogger() gin.HandlerFunc {
return func(c *gin.Context) {
fmt.Println("Ola")
log.Info("Teste SEQ")
c.Next()
}
}
// ReturnHeaders 'seta' os hea... | package api
import (
gin "gopkg.in/gin-gonic/gin.v1"
)
// ReturnHeaders 'seta' os headers padrões de resposta
func ReturnHeaders() gin.HandlerFunc {
return func(c *gin.Context) {
c.Header("Content-Type", "application/json")
c.Next()
}
}
| Remove código não usado do middleware | :fire: Remove código não usado do middleware
| Go | mit | mundipagg/boleto-api,mundipagg/boleto-api,mundipagg/boleto-api |
ef8ab46cc4e6344cb9855eaac719ffeddff8082c | api/ServiceClient.go | api/ServiceClient.go | package ninja
import (
"time"
)
type ServiceClient struct {
conn *Connection
topic string
}
//
// OnEvent builds a simple subscriber which supports pulling apart the topic
//
// err := sm.conn.GetServiceClient("$device/:deviceid/channel/:channelid")
// .OnEvent("state", func(params *YourEven... | package ninja
import (
"time"
)
type ServiceClient struct {
conn *Connection
topic string
}
//
// OnEvent builds a simple subscriber which supports pulling apart the topic
//
// err := sm.conn.GetServiceClient("$device/:deviceid/channel/:channelid")
// .OnEvent("state", func(params *YourEven... | Add period to keep grammar nazis and godoc happy. | Add period to keep grammar nazis and godoc happy.
Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com>
| Go | mit | ninjasphere/go-ninja,ninjasphere/go-ninja |
61963d486cf99461b907b8e2970a7f0b74556b10 | cli/layout/modeline.go | cli/layout/modeline.go | package layout
import "github.com/elves/elvish/styled"
// ModePrompt returns a styled text that is suitable as the prompt in the codearea
// of a combobox.
func ModePrompt(content string, space bool) func() styled.Text {
p := styled.MakeText(content, "bold", "lightgray", "bg-magenta")
if space {
p = p.ConcatText(... | package layout
import "github.com/elves/elvish/styled"
// ModePrompt returns a callback suitable as the prompt in the codearea of a
// combobox.
func ModePrompt(content string, space bool) func() styled.Text {
p := styled.MakeText(content, "bold", "lightgray", "bg-magenta")
if space {
p = p.ConcatText(styled.Plai... | Make doc comment of ModeLine more accurate. | cli/layout: Make doc comment of ModeLine more accurate.
| Go | bsd-2-clause | elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish |
3c5e9a32cff19c6abcabbb51c78e4647b8aece29 | lib/objectserver/api.go | lib/objectserver/api.go | package objectserver
import (
"github.com/Symantec/Dominator/lib/hash"
"io"
)
type FullObjectServer interface {
ObjectServer
ListObjectSizes() map[hash.Hash]uint64
ListObjects() []hash.Hash
NumObjects() uint64
}
type ObjectGetter interface {
GetObject(hashVal hash.Hash) (uint64, io.ReadCloser, error)
}
type ... | package objectserver
import (
"github.com/Symantec/Dominator/lib/hash"
"io"
)
type FullObjectServer interface {
DeleteObject(hashVal hash.Hash) error
ObjectServer
ListObjectSizes() map[hash.Hash]uint64
ListObjects() []hash.Hash
NumObjects() uint64
}
type ObjectGetter interface {
GetObject(hashVal hash.Hash) ... | Add DeleteObject() method to lib/objectserver.FullObjectServer interface. | Add DeleteObject() method to lib/objectserver.FullObjectServer interface.
| Go | apache-2.0 | Symantec/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator |
96f278f02752f6849ca2d49d8127178d6d52118e | lib/brain/vlan.go | lib/brain/vlan.go | package brain
import "fmt"
// VLAN is a representation of a VLAN, as used by admin endpoints
type VLAN struct {
ID int `json:"id"`
Num int `json:"num"`
UsageType string `json:"usage_type"`
}
// String serialises a VLAN to easily be output
func (v *VLAN) String() string {
return fmt.Sprintf("%d... | package brain
import "fmt"
// VLAN is a representation of a VLAN, as used by admin endpoints
type VLAN struct {
ID int `json:"id"`
Num int `json:"num"`
UsageType string `json:"usage_type"`
}
// String serialises a VLAN to easily be output
func (v *VLAN) String() string {
return fmt.Sprintf("%d... | Fix String serialisation of VLAN | Fix String serialisation of VLAN
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
c048869595edefaf309e69cff70685c2e25dedd3 | client/error_test.go | client/error_test.go | package client
import (
"testing"
. "github.com/stripe/stripe-go"
)
func TestErrors(t *testing.T) {
c := &Api{}
c.Init("bad_key", nil, nil)
_, err := c.Account.Get()
if err == nil {
t.Errorf("Expected an error")
}
stripeErr := err.(*Error)
if stripeErr.Type != InvalidRequest {
t.Errorf("Type %v does... | package client
import (
"testing"
. "github.com/stripe/stripe-go"
)
func TestErrors(t *testing.T) {
c := &Api{}
c.Init("bad_key", nil, nil)
_, err := c.Account.Get()
if err == nil {
t.Errorf("Expected an error")
}
stripeErr := err.(*Error)
if stripeErr.Type != InvalidRequest {
t.Errorf("Type %v does... | Add a test for the HttpStatusCode field | Add a test for the HttpStatusCode field
| Go | mit | mondough/stripe-go,shazow/stripe-go,dominicphillips/stripe-go,froatsnook/stripe-go,ChannelMeter/stripe-go,stripe/stripe-go,froatsnook/stripe-go,BearchInc/stripe-go,getbread/stripe-go,ryanlower/stripe-go,stripe/stripe-go,gcnonato/stripe-go,hyperworks/stripe-go,collinglass/stripe-go,ChannelMeter/stripe-go,dominicphillips... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.