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 |
|---|---|---|---|---|---|---|---|---|---|
33ebc7856ecfb5fe5b24a3dbc77a13c0a39aa27f | go/src/socialapi/workers/sitemap/sitemapgenerator/generator/fileselector.go | go/src/socialapi/workers/sitemap/sitemapgenerator/generator/fileselector.go | package generator
import (
"socialapi/workers/helper"
"socialapi/workers/sitemap/common"
"github.com/koding/redis"
)
type FileSelector interface {
Select() (string, error)
}
type SimpleFileSelector struct{}
func (s SimpleFileSelector) Select() (string, error) {
return "sitemap", nil
}
type CachedFileSelector... | package generator
import (
"socialapi/workers/helper"
"socialapi/workers/sitemap/common"
)
type FileSelector interface {
Select() (string, error)
}
type SimpleFileSelector struct{}
func (s SimpleFileSelector) Select() (string, error) {
return "sitemap", nil
}
type CachedFileSelector struct{}
func (s CachedFil... | Fix sitemap items are not generated bug | Sitemap: Fix sitemap items are not generated bug
| Go | agpl-3.0 | drewsetski/koding,acbodine/koding,andrewjcasal/koding,usirin/koding,rjeczalik/koding,acbodine/koding,gokmen/koding,gokmen/koding,szkl/koding,cihangir/koding,acbodine/koding,usirin/koding,cihangir/koding,mertaytore/koding,jack89129/koding,szkl/koding,alex-ionochkin/koding,drewsetski/koding,szkl/koding,acbodine/koding,us... |
6ddfde263b7433e2ab8a9f03e64e3cf86f27b66b | src/ustackweb/models/user_collection.go | src/ustackweb/models/user_collection.go | package models
import (
"github.com/UserStack/ustackd/backends"
)
type UserCollection struct {
}
func (this UserCollection) All() []User {
return []User{
User{&backends.User{Uid: 1, Email: "foo"}},
User{&backends.User{Uid: 2, Email: "admin"}},
User{&backends.User{Uid: 3, Email: "abc"}},
User{&backends.User... | package models
import (
"github.com/UserStack/ustackd/backends"
)
type UserCollection struct {
}
func (this *UserCollection) All() []User {
return []User{
User{&backends.User{Uid: 1, Email: "foo"}},
User{&backends.User{Uid: 2, Email: "admin"}},
User{&backends.User{Uid: 3, Email: "abc"}},
User{&backends.Use... | Fix user collection pass by ref. | Fix user collection pass by ref.
| Go | mit | UserStack/ustackweb,UserStack/ustackweb,UserStack/ustackweb,UserStack/ustackweb |
37f4ad60ac7454a0400b18fbe2e1171030040c95 | goliath.go | goliath.go | package main
import (
"encoding/json"
"flag"
log "github.com/golang/glog"
"github.com/jrupac/goliath/opml"
"github.com/jrupac/goliath/storage"
)
const VERSION = "0.01"
var (
dbPath = flag.String("dbPath", "", "The address of the database.")
)
func main() {
flag.Parse()
defer log.Flush()
log.Infof("Goliath... | package main
import (
"encoding/json"
"flag"
log "github.com/golang/glog"
"github.com/jrupac/goliath/opml"
"github.com/jrupac/goliath/storage"
)
const VERSION = "0.01"
var (
dbPath = flag.String("dbPath", "", "The address of the database.")
opmlPath = flag.String("opmlPath", "", "Path of OPML file to import... | Move OPML importing beyond a non-default flag. | Move OPML importing beyond a non-default flag.
Now that persisting the OPML data is done, no need to clobber it every time.
| Go | mit | jrupac/goliath,jrupac/goliath,jrupac/goliath,jrupac/goliath,jrupac/goliath |
c13e00210eb1b377f37b8baea84913fc63db11f5 | browser_windows.go | browser_windows.go | package browser
func openBrowser(url string) error {
return runCmd("cmd", "/c", "start", url)
}
| package browser
import (
"strings"
)
func openBrowser(url string) error {
r := strings.NewReplacer("&", "^&")
return runCmd("cmd", "/c", "start", r.Replace(url))
}
| Fix Windows code to allow multiple GET parameters | Fix Windows code to allow multiple GET parameters
| Go | bsd-2-clause | pkg/browser |
1ab2af89c3c32bf788d1d1985c1b601489c7b331 | runid/sqlite3.go | runid/sqlite3.go | package runid
import (
"context"
"database/sql"
"github.com/anacrolix/missinggo/expect"
)
type T int64
func New(db *sql.DB) (ret *T) {
ctx := context.Background()
conn, err := db.Conn(ctx)
expect.Nil(err)
defer func() {
expect.Nil(conn.Close())
}()
res, err := conn.ExecContext(ctx, "insert into runs defa... | package runid
import (
"context"
"database/sql"
"github.com/anacrolix/missinggo/expect"
)
type T int64
func New(db *sql.DB) (ret *T) {
ctx := context.Background()
conn, err := db.Conn(ctx)
expect.Nil(err)
defer func() {
expect.Nil(conn.Close())
}()
_, err = conn.ExecContext(ctx, `CREATE TABLE if not exis... | Create the runs table if it doesn't exist | runid: Create the runs table if it doesn't exist
| Go | mit | anacrolix/missinggo |
863dfc20ff4f2388ece05092115f0b9e2f0740ae | pkg/client/envconfig.go | pkg/client/envconfig.go | package client
import (
"context"
"github.com/sethvargo/go-envconfig"
)
type Env struct {
LoginAuthURL string `env:"TELEPRESENCE_LOGIN_AUTH_URL,default=https://auth.datawire.io/auth"`
LoginTokenURL string `env:"TELEPRESENCE_LOGIN_TOKEN_URL,default=https://auth.datawire.io/token"`
LoginCompletionURL s... | package client
import (
"context"
"os"
"github.com/sethvargo/go-envconfig"
)
type Env struct {
LoginDomain string `env:"TELEPRESENCE_LOGIN_DOMAIN,required"`
LoginAuthURL string `env:"TELEPRESENCE_LOGIN_AUTH_URL,default=https://${TELEPRESENCE_LOGIN_DOMAIN}/auth"`
LoginTokenURL string `env:"TEL... | Add a SYSTEMA_ENV variable to easily adjust staging/prod | CLI: Add a SYSTEMA_ENV variable to easily adjust staging/prod
| Go | apache-2.0 | datawire/telepresence,datawire/telepresence,datawire/telepresence |
ca3529bd9a6bac1a87cb47ba185c1490ab5e2836 | data.go | data.go | package torrent
import "io"
// Represents data storage for a Torrent.
type Data interface {
io.ReaderAt
io.WriterAt
// Bro, do you even io.Closer?
Close()
// We believe the piece data will pass a hash check.
PieceCompleted(index int) error
// Returns true if the piece is complete.
PieceComplete(index int) boo... | package torrent
import "io"
// Represents data storage for a Torrent.
type Data interface {
// Should return io.EOF only at end of torrent. Short reads due to missing
// data should return io.ErrUnexpectedEOF.
io.ReaderAt
io.WriterAt
// Bro, do you even io.Closer?
Close()
// Called when the client believes the... | Improve doc comments on Data | Improve doc comments on Data
| Go | mpl-2.0 | anacrolix/torrent,anacrolix/torrent |
b1f08bcbc8e7880ea81a030e679a6bc779daba08 | key.go | key.go | package rdbtools
import (
"fmt"
"time"
)
type KeyObject struct {
ExpiryTime time.Time
Key interface{}
}
func NewKeyObject(key interface{}, expiryTime int64) KeyObject {
k := KeyObject{
Key: key,
}
if expiryTime >= 0 {
k.ExpiryTime = time.Unix(expiryTime/1000, 0)
}
return k
}
func (k KeyObject) ... | package rdbtools
import (
"fmt"
"time"
)
type KeyObject struct {
ExpiryTime time.Time
Key interface{}
}
func NewKeyObject(key interface{}, expiryTime int64) KeyObject {
k := KeyObject{
Key: key,
}
if expiryTime >= 0 {
k.ExpiryTime = time.Unix(expiryTime/1000, 0)
}
return k
}
func (k KeyObject) ... | Use UTC for the ExpiryTime in String() | Use UTC for the ExpiryTime in String()
| Go | mit | vrischmann/rdbtools |
1b6d552c0eb9a01e24ec4ac607ee4ae9cd547f2c | flow/type_errors.go | flow/type_errors.go | package flow
import (
"fmt"
"go/types"
"github.com/dustin/go-humanize"
)
func cardinalityMismatchError(source, dest ComponentID, sourceSig, destSig *types.Tuple) error {
return fmt.Errorf(`
As I infer the types of values flowing through your program, I see a mismatch in this connection.
%[1]s -> %[2]s
There ... | package flow
import (
"fmt"
"go/types"
"github.com/dustin/go-humanize"
)
func cardinalityMismatchError(source, dest ComponentID, sourceSig, destSig *types.Tuple) error {
return fmt.Errorf(`
As I infer the types of values flowing through your program, I see a mismatch in this connection.
%[1]s -> %[2]s
There ... | Improve error message for type mismatch. | Improve error message for type mismatch.
| Go | mit | Logiraptor/oak |
7457b3668b9902d4f90fde9e171c3dd4b23792c8 | help.go | help.go | package task
import (
"fmt"
"sort"
"text/tabwriter"
)
// PrintTasksHelp prints help os tasks that have a description
func (e *Executor) PrintTasksHelp() {
tasks := e.tasksWithDesc()
if len(tasks) == 0 {
return
}
e.outf("Available tasks for this project:")
// Format in tab-separated columns with a tab stop ... | package task
import (
"fmt"
"sort"
"text/tabwriter"
)
// PrintTasksHelp prints help os tasks that have a description
func (e *Executor) PrintTasksHelp() {
tasks := e.tasksWithDesc()
if len(tasks) == 0 {
e.outf("task: No tasks with description available")
return
}
e.outf("task: Available tasks for this proj... | Revert "Revert "list: print message with there's no task with description"" | Revert "Revert "list: print message with there's no task with description""
This reverts commit e065dcb81659e5b3c38255ece1702d6c408ffebe.
Reintroducing this. Reverted unintentionally.
| Go | mit | go-task/task,go-task/task |
f1a872cbe5c89238a1fd27f583a4a625af42f055 | mcurl.go | mcurl.go | package materials
import (
"os"
)
type MaterialsCommons struct {
user *User
baseUri string
}
func NewMaterialsCommons(user *User) *MaterialsCommons {
mcurl := os.Getenv("MCURL")
if mcurl == "" {
mcurl = "https://api.materialscommons.org"
}
return &MaterialsCommons{
user: user,
baseUri: mcurl,
}
... | package materials
import (
"os"
)
type MaterialsCommons struct {
user *User
baseUri string
}
func NewMaterialsCommons(user *User) *MaterialsCommons {
mcurl := os.Getenv("MCAPIURL")
if mcurl == "" {
mcurl = "https://api.materialscommons.org"
}
return &MaterialsCommons{
user: user,
baseUri: mcurl,
... | Update URL name to make it explicit that it points at the api. | Update URL name to make it explicit that it points at the api.
| Go | mit | materials-commons/materials,materials-commons/materials |
f8d9daefdc3201c718381e0106f1a748fc4fe73d | go/libkb/version.go | go/libkb/version.go | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package libkb
import (
"fmt"
)
// NOTE: This file is the source of truth for our version number, but we have a
// script that reads it at packaging/version.sh. If you refactor this
// ... | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package libkb
import (
"fmt"
)
// NOTE: This file is the source of truth for our version number, but we have a
// script that reads it at packaging/version.sh. If you refactor this
// ... | Bump build number to 5 for 1.0.5 | Bump build number to 5 for 1.0.5
| 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 |
73cdd9abbac2696f4cb6df9f235dbd91a261fd73 | cmd/gddoexp/gddoexp.go | cmd/gddoexp/gddoexp.go | // gddoexp is a command line tool crated to list eligible packages for
// archiving in GoDoc.org
package main
import (
"fmt"
"net/http"
"os"
"path"
"github.com/golang/gddo/database"
"github.com/gregjones/httpcache"
"github.com/gregjones/httpcache/diskcache"
"github.com/rafaeljusto/gddoexp"
)
func main() {
/... | // gddoexp is a command line tool crated to list eligible packages for
// archiving in GoDoc.org
package main
import (
"fmt"
"net/http"
"os"
"path"
"github.com/golang/gddo/database"
"github.com/gregjones/httpcache"
"github.com/gregjones/httpcache/diskcache"
"github.com/rafaeljusto/gddoexp"
)
func main() {
/... | Add some initial information in command line | Add some initial information in command line
| Go | mit | rafaeljusto/gddoexp |
9003db03dceba99ec633fadecbeddc08e2d7c1e7 | assignments/go/hamming/hamming_test.go | assignments/go/hamming/hamming_test.go | package hamming
import (
"testing"
)
var testCases = []struct {
expected int
strandA, strandB string
description string
}{
{0, "", "", "no difference between empty strands"},
{2, "AG", "CT", "complete hamming distance for small strand"},
{0, "A", "A", "no difference between identical strands"},
{... | package hamming
import (
"testing"
)
var testCases = []struct {
expected int
strandA, strandB string
description string
}{
{0, "", "", "no difference between empty strands"},
{2, "AG", "CT", "complete hamming distance for small strands"},
{0, "A", "A", "no difference between identical strands"},
... | Tweak hamming test suite in Go | Tweak hamming test suite in Go
| Go | agpl-3.0 | mscoutermarsh/exercism_coveralls,jtigger/exercism.io,kangkyu/exercism.io,nathanbwright/exercism.io,jtigger/exercism.io,colinrubbert/exercism.io,mscoutermarsh/exercism_coveralls,bmulvihill/exercism.io,treiff/exercism.io,Tonkpils/exercism.io,Tonkpils/exercism.io,treiff/exercism.io,kizerxl/exercism.io,mhelmetag/exercism.i... |
1e4d853beea3c39f845b403ed620703cc5ba9260 | apps/staging_log_test.go | apps/staging_log_test.go | package apps
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/vito/cmdtest/matchers"
. "github.com/pivotal-cf-experimental/cf-acceptance-tests/helpers"
)
var _ = Describe("An application being staged", func() {
BeforeEach(func() {
AppName = RandomName()
})
AfterEach(func() {
E... | package apps
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/vito/cmdtest/matchers"
. "github.com/pivotal-cf-experimental/cf-acceptance-tests/helpers"
)
var _ = Describe("An application being staged", func() {
BeforeEach(func() {
AppName = RandomName()
})
AfterEach(func() {
E... | Test failure: 'Staging...' missing from output | Test failure: 'Staging...' missing from output
Go cli commit e41c9e5376773132580a363ed127a0faa51da15d removed the
'Staging...' message but the test still expects it. This removes that
expectation.
| Go | apache-2.0 | matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests,matt-royal/cf-acceptance-tests |
e2aaaaccc615c0757a48d22b17e88f8baddaaf8f | shared/api/instance_console.go | shared/api/instance_console.go | package api
// InstanceConsoleControl represents a message on the instance console "control" socket.
//
// API extension: instances
type InstanceConsoleControl struct {
Command string `json:"command" yaml:"command"`
Args map[string]string `json:"args" yaml:"args"`
}
// InstanceConsolePost represents a... | package api
// InstanceConsoleControl represents a message on the instance console "control" socket.
//
// API extension: instances
type InstanceConsoleControl struct {
Command string `json:"command" yaml:"command"`
Args map[string]string `json:"args" yaml:"args"`
}
// InstanceConsolePost represents a... | Add swagger metadata for instance console | shared/api: Add swagger metadata for instance console
Signed-off-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>
| Go | apache-2.0 | lxc/lxd,hallyn/lxd,lxc/lxd,lxc/lxd,hallyn/lxd,lxc/lxd,stgraber/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,atxwebs/lxd,stgraber/lxd,atxwebs/lxd,hallyn/lxd,hallyn/lxd,atxwebs/lxd,lxc/lxd,atxwebs/lxd,stgraber/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd |
a5cc9d72c04020ace62ab9d59ba46a269857f889 | metric/metric.go | metric/metric.go | // Copyright 2015 Eleme Inc. All rights reserved.
package metric
// Metric with name and value
type Metric struct {
Name string // metric name
Stamp uint64 // metric timestamp
Value float64 // metric value
Score float64 // metric anomaly score
AvgOld float64 // previous average value
AvgNew float64 // cu... | // Copyright 2015 Eleme Inc. All rights reserved.
package metric
// Metric with name and value
type Metric struct {
Name string // metric name
Stamp uint32 // metric timestamp (able to use for 90 years from now)
Value float64 // metric value
Score float64 // metric anomaly score
AvgOld float64 // previous... | Use stamp as uint32 (able to be used for 90 years) | Use stamp as uint32 (able to be used for 90 years)
| Go | mit | facesea/banshee,eleme/banshee,facesea/banshee,facesea/banshee,eleme/banshee,eleme/banshee,eleme/banshee,eleme/banshee,facesea/banshee |
5b5dcf2405100a9f87dab83babff4488aa57073d | client/client.go | client/client.go | package client
import (
"code.google.com/p/go-uuid/uuid"
"github.com/dnaeon/gru/minion"
)
type Client interface {
// Submits a new task to a minion
SubmitTask(minion uuid.UUID, task MinionTask) error
}
| package client
import (
"code.google.com/p/go-uuid/uuid"
// "github.com/dnaeon/gru/minion"
"gru/minion"
)
type Client interface {
// Submits a new task to a minion
SubmitTask(u uuid.UUID, t minion.MinionTask) error
}
| Use shorter names for the arguments passed to SubmitTask method | Use shorter names for the arguments passed to SubmitTask method
| Go | mit | ranjithamca/gru |
4c7d1c1985ab9e2d686ee79007dce14c1139b298 | weave-loadbalance/example/src/myip/myip.go | weave-loadbalance/example/src/myip/myip.go | package main
import (
"bytes"
"fmt"
"github.com/gorilla/mux"
"log"
"net"
"net/http"
)
func main() {
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/", HelloWeave)
router.HandleFunc("/myip", myIp)
log.Fatal(http.ListenAndServe(":80", router))
}
func HelloWeave(w http.ResponseWriter, r *htt... | package main
import (
"bytes"
"fmt"
"github.com/gorilla/mux"
"log"
"net"
"net/http"
)
func main() {
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/", HelloWeave)
router.HandleFunc("/myip", myIp)
log.Fatal(http.ListenAndServe(":80", router))
}
func HelloWeave(w http.ResponseWriter, r *htt... | Update to just look at ethwe for the example | Update to just look at ethwe for the example
| Go | apache-2.0 | pierreozoux/guides,spacediver/guides,pierreozoux/guides,fintanr/weave-gs,jjperezaguinaga/guides,jjperezaguinaga/guides,kikkomep/guides,kikkomep/guides,kikkomep/guides,pierreozoux/guides,pessoa/guides,jjperezaguinaga/guides,fintanr/weave-gs,kikkomep/guides,spacediver/guides,kikkomep/guides,spacediver/guides,pierreozoux/... |
a5f492da66dc7960cf1fc58f30cca6b280335dbf | trello/client.go | trello/client.go | package trello
import (
"github.com/joonasmyhrberg/go-trello"
)
type TrelloConfig struct {
Key string
Token string
User string
}
var trelloClient *trello.Client
var trelloConfig TrelloConfig
func Authenticate(config TrelloConfig) error {
trelloConfig = config
trello, err := trello.NewAuthClient(config.Ke... | package trello
import (
"github.com/joonasmyhrberg/go-trello"
)
type TrelloConfig struct {
Key string
Token string
User string
ActionHandler func(action trello.Action)
}
var trelloClient *trello.Client
var trelloConfig TrelloConfig
func Authenticate(config TrelloConfig) error {
tre... | Add ActionHandler to trello config | Add ActionHandler to trello config
| Go | mit | HeiaHeia/trello-bot |
d34c07302a1e9e6cfe521401ec428c6d2852600a | disasm/log.go | disasm/log.go | // Copyright 2017 The go-interpreter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package disasm
import (
"io/ioutil"
"log"
"os"
)
var PrintDebugInfo = false
var logger *log.Logger
func init() {
w := ioutil.Discard
if P... | // Copyright 2017 The go-interpreter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package disasm
import (
"io/ioutil"
"log"
"os"
)
var logger *log.Logger
func SetDebugMode(l bool) {
w := ioutil.Discard
if l {
w = os.St... | Replace PrintDegbugInfo with function SetDebugMode. | disasm: Replace PrintDegbugInfo with function SetDebugMode.
SetDebugMode allows logging functionality to be enabled or disabled at
will.
| Go | bsd-3-clause | go-interpreter/wagon,go-interpreter/wagon |
fcd99fde7caba395745ccaeb4ee21c8e82005707 | commands/tar_stream.go | commands/tar_stream.go | // +build !windows
package commands
import (
"io"
"log"
"os"
"os/exec"
)
func tarStreamFrom(workDir string, paths []string) (io.ReadCloser, error) {
var archive io.ReadCloser
if tarPath, err := exec.LookPath("tar"); err == nil {
tarCmd := exec.Command(tarPath, append([]string{"-czf", "-"}, paths...)...)
t... | // +build !windows
package commands
import (
"io"
"log"
"os"
"os/exec"
)
func tarStreamFrom(workDir string, paths []string) (io.ReadCloser, error) {
var archive io.ReadCloser
var writer io.WriteCloser
if tarPath, err := exec.LookPath("tar"); err == nil {
tarCmd := exec.Command(tarPath, []string{"-czf", "-"... | Fix issue where tar command would fail if there were too many command line arguments | Fix issue where tar command would fail if there were too many command line arguments
Signed-off-by: Dan Weinberg <5ed7700fd0f25639b4f8f8b3c1bd72b4eff8b781@cloudcredo.com>
| Go | apache-2.0 | cjcjameson/fly,simonjjones/fly,zachgersh/fly,zachgersh/fly,cjcjameson/fly |
ee0e35de0d1f0a617bcefcd586c502ea90964960 | modules/hbs/rpc/package.go | modules/hbs/rpc/package.go | package rpc
import (
viper "github.com/spf13/viper"
log "github.com/Cepave/open-falcon-backend/common/logruslog"
nqmService "github.com/Cepave/open-falcon-backend/common/service/nqm"
)
var logger = log.NewDefaultLogger("INFO")
func InitPackage(config *viper.Viper) {
config.SetDefault("nqm.queue_size.refresh_age... | package rpc
import (
viper "github.com/spf13/viper"
log "github.com/Cepave/open-falcon-backend/common/logruslog"
nqmService "github.com/Cepave/open-falcon-backend/common/service/nqm"
)
var logger = log.NewDefaultLogger("INFO")
func InitPackage(config *viper.Viper) {
initNqmConfig(config)
}
func initNqmConfig(c... | Add checking of least value on cache timeout(non-debug mode) | [OWL-1594] Add checking of least value on cache timeout(non-debug mode)
| Go | apache-2.0 | Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open... |
7c9c0a870be008050f74c156e64273b17bcf1161 | config/config.go | config/config.go | // Package config allows for reading configuration from a JSON file
package config
import (
"encoding/json"
"io/ioutil"
)
var conf *Config
type (
// Config struct holds data from a JSON config file
Config struct {
DB DB `json:"db"`
Metrics map[string]string `json:"me... | // Package config allows for reading configuration from a JSON file
package config
import (
"encoding/json"
"io/ioutil"
)
var conf *Config
type (
// Config struct holds data from a JSON config file
Config struct {
DB DB `json:"db"`
Metrics Metrics `json:"me... | Use the correct type for Metrics in the Config struct | Use the correct type for Metrics in the Config struct
| Go | apache-2.0 | mistifyio/mistify-operator-admin |
be73da58aa89a35541c04b042b9ddb17c947a710 | window/window.go | window/window.go | package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorS... | package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorS... | Add Quit and SetViewportBounds to Window | Add Quit and SetViewportBounds to Window
| Go | apache-2.0 | oakmound/oak,oakmound/oak,oakmound/oak |
2f411b9a125577812a1696af899c7ba7fedbf372 | core/manifest_test.go | core/manifest_test.go | package core_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-cf-experimental/destiny/core"
. "github.com/pivotal-cf-experimental/gomegamatchers"
"gopkg.in/yaml.v2"
)
var _ = Describe("Manifest", func() {
Describe("PropertiesTurbulenceAgentAPI", func() {
It("serializes t... | package core_test
import (
"github.com/pivotal-cf-experimental/destiny/core"
"github.com/pivotal-cf-experimental/gomegamatchers"
"gopkg.in/yaml.v2"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Manifest", func() {
Describe("PropertiesTurbulenceAgentAPI", func() {
It("serializes t... | Use gomegamatcher.MatchYAML instead of gomega's MatchYAML | Use gomegamatcher.MatchYAML instead of gomega's MatchYAML
[#129671425]
Signed-off-by: Angela Chin <09c3fe443cd90255b3ab6945ab331bb5cdf11ccb@pivotal.io>
| Go | apache-2.0 | pivotal-cf-experimental/destiny,pivotal-cf-experimental/destiny |
5d20e0bd09da8d1b5349b0e55ea2ffaa366b14b8 | plex/server_test.go | plex/server_test.go | package plex
import (
"testing"
)
func TestCreateURI(t *testing.T) {
type args struct {
server Host
path string
token string
}
tests := []struct {
name string
args args
want string
}{
{"Test SSL", args{server: Host{Name: "Test SSL", Hostname: "localhost", Port: 2121, Ssl: true}, path: "test", to... | package plex
import (
"testing"
)
func TestCreateURI(t *testing.T) {
type args struct {
server Host
path string
}
tests := []struct {
name string
args args
want string
}{
{"Test SSL", args{server: Host{Name: "Test SSL", Hostname: "localhost", Port: 2121, Ssl: true}, path: "test"}, "https://localhos... | Update test to match updated fuction | Update test to match updated fuction
| Go | mit | danstis/Plex-Sync,danstis/Plex-Sync,danstis/Plex-Sync |
a144fcfdb707ccb883a33a1e44473f51ca5f9843 | chessboard/print.go | chessboard/print.go | package chessboard
import "fmt"
func PrintChessboard() {
fmt.Print(" ")
for i := 0; i < 8; i++ {
fmt.Printf(" %c", 'a'+i)
}
fmt.Println()
for i := 0; i < 8; i++ {
fmt.Print(" +")
for j := 0; j < 8; j++ {
fmt.Print("-+")
}
fmt.Println()
fmt.Printf("%d|", i+1)
for j := 0; j < 8; j++ {
fmt.Prin... | package chessboard
import "fmt"
func PrintChessboard() {
fmt.Print(" ")
for i := 0; i < 8; i++ {
fmt.Printf(" %c", 'a'+i)
}
fmt.Println()
for i := 0; i < 8; i++ {
fmt.Print(" +")
for j := 0; j < 8; j++ {
fmt.Print("-+")
}
fmt.Println()
fmt.Printf("%d|", i+1)
for j := 0; j < 8; j++ {
fmt.Prin... | Print pieces of each point | Print pieces of each point
| Go | mit | Roadagain/Chess |
d66c9f883fd36e007944b71650646d083e1d9db8 | digraph/graphviz_test.go | digraph/graphviz_test.go | package digraph
import (
"bytes"
"strings"
"testing"
)
func TestWriteDot(t *testing.T) {
nodes := ParseBasic(`a -> b ; foo
a -> c
b -> d
b -> e
`)
var nlist []Node
for _, n := range nodes {
nlist = append(nlist, n)
}
buf := bytes.NewBuffer(nil)
if err := WriteDot(buf, nlist); err != nil {
t.Fatalf("err:... | package digraph
import (
"bytes"
"strings"
"testing"
)
func TestWriteDot(t *testing.T) {
nodes := ParseBasic(`a -> b ; foo
a -> c
b -> d
b -> e
`)
var nlist []Node
for _, n := range nodes {
nlist = append(nlist, n)
}
buf := bytes.NewBuffer(nil)
if err := WriteDot(buf, nlist); err != nil {
t.Fatalf("err:... | Fix TestWriteDot random order error | Fix TestWriteDot random order error
| Go | mpl-2.0 | kl4w/terraform,thegedge/terraform,StephenWeatherford/terraform,nathanielks/terraform,DualSpark/terraform,spuder/terraform,pryorda/terraform,grubernaut/terraform,vrenjith/terraform,yamamoto-febc/terraform,bashtoni/terraform,peterbeams/terraform,opsidian/terraform,maxenglander/terraform,getyourguide/terraform,harijayms/t... |
3e4b09a348a1c08c7f37209b5693f345b26ee25f | cells_test.go | cells_test.go | package vizzini_test
import (
"code.cloudfoundry.org/bbs/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Cells", func() {
It("should return all cells", func() {
cells, err := bbsClient.Cells(logger)
Expect(err).NotTo(HaveOccurred())
Expect(len(cells)).To(BeNumerically(">=",... | package vizzini_test
import (
"code.cloudfoundry.org/bbs/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Cells", func() {
It("should return all cells", func() {
cells, err := bbsClient.Cells(logger)
Expect(err).NotTo(HaveOccurred())
Expect(len(cells)).To(BeNumerically(">=",... | Update cell presence to include rootfs and volume driver info | Update cell presence to include rootfs and volume driver info
[#124601741]
Signed-off-by: Nima Kaviani <0ebde517669f70c2aec92dc89d4950413b825ec0@us.ibm.com>
| Go | apache-2.0 | pivotal-cf-experimental/vizzini,cloudfoundry-incubator/vizzini,pivotal-cf-experimental/vizzini,cloudfoundry-incubator/vizzini |
17b281b6ed8d785b49fda3aad5ac40231aaad011 | NetEcho/golang/client/cmd/main.go | NetEcho/golang/client/cmd/main.go | package main
import "fmt"
func main() {
fmt.Println("echo client")
}
| package main
import (
"bufio"
"flag"
"fmt"
"net"
"os"
"strings"
)
func serve(conn net.Conn) {
}
func main() {
flag.Parse()
ip := flag.Arg(0)
port := flag.Arg(1)
if ip == "" || port == "" {
fmt.Println("Usage: client ip port")
return
}
addr := ip + ":" + port
fmt.Printf("Connecting to %s ...", add... | Add echo-client implementation in golang | Add echo-client implementation in golang
| Go | mit | kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka |
c07105554ec716ccf43c1f7985286b677bd5da4e | release/releaser.go | release/releaser.go | package release
import (
"time"
"github.com/go-kit/kit/log"
"github.com/weaveworks/flux/update"
)
type Changes interface {
CalculateRelease(update.ReleaseContext, log.Logger) ([]*update.ServiceUpdate, update.Result, error)
ReleaseKind() update.ReleaseKind
ReleaseType() update.ReleaseType
CommitMessage() stri... | package release
import (
"time"
"github.com/go-kit/kit/log"
"github.com/weaveworks/flux/update"
)
type Changes interface {
CalculateRelease(update.ReleaseContext, log.Logger) ([]*update.ServiceUpdate, update.Result, error)
ReleaseKind() update.ReleaseKind
ReleaseType() update.ReleaseType
CommitMessage() stri... | Change ApplyChanges stage timer to write_changes | Change ApplyChanges stage timer to write_changes
| Go | apache-2.0 | weaveworks/flux,squaremo/flux,squaremo/flux,weaveworks/flux |
43ee0e4baf2bac1ee72a55d4f9568e2d725e302a | server/logger.go | server/logger.go | package server
import (
"net/http"
"github.com/influxdata/chronograf"
)
// Logger is middleware that logs the request
func Logger(logger chronograf.Logger, next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
logger.
WithField("component", "server").
WithField("remote_add... | package server
import (
"net/http"
"time"
"github.com/influxdata/chronograf"
)
// Logger is middleware that logs the request
func Logger(logger chronograf.Logger, next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
now := time.Now()
logger.
WithField("component", "server... | Add logging of response times | Add logging of response times
This makes monitoring Chronograf :+1:
| Go | mit | li-ang/influxdb,influxdata/influxdb,influxdata/influxdb,influxdb/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,li-ang/influxdb,nooproblem/influxdb,nooproblem/influxdb,influxdb/influ... |
e65a1bc071a31f83e563e4a6853d19a33c110faa | go/1/main.go | go/1/main.go | package main
import "fmt"
func main() {
fmt.Println("Hello!")
} | package main
import "fmt"
func main() {
multiples := make(map[int]bool)
sum := 0
for n, by3, by5 := 1, 3, 5; n < 1000; n++ {
by3 = n * 3
if (by3 >= 1000) {
break;
}
_, ok := multiples[by3]
if ! ok {
sum += by3
multiples[by3] = true
}
by5 = n * 5
if (by5 >= 1000) {
continue;
}
... | Solve first problem with Go | Solve first problem with Go
| Go | mit | krasun/ProjectEulerSolutions |
33687eb78acee1009f7a026a59f46781b5360e79 | geocoder_test.go | geocoder_test.go | package geocoder
import (
"fmt"
"testing"
)
const (
city = "Seattle"
state = "WA"
postalCode = "98104"
seattleLat = 47.603561
seattleLng = -122.329437
)
func TestGeocode(t *testing.T) {
query := "Seattle WA"
lat, lng := Geocode(query)
if lat != seattleLat || lng != seattleLng {
t.Error(fmt.Sp... | package geocoder
import (
"testing"
)
const (
city = "Seattle"
state = "WA"
postalCode = "98104"
seattleLat = 47.603561
seattleLng = -122.329437
)
func TestGeocode(t *testing.T) {
query := "Seattle WA"
lat, lng := Geocode(query)
if lat != seattleLat || lng != seattleLng {
t.Errorf("Expected %f... | Use t.Errorf instead of t.Error(fmt.Sprintf | Use t.Errorf instead of t.Error(fmt.Sprintf
| Go | mit | rafaeljribeiro/geocoder,jasonwinn/geocoder,stanim/geocoder |
f3f3c289d594896d62d3f62c23c6cbc87ab9b90d | main_test.go | main_test.go | package main
import (
"encoding/xml"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestStraingToVoiceMailResponse(t *testing.T) {
recorder := httptest.NewRecorder()
StraightToVoiceMail(recorder, nil)
if status := recorder.Code; status != http.StatusOK {
t.Errorf("returned wrong status cod... | package main
import (
"encoding/xml"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestStraingToVoiceMailResponse(t *testing.T) {
recorder := httptest.NewRecorder()
StraightToVoiceMail(recorder, nil)
if status := recorder.Code; status != http.StatusOK {
t.Errorf("returned wrong status cod... | Correct typo in test method name | Correct typo in test method name
| Go | mit | antontsv/twilio |
bd6ebbd157aac78132090e9373daf1c9bc315503 | internal/mbtest/helper.go | internal/mbtest/helper.go | package mbtest
import (
"bytes"
"io/ioutil"
"path/filepath"
"testing"
)
const testdataDir = "testdata"
// Testdata returns a file's bytes based on the path relative to the testdata
// directory. It fails the test if the testdata file can not be read.
func Testdata(t *testing.T, relativePath string) []byte {
pat... | package mbtest
import (
"bytes"
"io/ioutil"
"path/filepath"
"testing"
)
const testdataDir = "testdata"
// Testdata returns a file's bytes based on the path relative to the testdata
// directory. It fails the test if the testdata file can not be read.
func Testdata(t *testing.T, relativePath string) []byte {
pat... | Fix tests using testdata with trailing newlines by slicing off whitespace | Fix tests using testdata with trailing newlines by slicing off whitespace
| Go | bsd-2-clause | messagebird/go-rest-api |
ed45ca9d1da5064115add1172d59d7ea04e5237d | microsoft/api_test.go | microsoft/api_test.go | package microsoft
// func TestTranslate(t *testing.T) {
// api := NewTranslator("", "")
// original := "dog"
// translation, err := api.Translate(original, "en", "de")
// if err != nil {
// t.Errorf("Unexpected error: %s", err)
// }
// if translation != "" {
// t.Errorf("Unexpected translation: %s", trans... | package microsoft
import (
"testing"
"github.com/st3v/translator"
)
// func TestTranslate(t *testing.T) {
// api := NewTranslator("", "")
// original := "dog"
// translation, err := api.Translate(original, "en", "de")
// if err != nil {
// t.Errorf("Unexpected error: %s", err)
// }
// if translation != ... | Add unit test for api.Languages() | Add unit test for api.Languages()
| Go | apache-2.0 | holygeek/translator,st3v/translator |
f1d0cf0d906a3ed9543b64fdf7f4cfc0d4c35869 | lib/flight/flight_test.go | lib/flight/flight_test.go | // Package flight_test
package flight_test
import (
"log"
"net/http/httptest"
"testing"
"github.com/blue-jay/blueprint/lib/env"
"github.com/blue-jay/blueprint/lib/flight"
)
// TestRace tests for race conditions.
func TestRace(t *testing.T) {
for i := 0; i < 100; i++ {
go func() {
// Load the configuration... | // Package flight_test
package flight_test
import (
"log"
"net/http/httptest"
"testing"
"github.com/blue-jay/blueprint/lib/env"
"github.com/blue-jay/blueprint/lib/flight"
)
// TestRace tests for race conditions.
func TestRace(t *testing.T) {
for i := 0; i < 100; i++ {
go func() {
// Load the configuration... | Update test to use example json | Update test to use example json
| Go | mit | arapov/pile,blue-jay/blueprint,blue-jay/blueprint,arapov/pile |
cb16353e358ef615b77cdc1b1f33b81444526383 | pingcheck.go | pingcheck.go | package main
import (
"fmt"
"log"
"net"
"time"
fastping "github.com/tatsushid/go-fastping"
)
type PingCheck struct {
Host string
}
func ParsePingCheck(data map[string]interface{}) PingCheck {
check := PingCheck{}
if data["host"] != nil {
check.Host = data["host"].(string)
}
return check
}
func (check... | package main
import (
"fmt"
"log"
"os/exec"
)
type PingCheck struct {
Host string
}
func ParsePingCheck(data map[string]interface{}) PingCheck {
check := PingCheck{}
if data["host"] != nil {
check.Host = data["host"].(string)
}
return check
}
func (check PingCheck) Name() string {
return "PING"
}
func... | Replace fastping with os.exec call of ping | Replace fastping with os.exec call of ping
| Go | mit | sosedoff/howdy |
1c3a0a7136cb9d5cb46779462651e38fa86880c7 | pipeline_test.go | pipeline_test.go | package scipipe
import (
"github.com/stretchr/testify/assert"
t "testing"
)
func testAddProcesses(t *t.T) {
proc1 := NewBogusProcess()
proc2 := NewBogusProcess()
pipeline := NewPipeline()
pipeline.AddProcesses(proc1, proc2)
assert.NotNil(t, pipeline.processes[0])
assert.NotNil(t, pipeline.processes[1])
ass... | package scipipe
import (
"github.com/stretchr/testify/assert"
t "testing"
)
func TestAddProcesses(t *t.T) {
proc1 := NewBogusProcess()
proc2 := NewBogusProcess()
pipeline := NewPipeline()
pipeline.AddProcesses(proc1, proc2)
assert.EqualValues(t, len(pipeline.processes), 2)
assert.IsType(t, &BogusProcess{}, ... | Fix wrongly written pipeline test | Fix wrongly written pipeline test
| Go | mit | scipipe/scipipe,scipipe/scipipe,samuell/scipipe |
3c5553e92e3448be5809e2d3ea88af5b3c935e60 | go/005_test.go | go/005_test.go | package main
import (
"math"
"testing"
)
const MaxInt = int(^uint(0) >> 1)
func smallestMultiple() int {
divisible := false
answer := 0
for i := 20; i < MaxInt; i++ {
for j := 1; j <= 20; j++ {
divisible = math.Remainder(float64(i), float64(j)) == float64(0)
if divisible == false {
break
}
}
... | package main
import (
"math"
"testing"
)
// From mathblog.dk/project-euler-problem-5
func generatePrimes(limit int) []int {
var primes []int
var j int
isPrime := false
primes = append(primes, 2)
for i := 3; i <= limit; i += 2 {
j = 0
isPrime = true
for primes[j]*primes[j] <= i {
if i%primes[j] == 0 ... | Speed up problem 5 solution | Speed up problem 5 solution
| Go | bsd-2-clause | jmalonzo/project-euler-solutions,jmalonzo/project-euler-solutions |
650103b77015147b18ff640e566937b68ef35db3 | database/batch.go | database/batch.go | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// For ease of implementation, our database's interface matches Ethereum's
// database implementation. This was to allow use to use Geth code as is for the
// EVM chain.
package database
// Batch is a write-only databa... | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// For ease of implementation, our database's interface matches Ethereum's
// database implementation. This was to allow use to use Geth code as is for the
// EVM chain.
package database
// Batch is a write-only databa... | Improve comment on Batch interface | Improve comment on Batch interface
| Go | bsd-3-clause | ava-labs/avalanchego,ava-labs/avalanchego |
edf8e17e34de5e0c8266dd65abe4d1803a2dbf98 | rtypes/nil.go | rtypes/nil.go | package rtypes
import (
"github.com/robloxapi/types"
)
type NilType struct{}
var Nil NilType
func (NilType) Type() string {
return "nil"
}
func (NilType) String() string {
return "nil"
}
func (n NilType) Copy() types.PropValue {
return n
}
| package rtypes
type NilType struct{}
var Nil NilType
func (NilType) Type() string {
return "nil"
}
func (NilType) String() string {
return "nil"
}
| Remove Copy method from Nil. | Remove Copy method from Nil.
Nil should not be a property value.
| Go | mit | Anaminus/rbxmk,Anaminus/rbxmk |
875942854c369d011888cf2a484f0dc86649ac3e | aprs.go | aprs.go | package main
import (
"fmt"
"strings"
)
type APRSPacket struct {
Callsign string
PacketType string
Latitude string
Longitude string
Altitude string
GPSTime string
RawData string
Symbol string
Heading string
PHG string
Speed string
Destinat... | package main
import (
"fmt"
"strings"
)
type APRSPacket struct {
Callsign string
PacketType string
Latitude string
Longitude string
Altitude string
GPSTime string
RawData string
Symbol string
Heading string
PHG string
Speed string
Destinat... | Remove error from the struct, since its uneeded. | Remove error from the struct, since its uneeded.
| Go | apache-2.0 | benjojo/aprs.go |
e4b0a989f353a0e9bbca45331c8ae3f9fd69dc50 | config_unix.go | config_unix.go | // +build !windows
package main
import (
"bytes"
"errors"
"os"
"os/exec"
"path/filepath"
"strings"
)
func configFile() (string, error) {
dir, err := homeDir()
if err != nil {
return "", err
}
return filepath.Join(dir, ".terraformrc"), nil
}
func configDir() (string, error) {
dir, err := homeDir()
if ... | // +build !windows
package main
import (
"errors"
"os"
"os/user"
"path/filepath"
)
func configFile() (string, error) {
dir, err := homeDir()
if err != nil {
return "", err
}
return filepath.Join(dir, ".terraformrc"), nil
}
func configDir() (string, error) {
dir, err := homeDir()
if err != nil {
retur... | Use build-in method to get user homedir instead of eval on sh | Use build-in method to get user homedir instead of eval on sh
| Go | mpl-2.0 | hashicorp/terraform,hartzell/terraform,tpounds/terraform,asedge/terraform,hartzell/terraform,kl4w/terraform,heimweh/terraform,drebes/terraform,gechr/terraform,donaldguy/terraform,yanndegat/terraform,rnaveiras/terraform,youhong316/terraform,nlamirault/terraform,fatmcgav/terraform,asedge/terraform,tommynsong/terraform,tp... |
c6186a66808a098b0b754d090cb4b3c593e87437 | app/models/thread.go | app/models/thread.go | package models
import (
"github.com/revel/revel"
"time"
)
type Thread struct {
ThreadId int
UserId int
Topic string
// Transient
Thread *Thread
User *User
}
| package models
import (
"github.com/revel/revel"
"time"
)
type Thread struct {
ThreadId int
UserId int
Topic string
// Transient
User *User
}
| Remove *Thread from Thread model | Remove *Thread from Thread model
| Go | mit | bahlo/godisc,bahlo/godisc,bahlo/godisc |
2232083ff80d6a97ab14443cef1c520642f6e25e | autoload/autoload.go | autoload/autoload.go | package autoload
/*
To use autoload, import the package like so:
import _ "github.com/jpfuentes2/env.go/autoload"
Importing this package will automatically source the `pwd`/.env file and set
each environment variable.
If you do not want to automatically set the env variables and/or specify a different ... | package autoload
/*
To use autoload, import the package like so:
import _ "github.com/jpfuentes2/go-env/autoload"
Importing this package will automatically source the `pwd`/.env file and set
each environment variable.
If you do not want to automatically set the env variables and/or specify a different ... | Fix last reference to old project name | Fix last reference to old project name
| Go | mit | jpfuentes2/go-env |
63ea11911b7d72b41e02144514f5c5bc66413ccd | ext/singularity/dummy_registry.go | ext/singularity/dummy_registry.go | package singularity
import (
"github.com/opentable/sous/ext/docker"
"github.com/opentable/sous/lib"
)
// DummyNameCache implements the Builder interface by returning a
// computed image name for a given source version
type DummyRegistry struct {
}
// NewDummyNameCache builds a new DummyNameCache
func NewDummyRegis... | package singularity
import "github.com/opentable/sous/lib"
// DummyNameCache implements the Builder interface by returning a
// computed image name for a given source version
type DummyRegistry struct {
}
// NewDummyNameCache builds a new DummyNameCache
func NewDummyRegistry() *DummyRegistry {
return &DummyRegistry... | Remove unnecessary docker ref in DummyRegistry | Remove unnecessary docker ref in DummyRegistry
| Go | mit | opentable/sous,opentable/sous,nyarly/sous,samsalisbury/sous,opentable/sous,opentable/sous,samsalisbury/sous,samsalisbury/sous,nyarly/sous,samsalisbury/sous,samsalisbury/sous,opentable/sous,nyarly/sous |
7b531b82b394a0c000412dd9cb9129420861f158 | status.go | status.go | // Copyright 2013 Carlos Brando. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package main
import (
"fmt"
"os/exec"
"regexp"
"strings"
"github.com/carlosbrando/lunchy/agents"
)
func (c *Command) status() error {
cmd := exec.Command("lau... | // Copyright 2013 Carlos Brando. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package main
import (
"fmt"
"os/exec"
"regexp"
"strings"
"github.com/carlosbrando/lunchy/agents"
)
var headerPrinted bool = false
// printHeader prints the he... | Make it better than the original version. | Make it better than the original version.
| Go | mit | carlosbrando/lunchy |
6cd6cfc43b2355272a0e5c22f24d78aba1d6c438 | io/h5/flags.go | io/h5/flags.go | // Copyright 2016 The Gosl Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !windows,!darwin
package h5
/*
#cgo CFLAGS: -I/usr/include/hdf5/serial -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FORTIFY_SOURCE=2 -g -O2 -Wform... | // Copyright 2016 The Gosl Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !windows,!darwin
package h5
/*
#cgo CFLAGS: -I/usr/include/hdf5/serial -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FORTIFY_SOURCE=2 -g -O2 -Wform... | Remove -lsz flag in io/h5 compilation because Travis cannot find it | Remove -lsz flag in io/h5 compilation because Travis cannot find it
| Go | bsd-3-clause | cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl |
e9b6a46ddb79f0d45ff42128985e531a21871cfa | commands/echo.go | commands/echo.go | // Copyright 2015 The tgbot Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package commands
import (
"fmt"
"io"
"regexp"
"strings"
)
type cmdEcho struct {
name string
description string
syntax string
re ... | // Copyright 2015 The tgbot Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package commands
import (
"fmt"
"io"
"regexp"
"strings"
)
type cmdEcho struct {
name string
description string
syntax string
re ... | Fix bug in !e command | Fix bug in !e command
| Go | bsd-3-clause | jroimartin/tgbot |
df8528b6c78a8f8f2c9220a13bbf517290eac193 | slackapi_test.go | slackapi_test.go | package slackapi
import (
"encoding/json"
"testing"
)
func CheckResponse(t *testing.T, x interface{}, y string) {
out, err := json.Marshal(x)
if err != nil {
t.Fatal("json fromat;", err)
}
if string(out) != y {
t.Fatalf("invalid json response;\n- %s\n+ %s\n", y, out)
}
}
func TestAPITest(t *testing.T) {
... | package slackapi
import (
"encoding/json"
"testing"
)
func CheckResponse(t *testing.T, x interface{}, y string) {
out, err := json.Marshal(x)
if err != nil {
t.Fatal("json fromat;", err)
}
if string(out) != y {
t.Fatalf("invalid json response;\n- %s\n+ %s\n", y, out)
}
}
func TestAPITest(t *testing.T) {
... | Remove auth.revoke unit test due to API uncertanties | Remove auth.revoke unit test due to API uncertanties
| Go | mit | cixtor/slackapi |
0d4c8d2e4fdbf23bdff41c8a2a79d2edf5205ea4 | u/u9/main.go | u/u9/main.go | package u9
import (
"github.com/gopherjs/gopherjs/js"
"honnef.co/go/js/dom"
)
// AddTabSupport is a helper that modifies a <textarea>, so that pressing tab key will insert tabs.
func AddTabSupport(textArea *dom.HTMLTextAreaElement) {
textArea.AddEventListener("keydown", false, func(event dom.Event) {
switch ke :... | package u9
import (
"github.com/gopherjs/gopherjs/js"
"honnef.co/go/js/dom"
)
// AddTabSupport is a helper that modifies a <textarea>, so that pressing tab key will insert tabs.
func AddTabSupport(textArea *dom.HTMLTextAreaElement) {
textArea.AddEventListener("keydown", false, func(event dom.Event) {
switch ke :... | Use a more readable constant. | u9: Use a more readable constant.
| Go | mit | shurcooL/go |
7d1d9d98e4e9e04572a61016fd96e8acfb91c62f | atc/resource/resource_check.go | atc/resource/resource_check.go | package resource
import (
"context"
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/runtime"
)
func (resource *resource) Check(
ctx context.Context,
spec runtime.ProcessSpec,
runnable runtime.Runnable) ([]atc.Version, error) {
var versions []atc.Version
err := runnable.RunScript(
... | package resource
import (
"context"
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/runtime"
)
type checkRequest struct {
Source atc.Source `json:"source"`
Version atc.Version `json:"version"`
}
func (resource *resource) Check(
ctx context.Context,
spec runtime.ProcessSpec,
runnabl... | Fix broken check resource - run script was being passed a resource instead of serializable json | Fix broken check resource
- run script was being passed a resource instead of serializable json
Signed-off-by: Krishna Mannem <70f8bf4e42dd699c2822d738a7ab22d45b22b08a@pivotal.io>
Signed-off-by: Sameer Vohra <9dd3a30774efbd15e2401a4c8ee8d5219d46192f@gmail.com>
| Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
9ddbc8d4746d1876f9a6f0e1a543b7b85563b578 | i18n/translate.go | i18n/translate.go | package i18n
// T returns the given string translated into the language
// returned by lang.
func T(str string, lang Languager) string {
return Tc("", str, lang)
}
// Tn translates the given string into the language returned
// by lang. The string will have different forms for singular
// and plural forms. The chose... | package i18n
import (
"gnd.la/i18n/table"
)
// T returns the given string translated into the language
// returned by lang.
func T(str string, lang Languager) string {
return Tc("", str, lang)
}
// Tn translates the given string into the language returned
// by lang. The string will have different forms for singul... | Implement the actual calls to translation tables. | Implement the actual calls to translation tables.
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
622a6679403dd07c987d8b148e41d54d557ed185 | test/bugs/bug125.go | test/bugs/bug125.go | // errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
OS "os" // should require semicolon here; this is no different from other decls
IO "io"
)
func main() {
}
| // errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
OS "os" // should require semicolon here; this is no different from other decls
IO "io" // ERROR "missing"
)
... | Add ERROR comment for errmsg to look for. | Add ERROR comment for errmsg to look for.
R=gri
DELTA=1 (0 added, 0 deleted, 1 changed)
OCL=19460
CL=19500 | Go | bsd-3-clause | abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go |
ed1eb770f0ec882af805b452c904f29db6050110 | test/bugs/bug126.go | test/bugs/bug126.go | // errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
const none = 0 // same const identifier declared twice should not be accepted
const none = 1 // ERROR "redeclared"
| // errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// same const identifier declared twice should not be accepted
const none = 0 // GCCGO_ERROR "previous"
const none = 1 //... | Tweak comments so that this test passes with gccgo. | Tweak comments so that this test passes with gccgo.
bug126.go:7:7: error: redefinition of 'none'
bug126.go:6:7: note: previous definition of 'none' was here
R=gri
DELTA=3 (1 added, 0 deleted, 2 changed)
OCL=20563
CL=20723
| Go | bsd-3-clause | npe9/noahevans-go9,webfd/go-zh,npe9/noahevans-go9,npe9/noahevans-go9,scirelli/scirelli-go,webfd/go-zh,rdp/rogerpack2005-golang,Triskite/willstone-goclone,bryanxu/go-zh,bryanxu/go-zh,d0f/go-zh,rflanagan/reginaldflanagan-project1,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,webfd/go-zh,d0f/go-zh,scirelli/s... |
26737e00309e305db76a04c734a947ebb8be58d8 | reduce_test.go | reduce_test.go | package gorobdd
import (
"fmt"
//"testing"
)
func ExampleReduceTrivial() {
fmt.Println(Reduce(True([]string{})))
fmt.Println(Reduce(False([]string{})))
fmt.Println(Reduce(True([]string{"a"})))
fmt.Println(Reduce(False([]string{"a"})))
fmt.Println(Reduce(True([]string{"a", "b"})))
fmt.Println(Reduce(False([]st... | package gorobdd
import (
"fmt"
//"testing"
)
func ExampleReduceTrivial() {
fmt.Println(Reduce(True([]string{})))
fmt.Println(Reduce(False([]string{})))
fmt.Println(Reduce(True([]string{"a"})))
fmt.Println(Reduce(False([]string{"a"})))
fmt.Println(Reduce(True([]string{"a", "b"})))
fmt.Println(Reduce(False([]st... | Reduce skips plies with both True and False leaves. | Reduce skips plies with both True and False leaves.
| Go | mit | callpraths/gorobdd |
db989029b4110bf06ffa82766787ebeef817e048 | platform/main.go | platform/main.go | package main
import (
"flag"
"fmt"
"github.com/BurntSushi/toml"
log "github.com/Sirupsen/logrus"
)
func StartServer(config *SiteConfig) {
gb := NewGoblin(config)
err := gb.Init()
if err != nil {
log.Errorf("Goblin init fail. %s", err)
return
}
gb.StartServer()
}
func main() {
configPtr := flag.String("... | package main
import (
"flag"
"fmt"
"github.com/BurntSushi/toml"
log "github.com/Sirupsen/logrus"
"os"
)
func StartServer(config *SiteConfig) {
gb := NewGoblin(config)
err := gb.Init()
if err != nil {
log.Errorf("Goblin init fail. %s", err)
return
}
gb.StartServer()
}
func main() {
configPtr := flag.St... | Add dbconnection to env support. | Add dbconnection to env support.
| Go | apache-2.0 | ggoblin/goblin,eternnoir/goblin,eternnoir/goblin,eternnoir/goblin,ggoblin/goblin,ggoblin/goblin |
b0e487333784645b8549c58668bff0b4909dbfa7 | lib/image/list.go | lib/image/list.go | package image
import (
"github.com/Symantec/Dominator/lib/filesystem"
"github.com/Symantec/Dominator/lib/hash"
)
func (image *Image) listObjects() []hash.Hash {
hashes := make([]hash.Hash, 0, image.FileSystem.NumRegularInodes+2)
for _, inode := range image.FileSystem.InodeTable {
if inode, ok := inode.(*filesys... | package image
import (
"github.com/Symantec/Dominator/lib/hash"
)
func (image *Image) listObjects() []hash.Hash {
hashes := make([]hash.Hash, 0, image.FileSystem.NumRegularInodes+2)
image.forEachObject(func(hashVal hash.Hash) error {
hashes = append(hashes, hashVal)
return nil
})
return hashes
}
| Change lib/image.Image.ListObjects() to use forEachObject() iterator. | Change lib/image.Image.ListObjects() to use forEachObject() iterator.
| Go | apache-2.0 | keep94/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator |
24bb1f52ec6e1a3be30987ecafb0d159b501eeb0 | workflowhelpers/as_user.go | workflowhelpers/as_user.go | package workflowhelpers
import (
"time"
)
type userContext interface {
SetCfHomeDir() (string, string)
UnsetCfHomeDir(string, string)
Login()
Logout()
TargetSpace()
}
var AsUser = func(uc userContext, timeout time.Duration, actions func()) {
originalCfHomeDir, currentCfHomeDir := uc.SetCfHomeDir()
uc.Login()... | package workflowhelpers
import (
"time"
)
type userContext interface {
SetCfHomeDir() (string, string)
UnsetCfHomeDir(string, string)
Login()
Logout()
TargetSpace()
}
func AsUser(uc userContext, timeout time.Duration, actions func()) {
originalCfHomeDir, currentCfHomeDir := uc.SetCfHomeDir()
uc.Login()
defe... | Refactor variable declaration as function | Refactor variable declaration as function
Signed-off-by: Alexander Berezovsky <a12e46294a7d630b60bbba114755367d6bafe2fb@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/cf-test-helpers,cloudfoundry-incubator/cf-test-helpers |
2132a0a27b3d10ffd53494054d6ab3b225859938 | block_test.go | block_test.go | package main
import (
"testing"
)
func TestNewBlock(t *testing.T) {
startApplication()
// Register on volume
b := datastore.NewBlock()
// Persist
b.Persist()
// Encode
b.ErasureEncoding()
// Persist with encoding
b.Persist()
}
| package main
import (
"crypto/md5"
"fmt"
"testing"
)
func TestNewBlock(t *testing.T) {
startApplication()
// Register on volume
b := datastore.NewBlock()
// Persist
b.Persist()
// Calculate hashes
preHash := make([]string, 10)
for i, ds := range b.DataShards {
h := md5.New()
h.Write(ds.Contents().By... | Validate data shard integrity on erasure coding | Validate data shard integrity on erasure coding
| Go | apache-2.0 | RobinUS2/xyzfs,RobinUS2/xyzfs |
5d1671bb9bf53a61f5c8db8a00f8c62adcf33e81 | integration_tests/root_test.go | integration_tests/root_test.go | package wl_integration_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("basic root functionality", func() {
It("gets root correctly", func() {
root, err := client.Root()
Expect(err).NotTo(HaveOccurred())
Expect(root.ID).To(BeNumerically(">", 0))
})
})
| package wl_integration_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/robdimsdale/wl"
)
var _ = Describe("basic root functionality", func() {
It("gets root correctly", func() {
var err error
var root wl.Root
Eventually(func() error {
root, err = client.Root()
return er... | Reduce flakiness in root test. | Reduce flakiness in root test.
[#105727604]
| Go | mit | robdimsdale/wl,robdimsdale/wundergo,robdimsdale/wl,robdimsdale/wundergo |
7071627cb12f127cae3d221ba433785157c09755 | departure/watcher.go | departure/watcher.go | package departure
import (
"time"
"fmt"
)
func Watch(duration, throttle, bufferTime int, apiKey, origin, destination, transitMode, lineName string) {
ticker := time.NewTicker(time.Second * time.Duration(throttle))
go func() {
for range ticker.C {
desiredDepTime := time.Now().Add(time.Duration(bufferTime) * t... | package departure
import (
"time"
"fmt"
)
func Watch(duration, throttle, bufferTime int, apiKey, origin, destination, transitMode, lineName string) {
ticker := time.NewTicker(time.Second * time.Duration(throttle))
go func() {
for range ticker.C {
desiredDepTime := time.Now().Add(time.Duration(bufferTime) * t... | Subtract buffer time from wait time | Subtract buffer time from wait time
| Go | mit | DanShu93/trainspotter,DanShu93/trainspotter |
10e3f75b7cae2782ee079b88de26223968fec5b6 | cmd/bundles/main.go | cmd/bundles/main.go | package main
import (
"fmt"
"github.com/peteretelej/saf"
)
func main() {
b, err := saf.GetBundles()
if err != nil {
fmt.Printf("Failed to get bundles: %v\n", err)
return
}
b.PrettyPrint()
}
| package main
import (
"fmt"
"os"
"github.com/peteretelej/saf"
)
func main() {
b, err := saf.GetBundles()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to get bundles: %v\n", err)
os.Exit(1)
}
b.PrettyPrint()
}
| Add exit status to error exit | Add exit status to error exit
| Go | mit | peteretelej/saf |
6edc7cec47f6a972cfc71f8ce4f00624b93e0662 | src/greenskeeper/greenskeeper_suite_test.go | src/greenskeeper/greenskeeper_suite_test.go | package greenskeeper
import (
"os/exec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"testing"
)
func TestGreenskeeper(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Greenskeeper Suite")
}
var _ = BeforeSuite(func() {
cmd := exec.Command("groupadd", "mewtwo")... | package greenskeeper
import (
"os/exec"
"os/user"
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
func TestGreenskeeper(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Greenskeeper Suite")
}
var _ = BeforeSuite(func() {
if _, err := user.Looku... | Reduce flakiness of greenskeeper suite | Reduce flakiness of greenskeeper suite
[#152240930]
| Go | apache-2.0 | cloudfoundry-incubator/guardian-release,cloudfoundry-incubator/guardian-release,cloudfoundry-incubator/guardian-release |
0c72bcc4edc09902ecded9a92ce08d145ee94e14 | utils/form_filler_test.go | utils/form_filler_test.go | package utils_test
import (
"github.com/herald-it/goncord/utils"
"net/url"
"testing"
)
type TestStruct struct {
Field string
Field2 int
}
func TestFormFiller(t *testing.T) {
ts := new(TestStruct)
form := url.Values{}
form.Set("Field", "form_field")
form.Set("Field2", "1")
err := utils.Fill(ts, form)
if ... | package utils_test
import (
"github.com/herald-it/goncord/utils"
. "github.com/smartystreets/goconvey/convey"
"net/url"
"testing"
)
type TestStruct struct {
Field string
Field2 int
}
func TestFormFiller(t *testing.T) {
Convey("Test form filler method", t, func() {
ts := new(TestStruct)
form := url.Values... | Change test fraemwork on Convey. | Change test fraemwork on Convey.
| Go | mit | herald-it/goncord |
6de229cac19424ca407d08ec9ab827dc13a65e7b | src/chessboard/piece.go | src/chessboard/piece.go | package chessboard
var starting = [][]byte{
[]byte{'R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R'},
[]byte{'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'},
[]byte{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
[]byte{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
[]byte{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
[]byte{' ', ' ', ' ', ' ', ' ... | package chessboard
type Board [][]byte
var starting = Board{
{'R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R'},
{'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'},
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},... | Set board as an alias of [][]byte | Set board as an alias of [][]byte
| Go | mit | Roadagain/Chess |
1c9ab08ace7ac3bbc42ed04cc5a4a0660b213a9a | ginkgomon/helpers.go | ginkgomon/helpers.go | package ginkgomon
import (
"fmt"
"os"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
func Invoke(runner ifrit.Runner) ifrit.Process {
process := ifrit.Background(runner)
select {
case <-process.Ready():
case err := <-process.Wait():
ginkgo.Fail(fmt.Sprintf("process failed... | package ginkgomon
import (
"fmt"
"os"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
func Invoke(runner ifrit.Runner) ifrit.Process {
process := ifrit.Background(runner)
select {
case <-process.Ready():
case err := <-process.Wait():
ginkgo.Fail(fmt.Sprintf("process failed... | Use EventuallyWithOffset instead of Eventually to get the correct stacktrace | Use EventuallyWithOffset instead of Eventually to get the correct stacktrace
| Go | mit | tedsuo/ifrit |
24abbe91ce556edb7dc4a11a89a7b8e97f7e31fc | gtk/gtk_deprecated_since_3_16.go | gtk/gtk_deprecated_since_3_16.go | //+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14
package gtk
// #cgo pkg-config: gtk+-3.0
// #include <gtk/gtk.h>
// #include <stdlib.h>
import "C"
import (
"github.com/gotk3/gotk3/gdk"
"unsafe"
)
// OverrideColor is a wrapper around gtk_widget_override_color().
func (v *Widget) OverrideColor(state StateFlags,... | //+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14
package gtk
// #cgo pkg-config: gtk+-3.0
// #include <gtk/gtk.h>
// #include <stdlib.h>
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/gdk"
)
// OverrideColor is a wrapper around gtk_widget_override_color().
func (v *Widget) OverrideColor(state StateFlags... | Fix issue introduced when changing name of internal member for RGBA type | Fix issue introduced when changing name of internal member for RGBA type
| Go | isc | pekim/gotk3,andre-hub/gotk3,pekim/gotk3,pekim/gotk3,gotk3/gotk3,yamnikov-oleg/gotk3,andre-hub/gotk3,yamnikov-oleg/gotk3,andre-hub/gotk3,gotk3/gotk3,yamnikov-oleg/gotk3 |
7445399be5ae7588274bbe6843c6ca6a342d6326 | cmd/mtime/main.go | cmd/mtime/main.go | package main
import (
"os"
"fmt"
)
func main() {
for _, s := range os.Args[1:] {
fi, _ := os.Stat(s)
mt := fi.ModTime()
fmt.Printf("%d %s", mt, s)
}
}
| package main
import (
"fmt"
"os"
)
func main() {
for _, s := range os.Args[1:] {
fi, err := os.Stat(s)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
}
mt := fi.ModTime()
fmt.Printf("%d %s", mt, s)
}
}
| Check for error return from Stat | mtime: Check for error return from Stat
| Go | bsd-3-clause | mortdeus/goblin |
4ca42abd488ebf1156d1d28a30b059a2d2f652c2 | cmd/lbmgr/utility.go | cmd/lbmgr/utility.go | package main
import (
"fmt"
"os"
)
func pr(f string, v ...interface{}) {
fmt.Printf(f+"\n", v...)
}
func exists(path string) bool {
_, err := os.Stat(path)
return err == nil
}
// createdir is used when the existence of a directory is absolutely required.
func createdir(dir string) string {
if !exists(dir) {
... | package main
import (
"fmt"
"os"
)
func pr(f string, v ...interface{}) {
fmt.Printf(f+"\n", v...)
}
func prn(f string, v ...interface{}) {
fmt.Printf(f, v...)
}
func exists(path string) bool {
_, err := os.Stat(path)
return err == nil
}
// createdir is used when the existence of a directory is absolutely req... | Add prn() for no-newline printouts. | Add prn() for no-newline printouts.
| Go | mit | Urethramancer/lbapi,Urethramancer/lbapi |
6ecb43035c8ff0aa1f77087100bdcde56aedebea | server/server.go | server/server.go | package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/julienschmidt/httprouter"
"github.com/rs/cors"
"gopkg.in/mgo.v2"
"github.com/kshvmdn/what-class-is-this/server/controllers"
)
func getSession() *mgo.Session {
s, err := mgo.Dial("mongodb://localhost")
if err != nil {
log.Fatal(err)
}
retu... | package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/julienschmidt/httprouter"
"github.com/rs/cors"
"gopkg.in/mgo.v2"
"github.com/kshvmdn/what-class-is-this/server/controllers"
)
func getSession() *mgo.Session {
s, err := mgo.Dial("mongodb://localhost")
if err != nil {
log.Fatal(err)
}
retu... | Fix log print in main method | Fix log print in main method
Fix log print in main method
Update server.go
| Go | mit | qasim/what-class-is-this,qasim/what-class-is-this,qasim/what-class-is-this,qasim/what-class-is-this |
47a5da9bace9b3a5127b24daa2b382e12cf85a3c | example_test.go | example_test.go | // Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Sample application to demonstrate the log package.
package log_test
import (
"context"
"os"
"zombiezen.com/go/log"
)
func Example() {
// Initialize t... | // Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Sample application to demonstrate the log package.
package log_test
import (
"context"
"os"
"zombiezen.com/go/log"
)
func Example() {
// Initialize t... | Correct variable names in example | Correct variable names in example
| Go | bsd-3-clause | zombiezen/go-log |
2244d77c94c14a94622fa048d937f828cf6519b4 | handlers/handlers.go | handlers/handlers.go | package handlers
import (
"net/http"
"github.com/cloudfoundry-incubator/bbs"
"github.com/cloudfoundry-incubator/nsync"
"github.com/cloudfoundry-incubator/nsync/recipebuilder"
"github.com/pivotal-golang/lager"
"github.com/tedsuo/rata"
)
func New(logger lager.Logger, bbsClient bbs.Client, recipebuilders map[stri... | package handlers
import (
"net/http"
"github.com/cloudfoundry-incubator/bbs"
"github.com/cloudfoundry-incubator/nsync"
"github.com/cloudfoundry-incubator/nsync/recipebuilder"
"github.com/pivotal-golang/lager"
"github.com/tedsuo/rata"
)
func New(logger lager.Logger, bbsClient bbs.Client, recipebuilders map[stri... | Allow CancelTaskHandler to be called when nsync CancelTaskRoute is hit. | Allow CancelTaskHandler to be called when nsync CancelTaskRoute is hit.
- Register the handler with Rata
[#111473134]
Signed-off-by: Frank Kotsianas <7292b1604e9876e8e1934a101736830424483797@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/nsync |
65dd2714e0347738499bed12fec0df02fcba5748 | server/request.go | server/request.go | package server
import (
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
)
type Request interface {
context.Context
// Id of this message, used to correlate the response
Id() string
// ContentType of the payload
ContentType() string
// Payload of raw bytes received from the transport
Payload() ... | package server
import (
"github.com/b2aio/typhon/auth"
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
)
// Request received by the server
type Request interface {
context.Context
// Id of this message, used to correlate the response
Id() string
// ContentType of the payload
ContentType() strin... | Switch out access token for credentials | Switch out access token for credentials
| Go | mit | monzo/typhon,mondough/typhon |
bdd74d44f4b429a67cec822017def26b94145195 | groups_linux.go | groups_linux.go | package pufferpanel
import (
"os/user"
)
func UserInGroup() bool {
u, err := user.Current()
if err != nil {
return false
}
expectedGroup, err := user.LookupGroup("pufferpanel")
if err != nil {
return false
}
groups, err := u.GroupIds()
if err != nil {
return false
}
return ContainsString(groups, ex... | package pufferpanel
import (
"os/user"
)
func UserInGroup() bool {
u, err := user.Current()
if err != nil {
return false
}
groups, err := u.GroupIds()
if err != nil {
return false
}
allowedIds := make([]string, 0)
if expectedGroup, err := user.LookupGroup("pufferpanel"); err == nil {
allowedIds = ap... | Change group check to permit pufferpanel and root groups This means root can use this without changing groups | Change group check to permit pufferpanel and root groups
This means root can use this without changing groups
| Go | apache-2.0 | PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel |
241f8379347845280c5ae1d6d8947103ea9abe28 | gists/gist8065433/main.go | gists/gist8065433/main.go | package gist8065433
import "net"
// GetPublicIps returns a string slice of non-loopback IPs.
func GetPublicIps() (publicIps []string, err error) {
ifis, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, ifi := range ifis {
addrs, err := ifi.Addrs()
if err != nil {
return nil, err
}
f... | package gist8065433
import "net"
// GetPublicIps returns a string slice of non-loopback IPs.
func GetPublicIps() (publicIps []string, err error) {
ifis, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, ifi := range ifis {
addrs, err := ifi.Addrs()
if err != nil {
return nil, err
}
f... | Add GetAllIps to get a list of all IPv4 interfaces, including loopback. | Add GetAllIps to get a list of all IPv4 interfaces, including loopback.
| Go | mit | shurcooL/go |
fae96b72e31deb1dbccf7d5fa352e1f23a3c2109 | pkg/api/store/projectsetter/project_setter_test.go | pkg/api/store/projectsetter/project_setter_test.go | package projectsetter
import (
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/project"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net/http"
"testing"
)
// Tests that getMatchingNamespaces returns the proper amount namespaces given duplicates, empty slices, and multipl... | Add tests for project setter | Add tests for project setter
Added tests for logic in project setter store.
| Go | apache-2.0 | rancher/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher | |
845c6dc392ed034057857abc5a4d814c458d0bbf | app/models/chart.go | app/models/chart.go | package models
import (
"time"
"github.com/jinzhu/now"
"github.com/qor/qor-example/db"
)
type Chart struct {
Total string
Date time.Time
}
/*
date format 2015-01-23
*/
func GetChartData(table, start, end string) (res []Chart) {
startdate, err := time.Parse("2006-01-02", start)
if err != nil {
return
}
e... | package models
import (
"time"
"github.com/jinzhu/now"
"github.com/qor/qor-example/db"
)
type Chart struct {
Total string
Date time.Time
}
/*
date format 2015-01-23
*/
func GetChartData(table, start, end string) (res []Chart) {
startdate, err := now.Parse(start)
if err != nil {
return
}
enddate, err :=... | Fix time zone problem by using now parse time | Fix time zone problem by using now parse time
| Go | mit | firestudios/qor-example,grengojbo/qor-example,qor/qor-example,grengojbo/qor-example,firestudios/qor-example,qor/qor-example,qor/qor-example,grengojbo/qor-example,firestudios/qor-example |
a11b806d935e7e7b8e7d27d3e1a49398eaaef0c2 | core/commands/helptext_test.go | core/commands/helptext_test.go | package commands
import (
cmds "github.com/ipfs/go-ipfs/commands"
"strings"
"testing"
)
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
if c.Helptext.Tagline == "" {
t.Errorf("%s has no tagline!", strings.Join(name, " "))
}
if c.Helptext.LongDescription == "" {
t.Errorf("%s has ... | package commands
import (
cmds "github.com/ipfs/go-ipfs/commands"
"strings"
"testing"
)
func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
if c.Helptext.Tagline == "" {
t.Errorf("%s has no tagline!", strings.Join(name, " "))
}
if c.Helptext.LongDescription == "" {
t.Errorf("%s has ... | Add ProcessHelp call to Helptext test. | Add ProcessHelp call to Helptext test.
License: MIT
Signed-off-by: Jakub Sztandera <77246600354bed77252577b0222eb63e0827639a@protonmail.ch>
| Go | mit | ianopolous/go-ipfs,WilliButz/go-ipfs,Quantomicus/go-ipfs,MichaelMure/go-ipfs,Luzifer/go-ipfs,MichaelMure/go-ipfs,WilliButz/go-ipfs,kyledrake/go-ipfs,Luzifer/go-ipfs,ianopolous/go-ipfs,Quantomicus/go-ipfs,ianopolous/go-ipfs,JustinDrake/go-ipfs,OpenBazaar/go-ipfs,OpenBazaar/go-ipfs,JustinDrake/go-ipfs,JustinDrake/go-ipfs... |
0c2e34e3d8c64bb1c81e41feca9e1f61374752a6 | procaddr/glx/glx.go | procaddr/glx/glx.go | package glx
// #cgo linux LDFLAGS: -lGL
// #include <stdlib.h>
// #include <GL/glx.h>
import "C"
import "unsafe"
func GetProcAddress(name string) unsafe.Pointer {
var cname *C.GLubyte = (*C.GLubyte)(C.CString(name))
defer C.free(unsafe.Pointer(cname))
return unsafe.Pointer(C.glXGetProcAddress(cname))
}
| package glx
// #cgo linux LDFLAGS: -lGL
// #include <stdlib.h>
// #include <GL/glx.h>
import "C"
import "unsafe"
func GetProcAddress(name string) unsafe.Pointer {
var cname *C.GLubyte = (*C.GLubyte)(unsafe.Pointer(C.CString(name)))
defer C.free(unsafe.Pointer(cname))
return unsafe.Pointer(C.glXGetProcAddress(cname... | Fix the GLX C string conversion. | Fix the GLX C string conversion.
Fixes #4.
| Go | mit | go-gl/gl,thinkofdeath/gl,mantyr/gl,MaVo159/gl,stephenwithav/gl |
b0a8d01e9708f2c90130ad8163ac75247ac14e96 | input/s3/s3_input_test.go | input/s3/s3_input_test.go | package s3
import (
"testing"
"github.com/rlmcpherson/s3gof3r"
"polydawn.net/repeatr/input/tests"
"polydawn.net/repeatr/lib/guid"
"polydawn.net/repeatr/output/s3"
)
func TestCoreCompliance(t *testing.T) {
if _, err := s3gof3r.EnvKeys(); err != nil {
t.Skipf("skipping s3 output tests; no s3 credentials loaded... | package s3
import (
"testing"
"github.com/rlmcpherson/s3gof3r"
"polydawn.net/repeatr/input/tests"
"polydawn.net/repeatr/lib/guid"
"polydawn.net/repeatr/output/s3"
)
func TestCoreCompliance(t *testing.T) {
if _, err := s3gof3r.EnvKeys(); err != nil {
t.Skipf("skipping s3 output tests; no s3 credentials loaded... | Add test of s3 splay URIs: CA-storage under prefix | Add test of s3 splay URIs: CA-storage under prefix
Using the URI scheme to indicate a "splay" mode causes the s3 input and output systems to save data under content-addressible hashes (prefixed by a selected path) -- this allows easily storing sets of data under a single URI.
(A better test would shovel several datas... | Go | apache-2.0 | polydawn/repeatr,subuser-security/repeatr,kkroening/repeatr,polydawn/repeatr,kkroening/repeatr,subuser-security/repeatr |
b8af8747a84459eb917f980e5ccd89ad25e57a16 | models/image.go | models/image.go | package models
import (
"github.com/spacedock-io/registry/db"
)
type Image struct {
Id int64
Uuid string
Json []byte
Checksum string
Size int64
Ancestry []string
Tags []Tag
}
func (image *Image) Save() error {
q := db.DB.Save(image)
return q.Error
}
| package models
import (
"github.com/spacedock-io/registry/db"
)
type Image struct {
Id int64
Uuid string
Json []byte
Checksum string
Size int64
Ancestry []Ancestor
Tags []Tag
}
type Ancestor struct {
Id int64
ImageId int64
Name string
}
func (image *Image) Save() e... | Add very basic Ancestry model | Add very basic Ancestry model
| Go | mit | spacedock-io/registry |
d69e9dc473b019bfc33039ac78ae6bea0c2a5242 | templates/content.go | templates/content.go | package templates
func ScopeTemplateContent() string {
return `{{ .Name}}:
{{ range .Services }}{{ .GetName }}:
{{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }}
{{ end }}{{ end }}
`
}
| package templates
func ScopeTemplateContent() string {
return `#cloud-config
{{ .Name}}:
{{ range .Services }}{{ .GetName }}:
{{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
`
}
| Add line break after each service on template | Add line break after each service on template
| Go | apache-2.0 | bernardolins/clustereasy,bernardolins/clustereasy |
5a38d379d1c258102ba51bb83842326924755242 | migrator/migrator.go | migrator/migrator.go | package migrator
import (
"github.com/mattes/migrate/migrate"
"github.com/resourced/resourced-master/config"
)
func New(generalConfig config.GeneralConfig) *Migrator {
m := &Migrator{}
m.AppGeneralConfig = generalConfig
return m
}
type Migrator struct {
AppGeneralConfig config.GeneralConfig
}
func (m *Migrat... | package migrator
import (
_ "github.com/mattes/migrate/driver/postgres"
"github.com/mattes/migrate/migrate"
"github.com/resourced/resourced-master/config"
)
func New(generalConfig config.GeneralConfig) *Migrator {
m := &Migrator{}
m.AppGeneralConfig = generalConfig
return m
}
type Migrator struct {
AppGenera... | Upgrade migrate library to avoid using sqlite lib. | Upgrade migrate library to avoid using sqlite lib. | Go | mit | resourced/resourced-master,resourced/resourced-master,resourced/resourced-master,resourced/resourced-master,resourced/resourced-master,resourced/resourced-master |
68341e6e8affb1a740415709cfb205b0bd55b21e | packer/rpc/server_test.go | packer/rpc/server_test.go | package rpc
import (
"cgl.tideland.biz/asserts"
"net/rpc"
"testing"
)
func TestServer_Address_PanicIfNotStarted(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
defer func() {
p := recover()
assert.NotNil(p, "should panic")
assert.Equal(p.(string), "Server not listening.", "right panic")
}()
... | package rpc
import (
"cgl.tideland.biz/asserts"
"net/rpc"
"testing"
)
func TestServer_Address_PanicIfNotStarted(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
defer func() {
p := recover()
assert.NotNil(p, "should panic")
assert.Equal(p.(string), "Server not listening.", "right panic")
}()
... | Test regisering a UI with the server | Test regisering a UI with the server
| Go | mpl-2.0 | ephemeralsnow/packer,uber/packer,hasJackb/packer,grubernaut/packer,jszwedko/packer,leroux/packer,ttaylor249/packer,ephemeralsnow/packer,bensojona/packer,oliviertremblay/packer,jarl-dk/packer,evertrue/packer,rk295/packer,visioncritical/packer,msabramo/packer,monkeylittleinc/packer,sansb/packer,yonglehou/packer,atlassian... |
cffa5b6b50d25a48b20754af5fc9a5154d516c5e | network/resolver/dns/dns.go | network/resolver/dns/dns.go | // Package dns resolves names to dns records
package dns
import (
"net"
"github.com/micro/go-micro/network/resolver"
)
// Resolver is a DNS network resolve
type Resolver struct{}
// Resolve assumes ID is a domain name e.g micro.mu
func (r *Resolver) Resolve(name string) ([]*resolver.Record, error) {
host, port, ... | // Package dns resolves names to dns records
package dns
import (
"context"
"net"
"github.com/micro/go-micro/network/resolver"
"github.com/miekg/dns"
)
// Resolver is a DNS network resolve
type Resolver struct {
// The resolver address to use
Address string
}
// Resolve assumes ID is a domain name e.g micro.m... | Make use of cloudflare 1.0.0.1 by default to resolve addresses | Make use of cloudflare 1.0.0.1 by default to resolve addresses
| Go | apache-2.0 | myodc/go-micro,micro/go-micro |
cb5e4254572805c3e70a342ce3ad84124ea438fe | pkg/agent/syssetup/setup.go | pkg/agent/syssetup/setup.go | package syssetup
import (
"io/ioutil"
"os/exec"
"github.com/sirupsen/logrus"
)
var (
callIPTablesFile = "/proc/sys/net/bridge/bridge-nf-call-iptables"
)
func Configure() error {
exec.Command("modprobe", "br_netfilter").Run()
if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil {
logru... | package syssetup
import (
"io/ioutil"
"os/exec"
"github.com/sirupsen/logrus"
)
var (
callIPTablesFile = "/proc/sys/net/bridge/bridge-nf-call-iptables"
forward = "/proc/sys/net/ipv4/ip_forward"
)
func Configure() error {
exec.Command("modprobe", "br_netfilter").Run()
if err := ioutil.WriteFile(callIP... | Set /proc/sys/net/ipv4/ip_forward on agent start | Set /proc/sys/net/ipv4/ip_forward on agent start
| Go | apache-2.0 | rancher/k3s,rancher/k3s |
1078781487b9e3b198f95486886271ae999ff1d8 | state/state.go | state/state.go | package state
import (
"github.com/hashicorp/terraform/terraform"
)
// State is the collection of all state interfaces.
type State interface {
StateReader
StateWriter
StateRefresher
StatePersister
}
// StateReader is the interface for things that can return a state. Retrieving
// the state here must not error. ... | package state
import (
"github.com/hashicorp/terraform/terraform"
)
// State is the collection of all state interfaces.
type State interface {
StateReader
StateWriter
StateRefresher
StatePersister
}
// StateReader is the interface for things that can return a state. Retrieving
// the state here must not error. ... | Change lock reason -> info | Change lock reason -> info
This makes it more apparent that the information passed in isn't
required nor will it conform to any standard. There may be call sites
that can't provide good contextual info, and we don't want to count on
that value.
| Go | mpl-2.0 | lstolyarov/terraform,JDiPierro/terraform,pgray/terraform,ColinHebert/terraform,kjmkznr/terraform,evandbrown/terraform,bradfeehan/terraform,yanndegat/terraform,taliesins/terraform,yanndegat/terraform,harijayms/terraform,kristinn/terraform,paybyphone/terraform,GannettDigital/terraform,vancluever/terraform,mathieuherbert/... |
e1f719daee0790811f8f22c6f304396b1f6c309e | rules/regex/rules.go | rules/regex/rules.go | package regex
import (
"fmt"
"time"
"cirello.io/gochatbot/bot"
)
var regexRules = []regexRule{
{
`{{ .RobotName }} jump`, `tells the robot to jump`,
func(bot bot.Self, msg string, matches []string) []string {
var ret []string
ret = append(ret, "{{ .User }}, How high?")
lastJumpTS := bot.MemoryRead("... | package regex
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
"cirello.io/gochatbot/bot"
)
var regexRules = []regexRule{
{
`{{ .RobotName }} jump`, `tells the robot to jump`,
func(bot bot.Self, msg string, matches []string) []string {
var ret []string
ret = append(ret, "{{ .User }}, How h... | Add example command in Regex rule which uses its matches | Add example command in Regex rule which uses its matches
| Go | mit | ccirello/gochatbot,ccirello/gochatbot,ccirello/gochatbot |
e9e582905ca1c0652363fe480fb8f2fc1c067ded | fsm.go | fsm.go | package raft
// FSM provides an interface that can be implemented by
// clients to make use of the replicated log
type FSM interface {
// Apply log is invoked once a log entry is commited
ApplyLog([]byte)
}
| package raft
// FSM provides an interface that can be implemented by
// clients to make use of the replicated log
type FSM interface {
// Apply log is invoked once a log entry is commited
Apply([]byte)
}
| Change FSM method to just Apply | Change FSM method to just Apply
| Go | mpl-2.0 | otoolep/raft,dgnorton/raft,PattyW/raft_govec,hashicorp/raft,sean-/raft,quantiply-fork/raft,wantonsolutions/raft,hashicorp/raft,jmptrader/raft-1,tempbottle/raft-2 |
e7af00087b9bf1cd832bc279b8ae1d57a3e3b0ea | log.go | log.go | package wrapplog
import (
"strings"
"github.com/Sirupsen/logrus"
)
var jsonFormatter = logrus.JSONFormatter{}
type WrappFormatter struct {
// TimestampFormat sets the format used for marshaling timestamps.
TimestampFormat string
}
func (f *WrappFormatter) Format(entry *logrus.Entry) ([]byte, error) {
jsonByte... | package wrapplog
import (
"os"
"strings"
"github.com/Sirupsen/logrus"
)
var jsonFormatter = logrus.JSONFormatter{}
type WrappFormatter struct{}
func init() {
logrus.SetFormatter(&WrappFormatter{})
logrus.SetOutput(os.Stdout)
logrus.Info("initializing wrapp logging")
}
// Format logs according to WEP-007
fun... | Set up WrappFormatter in init | Set up WrappFormatter in init
| Go | mit | wrapp/wrapplog |
32bc365655c7f33d88b716230823b072c30684a4 | util/slice.go | util/slice.go | package util
import (
"regexp"
)
func Contains(stringSlice []string, searchString string) bool {
for _, value := range stringSlice {
if value == searchString {
return true
}
}
return false
}
func ContainsRegex(regexs []string, searchString string) bool {
for _, regex := range regexs {
match, err := reg... | package util
import (
"regexp"
)
func Contains(stringSlice []string, searchString string) bool {
for _, regex := range stringSlice {
match, err := regexp.MatchString(regex, searchString)
if match {
return true
}
if err != nil {
loggerUtilHTML.Errorf(err.Error())
}
}
return false
}
func ContainsRe... | Add regex for specific form inputs detection | Add regex for specific form inputs detection
| Go | mit | v4lproik/no-name,v4lproik/no-name,v4lproik/no-name |
5ebe5070d9fc59595d56319977a87d36389f89c3 | app/models/init.go | app/models/init.go | package models
import (
"github.com/coopernurse/gorp"
)
func CreateTables(g *gorp.DbMap) {
// Add User Table
t := g.AddTableWithName(User{}, "dispatch_user").SetKeys(true, "UserId")
t.ColMap("Password").Transient = true
// Add UserApp Table
g.AddTableWithName(UserApp{}, "dispatch_app").SetKeys(true, "UserAppId... | package models
import (
"github.com/coopernurse/gorp"
)
func CreateTables(g *gorp.DbMap) {
// Add User Table
t := g.AddTableWithName(User{}, "dispatch_user").SetKeys(true, "UserId")
t.ColMap("Password").Transient = true
// Add UserApp Table
g.AddTableWithName(UserApp{}, "dispatch_app").SetKeys(true, "UserAppId... | Put the Tables for Live | Put the Tables for Live
| Go | mit | melange-app/melange,melange-app/melange,melange-app/melange,melange-app/melange,melange-app/melange,melange-app/melange |
338564c0fff2f3e67890d163093b7cbd78e4bfc9 | main.go | main.go | package main
import (
"fmt"
"os"
"flag"
"github.com/golang/glog"
"github.com/asobti/kube-monkey/config"
"github.com/asobti/kube-monkey/kubemonkey"
)
func glogUsage() {
fmt.Fprintf(os.Stderr, "usage: example -stderrthreshold=[INFO|WARN|FATAL] -log_dir=[string]\n", )
flag.PrintDefaults()
... | package main
import (
"fmt"
"os"
"flag"
"github.com/golang/glog"
"github.com/asobti/kube-monkey/config"
"github.com/asobti/kube-monkey/kubemonkey"
)
func glogUsage() {
fmt.Fprintf(os.Stderr, "usage: example -stderrthreshold=[INFO|WARN|FATAL] -log_dir=[string]\n", )
flag.PrintDefaults()
os.Exit(2)
}
func... | Enable file and stderr logging | Enable file and stderr logging
10 minute test on glog configs for logtostderr and alsologtostderr
Results of test --> if alsologtostderr is true, it wiill write to stderr
no matter if logtostderr is false and put before or after
alsologtostderr
temporary logs are stored at the /tmp directory and can be overriden
wit... | Go | apache-2.0 | asobti/kube-monkey |
517c75bbc0175398cfff84342040e63b54016b9f | plug.go | plug.go | package main
import "math/rand"
import "time"
const DEFAULT_AD_CHANCE = 85
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
}
func (p Plug) IsDefault() bool {
return p.ViewsRemaining >= 0
}
func ChoosePlug(plugs []Plug) Plug {
rand.Seed(time.Now().Unix())
... | package main
import "math/rand"
import "time"
const DEFAULT_AD_CHANCE = 95
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
}
func (p Plug) IsDefault() bool {
return p.ViewsRemaining >= 0
}
func ChoosePlug(plugs []Plug) Plug {
rand.Seed(time.Now().Unix())
... | Make Default Ads super rare | Make Default Ads super rare
| Go | mit | liam-middlebrook/csh-plug |
e46f89c1a6001f765ad1a04758111b0297d912db | secretcrypt/secretcrypt_test.go | secretcrypt/secretcrypt_test.go | package secretcrypt
import (
"bytes"
"testing"
)
func passthrough(plaintext string) {
crypted, err := Encrypt("testphrase", []byte(plaintext))
if err != nil {
panic(err)
}
plain, err := Decrypt("testphrase", crypted)
if err != nil {
panic(err)
}
if !bytes.Equal(plain, []byte(plain)) {
panic("expected... | package secretcrypt
import (
"bytes"
"testing"
"math/rand"
)
func passthrough(passphrase string, plaintext []byte) {
crypted, err := Encrypt(passphrase, plaintext)
if err != nil {
panic(err)
}
plainResult, err := Decrypt(passphrase, crypted)
if err != nil {
panic(err)
}
if !bytes.Equal(plainResult, pl... | Fix test bug, improve test edge case coverage. | Fix test bug, improve test edge case coverage.
The bug fixed is that we were comparing the wrong byte array in
`passthrough`, thus rendering the test partially ineffective (would
not detect incorrect output).
| Go | mit | scode/saltybox,scode/saltybox |
9049bcaceccfcbe02e5c4b79e1d661c60866c0d7 | ldb/boundary_test.go | ldb/boundary_test.go | // Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package ldb_test
import (
"github.com/conformal/btcdb"
"github.com/conformal/btcwire"
"os"
"testing"
)
// we need to test for empty databas and make certain it returns p... | // Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package ldb_test
import (
"github.com/conformal/btcdb"
"github.com/conformal/btcwire"
"os"
"testing"
)
// we need to test for empty databas and make certain it returns p... | Update error message for zero hash change. | Update error message for zero hash change.
| Go | isc | Dirbaio/btcd,CryptocurrencyCabal/htcd,pkothbauer/btcd,btcsuitereleases/btcd,ppcsuite/ppcd-old,jimmysong/btcd,BitGo/prova,jrick/btcd,ppcsuite/ppcd,qchain/btcd,davecgh/btcd,jcmincke/dcrd,stevenroose/btcd,ppcsuite/ppcd-old,tb00/btcd,CryptocurrencyCabal/htcd,soapboxsys/ombfullnode,mathiasrw/btcd,glv2/ppcd,jrick/btcd,jcminc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.