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
7b3b1531a5c53db83c52dd480ef6d0291b4c0b3b
github/util.go
github/util.go
// +build linux,darwin package github import ( "code.google.com/p/go.crypto/ssh/terminal" ) func isTerminal(fd uintptr) bool { return terminal.IsTerminal(int(fd)) }
// +build !windows package github import ( "code.google.com/p/go.crypto/ssh/terminal" ) func isTerminal(fd uintptr) bool { return terminal.IsTerminal(int(fd)) }
Use not windows build tag
Use not windows build tag
Go
mit
jingweno/gh,beni55/gh,jingweno/gh,beni55/gh,beni55/gh,jingweno/gh
ea85e692cc33c3e474923dfec80a3487c97e8b62
sqlparser/sql_mod.go
sqlparser/sql_mod.go
package sqlparser // Magicify runs the SQL passed in, and a table name, throught a customized // TextQL SQL Parser. This provides the following functionality: // - Queries that do not start with SELECT are implictly mapped to SELECT statements // - Queries that are missing a FROM, have the FROM inserted with tableNa...
package sqlparser // Magicify runs the SQL passed in, and a table name, throught a customized // TextQL SQL Parser. This provides the following functionality: // - Queries that do not start with SELECT are implictly mapped to SELECT statements // - Queries that are missing a FROM, have the FROM inserted with tableNa...
Fix subselect implict from magic
Fix subselect implict from magic
Go
mit
dinedal/textql
10e2bc58c9580ceb456f3f9c92cd222ed48c87df
lib/regions.go
lib/regions.go
package lib // Region on Vultr type Region struct { ID int `json:"DCID,string"` Name string `json:"name"` Country string `json:"country"` Continent string `json:"continent"` State string `json:"state"` } func (c *Client) GetRegions() ([]Region, error) { var regionMap map[string]Region if e...
package lib // Region on Vultr type Region struct { ID int `json:"DCID,string"` Name string `json:"name"` Country string `json:"country"` Continent string `json:"continent"` State string `json:"state"` Ddos bool `json:"ddos_protection"` } func (c *Client) GetRegions() ([]Region, erro...
Add ddos_protection field to Region struct
Add ddos_protection field to Region struct
Go
mit
janeczku/vultr,JamesClonk/vultr,jackmiller334/vultr
2ccd8d7ae0a2e66fc2d6b8f014bef2d7d9237796
memory_test.go
memory_test.go
package gotop import ( "encoding/json" "fmt" "testing" "time" ) func TestMemoryUsage(t *testing.T) { memInfoChan := make(chan MemInfo) go MemoryUsage(memInfoChan, time.Second) iterations := 0 for { memInfo, ok := <-memInfoChan if ok == false || iterations > 3 { break } a, _ := json.Marshal(memInfo)...
package gotop import ( "encoding/json" "fmt" "testing" "time" ) func TestMemoryUsage(t *testing.T) { memInfoChan := make(chan MemInfo) go MemoryUsage(memInfoChan, time.Second) iterations := 0 for { memInfo, ok := <-memInfoChan iterations = iterations + 1 if ok == false || iterations > 3 { break } ...
Fix an issue where TestMemoryUsage() would never finish
Fix an issue where TestMemoryUsage() would never finish
Go
mit
nindalf/gotop
d767399f889dad44213b61e78cd56e0f644cb93c
models/feed.go
models/feed.go
package models import ( "fmt" "golang.org/x/crypto/sha3" "time" ) // Feed is a single source of articles. type Feed struct { ID int64 FolderID int64 Title string Description string URL string Latest time.Time } // Hash returns a SHA256 hash of this object. func (a *Feed) Hash() str...
package models import ( "fmt" "golang.org/x/crypto/sha3" "time" ) // Feed is a single source of articles. type Feed struct { ID int64 FolderID int64 Title string Description string URL string Link string Latest time.Time } // Hash returns a SHA256 hash of this object. func ...
Support an additional Link field in the models.Feed object.
core/models: Support an additional Link field in the models.Feed object.
Go
mit
jrupac/goliath,jrupac/goliath,jrupac/goliath,jrupac/goliath,jrupac/goliath
aa5eca074273f749be16e79a9523548b3431248e
testing/constants.go
testing/constants.go
// Copyright 2012, 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package testing import ( "time" "launchpad.net/juju-core/utils" ) // ShortWait is a reasonable amount of time to block waiting for something that // shouldn't actually happen. (as in, the test suite will *actually* ...
// Copyright 2012, 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package testing import ( "time" "launchpad.net/juju-core/utils" ) // ShortWait is a reasonable amount of time to block waiting for something that // shouldn't actually happen. (as in, the test suite will *actually* ...
Add utopic to supported series
Add utopic to supported series
Go
agpl-3.0
tasdomas/juju,howbazaar/juju,fwereade/juju,dooferlad/juju,axw/juju,cmars/juju,AdamIsrael/juju,mjs/juju,kat-co/juju,makyo/juju,bac/juju,dimitern/juju,alesstimec/juju,marcmolla/juju,alesstimec/juju,marcoceppi/juju,marcoceppi/juju,mhilton/juju,anastasiamac/juju,mjs/juju,makyo/juju,reedobrien/juju,fwereade/juju,frankban/ju...
96f87f0f56540f19aaa486a84bfb592c96b76d74
orm/driver/datastore/doc.go
orm/driver/datastore/doc.go
// Package datastore implements an App Engine datastore driver // the Gondola's ORM. // // This package is only available when building your application using // the App Engine Go SDK. To enable the driver, import its package: // // import ( // _ "gnd.la/orm/driver/datastore" // ) // // Some caveats your need to...
// Package datastore implements an App Engine datastore driver // the Gondola's ORM. // // This package is only available when building your application using // the App Engine Go SDK. To enable the driver, import its package: // // import ( // _ "gnd.la/orm/driver/datastore" // ) // // The URL format for this p...
Add example URL in datastore ORM driver
Add example URL in datastore ORM driver
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
ad50209dd215f6324ec49fc22036af57d8f1e15b
tools/tools.go
tools/tools.go
package tools import ( "log" "strings" "fmt" ) // UploadFile used to upload file by S3 pre-signed URL func UploadFile(path, url string) int { log.Println("Uploading file from path:", path) file, info := prepareFile(path) resp := sendRequest(url, &file, info) return getStatusOfUpload(resp) } // GetFileName ret...
package tools import ( "fmt" "log" "strings" ) // UploadFile used to upload file by S3 pre-signed URL func UploadFile(path, url string) int { log.Println("Uploading file from path:", path) file, info := prepareFile(path) resp := sendRequest(url, &file, info) return getStatusOfUpload(resp) } // GetFileName ret...
Fix gofmt formating for a file
Fix gofmt formating for a file
Go
mit
artemnikitin/devicefarm-ci-tool
0fbff83d68948a1b1834deaad45f2821e0c3bf8a
image/dcmimage_test.go
image/dcmimage_test.go
package image import ( "testing" ) func TestWriteBMP(t *testing.T) { filename := "test.bmp" var di DcmImage di.Columns = 64 di.Rows = 64 di.BitsAllocated = 16 di.BitsStored = 12 di.HighBit = 11 err := di.WriteBMP(filename, 8, 0) if err != nil { t.Errorf("WriteBMP() %s", err.Error()) } }
package image import ( "testing" ) func TestWrite8BMP(t *testing.T) { filename := "8.bmp" var di DcmImage di.Columns = 64 di.Rows = 64 di.BitsAllocated = 8 di.BitsStored = 12 di.HighBit = 11 err := di.WriteBMP(filename, 8, 0) if err != nil { t.Errorf("WriteBMP() %s", err.Error()) } } func TestWrite16B...
Add more test cases for testing write BMP file.
Add more test cases for testing write BMP file.
Go
mit
grayzone/godcm
6cf39801b3b2294491d447a1e9d0ed23050eaba3
cmd/skaffold/app/cmd/completion.go
cmd/skaffold/app/cmd/completion.go
/* Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
/* Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
Add newline at the end of file
Add newline at the end of file
Go
apache-2.0
GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold
dbf57b6e6c282fa7558dd573758795ae91f10154
src/fullerite/collector/nerve_httpd.go
src/fullerite/collector/nerve_httpd.go
package collector import ( "fullerite/metric" l "github.com/Sirupsen/logrus" ) // NerveHTTPD discovers Apache servers via Nerve config // and reports metric for them type NerveHTTPD struct { baseCollector } func init() { RegisterCollector("NerveHTTPD", newNerveHTTPD) } func newNerveHTTPD(channel chan metric.Me...
package collector import ( "fullerite/metric" "time" l "github.com/Sirupsen/logrus" ) // NerveHTTPD discovers Apache servers via Nerve config // and reports metric for them type NerveHTTPD struct { baseCollector configFilePath string queryPath string timeout int statusTTL time.Duration } f...
Add more code for NerveHTTPD collector
Add more code for NerveHTTPD collector
Go
apache-2.0
qnib/QNIBCollect,qnib/QNIBCollect,qnib/QNIBCollect,qnib/QNIBCollect
1f93bea7466fae550349ce1600263c41b8758cb1
crop.go
crop.go
package gifs type Crop struct { X float32 `json:"x,omitempty"` Y float32 `json:"y,omitempty"` Height float32 `json:"height,omitempty"` Width float32 `json:"width,omitempty"` }
package gifs // Crop holds the offsets and final dimensions of the // desired media after cropping. Both X and Y offsets // will tell us where the top-left corner of the cropped // media will be. Then Height and Width can determine the // top-right, bottom-left and bottom-right coordinates. type Crop struct { // X...
Add comments to the Crop struct and fields
Add comments to the Crop struct and fields
Go
mit
gifs/gifs-go
765834d4380829547004dd347382dfd378b3bd04
src/combinatorial/shuffle/shuffle_test.go
src/combinatorial/shuffle/shuffle_test.go
package algoholic import "testing" const BENCHMARK_LENGTH = 10 func TestFisherYatesShufflesEvenly(t *testing.T) { // Set an arbitrary maximum error from expectation - We expect each number to occur within // 0.7% of the probability in a list of length 10 after 1e6 iterations. // TODO: Determine maximum error math...
package algoholic import "testing" const BENCHMARK_LENGTH = 10 func TestFisherYatesShufflesEvenly(t *testing.T) { // Set an arbitrary maximum error from expectation - We expect each number to occur within // 1% of the probability in a list of length 10 after 1e6 iterations. // TODO: Determine maximum error mathem...
Update tests to reflect better seeding.
Update tests to reflect better seeding. We have to lower our expectations a bit.
Go
mit
lorenzo-stoakes/algoholic
2850c39ffbb7e14bf0b4feb192e36930b8e2aa9c
opencv/cxcore_test.go
opencv/cxcore_test.go
package opencv import ( "testing" ) func TestLoadImage2(t *testing.T) { // t.Errorf("aaa") }
package opencv import ( "testing" "fmt" ) func TestContourArea(t *testing.T){ img := CreateImage(100,100,IPL_DEPTH_8U,1) defer img.Release() // Creating object of area 100 shape := []Point{ Point{10,10}, Point{20,10}, Point{20,20}, Point{10,20}, Point{10,10}} for i:=0; i<(len(shape)-1); i++{ Line(...
Create start of testing of cxcore functions
Create start of testing of cxcore functions
Go
bsd-3-clause
mike-ando/go-opencv,mike-ando/go-opencv,mike-ando/go-opencv,mike-ando/go-opencv
0d36314b5179a3251459cba07315a606af06d13a
main/bsearch.go
main/bsearch.go
package main import ( "bsearch/index" "bsearch/ops" "fmt" "os" "flag" ) func usage() { fmt.Fprintf(os.Stderr, "usage: bsearch <path to index blob>\n") flag.PrintDefaults() os.Exit(1) } func main() { flag.Parse() if flag.NArg() != 1 { usage() } dbname := flag.Arg(0) in, err := index.Open(dbname) if er...
package main import ( "bsearch/index" "bsearch/ops" "fmt" "os" "flag" ) func usage() { fmt.Fprintf(os.Stderr, "usage: bsearch <path to index blob>\n") flag.PrintDefaults() os.Exit(1) } func main() { flag.Parse() if flag.NArg() != 1 { usage() } dbname := flag.Arg(0) in, err := index.Open(dbname) if er...
Test that Add actually works.
Test that Add actually works.
Go
isc
art4711/bsearch
0e28ef61a73873d6cfc4df35202d5543b5af10b6
main_test.go
main_test.go
package main import ( "fmt" "testing" ) func mainTester(t *testing.T) { fmt.Println("Howdy buddy") t.Log("one test passed.") }
package main import ( "fmt" "testing" ) func mainTester(t *testing.T) { fmt.Println("Howdy buddy!!!") t.Log("one test passed.") }
Test after run test main
Test after run test main
Go
mit
vassilux/vorimport,vassilux/vorimport,vassilux/vorimport
2f67940fac1b3cbe3106d4ecab9227ec89d58abc
main_test.go
main_test.go
package main import ( "os" "testing" ) func TestMain(m *testing.M) { os.Setenv("FAW_ICONS_YAML_PATH", "workflow/icons.yml") m.Run() }
package main import ( "os" "testing" ) func TestMain(m *testing.M) { os.Setenv("FAW_ICONS_YAML_PATH", "workflow/icons.yml") os.Exit(m.Run()) }
Improve TestMain function for exit code
Improve TestMain function for exit code
Go
mit
ruedap/alfred-font-awesome-workflow,ruedap/alfred-font-awesome-workflow,ruedap/alfred-font-awesome-workflow
e97dffb5547e9b6c67c1feda609d31019876f455
meta/meta.go
meta/meta.go
package meta import "fmt" // GITCOMMIT indicates which git hash the binary was built off of. var GITCOMMIT string // VERSION indicates which version of the binary is running. var VERSION string const majorRelease = "0.3.x" // Version returns the version/commit string. func Version() string { version, commit := VE...
package meta import "fmt" // GITCOMMIT indicates which git hash the binary was built off of. var GITCOMMIT string // VERSION indicates which version of the binary is running. var VERSION string const majorRelease = "0.3.x" // Version returns the version/commit string. func Version() string { version, commit := VE...
Use fallback if one of commit/version are blank (instead of both)
Use fallback if one of commit/version are blank (instead of both)
Go
mit
kshvmdn/fsql
accdcdb92ab2a9205b15aef94cda458c3c1c7912
src/disjoin_set.go
src/disjoin_set.go
package main type DisjoinSet struct { parent []int rank []int } func NewDisjoinSet() *DisjoinSet { return &DisjoinSet{} } func (s *DisjoinSet) Make() int { s.parent = append(s.parent, -1) s.rank = append(s.rank, 0) return len(s.parent) - 1 } func (s *DisjoinSet) Find(x int) int { if s.parent[x] == -1 { r...
package main type DisjoinSet struct { parent []int rank []int } func NewDisjoinSet() *DisjoinSet { return &DisjoinSet{} } func (s *DisjoinSet) Make() int { x := len(s.parent) s.parent = append(s.parent, x) s.rank = append(s.rank, 0) return x } func (s *DisjoinSet) Find(x int) int { if s.parent[x] == x { ...
Use parent[x] == x for root, not -1 as before
Use parent[x] == x for root, not -1 as before
Go
mit
krasin/voxel
14ed737f34b7e993d6bda51aea52ab260fd16cc1
cf/actors/i18n_init.go
cf/actors/i18n_init.go
package actors import ( "github.com/cloudfoundry/cli/cf/i18n" goi18n "github.com/nicksnyder/go-i18n/i18n" ) var T goi18n.TranslateFunc func init() { T = i18n.Init("actors", i18n.GetResourcesPath()) }
package actors import ( "github.com/cloudfoundry/cli/cf/i18n" goi18n "github.com/nicksnyder/go-i18n/i18n" ) var T goi18n.TranslateFunc func init() { T = i18n.Init("actors", i18n.GetResourcesPath()) }
Add newline at end of some random file
Add newline at end of some random file
Go
apache-2.0
markstgodard/cli,ofer43211/cli,saurabhguptasg/cli,srikanth88infy/cli,mcintyred/cli,ReachingOut/cli,saurabhguptasg/cli,nttlabs/cli,carnell69/cli,ReachingOut/cli,diatmpravin/cli,mcowger/cli,Zouuup/cli,nttlabs/cli,kavoj/cli,ofer43211/cli,diatmpravin/cli,cf-routing/cli,18F/cli,saravana76/cli,AmitRoushan/cli,simonleung8/cli...
aa2edfb1a5f4b40ccab7edff9b0371987f0ff518
utils/base62.go
utils/base62.go
package utils func Base62(n uint) string { b62 := "" if n == 0 { return "0" } for n != 0 { r := n % 62 n = n / 62 b62 = string("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[r]) + b62 } return b62 }
package utils const digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" func Base62(n uint) string { b62 := "" if n == 0 { return "0" } for n != 0 { r := n % 62 n = n / 62 b62 = string(digits[r]) + b62 } return b62 }
Use a const for base 62 digits.
Use a const for base 62 digits.
Go
apache-2.0
control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced
a5246f8c166f46e76b5778599d48b1e184046bc0
uuid_test.go
uuid_test.go
package uuid_test import ( "fmt" "github.com/northbright/uuid" ) func ExampleNew() { for i := 0; i < 5; i++ { uuid, _ := uuid.New() fmt.Printf("%v\n", uuid) } // Output }
package uuid_test import ( "fmt" "github.com/northbright/uuid" ) func ExampleNew() { for i := 0; i < 5; i++ { uuid, _ := uuid.New() fmt.Printf("%v\n", uuid) } // Output: }
Fix no test case issue
Fix no test case issue * // Output -> // Output:
Go
mit
northbright/uuid
d505cbe8cb210e2dfae6e3a17d64c7c95eb2394f
log.go
log.go
package web import ( "errors" "fmt" "log" "os" "github.com/deferpanic/deferclient/deferstats" ) var ( dfs *deferstats.Client ) // NewLogger configures defer panic error and starts capturing stats. // It looks for DEFERPANIC_KEY, // DEVERPANIC_ENVIRONMENT and DEFERPANIC_APPGROUP environment vars func NewLogger...
package web import ( "errors" "fmt" "log" "os" "github.com/deferpanic/deferclient/deferstats" ) var ( dfs *deferstats.Client ) // NewLogger configures defer panic error and starts capturing stats. // It looks for DEFERPANIC_KEY, // DEVERPANIC_ENVIRONMENT and DEFERPANIC_APPGROUP environment vars func NewLogger...
Fix bug where global defer stats object was being overwritten
Fix bug where global defer stats object was being overwritten
Go
apache-2.0
GoIncremental/web
3e46977ec15093ff8fcf84bf5d3e339c17a06630
libcontainer/stacktrace/capture_test.go
libcontainer/stacktrace/capture_test.go
package stacktrace import "testing" func captureFunc() Stacktrace { return Capture(0) } func TestCaptureTestFunc(t *testing.T) { stack := captureFunc() if len(stack.Frames) == 0 { t.Fatal("expected stack frames to be returned") } // the first frame is the caller frame := stack.Frames[0] if expected := "ca...
package stacktrace import ( "strings" "testing" ) func captureFunc() Stacktrace { return Capture(0) } func TestCaptureTestFunc(t *testing.T) { stack := captureFunc() if len(stack.Frames) == 0 { t.Fatal("expected stack frames to be returned") } // the first frame is the caller frame := stack.Frames[0] if...
Fix to allow for build in different path
Fix to allow for build in different path The path in the stacktrace might not be: "github.com/opencontainers/runc/libcontainer/stacktrace" For example, for me its: "_/go/src/github.com/opencontainers/runc/libcontainer/stacktrace" so I changed the check to make sure the tail end of the path matches instead of the e...
Go
apache-2.0
adrianreber/runc,wangkirin/runc,albertoleal/runc,sunyuan3/runc,runcom/runc,estesp/runc,opencontainers/runc,nkwilson/runc,justincormack/runc,mikebrow/runc,coolljt0725/runc,jhowardmsft/runc,kolyshkin/runc,dqminh/runc,runcom/runc,mheon/runc,WeiZhang555/runc,adrianreber/runc,mikebrow/runc,maxamillion/runc,docker/runc,alber...
fd3f2e175fa6ddb606d2c681ff86a97faccfebbd
pkg/jsonlog/jsonlog.go
pkg/jsonlog/jsonlog.go
package jsonlog import ( "encoding/json" "fmt" "io" "log" "time" ) type JSONLog struct { Log string `json:"log,omitempty"` Stream string `json:"stream,omitempty"` Created time.Time `json:"time"` } func (jl *JSONLog) Format(format string) (string, error) { if format == "" { return jl.Log, nil }...
package jsonlog import ( "encoding/json" "fmt" "io" "log" "time" ) type JSONLog struct { Log string `json:"log,omitempty"` Stream string `json:"stream,omitempty"` Created time.Time `json:"time"` } func (jl *JSONLog) Format(format string) (string, error) { if format == "" { return jl.Log, nil }...
Change unused WriteCloser to Writer
Change unused WriteCloser to Writer Signed-off-by: Alexandr Morozov <4efb7da3e38416208b41d8021a942884d8a9435c@docker.com>
Go
apache-2.0
rabbitcount/docker,spinolacastro/docker,PatrickLang/moby,laijs/docker,aidanhs/docker,euank/docker,harche/docker,makinacorpus/docker,swasd/baleno,troy0820/docker.github.io,jvgogh/docker,tklauser/docker,moxiegirl/docker,shaded-enmity/docker,clearlinux/docker,msagheer/docker,itsnuwan/docker,yang1992/docker,konstruktoid/do...
650774d360b919b084161723661b5ec12dbac7b7
svn/log.go
svn/log.go
package svn import ( "encoding/xml" "github.com/pkg/errors" ) type Log struct { XMLName xml.Name `xml:"log"` Entries []LogEntry `xml:"logentry"` } type LogEntry struct { *Commit XMLName xml.Name `xml:"logentry"` Paths []Path `xml:"paths>path"` Message string `xml:"msg"` } type Path struct { XMLNam...
package svn import ( "encoding/xml" "github.com/pkg/errors" ) type Log struct { XMLName xml.Name `xml:"log"` Entries []LogEntry `xml:"logentry"` } type LogEntry struct { *Commit XMLName xml.Name `xml:"logentry"` Paths []Path `xml:"paths>path"` Message string `xml:"msg"` } type Path struct { XMLNam...
Add missing path name attribute
Add missing path name attribute
Go
agpl-3.0
jackwilsdon/svnwatch
be6ec3695d430904e5d2992a541ac9007882b259
cmd/resumic/main.go
cmd/resumic/main.go
package main import ( "flag" "github.com/resumic/schema/cmd/resumic/validate" ) func main() { var doc string flag.StringVar(&doc, "doc", "../../examples/invalid/invalid_email.json", "Example file") flag.Parse() validate.ValidateJSON(doc) }
package main import ( "encoding/json" "flag" "fmt" "log" "os" "github.com/erbesharat/schema/schema" "github.com/resumic/schema/cmd/resumic/validate" ) func main() { var doc string var schemaFile string flag.StringVar(&doc, "doc", "../../examples/invalid/invalid_email.json", "Example file") flag.StringVar(...
Add subcommand for generating schema.json file
Add subcommand for generating schema.json file
Go
apache-2.0
resumic/schema,resumic/schema
9846aecd66154be474d74c8108cf896d7c940f70
interfaces.go
interfaces.go
// Copyright 2015 Mathieu MAST. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. package container import ( "reflect" ) type Container interface { Add(interface{}) error GetSize() int Search(interface{}) (interface{}, error) Remove(inter...
// Copyright 2015 Mathieu MAST. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. package container import ( "reflect" ) type Container interface { Add(interface{}) error GetSize() int Search(interface{}) (interface{}, error) Remove(inter...
Add ToArrayOfType & Visit methods
Add ToArrayOfType & Visit methods
Go
mit
goloc/container
77205cc922eb8f68e1804bdd593273d50cc86a71
file.go
file.go
package main import ( "github.com/codegangsta/cli" "os" "path" ) type File struct { ImdbID string Format string FileName string FullPath string } func (f *File) IsValid() bool { return f.ImdbID != "" && f.Present() } // Is the file is present on disk func (f *File) Present() bool { return fileExists(f....
package main import ( "github.com/codegangsta/cli" "os" "path" ) type File struct { ImdbID string Format string FileName string FullPath string } func (f *File) IsValid() bool { return f.ImdbID != "" && f.Present() } // Present checks to see if the file is present on disk. func (f *File) Present() bool ...
Add go doc style comment
Add go doc style comment
Go
mit
dillonhafer/imdb-tags,dillonhafer/imdb-tags
b6e805835a546d7481bc6f184f174ae5b6d040c6
getshell_test.go
getshell_test.go
package shell import ( "bytes" "fmt" "os" "testing" ) func TestCat(t *testing.T) { myShell, err := NewShell() if err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) os.Exit(1) } reader, err := myShell.Cat("QmQLBvJ3ur7U7mzbYDLid7WkaciY84SLpPYpGPHhDNps2Y") if err != nil { fmt.Fprintf(os.Stderr, "err...
package shell import ( "bytes" "fmt" "os" "testing" ) func TestCat(t *testing.T) { myShell, err := NewShell() if err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) os.Exit(1) } reader, err := myShell.Cat("QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y") if err != nil { fmt.Fprintf(os.Stderr, "err...
Make getshell test more reliable.
Make getshell test more reliable. This test now uses the 'contact' doc from the standard asset set. While still not guaranteed to be present, this is a significant improvement from the previous ad-hoc test document, which required it be manually added to the local repo ahead of time.
Go
mit
noffle/fallback-ipfs-shell
a4e62e9e7f24b4a1e12602fbcdb12c8aa5070536
aws/ec2/availability_zone_retriever.go
aws/ec2/availability_zone_retriever.go
package ec2 import ( "errors" goaws "github.com/aws/aws-sdk-go/aws" awsec2 "github.com/aws/aws-sdk-go/service/ec2" ) type AvailabilityZoneRetriever struct { ec2ClientProvider ec2ClientProvider } func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever { return Availabili...
package ec2 import ( "errors" goaws "github.com/aws/aws-sdk-go/aws" awsec2 "github.com/aws/aws-sdk-go/service/ec2" ) type AvailabilityZoneRetriever struct { ec2ClientProvider ec2ClientProvider } func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever { return Availabili...
Revert "Fix bbl up for AWS"
Revert "Fix bbl up for AWS" This reverts commit 94599faddf4921e2ad53ffe47755b4b89ebd3a41. [#139857703] Signed-off-by: Christian Ang <15ae83feccf4d84083a62aba1cdf46bd8ce2e33b@pivotal.io>
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader,niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader
e44ef868c4de558aec010c062891422ffa4320a2
pkg/ssh/prompt_test.go
pkg/ssh/prompt_test.go
package ssh import ( "testing" ) func TestAddPrompterVariablesNoPrompter(t *testing.T) { if e, err := addPrompterVariables([]string{"SSH_ASKPASS=someprogram"}, ""); err != nil { t.Fatal("failed to set prompter environment variables:", err) } else if len(e) != 0 { t.Error("SSH_ASKPASS environment variable not r...
package ssh import ( "testing" ) func TestAddPrompterVariablesNoPrompter(t *testing.T) { if e, err := setPrompterVariables([]string{"SSH_ASKPASS=someprogram"}, ""); err != nil { t.Fatal("failed to set prompter environment variables:", err) } else if len(e) != 0 { t.Error("SSH_ASKPASS environment variable not r...
Fix rename issue with SSH tests.
Fix rename issue with SSH tests. This commit fixes our SSH test breakage due to the renaming of addPrompterVariables to setPrompterVariables.
Go
mit
havoc-io/mutagen,havoc-io/mutagen
ff16eda59f1a5f937519ec5d330120a594860512
pkg/eval/exc/exc_test.go
pkg/eval/exc/exc_test.go
package exc import ( "testing" "github.com/elves/elvish/pkg/eval" ) var That = eval.That func TestExc(t *testing.T) { setup := func(ev *eval.Evaler) { ev.Global.AddNs("exc", Ns) } eval.TestWithSetup(t, setup, // Have a simple sanity test that exc:show writes something. That(`exc:show ?(fail foo) | > (count ...
package exc import ( "testing" "github.com/elves/elvish/pkg/eval" ) var That = eval.That func TestExc(t *testing.T) { setup := func(ev *eval.Evaler) { ev.Global.AddNs("exc", Ns) } eval.TestWithSetup(t, setup, // Have a simple sanity test that exc:show writes something. That(`exc:show ?(fail foo) | > (count ...
Add missing unit tests for exc:is-pipeline-exc.
pkg/eval/exc: Add missing unit tests for exc:is-pipeline-exc.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
955d11a182cf9d78b86de81be34e53103a02b04c
macExcel_test.go
macExcel_test.go
package xlsx import ( "testing" ) func TestMacExcel(t *testing.T) { xlsxFile, error := OpenFile("macExcelTest.xlsx") if error != nil { t.Error(error.Error()) return } if xlsxFile == nil { t.Error("OpenFile returned nil FileInterface without generating an os.Error") return } s := xlsxFile.Sheets[0].Cell...
package xlsx import ( "testing" ) // Test that we can successfully read an XLSX file generated by // Microsoft Excel for Mac. In particular this requires that we // respect the contents of workbook.xml.rels, which maps the sheet IDs // to their internal file names. func TestMacExcel(t *testing.T) { xlsxFile, error...
Add docstring to TestMacExcel test function.
Add docstring to TestMacExcel test function.
Go
bsd-3-clause
ryho/xlsx
80a1a84ffc3bdb55e92d9443aad4e11e3f772ff0
monitoring/os.go
monitoring/os.go
// +build !linux /* Copyright 2017 Gravitational, Inc. 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...
// +build !linux /* Copyright 2017 Gravitational, Inc. 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 missing dependency on darwin
Add missing dependency on darwin
Go
apache-2.0
gravitational/satellite,gravitational/satellite
0fb6a6b28dc26ff9539650920895b55bd900bb99
container/lxd/lxdclient/conn.go
container/lxd/lxdclient/conn.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build go1.3 package lxdclient import ( "github.com/juju/errors" "github.com/lxc/lxd" ) // Client is a high-level wrapper around the LXD API client. type Client struct { raw rawClientWrapper namespace string } ...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build go1.3 package lxdclient import ( "github.com/juju/errors" "github.com/lxc/lxd" ) // Client is a high-level wrapper around the LXD API client. type Client struct { raw rawClientWrapper namespace string r...
Add "remote" field to lxdclient.Config.
Add "remote" field to lxdclient.Config.
Go
agpl-3.0
bz2/juju,perrito666/juju,mikemccracken/juju,makyo/juju,dooferlad/juju,bogdanteleaga/juju,dooferlad/juju,frankban/juju,marcmolla/juju,AdamIsrael/juju,axw/juju,waigani/juju,waigani/juju,reedobrien/juju,bac/juju,waigani/juju,waigani/juju,mjs/juju,mikemccracken/juju,ericsnowcurrently/juju,voidspace/juju,gabriel-samfira/juj...
715564d057e14cd2c2bcccce60ebd74a2befe02e
internal/vm/fuzz.go
internal/vm/fuzz.go
// Copyright 2011 Google Inc. All Rights Reserved. // This file is available under the Apache license. // +build gofuzz package vm import ( "bytes" ) func Fuzz(data []byte) int { if _, err := Compile("fuzz", bytes.NewReader(data), false, false, false, nil); err != nil { return 0 } return 1 }
// Copyright 2011 Google Inc. All Rights Reserved. // This file is available under the Apache license. // +build gofuzz package vm import ( "bytes" ) func Fuzz(data []byte) int { // We need to successfully parse flags to initialize the glog logger used // by the compiler, but the fuzzer gets called with flags ca...
Initialize the flags so that the glogger doesn't log that we haven't done so, but try to avoid intercepting the libFuzzer main's flags.
Initialize the flags so that the glogger doesn't log that we haven't done so, but try to avoid intercepting the libFuzzer main's flags. Issue #256
Go
apache-2.0
google/mtail,SuperQ/mtail,SuperQ/mtail,google/mtail
8db61c9870a31f416e68a4b9227a24575937efd2
generator/random_name.go
generator/random_name.go
package generator import ( "strconv" "github.com/adam-hanna/randomstrings" "github.com/onsi/ginkgo/config" ) func randomName() string { str, err := randomstrings.GenerateRandomString(20) if err != nil { panic(err) } return str } func PrefixedRandomName(prefixName, resourceName string) string { return pre...
package generator import ( "strconv" uuid "github.com/nu7hatch/gouuid" "github.com/onsi/ginkgo/config" ) func randomName() string { guid, err := uuid.NewV4() if err != nil { panic(err) } return guid.String() } func PrefixedRandomName(prefixName, resourceName string) string { return prefixName + "-" + str...
Revert "Use a better random string generator"
Revert "Use a better random string generator" This reverts commit d7716de8d098ea2832a67fda27fda34556da9b93. Signed-off-by: Alvaro Perez-Shirley <d5000c5ec3097613a224bab22ba8fc2a47fdc5ca@pivotal.io>
Go
apache-2.0
cloudfoundry-incubator/cf-test-helpers,cloudfoundry-incubator/cf-test-helpers
d2aecce5d5967012550490d4c30aa1aa01db7656
go/roman-numerals/roman_numerals.go
go/roman-numerals/roman_numerals.go
package romannumerals import "errors" func ToRomanNumeral(input int) (string, error) { if input <= 0 { return "", errors.New("input must be greater than 0") } else if input > 3000 { return "", errors.New("input must be less than or equal to 3000") } output := convertDigitToRomanNumeral(input) return output, ...
package romannumerals import ( "errors" ) func ToRomanNumeral(input int) (output string, err error) { if input <= 0 { return "", errors.New("input must be greater than 0") } else if input > 3000 { return "", errors.New("input must be less than or equal to 3000") } numerator := input denominator := 1000 fo...
Use divmod to determine the significance of each digit
Use divmod to determine the significance of each digit
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
d1789be33e3535b381d7e2700b45b3d5499b4ee6
collector/interrupts_common.go
collector/interrupts_common.go
// Copyright 2015 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
// Copyright 2015 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
Fix compilation on OS X
Fix compilation on OS X As OS X doesn't have it's own interrupts provider, don't build interrupts_common on OS X as well. Otherwise build fails, because interrupts_common depends on variables provided by platform-specific files. Signed-off-by: Pavel Borzenkov <073b1820d4178210f16262dddeb2ba44fb7467d3@gmail.com>
Go
apache-2.0
cbstewart9393/node_exporter,siavashs/node_exporter,mslocrian/flexswitch_exporter,fefelovgroup/node_exporter,prometheus/node_exporter,siavashs/node_exporter,chosenken/node_exporter,bs-github/node_exporter,knweiss/node_exporter,derekmarcotte/node_exporter,derekmarcotte/node_exporter,mslocrian/flexswitch_exporter,chosenke...
d884bcc1848360e1996d301669efa72f603af823
server/language_pool.go
server/language_pool.go
package server import ( "errors" "sync" "time" ) type LanguagePool struct { mutex sync.RWMutex languages map[string]*Language } func NewLanguagePool() *LanguagePool { p := new(LanguagePool) p.languages = make(map[string]*Language) return p } func (lp *LanguagePool) Add(l *Language) error { lp.mutex.Loc...
package server import ( "sync" "time" ) type LanguagePool struct { mutex sync.Mutex languages map[string]*Language } func NewLanguagePool() *LanguagePool { p := new(LanguagePool) p.languages = make(map[string]*Language) return p } func (lp *LanguagePool) Remove(l *Language) { lp.mutex.Lock() defer lp.m...
Use mutex instead of RWMutex in language
Use mutex instead of RWMutex in language
Go
mit
MStoykov/mazungumzo
491cfff74ed9b21fc6db57e24e4d26edea170696
sodium/utils.go
sodium/utils.go
package sodium import "fmt" import "unsafe" // #include <stdio.h> // #include <sodium.h> import "C" func MemZero(buff1 []byte) { if len(buff1) > 0 { C.sodium_memzero(unsafe.Pointer(&buff1[0]), C.size_t(len(buff1))) } } func MemCmp(buff1, buff2 []byte, length int) int { if length >= len(buff1) || length >= len(...
package sodium import "fmt" import "unsafe" // #include <stdio.h> // #include <sodium.h> import "C" func MemZero(buff1 []byte) { if len(buff1) > 0 { C.sodium_memzero(unsafe.Pointer(&buff1[0]), C.size_t(len(buff1))) } } func MemCmp(buff1, buff2 []byte, length int) int { if length >= len(buff1) || length >= len(...
Fix Bin2hex: the length has to include the trailing \0
Fix Bin2hex: the length has to include the trailing \0
Go
isc
GoKillers/libsodium-go,GoKillers/libsodium-go
488d3581c187cc3a6151232202d484575f7fdec5
plugins/inputs/all/all.go
plugins/inputs/all/all.go
package all import ( _ "github.com/SpirentOrion/metrics-service/telegraf/plugins/inputs/cloudstress_agent_consumer" _ "github.com/SpirentOrion/metrics-service/telegraf/plugins/inputs/cloudstress_host_consumer" )
package all import ( _ "github.com/SpirentOrion/metrics-service/telegraf/plugins/inputs/cloudstress_agent_consumer" _ "github.com/SpirentOrion/metrics-service/telegraf/plugins/inputs/host_agent_consumer" )
Rename cloudstress agent consumer plugin to host agent consumer plugin
Rename cloudstress agent consumer plugin to host agent consumer plugin
Go
mit
SpirentOrion/telegraf,SpirentOrion/telegraf,SpirentOrion/telegraf,SpirentOrion/telegraf
2106e0fa6a6d245a6f5a1f65a67849987eacfabc
internal/devicescale/impl_js.go
internal/devicescale/impl_js.go
// Copyright 2018 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 2018 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...
Use devicePixelRatio property for go2cpp
devicescale: Use devicePixelRatio property for go2cpp
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
c46a983c3819e0eb5cfcffdd4cad5707fe7ff48e
search/search_test.go
search/search_test.go
package search_test import ( "testing" "github.com/wasanx25/sreq/search" ) func TestNew(t *testing.T) { actual := search.New("testK", "testS") if actual.Keyword != "testK" { t.Errorf("expected=%q, got=%q", "testK", actual.Keyword) } if actual.Sort != "testS" { t.Errorf("expected=%q, got=%q", "testS", actu...
package search_test import ( "testing" "github.com/wasanx25/sreq/search" ) func TestNew(t *testing.T) { actual := search.New("testK", "testS") if actual.Keyword != "testK" { t.Errorf("expected=%q, got=%q", "testK", actual.Keyword) } if actual.Sort != "testS" { t.Errorf("expected=%q, got=%q", "testS", actu...
Add search get url test
Add search get url test
Go
apache-2.0
wataru0225/sreq
54150cb6ae8a96d139c21723df3754616d8b1ac5
core/api-client.go
core/api-client.go
package core import ( "io/ioutil" "net" "net/http" ) var ( // HTTP stuff tr *http.Transport client *http.Client ) // Custom dial for Docker unix socket func unixSocketDial(proto, addr string) (conn net.Conn, err error) { return net.Dial("unix", DGConfig.Docker.UnixSocketPath) } /* Initialize API Client ...
package core import ( "io/ioutil" "net" "net/http" ) var ( // HTTP stuff tr *http.Transport client *http.Client ) // Custom dial for Docker unix socket func unixSocketDial(proto, addr string) (conn net.Conn, err error) { return net.Dial("unix", DGConfig.Docker.UnixSocketPath) } /* Initialize API Client ...
Change http client request body verbose level
Change http client request body verbose level
Go
mit
90TechSAS/docker-guard-probe,90TechSAS/docker-guard-probe
6bcf463b019461454fb2164b725ad343b42bc386
client_windows_test.go
client_windows_test.go
/* Copyright The containerd Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
/* Copyright The containerd 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...
Move to sha-specified test image for nanoserver
Move to sha-specified test image for nanoserver Signed-off-by: Phil Estes <dbac1f450dc8326caa7ba104b384a0eca642250c@linux.vnet.ibm.com>
Go
apache-2.0
mikebrow/containerd,thaJeztah/containerd,dmcgowan/containerd,estesp/containerd,vdemeester/containerd,vdemeester/containerd,estesp/containerd,dmcgowan/containerd,thaJeztah/containerd,crosbymichael/containerd,containerd/containerd,crosbymichael/containerd,mikebrow/containerd,containerd/containerd
466fb374065b9e1e7318d8a0a41f691cf05a5751
stream/notifs.go
stream/notifs.go
package stream import "github.com/synapse-garden/sg-proto/store" // Removed is a notification Resourcer that can inform a user they have // been removed from the Stream without informing them of any other // information about the Stream. type Removed string // Resource implements Resourcer.Resource on Removed. func ...
package stream import "github.com/synapse-garden/sg-proto/store" // Removed is a notification Resourcer that can inform a user they have // been removed from the Stream without informing them of any other // information about the Stream. type Removed string // Resource implements Resourcer.Resource on Removed. func ...
Make stream connection events more specific
Make stream connection events more specific
Go
agpl-3.0
synapse-garden/sg-proto
ee7d6544c7406ae92002c17e567f838384cc1fd1
compression.go
compression.go
package kafka var codecs = make(map[int8]CompressionCodec) // RegisterCompressionCodec registers a compression codec so it can be used by a Writer. func RegisterCompressionCodec(codec func() CompressionCodec) { c := codec() codecs[c.Code()] = c } // CompressionCodec represents a compression codec to encode and dec...
package kafka import "sync" var codecs = make(map[int8]CompressionCodec) var codecsMutex sync.RWMutex // RegisterCompressionCodec registers a compression codec so it can be used by a Writer. func RegisterCompressionCodec(codec func() CompressionCodec) { c := codec() codecsMutex.Lock() codecs[c.Code()] = c codecs...
Add mutex on codecs map
Add mutex on codecs map
Go
mit
segmentio/kafka-go
c2d8a81138be3bf77f0019bd91b68dabb8099f8c
cmd/status.go
cmd/status.go
package cmd import ( "fmt" "net/http" "os" "github.com/spf13/cobra" ) // statusCmd represents the status command var statusCmd = &cobra.Command{ Use: "status", Short: "Check if the HTTP server is running", Long: `Check if the HTTP server has been started and answer 200 for /status.`, Run: func(cmd *cobra....
package cmd import ( "fmt" "net/http" "os" "github.com/spf13/cobra" ) // statusCmd represents the status command var statusCmd = &cobra.Command{ Use: "status", Short: "Check if the HTTP server is running", Long: `Check if the HTTP server has been started and answer 200 for /status.`, Run: func(cmd *cobra....
Use `== ""` instead of `len() == 0`
Use `== ""` instead of `len() == 0`
Go
agpl-3.0
nono/cozy-stack,sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,sebn/cozy-stack,nono/cozy-stack,sebn/cozy-stack,nono/cozy-stack,sebn/cozy-stack
e7b6c143052f6ca99c13a2eb07aebc3250cbe9bf
suite/suite_order_test.go
suite/suite_order_test.go
package suite import ( "strings" "testing" "github.com/stretchr/testify/assert" ) type CallOrderSuite struct { Suite callOrder []string } func (s *CallOrderSuite) call(method string) { // s.Mutex.Lock() // defer s.Mutex.Unlock() s.callOrder = append(s.callOrder, method) } func TestSuiteCallOrder(t *testin...
package suite import ( "math/rand" "strings" "testing" "time" "github.com/stretchr/testify/assert" ) type CallOrderSuite struct { Suite callOrder []string } func (s *CallOrderSuite) call(method string) { time.Sleep(time.Duration(rand.Intn(300)) * time.Millisecond) s.callOrder = append(s.callOrder, method) ...
Remove parallel as that makes goroutines deadlock
Remove parallel as that makes goroutines deadlock
Go
mit
stretchr/testify,stretchr/testify
bde8802a3307899222a765a6ad484deee82d811e
rest/tests/client/server_client_test.go
rest/tests/client/server_client_test.go
package clienttest import ( check "gopkg.in/check.v1" "github.com/radanalyticsio/oshinko-cli/rest/version" "github.com/radanalyticsio/oshinko-cli/rest/helpers/info" "os" ) func (s *OshinkoRestTestSuite) TestServerInfo(c *check.C) { resp, _ := s.cli.Server.GetServerInfo(nil) val := os.Getenv("OSHINKO_CLUSTER_I...
package clienttest import ( check "gopkg.in/check.v1" "github.com/radanalyticsio/oshinko-cli/rest/version" "github.com/radanalyticsio/oshinko-cli/rest/helpers/info" "os" ) func (s *OshinkoRestTestSuite) TestServerInfo(c *check.C) { val := os.Getenv("OSHINKO_CLUSTER_IMAGE") os.Setenv("OSHINKO_CLUSTER_IMAGE", ""...
Modify env var before request in server test
Modify env var before request in server test
Go
apache-2.0
radanalyticsio/oshinko-cli,tmckayus/oshinko-cli,tmckayus/oshinko-cli,crobby/oshinko-cli,tmckayus/oshinko-cli,crobby/oshinko-cli,crobby/oshinko-cli,radanalyticsio/oshinko-cli,radanalyticsio/oshinko-cli
5d66fa46e201e4989964815561a47ca484df33a2
tardeploy/monitor/watch.go
tardeploy/monitor/watch.go
package monitor import ( "time" log "github.com/sirupsen/logrus" ) func Watch(directory string, deployments chan<- string) { done := make(chan bool) defer close(done) watcher, err := NewBatcher(5 * time.Second) if err != nil { log.Fatal(err) } if err != nil { log.Fatal(err) } defer watcher.Close() g...
package monitor import ( "time" log "github.com/sirupsen/logrus" ) func Watch(directory string, batchInterval int, deployments chan<- string) { done := make(chan bool) defer close(done) log.Infof("Starting watcher with a batch interval of %ds", batchInterval) watcher, err := NewBatcher(time.Duration(batchInt...
Add parameter for batch interval
Add parameter for batch interval
Go
apache-2.0
sascha-andres/tardeploy
b626ae0970435eea693fe09fb5d4000039a01b90
amazon-ebs-mock/builder_test.go
amazon-ebs-mock/builder_test.go
package amazonebsmock import ( "fmt" "testing" ) func TestPrepare(t *testing.T) { builder := new(Builder) str, _ := builder.Prepare() fmt.Println(str) }
package amazonebsmock import ( "github.com/Horgix/packer-builder-amazon-ebs-mock/packer-lib-mock" "log" "testing" ) // TODO : This test could be improved, but since this method does absolutely // nothing except initializing rand, and this is complicated to test, it hasn't // been done. Feel free to improve it! fun...
Add a first basic test to the Run() method
Add a first basic test to the Run() method
Go
mpl-2.0
Horgix/packer-builder-amazon-ebs-mock,Horgix/packer-builder-amazon-ebs-mock
686cf12e54030e5f80e66f125d13e1346e6bf1ac
binding/binding_test.go
binding/binding_test.go
package binding import ( "testing" "time" "github.com/stretchr/testify/require" ) func TestParseTimeErrorParsing(t *testing.T) { r := require.New(t) _, err := parseTime([]string{"this is sparta"}) r.Error(err) } func TestParseTime(t *testing.T) { r := require.New(t) tt, err := parseTime([]string{"2017-01-01...
package binding import ( "testing" "time" "github.com/stretchr/testify/require" ) func TestParseTimeErrorParsing(t *testing.T) { r := require.New(t) _, err := parseTime([]string{"this is sparta"}) r.Error(err) } func TestParseTime(t *testing.T) { r := require.New(t) testCases := []struct { input str...
Add test cases for binding parseTime
Add test cases for binding parseTime
Go
mit
gobuffalo/buffalo,markbates/buffalo,gobuffalo/buffalo
a0a47c6570e18e8f151989fc8f2af3c9436c42b7
plugin/pkg/admission/deny/admission_test.go
plugin/pkg/admission/deny/admission_test.go
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Improve the code coverage of /plugin/pkg/admission/deny
Improve the code coverage of /plugin/pkg/admission/deny
Go
apache-2.0
YuPengZTE/kubernetes,liggitt/kubernetes,timoreimann/kubernetes,sarat-k/kubernetes,HardySimpson/kubernetes,JulienBalestra/kubernetes,jianhuiz/kubernetes,apcera/kubernetes,koep/kubernetes,stu-gott/kubernetes,yuexiao-wang/kubernetes,maisem/kubernetes,olivierlemasle/kubernetes,intelsdi-x/kubernetes,cheapRoc/kubernetes,mica...
3864c09589044f3fdd54441069032276095a2f87
dos/ansicfile/ansicfile_test.go
dos/ansicfile/ansicfile_test.go
package ansicfile import "testing" func TestOpen(t *testing.T) { fp, err := Open("あ", "w") if err == nil { Putc(byte('1'), fp) Close(fp) } else { t.Fatalf("NG: Open(\"あ\") Failed by %s", err.Error()) } fp, err = Open("*", "w") if err == nil { t.Fatalf("NG: Open(\"*\") should failed") } else { print("...
package ansicfile import "testing" func TestOpen(t *testing.T) { fp, err := Open("あ", "w") if err == nil { fp.Putc(byte('1')) fp.Close() } else { t.Fatalf("NG: Open(\"あ\") Failed by %s", err.Error()) } fp, err = Open("*", "w") if err == nil { t.Fatalf("NG: Open(\"*\") should failed") } else { print("...
Update test for last version of ansicfile
Update test for last version of ansicfile
Go
bsd-3-clause
tsuyoshicho/nyagos,nocd5/nyagos,tyochiai/nyagos,zetamatta/nyagos
40a61c28e7a6fdc3a157fffad804502081c1027f
cmd/crank/main.go
cmd/crank/main.go
package main import ( "../../pkg/netutil" "flag" "log" "syscall" ) var ( addr string conf string ) func init() { flag.StringVar(&addr, "addr", "", "external address to bind (e.g. 'tcp://:80')") flag.StringVar(&conf, "conf", "", "path to the process config file") } func main() { flag.Parse() // TODO: If r...
package main import ( "../../pkg/netutil" "flag" "log" "os" "syscall" ) var ( addr string conf string ) func init() { flag.StringVar(&addr, "addr", os.Getenv("CRANK_ADDR"), "external address to bind (e.g. 'tcp://:80')") flag.StringVar(&conf, "conf", os.Getenv("CRANK_CONF"), "path to the process config file"...
Allow to pass crank opts as environment variables
Allow to pass crank opts as environment variables
Go
mit
pusher/crank,pusher/crank,pusher/crank
9668049fa85fcd9bff11a229be29baad24d7d8ce
riff-cli/global/riff_version.go
riff-cli/global/riff_version.go
/* * Copyright 2018 the original author or 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 ...
/* * Copyright 2018 the original author or 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 ...
Use latest for function invoker version
Use latest for function invoker version
Go
apache-2.0
markfisher/sk8s,markfisher/sk8s,markfisher/sk8s,markfisher/sk8s
625b045b689c18f29adee606047ab54eb7a502f8
test/utils/test_db.go
test/utils/test_db.go
package utils import ( "fmt" "os" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) // TestDB initialize a db for testing func TestDB() *gorm.DB { dbuser, dbpwd, dbname := "qor", "qor", "qor_test" if os.Getenv("TEST_ENV") == "CI" { dbuser, dbpwd = os.Getenv("DB_USER"), os....
package utils import ( "fmt" "os" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) // TestDB initialize a db for testing func TestDB() *gorm.DB { dbuser, dbpwd, dbname := "qor", "qor", "qor_test" if os.Getenv("TEST_ENV") == "CI" { dbuser, dbpwd = os.Getenv("DB_USER"), os....
Fix GORM v1 compile error
Fix GORM v1 compile error
Go
mit
qor/qor,qor/qor,qor/qor
45654876e6fc61a66e02a02b8c92b20162e874c3
configuration.go
configuration.go
package main import ( "encoding/json" "fmt" "github.com/imdario/mergo" "io/ioutil" ) // Configuration is the configuration type type Configuration struct { Environment Environments map[string]Environment `json:"environments"` } // Load open, read and parse the given configuration file func Load(filename string...
package main import ( "encoding/json" "fmt" "github.com/imdario/mergo" "io/ioutil" ) // Configuration is the configuration type type Configuration struct { Environment Environments map[string]Environment `json:"environments"` } // Load open, read and parse the given configuration file func Load(filename string...
Fix the Configuration.Env to follow the breaking-change of the mergo library
Fix the Configuration.Env to follow the breaking-change of the mergo library
Go
unlicense
rsterbin/rambler,elwinar/rambler
399f1c20e0fccaec8c40ccb4ba1e6fca7c6e29fd
builtin/providers/aws/import_aws_cloudfront_distribution_test.go
builtin/providers/aws/import_aws_cloudfront_distribution_test.go
package aws import ( "testing" "github.com/hashicorp/terraform/helper/resource" ) func TestAccCloudFrontDistribution_importBasic(t *testing.T) { resourceName := "aws_cloudfront_distribution.s3_distribution" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAc...
package aws import ( "testing" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) { resourceName := "aws_cloudfront_distribution.s3_distribution" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: tes...
Rename the Basic Import test for CloudFront distributions
provider/aws: Rename the Basic Import test for CloudFront distributions
Go
mpl-2.0
niclic/terraform,markpeek/terraform,crunchywelch/terraform,kristinn/terraform,paultyng/terraform,yanndegat/terraform,hngkr/terraform,GrayCoder/terraform,mafrosis/terraform,BobVanB/terraform,tommynsong/terraform,GannettDigital/terraform,apparentlymart/terraform,huydinhle/terraform,rrudduck/terraform,TimeIncOSS/terraform...
1a44936a957c4b0075194a869895a24bae32117b
cmd/kubectl-gke-exec-auth-plugin/main.go
cmd/kubectl-gke-exec-auth-plugin/main.go
package main import ( "encoding/json" "fmt" "github.com/spf13/pflag" "k8s.io/cloud-provider-gcp/cmd/kubectl-gke-exec-auth-plugin/provider" "k8s.io/component-base/version/verflag" ) func main() { pflag.Parse() verflag.PrintAndExitIfRequested() ec, err := provider.ExecCredential() if err != nil { msg := fm...
package main import ( "encoding/json" "fmt" "github.com/spf13/pflag" "k8s.io/cloud-provider-gcp/cmd/kubectl-gke-exec-auth-plugin/provider" "k8s.io/component-base/version/verflag" ) func main() { pflag.Parse() verflag.PrintAndExitIfRequested() ec, err := provider.ExecCredential() if err != nil { msg := fm...
Handle error message from json formatting.
Handle error message from json formatting.
Go
apache-2.0
kubernetes/cloud-provider-gcp,kubernetes/cloud-provider-gcp
1261340aea12cf23543d327cc1082febc4a282de
pkg/apis/pipeline/v1alpha1/types_test.go
pkg/apis/pipeline/v1alpha1/types_test.go
/* Copyright 2019 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 2019 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...
Make sure v1alpha1.Condition satisfy webhook.GenericCRD ⚙
Make sure v1alpha1.Condition satisfy webhook.GenericCRD ⚙ This makes Condition consistent with the rest of the CRDs defined by tektoncd/pipeline. Signed-off-by: Vincent Demeester <b98c0fd48a8945096c766de790fe70420dd2f223@redhat.com>
Go
apache-2.0
tektoncd/pipeline,tektoncd/pipeline
95e9a4992456502ec4386f310bc56e0bb64aa262
pkg/kubeconfig/templates.go
pkg/kubeconfig/templates.go
package kubeconfig import "html/template" const ( tokenTemplateText = `apiVersion: v1 kind: Config clusters: {{- range .Nodes}} - name: "{{.ClusterName}}" cluster: server: "{{.Server}}" {{- if ne .Cert "" }} certificate-authority-data: "{{.Cert}}" {{- end }} {{- end}} users: - name: "{{.User}}" user: ...
package kubeconfig import "html/template" const ( tokenTemplateText = `apiVersion: v1 kind: Config clusters: {{- range .Nodes}} - name: "{{.ClusterName}}" cluster: server: "{{.Server}}" {{- if ne .Cert "" }} certificate-authority-data: "{{.Cert}}" {{- end }} {{- end}} users: - name: "{{.ClusterName}}" u...
Use ClusterName for KubeConfig User's name
Use ClusterName for KubeConfig User's name Currently the user name is always the same for every config you generate (`u-xxxxx`), so the kubeconfigs for 2 clusters cannot be merged together. Instead, Generate kubeconfigs with the User, Context, and Cluster name all set to the cluster `name`, so that the configs of any...
Go
apache-2.0
cjellick/rancher,cjellick/rancher,rancherio/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,cjellick/rancher,rancher/rancher
3c0fe2d3bfa96f65da18b63a2aec34a84b32dc62
flag_test.go
flag_test.go
package configeur import ( "fmt" "testing" ) func TestFlags(t *testing.T) { f := Flag{ args: []string{"exec", "--x=2", "--y=four five six seven"}, } if v, _ := f.String("x"); v != "2" { fmt.Println(v) t.Fail() } if v, _ := f.String("y"); v != "four five six seven" { fmt.Println(v) t.Fail() } }
package configeur import ( "testing" ) func TestFlagStrings(t *testing.T) { f, ff := createFlag(t, "--x=hello", `--z=hello world`, "--y=22") test(value(f.String("x")), "hello", ff) test(value(f.String("z")), "hello world", ff) test(value(f.String("y")), "22", ff) } func TestFlagsInts(t *testing.T) { f, ff := ...
Add updated testing for Flag using the new suite
Add updated testing for Flag using the new suite
Go
mit
paked/configure
8c4fe6db84c5e80d4218912d004108f7efbda5e6
lib/requester.go
lib/requester.go
package pewpew import ( "net/http" "net/http/httputil" "time" ) func runRequest(req http.Request, client *http.Client) (response *http.Response, stat RequestStat) { reqStartTime := time.Now() response, responseErr := (*client).Do(&req) reqEndTime := time.Now() if responseErr != nil { stat = RequestStat{ ...
package pewpew import ( "net/http" "net/http/httputil" "time" ) func runRequest(req http.Request, client *http.Client) (response *http.Response, stat RequestStat) { reqStartTime := time.Now() response, responseErr := (*client).Do(&req) reqEndTime := time.Now() if responseErr != nil { stat = RequestStat{ ...
Fix mistake printing wrong HTTP proto
Fix mistake printing wrong HTTP proto
Go
mit
bengadbois/pewpew
fca9c1badb3721928e7b80a38af340b413e2a9d8
testwriter.go
testwriter.go
package loggo import ( "path" "time" ) // TestLogValues represents a single logging call. type TestLogValues struct { Level Level Module string Filename string Line int Timestamp time.Time Message string } // TestWriter is a useful Writer for testing purposes. Each component of the // logging...
package loggo import ( "path" "sync" "time" ) // TestLogValues represents a single logging call. type TestLogValues struct { Level Level Module string Filename string Line int Timestamp time.Time Message string } // TestWriter is a useful Writer for testing purposes. Each component of the //...
Fix data race in test writer
Fix data race in test writer
Go
mit
cmars/tools,cmars/tools,cmars/tools,cmars/tools
0063d23233fff0d4ec6326885828d5fbbbaefc85
cmd/goacme/main_test.go
cmd/goacme/main_test.go
package main import ( "flag" "testing" ) func TestDefaultDisco(t *testing.T) { v := discoAliases[defaultDisco] if v == "" { t.Fatalf("alias for %q is zero; all aliases: %v", defaultDisco, discoAliases) } } func TestDiscoAliasFlag(t *testing.T) { tests := []struct { a discoAliasFlag args []string wan...
package main import ( "flag" "testing" ) func TestDefaultDisco(t *testing.T) { v := discoAliases[defaultDisco] if v == "" { t.Fatalf("alias for %q is zero; all aliases: %v", defaultDisco, discoAliases) } } func TestDiscoAliasFlag(t *testing.T) { tests := []struct { a discoAliasFlag args []string wan...
Fix golint using type in variable declaration
Fix golint using type in variable declaration This fixes: main_test.go:25:9: should omit type discoAliasFlag from declaration of var a; it will be inferred from the right-hand side Closes #29
Go
apache-2.0
google/acme
76e05fd54739165dcb9a451d41e3988807ce2d0f
data/organization.go
data/organization.go
package data import ( "time" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) type Organization struct { ID bson.ObjectId `bson:"_id"` Name string `bson:"name"` OwnerID bson.ObjectId `bson:"owner_id"` CreatorID bson.ObjectId `bson:"creator_id"` CreatedAt time.Time `bson:"created_at"` ...
package data import ( "time" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) type Organization struct { ID bson.ObjectId `bson:"_id"` Name string `bson:"name"` OwnerID bson.ObjectId `bson:"owner_id"` CreatorID bson.ObjectId `bson:"creator_id"` CreatedAt time.Time `bson:"created_at"` ...
Implement ListOrganizationOwner function in data
Implement ListOrganizationOwner function in data
Go
bsd-3-clause
FurqanSoftware/papyrus,FurqanSoftware/papyrus,FurqanSoftware/papyrus
270b034de1e7039194fead11f7d0b7b92500e7bc
action/import_godep.go
action/import_godep.go
package action import ( "github.com/Masterminds/glide/godep" "github.com/Masterminds/glide/msg" ) // ImportGodep imports a GPM file. func ImportGodep(dest string) { base := "." config := EnsureConfig() if !godep.Has(base) { msg.Die("No Godep data found.") } deps, err := godep.Parse(base) if err != nil { m...
package action import ( "github.com/Masterminds/glide/godep" "github.com/Masterminds/glide/msg" ) // ImportGodep imports a Godep file. func ImportGodep(dest string) { base := "." config := EnsureConfig() if !godep.Has(base) { msg.Die("No Godep data found.") } deps, err := godep.Parse(base) if err != nil { ...
Fix a typo in comment
Fix a typo in comment
Go
mit
avvmoto/glide,cmars/tools,cmars/tools,cmars/tools,franciscocpg/glide,franciscocpg/glide,cmars/tools,avvmoto/glide
b6f88e1fc83e767749e5857a3835d0e05557376e
meta/seektable.go
meta/seektable.go
package meta // SeekTable contains one or more precalculated audio seek points. // // ref: https://www.xiph.org/flac/format.html#metadata_block_seektable type SeekTable struct{}
package meta // SeekTable contains one or more precalculated audio frame seek points. // // ref: https://www.xiph.org/flac/format.html#metadata_block_seektable type SeekTable struct { // One or more seek points. Points []SeekPoint } // A SeekPoint specifies the byte offset and initial sample number of a given // ta...
Add SeekTable and SeekPoint definitions.
meta: Add SeekTable and SeekPoint definitions.
Go
unlicense
mewkiz/flac
33362911d547548214a34ac0be71256700a31fb4
librariesio/projects.go
librariesio/projects.go
package librariesio import ( "fmt" "net/http" ) // Project that holds a name field type Project struct { Name string `json:"name"` } // GetProject returns information about a project and it's versions. // GET https://libraries.io/api/:platform/:name func (c *Client) GetProject(platform string, name string) (*Proj...
package librariesio import ( "fmt" "net/http" "time" ) // Project represents a project on libraries.io type Project struct { Description string `json:"description,omitempty"` Forks int `json:"forks,omitempty"` Homepage string `json:"homepage,omitempty"...
Add other fields to Project struct
Add other fields to Project struct
Go
mit
hackebrot/go-librariesio
f36b74f606249367ed007a9d91c92f4b1b5c0ecb
action/createschema.go
action/createschema.go
package action import ( "encoding/gob" "fmt" ) type CreateSchema struct { SchemaName string } // Register type for gob func init() { gob.Register(&CreateSchema{}) } func (a *CreateSchema) Execute(c *Context) error { _, err := c.Tx.Exec( fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS \"%s\";", a.SchemaName), ) r...
package action import ( "encoding/gob" "fmt" ) type CreateSchema struct { SchemaName string } // Register type for gob func init() { gob.Register(&CreateSchema{}) } func (a *CreateSchema) Execute(c *Context) error { _, err := c.Tx.Exec( fmt.Sprintf(` DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_name...
Fix create schema action on postgres 9.2.
Fix create schema action on postgres 9.2.
Go
mit
pagarme/teleport,pagarme/teleport
a6737b81e19912648b5b9d5d9afab9c643aa54c7
go/libkb/constants_release.go
go/libkb/constants_release.go
// +build release package libkb // Production run mode currently still unsafe. // This will cause the build to fail for this tag on purpose. //const DefaultRunMode = ProductionRunMode
// +build release package libkb // Production run mode currently...enabled! const DefaultRunMode = ProductionRunMode
Enable DefaultRunMode for release builds
Enable DefaultRunMode for release builds
Go
bsd-3-clause
keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client
3f71ca2f2ff9a6028600294e80846d205ebc8ad0
go/parallel-letter-frequency/parallel_letter_frequency.go
go/parallel-letter-frequency/parallel_letter_frequency.go
package letter // FreqMap records the frequency of each rune in a given text. type FreqMap map[rune]int // Frequency counts the frequency of each rune in a given text and returns this // data as a FreqMap. func Frequency(s string) FreqMap { m := FreqMap{} for _, r := range s { m[r]++ } return m } // Concurrent...
package letter // FreqMap records the frequency of each rune in a given text. type FreqMap map[rune]int // Frequency counts the frequency of each rune in a given text and returns this // data as a FreqMap. func Frequency(s string) FreqMap { m := FreqMap{} for _, r := range s { m[r]++ } return m } // Concurrent...
Replace extract func w/ anon func
Replace extract func w/ anon func
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
ce86a9940c4b9311dce25f8b89511e47d1dbd470
internal/uidriver/mobile/graphics_ios.go
internal/uidriver/mobile/graphics_ios.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...
Fix the package name in a panic message
internal/uidriver/mobile: Fix the package name in a panic message
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
f70a48e28af671a7ffe8f631510c66270e43ec29
acme/provider.go
acme/provider.go
package acme // ChallengeProvider presents the solution to a challenge available to be solved // CleanUp will be called by the challenge if Present ends in a non-error state. type ChallengeProvider interface { Present(domain, token, keyAuth string) error CleanUp(domain, token, keyAuth string) error }
package acme // ChallengeProvider enables implementing a custom challenge // provider. Present presents the solution to a challenge available to // be solved. CleanUp will be called by the challenge if Present ends // in a non-error state. type ChallengeProvider interface { Present(domain, token, keyAuth string) erro...
Improve wording of ChallengeProvider comment
Improve wording of ChallengeProvider comment
Go
mit
xenolf/lego,fxposter/lego,xenolf/lego
3425ae831dd809140f6094813bba8ebce0c962b1
commands/command_queues.go
commands/command_queues.go
package gitmedia import ( ".." "../queuedir" "strings" ) type QueuesCommand struct { *Command } func (c *QueuesCommand) Run() { err := gitmedia.WalkQueues(func(name string, queue *queuedir.Queue) error { gitmedia.Print(name) return queue.Walk(func(id string, body []byte) error { parts := strings.Split(st...
package gitmedia import ( ".." "../queuedir" "os" "path/filepath" "strings" ) type QueuesCommand struct { *Command } func (c *QueuesCommand) Run() { err := gitmedia.WalkQueues(func(name string, queue *queuedir.Queue) error { wd, _ := os.Getwd() gitmedia.Print(name) return queue.Walk(func(id string, body...
Make queues list output consistent with git status
Make queues list output consistent with git status
Go
mit
Aorjoa/git-lfs,JeckoHeroOrg/-git-lfs_miilkyway,larsxschneider/git-lfs,PeterDaveHello/git-lfs,beni55/git-lfs,PeterDaveHello/git-lfs,jsroads/git-lfs,ttaylorr/git-lfs,dakotahawkins/git-lfs,ssgelm/git-lfs,WillHipschman/git-lfs,aleb/git-lfs,beni55/git-lfs,iSC-Labs/git-lfs,larsxschneider/git-lfs,bozaro/git-lfs,ModernTechnolo...
ed827467c759468ccfbff451be6f34886db4f58a
main_test.go
main_test.go
package main import ( "os" "testing" "github.com/rollbar/rollbar-go" "github.com/stretchr/testify/assert" ) func TestSetupEnv(t *testing.T) { setupEnv() port := os.Getenv("PORT") assert.NotEqual(t, port, "") } func TestSetupRollbar(t *testing.T) { setupRollbar() assert.Equal(t, rollbar.Token(), os.Getenv("...
package main import ( "os" "testing" "github.com/rollbar/rollbar-go" "github.com/stretchr/testify/assert" "go.uber.org/goleak" ) func TestMain(m *testing.M) { rollbar.Close() goleak.VerifyTestMain(m) } func TestSetupEnv(t *testing.T) { setupEnv() port := os.Getenv("PORT") assert.NotEqual(t, port, "") } f...
Add goleak to main package
Add goleak to main package
Go
mit
albertyw/reaction-pics,albertyw/reaction-pics,albertyw/reaction-pics,albertyw/reaction-pics
9a8b7d4e8f347bfa230879db9d7d4e4d9e19f962
main_test.go
main_test.go
package sanitized_anchor_name_test import ( "fmt" "github.com/shurcooL/go/github_flavored_markdown/sanitized_anchor_name" ) func ExampleCreate() { anchorName := sanitized_anchor_name.Create("This is a header") fmt.Println(anchorName) // Output: // this-is-a-header } func ExampleCreate2() { fmt.Println(sani...
package sanitized_anchor_name_test import ( "fmt" "github.com/shurcooL/sanitized_anchor_name" ) func ExampleCreate() { anchorName := sanitized_anchor_name.Create("This is a header") fmt.Println(anchorName) // Output: // this-is-a-header } func ExampleCreate2() { fmt.Println(sanitized_anchor_name.Create("Th...
Fix test to import moved package.
Fix test to import moved package.
Go
mit
shurcooL/sanitized_anchor_name
c0cdd8d2bb7e5980694459bf2e6f1959c8efd91d
utils/backoff.go
utils/backoff.go
// Package utils contains common shared code. package utils import ( "math" "time" ) // Backoff holds the number of attempts as well as the min and max backoff delays. type Backoff struct { attempt, Factor float64 Min, Max time.Duration } // Duration calculates the backoff delay and increments the attempt...
// Package utils contains common shared code. package utils import ( "math" "time" ) // Backoff holds the number of attempts as well as the min and max backoff delays. type Backoff struct { attempt, Factor int Min, Max time.Duration } // Duration calculates the backoff delay and increments the attempts co...
Rename SetDuration to CalcDuration and change attempts and factor to ints.
Rename SetDuration to CalcDuration and change attempts and factor to ints.
Go
mit
force12io/force12,force12io/force12
9a561908c56af83ceb092a33d00fca712dc73410
test_relate/relate_test.go
test_relate/relate_test.go
package test_relate import ( "github.com/stephenalexbrowne/zoom" . "launchpad.net/gocheck" "testing" ) // Gocheck setup... func Test(t *testing.T) { TestingT(t) } type RelateSuite struct{} var _ = Suite(&RelateSuite{}) func (s *RelateSuite) SetUpSuite(c *C) { zoom.Init(&zoom.Configuration{Database: 7}) err...
package test_relate import ( "github.com/stephenalexbrowne/zoom" . "launchpad.net/gocheck" "testing" ) // Gocheck setup... func Test(t *testing.T) { TestingT(t) } type RelateSuite struct{} var _ = Suite(&RelateSuite{}) func (s *RelateSuite) SetUpSuite(c *C) { zoom.Init(&zoom.Configuration{Database: 7}) err...
Add some tests for relations
Add some tests for relations
Go
mit
albrow/zoom
1717bb941ed4035a6b86209089f58cd669cb2941
pkg/record/handler/handler.go
pkg/record/handler/handler.go
package handler import ( "time" "github.com/skygeario/skygear-server/pkg/server/skyerr" ) var timeNow = func() time.Time { return time.Now().UTC() } type serializedError struct { id string err skyerr.Error } func newSerializedError(id string, err skyerr.Error) serializedError { return serializedError{ id: ...
package handler import ( "encoding/json" "strings" "time" "github.com/skygeario/skygear-server/pkg/server/skyerr" ) var timeNow = func() time.Time { return time.Now().UTC() } type serializedError struct { id string err skyerr.Error } func newSerializedError(id string, err skyerr.Error) serializedError { re...
Fix record save error not serialized
Fix record save error not serialized
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
1ea65072845fb84ba6a6a7e3a1b569396bbdea15
pkg/auth/identity/identity.go
pkg/auth/identity/identity.go
package identity import ( "encoding/json" "errors" "github.com/google/uuid" ) // Identity data to be encode in auth token type Identity struct { ID uuid.UUID `json:"id"` Email string `json:"email"` Roles []string `json:"roles"` } // FromGoogleData sets *i to a copy of data. func (i *Identity) FromGoogl...
package identity import ( "encoding/json" "errors" "github.com/google/uuid" ) // Identity data to be encode in auth token type Identity struct { ID uuid.UUID `json:"id"` Email string `json:"email"` Roles []string `json:"roles"` } // FromGoogleData sets *i to a copy of data. func (i *Identity) FromGoogl...
Implement from social media methods
Implement from social media methods
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
1582f71461543c700a1c0ca34df3440f58a4b7ce
waiter.go
waiter.go
package distribution import "net/rpc" // Waiter is a struct that is returned by Go() method to be able to // wait for a Node response. It handles the rpc.Call to be able to get // errors if any. type Waiter struct { Node *Node rpcCall *rpc.Call client *rpc.Client } // Wait for the response caller. func (w *Wa...
package distribution import ( "errors" "net/rpc" ) // Waiter is a struct that is returned by Go() method to be able to // wait for a Node response. It handles the rpc.Call to be able to get // errors if any. type Waiter struct { Node *Node rpcCall *rpc.Call client *rpc.Client } // Wait for the response call...
Handle "no rpcClient" error in Waiter.Error()
Handle "no rpcClient" error in Waiter.Error()
Go
mit
metal3d/distribution
e062e66ee1d21868ddce5cbda7054cac862292fa
registry/storage/layerreader.go
registry/storage/layerreader.go
package storage import ( "net/http" "time" "github.com/docker/distribution" "github.com/docker/distribution/digest" ) // layerReader implements Layer and provides facilities for reading and // seeking. type layerReader struct { fileReader digest digest.Digest } var _ distribution.Layer = &layerReader{} func...
package storage import ( "net/http" "time" "github.com/docker/distribution" "github.com/docker/distribution/digest" ) // layerReader implements Layer and provides facilities for reading and // seeking. type layerReader struct { fileReader digest digest.Digest } var _ distribution.Layer = &layerReader{} func...
Insert request method option storage driver URLFor
Insert request method option storage driver URLFor Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Go
apache-2.0
wking/docker-distribution,rodacom/docker-hub,whyrusleeping/distribution,denverdino/denverdino.github.io,iskradelta/distribution,arvindkandhare/distribution,rhoml/distribution,LouisKottmann/distribution,nevermosby/distribution,hpcloud/distribution,johnstep/docker.github.io,gdevillele/docker.github.io,jmitchell/distribut...
450bfb2d7d5b360ec484c98299db03dcf69e701d
mesos/state.go
mesos/state.go
package mesos import ( "fmt" "strings" "github.com/CiscoCloud/mesos-consul/registry" ) func (sj *StateJSON) GetFollowerById(id string) (string, error) { for _, f := range sj.Followers { if f.Id == id { return f.Hostname, nil } } return "", fmt.Errorf("Follower not found: %s", id) } // Task Methods /...
package mesos import ( "fmt" "strings" "github.com/CiscoCloud/mesos-consul/registry" ) func (sj *StateJSON) GetFollowerById(id string) (string, error) { for _, f := range sj.Followers { if f.Id == id { return f.Hostname, nil } } return "", fmt.Errorf("Follower not found: %s", id) } // Task Methods /...
Remove `consul` from the check labels
Remove `consul` from the check labels
Go
apache-2.0
CiscoCloud/mesos-consul,mantl/mesos-consul
3f73331ba0e4da8dedd910bcec9edcb383ff16e3
edit/tty/setup_windows.go
edit/tty/setup_windows.go
package tty import ( "os" "github.com/elves/elvish/util" "golang.org/x/sys/windows" ) const ( wantedInMode = windows.ENABLE_WINDOW_INPUT | windows.ENABLE_MOUSE_INPUT | windows.ENABLE_PROCESSED_INPUT wantedOutMode = windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING ) func setup(in...
package tty import ( "os" "github.com/elves/elvish/util" "golang.org/x/sys/windows" ) const ( wantedInMode = windows.ENABLE_WINDOW_INPUT | windows.ENABLE_MOUSE_INPUT | windows.ENABLE_PROCESSED_INPUT wantedOutMode = windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING ) func setup(in...
Adjust the order of TTY restoration on Windows.
Adjust the order of TTY restoration on Windows. Normal commands no longer produce unsupported escape sequences. This addresses #798.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
43ce41236f080f64879c4757b0740f8a198498ce
model/index.go
model/index.go
package model import "github.com/blevesearch/bleve" // InitIndex initializes the search index at the specified path func InitIndex(filepath string) (bleve.Index, error) { index, err := bleve.Open(filepath) // Doesn't yet exist (or error opening) so create a new one if err != nil { mapping := bleve.NewIndexMappi...
package model import ( "github.com/blevesearch/bleve" "github.com/blevesearch/bleve/analysis/language/en" ) // InitIndex initializes the search index at the specified path func InitIndex(filepath string) (bleve.Index, error) { index, err := bleve.Open(filepath) // Doesn't yet exist (or error opening) so create a...
Add mapping for name, full name, and description
Add mapping for name, full name, and description
Go
mit
hoop33/limo
04c7ba69af032781825b70c12264bbf2a98d54eb
api/util_test.go
api/util_test.go
package api import ( "testing" ) func assertQueryMeta(t *testing.T, qm *QueryMeta) { if qm.LastIndex == 0 { t.Fatalf("bad index: %d", qm.LastIndex) } if !qm.KnownLeader { t.Fatalf("expected known leader, got none") } } func assertWriteMeta(t *testing.T, wm *WriteMeta) { if wm.LastIndex == 0 { t.Fatalf("b...
package api import ( "testing" ) func assertQueryMeta(t *testing.T, qm *QueryMeta) { if qm.LastIndex == 0 { t.Fatalf("bad index: %d", qm.LastIndex) } if !qm.KnownLeader { t.Fatalf("expected known leader, got none") } } func assertWriteMeta(t *testing.T, wm *WriteMeta) { if wm.LastIndex == 0 { t.Fatalf("b...
Remove clock granularity sensitive test assertion.
Remove clock granularity sensitive test assertion. TestRequestTime already verifies that the request time is properly recorded.
Go
mpl-2.0
novilabs/nomad,hooklift/nomad,dvusboy/nomad,barnardb/nomad,novilabs/nomad,diptanu/nomad,dbresson/nomad,nak3/nomad,mattyr/nomad,hashicorp/nomad,Ashald/nomad,dvusboy/nomad,burdandrei/nomad,kmalec/nomad,iverberk/nomad,barnardb/nomad,novilabs/nomad,dvusboy/nomad,xytis/nomad,ranjib/nomad,dbresson/nomad,dbresson/nomad,achand...
3883e83c349f460f6f6c7a746f062a746737f117
go/src/socialapi/workers/api/modules/notificationsettings/handlers.go
go/src/socialapi/workers/api/modules/notificationsettings/handlers.go
package notificationsettings import ( "socialapi/workers/common/handler" "socialapi/workers/common/mux" ) func AddHandlers(m *mux.Mux) { m.AddHandler( handler.Request{ Handler: Create, Name: "notification-settings-create", Type: handler.PostRequest, Endpoint: "/channel/{id}/notificationsett...
package notificationsettings import ( "socialapi/workers/common/handler" "socialapi/workers/common/mux" ) func AddHandlers(m *mux.Mux) { m.AddHandler( handler.Request{ Handler: Create, Name: "notification-settings-create", Type: handler.PostRequest, Endpoint: "/channel/{id}/notificationsett...
Delete endpoint is added for notification setting
social/handler: Delete endpoint is added for notification setting
Go
agpl-3.0
koding/koding,rjeczalik/koding,sinan/koding,acbodine/koding,kwagdy/koding-1,gokmen/koding,koding/koding,rjeczalik/koding,andrewjcasal/koding,szkl/koding,alex-ionochkin/koding,mertaytore/koding,usirin/koding,andrewjcasal/koding,cihangir/koding,mertaytore/koding,usirin/koding,mertaytore/koding,jack89129/koding,cihangir/k...
28ccd9b63abf673cb565e143297a3a45f4233202
directives.go
directives.go
// Copyright 2020 Frederik Zipp. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gocyclo import ( "go/ast" "strings" ) type directives []string func (ds directives) HasIgnore() bool { return ds.isPresent("ignore") } func (ds di...
// Copyright 2020 Frederik Zipp. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gocyclo import ( "go/ast" "strings" ) type directives []string func (ds directives) HasIgnore() bool { return ds.isPresent("ignore") } func (ds di...
Allow ignore directive with trailing spaces
Allow ignore directive with trailing spaces
Go
bsd-3-clause
fzipp/gocyclo
2e2989610520b3b02963733416e4ec040938a89e
tracker/init_test.go
tracker/init_test.go
package tracker import ( "os" "testing" "github.com/powerman/narada-go/narada/staging" ) func TestMain(m *testing.M) { os.Exit(staging.TearDown(m.Run())) }
package tracker import ( "io/ioutil" "os" "path/filepath" "testing" "github.com/powerman/narada-go/narada/staging" ) func TestMain(m *testing.M) { os.Exit(staging.TearDown(m.Run())) } func readTestFile(t *testing.T, path string) []byte { b, err := ioutil.ReadFile(filepath.Join("var", "testdata", path)) if er...
Add helper function to readfiles from testdata folder
Add helper function to readfiles from testdata folder
Go
mit
qarea/jirams,qarea/jirams
2e4b3b56f19d6b308bf2c453e80313071a9a2bcb
chap3_searching/symboltable/stringtoint.go
chap3_searching/symboltable/stringtoint.go
package symboltable type StringToIntST interface { Put(key string, val int) Get(key string) (int, bool) Delete(key string) } //changed
package symboltable type StringToIntST interface { Put(key string, val int) Get(key string) (int, bool) Delete(key string) }
Revert "test after new machine setup"
Revert "test after new machine setup" This reverts commit c5fdb52a2325a63899dd99b8f93cc6204618b2f2.
Go
mit
lzcqd/sedgewick
48f9c45c99c4ea7079c924adcb18b9d167b504d8
uploader/uploader.go
uploader/uploader.go
package uploader import ( "errors" "github.com/matthew-andrews/s3up/objects" "sync" ) type s3ClientInterface interface { UploadFile(string, objects.File) error } func Upload(service s3ClientInterface, bucket string, files []objects.File, concurrency int) []error { ec := make(chan error, len(files)) if len(file...
package uploader import ( "errors" "github.com/matthew-andrews/s3up/objects" "sync" ) type s3ClientInterface interface { UploadFile(string, objects.File) error } func Upload(service s3ClientInterface, bucket string, files []objects.File, concurrency int) []error { if len(files) < 1 { return []error{errors.New...
Tidy up code a little
Tidy up code a little
Go
mit
matthew-andrews/s3up
f183acefe2c5e69a2f2d8efd7c3d0a41ad1acdb3
storage/interface.go
storage/interface.go
package storage import ( "io" "github.com/anacrolix/torrent/metainfo" ) type ClientImplCloser interface { ClientImpl Close() error } // Represents data storage for an unspecified torrent. type ClientImpl interface { OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (TorrentImpl, error) } // Data storag...
package storage import ( "io" "github.com/anacrolix/torrent/metainfo" ) type ClientImplCloser interface { ClientImpl Close() error } // Represents data storage for an unspecified torrent. type ClientImpl interface { OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (TorrentImpl, error) } // Data storag...
Add default param name in TorrentImpl.Piece func
Add default param name in TorrentImpl.Piece func
Go
mpl-2.0
anacrolix/torrent,anacrolix/torrent
5e593f6c2a774e85319c13d23a9436fa32a93a71
commands/copy.go
commands/copy.go
package commands import ( "fmt" "os" "github.com/spf13/cobra" ) func init() { RootCmd.AddCommand(&cobra.Command{ Use: "cp [name]", Short: "Copy a credential to the clipboard", Long: `The copy command is used to copy a credential's password to the clipboard. `, Run: func(cmd *cobra.Command, ...
package commands import ( "fmt" "os" "github.com/bndw/pick/utils" "github.com/spf13/cobra" ) func init() { RootCmd.AddCommand(&cobra.Command{ Use: "cp [name]", Short: "Copy a credential to the clipboard", Long: `The copy command is used to copy a credential's password to the clipboard. `, ...
Copy command uses safe's Get method
Copy command uses safe's Get method
Go
mit
bndw/pick,bndw/pick
8d436c8d2297250f8f25373156462eb633fe81f7
v1/tv/profile_example_test.go
v1/tv/profile_example_test.go
// Copyright (C) 2016 AppNeta, Inc. All rights reserved. package tv_test import ( "github.com/appneta/go-traceview/v1/tv" "golang.org/x/net/context" ) func ExampleBeginProfile(ctx context.Context) { defer tv.BeginProfile(ctx, "example").End() // ... do something ... } func ExampleBeginProfile_func(ctx context.C...
// Copyright (C) 2016 AppNeta, Inc. All rights reserved. package tv_test import ( "time" "github.com/appneta/go-traceview/v1/tv" "golang.org/x/net/context" ) func slowFunc(ctx context.Context) { defer tv.BeginProfile(ctx, "slowFunc").End() // ... do something else ... time.Sleep(1 * time.Second) } func Examp...
Update godoc Profile example to use whole file example
Update godoc Profile example to use whole file example
Go
apache-2.0
appneta/go-appneta,appneta/go-appneta
44863b07f48a9ad14fdae5d07786baad96a57cd7
linoise/linoise_test.go
linoise/linoise_test.go
// Copyright 2010 The "go-linoise" Authors // // Use of this source code is governed by the Simplified BSD License // that can be found in the LICENSE file. // // This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES // OR CONDITIONS OF ANY KIND, either express or implied. See the License // for more de...
// Copyright 2010 The "go-linoise" Authors // // Use of this source code is governed by the Simplified BSD License // that can be found in the LICENSE file. // // This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES // OR CONDITIONS OF ANY KIND, either express or implied. See the License // for more de...
Use a type assertion on the io.Reader to make it an os.File, and to access so to its FD
Use a type assertion on the io.Reader to make it an os.File, and to access so to its FD
Go
bsd-2-clause
fiber/go-linoise