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
df87f92c7d38682f9712644f1b9e595b9b9716ce
src/wayang/wayang/data.go
src/wayang/wayang/data.go
package wayang type Endpoint map[string]map[string]interface{} type Mock map[string]Endpoint type DataStore interface { NewMock(Mock) (string, error) GetEndpoint(string, string) (Endpoint, error) UpdateEndpoint(string, Mock) error Close() }
package wayang type Endpoint map[string]interface{} type Mock map[string]Endpoint type DataStore interface { NewMock(Mock) (string, error) GetEndpoint(string, string) (Endpoint, error) UpdateEndpoint(string, Mock) error Close() }
Support array types for endpoints.
Support array types for endpoints.
Go
bsd-3-clause
rahulg/wayang,rahulg/wayang
fe67e8d8f00d64fb2de9728c157653d92aa8636a
sirius.go
sirius.go
package sirius import ( "golang.org/x/net/context" ) type Service struct { loader ExtensionLoader clients []Client } func NewService(l ExtensionLoader) *Service { return &Service{ loader: l, } } func (s *Service) Start(ctx context.Context, users []User) { for _, user := range users { cl := NewClient(&use...
package sirius import ( "golang.org/x/net/context" ) type Service struct { loader ExtensionLoader clients []Client } func NewService(l ExtensionLoader) *Service { return &Service{ loader: l, } } func (s *Service) Start(ctx context.Context, users []User) { for _, u := range users { u := u cl := NewClien...
Fix bug where user references would leak between clients
Fix bug where user references would leak between clients
Go
mit
kayex/sirius
fba60db1256236a7f0ca56d617ed20067c29f3e2
dev/ssl_darwin.go
dev/ssl_darwin.go
package dev import ( "fmt" "os/exec" "github.com/puma/puma-dev/homedir" ) const supportDir = "~/Library/Application Support/io.puma.dev" func TrustCert(cert string) error { fmt.Printf("* Adding certification to login keychain as trusted\n") fmt.Printf("! There is probably a dialog open that you must type your ...
package dev import ( "fmt" "os/exec" "github.com/puma/puma-dev/homedir" ) const supportDir = "~/Library/Application Support/io.puma.dev" func TrustCert(cert string) error { fmt.Printf("* Adding certification to login keychain as trusted\n") fmt.Printf("! There is probably a dialog open that requires you to aut...
Update message to be applicable for touch id
Update message to be applicable for touch id
Go
bsd-3-clause
puma/puma-dev,attilagyorffy/puma-dev,puma/puma-dev,attilagyorffy/puma-dev,puma/puma-dev,attilagyorffy/puma-dev,puma/puma-dev,attilagyorffy/puma-dev
ed062868d3e91d3fc81b63191c6076ba1b769209
cgoflags.go
cgoflags.go
package hdf5 // #cgo LDFLAGS: -lhdf5 -lhdf5_hl // #cgo darwin CFLAGS: -I/opt/local/include // #cgo darwin LDFLAGS: -L/opt/local/lib // #include "hdf5.h" import "C"
package hdf5 // #cgo LDFLAGS: -lhdf5 -lhdf5_hl // #cgo darwin CFLAGS: -I/usr/local/include // #cgo darwin LDFLAGS: -L/usr/local/lib // #include "hdf5.h" import "C"
Update library and include paths for homebrew on darwin.
Update library and include paths for homebrew on darwin.
Go
bsd-3-clause
sbinet/go-hdf5,disktnk/go-hdf5
e34d969e472285fe547462507456e86b4ebd3f6a
example/client.go
example/client.go
package main import ( "gearman" "log" ) func main() { client := gearman.NewClient() defer client.Close() client.AddServer("127.0.0.1:4730") echo := []byte("Hello\x00 world") if data, err := client.Echo(echo); err != nil { log.Println(string(data)) } handle, err := client....
package main import ( "gearman" "log" ) func main() { client := gearman.NewClient() defer client.Close() if err := client.AddServer("127.0.0.1:4730"); err != nil { log.Fatalln(err) } echo := []byte("Hello\x00 world") if data, err := client.Echo(echo); err != nil { log....
Fix bugs in example codes.
Fix bugs in example codes.
Go
mit
sgrimee/gearman-go,echa/gearman-go,sgrimee/gearman-go,tacahilo/gearman-go,echa/gearman-go,mikespook/gearman-go,mikespook/gearman-go,mikespook/gearman-go,tacahilo/gearman-go
aa085d7bac92a89504eba6e9502db571a612922e
disgoirc.go
disgoirc.go
package main import ( "encoding/json" "flag" "io/ioutil" log "github.com/Sirupsen/logrus" "github.com/GinjaNinja32/disgoirc/bot" ) func main() { debug := flag.Bool("debug", false, "Debug mode") confLocation := flag.String("config", "conf.json", "Config file location") flag.Parse() if *debug { log.SetLev...
package main import ( "encoding/json" "flag" "io/ioutil" log "github.com/Sirupsen/logrus" "github.com/GinjaNinja32/DisGoIRC/bot" ) func main() { debug := flag.Bool("debug", false, "Debug mode") confLocation := flag.String("config", "conf.json", "Config file location") flag.Parse() if *debug { log.SetLev...
Change import path to match GitHub URL
Change import path to match GitHub URL
Go
agpl-3.0
GinjaNinja32/DisGoIRC
1e910fcb0dc2e58bc3ab3d9e80f906ba881ab69a
slack/auth.go
slack/auth.go
package slack import ( "net/url" ) type AuthService struct { api *SlackClient } type Auth struct { UserId string `json:"user_id"` Username string `json:"user"` Team string `json:"team"` TeamId string `json:"team_id"` TeamUrl url.URL } func (s *AuthService) Test() (*Auth, error) { req, _ := s.api...
package slack type AuthService struct { api *SlackClient } type Auth struct { UserId string `json:"user_id"` Username string `json:"user"` Team string `json:"team"` TeamId string `json:"team_id"` TeamUrl string `json:"url"` } func (s *AuthService) Test() (*Auth, error) { req, _ := s.api.NewReques...
Change TeamURL to standard string, no need to parse for now.
Change TeamURL to standard string, no need to parse for now.
Go
mit
tappleby/slack_auth_proxy,tappleby/slack_auth_proxy
8a55ab207daeb27609a2f4de402fdfde787d87e1
web/api/routes.go
web/api/routes.go
package api import ( "github.com/labstack/echo" ) // RegisterAPIRoutes adds API routes to the Echo's route group func RegisterAPIRoutes(g *echo.Group) { // Store endpoints first since they are the most active //e.GET("/api/store/", storeGetView) //e.POST("/api/store/", storePostView) g = g.Group("/store") g.GET...
package api import ( "github.com/labstack/echo" ) // RegisterAPIRoutes adds API routes to the Echo's route group func RegisterAPIRoutes(g *echo.Group) { // Store endpoints first since they are the most active //e.GET("/api/store/", storeGetView) //e.POST("/api/store/", storePostView) // TODO Can not register sa...
Add workaround for store event route
Add workaround for store event route
Go
mit
diyan/assimilator,diyan/assimilator,diyan/assimilator
1fd216bbee4a0844d9aeac152f4d094f5048e194
io_sink.go
io_sink.go
package steno import ( "bufio" "os" ) type IO struct { writer *bufio.Writer codec Codec } func NewIOSink(file *os.File) *IO { writer := bufio.NewWriter(file) io := new(IO) io.writer = writer return io } func NewFileSink(path string) *IO { file, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY...
package steno import ( "bufio" "os" ) type IOSink struct { writer *bufio.Writer codec Codec } func NewIOSink(file *os.File) *IOSink { writer := bufio.NewWriter(file) ioSink := new(IOSink) ioSink.writer = writer return ioSink } func NewFileSink(path string) *IOSink { file, err := os.OpenFile(path, os.O_AP...
Rename struct IO to IOSink
Rename struct IO to IOSink Change-Id: Icbbc5215648f4f19cc834ca3234e3e1294fd3471
Go
apache-2.0
cloudfoundry/gosteno
149906099aa52b0363ab0d78ed6ff31b66a5f46f
integration/v7/isolated/config_test.go
integration/v7/isolated/config_test.go
package isolated import ( "code.cloudfoundry.org/cli/integration/helpers" "code.cloudfoundry.org/cli/util/configv3" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Config", func() { Describe("Version Management", func() { var oldTarget string var oldVersion int var oldSkipSSLValid...
package isolated import ( "code.cloudfoundry.org/cli/integration/helpers" "code.cloudfoundry.org/cli/util/configv3" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Config", func() { Describe("Version Management", func() { It("reset config to default if version mismatch", func() { h...
Fix config test for client credentials
Fix config test for client credentials - Use `cf plugins` to demonstrate that config is cleared. The LoginCF helper previously used would error if the API endpoint was not set - Remove restoration of old config values - each tests runs in its own home directory and so has a separate copy of the config [#170247645...
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
93c9d95a5a52429b3543ed9a05005292908cc41d
kami/db.go
kami/db.go
package main import ( "fmt" "github.com/jmoiron/sqlx" _ "github.com/lib/pq" ) const ( DBHOST string = "localhost" DATABASE string = "lms2_development" DBUSER string = "lms" DBPASS string = "" SSLMODE string = "disable" ) var DBUrl string = fmt.Sprintf( "postgres://%s:%s@%s/%s?sslmode=%s", DBUSER, D...
package main import ( "database/sql" "fmt" _ "github.com/lib/pq" ) const ( DBHOST string = "localhost" DATABASE string = "lms2_db_dev" DBUSER string = "lms2_db_user" DBPASS string = "lms_2014" SSLMODE string = "disable" ) var DBUrl string = fmt.Sprintf( "postgres://%s:%s@%s/%s?sslmode=%s", DBUSER, ...
Switch to builtin database/sql driver
Switch to builtin database/sql driver
Go
mit
konjoot/benches,konjoot/benches,konjoot/benches
b0ef20d4f8883925ae2bf38282395b3a21a81497
manager.go
manager.go
package main import ( "fmt" "github.com/deevatech/manager/runner" "github.com/gin-gonic/gin" "log" "net/http" "os" ) func init() { log.Println("Deeva Manager!") } func main() { router := gin.Default() router.POST("/run", handleRunRequest) port := os.Getenv("DEEVA_MANAGER_PORT") if len(port) == 0 { port...
package main import ( "fmt" "github.com/deevatech/manager/runner" "github.com/gin-gonic/gin" "log" "net/http" "os" ) func init() { log.Println("Deeva Manager!") } func main() { router := gin.Default() router.POST("/run", handleRunRequest) port := os.Getenv("DEEVA_MANAGER_PORT") if len(port) == 0 { port...
Use 8080 as the default port
Use 8080 as the default port
Go
mit
deevatech/manager
b4683f4a5b6829ab7d409516239ed8c5b0a367f5
go/protein-translation/protein_translation.go
go/protein-translation/protein_translation.go
package protein
package protein import "errors" // ErrStop represents a STOP codon var ErrStop error = errors.New("stop codon") // ErrInvalidBase represents an invalid base that cannot me mapped to an amino acid. var ErrInvalidBase error = errors.New("invalid base") func FromCodon(codon string) (protein string, e error) { return ...
Define necessary errors and functions
Define necessary errors and functions
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
47a844f540b4faa61ba811da1cb4f8d57ee5dcce
youtubedr/main.go
youtubedr/main.go
package main import ( "flag" "fmt" "log" "os/user" "path/filepath" . "github.com/kkdai/youtube" ) func main() { flag.Parse() log.Println(flag.Args()) usr, _ := user.Current() currentDir := fmt.Sprintf("%v/Movies/youtubedr", usr.HomeDir) log.Println("download to dir=", currentDir) y := NewYoutube(true) a...
package main import ( "flag" "fmt" "log" "os/user" "path/filepath" . "github.com/kkdai/youtube" ) func main() { flag.Parse() log.Println(flag.Args()) usr, _ := user.Current() currentDir := fmt.Sprintf("%v/Movies/youtubedr", usr.HomeDir) log.Println("download to dir=", currentDir) y := NewYoutube(true) a...
Fix cannot download video cause crash.
Fix cannot download video cause crash.
Go
mit
kkdai/youtube
0bcfe90be351f39af7f44b08408f3e6a6296e831
logger/logger.go
logger/logger.go
package logger import ( "bytes" "fmt" "github.com/mgutz/ansi" ) //Info output a green text line func Info(f string, args ...interface{}) { fmt.Printf(Colorize(f, "green")+"\n", args...) } //Warn output a red text line func Warn(f string, args ...interface{}) { fmt.Printf(Colorize(f, "red")+"\n", args...) } //C...
package logger import ( "bytes" "fmt" "github.com/mgutz/ansi" ) var ( debugize = ansi.ColorFunc("green+h:black") greenize = ansi.ColorFunc("green") redize = ansi.ColorFunc("red") ) //Debug output a debug text func Debug(f string, args ...interface{}) { fmt.Printf(debugize("[DEBUG] "+f)+"\n", args...) } //I...
Add Debug function in Logger module
[TASK] Add Debug function in Logger module This change add a new function Debug in the logger Module and use closure to avoid recalculating ANSI code compilation
Go
mit
dfeyer/flow-debugproxy
122b2b857fee1a363d619a4de9783f242991f53a
cmd/mangadownloader.go
cmd/mangadownloader.go
package main import ( "errors" "flag" "github.com/pierrre/mangadownloader" "net/url" "os" ) func main() { flag.Parse() out, err := os.Getwd() if err != nil { panic(err) } md := mangadownloader.CreateDefaultMangeDownloader() for _, arg := range flag.Args() { u, err := url.Parse(arg) if err != nil {...
package main import ( "errors" "flag" "github.com/pierrre/mangadownloader" "net/url" "os" "path/filepath" ) func main() { outFlag := flag.String("out", "", "Output directory") flag.Parse() out := *outFlag if !filepath.IsAbs(out) { currentDir, err := os.Getwd() if err != nil { panic(err) } out = ...
Add command flag "out" (output directory)
Add command flag "out" (output directory)
Go
mit
pierrre/mangadownloader
d180182e3ab2a2391788f4c7e2334ddaca62f0dd
pddltest/main.go
pddltest/main.go
package main import ( "fmt" "os" "io/ioutil" "pddl" ) const dump = false func main() { s, err := ioutil.ReadAll(os.Stdin) if err != nil { panic("Error reading standard input") } p := pddl.Parse(pddl.Lex("stdin", string(s))) d := p.ParseDomain() // d := p.ParseProblem() if (dump) { fmt.Printf("%+v\n", ...
package main import ( "fmt" "os" "io/ioutil" "goplan/pddl" ) const dump = false func main() { s, err := ioutil.ReadAll(os.Stdin) if err != nil { panic("Error reading standard input") } p := pddl.Parse(pddl.Lex("stdin", string(s))) d := p.ParseDomain() // d := p.ParseProblem() if (dump) { fmt.Printf("%...
Use the proper import path for goplan/pddl.
Use the proper import path for goplan/pddl.
Go
mit
eaburns/planit,eaburns/planit
e9eec059d3a3a6718a531f0a0082f9664ef6a603
src/tick/timers_test.go
src/tick/timers_test.go
package discord import ( "fmt" "sync" "testing" "time" ) func TestBasicTicker(t *testing.T) { // t.Skip("TickOnce not implemented") var counter = 1 var i = 0 mu := sync.Mutex{} f := func(to *Ticker) { fmt.Println("Iteration: " + string(i)) mu.Lock() defer mu.Unlock() if i >= 5 { to.Done() } ...
package discord import ( "fmt" "testing" "time" ) func TestBasicTicker(t *testing.T) { // t.Skip("TickOnce not implemented") var counter = 1 var i = 0 f := func(to *Ticker) { fmt.Printf("Iteration: %d\n", i) if i >= 5 { to.Done() } counter++ i++ } cleanUp := func(to *Ticker) { return } ...
Simplify test case. Tweak logging.
Simplify test case. Tweak logging.
Go
mit
therealfakemoot/alpha
67cc124fef5cf6ae3ce7d4a3efae76ac39dcb793
release.go
release.go
// +build release package main import "github.com/ninjasphere/go-ninja/bugs" // BugsKey key used for reporting bugs const BugsKey = "57be7f895461a18014b0b325daf4ea3e" func init() { bugs.Configure("release", BugsKey, Version) }
// +build release package main import "github.com/ninjasphere/go-ninja/bugs" // BugsKey key used for reporting bugs const BugsKey = "57be7f895461a18014b0b325daf4ea3e" func init() { bugs.Configure("release", BugsKey) }
Remove version for the moment.
Remove version for the moment.
Go
mit
ninjasphere/driver-go-lifx,ninjasphere/driver-go-lifx
48e55018c150d6a69f0c22fe7c50cadf8370c8bc
updater_test.go
updater_test.go
package main import ( "bytes" "github.com/mitchellh/packer/packer" "testing" ) // This is totally not isolated from the filesystem func TestUpdateJsonFileWithString(t *testing.T) { file := "/tmp/testpathstring.json" paths := []string{"testpathstring"} ui := &packer.BasicUi{ Reader: new(bytes.Buffer), W...
package main import ( "bytes" "testing" "github.com/mitchellh/packer/packer" "github.com/stretchr/testify/assert" ) func TestUpdateJSONFileShouldGiveErrorWhenFileDoesNotExist(t *testing.T) { file := "testdata/some_inexisting_file.json" paths := []string{"some.path.foo.bar"} ui := &packer.BasicUi{ Reader: ...
Update test to reflect multi-region revert.
Update test to reflect multi-region revert.
Go
bsd-3-clause
cliffano/packer-post-processor-json-updater
ab99ac551bd95e1c2c611e6af1f8a4d625497c42
cmd_current.go
cmd_current.go
package main var CmdCurrent = &Cmd{ Name: "current", Desc: "Reports whether direnv's view of a file is current (or stale)", Args: []string{"PATH"}, Private: true, Fn: currentCommandFn, } func currentCommandFn(env Env, args []string) (err error) { path := args[1] watches := NewFileTimes() watchSt...
package main import ( "errors" ) var CmdCurrent = &Cmd{ Name: "current", Desc: "Reports whether direnv's view of a file is current (or stale)", Args: []string{"PATH"}, Private: true, Fn: currentCommandFn, } func currentCommandFn(env Env, args []string) (err error) { if len(args) < 2 { err = er...
Handle `direnv current` with no argument
Handle `direnv current` with no argument Fixes #216
Go
mit
direnv/direnv,direnv/direnv
a906dc321b30096bfd4b3b489b2329c8e7d8a5d7
cmd/jid/jid.go
cmd/jid/jid.go
package main import ( "flag" "fmt" "os" "github.com/simeji/jid" ) func main() { content := os.Stdin var qm bool qs := "." flag.BoolVar(&qm, "q", false, "Output query mode") flag.Parse() args := flag.Args() if len(args) > 0 { qs = args[0] } e, err := jid.NewEngine(content, qs) if err != nil { f...
package main import ( "flag" "fmt" "os" "github.com/simeji/jid" ) const VERSION = "0.6.2" func main() { content := os.Stdin var qm bool var version bool qs := "." flag.BoolVar(&qm, "q", false, "Output query mode") flag.BoolVar(&version, "version", false, "print the version and exit") flag.Parse() if ...
Add --version flag for homebrew test
Add --version flag for homebrew test
Go
mit
simeji/jid
ac6348e807764d8e2a0ad903addad8f62da7167e
crossdomain.go
crossdomain.go
package crossdomain import ( "fmt" "net/http" ) // make a struct for our http handler type CDHandler struct {} // use to build the xml type crossdomain struct { } func (*c CDHandler) serveHTTP(w http.ResponseWriter, r *http.Request) { // serve the relevant crossdomain.xml stuff here // simple to begin ...
package crossdomain import ( "fmt" "net/http" ) // make a struct for our http handler type CDHandler struct {} // use to build the xml type crossdomain struct { } func (*c CDHandler) serveHTTP(w http.ResponseWriter, r *http.Request) { // serve the relevant crossdomain.xml stuff here // simple to begin ...
Write to the correct writer
Write to the correct writer
Go
mit
matzhouse/go-crossdomain
9d1f233729426e7fca0c8cc5eefedac1b57a7e5f
pkg/issuer/acme/dns/acmedns/acmedns_test.go
pkg/issuer/acme/dns/acmedns/acmedns_test.go
package acmedns import ( "github.com/stretchr/testify/assert" "os" "testing" ) var ( acmednsLiveTest bool acmednsHost string acmednsAccountsJson []byte acmednsDomain string ) func init() { acmednsHost = os.Getenv("") acmednsAccountsJson = []byte(os.Getenv("AZURE_CLIENT_SECRET")) if len(ac...
package acmedns import ( "github.com/stretchr/testify/assert" "os" "testing" ) var ( acmednsLiveTest bool acmednsHost string acmednsAccountsJson []byte acmednsDomain string ) func init() { acmednsHost = os.Getenv("ACME_DNS_HOST") acmednsAccountsJson = []byte(os.Getenv("ACME_DNS_ACCOUNT_JSO...
Fix env variable names in unit test
Fix env variable names in unit test Signed-off-by: Max Ehrlich <c7cd0513ef0c504f678ca33c2b168f4f84cd4d51@gmail.com>
Go
apache-2.0
jetstack-experimental/cert-manager,jetstack/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager,cert-manager/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager,jetstack/cert-manager,jetstack/cert-manager
87e1b9163bd1ee3e7d5dfd79af59ff818e0b7849
appengine/controller/cron.go
appengine/controller/cron.go
package controller import ( "net/http" "time" "github.com/utahta/momoclo-channel/appengine/lib/crawler" "github.com/utahta/momoclo-channel/appengine/lib/reminder" "github.com/utahta/momoclo-channel/appengine/lib/ustream" "golang.org/x/net/context" ) // Notify reminder func CronReminder(w http.ResponseWriter, r...
package controller import ( "net/http" "time" "github.com/utahta/momoclo-channel/appengine/lib/crawler" "github.com/utahta/momoclo-channel/appengine/lib/reminder" "github.com/utahta/momoclo-channel/appengine/lib/ustream" "golang.org/x/net/context" ) // Notify reminder func CronReminder(w http.ResponseWriter, r...
Change timeout 55s to 30s
Change timeout 55s to 30s
Go
mit
utahta/momoclo-channel,utahta/momoclo-channel
37667238171d53e2f769de9c30930cb47dfbfacc
api/oidc.go
api/oidc.go
package api import ( "encoding/json" "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcTokenRequest struct { Audience string `json:"audience"` } type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId strin...
package api import ( "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcTokenRequest struct { Audience string `json:"audience"` } type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId string, audience ...st...
Fix http client does not require explict unmarshal
Fix http client does not require explict unmarshal
Go
mit
buildkite/agent,buildkite/agent,buildkite/agent
658aa8a4e5b5447cf74d600ee4ac62c20f0eabbc
cmd/edit.go
cmd/edit.go
package cmd import ( "fmt" "os" "github.com/spf13/cobra" "github.com/tsub/s3-edit/cli" "github.com/tsub/s3-edit/cli/s3" ) var editCmd = &cobra.Command{ Use: "edit [S3 file path]", Short: "Edit directly a file on S3", Long: "Edit directly a file on S3", Run: func(cmd *cobra.Command, args []string) { if l...
package cmd import ( "github.com/spf13/cobra" "github.com/tsub/s3-edit/cli" "github.com/tsub/s3-edit/cli/s3" ) var editCmd = &cobra.Command{ Use: "edit [S3 file path]", Short: "Edit directly a file on S3", Long: "Edit directly a file on S3", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []str...
Refactor validate arguments using cobra.ExactArgs
Refactor validate arguments using cobra.ExactArgs
Go
mit
tsub/s3-edit
04b711be5ba380f0b0264f469d196d7f307a2a01
negotiate/negotiate.go
negotiate/negotiate.go
package negotiate import ( "github.com/K-Phoen/negotiation" "net/http" ) type formatNegotiator struct { acceptedFormats []string } func FormatNegotiator(acceptedFormats []string) *formatNegotiator { return &formatNegotiator{ acceptedFormats: acceptedFormats, } } func (negotiator *formatNegotiator) ServeHTTP(...
package negotiate import ( "github.com/K-Phoen/negotiation" "net/http" ) type formatNegotiator struct { acceptedFormats []string } func RegisterFormat(format string, mimeTypes []string) { negotiation.RegisterFormat(format, mimeTypes) } func FormatNegotiator(acceptedFormats []string) *formatNegotiator { return ...
Add a method allowing to register custom formats
Add a method allowing to register custom formats
Go
mit
K-Phoen/http-negotiate
0dafb1c8b57e792e10345161d2e332874f9fde3b
cmd/client/main.go
cmd/client/main.go
package main import ( "github.com/itsankoff/gotcha/client" "log" ) func main() { ws := client.NewWebSocketClient() c := client.New(ws) err := c.Connect("ws://127.0.0.1:9000/websocket") log.Println("connected", err) userId, err := c.Register("pesho", "123") log.Println("registered", err) err = c.Authenticate...
package main import ( "flag" "github.com/itsankoff/gotcha/client" "log" ) func main() { var host string flag.StringVar(&host, "host", "ws://0.0.0.0:9000/websocket", "remote server host") flag.Parse() ws := client.NewWebSocketClient() c := client.New(ws) err := c.Connect(host) log.Println("connected", er...
Add cmd arguments for client cmd tool
Add cmd arguments for client cmd tool
Go
mit
itsankoff/gotcha,itsankoff/gotcha
87c05540e252720ef8375b09c098a585b96dcb57
aroc.go
aroc.go
package main import ( "fmt" "github.com/howeyc/fsnotify" "log" "os" "os/exec" ) func main() { if len(os.Args) < 3 { fmt.Fprintln(os.Stderr, "Usage: aroc DIRECTORY COMMAND [ARGS…]") os.Exit(1) } watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() err = watch...
package main import ( "fmt" "github.com/sdegutis/go.fsevents" "log" "os" "os/exec" ) func main() { if len(os.Args) < 3 { fmt.Fprintln(os.Stderr, "Usage: aroc DIRECTORY COMMAND [ARGS…]") os.Exit(1) } ch := fsevents.WatchPaths([]string{os.Args[1]}) var cmd *exec.Cmd go func() { for _ = range ch { ...
Switch from fsnotify to fsevents
Switch from fsnotify to fsevents
Go
mit
mxey/aroc
de8d72cecf8d300fece134709b45923f8d8d4fef
pkg/apis/pipeline/v1beta1/cluster_task_validation.go
pkg/apis/pipeline/v1beta1/cluster_task_validation.go
/* Copyright 2020 The Tekton Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
/* Copyright 2020 The Tekton Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
Enhance v1beta1 validation code for clustertask 🍸
Enhance v1beta1 validation code for clustertask 🍸 This make a better use of knative.dev/pkg apis errors package in order to make the code simpler, *and* the report better. - This allows reporting multiple validation error at once — so, one failure message (webhook error) would be more useful to the user. - This re...
Go
apache-2.0
tektoncd/pipeline,tektoncd/pipeline
f6e5c2c2d521b6f36c7e14e05c2c343ad9c37172
resultfield.go
resultfield.go
package testrail // ResultField represents a ResultField type ResultField struct { Configs []ResultFieldConfig `json:"configs"` Description string `json:"description"` DisplayOrder int `json:"display_order"` ID int `json:"ID"` Label string ...
package testrail // ResultField represents a ResultField type ResultField struct { Configs []ResultFieldConfig `json:"configs"` Description string `json:"description"` DisplayOrder int `json:"display_order"` ID int `json:"ID"` Label string ...
Add missing undocumented is_active field
Add missing undocumented is_active field This fields allows us to skip inactive custom fields.
Go
mit
Etienne42/testrail
cb82e4bba6b3e526ffdd7cf607474ce3ea9ab953
go/010_test.go
go/010_test.go
package main import ( "math/big" "testing" ) func sumOfPrimesBelow(x int64) int64 { var i int64 var sum int64 = 0 for i = 2; i < x; i++ { if i > 2 && i%2 == 0 { continue } j := big.NewInt(i) if !j.ProbablyPrime(10) { continue } sum += i } return sum } func TestSumOfPrimesBelow2M(t *testi...
package main import ( "testing" ) func sumOfPrimesBelow(x int) int { sieve := make([]bool, x) for i:=0; i<x; i++ { sieve[i] = true } sieve[0] = false sieve[1] = false for i:=2; i<x; i++ { if sieve[i] == false { continue } for j:=2*i; j<x; j+=i { sieve[j] = false } } sum := 0 for i:=2; i...
Use a sieve for Prob 10
Use a sieve for Prob 10
Go
bsd-2-clause
jmalonzo/project-euler-solutions,jmalonzo/project-euler-solutions
4d2338cbdcf6b51ef83c1ea8037b5a956cd80ea8
dish.go
dish.go
package chalmers_chop type Allergen int const ( Gluten Allergen = iota Egg Milk ) type Dish struct { Name string Contents string Price int Allergens []Allergen } func NewDish(name, contents string) *Dish { return &Dish{ Name: name, Contents: contents, } }
package chalmers_chop type Allergen int const ( Gluten Allergen = iota Egg Lactose ) type Dish struct { Name string Contents string Price int Allergens []Allergen } func NewDish(name, contents string) *Dish { return &Dish{ Name: name, Contents: contents, } }
Correct “Milk” allergen to “Lactose”
Correct “Milk” allergen to “Lactose”
Go
mit
kayex/chalmers-chop
d00ba6eacdab6fa18dabf91fa7ca8883dd9177e4
client_factory.go
client_factory.go
package web import ( "net/http" "github.com/concourse/go-concourse/concourse" ) type ClientFactory interface { Build(request *http.Request) concourse.Client } type clientFactory struct { apiEndpoint string } func NewClientFactory(apiEndpoint string) ClientFactory { return &clientFactory{ apiEndpoint: apiEnd...
package web import ( "crypto/tls" "net/http" "github.com/concourse/go-concourse/concourse" ) type ClientFactory interface { Build(request *http.Request) concourse.Client } type clientFactory struct { apiEndpoint string allowSelfSignedCertificates bool } func NewClientFactory(apiEndpoint strin...
Use external_url when TLS enabled or IP address otherwise - Allow self-signed certificates only when in development mode
Use external_url when TLS enabled or IP address otherwise - Allow self-signed certificates only when in development mode [#119388165] Signed-off-by: Jacob Frank <e2b78b2ae98d5304f4676b7cd3c5892a0e3e7c9f@pivotal.io>
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
3cfa9839ae5c07a739f35840cac3d81f7cc6d1c2
oracle_test.go
oracle_test.go
// +build oracle package testfixtures import ( _ "gopkg.in/rana/ora.v3" ) func init() { databases = append(databases, databaseTest{ "ora", "ORACLE_CONN_STRING", "testdata/schema/oracle.sql", &OracleHelper{}, }, ) }
// +build oracle package testfixtures import ( _ "github.com/mattn/go-oci8" ) func init() { databases = append(databases, databaseTest{ "oci8", "ORACLE_CONN_STRING", "testdata/schema/oracle.sql", &OracleHelper{}, }, ) }
Change Oracle driver (use github.com/mattn/go-oci8)
Change Oracle driver (use github.com/mattn/go-oci8)
Go
mit
go-testfixtures/testfixtures,go-testfixtures/testfixtures
80d1dba8f1ca95e9c8cc7b11b55d58c4442cbe50
notmobile.go
notmobile.go
// Copyright 2015 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. // +build linux,!android darwin,!arm,!arm64 package sensor import ( "errors" "time" ) type manager struct { } func (m *manager) initialize() { } func (m ...
// Copyright 2015 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. // +build linux,!android darwin,!arm,!arm64 package sensor import ( "errors" "time" ) type manager struct{} func (m *manager) initialize() {} func (m *ma...
Fix the broken build for non-darwin and non-android.
Fix the broken build for non-darwin and non-android.
Go
bsd-3-clause
rakyll/sensors,rakyll/sensors
bdd73de656fa67d3c58e182cfa9209697b3d7358
lib/version.go
lib/version.go
package lib const ( Version = "2.2.1" )
package lib const ( // Version is the version number the client believes it is Version = "2.2.1" )
Put the Version comment back
Put the Version comment back
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
23ac6dad5762288d36f5379a20adfbcd6f0f8628
main.go
main.go
package main import ( "database/sql" "log" _ "github.com/mattn/go-sqlite3" ) var createUsers = ` CREATE TABLE users ( id INTEGER PRIMARY KEY, name VARCHAR ); ` var insertUser = `INSERT INTO users (id, name) VALUES (?, ?)` var selectUser = `SELECT id, name FROM users` func main() { db,...
package main import ( "database/sql" "log" _ "github.com/mattn/go-sqlite3" ) var createUsers = ` CREATE TABLE users ( id INTEGER, name VARCHAR ); ` var insertUser = `INSERT INTO users (id, name) VALUES (?, ?)` var selectUser = `SELECT id, name FROM users` type User struct { ID int64 Name sql.NullSt...
INSERT a NULL value and SELECT it back out
INSERT a NULL value and SELECT it back out
Go
mit
aodin/gophersql
872b8636fe5a1aa5eb38505249edc9fd13dcb70c
test_buffer.go
test_buffer.go
package main import ( "testing" ) func TestPacketAdd(t *testing.T) { pq := PacketQueue{} if pq.Length() != 0 { t.Errorf("Length should be 0 but was %d", pq.Length()) } i, err := pq.Add([]byte{1,2,3,4,5}) if err != nil { t.Error(err) } if i != 0 { t.Errorf("S...
package main import ( "testing" ) func TestPacketAdd(t *testing.T) { pq := PacketQueue{} if pq.Length() != 0 { t.Errorf("Length should be 0 but was %d", pq.Length()) } i, err := pq.Add([]byte{1,2,3,4,5}) if err != nil { t.Error(err) } if i != 0 { t.Errorf("S...
Add some more queue tests
Add some more queue tests
Go
agpl-3.0
erjiang/tuntuntun,erjiang/tuntuntun,erjiang/tuntuntun,erjiang/tuntuntun
962fe944f7c50862003969b11e4f1ceb2693b9a8
4_2.go
4_2.go
package h2spec import ( "github.com/bradfitz/http2" "github.com/bradfitz/http2/hpack" ) func FrameSizeTestGroup() *TestGroup { tg := NewTestGroup("4.2", "Frame Size") tg.AddTestCase(NewTestCase( "Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE", "The endpoint MUST send a FRAME_SIZE_ERROR erro...
package h2spec import ( "github.com/bradfitz/http2" "github.com/bradfitz/http2/hpack" ) func FrameSizeTestGroup() *TestGroup { tg := NewTestGroup("4.2", "Frame Size") tg.AddTestCase(NewTestCase( "Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE", "The endpoint MUST send a FRAME_SIZE_ERROR erro...
Test 4.2: use the max frame size from the server's SETTINGS frame
Test 4.2: use the max frame size from the server's SETTINGS frame The test now does a settings handshake and uses the server's settings to determine the max frame size (then sends a frame 1 byte longer). Previously the test used the value of the default setting.
Go
mit
shane-kearns/h2spec,summerwind/h2spec,rmoorman/h2spec
59cfecf0d07178fdc13a17f04f35364be18dfa18
main.go
main.go
/* * Mini Object Storage, (C) 2014,2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicab...
/* * Mini Object Storage, (C) 2014,2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicab...
Remove redundant app.Name, internally codegangsta uses os.Args[0]
Remove redundant app.Name, internally codegangsta uses os.Args[0]
Go
agpl-3.0
minio/mc,abperiasamy/mc,fkautz/mc,krishnasrinivas/mc,fkautz/mc,akiradeveloper/mc,balamurugana/mc,akiradeveloper/mc,krisis/mc,minio/mc,balamurugana/mc,krishnasrinivas/mc,harshavardhana/mc,krisis/mc,abperiasamy/mc,winchram/mc,CarterMcClellan/mc,harshavardhana/mc,winchram/mc,vadmeste/mc,vadmeste/mc,CarterMcClellan/mc
9ad5f43d6d799b962395da9d535781e9063ed999
main.go
main.go
package main import ( "flag" "fmt" "net/http" ) var config struct { path string address string port int } func main() { flag.StringVar(&config.path, "path", "", "Optional path to serve static files from.") flag.StringVar(&config.address, "address", "127.0.0.1", "Address to listen on.") flag.IntVar(&co...
package main import ( "flag" "fmt" "log" "net/http" ) var config struct { path string address string port int } func main() { flag.StringVar(&config.path, "path", "", "Optional path to serve static files from.") flag.StringVar(&config.address, "address", "127.0.0.1", "Address to listen on.") flag.Int...
Add error reporting when web server fails
Add error reporting when web server fails
Go
mit
rehearse/rehearse
3888ce0ae1cde44c773bee68706fb9b1ec32ffe6
main.go
main.go
package main import ( "bufio" "fmt" "os" "github.com/go-distributed/gog/agent" "github.com/go-distributed/gog/config" ) func main() { config, err := config.ParseConfig() if err != nil { fmt.Println("Failed to parse configuration", err) return } ag := agent.NewAgent(config) ag.RegisterMessageHandler(msg...
package main import ( "bufio" "fmt" "os" "github.com/go-distributed/gog/agent" "github.com/go-distributed/gog/config" ) func main() { config, err := config.ParseConfig() if err != nil { fmt.Println("Failed to parse configuration", err) return } ag := agent.NewAgent(config) ag.RegisterMessageHandler(msg...
Remove ShufflePeers() to avoid partion in setup.
Remove ShufflePeers() to avoid partion in setup.
Go
apache-2.0
go-distributed/gog,go-distributed/gog,go-distributed/gog
be9d15b565a7223a0391ebb074f092cfaceabb95
upup/pkg/fi/cloudup/phase.go
upup/pkg/fi/cloudup/phase.go
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Fix code comment on PhaseSecurity
Fix code comment on PhaseSecurity
Go
apache-2.0
robinpercy/kops,tsupertramp/kops,mad01/kops,blakebarnett/kops,blakebarnett/kops,robinpercy/kops,gambol99/kops,chrislovecnm/kops,andrewsykim/kops,justinsb/kops,andrewsykim/kops,kubernetes/kops,blakebarnett/kops,mad01/kops,mad01/kops,mad01/kops,tsupertramp/kops,andrewsykim/kops,kubernetes/kops,chrislovecnm/kops,gambol99/...
230c157f4c645efbf9ae64ec5c83ac1242b5d2fa
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, "GGACTGA", "GGACTGA", "no difference between identical strands"}, {3, "ACT", "GGA", "complete hamming distance in small strand"}, {9, "GGACGGATTCTG", "AGGACGGATTCT", "dist...
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"}, {...
Update hamming tests in Go
Update hamming tests in Go
Go
mit
pminten/xgo,leenipper/xgo,robphoenix/exercism-go,pminten/xgo,exercism/xgo,exercism/xgo,leenipper/xgo,robphoenix/exercism-go
c78acaddfc9bb52d20a38dcddc961ea3d95a6e3f
pygments.go
pygments.go
// Pygments wrapper for golang. Pygments is a syntax highlighter package pygments import ( "bytes" "fmt" "os" "os/exec" "strings" ) var ( bin = "pygmentize" ) func Binary(path string) { bin = path } func Which() string { return bin } func Highlight(code string, lexer string, format string, enc string) str...
// Pygments wrapper for golang. Pygments is a syntax highlighter package pygments import ( "bytes" "fmt" "os" "os/exec" "strings" ) var ( bin = "pygmentize" ) func Binary(path string) { bin = path } func Which() string { return bin } func Highlight(code string, lexer string, format string, enc string) str...
Make lexer argument optional and guess content if not provided
Make lexer argument optional and guess content if not provided
Go
mit
christoffer/pygments
80e8535442d75b511741e5f09badf52e9c5ca3b4
examples/hellomessage/hello_message.go
examples/hellomessage/hello_message.go
package hellomessage // import "myitcv.io/react/examples/hellomessage" import ( r "myitcv.io/react" ) //go:generate reactGen // HelloMessageDef is the definition of the HelloMessage component type HelloMessageDef struct { r.ComponentDef } // HelloMessageProps is the props type for the HelloMessage component type ...
package hellomessage // import "myitcv.io/react/examples/hellomessage" import ( r "myitcv.io/react" ) //go:generate reactGen // HelloMessageDef is the definition of the HelloMessage component type HelloMessageDef struct { r.ComponentDef } // HelloMessageProps is the props type for the HelloMessage component type ...
Remove old code from hello message example
Remove old code from hello message example
Go
bsd-3-clause
myitcv/react,myitcv/react,myitcv/react,myitcv/react
67290925446492809e647e82a28aeccdf4416fe1
riff-cli/pkg/initializers/utils/resolve_opts.go
riff-cli/pkg/initializers/utils/resolve_opts.go
/* * Copyright 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
/* * Copyright 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
Switch python to grpc protocol
Switch python to grpc protocol
Go
apache-2.0
markfisher/sk8s,markfisher/sk8s,markfisher/sk8s,markfisher/sk8s
2ca82a147a28f7378183564f4578b8623497dd2c
user_create.go
user_create.go
package zoom // Use this file for /user endpoints // CreateUserPath - v2 path for creating a user const CreateUserPath = "/users" type CreateUserInfo struct { Email string `json:"email"` Type UserType `json:"type"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omi...
package zoom // Use this file for /user endpoints // CreateUserPath - v2 path for creating a user const CreateUserPath = "/users" // CreateUserInfo are details about a user to create type CreateUserInfo struct { Email string `json:"email"` Type UserType `json:"type"` FirstName string `json:"first_name...
Add a comment to CreateUserInfo
Add a comment to CreateUserInfo
Go
mit
himalayan-institute/zoom-lib-golang,himalayan-institute/zoom-lib-golang
f83d8fabb55f4258b36ed2a698f18ec1b140f7fa
Go/SlackMessage/main.go
Go/SlackMessage/main.go
package main import ( "fmt" "os" "strings" "github.com/nlopes/slack" ) func main() { api := slack.New("SLACK-TOKEN") slackMessage := "[Atlassian Server] " if len(os.Args) > 1 { slackMessage += strings.Join(os.Args[1:], " ") } else { slackMessage += " Empty Message" } channelID, timestamp, err := api....
package main import ( "fmt" "os" "strings" "github.com/nlopes/slack" ) func main() { api := slack.New("SLACK-TOKEN") slackMessage := "[Atlassian Server] " if len(os.Args) > 1 { slackMessage += strings.Join(os.Args[1:], " ") } else { slackMessage += " Empty Message" } channelID, timestamp, err := api....
Add new line to end of message
Add new line to end of message
Go
apache-2.0
luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs,luyaotsung/CompanyWorkJobs
7fc1e76e7e5e7b6e6f0ebf4753e5efacb59a6d69
builder/softlayer/artifact.go
builder/softlayer/artifact.go
package softlayer import ( "fmt" "log" ) // Artifact represents a Softlayer image as the result of a Packer build. type Artifact struct { imageName string imageId string datacenterName string client *SoftlayerClient } // BuilderId returns the builder Id. func (*Artifact) BuilderId() string ...
package softlayer import ( "fmt" "log" ) // Artifact represents a Softlayer image as the result of a Packer build. type Artifact struct { imageName string imageId string datacenterName string client *SoftlayerClient } // BuilderId returns the builder Id. func (*Artifact) BuilderId() string ...
Add State to Artifact struct to support the new packer api (v0.7.2)
Add State to Artifact struct to support the new packer api (v0.7.2)
Go
mit
koding/packer-builder-softlayer,kgrvamsi/packer-builder-softlayer,leonidlm/packer-builder-softlayer
f0721fff43a1e1cbaf9002b185c787c7e7800a79
resctrl/manager.go
resctrl/manager.go
// +build linux // Copyright 2020 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
// +build linux // Copyright 2020 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
Add checking if resctrl path exists
Add checking if resctrl path exists Signed-off-by: Katarzyna Kujawa <6d81612c80214d850c10c80be3c4dcdb2935414e@intel.com>
Go
apache-2.0
linux-on-ibm-z/cadvisor,linux-on-ibm-z/cadvisor,linux-on-ibm-z/cadvisor
b19a8d49ee591e75be0a1bff44505ecfe3344408
rethink/rethink.go
rethink/rethink.go
package rethink import ( r "github.com/dancannon/gorethink" ) type DB struct { Session *r.Session } func NewDB(session *r.Session) *DB { return &DB{ Session: session, } } func (db *DB) Get(table, id string) (map[string]interface{}, error) { result, err := r.Table(table).Get(id).RunRow(db.Session) if err != ...
package rethink import ( r "github.com/dancannon/gorethink" "fmt" ) type DB struct { Session *r.Session } func NewDB(session *r.Session) *DB { return &DB{ Session: session, } } var emptyMap map[string]interface{} func (db *DB) Get(table, id string) (map[string]interface{}, error) { result, err := r.Table(t...
Return error if we don't find a key.
Return error if we don't find a key.
Go
mit
materials-commons/gohandy,materials-commons/gohandy
820c4bf43f3328987730607aff8c2ef8107d3d56
handler/render.go
handler/render.go
package handler import ( "net/http" "time" "github.com/yuuki/dynamond/log" "github.com/yuuki/dynamond/timeparser" ) const ( DAYTIME = time.Duration(24 * 60 * 60) * time.Second ) func Render(w http.ResponseWriter, r *http.Request) { until := time.Now() from := until.Add(-DAYTIME) if v := r.FormValue("from")...
package handler import ( "net/http" "net/url" "time" "github.com/yuuki/dynamond/log" "github.com/yuuki/dynamond/timeparser" ) const ( DAYTIME = time.Duration(24 * 60 * 60) * time.Second ) func Render(w http.ResponseWriter, r *http.Request) { until := time.Now() from := until.Add(-DAYTIME) if v := r.FormVa...
Fix to parse 'now+1y' becase FormValue has already unescaped
Fix to parse 'now+1y' becase FormValue has already unescaped
Go
apache-2.0
yuuki/diamondb,yuuki/diamondb
7318a8bfe605d031f8b814e41e2bc1ed1c67b412
openflow/of10/message.go
openflow/of10/message.go
package of10 import . "github.com/oshothebig/goflow/openflow" type FeaturesRequest struct { Header } type FeaturesReply struct { Header DatapathId DatapathId Buffers uint32 Tables uint8 pad [3]uint8 Capabilities Capability Actions ActionType Ports []PhysicalPort } type Dat...
package of10 import . "github.com/oshothebig/goflow/openflow" type FeaturesRequest struct { Header } type FeaturesReply struct { Header DatapathId DatapathId Buffers uint32 Tables uint8 pad [3]uint8 Capabilities Capability Actions ActionType Ports []PhysicalPort } type Dat...
Declare constant related to capability
Declare constant related to capability
Go
mit
oshothebig/goflow
f2a753d1df1c3b2188acde5fbfad5ed41a3865c6
main.go
main.go
package main import ( _ "expvar" "github.com/codegangsta/negroni" "github.com/meatballhat/negroni-logrus" "github.com/unrolled/render" "net/http" ) func main() { Run() } func Run() { m := http.DefaultServeMux n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets"))) l := negronilogrus.N...
package main import ( _ "expvar" "github.com/codegangsta/negroni" "github.com/meatballhat/negroni-logrus" "github.com/unrolled/render" "net/http" "os" ) func main() { Run() } func Run() { m := http.DefaultServeMux n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets"))) l := negronilo...
Allow port to be specified by environment variable
Allow port to be specified by environment variable
Go
mit
mattbostock/leavediary
1ae1f5f0d55f5c75f6b3fb71db284d33359a8e5f
web.go
web.go
package main import ( "path" "gnd.la/app" "gnd.la/apps/docs" "gnd.la/net/urlutil" ) const ( //gondolaURL = "http://www.gondolaweb.com" gondolaURL = "ssh://abra.rm-fr.net/home/fiam/git/gondola.git" ) func gndlaHandler(ctx *app.Context) { if ctx.FormValue("go-get") == "1" { ctx.MustExecute("goget.html", nil)...
package main import ( "path" "gnd.la/app" "gnd.la/apps/docs" "gnd.la/net/urlutil" ) const ( gondolaURL = "http://www.gondolaweb.com" ) func gndlaHandler(ctx *app.Context) { if ctx.FormValue("go-get") == "1" { ctx.MustExecute("goget.html", nil) return } // Check if the request path is a pkg name var p s...
Update path to Gondola repository
Update path to Gondola repository
Go
apache-2.0
rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb
db1755682e45ea70489a382139721b19c25f6274
resources/ec2/internet_gateway.go
resources/ec2/internet_gateway.go
package ec2 import ( "github.com/jagregory/cfval/resources/common" . "github.com/jagregory/cfval/schema" ) // see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html func InternetGateway() Resource { return Resource{ AwsType: "AWS::EC2::InternetGateway", // Na...
package ec2 import ( "github.com/jagregory/cfval/resources/common" . "github.com/jagregory/cfval/schema" ) // see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html func InternetGateway() Resource { return Resource{ AwsType: "AWS::EC2::InternetGateway", // Na...
Change Ref value of Internet Gateway to an ID despite what the docs say
Change Ref value of Internet Gateway to an ID despite what the docs say
Go
mit
jagregory/cfval,jagregory/cfval
4df1ae519f47f36b93e710abb8a9b468670bcf44
graph.go
graph.go
// gogl provides a framework for representing and working with graphs. package gogl type Vertex interface{} type Graph interface { EachVertex(f func(vertex Vertex)) EachEdge(f func(source Vertex, target Vertex)) EachAdjacent(vertex Vertex, f func(adjacent Vertex)) HasVertex(vertex Vertex) bool GetSubgraph([]Vert...
// gogl provides a framework for representing and working with graphs. package gogl // Constants defining graph capabilities and behaviors. const ( E_DIRECTED, EM_DIRECTED = 1 << iota, 1 << iota - 1 E_UNDIRECTED, EM_UNDIRECTED E_WEIGHTED, EM_WEIGHTED E_TYPED, EM_TYPED E_SIGNED, EM_SIGNED E_LOOPS, EM_LOOPS ...
Introduce bitfield describing edge capabilities.
Introduce bitfield describing edge capabilities.
Go
mit
sdboyer/gogl,sdboyer/gogl
bc687b17b99abc42f2e1812efd06c153a905550a
event.go
event.go
package jo // Events signal changes in scanning state. type Event int const ( // Nothing of interest, continue scanning. None Event = 0 // Same as None, but specifically for whitespace. Space = (1 << iota) // Start events. ObjectStart = (1 << iota) KeyStart ArrayStart StringStart NumberStart BoolStart N...
package jo // Events signal changes in scanning state. type Event int const ( // Nothing of interest, continue scanning. None Event = 0 // Same as None, but specifically for whitespace. Space = (1 << iota) // Start events. ObjectStart = (1 << iota) KeyStart ArrayStart StringStart NumberStart BoolStart N...
Add the Start and End bitsets
Add the Start and End bitsets
Go
isc
erkl-old/jo
6bcc2da3cdadf167849c94a5d56483471458ee3e
stats_bsd.go
stats_bsd.go
// +build freebsd darwin package main func (m *memData) Update() error { return nil } func getifnum() (int, error) { return 0, nil } func (nd *netData) Setup() error { return nil } func (nd *netData) Update() error { return nil }
// +build freebsd darwin package main import ( "github.com/blabber/go-freebsd-sysctl/sysctl" ) var pagesize int64 var pae bool func init() { var err error pagesize, err = sysctl.GetInt64("hw.pagesize") if err != nil { panic(err) } _, err = sysctl.GetString("kern.features.pae") if err.Error() == "no such f...
Correct memory usage status on FreeBSD
Correct memory usage status on FreeBSD Valid sysctl fields are taken from atop
Go
mit
NHOrus/tgotop
b9af80d16ddd4b5bcabf6805bd0063b5694de66d
main.go
main.go
package main import ( "flag" "os" "github.com/ian-kent/Go-MailHog/MailHog-Server/config" "github.com/ian-kent/Go-MailHog/MailHog-UI/assets" "github.com/ian-kent/Go-MailHog/MailHog-UI/http/web" "github.com/ian-kent/Go-MailHog/http" "github.com/ian-kent/go-log/log" gotcha "github.com/ian-kent/gotcha/app" ) var...
package main import ( "flag" "os" "github.com/ian-kent/Go-MailHog/MailHog-Server/config" "github.com/ian-kent/Go-MailHog/MailHog-UI/assets" "github.com/ian-kent/Go-MailHog/MailHog-UI/web" "github.com/ian-kent/Go-MailHog/http" "github.com/ian-kent/go-log/log" gotcha "github.com/ian-kent/gotcha/app" ) var conf...
Remove old tests, fix import
Remove old tests, fix import
Go
mit
thejameskyle/MailHog-UI,jjz/MailHog-UI,mailhog/MailHog-UI,mailhog/MailHog-UI,mailhog/MailHog-UI,jjz/MailHog-UI,jjz/MailHog-UI,danielwhite/MailHog-UI,thejameskyle/MailHog-UI,danielwhite/MailHog-UI,thejameskyle/MailHog-UI,danielwhite/MailHog-UI
383dced28708b4a1c0e93b8e85bf4832bf75ec96
main.go
main.go
package main import ( "bufio" "os" "github.com/calebthompson/ftree/tree" ) func main() { r := bufio.NewScanner(os.Stdin) lines := []string{} for r.Scan() { lines = append(lines, r.Text()) } t := tree.Tree(lines, "/") t.Print(0, nil) }
package main import ( "bufio" "fmt" "os" "github.com/calebthompson/ftree/tree" ) const ( version = "v0.1.0" help = `Pipe output from some command that lists a single file per line to ftree. find . | ftree git ls-files {app,spec}/models | ftree lsrc | cut -d : -f 1 | ftree ` ) func main() { handleArgume...
Add version and help arguments
Add version and help arguments `-v / --version` will print version information and exit. `-h / --help` will print help information and exit. Any other flag will complain and exit with a failure code.
Go
mit
thoughtbot/ftree,thoughtbot/ftree
b33d5c5393e80ffc39fb31da8d88440803853a0a
_docs/server.go
_docs/server.go
// Copyright 2015 Hajime Hoshi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
// Copyright 2016 Hajime Hoshi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Update license year in a new file
doc: Update license year in a new file
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
97afad3a04431823d9f07ece330c7b04b302a708
internal/stats/count_nodes.go
internal/stats/count_nodes.go
package stats import ( "fmt" "github.com/callpraths/gorobdd/internal/node" ) func CountNodes(n *node.Node) (int, error) { m := make(map[*node.Node]bool) return countNodesHelper(n, m) } func countNodesHelper(n *node.Node, m map[*node.Node]bool) (int, error) { _, seen := m[n] if seen { return 0, nil } m[n] =...
package stats import ( "fmt" "github.com/callpraths/gorobdd/internal/node" "github.com/callpraths/gorobdd/internal/tag" ) func CountNodes(n *node.Node) (int, error) { s := tag.NewSeenContext() return countNodesHelper(n, s) } func countNodesHelper(n *node.Node, s tag.SeenContext) (int, error) { if s.IsSeen(n) {...
Implement CountNodes using the seen tag.
Implement CountNodes using the seen tag.
Go
mit
callpraths/gorobdd
4d7c2ef91577ebb13a64af7934e1f316533ab0b8
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).UTC() } return k } func (k KeyOb...
Store the expiry time in UTC directly
Store the expiry time in UTC directly
Go
mit
vrischmann/rdbtools
ba755b61f373b824f6952a9b237223558c0e2f19
ast/ast_test.go
ast/ast_test.go
package ast_test import ( "strings" "testing" "github.com/DeedleFake/wdte/ast" ) func printTree(t *testing.T, cur ast.Node, depth int) { indent := strings.Repeat(" ", depth) switch cur := cur.(type) { case *ast.Term: t.Logf("%v%v", indent, cur) case *ast.NTerm: t.Logf("%v(%v", indent, cur) for _, c :=...
package ast_test import ( "strings" "testing" "github.com/DeedleFake/wdte/ast" ) func printTree(t *testing.T, cur ast.Node, depth int) { indent := strings.Repeat(" ", depth) switch cur := cur.(type) { case *ast.Term: t.Logf("%v%v", indent, cur) case *ast.NTerm: t.Logf("%v(%v", indent, cur) for _, c :=...
Remove optional semicolons from test.
ast: Remove optional semicolons from test.
Go
mit
DeedleFake/wdte,DeedleFake/wdte
4c43f8c181776bc705d97d6bf3c7818d58f220e5
useragent.go
useragent.go
package main import ( "net/http" "strings" ) var ( // Whitelist crawlers here crawlerPatterns = [...]string{ "Googlebot", "bingbot", "MSNbot", "facebookexternalhit", "PlurkBot", "Twitterbot", "CloudFlare-AlwaysOnline", } ) func isCrawlerUserAgent(r *http.Request) bool { ua := r.UserAgent() for ...
package main import ( "net/http" "strings" ) var ( // Whitelist crawlers here crawlerPatterns = [...]string{ "Google (+https://developers.google.com/+/web/snippet/)", "Googlebot", "bingbot", "MSNbot", "facebookexternalhit", "PlurkBot", "Twitterbot", "CloudFlare-AlwaysOnline", } ) func isCrawlerU...
Add Google+ snippet fetcher to crawler list
Add Google+ snippet fetcher to crawler list
Go
mit
ptt/pttweb
6c722ebf604bf266d42cf2ba2227ef6812ddac7f
src/cf/app_files_test.go
src/cf/app_files_test.go
package cf_test import ( . "cf" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "path/filepath" ) var _ = Describe("AppFiles", func() { fixturePath := filepath.Join("..", "fixtures", "applications") Describe("AppFilesInDir", func() { It("all files have '/' path separators", func() { files, err := Ap...
package cf_test import ( . "cf" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "path/filepath" "path" ) var _ = Describe("AppFiles", func() { fixturePath := filepath.Join("..", "fixtures", "applications") Describe("AppFilesInDir", func() { It("all files have '/' path separators", func() { files, e...
Fix app files test on windows
Fix app files test on windows
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
f7094424d06f70dbc656e043f9fecae00d9576b2
tweet.go
tweet.go
package anaconda type Tweet struct { Source string Id int64 Retweeted bool Favorited bool User TwitterUser Truncated bool Text string Retweet_count int64 Id_str string Created_at string Entities TwitterEntities }
package anaconda import ( "time" ) type Tweet struct { Source string Id int64 Retweeted bool Favorited bool User TwitterUser Truncated bool Text string Retweet_count int64 Id_str string Created_at string Entities TwitterEntities } // Creat...
Add CreatedAtTime() convenience wrapper function
Add CreatedAtTime() convenience wrapper function
Go
mit
jmptrader/anaconda,logashoff/anaconda,rendon/anaconda,intfrr/anaconda,amit-lulla/twitterapi,ifross89/anaconda,jeffk/anaconda,rfsbraz/anaconda,cgag/anaconda,aatishnn/anaconda,140proof/anaconda,azr/anaconda,josephyzhou/anaconda,Fe4nn0r/anaconda
9cd1c9b1f88e04c420219b16e239a8f1a5846df9
types.go
types.go
package radius import ( "encoding/binary" "io" ) // AttributeType defines types for an Attribute type AttributeType int64 const ( // Attributes for RFC2866/Radius accounting AccountingStatusType AttributeType = 40 AccountingDelayTime AttributeType = 41 AccountingInputOctets AttributeType = 42 Acc...
package radius import "io" // AttributeType defines types for an Attribute type AttributeType int64 const ( // Attributes for RFC2866/Radius accounting AccountingStatusType AttributeType = 40 AccountingDelayTime AttributeType = 41 AccountingInputOctets AttributeType = 42 AccountingOutputOctets At...
Remove unnecesary endianness from attribute type writer
Remove unnecesary endianness from attribute type writer
Go
mit
CyCoreSystems/radius,CyCoreSystems/radius
91e5b46ad966ca77fc8077e62fe6460c9c908188
decoder_example_test.go
decoder_example_test.go
// The original error message returned by stdlib changed with go1.8. // We only test the latest release. // //+build go1.8 forcego1.8 package jsonptrerror_test import ( "fmt" "strings" "github.com/dolmen-go/jsonptrerror" ) func ExampleDecoder() { decoder := jsonptrerror.NewDecoder(strings.NewReader( `{"key": ...
// The original error message returned by stdlib changed with go1.8. // We only test the latest release. // //+build go1.8 forcego1.8 package jsonptrerror_test import ( "fmt" "strings" "github.com/dolmen-go/jsonptrerror" ) func ExampleDecoder() { decoder := jsonptrerror.NewDecoder(strings.NewReader( `{"key": ...
Fix Example to not show the original error (which is go version dependent)
Fix Example to not show the original error (which is go version dependent)
Go
apache-2.0
dolmen-go/jsonptrerror
4946cbd9dcf72f518e1d7692a92a9b126592710b
api/api_test.go
api/api_test.go
package api_test import ( "log" "net/http" "os" "testing" "github.com/jvikstedt/alarmy/api" "github.com/jvikstedt/alarmy/store" ) var handler http.Handler var mockStore *store.MockStore func TestMain(m *testing.M) { setup() retCode := m.Run() os.Exit(retCode) } func setup() { mockStore = &store.MockStore...
package api_test import ( "bytes" "log" "net/http" "os" "testing" "github.com/jvikstedt/alarmy/api" "github.com/jvikstedt/alarmy/store" ) var handler http.Handler var mockStore *store.MockStore var logs = &bytes.Buffer{} func TestMain(m *testing.M) { setup() retCode := m.Run() os.Exit(retCode) } func set...
Write test logs to a buffer, so it can be used for testing and cleaner test output
Write test logs to a buffer, so it can be used for testing and cleaner test output
Go
mit
jvikstedt/alarmy
689fc1e40d8ba35d5cf9c2fab189b09eb02811fc
container/lxd/lxdclient/conn_profile.go
container/lxd/lxdclient/conn_profile.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package lxdclient import ( "github.com/juju/errors" ) type rawProfileClient interface { ProfileCreate(name string) error ListProfiles() ([]string, error) SetProfileConfigItem(name, key, value string) error } type profil...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build go1.3 package lxdclient import ( "github.com/juju/errors" ) type rawProfileClient interface { ProfileCreate(name string) error ListProfiles() ([]string, error) SetProfileConfigItem(name, key, value string) err...
Add a missing build constraint.
Add a missing build constraint.
Go
agpl-3.0
gabriel-samfira/juju,kat-co/juju,bac/juju,kat-co/juju,gabriel-samfira/juju,davecheney/juju,ericsnowcurrently/juju,axw/juju,mjs/juju,voidspace/juju,dooferlad/juju,makyo/juju,dimitern/juju,bz2/juju,bz2/juju,kat-co/juju,reedobrien/juju,bogdanteleaga/juju,wwitzel3/juju,macgreagoir/juju,ericsnowcurrently/juju,perrito666/juj...
e56691bc440882240695b15994b8719a155af0b5
flags.go
flags.go
package main import ( "flag" "fmt" "os" ) var ( flBroker string flConsumerGroup string flTopic string flPartition int flNewest bool fsConsumerGroup = flag.NewFlagSet("cgo", flag.ContinueOnError) fsGetOffset = flag.NewFlagSet("go", flag.ContinueOnError) ) func init() { flag.U...
package main import ( "flag" "fmt" "os" ) var ( flBroker string flConsumerGroup string flTopic string flPartition int flNewest bool fsConsumerGroup = flag.NewFlagSet("cgo", flag.ContinueOnError) fsGetOffset = flag.NewFlagSet("go", flag.ContinueOnError) ) func init() { flag.U...
Make the broker flag global
Make the broker flag global
Go
mit
vrischmann/koff
5eabc60fda9687cb3906680f1078e700975c523e
core/vars.go
core/vars.go
// package core contains the core data structures and functionality // leveraged y the other other Goed packages. package core import "os" const Version = "0.0.3" const ApiVersion = "v1" var Trace = false // Ed is thew editor singleton var Ed Editable // Colors is the number of colors to use in the terminal var Co...
// package core contains the core data structures and functionality // leveraged y the other other Goed packages. package core import "os" const Version = "0.0.3" const ApiVersion = "v1" var Trace = true // Ed is thew editor singleton var Ed Editable // Colors is the number of colors to use in the terminal var Col...
Use fixed constant values for cursorMvmt
Use fixed constant values for cursorMvmt
Go
mit
tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed,tcolar/goed
0a76605fa3846edd5618a51ede510c4f4fd5466d
common.go
common.go
package main import ( "encoding/json" "io/ioutil" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) type ThumbnailSize struct { Width uint Height uint } var ThumbnailSizes = map[string]ThumbnailSize{ "small": ThumbnailSize{100, 100}, "large": ThumbnailSize{500, 500}, } type Config struct { SourceFolderPat...
package main import ( "encoding/json" "fmt" "io/ioutil" "path" "github.com/jinzhu/gorm" _ "github.com/lib/pq" ) type ThumbnailSize struct { Width uint Height uint } var ThumbnailSizes = map[string]ThumbnailSize{ "small": ThumbnailSize{100, 100}, "large": ThumbnailSize{500, 500}, } type Config struct { ...
Add method to partition id into thumbnail path
Add method to partition id into thumbnail path
Go
mit
jaischeema/panorma,jaischeema/panorma,jaischeema/panorma
69a58785f8501a1df0e25ff6abe6fceed5c75098
cli/cli_test.go
cli/cli_test.go
package cli import ( "testing" "github.com/libopenstorage/openstorage/api" "github.com/stretchr/testify/require" ) func TestCmdMarshalProto(t *testing.T) { volumeSpec := &api.VolumeSpec{ Size: 64, Format: api.FSType_FS_TYPE_EXT4, } data := cmdMarshalProto(volumeSpec, false) require.Equal( t, `{ "ep...
package cli import ( "testing" "github.com/libopenstorage/openstorage/api" "github.com/stretchr/testify/require" ) func TestCmdMarshalProto(t *testing.T) { volumeSpec := &api.VolumeSpec{ Size: 64, Format: api.FSType_FS_TYPE_EXT4, } data := cmdMarshalProto(volumeSpec, false) require.Equal( t, `{ "ep...
Update UT for removed fields
Update UT for removed fields
Go
apache-2.0
pault84/openstorage,pault84/openstorage,libopenstorage/openstorage,libopenstorage/openstorage,pault84/openstorage,libopenstorage/openstorage
3533358e7de5a8b916dd032f691ca867ee0e4743
exit_test.go
exit_test.go
// +build !freebsd package mint_test import ( "os" "testing" "github.com/otiai10/mint" ) // Exit func TestExit(t *testing.T) { mint.Expect(t, func() { os.Exit(999999) }).Exit(999999) mint.Expect(t, func() { os.Exit(1) }).Not().Exit(0) }
// +build !freebsd package mint_test import ( "os" "testing" "github.com/otiai10/mint" ) // Exit func TestExit(t *testing.T) { mint.Expect(t, func() { os.Exit(999999) }).Exit(999999) mint.Expect(t, func() { os.Exit(1) }).Not().Exit(0) r := mint.Expect(t, func() { os.Exit(0) }).Dry().Exit(1) mint.E...
Cover negative test case of "Exit"
Cover negative test case of "Exit"
Go
mit
otiai10/mint
31485faecb4738d1c25d556ec2a88f49fc7a2194
config_linux.go
config_linux.go
// +build linux package specs // LinuxSpec is the full specification for linux containers. type LinuxSpec struct { Spec // Linux is platform specific configuration for linux based containers. Linux Linux `json:"linux"` } // Linux contains platform specific configuration for linux based containers. type Linux stru...
// +build linux package specs // LinuxSpec is the full specification for linux containers. type LinuxSpec struct { Spec // Linux is platform specific configuration for linux based containers. Linux Linux `json:"linux"` } // Linux contains platform specific configuration for linux based containers. type Linux stru...
Return golang compliant names for UID and GID in User
Return golang compliant names for UID and GID in User Signed-off-by: Alexander Morozov <4efb7da3e38416208b41d8021a942884d8a9435c@docker.com>
Go
apache-2.0
vbatts/specs,vishh/specs,runcom/specs,hqhq/runtime-spec,ujuc/specs,HardikDR/specs,marcosnils/specs,wking/opencontainer-specs,cloudfoundry-incubator/specs,wangkirin/specs,wking/opencontainer-runtime-spec,talwai/specs,opencontainers/runtime-spec,jonboulle/specs,mheon/specs,laijs/specs,gao-feng/specs,opencontainers/specs,...
5ebd3b9188422504000cda3364ec6a3be488d14f
src/tool/logplexd/logplexd.go
src/tool/logplexd/logplexd.go
package main import ( "fmt" "log" "net/http" "net/http/httptest" "os" "os/signal" ) type LogplexPrint struct{} func (*LogplexPrint) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Printf("Request: %#v", *r) w.WriteHeader(http.StatusNoContent) } func main() { s := httptest.NewTLSServer(&LogplexPrint...
package main import ( "fmt" "log" "net/http" "net/http/httptest" "net/http/httputil" "os" "os/signal" ) type LogplexPrint struct{} func (*LogplexPrint) ServeHTTP(w http.ResponseWriter, r *http.Request) { dump, err := httputil.DumpRequest(r, true) if err != nil { log.Printf("Could not dump request: %#v", e...
Use httputil DumpRequest instead of just %v formatting
Use httputil DumpRequest instead of just %v formatting This makes logplexd output a lot more useful in most cases. DumpRequest is set up to render the request body, also. Signed-off-by: Daniel Farina <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@fdr.io>
Go
bsd-2-clause
heroku/pg_logplexcollector,logplex/pg_logplexcollector
50c1d10aa90894526f46da9232f543f6f22f7a56
CoreModule/PingCommand.go
CoreModule/PingCommand.go
package CoreModule import ( "fmt" "github.com/bwmarrin/discordgo" "github.com/gendonl/genbot/Bot" "time" ) func initPingCommand() (cc CoreCommand) { cc = CoreCommand{ name: "ping", description: "Returns pong.", usage: "`%sping`", aliases: []string{}, permission: discordgo.PermissionSendM...
package CoreModule import ( "fmt" "github.com/bwmarrin/discordgo" "github.com/gendonl/genbot/Bot" "time" ) func initPingCommand() (cc CoreCommand) { cc = CoreCommand{ name: "ping", description: "Returns pong.", usage: "`%sping`", aliases: []string{}, permission: discordgo.PermissionSendM...
Add bot-latency to ping command
Add bot-latency to ping command
Go
mit
GenDoNL/GoDiscordBot
f2201f6ba4a8758e618016fa2c047cb2ee9def65
pkg/errors/http_test.go
pkg/errors/http_test.go
package errors import ( nativeErrors "errors" "net/http" "testing" ) func TestHTTPStatusCode(t *testing.T) { if HTTPStatusCode(nil) != http.StatusOK { t.Error("Status code does not match") } if HTTPStatusCode(New(INTERNAL, "internal error")) != http.StatusInternalServerError { t.Error("Status code does not...
package errors import ( nativeErrors "errors" "net/http" "testing" ) func TestHTTPStatusCode(t *testing.T) { if HTTPStatusCode(nil) != http.StatusOK { t.Error("Status code does not match") } if HTTPStatusCode(New(INTERNAL, "internal error")) != http.StatusInternalServerError { t.Error("Status code does not...
Fix code as int test
Fix code as int test
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
9955a22f37dcc1fa93ec898c1d892281b1df5c3c
api/validation.go
api/validation.go
package api import "regexp" var idRegexp = regexp.MustCompile("^[[:alnum:]](?:[_-]?[[:alnum:]]){1,35}$") // ValidID returns true if the given ID is a valid application or device ID func ValidID(id string) bool { return idRegexp.Match([]byte(id)) }
package api import "regexp" var idRegexp = regexp.MustCompile("^[0-9a-z](?:[_-]?[0-9a-z]){1,35}$") // ValidID returns true if the given ID is a valid application or device ID func ValidID(id string) bool { return idRegexp.Match([]byte(id)) }
Use lowercase AppIDs and DevIDs
Use lowercase AppIDs and DevIDs
Go
mit
mgranberry/ttn,jvanmalder/ttn,mgranberry/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,mgranberry/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,TheThingsNetwork/ttn
60d16f5843d577ffade53154989174157ab66a3d
pkg/cmd/server/apis/config/v1/stringsource.go
pkg/cmd/server/apis/config/v1/stringsource.go
package v1 import "encoding/json" // UnmarshalJSON implements the json.Unmarshaller interface. // If the value is a string, it sets the Value field of the StringSource. // Otherwise, it is unmarshaled into the StringSourceSpec struct func (s *StringSource) UnmarshalJSON(value []byte) error { // If we can unmarshal t...
package v1 import "encoding/json" // UnmarshalJSON implements the json.Unmarshaller interface. // If the value is a string, it sets the Value field of the StringSource. // Otherwise, it is unmarshaled into the StringSourceSpec struct func (s *StringSource) UnmarshalJSON(value []byte) error { // If we can unmarshal t...
Fix inconsistency in StringSource MarshalJSON
Fix inconsistency in StringSource MarshalJSON The method should be bound to *StringSource like every other type in the codebase. The unintentional copy did not result in any behavioral changes. Signed-off-by: Monis Khan <19f7b2d00144930eab99c4cfd2a8d2d2a225ef67@redhat.com>
Go
apache-2.0
wjiangjay/origin,php-coder/origin,ramr/origin,mahak/origin,PI-Victor/origin,legionus/origin,ramr/origin,PI-Victor/origin,Miciah/origin,liggitt/origin,sdminonne/origin,linzhaoming/origin,jim-minter/origin,pweil-/origin,nak3/origin,dinhxuanvu/origin,hroyrh/origin,liangxia/origin,imcsk8/origin,jwhonce/origin,pecameron/ori...
e698c7d8148dca96454ae7e5a6e08d288627ebe3
cmd/atlas/cmd_ip.go
cmd/atlas/cmd_ip.go
package main import ( "fmt" "github.com/urfave/cli" "log" "os" "strconv" ) // init injects our "ip" related commands/options. func init() { // Fill-in the various commands cliCommands = append(cliCommands, cli.Command{ Name: "ip", Usage: "returns current ip", Description: "shorthand for gett...
package main import ( "fmt" "github.com/urfave/cli" "log" "strconv" ) // init injects our "ip" related commands/options. func init() { // Fill-in the various commands cliCommands = append(cliCommands, cli.Command{ Name: "ip", Usage: "returns current ip", Description: "shorthand for getting cu...
Use log.Fatalf instead of Printf/Exit.
Use log.Fatalf instead of Printf/Exit.
Go
mit
keltia/ripe-atlas
1c29d3b23555d2a06c6cb09a53b63a426080826a
main.go
main.go
package main import ( "fmt" "log" "net/http" "net/http/httputil" ) func hello(rw http.ResponseWriter, req *http.Request) { fmt.Fprintf(rw, "This is stalemate.") } func processPayload(rw http.ResponseWriter, req *http.Request) { dump, err := httputil.DumpRequest(req, true) if err != nil { log.Println(err) }...
package main import ( "encoding/json" "fmt" "log" "net/http" "os" "github.com/google/go-github/github" "github.com/rjz/githubhook" ) func hello(rw http.ResponseWriter, req *http.Request) { fmt.Fprintf(rw, "This is stalemate.") } func processPayload(rw http.ResponseWriter, req *http.Request) { hook, err := ...
Use client libraries to parse installation event
Use client libraries to parse installation event
Go
mit
kytrinyx/stalemate
fc00f88b2c51f0af6e12e46434037102ef7cb61b
main.go
main.go
package main import ( "flag" "log" "os" ) var ( PlaybookFile = flag.String("play", "site.yml", "Path to the playbook to execute") InventoryFile = flag.String("i", "hosts", "Path to the inventory file") LimitHosts = flag.String("l", "", "Limit hosts") ) func main() { flag.Parse() log.SetFlags(0) log.SetO...
package main import ( "flag" "log" "os" ) var ( PlaybookFile = flag.String("play", "site.yml", "Path to the playbook to execute") InventoryFile = flag.String("i", "hosts", "Path to the inventory file") LimitHosts = flag.String("l", "", "Limit hosts") ) func main() { flag.Parse() log.SetFlags(0) log.SetO...
Load and check the plays in the playbook.
Load and check the plays in the playbook.
Go
apache-2.0
nesv/govern
34942989e7ce36711ccc29e6f1ccc35c8dcb8aae
main.go
main.go
package main import ( "bufio" "fmt" "os" ) func main() { file, err := os.Open("targetlist.txt") if err != nil { fmt.Println(err) os.Exit(1) } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { fmt.Println(scanner.Text()) } }
package main import ( "bufio" "fmt" "os" "regexp" ) func main() { file, err := os.Open("targetlist.txt") if err != nil { fmt.Println(err) os.Exit(1) } defer file.Close() scanner := bufio.NewScanner(file) r, _ := regexp.Compile("https?://(www.)?[a-zA-Z0-9.]{2,512}.[a-z]{2,10}") for scanner.Scan() ...
Test lines for valid URL
Test lines for valid URL
Go
bsd-3-clause
yorickdewid/gocraw,yorickdewid/gocraw
49f76c13e5285373eaaf3aba4e63c3d6b1dc51ce
main.go
main.go
package main import "fmt" type custom struct { firstname lastname } type custom1 struct { firstname lastname } func main() { fmt.Println("This is a simple text") // This is a modification from git hub custom.firstname = "Firstname String" custom.lastname = "Custom lastname" custom1.firstname = "This is ...
package main import ( "net/http" ) func main() { http.HandleFunc("/", serveHome) http.HandleFunc("/contact", serveContact) http.ListenAndServe(":8888", nil) } func serveHome(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello World")) } func serveContact(w http.ResponseWriter, r *http.Request) { w...
Add something to this commit
Add something to this commit
Go
bsd-2-clause
davidescus/simple-web-app,davidescus/simple-web-app,davidescus/simple-web-app
7c1fb5edf960d35317b5dfa926624ff7f62e1909
gocipher/letter_number.go
gocipher/letter_number.go
package gocipher func LetterNumberEncrypt(text string) []int { runes := []rune(text) numbers := make([]int, len(runes)) for i, rune := range runes { if rune >= 'A' && rune <= 'Z' { numbers[i] = int(rune - 'A' + 1) } else if rune >= 'a' && rune <= 'z' { numbers[i] = int(rune - 'a' + 1) } } return numbe...
package gocipher // LetterNumberEncrypt - Converts letters to the corresponding number. // e.g. "ABC...XYZ" becomes []int{1, 2, 3 ... 24, 25, 26} func LetterNumberEncrypt(text string) []int { runes := []rune(text) numbers := make([]int, len(runes)) for i, rune := range runes { if rune >= 'A' && rune <= 'Z' { n...
Add letter to number doc comments
Add letter to number doc comments
Go
mit
andrewarchi/gocipher
78ab1a9809872e77fb00c5863f4e3479d06b54f3
cors.go
cors.go
package gofakes3 import ( "net/http" "strings" ) var ( corsHeaders = []string{ "Accept", "Accept-Encoding", "Authorization", "Content-Disposition", "Content-Length", "Content-Type", "X-Amz-Date", "X-Amz-User-Agent", "X-CSRF-Token", "x-amz-acl", "x-amz-meta-filename", "x-amz-meta-from", "x...
package gofakes3 import ( "net/http" "strings" ) var ( corsHeaders = []string{ "Accept", "Accept-Encoding", "Authorization", "Content-Disposition", "Content-Length", "Content-Type", "X-Amz-Date", "X-Amz-User-Agent", "X-CSRF-Token", "x-amz-acl", "x-amz-content-sha256", "x-amz-meta-filename",...
Support multipart uploads from browser
Support multipart uploads from browser
Go
mit
johannesboyne/gofakes3,johannesboyne/gofakes3
60e826ef5a656ac79f8259339d768fc79c7fb298
mime.go
mime.go
package plaintext import ( "strings" ) // returns the mimetype of the full filename if none func getSuffix(filename string) string { idx := strings.LastIndex(filename, ".") if idx == -1 || idx+1 == len(filename) { return filename } return filename[idx+1:] } // ExtractorByFilename returns an plaintext extracto...
package plaintext import ( "strings" ) // returns the mimetype of the full filename if none func getSuffix(filename string) string { idx := strings.LastIndex(filename, ".") if idx == -1 || idx+1 == len(filename) { return filename } return filename[idx+1:] } // ExtractorByFilename returns an plaintext extracto...
Use golang parser for .hxx and .cxx files
Use golang parser for .hxx and .cxx files
Go
mit
client9/plaintext
ed530f8cd8605b5a7dd62584a32e14ee192fbc3d
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
glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,scirelli/scirelli-go,rdp/rogerpack2005-golang,mhennings/marcohennings-go,glycerine/jeaten-go-arrayof-structof,d0f/go-zh,bryanxu/go-zh,npe9/noa...
c577f6d86026d9e92e54050cb41a3657bbaea24d
client_test.go
client_test.go
package apixu import ( "os" "testing" ) func getAPIKey() string { return os.Getenv("APIXU_KEY") } func TestCurrentWeather(t *testing.T) { }
package apixu import ( "os" "testing" ) var cities = []string{ "Cairo", "London", "Paris", "Berlin", "New York", } func getAPIKey() string { return os.Getenv("APIXU_KEY") } func TestInvalidAPIKey(t *testing.T) { client := NewClient("Invalid_Key") _, err := client.Current("Paris") if err == nil { t.Err...
Add currentWeather and forecastWeather tests
Add currentWeather and forecastWeather tests
Go
mit
mohan3d/apixu-go
189a27608be511bc0680e4a055e8379b52934461
exec.go
exec.go
package coreutils import ( "os" "os/exec" ) // ExecCommand executes a command with args and returning the stringified output func ExecCommand(command string, args []string, redirect bool) string { if ExecutableExists(command) { // If the executable exists var output []byte runner := exec.Command(command, args....
package coreutils import ( "os" "os/exec" ) // ExecCommand executes a command with args and returning the stringified output func ExecCommand(command string, args []string, redirect bool) string { if ExecutableExists(command) { // If the executable exists var output []byte runner := exec.Command(command, args....
Call Wait() instead of Start() so we wait for the command to finish before output.
Call Wait() instead of Start() so we wait for the command to finish before output.
Go
apache-2.0
StroblIndustries/codeutilsShared,StroblIndustries/coreutils
c119496c3bafb55af153bec02135fb11d2f5065d
selector_test.go
selector_test.go
package main import ( "reflect" "testing" ) var parseIndexesListTests = []struct { list string indexes []int }{ // Only one index { list: "10", indexes: []int{9}, }, { list: "120", indexes: []int{119}, }, // Multiple indexes { list: "10,120", indexes: []int{9, 119}, }, { list: ...
package main
Remove test to summarize NewIndexes and parseIndexesList
Remove test to summarize NewIndexes and parseIndexesList
Go
mit
kusabashira/csvp
319f5690205142032dd948fb5da8cb38cae16236
examples/paging/page.go
examples/paging/page.go
package main import ( "context" "log" "os" "github.com/zmb3/spotify" "golang.org/x/oauth2/clientcredentials" ) func main() { config := &clientcredentials.Config{ ClientID: os.Getenv("SPOTIFY_ID"), ClientSecret: os.Getenv("SPOTIFY_SECRET"), TokenURL: spotify.TokenURL, } token, err := config.Toke...
package main import ( "context" "log" "os" "github.com/zmb3/spotify" "golang.org/x/oauth2/clientcredentials" ) func main() { config := &clientcredentials.Config{ ClientID: os.Getenv("SPOTIFY_ID"), ClientSecret: os.Getenv("SPOTIFY_SECRET"), TokenURL: spotify.TokenURL, } token, err := config.Toke...
Include longer playlist in pagination example
Include longer playlist in pagination example Signed-off-by: Noah Stride <1db01d43e08596f43a65fb393d969b98ee5b4dc6@noahstride.co.uk>
Go
apache-2.0
zmb3/spotify
0bb38f07e118c8d6e6bb1f85ab199b3530ac6060
shared_writer.go
shared_writer.go
package disruptor import "sync/atomic" type SharedWriter struct { written *Cursor upstream Barrier capacity int64 gate *Cursor mask int64 shift uint8 committed []int32 } func NewSharedWriter(write *SharedWriterBarrier, upstream Barrier) *SharedWriter { return &SharedWriter{ written: wri...
package disruptor import "sync/atomic" type SharedWriter struct { written *Cursor upstream Barrier capacity int64 gate *Cursor mask int64 shift uint8 committed []int32 } func NewSharedWriter(write *SharedWriterBarrier, upstream Barrier) *SharedWriter { return &SharedWriter{ written: wri...
Comment about keeping a commit together; also removed for loop where possible.
Comment about keeping a commit together; also removed for loop where possible.
Go
apache-2.0
yxd-hde/go-disruptor,smartystreets/go-disruptor,yxd-hde/go-disruptor,smartystreets/go-disruptor