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 |
|---|---|---|---|---|---|---|---|---|---|
6a551765b2f511639e525e8ac40ae9069b843157 | main.go | main.go | package main
import (
"github.com/esimov/diagram/io"
"github.com/esimov/diagram/ui"
"github.com/esimov/diagram/canvas"
"math/rand"
"time"
"flag"
"log"
"os"
)
var (
source = flag.String("source", "", "Source")
destination = flag.String("destination", "", "Destination")
)
func main() {
rand.Seed(time.Now()... | package main
import (
"github.com/esimov/diagram/io"
"github.com/esimov/diagram/ui"
"github.com/esimov/diagram/canvas"
"math/rand"
"time"
"flag"
"log"
"os"
)
var (
source = flag.String("in", "", "Source")
destination = flag.String("out", "", "Destination")
)
func main() {
rand.Seed(time.Now().UTC().UnixN... | Modify command line tool parameters | Modify command line tool parameters
| Go | mit | esimov/diagram,esimov/diagram |
6050d3d83fb673ec1f92a3841a73b756427390b7 | main.go | main.go | package main
import (
"fmt"
"github.com/nitishparkar/muffliato/crawler"
"io/ioutil"
"strings"
)
const sitesFile string = "sites.txt"
func main() {
data, err := ioutil.ReadFile(sitesFile)
if err != nil {
panic(err)
}
sites := strings.Split(string(data), "\n")
validSites := make([]string, 0)
for _, sit... | package main
import (
"fmt"
"github.com/nitishparkar/muffliato/crawler"
"io/ioutil"
"strings"
)
const sitesFile string = "sites.txt"
func main() {
data, err := ioutil.ReadFile(sitesFile)
if err != nil {
panic(err)
}
sites := strings.Split(string(data), "\n")
validSites := make([]string, 0)
for _, sit... | Use buffered channel so that all crawlers get a chance to execute | Use buffered channel so that all crawlers get a chance to execute
| Go | mit | nitishparkar/muffliato |
b680c822da75b460d18af343f0ec1ba668ce5065 | main.go | main.go | package main
import "log"
func main() {
log.Println("Starting 'nginx-requests-stats' app...")
}
| package main
import (
"log"
"net/http"
"github.com/jvrplmlmn/nginx-requests-stats/handlers"
)
const version = "0.1.0"
func main() {
log.Println("Starting 'nginx-requests-stats' app...")
// This endpoint returns a JSON with the version of the application
http.Handle("/version", handlers.VersionHandler(version... | Set the version of the application to 0.1.0 - Expose the /version endpoint | Set the version of the application to 0.1.0 - Expose the /version endpoint
| Go | mit | jvrplmlmn/nginx-requests-stats |
e8dcce0881dbae87f666ddff24f7707c1c4661be | main.go | main.go | // Cozy Cloud is a personal platform as a service with a focus on data.
// Cozy Cloud can be seen as 4 layers, from inside to outside:
//
// 1. A place to keep your personal data
//
// 2. A core API to handle the data
//
// 3. Your web apps, and also the mobile & desktop clients
//
// 4. A coherent User Experience
//
/... | // Cozy Cloud is a personal platform as a service with a focus on data.
// Cozy Cloud can be seen as 4 layers, from inside to outside:
//
// 1. A place to keep your personal data
//
// 2. A core API to handle the data
//
// 3. Your web apps, and also the mobile & desktop clients
//
// 4. A coherent User Experience
//
/... | Exit with error code `1` instead of `-1` | Exit with error code `1` instead of `-1`
`-1` comes from Cobra docs...
| Go | agpl-3.0 | sebn/cozy-stack,sebn/cozy-stack,sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,nono/cozy-stack |
d5f261bf4aa0d589cce6d27662b9a313845600f8 | next.go | next.go | package next
import (
"time"
)
// Minute returns a time.Time referencing the beginning of the next minute
func Minute(t time.Time) time.Time {
return t.Add(time.Minute).Truncate(time.Minute)
}
// Hour returns a time.Time referencing the beginning of the next hour
func Hour(t time.Time) time.Time {
return t.Add(ti... | package next
import (
"time"
)
// Minute returns a time.Time referencing the beginning of the next minute
func Minute(t time.Time) time.Time {
return t.Add(time.Minute).Truncate(time.Minute)
}
// Hour returns a time.Time referencing the beginning of the next hour
func Hour(t time.Time) time.Time {
return t.Add(ti... | Simplify logic since time.Date is benevolent | Simplify logic since time.Date is benevolent
| Go | apache-2.0 | billhathaway/next |
1ca0f385adcae2a235a968503441f4ff916b944e | main/dav.go | main/dav.go | package main
import (
"fmt"
"os"
"github.com/cloudfoundry/bosh-utils/davcli/app"
"github.com/cloudfoundry/bosh-utils/davcli/cmd"
)
func main() {
cmdFactory := cmd.NewFactory()
cmdRunner := cmd.NewRunner(cmdFactory)
cli := app.New(cmdRunner)
err := cli.Run(os.Args)
if err != nil {
fmt.Printf("Error runn... | package main
import (
"fmt"
"os"
"github.com/cloudfoundry/bosh-davcli/app"
"github.com/cloudfoundry/bosh-davcli/cmd"
)
func main() {
cmdFactory := cmd.NewFactory()
cmdRunner := cmd.NewRunner(cmdFactory)
cli := app.New(cmdRunner)
err := cli.Run(os.Args)
if err != nil {
fmt.Printf("Error running app - %s... | Fix import statements to reflect new project. | Fix import statements to reflect new project.
[#95634510](https://www.pivotaltracker.com/story/show/95634510)
Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
| Go | apache-2.0 | cloudfoundry/bosh-davcli,cloudfoundry/bosh-davcli |
7a714486652950fdbff9cc2346a955ab2bc9c522 | go/src/koding/db/mongodb/modelhelper/modelhelper.go | go/src/koding/db/mongodb/modelhelper/modelhelper.go | package modelhelper
import (
"koding/db/mongodb"
)
var Mongo *mongodb.MongoDB
func Initialize(url string) {
Mongo = mongodb.NewMongoDB(url)
}
| package modelhelper
import (
"koding/db/mongodb"
)
var Mongo *mongodb.MongoDB
func Initialize(url string) {
Mongo = mongodb.NewMongoDB(url)
}
func Close() {
if Mongo != nil {
Mongo.Close()
}
}
| Add mongo session closer to model helper | SocialTests: Add mongo session closer to model helper
| Go | agpl-3.0 | andrewjcasal/koding,koding/koding,rjeczalik/koding,acbodine/koding,koding/koding,alex-ionochkin/koding,gokmen/koding,mertaytore/koding,szkl/koding,drewsetski/koding,sinan/koding,kwagdy/koding-1,jack89129/koding,alex-ionochkin/koding,gokmen/koding,cihangir/koding,gokmen/koding,rjeczalik/koding,rjeczalik/koding,drewsetsk... |
9cdd504d27b979d4652bfc4e04dbd38915bb7468 | plugins/file/plugin.go | plugins/file/plugin.go | package file
import "github.com/vektra/cypress"
import "path/filepath"
type Plugin struct {
Paths []string
OffsetDB string
}
func (p *Plugin) Generator() (cypress.Generator, error) {
m := NewMonitor()
var files []string
for _, pat := range p.Paths {
matches, err := filepath.Glob(pat)
if err != nil {
... | package file
import "github.com/vektra/cypress"
import "path/filepath"
type Plugin struct {
Paths []string
OffsetDB string `toml:"offsetdb"`
}
func (p *Plugin) Generator() (cypress.Generator, error) {
m := NewMonitor()
var files []string
for _, pat := range p.Paths {
matches, err := filepath.Glob(pat)
... | Fix name of offsetdb in toml | Fix name of offsetdb in toml
| Go | bsd-3-clause | vektra/cypress,vektra/cypress |
95bf065037f2d6ebf7fe59e15361d1e3f4c4ff9e | sync.go | sync.go | package cdp
import (
"github.com/mafredri/cdp/rpcc"
)
type eventClient interface {
rpcc.Stream
}
// Sync takes two or more event clients and sets them into synchronous operation,
// relative to each other. This operation cannot be undone. If an error is
// returned this function is no-op and the event clients will... | package cdp
import (
"fmt"
"github.com/mafredri/cdp/rpcc"
)
type eventClient interface {
rpcc.Stream
}
type getStreamer interface {
GetStream() rpcc.Stream
}
// Sync takes two or more event clients and sets them into synchronous operation,
// relative to each other. This operation cannot be undone. If an error... | Send original Stream in Sync with GetStream | Send original Stream in Sync with GetStream
| Go | mit | mafredri/cdp,mafredri/cdp |
a3686ce037f5514dc9a7394525c63bd6f3ee4ce3 | util.go | util.go | package auth
import (
"crypto/sha256"
"crypto/subtle"
)
// SecureCompare performs a constant time compare of two strings to limit timing attacks.
func SecureCompare(given string, actual string) bool {
givenSha := sha256.Sum256([]byte(given))
actualSha := sha256.Sum256([]byte(actual))
return subtle.ConstantTimeC... | package auth
import (
"crypto/sha512"
"crypto/subtle"
)
// SecureCompare performs a constant time compare of two strings to limit timing attacks.
func SecureCompare(given string, actual string) bool {
givenSha := sha512.Sum512([]byte(given))
actualSha := sha512.Sum512([]byte(actual))
return subtle.ConstantTimeC... | Use sha512 instead of sha256, since sha512 is faster on amd64 cpus. | Use sha512 instead of sha256, since sha512 is faster on amd64 cpus.
Ref:
http://crypto.stackexchange.com/a/26340
| Go | mit | go-macaron/auth |
ddc4ea3ebbefe6b2ae925362899c66fc62e372e9 | model/db_test.go | model/db_test.go | package model
import (
"os"
"testing"
"github.com/jinzhu/gorm"
)
var dbPath = "./test.db"
var db *gorm.DB
func TestMain(m *testing.M) {
rmDB()
mkDB()
run := m.Run()
rmDB()
os.Exit(run)
}
func mkDB() {
var err error
db, err = InitDB(dbPath, false)
if err != nil {
panic(err)
}
}
func rmDB() {
if err ... | package model
import (
"fmt"
"os"
"testing"
"github.com/jinzhu/gorm"
)
var dbPath = "./test.db"
var db *gorm.DB
func TestMain(m *testing.M) {
rmDB()
mkDB()
run := m.Run()
rmDB()
os.Exit(run)
}
func mkDB() {
var err error
db, err = InitDB(dbPath, false)
if err != nil {
panic(err)
}
}
func clearDB() ... | Add function to clear database for testing | Add function to clear database for testing
| Go | mit | hoop33/limo |
9df9f81c3b9451258424eef8fc86fe5953b4adc1 | blenc/keygenerator_test.go | blenc/keygenerator_test.go | package blenc
import (
"bytes"
"io/ioutil"
"testing"
)
func allKG(f func(kg KeyGenerator)) {
func() {
f(constantKey("testkey"))
}()
}
func TestEqualData(t *testing.T) {
for _, data := range []string{
"",
"a",
"abc",
"9876543210123456789098765432101234567890",
} {
data := []byte(data)
allKG(fun... | package blenc
import (
"bytes"
"io/ioutil"
"strings"
"testing"
)
func allKG(f func(kg KeyGenerator)) {
func() {
f(constantKey("testkey"))
}()
}
func TestEqualData(t *testing.T) {
for _, data := range []string{
"",
"a",
"abc",
"9876543210123456789098765432101234567890",
strings.Repeat("data", 102... | Extend test case a bit | Extend test case a bit
| Go | apache-2.0 | cinode/go |
728bfe557ee7fabf5ed8ba067555dfe7e1c52f24 | cc_messages/lrp_instance.go | cc_messages/lrp_instance.go | package cc_messages
type LRPInstanceState string
const (
LRPInstanceStateStarting LRPInstanceState = "STARTING"
LRPInstanceStateRunning LRPInstanceState = "RUNNING"
LRPInstanceStateFlapping LRPInstanceState = "FLAPPING"
LRPInstanceStateUnknown LRPInstanceState = "UNKNOWN"
)
type LRPInstance struct {
ProcessGu... | package cc_messages
type LRPInstanceState string
const (
LRPInstanceStateStarting LRPInstanceState = "STARTING"
LRPInstanceStateRunning LRPInstanceState = "RUNNING"
LRPInstanceStateFlapping LRPInstanceState = "FLAPPING"
LRPInstanceStateUnknown LRPInstanceState = "UNKNOWN"
)
type LRPInstance struct {
ProcessGu... | Add details to CC LRPInstance | Add details to CC LRPInstance
[#86856252]
| Go | apache-2.0 | cloudfoundry-incubator/runtime-schema |
3546ca06a8e2311bf5f0b017da79aabf04894901 | _draft/git-mirror.go | _draft/git-mirror.go | package main
import (
_ "fmt"
"log"
"github.com/libgit2/git2go"
)
func main() {
var cloneOptions git.CloneOptions
cloneOptions.Bare = true
if _, err := git.Clone("https://github.com/rollbrettler/go-playground.git", "./test", &cloneOptions); err != nil {
log.Println(err)
}
}
| package main
import (
_ "fmt"
"io/ioutil"
"log"
"github.com/libgit2/git2go"
)
var clone string = "./test"
var repo string = "https://github.com/rollbrettler/go-playground.git"
func main() {
var cloneOptions git.CloneOptions
cloneOptions.Bare = true
_, err := ioutil.ReadDir(clone)
if err != nil {
log.Pri... | Update git mirror draft to check if the repo already clone | Update git mirror draft to check if the repo already clone
| Go | mit | rollbrettler/go-playground |
ac467a512263bd37f965fdf4989c443c4cf14de7 | text/txt.go | text/txt.go | package text
import (
"bufio"
"io"
"math"
"os"
"path/filepath"
"github.com/morikuni/preview"
)
// PreviewTxt print text file.
func PreviewTxt(path string, out io.Writer, conf *preview.Config) error {
f, err := os.Open(path)
if err != nil {
return err
}
ext := filepath.Ext(f.Name())
if ext != ".txt" &&... | package text
import (
"bufio"
"fmt"
"io"
"math"
"os"
"path/filepath"
"github.com/morikuni/preview"
)
// PreviewTxt print text file.
func PreviewTxt(path string, out io.Writer, conf *preview.Config) error {
f, err := os.Open(path)
if err != nil {
return err
}
ext := filepath.Ext(f.Name())
if ext != ".... | Use Scanner to read line | Use Scanner to read line
| Go | mit | morikuni/preview |
770ab74e382324d44276b9b4e211cc064b59c799 | main/main_suite_test.go | main/main_suite_test.go | package main_test
import (
"os"
"os/exec"
"path"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestMain(t *testing.T) {
RegisterFailHandler(Fail)
dir, err := os.Getwd()
Expect(err).NotTo(HaveOccurred())
cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl... | package main_test
import (
"os"
"os/exec"
"path"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestMain(t *testing.T) {
RegisterFailHandler(Fail)
dir, err := os.Getwd()
Expect(err).NotTo(HaveOccurred())
cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl... | Add ginkgo defer to allow us to see error message | Add ginkgo defer to allow us to see error message
-This is when the main_suite_test fails before running
the main_test
| Go | apache-2.0 | Zouuup/cli,markstgodard/cli,evanfarrar/cli,xingzhou/cli,saravana76/cli,rastasheep/trash-can,rastasheep/trash-can,cgvarela/cli,saravana76/cli,SrinivasChilveri/cli,markstgodard/cli,ofer43211/cli,zhang-hua/cli,mcintyred/cli,markstgodard/cli,mcowger/cli,pishro-cc/cli,saravana76/cli,kavoj/cli,zhang-hua/cli,SrinivasChilveri/... |
252244c93aab912ac3d4d967163e08b7a63f4c20 | devices/aeon/multisensor.go | devices/aeon/multisensor.go | package aeon
import (
"github.com/ninjasphere/go-openzwave"
"github.com/ninjasphere/driver-go-zwave/spi"
)
type multisensor struct {
driver spi.Driver
node openzwave.Node
}
func MultiSensorFactory(driver spi.Driver, node openzwave.Node) openzwave.Device {
return &multisensor{driver, node}
}
func (device *mu... | package aeon
import (
"github.com/ninjasphere/driver-go-zwave/spi"
"github.com/ninjasphere/go-ninja/channels"
"github.com/ninjasphere/go-openzwave"
"github.com/ninjasphere/go-openzwave/CC"
)
type multisensor struct {
spi.Device
motionChannel *channels.MotionChannel
}
func MultiSensorFactory(driver spi.Driver, ... | Implement the support for motion sensor. | Implement the support for motion sensor.
| Go | mit | ninjasphere/driver-go-zwave,ninjasphere/driver-go-zwave |
3a6432de5021ff422eed5b40bac493a0d3bdd0c5 | channel/http_test.go | channel/http_test.go | package channel
import (
"testing"
"github.com/emreler/finch/models"
)
func TestNotify(t *testing.T) {
h := &HTTPChannel{}
statusCode, err := h.Notify(&models.Alert{URL: "https://google.com/", Method: methodGet})
if err != nil {
t.Error(err)
}
t.Logf("status code: %d", statusCode)
}
| package channel
import (
"testing"
"github.com/emreler/finch/logger"
"github.com/emreler/finch/models"
)
func TestNotify(t *testing.T) {
mockLogger := &logger.MockLogger{}
h := NewHTTPChannel(mockLogger)
statusCode, err := h.Notify(&models.Alert{URL: "http://example.com/", Method: methodGet})
if err != nil ... | Update test to use mock logger | Update test to use mock logger
| Go | mit | emreler/finch,emreler/finch |
27c646fdcceadb08aebec333c75cf17183d9d51b | set3/challenge21/21_test.go | set3/challenge21/21_test.go | package challenge21
import (
"testing"
)
func TestExtract(t *testing.T) {
Seed(123)
outputs := make([]int, 10)
for i := 0; i < 10; i++ {
outputs[i] = Extract()
}
for i, num := range outputs {
for j, otherNum := range outputs {
if j == i {
continue
}
if num == otherNum {
// assuming that th... | package challenge21
import (
"testing"
)
func TestExtract(t *testing.T) {
Seed(123)
output0 := Extract()
Seed(123)
output1 := Extract()
Seed(321)
output2 := Extract()
// same seeds should result in same first result
if output0 != output1 {
t.Fail()
}
// different seeds should result in different firs... | Fix 21 unit test to just check seed -> result | Fix 21 unit test to just check seed -> result
| Go | mit | stripedpajamas/cryptopals-go,stripedpajamas/cryptopals-go |
6eb40501259e9b6bb784328189202b5e32c4b9c3 | generator/random_name.go | generator/random_name.go | package generator
import (
uuid "github.com/nu7hatch/gouuid"
)
func RandomName() string {
guid, err := uuid.NewV4()
if err != nil {
panic(err)
}
return "CATS-APP-" + guid.String()
}
| package generator
import (
uuid "github.com/nu7hatch/gouuid"
)
func RandomName() string {
guid, err := uuid.NewV4()
if err != nil {
panic(err)
}
return guid.String()
}
func PrefixedRandomName(namePrefix string) string {
return namePrefix + RandomName()
}
| Add unique prefix naming function | Add unique prefix naming function
[#93167244]
| Go | apache-2.0 | cloudfoundry-incubator/cf-test-helpers,cloudfoundry-incubator/cf-test-helpers |
bd81cec4e8000b0be2c8b0191b70568040972529 | sigctx/sigctx.go | sigctx/sigctx.go | package sigctx
import (
"os"
"os/signal"
"sync"
"syscall"
"github.com/SentimensRG/ctx"
)
var (
c ctx.C
once sync.Once
)
// New signal-bound ctx.C that terminates when either SIGINT or SIGTERM
// is caught.
func New() ctx.C {
once.Do(func() {
dc := make(chan struct{})
c = dc
ch := make(chan os.Sign... | package sigctx
import (
"os"
"os/signal"
"sync"
"syscall"
"github.com/SentimensRG/ctx"
)
var (
c ctx.C
sigCh chan os.Signal
initC, initSig sync.Once
)
func initSigCh() {
sigCh = make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
}
// New signal-bound ctx.C... | Add Tick, which fires each time a signal is caught | Add Tick, which fires each time a signal is caught
| Go | mit | SentimensRG/ctx |
cb594256caa3cf3556dcf1af623ae2c46ae8a289 | src/php/integration/deploy_a_php_app_with_phpredis_test.go | src/php/integration/deploy_a_php_app_with_phpredis_test.go | package integration_test
import (
"os"
"path/filepath"
"time"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CF PHP Buildpack", func() {
var app *cutlass.App
AfterEach(func() { app = DestroyApp(app) })
Context("deploying a basic PHP... | package integration_test
import (
"os"
"path/filepath"
"time"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CF PHP Buildpack", func() {
var app *cutlass.App
AfterEach(func() { app = DestroyApp(app) })
Context("deploying a basic PHP... | Update test because error message format changed. | Update test because error message format changed.
[#157055578, #157047336]
Signed-off-by: Jackson Feeny <c36636f229e2e0887bbecb5e06d5626818aed501@gmail.com>
| Go | apache-2.0 | cloudfoundry/php-buildpack,cloudfoundry/php-buildpack,cloudfoundry/php-buildpack,cloudfoundry/php-buildpack,cf-identity/php-buildpack,cloudfoundry/php-buildpack,cf-identity/php-buildpack,cf-identity/php-buildpack,cf-identity/php-buildpack,cloudfoundry/php-buildpack,cf-identity/php-buildpack,cf-identity/php-buildpack,cl... |
dc23141dcf5bba4fab44b1f3748d3437d4bd4ece | provider/common/util.go | provider/common/util.go | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package common
import (
"fmt"
"github.com/juju/names"
"github.com/juju/juju/environs"
)
// EnvFullName returns a string based on the provided environment
// that is suitable for identifying the env on a provider.
func E... | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package common
import (
"fmt"
"github.com/juju/names"
"github.com/juju/juju/environs"
)
// EnvFullName returns a string based on the provided environment
// that is suitable for identifying the env on a provider. The re... | Add more rationale to the doc comments for EnvFullName and MachineFullName. | provider/common: Add more rationale to the doc comments for EnvFullName and MachineFullName.
| Go | agpl-3.0 | ericsnowcurrently/juju,howbazaar/juju,Altoros/juju-cloudsigma,mjs/juju,reedobrien/juju,gabriel-samfira/juju,axw/juju,kat-co/juju,sinzui/juju,howbazaar/juju,dimitern/juju,mhilton/juju,voidspace/juju,gabriel-samfira/juju,marcmolla/juju,tasdomas/juju,thomnico/juju,cherylj/juju,kat-co/juju,mjs/juju,mjs/juju,kat-co/juju,dim... |
d8d5fc21527b1a047bcf5fff7b9213cadef5d622 | i18n/messages/extract_test.go | i18n/messages/extract_test.go | package messages
import (
"gnd.la/log"
"os"
"testing"
)
func TestExtract(t *testing.T) {
log.SetLevel(log.LDebug)
m, err := Extract("_test_data", DefaultFunctions(), DefaultTypes(), DefaultTagFields())
if err != nil {
t.Error(err)
}
t.Logf("Messages %v", m)
Write(os.Stdout, m)
}
| package messages
import (
"bytes"
"gnd.la/log"
"io/ioutil"
"path/filepath"
"testing"
)
func TestExtract(t *testing.T) {
log.SetLevel(log.LDebug)
m, err := Extract("_test_data", DefaultFunctions(), DefaultTypes(), DefaultTagFields())
if err != nil {
t.Error(err)
}
var buf bytes.Buffer
if err := Write(&buf... | Update test for message extraction | Update test for message extraction
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
315cf74ac2bb2627fcfadb220668f814086f6022 | imageserver/scanner/api.go | imageserver/scanner/api.go | package scanner
type FilterEntry string
type Filter []FilterEntry
type Directory struct {
}
type Image struct {
filter Filter
topDirectory *Directory
}
type Hash [64]byte
type ImageDataBase struct {
imageMap map[string]*Image
}
func LoadImageDataBase(baseDir string) (*ImageDataBase, error) {
return loa... | package scanner
type FilterEntry string
type Filter []FilterEntry
type Directory struct {
}
type Image struct {
filter Filter
topDirectory *Directory
}
type Hash [64]byte
type Object struct {
length uint64
}
type ImageDataBase struct {
imageMap map[string]*Image
objectMap map[Hash]*Object
}
func Loa... | Define Object type and add objectMap. | Define Object type and add objectMap.
| Go | apache-2.0 | Symantec/Dominator,keep94/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator |
b709538fd684223edb269fb326d92c98b8c1c91a | go/pio/host/internal/allwinner/doc.go | go/pio/host/internal/allwinner/doc.go | // Copyright 2016 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package allwinner exposes H3/A64 AllWinner GPIO functionality.
//
// Datasheet
//
// http://files.pine64.org/doc/datasheet/pine64/Allwinner... | // Copyright 2016 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
// Package allwinner exposes H3/A64 AllWinner GPIO functionality.
//
// Datasheet
//
// A64: http://files.pine64.org/doc/datasheet/pine64/Allw... | Add reference to Allwinner H3 | Add reference to Allwinner H3
| Go | apache-2.0 | maruel/dotstar,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dotstar,maruel/dlibox,maruel/dlibox |
fe19e27865a77bdc4e78957126206a6c2abbcb73 | mem.go | mem.go | package main
import (
"log"
"os/exec"
)
func mem() (string, error) {
mem, err := exec.Command("/usr/bin/free", "-tmo").Output()
if err != nil {
log.Fatal(err)
}
return string(mem), nil
}
| package main
import (
"log"
"os/exec"
)
func mem() (string, error) {
memory := exec.Command("/usr/bin/free", "-tmo")
awk := exec.Command("awk", `BEGIN {OFS=","} {print $1,$2,$3-$6-$7,$4+$6+$7}`)
out, err := memory.StdoutPipe()
if err != nil {
log.Fatal(err)
}
memory.Start()
awk.Stdin = out
mem_out, err ... | Use awk to format free command (incomplete) | Use awk to format free command (incomplete)
| Go | mit | adelq/go-dash |
381b54073efdfe910f4cf5a0f06226d74f18be9d | models/ospatch/entities.go | models/ospatch/entities.go | package ospatch
import "time"
type PatchInfo struct {
Execution_id string
Status string
Start_time time.Time
End_time time.Time
Init_messages []map[string]interface{}
}
| package ospatch
import "github.com/centurylinkcloud/clc-go-cli/base"
type PatchInfo struct {
Execution_id string
Status string
Start_time base.Time
End_time base.Time
Init_messages []map[string]interface{}
}
| Use base.Time for displaying times | Use base.Time for displaying times
| Go | apache-2.0 | CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli |
85c36d6e5d4896943122bf8297470593e2265de6 | model/service/light_bulb.go | model/service/light_bulb.go | package service
import(
"github.com/brutella/hap/model/characteristic"
)
type LightBulb struct {
*Service
On *characteristic.On
Name *characteristic.Name
Brightness *characteristic.Brightness
Saturation *characteristic.Saturation
Hue *characteristic.Hue
}
func NewLightBulb(name string, ... | package service
import(
"github.com/brutella/hap/model/characteristic"
)
type LightBulb struct {
*Service
On *characteristic.On
Name *characteristic.Name
Brightness *characteristic.Brightness
Saturation *characteristic.Saturation
Hue *characteristic.Hue
}
func NewLightBulb(name string, ... | Set correct service type for light bulb service | Set correct service type for light bulb service
| Go | apache-2.0 | brutella/hc,ninjasphere/hc,savaki/hc,mxlje/hc,sjfloat/hc,bahlo/hc |
753f11f669e5083246fb7403f44b316d12897005 | cf/api/resources/space_quotas.go | cf/api/resources/space_quotas.go | package resources
import "github.com/cloudfoundry/cli/cf/models"
type PaginatedSpaceQuotaResources struct {
Resources []SpaceQuotaResource
}
type SpaceQuotaResource struct {
Resource
Entity models.SpaceQuota
}
func (resource SpaceQuotaResource) ToModel() models.SpaceQuota {
entity := resource.Entity
return mo... | package resources
import "github.com/cloudfoundry/cli/cf/models"
type PaginatedSpaceQuotaResources struct {
Resources []SpaceQuotaResource
}
type SpaceQuotaResource struct {
Resource
Entity models.SpaceQuota
}
func (resource SpaceQuotaResource) ToModel() models.SpaceQuota {
entity := resource.Entity
return mo... | Fix instance memory output for space-quota(s). | Fix instance memory output for space-quota(s).
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
7c94a45bbf1f6fa4af9a47f1f21f8a2f5bd5ea25 | auth/auth.go | auth/auth.go | package auth
import (
"time"
"github.com/b2aio/typhon/server"
"golang.org/x/net/context"
)
// AuthenticationProvider provides helper methods to convert tokens to sessions
// using our own internal authorization services
type AuthenticationProvider interface {
// MarshalSession into wire format for transmission b... | package auth
import (
"time"
"golang.org/x/net/context"
)
// AuthenticationProvider provides helper methods to convert tokens to sessions
// using our own internal authorization services
type AuthenticationProvider interface {
// MarshalSession into wire format for transmission between services
MarshalSession(s ... | Revert Authorizer back to taking a context | Revert Authorizer back to taking a context
| Go | mit | monzo/typhon,mondough/typhon |
cf55065be31b1751e5e05d5aca78dff00313ccf4 | pkg/config/server.go | pkg/config/server.go | package config
type Server struct {
Debug bool
API API
DB DB
Helm Helm
LDAP LDAP
SecretsDir string `valid:"dir"`
Enforcer Enforcer
}
func (s Server) IsDebug() bool {
return s.Debug
}
// LDAP contains configuration for LDAP sync service (host, port, DN, filter query and mappi... | package config
type Server struct {
Debug bool
API API
DB DB
Helm Helm
LDAP LDAP
SecretsDir string `valid:"dir"`
Enforcer Enforcer
}
func (s Server) IsDebug() bool {
return s.Debug
}
// LDAP contains configuration for LDAP sync service (host, port, DN, filter query and mappi... | Add option to disable enforcer | Add option to disable enforcer
| Go | apache-2.0 | Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi |
d07ad6ce43c4c4c4a17b8763d8fe275a81215aeb | connections/input_message.go | connections/input_message.go | package connections
import "encoding/json"
type InputMessageType uint8
const (
InputMessageTypeGameCommand InputMessageType = iota
)
type InputMessage struct {
Type InputMessageType
Payload json.RawMessage
}
| package connections
import "encoding/json"
type InputMessageType uint8
const (
InputMessageTypeSnakeCommand InputMessageType = iota
)
type InputMessage struct {
Type InputMessageType
Payload json.RawMessage
}
| Fix input message type name game to snake command | Fix input message type name game to snake command
| Go | bsd-2-clause | ivan1993spb/clever-snake |
7da2256d250f7d6540366e066ba7fa4758aac477 | controller.go | controller.go | package i18n
import (
"github.com/microcosm-cc/bluemonday"
"github.com/qor/admin"
)
var htmlSanitizer = bluemonday.UGCPolicy()
type i18nController struct {
*I18n
}
func (controller *i18nController) Index(context *admin.Context) {
context.Execute("index", controller.I18n)
}
func (controller *i18nController) Upd... | package i18n
import (
"github.com/qor/admin"
"github.com/qor/qor/utils"
)
type i18nController struct {
*I18n
}
func (controller *i18nController) Index(context *admin.Context) {
context.Execute("index", controller.I18n)
}
func (controller *i18nController) Update(context *admin.Context) {
form := context.Request... | Use default HTMLSanitizer from qor utils | Use default HTMLSanitizer from qor utils
| Go | mit | qor/i18n,qor/i18n |
23531be27262f6065cdb46fa4c346b11a8b85a98 | internal/restorer/preallocate_darwin.go | internal/restorer/preallocate_darwin.go | package restorer
import (
"os"
"runtime"
"unsafe"
"golang.org/x/sys/unix"
)
func preallocateFile(wr *os.File, size int64) error {
// try contiguous first
fst := unix.Fstore_t{
Flags: unix.F_ALLOCATECONTIG | unix.F_ALLOCATEALL,
Posmode: unix.F_PEOFPOSMODE,
Offset: 0,
Length: size,
}
_, err := unix... | package restorer
import (
"os"
"golang.org/x/sys/unix"
)
func preallocateFile(wr *os.File, size int64) error {
// try contiguous first
fst := unix.Fstore_t{
Flags: unix.F_ALLOCATECONTIG | unix.F_ALLOCATEALL,
Posmode: unix.F_PEOFPOSMODE,
Offset: 0,
Length: size,
}
err := unix.FcntlFstore(wr.Fd(), un... | Use FcntlFstore to preallocate on Mac | Use FcntlFstore to preallocate on Mac
| Go | bsd-2-clause | restic/restic,restic/restic |
f6583bc41affb9ca601af6f6a9ef5d169d186ffd | src/coordinator/sharding.go | src/coordinator/sharding.go | package coordinator
import (
"cluster"
"protocol"
"time"
)
// duration 1h, 1d, 7d
// split duration to n shards
// if n > 1
// hash using either random or series name
// These are things that the Coordinator need (defined in Coordinator, will have to import cluster package)
type ShardAwareObject interface {
GetS... | package coordinator
import (
"cluster"
"protocol"
"time"
)
// duration 1h, 1d, 7d
// split duration to n shards
// if n > 1
// hash using either random or series name
// These are things that the Coordinator need (defined in Coordinator, will have to import cluster package)
type ShardAwareObject interface {
GetS... | Update Shard Query interface. Add getting shard by series and time | Update Shard Query interface. Add getting shard by series and time | Go | mit | mnuessler/influxdb,stvnwrgs/influxdb,egymgmbh/influxdb,GoIncremental/influxdb,apigee/influxdb,ehagan/InfluxDB,Wikia/influxdb,IMCG/InfluxDB,archsaber/influxdb,bspline/influxdb,radcheb/influxdb,slachiewicz/influxdb,opavader/influxdb,kingland/influxdb,CrazyJvm/influxdb,josephcopenhaver/influxdb,Venu4thFeb/influxdb,GrimDer... |
1feafcea579ef3a05996d2069324df29881b1374 | web/actions/save_form_and_redirect.go | web/actions/save_form_and_redirect.go | package actions
import (
"bones/web/forms"
"bones/web/templating"
"net/http"
)
type SaveFormAndRedirect struct {
ResponseWriter http.ResponseWriter
Request *http.Request
Form forms.Form
SuccessUrl string
ErrorContext templating.TemplateContext
}
func (wf SaveFormAndRedirect) Run() {
f... | package actions
import (
"bones/web/forms"
"bones/web/templating"
"net/http"
)
type SaveFormAndRedirect struct {
ResponseWriter http.ResponseWriter
Request *http.Request
Form forms.Form
SuccessUrl string
ErrorContext templating.TemplateContext
}
func (wf SaveFormAndRedirect) Run() {
i... | Handle form decoding error & refactor | Handle form decoding error & refactor | Go | mit | peterskeide/bones |
ac9b0363cc984d0c80f0fce658c100cd41e23042 | version.go | version.go | package main
var Name string = "developers-account-mapper"
var Version string = "0.1.0"
// GitCommit describes latest commit hash.
// This value is extracted by git command when building.
// To set this from outside, use go build -ldflags "-X main.GitCommit \"$(COMMIT)\""
var GitCommit string
| package main
var Name string = "developers-account-mapper"
var Version string
// GitCommit describes latest commit hash.
// This value is extracted by git command when building.
// To set this from outside, use go build -ldflags "-X main.GitCommit \"$(COMMIT)\""
var GitCommit string
| Remove default value for Version | Remove default value for Version
| Go | mit | wantedly/developers-account-mapper |
2a00ba31cb80f52454d0e67269b8c71c4ef69dd0 | database/migrations/7_addUuidColumnToEnvironmentConfigsTable.go | database/migrations/7_addUuidColumnToEnvironmentConfigsTable.go | package migrations
import (
"github.com/rubenv/sql-migrate"
)
func addUuidColumnToEnvironmentConfigsTable() *migrate.Migration {
return &migrate.Migration{
Id: "7",
Up: []string{`
ALTER TABLE environment_configs
ADD COLUMN uuid varchar(36) NOT NULL AFTER id,
ADD CONSTRAINT uix_environment_... | package migrations
import (
"github.com/rubenv/sql-migrate"
)
func addUuidColumnToEnvironmentConfigsTable() *migrate.Migration {
return &migrate.Migration{
Id: "7",
Up: []string{`
ALTER TABLE environment_configs
ADD COLUMN uuid varchar(36) NOT NULL AFTER id DEFAULT uuid(),
ADD CONSTRAINT uix_envi... | Add default uuid function for unique constraint | Add default uuid function for unique constraint | Go | mit | generationtux/brizo,generationtux/brizo,generationtux/brizo,generationtux/brizo,generationtux/brizo |
0498ed53bb886d2aefc174501f8b6dca3e48cd98 | shared/logging/log_posix.go | shared/logging/log_posix.go | // +build linux darwin
package logging
import (
slog "log/syslog"
log "gopkg.in/inconshreveable/log15.v2"
)
// getSystemHandler on Linux writes messages to syslog.
func getSystemHandler(syslog string, debug bool, format log.Format) log.Handler {
// SyslogHandler
if syslog != "" {
if !debug {
return log.Lvl... | // +build linux darwin
package logging
import (
log "gopkg.in/inconshreveable/log15.v2"
)
// getSystemHandler on Linux writes messages to syslog.
func getSystemHandler(syslog string, debug bool, format log.Format) log.Handler {
// SyslogHandler
if syslog != "" {
if !debug {
return log.LvlFilterHandler(
l... | Revert "Temporary workaround for log15 API breakage" | Revert "Temporary workaround for log15 API breakage"
This reverts commit 7c88b008b7f01972b2b366430ae9ac0ed743caf3.
This is needed as the archive copy of log15 is fine.
Signed-off-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>
| Go | apache-2.0 | lxc/lxd-pkg-ubuntu,lxc/lxd-pkg-ubuntu,lxc/lxd-pkg-ubuntu |
99d8e90c90cee52e7369de0b83b216dd77f40f0f | compat.go | compat.go | package p5r
// Compatability functions for the "regexp" package
// MatchString return true if the string matches the regex
// Returns false if an error/timeout occurs
func (re *Regexp) MatchString(s string) bool {
m, err := re.run(true, -1, getRunes(s))
if err != nil {
return false
}
return m != nil
}
// Repla... | package p5r
import (
goregexp "regexp"
)
// Compatability functions for the "regexp" package
// MatchString return true if the string matches the regex
// Returns false if an error/timeout occurs
func (re *Regexp) MatchString(s string) bool {
m, err := re.run(true, -1, getRunes(s))
if err != nil {
return false
... | Add conversion function to go Regexp | Add conversion function to go Regexp
| Go | mit | xyproto/p5r |
34ab2dfcb1651ade8e18cd7cf1f07b556e548d90 | api/naisrequest/deploy_test.go | api/naisrequest/deploy_test.go | package naisrequest
import (
"encoding/json"
"testing"
"github.com/nais/naisd/api/naisrequest"
"github.com/stretchr/testify/assert"
)
func TestStringMethodInDeployNaisRequestShouldHidePasswordAndUsername(t *testing.T) {
deployRequest := naisrequest.Deploy{
FasitUsername: "username" ,
FasitPass... | package naisrequest
import (
"encoding/json"
"testing"
"github.com/nais/naisd/api/naisrequest"
"github.com/stretchr/testify/assert"
)
func TestStringMethodInDeployNaisRequestShouldHidePasswordAndUsername(t *testing.T) {
deployRequest := naisrequest.Deploy{
FasitUsername: "username" ,
FasitPass... | ADD negative test for unmasked password | ADD negative test for unmasked password
| Go | mit | nais/naisd,nais/naisd |
07fa0ed0bde1554ece5c18dcb3237114175c1c73 | consistency/instances_provider.go | consistency/instances_provider.go | package consistency
import (
"encoding/json"
"os"
"github.com/pivotal-cf/cf-redis-broker/redis"
)
type InstancesProvider interface {
Instances() ([]redis.Instance, error)
}
type stateFileAvailableInstances struct {
path string
}
func NewStateFileAvailableInstances(path string) *stateFileAvailableInstances {
... | package consistency
import (
"encoding/json"
"os"
"github.com/pivotal-cf/cf-redis-broker/redis"
)
type InstancesProvider interface {
Instances() ([]redis.Instance, error)
}
type stateFileAvailableInstances struct {
path string
}
func NewStateFileAvailableInstances(path string) *stateFileAvailableInstances {
... | Fix function comments based on best practices from Effective Go | Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <c71e7261d37a4f6ae4cfb0cbd79081310a237e67@codelingo.io>
| Go | apache-2.0 | pivotal-cf/cf-redis-broker,pivotal-cf/cf-redis-broker |
b020b690d15205c8fd40e87edbe6e6331a45be63 | checks/extensions/nameconstraints/nameconstraints.go | checks/extensions/nameconstraints/nameconstraints.go | package nameconstraints
import (
"encoding/asn1"
"crypto/x509/pkix"
"github.com/globalsign/certlint/certdata"
"github.com/globalsign/certlint/checks"
"github.com/globalsign/certlint/errors"
)
const checkName = "NameConstraints Extension Check"
var extensionOid = asn1.ObjectIdentifier{2, 5, 29, 30}
func init(... | package nameconstraints
import (
"encoding/asn1"
"crypto/x509/pkix"
"github.com/globalsign/certlint/certdata"
"github.com/globalsign/certlint/checks"
"github.com/globalsign/certlint/errors"
)
const checkName = "NameConstraints Extension Check"
var extensionOid = asn1.ObjectIdentifier{2, 5, 29, 30}
func init(... | Return Warning instead of Err when Critical | Return Warning instead of Err when Critical
Name constraints do officially need to be set critical, often they are not because many implementations still don't support Name Constraints. This change returns a warning instead of an error using the custom error package. | Go | apache-2.0 | globalsign/certlint |
fb46262897f93c101c0a7d79e62e2ea9c0f0ad24 | src/sh/sh.go | src/sh/sh.go | // Copyright 2012 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
sh reads in a line at a time and runs it.
prompt is '% '
*/
package main
import (
"os/exec"
"fmt"
"os"
"strings"
"bufio"
)
func main() {
if len(... | // Copyright 2012 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
sh reads in a line at a time and runs it.
prompt is '% '
*/
package main
import (
"os/exec"
"fmt"
"os"
"strings"
"bufio"
)
func main() {
if len(... | Print the path when things don't work. | Print the path when things don't work.
Signed-off-by: Ronald G. Minnich <f569d0af9a3481c4007b95c7180d6c41009f2513@gmail.com>
| Go | bsd-3-clause | rminnich/u-root,u-root/u-root,GanShun/u-root,GanShun/u-root,rminnich/u-root,hugelgupf/u-root,rminnich/u-root,u-root/u-root,hugelgupf/u-root,hugelgupf/u-root,GanShun/u-root,hugelgupf/u-root,u-root/u-root,rminnich/u-root |
b7aa6b9916cfae8bb8f26e41569a6238809917cd | main.go | main.go | package main
import (
"github.com/dmaj/docker-volume-netshare/netshare"
)
var VERSION string = ""
var BUILD_DATE string = ""
func main() {
netshare.Version = VERSION
netshare.BuildDate = BUILD_DATE
netshare.Execute()
}
| package main
import (
"github.com/ContainX/docker-volume-netshare/netshare"
)
var VERSION string = ""
var BUILD_DATE string = ""
func main() {
netshare.Version = VERSION
netshare.BuildDate = BUILD_DATE
netshare.Execute()
}
| Fix import to original repository | Fix import to original repository
Probably not intended in: 65b6f423deecb93f09601aef352356a1d57c7c0f
| Go | apache-2.0 | ContainX/docker-volume-netshare,ContainX/docker-volume-netshare |
2796c102342b8408db9f7b5647c6717f3669e810 | main.go | main.go | package main
import (
"fmt"
"os"
"os/user"
"strconv"
"strings"
"syscall"
)
func checkError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(111)
}
}
func main() {
//path := os.Getenv("PATH")
user, err := user.Lookup(os.Args[1])
checkError(err)
uid, err := strconv.Atoi(user.Uid)
checkError(er... | package main
import (
"fmt"
"os"
"os/user"
"strconv"
"strings"
"syscall"
)
func checkError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(111)
}
}
func main() {
username := os.Args[1]
program := os.Args[2]
user, err := user.Lookup(username)
checkError(err)
uid, err := strconv.Atoi(user.Uid... | Use variables instead of os.Args | Use variables instead of os.Args
Instead of using the index of an array, use clear names to show what the
index of os.Args should be holding.
| Go | mit | tmiller/setuidgid |
8cc8ad3ddb7aca6a47d36f5b556e2e75860b8e5c | main.go | main.go | package main
import (
"bufio"
"fmt"
"log"
"os/exec"
"github.com/mgutz/ansi"
)
func main() {
cmd := exec.Command("./a.sh")
err := runCommand(cmd)
if err != nil {
log.Fatal(err)
}
}
func runCommand(cmd *exec.Cmd) error {
stdout, err := cmd.StdoutPipe()
if err != nil {
return err
}
stderr, err := cmd.... | package main
import (
"bufio"
"fmt"
"io"
"log"
"os/exec"
"github.com/mgutz/ansi"
)
func main() {
cmd := exec.Command("./a.sh")
err := runCommand(cmd)
if err != nil {
log.Fatal(err)
}
}
func runCommand(cmd *exec.Cmd) error {
stdout, err := cmd.StdoutPipe()
if err != nil {
return err
}
stderr, err :... | Create a helper function for reading and writing stdout or stderr | Create a helper function for reading and writing stdout or stderr
| Go | mit | hnakamur/execcommandexample,hnakamur/execcommandexample |
d4c367852258e8c9fd2946de9c037ed311710fd9 | probers/packages/rpm.go | probers/packages/rpm.go | package packages
import (
"io"
)
func probeRpms(pList *packageList, reader io.Reader) error {
return nil
}
| package packages
import (
"bufio"
"bytes"
"io"
"os/exec"
"strconv"
"strings"
)
func probeRpms(pList *packageList, reader io.Reader) error {
cmd := exec.Command("rpm", "-qa", "--queryformat",
"%{NAME} %{VERSION}-%{RELEASE} %{SIZE}\n")
stdout, err := cmd.Output()
if err != nil {
return err
}
scanner := b... | Add support for RPM packages. | Add support for RPM packages.
| Go | apache-2.0 | Symantec/health-agent,rgooch/health-agent,rgooch/health-agent,Symantec/health-agent |
8699545aa50426be14a575f141a033bc4ac5232f | WxShield2/wxplot/wxPlot/main.go | WxShield2/wxplot/wxPlot/main.go | package main
import (
"github.com/alecthomas/kingpin"
_ "github.com/cockroachdb/pq"
"github.com/npotts/arduino/WxShield2/wxplot"
"os"
)
var (
app = kingpin.New("wxPlot", "Plot data pulled from postgres/cockroachdb")
dataSourceName = app.Flag("dataSource", "Where should we connect to and yank data fro... | package main
import (
"github.com/alecthomas/kingpin"
_ "github.com/cockroachdb/pq"
"github.com/npotts/arduino/WxShield2/wxplot"
"os"
)
var (
app = kingpin.New("wxPlot", "Plot data pulled from postgres/cockroachdb")
dataSourceName = app.Flag("dataSource", "Where should we connect to and yank data fro... | Add option to shovel output files to a particular directory | Add option to shovel output files to a particular directory
| Go | mit | npotts/arduino,npotts/arduino,npotts/arduino,npotts/arduino,npotts/arduino |
acf60a8d46dd508c7919b4eaeb5b61d4e2187f88 | cmd/util.go | cmd/util.go | // +build linux darwin freebsd
package cmd
import (
"fmt"
"log"
"os"
"strings"
"time"
)
// ReturnCurrentUTC returns the current UTC time in RFC3339 format.
func ReturnCurrentUTC() string {
t := time.Now().UTC()
dateUpdated := (t.Format(time.RFC3339))
return dateUpdated
}
// SetDirection returns the directio... | // +build linux darwin freebsd
package cmd
import (
"fmt"
"log"
"os"
"strings"
"time"
)
// ReturnCurrentUTC returns the current UTC time in RFC3339 format.
func ReturnCurrentUTC() string {
t := time.Now().UTC()
dateUpdated := (t.Format(time.RFC3339))
return dateUpdated
}
// SetDirection returns the directio... | Fix edge case when you just loaded the binary and didn't have a command or a flag. | Fix edge case when you just loaded the binary and didn't have a command or a flag.
| Go | mit | octohost/octo,octohost/octo |
f261e1402662b73208365da6ae1022fe938f364b | unit_test.go | unit_test.go | package fnlog_test
import (
"github.com/northbright/fnlog"
"log"
)
func Example() {
iLog := fnlog.New("i")
wLog := fnlog.New("w")
eLog := fnlog.New("e")
var noTagLog *log.Logger = fnlog.New("")
iLog.Printf("print infos")
wLog.Printf("print warnnings")
eLog.Printf("print errors")
noTagLog.Printf("print mess... | package fnlog_test
import (
"github.com/northbright/fnlog"
"log"
)
var (
noTagLog *log.Logger
)
func Example() {
iLog := fnlog.New("i")
wLog := fnlog.New("w")
eLog := fnlog.New("e")
// Global *log.Logger
noTagLog = fnlog.New("")
iLog.Printf("print infos")
wLog.Printf("print warnnings")
eLog.Printf("prin... | Add global package-level declaration to make the whole file example work | Add global package-level declaration to make the whole file example work
| Go | mit | vonwenm/fnlog |
7101b0f7cb4064f5c901632392a3992a070ed13e | operation.go | operation.go | package oplogc
import "time"
type Operation struct {
// ID holds the operation id used to resume the streaming in case of connection failure.
ID string
// Event is the kind of operation. I can be one of insert, update or delete.
Event string
// Data holds the operation metadata.
Data *OperationData
ack chan<-... | package oplogc
import "time"
type Operation struct {
// ID holds the operation id used to resume the streaming in case of connection failure.
ID string
// Event is the kind of operation. It can be insert, update or delete.
Event string
// Data holds the operation metadata.
Data *OperationData
ack chan<- Opera... | Fix a typo in the documentation. | Fix a typo in the documentation. | Go | mit | dailymotion/oplogc |
8a951cf7c1e9d2ac5ad17892c6b760ea926ff643 | deansify.go | deansify.go | // Package deansify strips ANSI escape codes from either a named file or
// from STDIN.
package deansify
import (
"bufio"
"io"
"log"
"os"
"regexp"
)
var version = "0.0.2"
var ansiRegexp = regexp.MustCompile("\x1b[^m]*m")
func stripAnsi(s string) string {
return ansiRegexp.ReplaceAllLiteralString(s, "")
}
func... | // Package deansify strips ANSI escape codes from either a named file or
// from STDIN.
package deansify
import (
"bufio"
"fmt"
"io"
"log"
"os"
"regexp"
)
var version = "0.0.2"
var ansiRegexp = regexp.MustCompile("\x1b[^m]*m")
func stripAnsi(s string) string {
return ansiRegexp.ReplaceAllLiteralString(s, "")
... | Use fmt.Print instead of the print builtin in stripReader | Use fmt.Print instead of the print builtin in stripReader
| Go | mit | dpritchett/deansify,dpritchett/deansify |
4301bbff08f60dbc254753309be1cc18055539ce | pkg/kubelet/dockershim/docker_streaming_windows.go | pkg/kubelet/dockershim/docker_streaming_windows.go | // +build windows
/*
Copyright 2019 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 agr... | // +build windows
/*
Copyright 2019 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 agr... | Use ipv4 in wincat port forward | Use ipv4 in wincat port forward
| Go | apache-2.0 | krmayankk/kubernetes,lojies/kubernetes,jfrazelle/kubernetes,spzala/kubernetes,mYmNeo/kubernetes,li-ang/kubernetes,cadmuxe/kubernetes,feiskyer/kubernetes,hex108/kubernetes,olivierlemasle/kubernetes,jagosan/kubernetes,zhouhaibing089/kubernetes,sanjeevm0/kubernetes,tengqm/kubernetes,erwinvaneyk/kubernetes,GulajavaMinistud... |
d8f2cbc648a4d5b97c4d4daf999f2a4a21f909de | server.go | server.go | package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"gopkg.in/unrolled/render.v1"
"net/http"
)
var printer = render.New(render.Options {
Layout: "layout",
IndentJSON: true,
})
func main() {
router := mux.NewRouter().StrictSlash(true)
router.Path("/").Handle... | package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"gopkg.in/unrolled/render.v1"
"net/http"
)
var printer = render.New(render.Options {
Layout: "layout",
IndentJSON: true,
})
func main() {
router := mux.NewRouter().StrictSlash(true)
router.Path("/").Handle... | Use Urls instead of Resources for name | Use Urls instead of Resources for name
| Go | mit | glevine/burl |
c6ab2c976b4e081deeefdcae50bca13f02e32dcf | gogdb_test.go | gogdb_test.go | package godbg
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestProject(t *testing.T) {
Convey("Test buffers", t, func() {
Convey("By Default, equals to std", func() {
So(Out(), ShouldEqual, os.Stdout)
So(Err(), ShouldEqual, os.Stderr)
})
Convey("When set to buffer, no l... | package godbg
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestProject(t *testing.T) {
Convey("Test buffers", t, func() {
Convey("By Default, equals to std", func() {
So(Out(), ShouldEqual, os.Stdout)
So(Err(), ShouldEqual, os.Stderr)
})
Convey("When set to buffer, no l... | Test buffers for a new instance of Pdbg | Test buffers for a new instance of Pdbg
| Go | mit | VonC/godbg |
dcd7d0b4c61e204121f316665e7bc05efb1196b7 | glib/gbinding_since_2_68.go | glib/gbinding_since_2_68.go | // +build !glib_deprecated
package glib
// #include <gio/gio.h>
// #include <glib.h>
// #include <glib-object.h>
// #include "glib.go.h"
import "C"
import "unsafe"
// DupSource is a wrapper around g_binding_dup_source().
func (v *Binding) DupSource() *Object {
obj := C.g_binding_dup_source(v.native())
if obj == ni... | //go:build !glib_deprecated && !glib_2_40 && !glib_2_42 && !glib_2_44 && !glib_2_46 && !glib_2_48 && !glib_2_50 && !glib_2_52 && !glib_2_54 && !glib_2_56 && !glib_2_58 && !glib_2_60 && !glib_2_62 && !glib_2_64 && !glib_2_66
// +build !glib_deprecated,!glib_2_40,!glib_2_42,!glib_2_44,!glib_2_46,!glib_2_48,!glib_2_50,!gl... | Update Binding build tags to only build on later versions of Glib. This adds the build tags in both the old and new format, for maximum compatibility. | Update Binding build tags to only build on later versions of Glib. This adds the build tags in both the old and new format, for maximum compatibility.
| Go | isc | gotk3/gotk3,gotk3/gotk3 |
2e3dc056df878fb0ee0c3718b7e1ede509fa6333 | proto/sub/messages.go | proto/sub/messages.go | package sub
import (
"github.com/Symantec/Dominator/lib/filesystem"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/lib/triggers"
"github.com/Symantec/Dominator/proto/common"
"github.com/Symantec/Dominator/sub/scanner"
)
type Configuration struct {
ScanSpeedPercent uint
NetworkSpeedP... | package sub
import (
"github.com/Symantec/Dominator/lib/filesystem"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/lib/triggers"
"github.com/Symantec/Dominator/proto/common"
"github.com/Symantec/Dominator/sub/scanner"
)
type Configuration struct {
ScanSpeedPercent uint
NetworkSpeedP... | Add HardlinksToMake to UpdateRequest RPC message. | Add HardlinksToMake to UpdateRequest RPC message.
| Go | apache-2.0 | rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator |
8c19d3d91c0cada73a884a9ea80379afae837d7b | align_test.go | align_test.go | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package nwalgo
import (
"testing"
)
func TestAlign(t *testing.T) {
seqs := [][]string{
[]string{"CGAGAGA", "GAGAGA", "CGAGAGA", "-GAGAGA"}}
for _, a :=... | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package nwalgo
import (
"testing"
)
func TestAlign(t *testing.T) {
seqs := [][]string{
[]string{"CGAGAGA", "GAGAGA", "CGAGAGA", "-GAGAGA"}}
for _, a :=... | Add basic benchmark for Align | Add basic benchmark for Align
| Go | mit | aebruno/nwalgo |
153ce8b0a263edce819a5df534ff89a100c5454a | human_time.go | human_time.go | package main
import (
"github.com/dustin/go-humanize"
"time"
"strings"
)
func HumanTime(time time.Time) string {
original := humanize.Time(time)
parts := strings.Split(original, " ")
return parts[0] + " " + parts[1]
}
| package main
import (
"github.com/dustin/go-humanize"
"time"
"strings"
"math"
)
func HumanTime(time time.Time) string {
original := humanize.Time(time)
parts := strings.Split(original, " ")
length := int(math.Min(float64(len(parts)), 2)) // now / x minutes
parts = parts[:length]
re... | Fix fatal error when pokemon expires “now” | Fix fatal error when pokemon expires “now”
| Go | mit | jacobmarshall/pokevision-cli,jacobmarshall/pokevision-cli |
91100e20169d61798d0fcd2ab631fc5448e809b8 | util/hashutil/pkg.go | util/hashutil/pkg.go | // Package hashutil provides alloc free alternatives for pkg/hash
package hashutil
func HashStringFnv64a(str string) uint64 {
h := NewInlineFNV64a()
h.WriteString(str)
return h.Sum64()
}
| // Package hashutil provides alloc free alternatives for pkg/hash
package hashutil
func HashStringFnv64a(str string) uint64 {
h := NewInlineFNV64a()
h.WriteString(str)
return h.Sum64()
}
// TODO:
// https://segment.com/blog/allocation-efficiency-in-high-performance-go-services/
// https://github.com/segmentio/fast... | Update refer for perf optimization | [hashutil][doc] Update refer for perf optimization
- https://segment.com/blog/allocation-efficiency-in-high-performance-go-services/
- https://github.com/segmentio/fasthash
| Go | mit | dyweb/gommon,dyweb/gommon,dyweb/gommon |
d5a81790687a6aeaa8fd89165ee6f90309061bee | usb/libusb_cgo_benchmark_test.go | usb/libusb_cgo_benchmark_test.go | package usb
import "testing"
func BenchmarkCGo(b *testing.B) {
for _, bc := range []struct {
name string
bfunc func(*libusbContext, int)
}{
{
name: "simple function",
bfunc: func(ctx *libusbContext, N int) {
for i := 0; i < N; i++ {
libusbSetDebug(ctx, i&1)
}
},
},
{
name: "metho... | package usb
import "testing"
func BenchmarkCGo(b *testing.B) {
for _, bc := range []struct {
name string
bfunc func(*libusbContext, int)
}{
{
name: "simple function",
bfunc: func(ctx *libusbContext, N int) {
for i := 0; i < N; i++ {
libusbSetDebug(ctx, i&1)
}
},
},
{
name: "metho... | Exit libusb context when done. | Exit libusb context when done.
| Go | apache-2.0 | google/gousb,bernhardgoedel/gousb,google/gousb,google/gousb,bernhardgoedel/gousb,bernhardgoedel/gousb |
5a003f0a067cde6e6b0f0fd9b0d7ba13444670b6 | cloud/amazon/awsSdkGo/sdk.go | cloud/amazon/awsSdkGo/sdk.go | package awsSdkGo
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/s3"
)
type Sdk struct {
Ec2 *ec2.EC2
S3 *s3.S3
ASG *autoscaling.AutoScaling
}
func NewS... | package awsSdkGo
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/s3"
)
type Sdk struct {
Ec2 *ec2.EC2
... | Support MFA and roles when doing auth | Support MFA and roles when doing auth
| Go | apache-2.0 | kris-nova/kubicorn,k4k/kubicorn,kris-nova/kubicorn,k4k/kubicorn |
6e7b35036bf2e4421b599a007e55858c9042ddc9 | optimizer/gradientdescent/gradientdescent_test.go | optimizer/gradientdescent/gradientdescent_test.go | package gradientdescent_test
| package gradientdescent_test
import (
"github.com/amitkgupta/goodlearn/optimizer/gradientdescent"
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("GradientDescent", func() {
var goodGradient func([]float64) ([]float64, error)
BeforeEach(func() {
goodGradient = func(x []flo... | Add test for gradient descent | Add test for gradient descent
| Go | mit | amitkgupta/goodlearn |
4531cf31257db14549af03dff989cc5c4bc55b55 | multi_error.go | multi_error.go | package lib
import (
"errors"
"strings"
)
// MultiError implements error interface.
// An instance of MultiError has zero or more errors.
type MultiError struct {
errs []error
}
// Push adds an error to MultiError.
func (m *MultiError) Push(errString string) {
m.errs = append(m.errs, errors.New(errString))
}
//... | package lib
import (
"errors"
"strings"
)
// MultiError implements error interface.
// An instance of MultiError has zero or more errors.
type MultiError struct {
errs []error
}
// Push adds an error to MultiError.
func (m *MultiError) Push(errString string) {
m.errs = append(m.errs, errors.New(errString))
}
//... | Use array if fixed size length for errors | Use array if fixed size length for errors
| Go | mit | rShetty/multierror |
2354c5e2bb0c0132cd6f91d7f772fdce481d1950 | command/v7/passwd_command.go | command/v7/passwd_command.go | package v7
import (
"code.cloudfoundry.org/cli/command/translatableerror"
)
type PasswdCommand struct {
BaseCommand
usage interface{} `usage:"CF_NAME passwd"`
}
func (cmd PasswdCommand) Execute(args []string) error {
err := cmd.SharedActor.CheckTarget(false, false)
if err != nil {
return err
}
currentUser... | package v7
import (
"code.cloudfoundry.org/cli/command/translatableerror"
)
type PasswdCommand struct {
BaseCommand
usage interface{} `usage:"CF_NAME passwd"`
}
func (cmd PasswdCommand) Execute(args []string) error {
err := cmd.SharedActor.CheckTarget(false, false)
if err != nil {
return err
}
currentUser... | Remove extra newline from `passwd` output | v7: Remove extra newline from `passwd` output
[Finishes #172301989]
Authored-by: Reid Mitchell <15b84f3bcf1e0a1a99817cc9360cedc980d7c5b6@pivotal.io>
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
7ec0fb7f2deda3ed64329b98feba6a20a8ca18c5 | environs/local/environ_test.go | environs/local/environ_test.go | // Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package local_test
import (
gc "launchpad.net/gocheck"
"launchpad.net/juju-core/environs/local"
jc "launchpad.net/juju-core/testing/checkers"
)
type environSuite struct {
baseProviderSuite
}
var _ = gc.Suite(&environSu... | // Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package local_test
import (
gc "launchpad.net/gocheck"
"launchpad.net/juju-core/environs/local"
jc "launchpad.net/juju-core/testing/checkers"
)
type environSuite struct {
baseProviderSuite
}
var _ = gc.Suite(&environSu... | Test that the environment as non-nil storage. | Test that the environment as non-nil storage. | Go | agpl-3.0 | tsakas/juju,dooferlad/juju,mhilton/juju,mikemccracken/juju,tych0/juju,kat-co/juju,gabriel-samfira/juju,tsakas/juju,cloud-green/juju,mjs/juju,bogdanteleaga/juju,marcmolla/juju,thomnico/juju,ericsnowcurrently/juju,perrito666/juju,fwereade/juju,dimitern/juju,howbazaar/juju,perrito666/juju,marcmolla/juju,gabriel-samfira/ju... |
39b5a22f7ffa4202be49945b1ae88159c0173f72 | utils.go | utils.go | package minion
// AllRoutes a shortcut to be used on the UnauthenticatedRoutes when
// you want to have all your routes without jwt verification
const AllRoutes = "^.*$"
func lastChar(str string) (lc uint8) {
size := len(str)
if size == 0 {
return lc
}
return str[size-1]
}
| package minion
// AllRoutes a shortcut to be used on the UnauthenticatedRoutes when
// you want to have all your routes without jwt verification
var AllRoutes = []string{"^.*$"}
func lastChar(str string) (lc uint8) {
size := len(str)
if size == 0 {
return lc
}
return str[size-1]
}
| Simplify the shortcut for AllRoutes | Simplify the shortcut for AllRoutes
| Go | mit | ustrajunior/minion |
6227e3a1f277fa7f36bdce3d100279ec245fcc73 | go/src/socialapi/workers/sitemap/sitemapgenerator/main.go | go/src/socialapi/workers/sitemap/sitemapgenerator/main.go | package main
import (
"fmt"
"socialapi/workers/common/runner"
"socialapi/workers/helper"
"socialapi/workers/sitemap/sitemapgenerator/generator"
)
var (
Name = "SitemapGenerator"
)
func main() {
r := runner.New(Name)
if err := r.Init(); err != nil {
fmt.Println(err)
return
}
redisConn := helper.MustIni... | package main
import (
"fmt"
"socialapi/workers/common/runner"
"socialapi/workers/helper"
"socialapi/workers/sitemap/sitemapgenerator/generator"
)
var (
Name = "SitemapGenerator"
)
func main() {
r := runner.New(Name)
if err := r.Init(); err != nil {
fmt.Println(err)
return
}
redisConn := helper.MustIni... | Change handler variable to controller | Sitemap: Change handler variable to controller
| Go | agpl-3.0 | koding/koding,szkl/koding,sinan/koding,andrewjcasal/koding,alex-ionochkin/koding,acbodine/koding,rjeczalik/koding,koding/koding,sinan/koding,szkl/koding,rjeczalik/koding,mertaytore/koding,andrewjcasal/koding,acbodine/koding,koding/koding,koding/koding,kwagdy/koding-1,gokmen/koding,kwagdy/koding-1,jack89129/koding,usiri... |
c5a6b9f60c0cf2b3a12e3df8989a229484d42872 | go/vt/vtgate/buffer/check_error_opensource.go | go/vt/vtgate/buffer/check_error_opensource.go | package buffer
import (
"strings"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/vt/vterrors"
vtrpcpb "github.com/youtube/vitess/go/vt/proto/vtrpc"
)
// This function is in a separate file to make it easier to swap out an
// open-source implementation with any internal Google-only implementation.
... | package buffer
import (
"strings"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/vt/vterrors"
vtrpcpb "github.com/youtube/vitess/go/vt/proto/vtrpc"
)
// This function is in a separate file to make it easier to swap out an
// open-source implementation with any internal Google-only implementation.
... | Add matching for errno 1290 if no error message is present. | vtgate/buffer: Add matching for errno 1290 if no error message is present.
The error message can be omitted if -queryserver-config-terse-errors is enabled.
| Go | apache-2.0 | rnavarro/vitess,tirsen/vitess,rnavarro/vitess,rnavarro/vitess,HubSpot/vitess,davygeek/vitess,enisoc/vitess,tirsen/vitess,vitessio/vitess,dcadevil/vitess,alainjobart/vitess,mattharden/vitess,HubSpot/vitess,tirsen/vitess,mattharden/vitess,vitessio/vitess,enisoc/vitess,vitessio/vitess,pivanof/vitess,dcadevil/vitess,dcadev... |
1128a7c6249e54f53c7efb48e4334892d3155cf9 | p2p/net/pnet/entry.go | p2p/net/pnet/entry.go | package pnet
import (
"io"
ipnet "github.com/libp2p/go-libp2p-interface-pnet"
)
func NewProtector(input io.Reader) (ipnet.Protector, error) {
psk, err := decodeV1PSKKey(input)
if err != nil {
return nil, err
}
return &protector{psk}, nil
}
| package pnet
import (
"bytes"
ipnet "github.com/libp2p/go-libp2p-interface-pnet"
)
func NewProtector(key []byte) (ipnet.Protector, error) {
reader := bytes.NewReader(key)
psk, err := decodeV1PSKKey(reader)
if err != nil {
return nil, err
}
return &protector{psk}, nil
}
| Move from reader base ctor to bytestring based one | Move from reader base ctor to bytestring based one
| Go | mit | ipfs/go-libp2p,libp2p/go-libp2p,libp2p/go-libp2p |
a646f76b1f34d5e94a474720beab4c3396fffd83 | jiradata/TransitionsFuncs.go | jiradata/TransitionsFuncs.go | package jiradata
import (
"strings"
)
// Find will search the transitions for one that matches
// the given name. It will return a valid trantion that matches
// or nil
func (t Transitions) Find(name string) *Transition {
name = strings.ToLower(name)
for _, trans := range t {
if strings.Contains(strings.ToLower... | package jiradata
import (
"strings"
)
// Find will search the transitions for one that matches
// the given name. It will return a valid trantion that matches
// or nil
func (t Transitions) Find(name string) *Transition {
name = strings.ToLower(name)
matches := []Transitions{}
for _, trans := range t {
if stri... | Choose exact transition match if available | Choose exact transition match if available
| Go | apache-2.0 | Netflix-Skunkworks/go-jira,Netflix-Skunkworks/go-jira,Netflix-Skunkworks/go-jira,go-jira/jira,go-jira/jira |
e3770253fbc527e6f9cd7b5b506b1858f8debca5 | import_aws_sqs_queue_test.go | import_aws_sqs_queue_test.go | package aws
import (
"testing"
"fmt"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSSQSQueue_importBasic(t *testing.T) {
resourceName := "aws_sqs_queue.queue-with-defaults"
queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5))
reso... | package aws
import (
"testing"
"fmt"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSSQSQueue_importBasic(t *testing.T) {
resourceName := "aws_sqs_queue.queue"
queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5))
resource.Test(t, r... | Change the resource name expected as part of sqs queue import test | provider/aws: Change the resource name expected as part of sqs queue import test
| Go | mpl-2.0 | ClementCunin/terraform-provider-aws,terraform-providers/terraform-provider-aws,nbaztec/terraform-provider-aws,ashinohara/terraform-provider-aws,kjmkznr/terraform-provider-aws,nbaztec/terraform-provider-aws,nbaztec/terraform-provider-aws,terraform-providers/terraform-provider-aws,Ninir/terraform-provider-aws,ashinohara/... |
86160af288c338d0b661a83c2f6da7da71b49777 | env/config.go | env/config.go | package env
import (
"encoding/json"
"flag"
"os"
)
type config struct {
Database string `json:"database"`
Telegram telegram `json:"telegram"`
VK vk `json:"vk"`
}
type telegram struct {
Webhook string `json:"webhook"`
Token string `json:"token"`
}
type vk struct {
Confirmation string `json:"... | package env
import (
"encoding/json"
"flag"
"os"
"path"
)
type config struct {
Database string `json:"database"`
Telegram telegram `json:"telegram"`
VK vk `json:"vk"`
Migrations string
}
type telegram struct {
Webhook string `json:"webhook"`
Token string `json:"token"`
}
type vk stru... | Add migrations path to env.Config | Add migrations path to env.Config
| Go | mit | droptheplot/rand_chat,droptheplot/rand_chat,droptheplot/rand_chat,droptheplot/rand_chat |
c3901ea2ea5913c711f65f1f3b7fa9d9b5b356e5 | pes/packet_channel.go | pes/packet_channel.go | package pes
type PacketChannel <-chan *Packet
func (input PacketChannel) PayloadOnly() <-chan []byte {
output := make(chan []byte)
go func() {
for packet := range input {
output <- packet.Payload
}
close(output)
}()
return output
}
| package pes
type PacketChannel <-chan *Packet
func (input PacketChannel) PayloadOnly() <-chan []byte {
output := make(chan []byte)
go func() {
defer close(output)
for packet := range input {
output <- packet.Payload
}
}()
return output
}
| Use defer to schedule channel closing | Use defer to schedule channel closing
| Go | mit | 32bitkid/mpeg |
55f5a4b9ed23d556e3693869cf7d23173fb11156 | src/cf/errors/http_error.go | src/cf/errors/http_error.go | package errors
import "fmt"
type HttpError interface {
Error
StatusCode() int
Headers() string
Body() string
}
type httpError struct {
statusCode int
headers string
body string
code string
description string
}
type HttpNotFoundError struct {
*httpError
}
func NewHttpError(statusCode in... | package errors
import "fmt"
type HttpError interface {
error
StatusCode() int // actual HTTP status code
ErrorCode() string // error code returned in response body from CC or UAA
Headers() string // see: known_error_codes.go
Body() string
}
type httpError struct {
statusCode int
headers string
body ... | Add comments to HTTPError interface | Add comments to HTTPError interface
This can be very confusing potentially
| Go | apache-2.0 | kavoj/cli,saurabhguptasg/cli,simonleung8/cli,18F/cli,kavoj/cli,diatmpravin/cli,rastasheep/trash-can,mcowger/cli,SrinivasChilveri/cli,zhang-hua/cli,mcowger/cli,ReachingOut/cli,srikanth88infy/cli,simonleung8/cli,pishro-cc/cli,SrinivasChilveri/cli,saurabhguptasg/cli,nttlabs/cli,rastasheep/trash-can,xingzhou/cli,mcintyred/... |
127e43e56ff58c72b11fb9d03314c4a1bfb3ed15 | pkg/client/ensured_state.go | pkg/client/ensured_state.go | package client
import "fmt"
// An EnsuredState represents some state that is needed in order for a function to execute.
type EnsuredState interface {
// EnsureState will check if the state is active and activate it if that is not the case.
// The boolean return value indicates if the state was activated or not.
En... | package client
import "fmt"
// An EnsuredState represents some state that is needed in order for a function to execute.
type EnsuredState interface {
// EnsureState will check if the state is active and activate it if that is not the case.
// The boolean return value indicates if the state was activated or not.
En... | Make EnsuredState rollback unconditionally on error | Make EnsuredState rollback unconditionally on error
It is very confusing if resources that got acquired (daemon, connector,
intercepts) as the result of issuing a command are retained although
the command failed. This command changes that behavior so that all
resources acquired by the command are released if the comma... | Go | apache-2.0 | datawire/telepresence,datawire/telepresence,datawire/telepresence |
6243af12bb9893a06c0dd14ae166f34c0e8de4cb | repository.go | repository.go | // repository.go
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
)
type Repository struct {
ID int `json:"id"`
CloneURL string `json:"clone_url"`
}
// StartBuild executes a build on the Commit Payload
func (r Repository) StartBuild() {
cmd := exec.Command("git", "clone", r.CloneURL, "clones/"+st... | // repository.go
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
"strconv"
)
type Repository struct {
ID int `json:"id"`
CloneURL string `json:"clone_url"`
}
// StartBuild executes a build on the Commit Payload
func (r Repository) StartBuild() {
repoID := strconv.Itoa(r.ID)
cmd := exec.Comman... | Use Itoa instead of string function | Use Itoa instead of string function
| Go | mit | Machiel/go-docker-builder,Machiel/go-docker-builder |
c9f22a6baed84ae48fc91a326f4a0fc4b4a1b596 | game/event.go | game/event.go | package game
type EventType uint8
const (
EventTypeError EventType = iota
EventTypeObjectCreate
EventTypeObjectDelete
EventTypeObjectUpdate
EventTypeObjectChecked
)
type Event struct {
Type EventType
Payload interface{}
}
| package game
type EventType uint8
const (
EventTypeError EventType = iota
EventTypeObjectCreate
EventTypeObjectDelete
EventTypeObjectUpdate
EventTypeObjectChecked
)
var eventsLabels = map[EventType]string{
EventTypeError: "error",
EventTypeObjectCreate: "create",
EventTypeObjectDelete: "delete",
E... | Implement stringer interface for game.EventType | Implement stringer interface for game.EventType
| Go | bsd-2-clause | ivan1993spb/clever-snake |
582a79f00a1d87ba0debd8f3785d867c02451e5f | daemon/execdriver/lxc/lxc_init_linux.go | daemon/execdriver/lxc/lxc_init_linux.go | package lxc
import (
"fmt"
"github.com/docker/libcontainer/namespaces"
"github.com/docker/libcontainer/utils"
)
func finalizeNamespace(args *InitArgs) error {
if err := utils.CloseExecFrom(3); err != nil {
return err
}
if err := namespaces.SetupUser(args.User); err != nil {
return fmt.Errorf("setup user %s... | package lxc
import (
"fmt"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/namespaces"
"github.com/docker/libcontainer/utils"
)
func finalizeNamespace(args *InitArgs) error {
if err := utils.CloseExecFrom(3); err != nil {
return err
}
if err := namespaces.SetupUser(&libcontainer.Config{
U... | Update lxc with libcontainer SetupUser change | Update lxc with libcontainer SetupUser change
Signed-off-by: Michael Crosby <951f4c7b5d47e32d0112c78d14a98eaa23e6b5ef@gmail.com>
| Go | apache-2.0 | ABaldwinHunter/docker,beatle/docker,charleszheng44/moby,maaquib/docker,icaoweiwei/docker,bq-xiao/docker,CodyGuo/docker,HuKeping/docker,insequent/docker,jameseggers/docker,johnstep/docker.github.io,kkirsche/docker,yummypeng/docker,yummypeng/docker,ideaar/docker,pmorie/docker,sallyom/docker,dmcgowan/docker,elancom/docker... |
2abbb29dd1512f32a7f85347c3c9554afaced493 | units_resource.go | units_resource.go | package main
import (
"github.com/bmorton/deployster/fleet"
"log"
"net/http"
"net/url"
)
type UnitsResource struct {
Fleet fleet.Client
}
type UnitsResponse struct {
Units []VersionedUnit `json:"units"`
}
func (self *UnitsResource) Index(u *url.URL, h http.Header, req interface{}) (int, http.Header, *UnitsRes... | package main
import (
"github.com/bmorton/deployster/fleet"
"log"
"net/http"
"net/url"
)
type UnitsResource struct {
Fleet fleet.Client
}
type UnitsResponse struct {
Units []VersionedUnit `json:"units"`
}
func (self *UnitsResource) Index(u *url.URL, h http.Header, req interface{}) (int, http.Header, *UnitsRes... | Fix missed struct renaming of UnitsResponse. | Fix missed struct renaming of UnitsResponse.
| Go | mit | bmorton/deployster |
3db7a9e89ee1b2195437eed89b7f18ce43915f87 | src/nvim-go/nvim/command.go | src/nvim-go/nvim/command.go | package nvim
import (
"fmt"
"github.com/garyburd/neovim-go/vim"
)
func Echomsg(v *vim.Vim, format string, args ...interface{}) error {
return v.WriteOut(fmt.Sprintf(format, args...))
}
func Echoerr(v *vim.Vim, format string, args ...interface{}) error {
return v.WriteErr(fmt.Sprintf(format, args...))
}
| package nvim
import (
"fmt"
"github.com/garyburd/neovim-go/vim"
)
func Echo(v *vim.Vim, format string, a ...interface{}) error {
return v.Command("echo '" + fmt.Sprintf(format, a...) + "'")
}
func Echomsg(v *vim.Vim, format string, a ...interface{}) error {
return v.Command("echomsg '" + fmt.Sprintf(format, a..... | Fix Echo*** and Add ReportError interface wrapper | Fix Echo*** and Add ReportError interface wrapper
Signed-off-by: Koichi Shiraishi <13fbd79c3d390e5d6585a21e11ff5ec1970cff0c@zchee.io>
| Go | bsd-3-clause | zchee/nvim-go,zchee/nvim-go |
d2165be69c2be3b528f816c52db19f045940f249 | cmds/util/callbrowser.go | cmds/util/callbrowser.go | // +build !windows
package util
import (
"fmt"
"os"
"os/exec"
"runtime"
)
func openCommand() string {
switch runtime.GOOS {
case "darwin":
return "open"
default:
return "xdg-open"
}
}
func CallBrowser(url string) error {
fmt.Fprintf(os.Stderr, "Running a browser to open %s...", url)
command := openCom... | // +build !windows
package util
import (
"fmt"
"os"
"os/exec"
"runtime"
)
func openCommand() string {
switch runtime.GOOS {
case "darwin":
return "open"
default:
return "xdg-open"
}
}
func CallBrowser(url string) error {
fmt.Fprintf(os.Stderr, "Running a browser to open %s...", url)
command := openCom... | Fix console command on linux | Fix console command on linux
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
7a906eef4368b725fce6c1a3011e2dc329516c78 | bankfile/converter/krspaka.go | bankfile/converter/krspaka.go | package converter
import (
"fmt"
"log"
"strings"
)
type KrSpaKa struct {
comma rune
}
func NewKrSpaKa() KrSpaKa {
return KrSpaKa{
comma: ';',
}
}
func (k KrSpaKa) Comma() rune {
return k.comma
}
func (k KrSpaKa) IsTransaction(record []string) bool {
return !(len(record) != 17 || record[0] == "Auftragskon... | package converter
import (
"log"
"strings"
)
type KrSpaKa struct {
comma rune
}
func NewKrSpaKa() KrSpaKa {
return KrSpaKa{
comma: ';',
}
}
func (k KrSpaKa) Comma() rune {
return k.comma
}
func (k KrSpaKa) IsTransaction(record []string) bool {
return !(len(record) != 17 || record[0] == "Auftragskonto" || ... | Fix failing test, bei removing transaction type from "Memo" | Fix failing test, bei removing transaction type from "Memo"
| Go | mit | st3sch/whycc,st3sch/whycc |
dc89120829d2b94286cae348df6bea5c837ae57a | src/functorama.com/demo/base/opaqueproxyflyweight.go | src/functorama.com/demo/base/opaqueproxyflyweight.go | package base
// OpaqueProxyFlyweight enables implementation of its eponymous design pattern. You need lots of
// objects, but creating them is expensive. You want to externalize state, but your object is opaque
// (you access it through an interface) Only these objects can know the type of the external state.
// So cr... | package base
// OpaqueProxyFlyweight enables implementation of its eponymous design pattern. You need lots of
// objects, but creating them is expensive. You want to externalize state, but your object is opaque
// (you access it through an interface) Only these objects can know the type of the external state.
// So cr... | Add Extrinsically to interface definition | Add Extrinsically to interface definition
| Go | mit | johnny-morrice/webdelbrot-static,johnny-morrice/webdelbrot,johnny-morrice/webdelbrot-static,johnny-morrice/webdelbrot,johnny-morrice/godelbrot |
3d90a5b0a201b4a9aef0680d2910be0fb05ef0af | database/middleware.go | database/middleware.go | package database
import (
"github.com/go-martini/martini"
"log"
"net/http"
)
// The Martini handler to use for injecting the database context
func Middleware() martini.Handler {
db, err := OpenAndInit()
if err != nil {
log.Fatal(err)
}
return func(w http.ResponseWriter, r *http.Request, c martini.Context) ... | package database
import (
"github.com/go-martini/martini"
"log"
"net/http"
)
// The Martini handler to use for injecting the database context
func Middleware() martini.Handler {
db, err := OpenAndInit()
if err != nil {
log.Fatal(err)
}
return func(w http.ResponseWriter, r *http.Request, c martini.Context) ... | Revert "Accidentally was giving it the pointer to a pointer." | Revert "Accidentally was giving it the pointer to a pointer."
This reverts commit bbf3f7b3cc797b563b0670d552635df4fd613637.
| Go | mit | crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite |
d771612718b65bd4b78609c4596246449fbe3ccd | services/retention/config.go | services/retention/config.go | package retention
import (
"time"
"github.com/influxdb/influxdb/toml"
)
type Config struct {
Enabled bool `toml:"enabled"`
CheckInterval toml.Duration `toml:"check-interval"`
}
func NewConfig() Config {
return Config{Enabled: true, CheckInterval: toml.Duration(10 * time.Minute)}
}
| package retention
import (
"time"
"github.com/influxdb/influxdb/toml"
)
type Config struct {
Enabled bool `toml:"enabled"`
CheckInterval toml.Duration `toml:"check-interval"`
}
func NewConfig() Config {
return Config{Enabled: true, CheckInterval: toml.Duration(30 * time.Minute)}
}
| Set default retention check interval to 30 minutes | Set default retention check interval to 30 minutes
Since the minimum retention period is 1 hour, checking every 10 minutes
seems excessive and generates noise in the logs.
| Go | mit | benbjohnson/influxdb,tommymei/influxdb,CVTJNII/influxdb-tjnii,nooproblem/influxdb,imcom/influxdb,Venu4thFeb/influxdb,runcom/influxdb,toorop/influxdb,influxdb/influxdb,runcom/influxdb,pablolmiranda/influxdb,nckturner/influxdb,jipperinbham/influxdb,otoolep/influxdb,pkittenis/influxdb,toorop/influxdb,nckturner/influxdb,sa... |
a2d14d4e98cb1620043c4ba868aad0e277ea41b4 | obj/errors.go | obj/errors.go | package obj
import (
"fmt"
"reflect"
. "github.com/polydawn/refmt/tok"
)
// ErrInvalidUnmarshalTarget describes an invalid argument passed to UnmarshalDriver.Bind.
// (Unmarshalling must target a non-nil pointer so that it can address the value.)
type ErrInvalidUnmarshalTarget struct {
Type reflect.Type
}
func ... | package obj
import (
"fmt"
"reflect"
. "github.com/polydawn/refmt/tok"
)
// ErrInvalidUnmarshalTarget describes an invalid argument passed to UnmarshalDriver.Bind.
// (Unmarshalling must target a non-nil pointer so that it can address the value.)
type ErrInvalidUnmarshalTarget struct {
Type reflect.Type
}
func ... | Introduce ErrUnexpectedTokenType, which our unmarshaller machines should start returning here on out. | Introduce ErrUnexpectedTokenType, which our unmarshaller machines should start returning here on out.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
| Go | mit | polydawn/refmt,polydawn/go-xlate,polydawn/go-xlate,polydawn/refmt |
3c1c4e9db1a0ba2e1f5947ed1cb3a7f2b1e7cb1d | typetalk.go | typetalk.go | package typetalk
import (
"errors"
"github.com/Sirupsen/logrus"
"net/http"
"net/url"
)
const (
VERISON = "1.0.0"
)
type TypetalkHook struct {
AcceptedLevels []logrus.Level
BotURL string
}
func (th *TypetalkHook) Levels() []logrus.Level {
if th.AcceptedLevels == nil {
return AllLevels
}
return th... | package typetalk
import (
"errors"
"github.com/Sirupsen/logrus"
"net/http"
"net/url"
)
const (
VERISON = "1.0.0"
)
type TypetalkHook struct {
AcceptedLevels []logrus.Level
BotURL string
}
func (th *TypetalkHook) Levels() []logrus.Level {
if th.AcceptedLevels == nil {
return AllLevels
}
return th... | Add closing HTTP response body | Add closing HTTP response body
| Go | mit | dragon3/logrus-typetalk-hook |
b36483b7e15f8e905d4e38605d000665521ba097 | middleware.go | middleware.go | package fabric
import (
"context"
)
// HandlerFunc defines the handler function for the server
type HandlerFunc func(context.Context, Conn) (context.Context, Conn, error)
// NegotiatorFunc defines the negotiator functions for the clients
type NegotiatorFunc func(ctx context.Context, conn Conn) (context.Context, Con... | package fabric
import (
"context"
)
// HandlerFunc defines the handler function for the server
type HandlerFunc func(ctx context.Context, conn Conn) (context.Context, Conn, error)
// NegotiatorFunc defines the negotiator functions for the clients
type NegotiatorFunc func(ctx context.Context, conn Conn) (context.Con... | Fix var names on interfaces | Fix var names on interfaces
| Go | mit | nimona/go-nimona,nimona/go-nimona,nimona/go-nimona,nimona/go-nimona |
0e9858422bd4db7f344a813ebe832705025f21e8 | route.go | route.go | package main
import (
"github.com/labstack/echo"
"net/http"
)
func setupRoutes(e *echo.Echo) {
e.GET("/", route_main)
e.GET("/search/:query", route_search)
}
func route_main(c echo.Context) error {
return c.String(http.StatusOK, "You've reached /")
}
func route_search(c echo.Context) error {
allResults := mak... | package main
import (
"github.com/labstack/echo"
"github.com/texttheater/golang-levenshtein/levenshtein"
"net/http"
"sort"
)
// So that we can sort
var query string
func setupRoutes(e *echo.Echo) {
e.GET("/", route_main)
e.GET("/search/:query", route_search)
}
func route_main(c echo.Context) error {
return c... | Sort search results based on Levenshtein distance from query | Sort search results based on Levenshtein distance from query
| Go | mit | anthonynguyen/mread,anthonynguyen/mread |
b6068a081e1a42cb6fdecc0bc1ff3df000031c9d | infrastructure/aws/sqs/sqsadapter_test.go | infrastructure/aws/sqs/sqsadapter_test.go | package sqs
import (
"fmt"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/goadapp/goad/api"
"github.com/stretchr/testify/assert"
)
func init() {
}
func TestAdapterConstruction(t *testing.T) {
config := aws.NewConfig().WithRegion("somewhere")
testsqs := NewSQSAdapter(config, "testqueue")
assert.Equal(... | package sqs
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/stretchr/testify/assert"
)
func TestAdapterConstruction(t *testing.T) {
config := aws.NewConfig().WithRegion("somewhere")
testsqs := NewSQSAdapter(config, "testqueue")
assert.Equal(t, testsqs.QueueURL, "testqueue")
}
| Remove weak unit test for json serialisation | Remove weak unit test for json serialisation
| Go | mit | goadapp/goad,goadapp/goad,goadapp/goad |
03f0a64c65b93bb5a9cffc3097cb4f927cfa62f9 | storage/db.go | storage/db.go | package storage
import (
"os"
"github.com/hnakamur/api2go-gorm-gin-crud-example/model"
"github.com/jinzhu/gorm"
)
func InitDB() (*gorm.DB, error) {
db, err := gorm.Open(os.Getenv("DB_DIALECT"), os.Getenv("DB_PARAMS"))
if err != nil {
return nil, err
}
//db.LogMode(true)
db.AutoMigrate(&model.User{}, &mode... | package storage
import (
"os"
"github.com/hnakamur/api2go-gorm-gin-crud-example/model"
"github.com/jinzhu/gorm"
)
// InitDB creates and migrates the database
func InitDB() (*gorm.DB, error) {
db, err := gorm.Open(os.Getenv("DB_DIALECT"), os.Getenv("DB_PARAMS"))
if err != nil {
return nil, err
}
//db.LogMod... | Comment the exported function InitDB | fmtpolice: Comment the exported function InitDB
| Go | mit | pawmart/api2go-gin-gorm,pawmart/api2go-gin-gorm,hnakamur/api2go-gorm-gin-crud-example,hnakamur/api2go-gorm-gin-crud-example |
7cfbe3fd753f1e7cee6a86f130c5e1ec58947804 | src/webservice/server.go | src/webservice/server.go | package main
import (
"net/http"
"io/ioutil"
"os"
"log"
)
func saveHandler(w http.ResponseWriter, r *http.Request) {
folder := "/PRODUCTION/EXPERIMENT/web/savedfiles/"
filename := generateRandomURL()
path := folder + filename
if _, err := os.Stat(path); err != nil {
if os.IsNo... | package main
import (
"net/http"
"io/ioutil"
"os"
"log"
)
func saveHandler(w http.ResponseWriter, r *http.Request) {
folder := "/PRODUCTION/EXPERIMENT/web/savedfiles/"
filename := generateRandomURL()
path := folder + filename
if _, err := os.Stat(path); err != nil {
if !(os.Is... | Check whether file does exist | Check whether file does exist | Go | mit | elifkus/very-simple-service,elifkus/very-simple-service,elifkus/very-simple-service |
019c94bdfe2067142c48ce950e693d6eaaa10cf6 | rest/util.go | rest/util.go | package rest
func compareEtag(etag, baseEtag string) bool {
if etag == baseEtag {
return true
}
if l := len(etag); l == len(baseEtag)+2 && l > 3 && etag[0] == '"' && etag[l-1] == '"' && etag[1:l-1] == baseEtag {
return true
}
return false
}
| package rest
// compareEtag compares a client provided etag with a base etag. The client provided
// etag may or may not have quotes while the base etag is never quoted. This loose
// comparison of etag allows clients not stricly respecting RFC to send the etag with
// or without quotes when the etag comes from, for i... | Add some doc to compareEtag | Add some doc to compareEtag
| Go | mit | rs/rest-layer |
b4ae1a81edfe3c051bfd90c9d34d574c6a906f65 | ring/main.go | ring/main.go | package main
import (
"fmt"
"os"
"github.com/gholt/brimtext"
"github.com/gholt/ring"
)
func main() {
i := -1
for j, v := range os.Args {
if v == "--no-color" {
i = j
break
}
}
if i != -1 {
os.Args = append(os.Args[:i], os.Args[i+1:]...)
}
if err := ring.CLI(os.Args, os.Stdout, i == -1); err != ... | package main
import (
"fmt"
"os"
"github.com/gholt/brimtext"
"github.com/gholt/ring"
"golang.org/x/crypto/ssh/terminal"
)
func main() {
var args []string
color := terminal.IsTerminal(int(os.Stdout.Fd()))
for _, arg := range os.Args {
switch arg {
case "--color":
color = true
case "--no-color":
co... | Update to color output handling | Update to color output handling
| Go | bsd-3-clause | pandemicsyn/ring,gholt/ring |
e46d766aaf90b5eaf79cf40f2e57604a9ade12e9 | test/nogui.go | test/nogui.go | package test
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
"github.com/howeyc/gopass"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-... | package test
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
ui "github.com/fabiofalci/sconsify/ui"
"github.com/howeyc/gopass"
sp "github.com/op/go-libspotify/spotify"
)
func main2() {
username, pass := credentials()
event... | Make no gui test random all tracks | Make no gui test random all tracks
| Go | apache-2.0 | fabiofalci/sconsify |
eeea7906918ed8e4a5e16272d7e439390df7fde5 | pkg/cmd/infra/builder/builder.go | pkg/cmd/infra/builder/builder.go | package builder
import (
"fmt"
"github.com/spf13/cobra"
"github.com/openshift/origin/pkg/build/builder/cmd"
)
const longCommandSTIDesc = `
Perform a Source-to-Image Build
This command executes a Source-to-Image build using arguments passed via the environment.
It expects to be run inside of a container.
`
func... | package builder
import (
"fmt"
"github.com/spf13/cobra"
"github.com/openshift/origin/pkg/build/builder/cmd"
)
const longCommandSTIDesc = `
Perform a Source-to-Image Build
This command executes a Source-to-Image build using arguments passed via the environment.
It expects to be run inside of a container.
`
func... | Simplify code to get rid variable shadowing | Simplify code to get rid variable shadowing
| Go | apache-2.0 | robertol/origin,jupierce/origin,hferentschik/origin,dmage/origin,yepengxj/df,jsafrane/origin,quantiply-fork/origin,biyiklioglu/origin,maleck13/origin,PI-Victor/origin,mrunalp/origin,hingstarne/origin,spinolacastro/origin,mingderwang/origin,gashcrumb/origin,mrogers950/origin,smarterclayton/origin,pkdevbox/origin,Nick-Ha... |
a91ba8a5dd44892adef1afea347bfbf352bc7e0f | src/utils.go | src/utils.go | package ss13
import (
"log"
"time"
)
var (
now = time.Now()
debugging bool = false
)
func log_error(err error) {
if err != nil {
log.Panic("WARNING ", err)
}
}
func check_error(err error) {
if err != nil {
log.Fatal("ERROR ", err)
}
}
func SetDebug(val bool) {
debugging = val
}
func IsDebu... | package ss13
import (
"log"
"time"
)
var (
now = time.Now()
debugging bool = false
)
func log_error(err error) bool {
if err != nil {
log.Printf("WARNING: %s\n", err)
return true
}
return false
}
func check_error(err error) {
if err != nil {
log.Fatal("ERROR ", err)
}
}
func SetDebug(val ... | Make log_error actually log errors without panicing. | Make log_error actually log errors without panicing.
| Go | mit | lmas/ss13_se |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.