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
b74a999a2bb18336ef88b6552d8d93a25fb4353d
codeutilsShared.go
codeutilsShared.go
package codeutilsShared import ( "crypto/sha512" "encoding/hex" "os" ) // GlobalFileMode as a file mode we'll use for "global" operations such as when doing IO as root var GlobalFileMode os.FileMode // UniversalFileMode as a file mode we'll wherever we can var UniversalFileMode os.FileMode func init() { GlobalF...
package codeutilsShared import ( "crypto/sha512" "encoding/hex" "os" ) // GlobalFileMode as a file mode we'll use for "global" operations such as when doing IO as root var GlobalFileMode os.FileMode // UniversalFileMode as a file mode we'll wherever we can var UniversalFileMode os.FileMode func init() { GlobalF...
Implement rounds in Sha512Sum func
Implement rounds in Sha512Sum func
Go
apache-2.0
StroblIndustries/codeutilsShared,StroblIndustries/coreutils
3ed4399f5fcbf59b8c152461398131d9f8518650
upgrade.go
upgrade.go
package adeptus var ( regex_xp = regexp.MustCompile(`\(?\d+xp\)?`) // Match `150xp` and `(150xp)` ) type Upgrade interface { Mark string Name string Cost string } // ParseUpgrade generate an upgrade from a raw line func ParseUpgrade(raw string) (Upgrade, error) { upgrade := Upgrade{} // Get the fields of the...
package adeptus var ( regex_xp = regexp.MustCompile(`\(?\d+xp\)?`) // Match `150xp` and `(150xp)` ) type Upgrade interface { Mark string Name string Cost string Line int } // ParseUpgrade generate an upgrade from a raw line func ParseUpgrade(raw string, line int) (Upgrade, error) { // Initialize a new upgrade ...
Add a Line field to the Upgrade struct
Add a Line field to the Upgrade struct
Go
unlicense
elwinar/adeptus
c414130e60f72e610cafe8ea3d688e63305ab9ce
util/util_test.go
util/util_test.go
// Copyright 2014 Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package util import "testing" func TestAssertEquals(t *testing.T) { v := 1 AssertEquals(t, v, v) if t.Failed() { t.Errorf("AssertEquals(t, %d, %d) fails, w...
// Copyright 2014 Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package util import "testing" func TestAssertEquals(t *testing.T) { v := 1 AssertEquals(t, v, v) if t.Failed() { t.Errorf("AssertEquals(t, %d, %d) fails; w...
Change error message of AssertEquals test
Change error message of AssertEquals test The error message now follows the style of the others error messages.
Go
mit
mrekucci/euler
8252b320bf8b59becc2bb6de27ebc6b24f963e76
thirdparty/tollbooth_fasthttp/test/main.go
thirdparty/tollbooth_fasthttp/test/main.go
package main import ( "time" "github.com/didip/tollbooth" "github.com/magicwrighter/tollbooth/thirdparty/tollbooth_fasthttp" "github.com/valyala/fasthttp" ) func main() { requestHandler := func(ctx *fasthttp.RequestCtx) { switch string(ctx.Path()) { case "/hello": helloHandler(ctx) default: ctx.Erro...
package main import ( "time" "github.com/didip/tollbooth" "github.com/didip/tollbooth/thirdparty/tollbooth_fasthttp" "github.com/valyala/fasthttp" ) func main() { requestHandler := func(ctx *fasthttp.RequestCtx) { switch string(ctx.Path()) { case "/hello": helloHandler(ctx) default: ctx.Error("Unsup...
Remove faulty dependency on magicwright repo
Remove faulty dependency on magicwright repo Fixes #37
Go
mit
didip/tollbooth
0a45903563082932864f1e746a17a8e3f9a19a89
libcontainer/system/syscall_linux_386.go
libcontainer/system/syscall_linux_386.go
// +build linux,386 package system import ( "syscall" ) // Setuid sets the uid of the calling thread to the specified uid. func Setuid(uid int) (err error) { _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = e1 } return } // Setgid sets the gid of the calling thread to...
// +build linux,386 package system import ( "syscall" ) // Setuid sets the uid of the calling thread to the specified uid. func Setuid(uid int) (err error) { _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0) if e1 != 0 { err = e1 } return } // Setgid sets the gid of the calling thread ...
Support 32 bit UID on i386
Support 32 bit UID on i386 The original SETUID takes a 16 bit UID. Linux 2.4 introduced a new syscall, SETUID32, with support for 32 bit UIDs. The setgid wrapper already uses SETGID32. Signed-off-by: Carl Henrik Lunde <afbb228c01ef716d910901bf3f59b12538bf9acc@ifi.uio.no>
Go
apache-2.0
opencontainers/runc,sunyuan3/runc,jhowardmsft/runc,wking/runc,avagin/runc,maxamillion/runc,kolyshkin/runc,mheon/runc,vbatts/runc,WeiZhang555/runc,adrianreber/runc,opencontainers/runc,jhowardmsft/runc,stefanberger/runc,justincormack/runc,rhatdan/runc,hqhq/runc,justincormack/runc,shishir-a412ed/runc,nkwilson/runc,rajasec...
b9b86d05ff9a87f7b6e6c3de7decaefd45f5589b
main.go
main.go
package main import ( "fmt" "log" "net/http" "os" ) var version string func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { log.Printf("%s %s", r.Method, r.URL) fmt.Fprintf(w, GreetingMessage()) }) log.Fatal(http.ListenAndServe(":8000", nil)) } func GetVersion() string { re...
package main import ( "fmt" "log" "net/http" "os" ) var version string func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { defer logRequestInfo(r) fmt.Fprintf(w, GreetingMessage()) }) http.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) { defer logRequestI...
Add support for /ping and /health routes
Add support for /ping and /health routes
Go
mit
mongrelion/gapp
b02341bcf440acf5f1a8c89e14de035e8da65946
main.go
main.go
package main import ( "github.com/buchgr/bazelremote/cache" ) // TODO: Add command line flags func main() { e := cache.NewEnsureSpacer(0.8, 0.5) h := cache.NewHTTPCache(":8080", "/Users/buchgr/cache", 10*1024*1024, e) h.Serve() }
package main import ( "flag" "strconv" "github.com/buchgr/bazel-remote/cache" ) func main() { port := flag.Int("port", 8080, "The port the HTTP server listens on") dir := flag.String("dir", "", "Directory path where to store the cache contents") maxSize := flag.Int64("max_size", -1, "The maximum size of th...
Add basic command line flags
Add basic command line flags
Go
apache-2.0
buchgr/bazel-remote,buchgr/bazel-remote
e903b18af1f3a3947e56fd59de90f16c6d75bcfa
main.go
main.go
package main import ( "fmt" "log" "net/http" "os" "github.com/flynn/go-flynn/migrate" "github.com/flynn/go-flynn/postgres" ) func main() { log.SetFlags(log.Lmicroseconds | log.Lshortfile) db, err := postgres.Open("", "") if err != nil { log.Fatal(err) } m := migrate.NewMigrations() m.Add(1, "CREATE S...
package main import ( "fmt" "log" "net/http" "os" "github.com/flynn/go-flynn/migrate" "github.com/flynn/go-flynn/postgres" ) func main() { log.SetFlags(log.Lmicroseconds | log.Lshortfile) db, err := postgres.Open("", "") if err != nil { log.Fatal(err) } m := migrate.NewMigrations() m.Add(1, "CREATE S...
Reformat output to match other examples.
Reformat output to match other examples. Signed-off-by: Blaž Hrastnik <e26a9cc74a1e4715764aa09d1071b1ef182b1807@gmail.com>
Go
bsd-3-clause
flynn-examples/go-flynn-example,yunfanapp/go-flynn-example
a5529542189b3c9296f94f28fb9731af819f0afe
misc.go
misc.go
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) cmdReader, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer cmdReader.Close() scanner := bufio...
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) cmdReader, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer cmdReader.Close() scanner := bufio...
Add printing err to STD out
Add printing err to STD out
Go
mit
go-playground/generate
ae5a619e10dcd2324f26e11d00e7bae5269f4ec4
nest.go
nest.go
package main import ( "fmt" "io/ioutil" "os" "code.google.com/p/go-uuid/uuid" "github.com/jsgoecke/nest" "gopkg.in/yaml.v2" ) var thermostat *nest.Thermostat type NestConf struct { Productid string Productsecret string Authorization string Token string } func init() { f, err := ioutil.ReadFi...
package main import ( "fmt" "io/ioutil" "os" "github.com/jsgoecke/nest" "github.com/pborman/uuid" "gopkg.in/yaml.v2" ) var thermostat *nest.Thermostat type NestConf struct { Productid string Productsecret string Authorization string Token string } func init() { f, err := ioutil.ReadFile("./n...
Update to the new uuid project home.
Update to the new uuid project home. Change-Id: I341722687895f9ab83f41269045d0d52f032b0f9
Go
mit
guildencrantz/ask_nest,guildencrantz/ask_nest
5b7aa1add5567b64bcaf4a247d732acaec55077d
user.go
user.go
package buildah import ( "os/user" "strconv" "github.com/opencontainers/runtime-spec/specs-go" ) // TODO: we should doing these lookups using data that's actually in the container. func getUser(username string) (specs.User, error) { if username == "" { return specs.User{}, nil } runuser, err := user.Lookup(u...
package buildah import ( "os/user" "strconv" "github.com/opencontainers/runtime-spec/specs-go" ) // TODO: we should doing these lookups using data that's actually in the container. func getUser(username string) (specs.User, error) { if username == "" { return specs.User{}, nil } runuser, err := user.Lookup(u...
Drop supplemental groups for "run"
Drop supplemental groups for "run" Drop supplemental group resolution for the "run" command. The necessary functions weren't in go 1.5, and the runtime spec doesn't give us a place to put supplemental group information anyway. Signed-off-by: Nalin Dahyabhai <f562fcb2a0b898bf0be1afc867ea92325d8f825f@redhat.com>
Go
apache-2.0
projectatomic/buildah,rhatdan/buildah,TomSweeneyRedHat/buildah,ipbabble/buildah,projectatomic/buildah,ipbabble/buildah,TomSweeneyRedHat/buildah,nalind/buildah-1,nalind/buildah-1,nalind/buildah-1,nalind/buildah,projectatomic/buildah,TomSweeneyRedHat/buildah,rhatdan/buildah,nalind/buildah,rhatdan/buildah
2e998b3ba8936ed33b06ee4f0e166315a4b720f3
examples_test.go
examples_test.go
package gockle import ( "fmt" "github.com/maraino/go-mock" ) var mySession = &SessionMock{} func Example_dump() { var rows, _ = mySession.QuerySliceMap("select * from users") for _, row := range rows { fmt.Println(row) } } func Example_insert() { mySession.QueryExec("insert into users (id, name) values (1...
package gockle import ( "fmt" "github.com/maraino/go-mock" ) var mySession = &SessionMock{} func ExampleBatch() { var b = mySession.QueryBatch(BatchLogged) b.Query("insert into users (id, name) values (123, 'me')") b.Query("insert into users (id, name) values (456, 'you')") b.Exec() } func ExampleIterator(...
Put some Session examples into other types
Put some Session examples into other types
Go
apache-2.0
willfaught/gockle
6554beec1060da5ab1f55072a1489d7f40c9d5e2
aws_role.go
aws_role.go
package saml2aws import ( "fmt" "strings" ) // AWSRole aws role attributes type AWSRole struct { RoleARN string PrincipalARN string Name string } // ParseAWSRoles parses and splits the roles while also validating the contents func ParseAWSRoles(roles []string) ([]*AWSRole, error) { awsRoles := mak...
package saml2aws import ( "fmt" "strings" ) // AWSRole aws role attributes type AWSRole struct { RoleARN string PrincipalARN string Name string } // ParseAWSRoles parses and splits the roles while also validating the contents func ParseAWSRoles(roles []string) ([]*AWSRole, error) { awsRoles := mak...
Trim whitespace on extracted role ARNs
Trim whitespace on extracted role ARNs
Go
mit
Versent/saml2aws,Versent/saml2aws
09971f297453cc7a98e8fb6058c265efdee02c44
go/all-your-base/all_your_base.go
go/all-your-base/all_your_base.go
package allyourbase import ( "fmt" "math" ) func ConvertToBase(inputBase int, inputDigits []int, outputBase int) (outputDigits []int, e error) { base10 := getBase10Input(inputBase, inputDigits) if base10 == 0 { return []int{0}, nil } for base10 > 0 { digit := base10 % outputBase outputDigits = append([]in...
package allyourbase import ( "errors" "fmt" "math" ) func ConvertToBase(inputBase int, inputDigits []int, outputBase int) (outputDigits []int, e error) { if inputBase < 2 { return []int{}, errors.New("input base must be >= 2") } base10 := getBase10Input(inputBase, inputDigits) if base10 == 0 { return []int...
Return error for invalid base
Return error for invalid base
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
f23f229f4583cf0e5e0aab4cd265023ba7f525bb
thread_linux.go
thread_linux.go
// Package thread is designed for manage OS thread parameters. Usually you // need to call runtime.LockOSThread before use it. // // Only String methods allocates memory (mainly because using of fmt package) // so don't use them when GC is disabled. package thread import ( "fmt" "github.com/ziutek/sched" "syscall" ...
// Package thread is designed for manage OS thread parameters. Usually you // need to call runtime.LockOSThread before use it. // // Only String methods allocates memory (mainly because using of fmt package) // so don't use them when GC is disabled. package thread import ( "fmt" "github.com/ziutek/sched" "syscall" ...
Remove TID= from string representation of thread
Remove TID= from string representation of thread
Go
bsd-3-clause
ziutek/thread
2b593f12ae93c650afa7a91e93ab431e7aa5fb9d
Repo.go
Repo.go
package main import ( "io/ioutil" "strings" ) var airlineCodes AirlineCodes func check(e error) { if e != nil { panic(e) } } func init() { tableName := "airline" tableFields := []string{"Id", "Name", "IATA", "ICAO", "CallSign", "Country", "Comments"} CreateTable("127.0.0.1", "picasso", "picasso", "picasso...
package main import ( "io/ioutil" "strings" ) var airlineCodes AirlineCodes func check(e error) { if e != nil { panic(e) } } func init() { tableName := "airline" tableFields := []string{"Id", "Name", "IATA", "ICAO", "CallSign", "Country", "Comments"} mysql := GetServiceURI("mysql") CreateTable(mysql, "pi...
Put the mysql address in etcd
Put the mysql address in etcd
Go
mit
ftcjeff/AirlineCode-go
4c24eac9bfe4c21ac6a65c3d06ec442b685471f2
window/build.go
window/build.go
package window /* #cgo darwin CFLAGS: -F/Library/Frameworks -D_GOSMF_OSX_ #cgo darwin LDFLAGS: -F/Library/Frameworks -framework SDL2 #cgo linux CFLAGS: -D_GOSMF_LINUX_ #cgo linux LDFLAGS: -lSDL2main -lSDL2 #cgo windows CFLAGS: -D_GOSMF_WINDOWS_ #cgo windows LDFLAGS: -lSDL2main -lSDL2 */ import "C"
package window /* #cgo darwin CFLAGS: -D_GOSMF_OSX_ #cgo darwin LDFLAGS: -F/Library/Frameworks -framework SDL2 #cgo linux CFLAGS: -D_GOSMF_LINUX_ #cgo linux LDFLAGS: -lSDL2main -lSDL2 #cgo windows CFLAGS: -D_GOSMF_WINDOWS_ #cgo windows LDFLAGS: -lSDL2main -lSDL2 */ import "C"
Fix invalid CFLAG for golang v1.9.4
Fix invalid CFLAG for golang v1.9.4
Go
mit
anthonyrego/gosmf,anthonyrego/dodge
a4a50f8a69a72689b1700e4a1f9031e8ed9dab3d
config/track_test.go
config/track_test.go
package config import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestTrackIgnoreString(t *testing.T) { track := &Track{ IgnorePatterns: []string{ "con[.]txt", "pro.f", }, } testCases := map[string]bool{ "falcon.txt": false, "beacon|txt": true, "beacon.ext": true, "proof": ...
package config import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestTrackIgnoreString(t *testing.T) { track := &Track{ IgnorePatterns: []string{ "con[.]txt", "pro.f", }, } testCases := map[string]bool{ "falcon.txt": false, "beacon|txt": true, "beacon.ext": true, "proof": ...
Remove unnecessary duplication in track test
Remove unnecessary duplication in track test Differentiate between the test name and the failure message.
Go
mit
exercism/cli,exercism/cli
e4cd881921ecf083a79e3bff1bf68663c6b116e1
bin/terraform-provider-linode/main.go
bin/terraform-provider-linode/main.go
package main import ( "code.tobolaski.com/btobolaski/terraform-linode" "github.com/hashicorp/terraform/plugin" ) func main() { plugin.Serve(&plugin.ServeOpts{ ProviderFunc: linode.Provider, }) }
package main import ( "github.com/btobolaskiterraform-linode" "github.com/hashicorp/terraform/plugin" ) func main() { plugin.Serve(&plugin.ServeOpts{ ProviderFunc: linode.Provider, }) }
Rename the project for github
Rename the project for github
Go
mpl-2.0
btobolaski/terraform-provider-linode,btobolaski/terraform-provider-linode,bdwyertech/terraform-provider-linode,btobolaski/terraform-provider-linode
a2b8d636f3207a7d27b2f9512c5185d269936e2d
lexer_test.go
lexer_test.go
package eparser import ( "testing" ) func TestLex(t *testing.T) { l := newLexer() res, errs := l.Lex("a **= (7 ** (3 + 4 - 2)) << 1.23 % 0.3") expected := []tokenType{ IDENT, POW_EQ, LPAREN, INT, POW, LPAREN, INT, ADD, INT, SUB, INT, RPAREN, RPAREN, LSH, FLOAT, REM, FLOAT, EOL, } if errs != nil { t.Error...
package eparser import ( "testing" ) func TestLex(t *testing.T) { l := newLexer() res, errs := l.Lex("some_var123 **= (7 ** (3 + 4 - 2)) << 1.23 % 0.3") expected := []tokenType{ IDENT, POW_EQ, LPAREN, INT, POW, LPAREN, INT, ADD, INT, SUB, INT, RPAREN, RPAREN, LSH, FLOAT, REM, FLOAT, EOL, } if errs != nil {...
Test identifier reader inside lexer test
Test identifier reader inside lexer test
Go
mit
soudy/eparser,sodoz/mathcat,soudy/mathcat
effa489b8a1bf052bc897458d3e7e2528353076c
cmd/mstdn/cmd_toot.go
cmd/mstdn/cmd_toot.go
package main import ( "errors" "log" "github.com/mattn/go-mastodon" "github.com/urfave/cli" ) func cmdToot(c *cli.Context) error { if !c.Args().Present() { return errors.New("arguments required") } var toot string ff := c.String("ff") if ff != "" { text, err := readFile(ff) if err != nil { log.Fat...
package main import ( "errors" "log" "github.com/mattn/go-mastodon" "github.com/urfave/cli" ) func cmdToot(c *cli.Context) error { var toot string ff := c.String("ff") if ff != "" { text, err := readFile(ff) if err != nil { log.Fatal(err) } toot = string(text) } else { if !c.Args().Present() { ...
Fix `mstdn.exe toot -ff -` errors `arguments required`
Fix `mstdn.exe toot -ff -` errors `arguments required`
Go
mit
mattn/go-mastodon,178inaba/go-mastodon,mattn/go-mastodon
24ebe73ed5c7e7a13dccf3c069440b67f5bdcad8
libgo/go/net/sock_solaris.go
libgo/go/net/sock_solaris.go
// Copyright 2012 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 solaris // Sockets for Solaris package net import ( "syscall" ) func maxListenerBacklog() int { // The kernel does not track the limit. return...
// Copyright 2012 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 solaris // Sockets for Solaris package net import ( "syscall" ) func maxListenerBacklog() int { // The kernel does not track the limit. return...
Remove Solaris-specific version of listenerSockaddr.
net: Remove Solaris-specific version of listenerSockaddr. Solaris will use the version in sock_unix.go. R=iant CC=gofrontend-dev https://golang.org/cl/11488044
Go
bsd-3-clause
qskycolor/gofrontend,anlhord/gofrontend,golang/gofrontend,golang/gofrontend,anlhord/gofrontend,anlhord/gofrontend,golang/gofrontend,anlhord/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,qskycolor/gofrontend,qskycolor/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,golang/...
22ac3679c9ffa3e7dd0ea0f90c4aea6b93e56b9a
ws2801/ws2801_test.go
ws2801/ws2801_test.go
package ws2801_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/declanshanaghy/bbqberry/ws2801" ) var _ = Describe("WS2801", func() { var ( strand Strand ) BeforeEach(func() { strand := Strand{} strand.Init(10) }) AfterEach(func() { strand.Close() }) Describe("Ba...
package ws2801_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/declanshanaghy/bbqberry/ws2801" ) var _ = Describe("WS2801", func() { var ( strand *Strand ) BeforeEach(func() { strand = NewWS2801(10, 0) }) AfterEach(func() { strand.Close() }) Describe("Basic test",...
Fix unittest compilation. Still need to figure out execution on mac
Fix unittest compilation. Still need to figure out execution on mac
Go
apache-2.0
declanshanaghy/bbqberry,declanshanaghy/bbqberry,declanshanaghy/bbqberry,declanshanaghy/bbqberry
aa7d88fe8939fd5f494827509e18be9dc8ab1a6a
cmd/resumic/validate/validator.go
cmd/resumic/validate/validator.go
package validate import ( "fmt" "log" "os" "path" "github.com/gobuffalo/packr" "github.com/xeipuuv/gojsonschema" ) // ValidateJSON is used to check for validity func ValidateJSON(doc string) bool { file := path.Join("file:///", GetPath(), "/", doc) box := packr.NewBox("../../../") s, err := box.MustString(...
package validate import ( "fmt" "log" "os" "path" "github.com/gobuffalo/packr" "github.com/xeipuuv/gojsonschema" ) // ValidateJSON is used to check for validity func ValidateJSON(doc string) bool { file := path.Join("file:///", GetPath(), "/", doc) s := GetSchema() schemaLoader := gojsonschema.NewStringLoa...
Create generic packr function to get schema
Create generic packr function to get schema
Go
apache-2.0
resumic/schema,resumic/schema
927cc44a64657f5c2cc5a2f22bd051a7fa859d68
server/middleware/current_user.go
server/middleware/current_user.go
package middleware import ( "github.com/gin-gonic/gin" oauth_service "github.com/torinos-io/api/service/oauth_service" user_store "github.com/torinos-io/api/store/user_store" "github.com/torinos-io/api/type/system" ) const ( currentuser = "CurrentUser" ) // SetCurrentUser sets current authenticated user from a...
package middleware import ( "github.com/gin-gonic/gin" oauth_service "github.com/torinos-io/api/service/oauth_service" user_store "github.com/torinos-io/api/store/user_store" "github.com/torinos-io/api/type/system" ) const ( currentUserContextName = "CurrentUser" ) // SetCurrentUser sets current authenticated ...
Rename current user const value name
Rename current user const value name
Go
mit
torinos-io/api,torinos-io/api
17af21e717d343bb11eb0e875fa1b88ae7dd7361
url.go
url.go
package getter import "net/url" // RedactURL is a port of url.Redacted from the standard library, // which is like url.String but replaces any password with "xxxxx". // Only the password in u.URL is redacted. This allows the library // to maintain compatibility with go1.14. func RedactURL(u *url.URL) string { if u =...
package getter import "net/url" // RedactURL is a port of url.Redacted from the standard library, // which is like url.String but replaces any password with "redacted". // Only the password in u.URL is redacted. This allows the library // to maintain compatibility with go1.14. // This port was also extended to redact...
Redact SSH key from URL query parameter
Redact SSH key from URL query parameter Signed-off-by: Guilherme Macedo <27955baead6f80a3d4a3801086221d130d1a451c@suse.com>
Go
mpl-2.0
hashicorp/go-getter
85bb2a28c949625e96d9d6b8c7d08f958cebcb1f
playable.go
playable.go
package melrose import "time" type Playable interface { Play(Player, time.Duration) } type Player interface { PlayNote(Note, time.Duration) PlaySequence(Sequence, singleNoteDuration time.Duration) }
package melrose import "time" type Playable interface { Play(Player, time.Duration) } type Player interface { PlayNote(Note, time.Duration) PlaySequence(Sequence, time.Duration) }
Fix typo in Player interface
Fix typo in Player interface Go was thinking Sequence was a time.Duration, which is silly.
Go
mit
emicklei/melrose
2dad7e6a75806d1cc903b083b4c3ed69ab949764
utils.go
utils.go
package bamstats import ( "encoding/json" "os" log "github.com/Sirupsen/logrus" ) func check(err error) { if err != nil { log.Fatal(err) } } func max(a, b uint32) uint32 { if a < b { return b } return a } func min(a, b uint32) uint32 { if a < b { return a } return b } func OutputJson(stats interf...
package bamstats import ( "bufio" "encoding/json" "io" "os" log "github.com/Sirupsen/logrus" ) func check(err error) { if err != nil { log.Fatal(err) } } func max(a, b uint32) uint32 { if a < b { return b } return a } func min(a, b uint32) uint32 { if a < b { return a } return b } func OutputJs...
Add functions to output stats to file
Add functions to output stats to file
Go
bsd-3-clause
guigolab/bamstats,guigolab/bamstats
2c39fd0fc4e9a245bb3984bcfd38f333c6eaafc0
flag.go
flag.go
package main import ( "flag" "log" "strconv" "git.astuart.co/andrew/limio" ) var t = flag.String("t", "search", "the type of search to perform") var rl = flag.String("r", "", "the rate limit") var nc = flag.Bool("nocache", false, "skip cache") var clr = flag.Bool("clear", false, "clear cache") var downRate int ...
package main import ( "flag" "log" "os" "strconv" "git.astuart.co/andrew/limio" ) var t = flag.String("t", "movie", "the type of search to perform") var rl = flag.String("r", "", "the rate limit") var nc = flag.Bool("nocache", false, "skip cache") var clr = flag.Bool("clear", false, "clear cache") var downRate...
Allow shortening of "tvsearch" to "tv", "SAB_RATE" env, decimal rate arg
Allow shortening of "tvsearch" to "tv", "SAB_RATE" env, decimal rate arg
Go
mit
andrewstuart/dlite
3165608fb29d17d33ebeb88095e8d4c801b7ed68
src/main.go
src/main.go
package main import "os" import "github.com/codegangsta/cli" func main() { app := cli.NewApp() app.Name = "exercism" app.Usage = "fight the loneliness!" app.Action = func(c *cli.Context) { println("Hello friend!") } app.Run(os.Args) }
package main import "os" import "github.com/codegangsta/cli" func main() { app := cli.NewApp() app.Name = "exercism" app.Usage = "A command line tool to interact with http://exercism.io" app.Commands = []cli.Command{ { Name: "demo", ShortName: "d", Usage: "Fetch first assignment for each langu...
Add in all basic exercism commands.
Add in all basic exercism commands.
Go
mit
lcowell/cli,arvidsaur/cli,exercism/cli,Tonkpils/cli,Tonkpils/cli,yeah-right/cli,arvidsaur/cli,yeah-right/cli,Tonkpils/cli,neslom/cli,lcowell/cli,neslom/cli,zabawaba99/cli,exercism/cli,lcowell/cli,yeah-right/cli,arvidsaur/cli,zabawaba99/cli,zabawaba99/cli,neslom/cli
63c68d4b2de4b6cccab1d16472efe9d7bd7e3f7f
main.go
main.go
package main import ( "flag" "fmt" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchevents" ) func main() { var apply bool var dryrun bool var file string flag.BoolVar(&apply, "apply", false, "apply to CloudWatch Events") flag.BoolVar(&dryrun, "dry-run", false, "dry-run"...
package main import ( "flag" "fmt" "io/ioutil" yaml "gopkg.in/yaml.v2" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchevents" ) func main() { var apply bool var dryrun bool var file string flag.BoolVar(&apply, "apply", false, "apply to CloudWatch Events") flag.BoolV...
Load to structs from config yaml file
Load to structs from config yaml file
Go
mit
unasuke/maekawa
31ceaa732741ddbb2c9254ca13ed14ccf6d5aaa5
README.go
README.go
// Package `fmtmail` builds on top of the standard library's `net/mail`, by // adding a single function: // // func WriteMessage(w io.Writer, msg *mail.Message) error // // ...Which outputs the message to `w`. // // The basic functionality already works, but there are still some details // to finish up: // // * Han...
// Package `fmtmail` builds on top of the standard library's `net/mail`, by // adding a single function: // // func WriteMessage(w io.Writer, msg *mail.Message) error // // ...Which outputs the message to `w`. // // The basic functionality already works, but there are still some details // to finish up: // // * Han...
Add a TODO to the readme
Add a TODO to the readme
Go
isc
zenhack/go.fmtmail
7b08eaef24cbded87eea3a47dc76cabcec73bbfe
common/model/host.go
common/model/host.go
package model import ( "fmt" ) type Host struct { Id int Name string } func (this *Host) String() string { return fmt.Sprintf( "<id:%s,name:%s>", this.Id, this.Name, ) }
package model import ( "fmt" ) type Host struct { Id int Name string } func (this *Host) String() string { return fmt.Sprintf( "<id:%d,name:%s>", this.Id, this.Name, ) }
Fix wrong type error in coverage test.
[IN-119] Fix wrong type error in coverage test.
Go
apache-2.0
Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend
d070bd6b739a30f8efe4b20363ba1adc5ece0531
editor/editor_test.go
editor/editor_test.go
package editor import ( "bytes" "strings" "testing" "github.com/elpinal/coco3/config" ) type testScreen struct { } func (ts *testScreen) Refresh(prompt string, s []rune, pos int) { } func (ts *testScreen) SetLastLine(msg string) { } func TestEditor(t *testing.T) { inBuf := strings.NewReader("aaa" + string(Ch...
package editor import ( "bytes" "strings" "testing" "github.com/elpinal/coco3/config" ) type testScreen struct { } func (ts *testScreen) Refresh(prompt string, s []rune, pos int) { } func (ts *testScreen) SetLastLine(msg string) { } func TestEditor(t *testing.T) { inBuf := strings.NewReader("aaa" + string(Ch...
Check if output and error are empty
Check if output and error are empty
Go
mit
elpinal/coco3
14692307d99ad47f6cdc7b00cdb66dad8c6971dc
tools/session.go
tools/session.go
package tools import ( "gopkg.in/mgo.v2" "fmt" "errors" ) type SessionConf struct { Hosts []string Database string } var ( session *mgo.Session ) func InitSession(conf SessionConf) *mgo.Session { var err error dialInfo := mgo.DialInfo{ Addrs: conf.Hosts, Database: conf.Database, } session, err ...
package tools import ( "gopkg.in/mgo.v2" "fmt" "errors" ) type SessionConf mgo.DialInfo var ( session *mgo.Session ) func InitSession(conf *SessionConf) *mgo.Session { var err error session, err = mgo.DialWithInfo((*mgo.DialInfo)(conf)) if err != nil { panic(fmt.Sprintf("Failed to connect to DB server. %s...
Make SessionConf into shortcut type for mgo.DialInfo
Make SessionConf into shortcut type for mgo.DialInfo
Go
apache-2.0
kalcok/jc
558cc60452da006f956fb2da6e2778df2b9cc9aa
common/parallel/parallel_test.go
common/parallel/parallel_test.go
// Copyright 2015 The Chromium 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 parallel import ( "fmt" ) func ExampleFanOutIn() { data := []int{1, 20} err := FanOutIn(func(ch chan<- func() error) { for _, d := range da...
// Copyright 2015 The Chromium 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 parallel import ( "fmt" "sync/atomic" "testing" ) func ExampleFanOutIn() { data := []int{1, 20} err := FanOutIn(func(ch chan<- func() error...
Add race test for parallel
Add race test for parallel There aren't races here, but I figured I might as well add it :). R=dnj@chromium.org, estaab@chromium.org, vadimsh@chromium.org BUG= Review URL: https://codereview.chromium.org/1435753003
Go
apache-2.0
luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go
f76533cb653a281b68473f14d7ee9bebea9ba48a
bans.go
bans.go
package steamapi import ( "net/url" "strconv" "strings" ) type playerBansJSON struct { Players []PlayerBan } // PlayerBan contains all ban status for community, VAC and economy type PlayerBan struct { SteamID uint64 `json:"SteamId,string"` CommunityBanned bool VACBanned bool EconomyBan str...
package steamapi import ( "net/url" "strconv" "strings" ) type playerBansJSON struct { Players []PlayerBan } // PlayerBan contains all ban status for community, VAC and economy type PlayerBan struct { SteamID uint64 `json:"SteamId,string"` CommunityBanned bool VACBanned bool EconomyBan ...
Add missing fields from GetPlayerBans (v1) response
Add missing fields from GetPlayerBans (v1) response
Go
mit
Philipp15b/go-steamapi
1de238dc7bf8902f1d210df841eed6426b0928b5
bench_map_key_lookup_string_from_bytes_test.go
bench_map_key_lookup_string_from_bytes_test.go
package main import ( "fmt" "testing" ) func BenchmarkMapLookupKeyStringFromBytes(b *testing.B) { entries := 4096 lookup := make(map[string]int, entries) for i := 0; i < entries; i++ { lookup[fmt.Sprintf("foo.%d", i)] = -1 } find := []byte("foo.0") b.ResetTimer() for i := 0; i < b.N; i++ { // lookup[s...
package main /* Results -- $ go test -v -bench BenchmarkMap -benchmem testing: warning: no tests to run BenchmarkMapLookupKeyStringFromBytes-4 100000000 19.6 ns/op 0 B/op 0 allocs/op BenchmarkMapSetKeyStringFromBytes-4 20000000 73.8 ns/op ...
Add results for BenchmarkMapLookupKeyStringFromBytes and BenchmarkMapSetKeyStringFromBytes
Add results for BenchmarkMapLookupKeyStringFromBytes and BenchmarkMapSetKeyStringFromBytes
Go
mit
robskillington/benchmarks-go
2ec46e98aee6122f629401bb40c06c1a5f3556a7
type/model/subscription.go
type/model/subscription.go
package model import ( "github.com/guregu/null" ) // Subscription represents user's notification settings. type Subscription struct { ID int `json:"id"` UserID null.Int `json:"user_id"` ProjectUUID string `json:"project_uuid"` Email string `json:"email"` DeletedAt Time `json:"deleted...
package model import ( "github.com/guregu/null" ) // Subscription represents user's notification settings. type Subscription struct { ID int `json:"id" gorm:"primary_key"` UserID null.Int `json:"user_id" gorm:"ForeignKey:ID"` ProjectUUID string `json:"project_uuid" gorm:"ForeignKey:UUID"` E...
Set foreign key information to Subscription
Set foreign key information to Subscription
Go
mit
torinos-io/api,torinos-io/api
c7ea41e910b97dba76ae574a7a9e0538e6fe9ed3
webhooks.go
webhooks.go
package slack import ( "bytes" "encoding/json" "net/http" "github.com/pkg/errors" ) type WebhookMessage struct { Username string `json:"username,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` IconURL string `json:"icon_url,omitempty"` Channel string `json:"cha...
package slack import ( "bytes" "encoding/json" "net/http" "github.com/pkg/errors" ) type WebhookMessage struct { Username string `json:"username,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` IconURL string `json:"icon_url,omitempty"` Channel string `json:"cha...
Support `thread_ts` parameter for Incoming Webhook
Support `thread_ts` parameter for Incoming Webhook
Go
bsd-2-clause
178inaba/slack,james-lawrence/slack,nlopes/slack
2055ca4715326e78bb1d670aaefc3b0c82e01dfd
configuration_test.go
configuration_test.go
package tmdb import ( . "gopkg.in/check.v1" ) func (s *TmdbSuite) TestConfiguration(c *C) { result, err := s.tmdb.Configuration() s.baseTest(&result, err, c) c.Assert(result.Images.BaseURL, Equals, "http://image.tmdb.org/t/p/") c.Assert(result.Images.SecureBaseURL, Equals, "https://image.tmdb.org/t/p/") c.Asser...
package tmdb import ( . "gopkg.in/check.v1" ) func (s *TmdbSuite) TestConfiguration(c *C) { result, err := s.tmdb.Configuration() s.baseTest(&result, err, c) c.Assert(result.Images.BaseURL, Equals, "http://image.tmdb.org/t/p/") c.Assert(result.Images.SecureBaseURL, Equals, "https://image.tmdb.org/t/p/") c.Asser...
Switch assert to HasLen checker
Switch assert to HasLen checker
Go
mit
ryanbradynd05/go-tmdb,ryanbradynd05/go-tmdb,ryanbradynd05/go-tmdb
ad63b9c0275dff00bdbdceed7e724295bbf0e943
model/model_nonjs.go
model/model_nonjs.go
// +build !js package model import ( "context" "github.com/flimzy/kivik" _ "github.com/flimzy/kivik/driver/memory" // Memory driver ) func localConnection() (kivikClient, error) { c, err := kivik.New(context.Background(), "memory", "local") if err != nil { return nil, err } return wrapClient(c), nil } fun...
// +build !js package model import ( "context" "github.com/flimzy/kivik" _ "github.com/go-kivik/memorydb" // Kivik Memory driver ) func localConnection() (kivikClient, error) { c, err := kivik.New(context.Background(), "memory", "local") if err != nil { return nil, err } return wrapClient(c), nil } func r...
Switch to new memory driver location
Switch to new memory driver location
Go
mit
FlashbackSRS/flashback,flimzy/flashback,flimzy/flashback,FlashbackSRS/flashback,flimzy/flashback,FlashbackSRS/flashback
5f1b48afb2f772e2967bb7aa8c3743de5c8b6c47
main/common.go
main/common.go
package main import ( . "fmt" "polydawn.net/dockctrl/confl" "polydawn.net/dockctrl/crocker" ) /* Helps run anything that requires a docker connection. Handles creation & cleanup in one place. Docker daemon config is determined by looking around the cwd. */ func WithDocker(fn func(*crocker.Dock, *confl.ConfigLoa...
package main import ( . "fmt" "polydawn.net/dockctrl/confl" "polydawn.net/dockctrl/crocker" ) /* Helps run anything that requires a docker connection. Handles creation & cleanup in one place. Docker daemon config is determined by looking around the cwd. */ func WithDocker(fn func(*crocker.Dock, *confl.ConfigLoa...
Use a parent's dock folder if found.
Use a parent's dock folder if found.
Go
apache-2.0
polydawn/hroot,polydawn/hroot
01405c864b6a133cd33c8477ff056dafe41b86ee
packer/rpc/ui_test.go
packer/rpc/ui_test.go
package rpc import ( "cgl.tideland.biz/asserts" "net/rpc" "testing" ) type testUi struct { sayCalled bool sayFormat string sayVars []interface{} } func (u *testUi) Say(format string, a ...interface{}) { u.sayCalled = true u.sayFormat = format u.sayVars = a } func TestUiRPC(t *testing.T) { assert := assert...
package rpc import ( "cgl.tideland.biz/asserts" "net/rpc" "testing" ) type testUi struct { sayCalled bool sayFormat string sayVars []interface{} } func (u *testUi) Say(format string, a ...interface{}) { u.sayCalled = true u.sayFormat = format u.sayVars = a } func TestUiRPC(t *testing.T) { assert := assert...
Use the proper Server for tests
packer/rpc: Use the proper Server for tests
Go
mpl-2.0
pvandervelde/packer,beni55/packer,beni55/packer,rickard-von-essen/packer,bradparks/packer__create_vm_for_aws_docker_vagrant_etc,smaato/packer,Sheile/packer,msabramo/packer,pvandervelde/packer,styro/packer,dayglojesus/packer,trumant/packer,pecigonzalo/packer,Akasurde/packer,ricardclau/packer,yonglehou/packer,pecigonzalo...
46506118c33c960d82d87a822c3ac99dfaeaa494
main.go
main.go
package storageconsul import ( "github.com/caddyserver/caddy/v2" "github.com/caddyserver/certmagic" ) type TLSConsul struct { storage *ConsulStorage } func init() { caddy.RegisterModule(TLSConsul{}) } func (TLSConsul) CaddyModule() caddy.ModuleInfo { return caddy.ModuleInfo{ ID: "caddy.storage.tlsconsul", ...
package storageconsul import ( "github.com/caddyserver/caddy/v2" "github.com/caddyserver/certmagic" ) type TLSConsul struct { storage *ConsulStorage } func init() { caddy.RegisterModule(&TLSConsul{}) } func (TLSConsul) CaddyModule() caddy.ModuleInfo { return caddy.ModuleInfo{ ID: "caddy.storage.tlsconsul", ...
Change to use pointer receiver
Change to use pointer receiver
Go
apache-2.0
pteich/caddy-tlsconsul
8366af8a08f06687fa9538154c70209497fd1cc5
main.go
main.go
package main import ( "github.com/larzconwell/moln/config" "github.com/larzconwell/moln/loggers" "log" "os" "path/filepath" ) func main() { env := "development" if len(os.Args) > 1 { env = os.Args[1] } conf, err := config.ReadFiles("config/environment.json", "config/"+env+".json") if err != nil { log.F...
package main import ( "github.com/gorilla/mux" "github.com/larzconwell/moln/config" "github.com/larzconwell/moln/loggers" "log" "net/http" "os" "path/filepath" ) func main() { env := "development" if len(os.Args) > 1 { env = os.Args[1] } conf, err := config.ReadFiles("config/environment.json", "config/"...
Add router and start server
Add router and start server
Go
mit
larzconwell/moln,larzconwell/moln
82d30addc5b6bdbe27f8c21fca830274d909d6c6
frame/sequence.go
frame/sequence.go
package frame // Interface Sequence is used to manipulate with frames, which can be used more // than one time (e.g. APIC, COMM, USLT, SYLT and etc.) type Sequencer interface { AddFrame(Framer) Frames() []Framer }
package frame // Interface Sequence is used to manipulate with frames, which can be in tag // more than one (e.g. APIC, COMM, USLT, SYLT and etc.) type Sequencer interface { AddFrame(Framer) Frames() []Framer }
Make clearer comment in Sequencer interface
Make clearer comment in Sequencer interface
Go
mit
bogem/id3v2
40e7cbe4c32a14253adbb9cb4cc5a17560f16814
main.go
main.go
package main import ( "github.com/simon-engledew/gocmdpev/gopev" "io/ioutil" "github.com/fatih/color" "log" "os" ) func main() { buffer, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatalf("%v", err) } // fmt.Println(string(buffer)) err = gopev.Visualize(color.Output, buffer) if e...
package main import ( "github.com/simon-engledew/gocmdpev/gopev" "gopkg.in/alecthomas/kingpin.v2" "io/ioutil" "github.com/fatih/color" "log" "os" ) func main() { kingpin.CommandLine.HelpFlag.Short('h') kingpin.CommandLine.Version("1.0.0") kingpin.CommandLine.VersionFlag.Short('v') kingpin.Parse() ...
Use kingpin to add a -v/-h to use as Homebrew's test method
Use kingpin to add a -v/-h to use as Homebrew's test method
Go
mit
simon-engledew/gocmdpev
2856f7cfb5abe5a4dd55b57e4dd21ad260711aad
try.go
try.go
package meep func Try(fn func(), plan TryPlan) { defer func() { if err := coerce(recover()); err != nil { plan.MustHandle(err) } }() fn() } func coerce(rcvrd interface{}) error { switch err := rcvrd.(type) { case nil: // Panics of nils are possible btw but super absurd. Never do it. return nil case ...
package meep func RecoverPanics(fn func()) (e error) { defer func() { e = coerce(recover()) }() fn() return } func Try(fn func(), plan TryPlan) { plan.MustHandle(RecoverPanics(fn)) } func coerce(rcvrd interface{}) error { switch err := rcvrd.(type) { case nil: // Panics of nils are possible btw but super ...
Add RecoverPanics helper function that's almost entirely unopinionated.
Add RecoverPanics helper function that's almost entirely unopinionated. (Except for opinions about non-`error` panics, which still get a little bit of a treatment.) This is so continuously desirable in testing situations that having it on hand seems reasonable. Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5...
Go
apache-2.0
polydawn/meep,polydawn/meep
386a6a88c80998a3214af9001935eb5335fd7fc6
server/client_pool.go
server/client_pool.go
package server import ( "errors" "sync" ) type ClientPool struct { mutex sync.RWMutex clients map[string]*Client } func NewClientPool() *ClientPool { p := new(ClientPool) p.clients = make(map[string]*Client) return p } func (cp *ClientPool) Add(c *Client) error { cp.mutex.Lock() defer cp.mutex.Unlock() ...
package server import ( "errors" "sync" ) type ClientPool struct { mutex sync.RWMutex clients map[string]*Client } func NewClientPool() *ClientPool { p := new(ClientPool) p.clients = make(map[string]*Client) return p } func (cp *ClientPool) Add(c *Client) error { cp.mutex.Lock() defer cp.mutex.Unlock() ...
Remove broadcast from the client pool
Remove broadcast from the client pool
Go
mit
MStoykov/mazungumzo
635dfa6a30f9227809296d528839dbca10a36b19
cmd/mk/mk.go
cmd/mk/mk.go
package main import ( "fmt" "log" "os" "os/exec" "path/filepath" ) const FILE string = "Makefile" const PROG string = "make" /* TODO: add stopping at homedir configurable filename for aliases? */ func main() { checkDir, err := os.Getwd() if err != nil { log.Fatal(err) } for { //fmt.Println("Checking:", ...
package main import ( "fmt" "os" "os/exec" "path/filepath" ) const FILE string = "Makefile" const PROG string = "make" /* TODO: add stopping at homedir configurable filename for aliases? */ func main() { checkDir, err := os.Getwd() if err != nil { fmt.Println("Error getting working directory:", err) os.Exi...
Fix infinite loop at root dir if nothing is found
Fix infinite loop at root dir if nothing is found
Go
mit
wnh/home.bin
f3e9154a707d5cd2fb288cbfe625cee64b122087
config/options.go
config/options.go
package config import ( "log" "os" "path/filepath" "code.google.com/p/gcfg" ) const Version = "0.1a" const DEFAULT_NICKNAME = "perpetua" const DEFAULT_USER = "perpetua" var BASE_DIR = filepath.Join(os.ExpandEnv("$HOME"), ".perpetua") var CONFIG_FILE = filepath.Join(BASE_DIR, "perpetua.gcfg") var DATABASE_FILE ...
package config import ( "log" "os" "path/filepath" "code.google.com/p/gcfg" ) const Version = "0.1a" const DEFAULT_LANG = "en" const DEFAULT_NICKNAME = "perpetua" const DEFAULT_USER = "perpetua" var BASE_DIR = filepath.Join(os.ExpandEnv("$HOME"), ".perpetua") var CONFIG_FILE = filepath.Join(BASE_DIR, "perpetu...
Add an option to handle language: default to en
Add an option to handle language: default to en
Go
bsd-3-clause
eriol/perpetua
6428a6cfc41e39fbc377f4182b80be28bd3dffef
census.go
census.go
// The census package is used to query data from the census API. // // It's centered more so around data from Planetside 2 package census import ( "strings" ) var BaseURL = "http://census.daybreakgames.com/" var BaseURLOld = "http://census.soe.com/" func init() { //BaseURL = BaseURLOld } // CensusData is a struct...
// The census package is used to query data from the census API. // // It's centered more so around data from Planetside 2 package census import ( "strings" ) var BaseURL = "http://census.daybreakgames.com/" var BaseURLOld = "http://census.soe.com/" func init() { //BaseURL = BaseURLOld } // CensusData is a struct...
Change embeded struct CensusData's error structure
Change embeded struct CensusData's error structure
Go
mit
THUNDERGROOVE/census
dd8d8d63a3b7930a85815ba1090ca178a63159bb
controller/rpc.go
controller/rpc.go
package main import ( "net/http" "time" ct "github.com/flynn/flynn/controller/types" "github.com/flynn/flynn/pkg/rpcplus" rpc "github.com/flynn/flynn/pkg/rpcplus/comborpc" ) func rpcHandler(repo *FormationRepo) http.Handler { rpcplus.RegisterName("Controller", &ControllerRPC{formations: repo}) return rpc.New(...
package main import ( "net/http" "time" ct "github.com/flynn/flynn/controller/types" "github.com/flynn/flynn/pkg/rpcplus" rpc "github.com/flynn/flynn/pkg/rpcplus/comborpc" ) func rpcHandler(repo *FormationRepo) http.Handler { rpcplus.RegisterName("Controller", &ControllerRPC{formations: repo}) return rpc.New(...
Fix break scope in StreamFormations
controller: Fix break scope in StreamFormations Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>
Go
bsd-3-clause
justintung/flynn,felixrieseberg/flynn,mubassirhayat/flynn,jzila/flynn,flynn/flynn,TribeMedia/flynn,benbjohnson/flynn,schatt/flynn,TribeMedia/flynn,kgrz/flynn,jzila/flynn,TribeMedia/flynn,tonicbupt/flynn,tonicbupt/flynn,GrimDerp/flynn,whouses/flynn,arekkas/flynn,Brandywine2161/flynn,kgrz/flynn,whouses/flynn,schatt/flynn...
ad8e5980606c5e4bc1bc1a140ddc24f2a626969c
oci/mounts_freebsd.go
oci/mounts_freebsd.go
/* Copyright The containerd Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
/* Copyright The containerd Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
Remove empty mount option slice for FreeBSD
oci: Remove empty mount option slice for FreeBSD Mount options are marked `json:omitempty`. An empty slice in the default object caused TestWithSpecFromFile to fail. Signed-off-by: Samuel Karp <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@samuelkarp.com>
Go
apache-2.0
containerd/containerd,mikebrow/containerd,containerd/containerd,estesp/containerd,thaJeztah/containerd,mikebrow/containerd,thaJeztah/containerd,estesp/containerd
ac7a33826c035068fbd85b7c51f17a941793590f
finder/mock.go
finder/mock.go
package finder import ( "context" ) type MockFinder struct { result [][]byte // from new query string // logged from execute } func NewMockFinder(result [][]byte) *MockFinder { return &MockFinder{ result: result, } } func (m *MockFinder) Execute(ctx context.Context, query string, from int64, until int64) ...
package finder import ( "context" ) // MockFinder is used for testing purposes type MockFinder struct { result [][]byte // from new query string // logged from execute } // NewMockFinder returns new MockFinder object with given result func NewMockFinder(result [][]byte) *MockFinder { return &MockFinder{ res...
Document MockFinder, add Strings method
Document MockFinder, add Strings method
Go
mit
lomik/graphite-clickhouse,lomik/graphite-clickhouse
4ce854b81fe1c3731952a4885845f647f425aed9
gmws/gmws.go
gmws/gmws.go
package gmws import ( "os" "github.com/svvu/gomws/mwsHttps" ) // MwsConfig is configuraton to create the gomws base. // AccessKey and SecretKey are optional, bette to set them in evn variables. type MwsConfig struct { SellerId string AuthToken string Region string AccessKey string SecretKey string } // M...
package gmws import ( "fmt" "os" "github.com/kr/pretty" "github.com/svvu/gomws/mwsHttps" ) // MwsConfig is configuraton to create the gomws base. // AccessKey and SecretKey are optional, bette to set them in evn variables. type MwsConfig struct { SellerId string AuthToken string Region string AccessKey s...
Add pretty lib to inspect struct
Add pretty lib to inspect struct
Go
mit
ShijunWu/gomws,svvu/gomws
c8a756944d81687cc756f1f6a10466eee88e63e1
internal/util/util.go
internal/util/util.go
package util import ( "go/format" "regexp" ) func GoFmt(buf string) string { formatted, err := format.Source([]byte(buf)) if err != nil { panic(err) } return string(formatted) } var reTrim = regexp.MustCompile("\\s") func Trim(s string) string { return reTrim.ReplaceAllString(s, "") }
package util import ( "fmt" "go/format" "regexp" ) func GoFmt(buf string) string { formatted, err := format.Source([]byte(buf)) if err != nil { panic(fmt.Errorf("%s\nOriginal code:\n%s", err.Error(), buf)) } return string(formatted) } var reTrim = regexp.MustCompile("\\s") func Trim(s string) string { ret...
Print code on failed GoFmt
Print code on failed GoFmt
Go
apache-2.0
ruseinov/aws-sdk-go,jasdel/aws-sdk-go,radeksimko/aws-sdk-go,rail/aws-sdk-go,marcosnils/aws-sdk-go,zmarois/aws-sdk-go,matematik7/aws-sdk-go,yxd-hde/aws-sdk-go,digantsh/aws-sdk-go,keithpitt/aws-sdk-go,bpot/aws-sdk-go,agworld/aws-sdk-go,fwiesel/aws-sdk-go,calgaryscientific/aws-sdk-go,calgaryscientific/aws-sdk-go,dafyddcro...
a5cbbb8b5ac8b133ca943888c58edfe4502067ae
src/restic/pack/loader.go
src/restic/pack/loader.go
package pack import ( "errors" "restic/backend" ) // Loader loads data from somewhere at a given offset. In contrast to // io.ReaderAt, off may be negative, in which case it references a position // relative to the end of the file (similar to Seek()). type Loader interface { Load(p []byte, off int64) (int, error) ...
package pack import ( "errors" "restic/backend" ) // Loader loads data from somewhere at a given offset. In contrast to // io.ReaderAt, off may be negative, in which case it references a position // relative to the end of the file (similar to Seek()). type Loader interface { Load(p []byte, off int64) (int, error) ...
Fix BufferLoader for negative offset
Fix BufferLoader for negative offset
Go
bsd-2-clause
restic/restic,kurin/restic,byo/restic,middelink/restic,jayme-github/restic,restic/restic,stuertz/restic,fawick/restic,kurin/restic,ckemper67/restic,ar-jan/restic,arithmetric/restic,jayme-github/restic,fawick/restic,stuertz/restic,middelink/restic,ar-jan/restic,byo/restic
3d4176df547cf7a4dceca5e488cc283681065364
pkg/image/resolve.go
pkg/image/resolve.go
package image import ( "path" "strings" "github.com/rancher/rancher/pkg/settings" ) func Resolve(image string) string { reg := settings.SystemDefaultRegistry.Get() if reg != "" && !strings.HasPrefix(image, reg) { return path.Join(reg, image) } return image }
package image import ( "path" "strings" "github.com/rancher/rancher/pkg/settings" ) func Resolve(image string) string { reg := settings.SystemDefaultRegistry.Get() if reg != "" && !strings.HasPrefix(image, reg) { //Images from Dockerhub Library repo, we add rancher prefix when using private registry if !str...
Add `rancher/` prefix for images from dockerhub library
Add `rancher/` prefix for images from dockerhub library
Go
apache-2.0
cjellick/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher,cjellick/rancher
d0631c8d725713ac3138359fab1dae915eb030cb
test/test_postgres.go
test/test_postgres.go
package main import ( "bytes" c "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-check" "github.com/flynn/flynn/pkg/exec" ) type PostgresSuite struct { Helper } var _ = c.ConcurrentSuite(&PostgresSuite{}) // Check postgres config to avoid regressing on https://github.com/flynn/flynn/issues/101...
package main import ( c "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-check" ) type PostgresSuite struct { Helper } var _ = c.ConcurrentSuite(&PostgresSuite{}) // Check postgres config to avoid regressing on https://github.com/flynn/flynn/issues/101 func (s *PostgresSuite) TestSSLRenegotiation...
Use `flynn psql` for TestSSLRenegotiationLimit
test: Use `flynn psql` for TestSSLRenegotiationLimit This avoids reimplementing the psql run logic in two places and tests `flynn psql`. Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>
Go
bsd-3-clause
tonicbupt/flynn,pkdevbox/flynn,arekkas/flynn,whouses/flynn,supermario/flynn,TribeMedia/flynn,pkdevbox/flynn,benbjohnson/flynn,tonicbupt/flynn,clifff/flynn,justintung/flynn,whouses/flynn,arekkas/flynn,jzila/flynn,lmars/flynn,josephglanville/flynn,schatt/flynn,justintung/flynn,TribeMedia/flynn,GrimDerp/flynn,schatt/flynn...
53cb2dfe8aee123419562476d24181a6b6f2874c
2019/day05/second/day05b.go
2019/day05/second/day05b.go
package main import ( "strings" "github.com/bewuethr/advent-of-code/go/convert" "github.com/bewuethr/advent-of-code/go/intcode" "github.com/bewuethr/advent-of-code/go/ioutil" "github.com/bewuethr/advent-of-code/go/log" ) func main() { scanner, err := ioutil.GetInputScanner() if err != nil { log.Die("getting...
package main import ( "fmt" "strings" "github.com/bewuethr/advent-of-code/go/convert" "github.com/bewuethr/advent-of-code/go/intcode" "github.com/bewuethr/advent-of-code/go/ioutil" "github.com/bewuethr/advent-of-code/go/log" ) func main() { scanner, err := ioutil.GetInputScanner() if err != nil { log.Die("...
Update 2019 day 5, second part for new intcode computer
Update 2019 day 5, second part for new intcode computer
Go
mit
bewuethr/advent_of_code,bewuethr/advent_of_code,bewuethr/advent_of_code
c7dca71a2d6eb68d062ea035a3c01da268151281
gaupoitExamples/examples.go
gaupoitExamples/examples.go
//this file contains several examples by Golang package main import ( "fmt" ) func main() { //Check if number is odd or even fmt.Print("Enter a number: ") var number int fmt.Scanf("%d", &number) if (number % 2 == 0) { fmt.Printf("%d is even number\n", number) } else { fmt.Printf("%d is odd number\n", num...
//this file contains several examples by Golang package main import ( "fmt" ) func main() { checkNumberIsEvenOrOdd() } func checkNumberIsEvenOrOdd() { fmt.Print("Enter a number: ") var number int fmt.Scanf("%d", &number) if (number % 2 == 0) { fmt.Printf("%d is even number\n", number) } else { fmt.Pr...
Refactor code, move the code in main function to the other function
Refactor code, move the code in main function to the other function
Go
mit
gaupoit/goRepository
f35e4ea0d2371e53dc7dc284ea5c2c9c581c3b07
handle/hostinfo.go
handle/hostinfo.go
package handle import ( "github.com/smotti/ircx" "github.com/smotti/tad/config" "github.com/smotti/tad/report" "github.com/sorcix/irc" ) // CmdHostOs handles the CMD_HOST_OS bot command, by sending back data about // the hosts operating system gathered by CFEngine. func CmdHostOs(s ircx.Sender, m *irc.Message) { ...
package handle import ( "github.com/smotti/ircx" "github.com/smotti/tad/config" "github.com/smotti/tad/report" "github.com/sorcix/irc" ) // CmdHostOs handles the CMD_HOST_OS bot command, by sending back data about // the hosts operating system gathered by CFEngine. func CmdHostOs(s ircx.Sender, m *irc.Message) { ...
Fix missing call to Params
Fix missing call to Params
Go
unlicense
smotti/cfengine-tad
ff25ae17c5ea12556f0900944740aa2fcac6b39a
options_env.go
options_env.go
package gorocksdb // #include "rocksdb/c.h" import "C" // EnvOptions represents options for env. type EnvOptions struct { c *C.rocksdb_envoptions_t } // NewDefaultEnvOptions creates a default EnvOptions object. func NewDefaultEnvOptions() *EnvOptions { return NewNativeEnvOptions(C.rocksdb_envoptions_create()) } /...
package gorocksdb // #include "rocksdb/c.h" import "C" // EnvOptions represents options for env. type EnvOptions struct { c *C.rocksdb_envoptions_t } // NewDefaultEnvOptions creates a default EnvOptions object. func NewDefaultEnvOptions() *EnvOptions { return NewNativeEnvOptions(C.rocksdb_envoptions_create()) } /...
Add Destroy method for EnvOption
Add Destroy method for EnvOption
Go
mit
tecbot/gorocksdb,tecbot/gorocksdb
6c2a06f97f03a1170b592f366e42a4dc229fc85a
packet_test.go
packet_test.go
package node import ( "encoding/json" "testing" ) func TestPacketMarshalling(t *testing.T) { sk, _ := NewECDSAKey() m := Packet{sk.PublicKey().Hash(), 3, "test"} b, err := json.Marshal(m) if err != nil { t.Fatal(err) } var m2 Packet err = json.Unmarshal(b, &m2) if err != nil { t.Fatal(err) } if m2 != ...
package node import ( "encoding/json" "testing" ) func TestPacketMarshalling(t *testing.T) { sk, _ := NewECDSAKey() m := Packet{sk.PublicKey().Hash(), 3, "test"} b, err := json.Marshal(m) if err != nil { t.Fatal(err) } var m2 Packet err = json.Unmarshal(b, &m2) if err != nil { t.Fatal(err) } if m2 != ...
Make sure Packet.String() doesn't crash
Make sure Packet.String() doesn't crash
Go
mit
AutoRoute/node,AutoRoute/node
c23a2f4ae8e82058b5b123b33b331cec098bd6c9
schema/parser_test.go
schema/parser_test.go
package schema import "testing" func TestParse(t *testing.T) { text := ` package users from locale import Location // this is a comment // This is also a comment // This is one too type User { // version comment version 1 { required string uuid req...
package schema import "testing" func TestParse(t *testing.T) { text := ` package users from locale import Location // this is a comment // This is also a comment // This is one too type User { // version comment version 1 { required string uuid req...
Fix parser test compile errors
Fix parser test compile errors
Go
mit
swiftkick-io/namedtuple,blacklabeldata/namedtuple
a9894e2dce3ecfd2a17e6a3f8c3c317b05a750e6
hack/tools.go
hack/tools.go
// +build tools /* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
// +build tools /* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
Remove tool deps which are now handled by repo-infra
Remove tool deps which are now handled by repo-infra
Go
apache-2.0
GoogleCloudPlatform/testgrid,GoogleCloudPlatform/testgrid,GoogleCloudPlatform/testgrid,GoogleCloudPlatform/testgrid,GoogleCloudPlatform/testgrid,GoogleCloudPlatform/testgrid
7598c409732afa6d8b1c6e20527cb475c216a20d
gosearch_test.go
gosearch_test.go
package main import "testing" func TestFoo(t *testing.T) { }
package main import ( "strings" "testing" ) func TestMarkDownLinkWithDeprecatedNote(t *testing.T) { s := "* [go-lang-idea-plugin](https://github.com/go-lang-plugin-org/go-lang-idea-plugin) (deprecated) - The previous Go plugin for IntelliJ (JetBrains) IDEA, now replaced by the official plugin (above)." parts := s...
Add test for corner case with (deprecated)
Add test for corner case with (deprecated)
Go
mit
hvnsweeting/gosearch,hvnsweeting/gosearch
3865a8069ea3feb520dd23550b0fa19d04a6f26b
templates/content.go
templates/content.go
package templates func ScopeTemplateContent() string { return `#cloud-config {{ .Name}}: {{ range .Services }}{{ .GetName }}: {{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }} {{ end }} {{ end }}units: {{ range .Units }}- name: {{ .GetName }} command: {{ .GetCommand }} {{ end...
package templates func ScopeTemplateContent() string { return `#cloud-config {{ .Name}}: {{ range .Services }}{{ .GetName }}: {{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }} {{ end }} {{ end }}units: {{ range .Units }}- name: {{ .GetName }} command: {{ .GetCommand }} {{ e...
Fix identation error on template
Fix identation error on template
Go
apache-2.0
bernardolins/clustereasy,bernardolins/clustereasy
500fa50ecc2da00f42cee67b43f514577515c4ca
main_test.go
main_test.go
package main import ( "testing" ) func TestParseTemplateFiles(t *testing.T) { parse := parseTemplateFiles(templatePath) t.Log(parse) }
package main import ( "testing" ) // At moment I'm studding testing procedure in golang func TestParseTemplateFiles(t *testing.T) { t.Error("This is an error") }
Add firts demo test function for studding testing procedure in golang
Add firts demo test function for studding testing procedure in golang
Go
bsd-2-clause
davidescus/simple-web-app,davidescus/simple-web-app,davidescus/simple-web-app
95c30f519bfcbbb7af6df834b0121a2d039efc92
models/listresult.go
models/listresult.go
package models import ( "reflect" "gopkg.in/mgo.v2/bson" ) type ListResult struct { List interface{} `json:"list"` HasMore bool `json:"hasMore"` Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Pages int `json:"pages"` } func (b *Bas...
package models import ( "reflect" "gopkg.in/mgo.v2/bson" ) type ListResult struct { List interface{} `json:"list"` HasMore bool `json:"hasMore"` Total int `json:"total"` Count int `json:"count"` Page int `json:"page"` Pages int `json:"pages"` } func (b *Bas...
Fix an off by one error
Fix an off by one error
Go
mpl-2.0
sebest/hooky,danieldc/hooky,danieldc/hooky,sebest/hooky
1d0f638ac2b262a3719bedfe2a2d504d112e16a4
server/types/post.go
server/types/post.go
package types import ( "time" "github.com/joshheinrichs/geosource/server/types/fields" ) // "github.com/joshheinrichs/geosource/server/transactions" type PostInfo struct { Id string `json:"id" gorm:"column:p_postid"` CreatorId string `json:"creator" gorm:"column:p_userid_creator"` Channel string...
package types import ( "time" "github.com/joshheinrichs/geosource/server/types/fields" ) type PostInfo struct { Id string `json:"id" gorm:"column:p_postid"` CreatorId string `json:"creator" gorm:"column:p_userid_creator"` Channel string `json:"channel" gorm:"column:p_channelname"` Title s...
Remove a commented out, unused import
Remove a commented out, unused import
Go
mit
Decateron/geosource,Decateron/geosource,Decateron/geosource
5df7b3485d5b0d07341e097faf4dac457766fdd3
service/machinelearning/customizations.go
service/machinelearning/customizations.go
package machinelearning import ( "net/url" "github.com/awslabs/aws-sdk-go/aws" ) func init() { initRequest = func(r *aws.Request) { r.Handlers.Build.PushBack(updatePredictEndpoint) } } // updatePredictEndpoint rewrites the request endpoint to use the // "PredictEndpoint" parameter of the Predict operation. fu...
package machinelearning import ( "net/url" "github.com/awslabs/aws-sdk-go/aws" ) func init() { initRequest = func(r *aws.Request) { switch r.Operation { case opPredict: r.Handlers.Build.PushBack(updatePredictEndpoint) } } } // updatePredictEndpoint rewrites the request endpoint to use the // "PredictEn...
Fix MachineLearning.Predict() customization to only run on Predict()
Fix MachineLearning.Predict() customization to only run on Predict()
Go
apache-2.0
dragonfax/aws-sdk-go,keithpitt/aws-sdk-go,jkakar/aws-sdk-go,ebartels/aws-sdk-go,digantsh/aws-sdk-go,jjeffery/aws-sdk-go,jasdel/aws-sdk-go,radeksimko/aws-sdk-go,rosenhouse/aws-sdk-go,xibz/aws-sdk-go,rail/aws-sdk-go,digantsh/aws-sdk-go,gunosy/aws-sdk-go,vito/aws-sdk-go,myshen/aws-sdk-go,jkakar/aws-sdk-go,wolfspyre/aws-sd...
e85d05fef61ff27773e25a38fc2f4ec5bdd2264b
client/container_start_test.go
client/container_start_test.go
package client import ( "bytes" "io/ioutil" "net/http" "testing" "golang.org/x/net/context" ) func TestContainerStartError(t *testing.T) { client := &Client{ transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")), } err := client.ContainerStart(context.Background(), "nothi...
package client import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "testing" "golang.org/x/net/context" ) func TestContainerStartError(t *testing.T) { client := &Client{ transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")), } err := client.ContainerStart(cont...
Add test for valid json supplied in 'start' request
Add test for valid json supplied in 'start' request Signed-off-by: Bryan Boreham <de652539b24efdf404b95def4635bf3dbfd846aa@gmail.com>
Go
apache-2.0
jwhonce/engine-api,docker/engine-api,vdemeester/engine-api,thaJeztah/engine-api
7d968f34a2a9427204bfa6e713b90b8bc7d7dad4
test/extended/idling/util.go
test/extended/idling/util.go
package idling import ( "time" "github.com/openshift/origin/pkg/util/errors" exutil "github.com/openshift/origin/test/extended/util" kapi "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/util/wait" ) func waitForEndpointsAvailable(oc *exutil.CLI, serviceName string) error { return wait.Poll(200*time.Millisec...
package idling import ( "time" "github.com/openshift/origin/pkg/util/errors" exutil "github.com/openshift/origin/test/extended/util" kapi "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/util/wait" ) func waitForEndpointsAvailable(oc *exutil.CLI, serviceName string) error { return wait.Poll(200*time.Millisec...
Increase timeouts for idling extended test
Increase timeouts for idling extended test
Go
apache-2.0
enj/origin,dmage/origin,elyscape/origin,raffaelespazzoli/origin,maxamillion/origin,mfojtik/origin,sferich888/origin,sspeiche/origin,matthyx/origin,jim-minter/origin,ryanj/origin,wanghaoran1988/origin,danmcp/origin,pweil-/origin,enj/origin,pravisankar/origin,jsafrane/origin,pecameron/origin,jeremyeder/origin,php-coder/o...
ec6709764629c64904d63f799dca9954fafe34e6
reflection_test.go
reflection_test.go
package framework import ( "reflect" "testing" ) func Test_getMethods_OneMethod(t *testing.T) { testType := reflect.TypeOf(TestController{}) methods := getMethods(testType) expectedLen, actualLen := 1, len(methods) if expectedLen != actualLen { t.Errorf("Expected a count of %v but got %v", expectedLen, ac...
package framework import ( "reflect" "testing" ) func Test_getMethods_OneMethod(t *testing.T) { testType := reflect.TypeOf(TestController{}) methods := getMethods(testType) expectedLen, actualLen := 2, len(methods) if expectedLen != actualLen { t.Errorf("Expected a count of %v but got %v", expectedLen, ac...
Update tests to include render template function
Update tests to include render template function
Go
mit
icambridge-old/framework
688118c4b015dd6772693c36ebaeb5ce8cd1990b
input/text.go
input/text.go
package input import ( "github.com/antonienko/goandroid/device" "strings" ) // TextInput struct represents a text input subsystem for associated device. type TextInput struct { dev device.Device // Associated device } // NewTextInput method returns a new TextInput struct which is associated with // given device. ...
package input import ( "github.com/antonienko/goandroid/device" "strings" ) // TextInput struct represents a text input subsystem for associated device. type TextInput struct { dev device.Device // Associated device } // NewTextInput method returns a new TextInput struct which is associated with // given device. ...
Return error on the EnterText action
Return error on the EnterText action
Go
mit
antonienko/goandroid
b34aa2c43af424dd53718db6008874029b33a20d
pkg/pci/parse.go
pkg/pci/parse.go
package pci import ( "bufio" "bytes" ) func isHex(b byte) bool { return ('a' <= b && b <= 'f') || ('A' <= b && b <= 'F') || ('0' <= b && b <= '9') } // scan searches for Vendor and Device lines from the input *bufio.Scanner based // on pci.ids format. Found Vendors and Devices are added to the input map. // This ...
package pci import ( "bufio" "bytes" ) func isHex(b byte) bool { return ('a' <= b && b <= 'f') || ('A' <= b && b <= 'F') || ('0' <= b && b <= '9') } // scan searches for Vendor and Device lines from the input *bufio.Scanner based // on pci.ids format. Found Vendors and Devices are added to the input ids map. func...
Add condition on scan of pci.ids to exclude sub-classes from being caught up as a device.
Add condition on scan of pci.ids to exclude sub-classes from being caught up as a device.
Go
bsd-3-clause
hugelgupf/u-root,hugelgupf/u-root,rminnich/u-root,GanShun/u-root,hugelgupf/u-root,rminnich/u-root,GanShun/u-root,hugelgupf/u-root,u-root/u-root,u-root/u-root,u-root/u-root,rminnich/u-root,GanShun/u-root,rminnich/u-root
1a76f94868e36fc7fe3747e4715a97ea0295a0f2
read-file.go
read-file.go
package main import ( "fmt" _ "io/ioutil" "os" ) func main() { //f, err := ioutil.ReadFile("README.md") f, err := os.Open("README.md") if err != nil { return } fmt.Println(f.Name()) }
package main import ( "fmt" "io/ioutil" "os" ) func main() { file, err := ioutil.ReadFile("README.md") if err != nil { fmt.Println(err) os.Exit(1) } text := string(file) fmt.Println(text) }
Update read file example to actually work
Update read file example to actually work
Go
mit
rollbrettler/go-playground
62c1c6813b265f3796956ab58a174b0187798126
post_entities.go
post_entities.go
package tumblr // Defines each subtype of Post (see consts below) and factory methods // Post Types const ( Text = "text" Quote = "quote" Link = "link" Answer = "answer" Video = "video" Audio = "audio" Photo = "photo" Chat = "chat" ) // Stuff in the "response":"posts" field type Post struct { Blog...
package tumblr // Defines each subtype of Post (see consts below) and factory methods // Post Types const ( Text = "text" Quote = "quote" Link = "link" Answer = "answer" Video = "video" Audio = "audio" Photo = "photo" Chat = "chat" ) // Stuff in the "response":"posts" field type Post struct { Blog...
Add Photo, Quote, Link posts
Add Photo, Quote, Link posts
Go
mit
hut8/tumblr-go
f8661549879852391084fd8445b995833d7da8f1
testing/constants.go
testing/constants.go
// Copyright 2012, 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package testing import ( "time" "launchpad.net/juju-core/utils" ) // ShortWait is a reasonable amount of time to block waiting for something that // shouldn't actually happen. (as in, the test suite will *actually* ...
// Copyright 2012, 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package testing import ( "time" "launchpad.net/juju-core/utils" ) // ShortWait is a reasonable amount of time to block waiting for something that // shouldn't actually happen. (as in, the test suite will *actually* ...
Update tests to support "utopic"
[r=wallyworld],[bug=1311955] Update tests to support "utopic" Add "utopic" to SupportedSeries const in testing package. https://codereview.appspot.com/94730043/
Go
agpl-3.0
reedobrien/store
9cdde8b89f31d4873957652273e234b3a55740db
sort/msort/msort.go
sort/msort/msort.go
package algoholic // Merge Sort, O(n lg n) worst-case. Very beautiful. func MergeSort(ns []int) []int { if len(ns) < 2 { return ns } half := len(ns) / 2 ns1 := MergeSort(ns[:half]) ns2 := MergeSort(ns[half:]) return Merge(ns1, ns2) } func Merge(ns1, ns2 []int) []int { length := len(ns1) + len(ns2) ret :=...
package algoholic // Merge Sort, O(n lg n) worst-case. Very beautiful. func MergeSort(ns []int) []int { // Base case - an empty or length 1 slice is trivially sorted. if len(ns) < 2 { // We need not allocate memory here as the at most 1 element will only be referenced // once. return ns } half := len(ns) / ...
Add comments to merge sort.
Add comments to merge sort.
Go
mit
lorenzo-stoakes/algoholic
114c8d926f1d12cc30e03cc996db665c82008aeb
tradingdays/server/main.go
tradingdays/server/main.go
package main import ( "log" "net/http" "strconv" "time" ) func Log(req *http.Request) { log.Println(req.URL, req.UserAgent(), req.Form) } func Home(w http.ResponseWriter, req *http.Request) { w.Write([]byte("Hello World")) Log(req) } func TradeOpen(w http.ResponseWriter, req *http.Request) { data, err := st...
package main import ( "encoding/json" "log" "net/http" "strconv" "time" "github.com/toomore/gogrs/tradingdays" ) func Log(req *http.Request) { log.Println(req.URL, req.UserAgent(), req.Form) } func Home(w http.ResponseWriter, req *http.Request) { w.Write([]byte("Hello World")) Log(req) } type tradeJSON st...
Add return result in json.
Add return result in json.
Go
mit
toomore/gogrs,toomore/gogrs
465fe4a8fc62f4abd688565e2296c9e574427a21
integration_test/main_suite_test.go
integration_test/main_suite_test.go
package main_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" "testing" ) func TestGaragepi(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "GaragepiExecutable Suite") } var ( httpPort uint httpsPort uint garagepiBinPath string ) var _ =...
package main_test import ( "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" "testing" ) func TestGaragepi(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "GaragepiExecutable Suite") } var ( httpPort uint httpsPort uint garagepiBinPath string )...
Increase default Eventually timeout in integration tests.
Increase default Eventually timeout in integration tests. [#101363596]
Go
mit
robdimsdale/garagepi,robdimsdale/garagepi,robdimsdale/garagepi
38c5b09efa1a2d74b62c921b545601f1d5009496
store_test.go
store_test.go
package passhash import ( "testing" ) func TestDummyCredentialStoreStore(t *testing.T) { store := DummyCredentialStore{} credential := &Credential{} if err := store.Store(credential); err != nil { t.Error("Got error storing credential.", err) } } func TestDummyCredentialStoreLoad(t *testing.T) { store := Dum...
package passhash import ( "context" "testing" ) func TestDummyCredentialStoreStore(t *testing.T) { store := DummyCredentialStore{} credential := &Credential{} if err := store.Store(credential); err != nil { t.Error("Got error storing credential.", err) } } func TestDummyCredentialStoreStoreContext(t *testing...
Add tests for StoreContext() and LoadContext()
Add tests for StoreContext() and LoadContext()
Go
apache-2.0
dhui/passhash
f3cef41d6e27d68b18218cd81ba33c31810d0c1f
src/exercism/config_test.go
src/exercism/config_test.go
package exercism import ( "github.com/stretchr/testify/assert" "io/ioutil" "os" "path/filepath" "testing" ) func TestReadingWritingConfig(t *testing.T) { tmpDir, err := ioutil.TempDir("", "") assert.NoError(t, err) writtenConfig := Config{ GithubUsername: "user", ApiKey: "MyKey", Exercism...
package exercism import ( "github.com/stretchr/testify/assert" "io/ioutil" "os" "path/filepath" "testing" ) func TestReadingWritingConfig(t *testing.T) { tmpDir, err := ioutil.TempDir("", "") assert.NoError(t, err) writtenConfig := Config{ GithubUsername: "user", ApiKey: "MyKey", Exercism...
Add missing assertion in demo dir test
Add missing assertion in demo dir test
Go
mit
BhanuprakashVc/go-exercism,BhanuprakashVc/go-exercism
215ded7892a3fcb4146ef4315d5a925e3b31d663
user_basic.go
user_basic.go
// +build !cgo !linux package buildah import ( "fmt" ) func lookupUserInContainer(rootdir, username string) (uint64, uint64, error) { return 0, 0, errors.Wrapf("user lookup not supported") } func lookupGroupInContainer(rootdir, groupname string) (uint64, error) { return 0, errors.Wrapf("group lookup not supporte...
// +build !cgo !linux package buildah import ( "github.com/pkg/errors" ) func lookupUserInContainer(rootdir, username string) (uint64, uint64, error) { return 0, 0, errors.New("user lookup not supported") } func lookupGroupInContainer(rootdir, groupname string) (uint64, error) { return 0, errors.New("group looku...
Use errors.New() instead of Wrapf() for new errors
Use errors.New() instead of Wrapf() for new errors Call errors.New() instead of calling errors.Wrapf() when there's no error to wrap. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> Closes: #130 Approved by: rhatdan
Go
apache-2.0
projectatomic/buildah,nalind/buildah,TomSweeneyRedHat/buildah,nalind/buildah-1,rhatdan/buildah,nalind/buildah,ipbabble/buildah,nalind/buildah-1,TomSweeneyRedHat/buildah,TomSweeneyRedHat/buildah,projectatomic/buildah,nalind/buildah-1,projectatomic/buildah,rhatdan/buildah,ipbabble/buildah,rhatdan/buildah
dd033c880e42bd4b9fd416f7869cac9baf0b8a28
internal/mtail/log_deletion_integration_test.go
internal/mtail/log_deletion_integration_test.go
// Copyright 2020 Google Inc. All Rights Reserved. // This file is available under the Apache license. package mtail_test import ( "os" "path" "testing" "time" "github.com/golang/glog" "github.com/google/mtail/internal/mtail" "github.com/google/mtail/internal/testutil" ) func TestLogDeletion(t *testing.T) { ...
// Copyright 2020 Google Inc. All Rights Reserved. // This file is available under the Apache license. package mtail_test import ( "os" "path" "testing" "time" "github.com/golang/glog" "github.com/google/mtail/internal/mtail" "github.com/google/mtail/internal/testutil" ) func TestLogDeletion(t *testing.T) { ...
Raise the sleep hack in this test to make it less flaky.
Raise the sleep hack in this test to make it less flaky. This sucks, must repair!
Go
apache-2.0
google/mtail,SuperQ/mtail,SuperQ/mtail,google/mtail
2e9f15fc25b592909783fc03fcf451f23260edd1
router/proxy_handler.go
router/proxy_handler.go
package router import ( "github.com/valyala/fasthttp" ) // RedirectHandler stores the URL and HTTP code of a redirect type ProxyHandler struct { url string } // ServerHTTP writes a redirect to an HTTP response func (r *ProxyHandler) ServeHTTP(ctx *fasthttp.RequestCtx) { proxyClient := &fasthttp.HostClient{ Addr...
package router import ( "github.com/valyala/fasthttp" ) // RedirectHandler stores the URL and HTTP code of a redirect type ProxyHandler struct { url string } // ServerHTTP writes a redirect to an HTTP response func (r *ProxyHandler) ServeHTTP(ctx *fasthttp.RequestCtx) { proxyClient := &fasthttp.HostClient{ Addr...
Add error code so that CORS requests dont get 200s when service is down.
Add error code so that CORS requests dont get 200s when service is down.
Go
mit
tpbowden/swarm-ingress-router,tpbowden/swarm-ingress-router
87c31cf8cdb4eae9b4921222967c6cb585fbd19e
cmd/agentctl2/cmd/put_cmd.go
cmd/agentctl2/cmd/put_cmd.go
package cmd import ( "errors" "fmt" "github.com/ligato/vpp-agent/cmd/agentctl2/utils" "github.com/spf13/cobra" ) // RootCmd represents the base command when called without any subcommands. var putConfig = &cobra.Command{ Use: "put", Aliases: []string{"p"}, Short: "Put configuration file", Long: ` Put ...
package cmd import ( "errors" "fmt" "github.com/ligato/vpp-agent/cmd/agentctl2/utils" "github.com/spf13/cobra" ) // RootCmd represents the base command when called without any subcommands. var putConfig = &cobra.Command{ Use: "put", Aliases: []string{"p"}, Short: "Put configuration file", Long: ` Put ...
Add example command to CLI.
Agentctl2: Add example command to CLI. Signed-off-by: Andrej Kozemcak <806670a1cb1f0508258ef96648425f1247742d81@pantheon.tech>
Go
apache-2.0
ondrej-fabry/vpp-agent,ondrej-fabry/vpp-agent,VladoLavor/vpp-agent,VladoLavor/vpp-agent,ondrej-fabry/vpp-agent,VladoLavor/vpp-agent
e8d4b40fca8d193e2758626c02d5e48cc4b6335f
OakWeatherRecorder.go
OakWeatherRecorder.go
package main import ( "fmt" "github.com/peterhellberg/sseclient" "log" "os" ) var logger *log.Logger var urlFormat, deviceId string func init() { logger = log.New(os.Stdout, "", log.LstdFlags|log.Lmicroseconds) urlFormat = "https://api.particle.io/v1/devices/%s/events/?access_token=%s" } func main() { setti...
package main import ( "fmt" "github.com/peterhellberg/sseclient" "log" "os" ) var logger *log.Logger var urlFormat, deviceId string func init() { logger = log.New(os.Stdout, "", log.LstdFlags|log.Lmicroseconds) urlFormat = "https://api.particle.io/v1/devices/%s/events/?access_token=%s" } func main() { setti...
Handle if it returns a nil
Handle if it returns a nil This can happen if it tries to decode an event not called 'weatherstationJSON'
Go
mit
jhitze/oak_weather_recorder
d15cf7ab287e896507bfc36ebf4acb8ca5728518
example_test.go
example_test.go
package s3_test import ( "fmt" "github.com/kr/s3" "log" "net/http" "os" "strings" "time" ) func ExampleSign() { keys := s3.Keys{ os.Getenv("S3_ACCESS_KEY"), os.Getenv("S3_SECRET_KEY"), } data := strings.NewReader("hello, world") r, _ := http.NewRequest("PUT", "https://example.s3.amazonaws.com/foo", dat...
package s3 import ( "fmt" "log" "net/http" "os" "strings" "time" ) func ExampleSign() { keys := Keys{ os.Getenv("S3_ACCESS_KEY"), os.Getenv("S3_SECRET_KEY"), } data := strings.NewReader("hello, world") r, _ := http.NewRequest("PUT", "https://example.s3.amazonaws.com/foo", data) r.ContentLength = int64(...
Put test in the same package as the implementation
Put test in the same package as the implementation This avoids a reliance on github for mere testing when retrieving a copy of the source. Signed-off-by: Daniel Farina <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@heroku.com>
Go
mit
fastly/s3,yannk/s3,jbenet/s3,kr/s3,500px/s3,retailnext/s3,matope/s3
ea8759ba3628ce69b0c332ccea75ac6e373a938b
samples/firehose/main.go
samples/firehose/main.go
package main import ( "crypto/tls" "fmt" "os" "github.com/cloudfoundry/noaa/consumer" ) const firehoseSubscriptionId = "firehose-a" var ( dopplerAddress = os.Getenv("DOPPLER_ADDR") authToken = os.Getenv("CF_ACCESS_TOKEN") ) func main() { consumer := consumer.New(dopplerAddress, &tls.Config{InsecureSkip...
package main import ( "crypto/tls" "flag" "fmt" "os" "github.com/cloudfoundry/noaa/consumer" "github.com/cloudfoundry/sonde-go/events" ) const firehoseSubscriptionId = "firehose-a" var ( dopplerAddress = os.Getenv("DOPPLER_ADDR") authToken = os.Getenv("CF_ACCESS_TOKEN") ) func main() { filterType := ...
Add example of firehose filtering by envelope type
Add example of firehose filtering by envelope type [#145888141] Signed-off-by: Mark Kollasch <8a586b113574ae1b67073fe50ce7d0da2ec8bc53@pivotal.io>
Go
apache-2.0
cloudfoundry/noaa,cloudfoundry/noaa
1aa4a255b988855cc539221fbe172b32b8c62496
src/cf/app_constants.go
src/cf/app_constants.go
package cf import ( "os" "path/filepath" ) const ( Version = "6.0.0.rc2-SHA" Usage = "A command line tool to interact with Cloud Foundry" ) func Name() string { return filepath.Base(os.Args[0]) }
package cf import ( "os" "path/filepath" ) const ( Version = "6.0.0-SHA" Usage = "A command line tool to interact with Cloud Foundry" ) func Name() string { return filepath.Base(os.Args[0]) }
Remove rc2 from version string
Remove rc2 from version string [Finishes #64172410]
Go
apache-2.0
hyenaspots/cli,simonleung8/cli,SrinivasChilveri/cli,mcintyred/cli,HuaweiTech/cli,carnell69/cli,ofer43211/cli,mcintyred/cli,nttlabs/cli,srikanth88infy/cli,nttlabs/cli,saravana76/cli,TomG713/cli,zhang-hua/cli,saurabhguptasg/cli,mcowger/cli,xingzhou/cli,saravana76/cli,kavoj/cli,pishro-cc/cli,ofer43211/cli,rastasheep/trash...
8037ded8c5d7eead4dcd49a943626f08bac1f95b
signal/signal_windows.go
signal/signal_windows.go
package signal import ( "syscall" ) // Signals used in cli/command (no windows equivalent, use // invalid signals so they don't get handled) const ( SIGCHLD = syscall.Signal(0xff) SIGWINCH = syscall.Signal(0xff) SIGPIPE = syscall.Signal(0xff) // DefaultStopSignal is the syscall signal used to stop a container ...
package signal import ( "syscall" "golang.org/x/sys/windows" ) // Signals used in cli/command (no windows equivalent, use // invalid signals so they don't get handled) const ( SIGCHLD = syscall.Signal(0xff) SIGWINCH = syscall.Signal(0xff) SIGPIPE = syscall.Signal(0xff) // DefaultStopSignal is the syscall sig...
Handle more signals to make ParseSignal containerd compatible
Handle more signals to make ParseSignal containerd compatible We'd like to use moby/sys/signal in containerd, but containerd currently supports more signals. Adding them here closes the gap. Signed-off-by: Kazuyoshi Kato <732288c132d39c7d9231a005036e5ecd0fff1d64@amazon.com>
Go
apache-2.0
moby/sys
4d75c3fa4eea1087574072efa9edadb3c3daa390
common.go
common.go
/* Copyright 2016 The Fission 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, sof...
/* Copyright 2016 The Fission 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, sof...
Make internal urls relative (as before)
Make internal urls relative (as before)
Go
apache-2.0
fission/fission,ktrance/fission,fission/fission,platform9/fission,life1347/fission,life1347/fission,ktrance/fission,fission/fission,life1347/fission,life1347/fission,life1347/fission,ktrance/fission,platform9/fission,life1347/fission,platform9/fission,fission/fission,life1347/fission,life1347/fission,ktrance/fission,li...
df0959217e3cbbceb4ea3ceef5dfd44ff0b813c8
config.go
config.go
package main import ( "flag" "fmt" "os" ) type Config struct { extractAddress string entitiesPath string logPath string } func NewConfig() *Config { cfg := new(Config) cfg.extractAddress = getenvDefault("EXTRACTOR_EXTRACT_ADDR", ":3096") cfg.entitiesPath = getenvDefault("EXTRACTOR_ENTITIES_PATH", ...
package main import ( "flag" "fmt" "os" ) type Config struct { extractAddress string entitiesPath string logPath string } func NewConfig() *Config { cfg := new(Config) cfg.extractAddress = getenvDefault("EXTRACTOR_EXTRACT_ADDR", ":3096") cfg.entitiesPath = getenvDefault("EXTRACTOR_ENTITIES_PATH", ...
Change default data path to be a relative path
Change default data path to be a relative path although a relative path could be ambiguous, in most cases this a reasonable and convenient setting because you'll likely invoke the binary from the root directory of the app, and if you don't you can easily pass in a different setting.
Go
mit
alphagov/entity-extractor,alphagov/entity-extractor,alphagov/entity-extractor
e88d3dff2e73ef9b10c3772bacc3e7d61453ad97
src/github.com/nullstyle/go-codegen/cmd/go-codegen/main.go
src/github.com/nullstyle/go-codegen/cmd/go-codegen/main.go
package main import ( "log" "os" macro "github.com/nullstyle/go-codegen" ) func main() { args := os.Args[1:] if len(args) == 0 { args = []string{"."} } for _, arg := range args { err := macro.Process(arg) if err != nil { log.Fatalln(err) } } }
package main import ( "log" "os" codegen "github.com/nullstyle/go-codegen" ) func main() { args := os.Args[1:] if len(args) == 0 { args = []string{"."} } for _, arg := range args { err := codegen.Process(arg) if err != nil { log.Fatalln(err) } } }
Remove last reference to macro
Remove last reference to macro
Go
isc
nullstyle/go-codegen
7648b654030e7b31b1ff915087efb1c05de8bf8a
src/seq/seqimpl/ameta.go
src/seq/seqimpl/ameta.go
package seqimpl import "seq" type AMeta struct { meta seq.PersistentMap } func (o *AMeta) Meta() seq.PersistentMap { return o.meta }
package seqimpl import "seq" // AMeta provides a slot to hold a 'meta' value type AMeta struct { meta seq.PersistentMap } func (o *AMeta) Meta() seq.PersistentMap { return o.meta }
Add comment on AMeta type
Add comment on AMeta type
Go
bsd-2-clause
dmiller/go-seq