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
a059bb1221cf11a9aa358083efe65763cf3507ba
source_test.go
source_test.go
package getter import ( "testing" ) func TestSourceDirSubdir(t *testing.T) { cases := []struct { Input string Dir, Sub string }{ { "hashicorp.com", "hashicorp.com", "", }, { "hashicorp.com//foo", "hashicorp.com", "foo", }, { "hashicorp.com//foo?bar=baz", "hashicorp.com?bar=baz", ...
package getter import ( "testing" ) func TestSourceDirSubdir(t *testing.T) { cases := []struct { Input string Dir, Sub string }{ { "hashicorp.com", "hashicorp.com", "", }, { "hashicorp.com//foo", "hashicorp.com", "foo", }, { "hashicorp.com//foo?bar=baz", "hashicorp.com?bar=baz", ...
Test to validate the SourceDirSubdir works as expected with globs
Test to validate the SourceDirSubdir works as expected with globs
Go
mpl-2.0
hashicorp/go-getter,missedone/go-getter
d360d15bd850318b354dd7784d7d78990c6d875d
sub/scanner/rebuild.go
sub/scanner/rebuild.go
package scanner func (fs *FileSystem) rebuildPointers() { fs.Directory.rebuildPointers(fs) } func (directory *Directory) rebuildPointers(fs *FileSystem) { for _, file := range directory.FileList { file.rebuildPointers(fs) } for _, dir := range directory.DirectoryList { dir.rebuildPointers(fs) } } func (file...
package scanner func (fs *FileSystem) rebuildPointers() { fs.Directory.rebuildPointers(fs) } func (directory *Directory) rebuildPointers(fs *FileSystem) { for _, file := range directory.RegularFileList { file.rebuildPointers(fs) } for _, file := range directory.FileList { file.rebuildPointers(fs) } for _, d...
Rebuild pointers for regular files.
Rebuild pointers for regular files.
Go
apache-2.0
Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator
e8c98556ba2e67eb46ec236a629ed9457086285b
worker/import-cache/subsetMatcher.go
worker/import-cache/subsetMatcher.go
package cache type SubsetMatcher struct { } func NewSubsetMatcher() *SubsetMatcher { return &SubsetMatcher{} } func (sm *SubsetMatcher) Match(servers []*ForkServer, imports []string) (*ForkServer, []string, bool) { best_fs := servers[0] best_score := 0 best_toCache := imports for i := 1; i < len(servers); i++ {...
package cache type SubsetMatcher struct { } func NewSubsetMatcher() *SubsetMatcher { return &SubsetMatcher{} } func (sm *SubsetMatcher) Match(servers []*ForkServer, imports []string) (*ForkServer, []string, bool) { best_fs := servers[0] best_score := -1 best_toCache := imports for i := 1; i < len(servers); i++ ...
Fix import hit count with 0-package handlers
Fix import hit count with 0-package handlers
Go
apache-2.0
open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda
9aa86a9ebfb12bcea50edbb99d8388ad244d3cff
main.go
main.go
package main import ( "log" "os" "github.com/Sirupsen/logrus" ) func init() { logrus.SetLevel(logrus.DebugLevel) } func main() { args := os.Args[1:] if len(args) == 0 { args = []string{os.Getenv("SHELL")} } c := &Container{ Args: args, Uid: os.Getuid(), Gid: os.Getgid(), } if err := c.Start(); e...
package main import ( "os" log "github.com/Sirupsen/logrus" ) func init() { log.SetLevel(log.DebugLevel) } func main() { args := os.Args[1:] if len(args) == 0 { args = []string{os.Getenv("SHELL")} } c := &Container{ Args: args, Uid: os.Getuid(), Gid: os.Getgid(), } if err := c.Start(); err != nil...
Use logrus for logging, instead a mix of loggers
Use logrus for logging, instead a mix of loggers logrus was not properly being used, it was just initialised but then the normal log was called. The compiler was not complaining because the logrus package was used on the `init()`.
Go
mit
LK4D4/unc
e4a5fcb40ddea24cfa6592aff704dcd41232a004
main.go
main.go
package main import ( "flag" "io/ioutil" "log" "os" "fmt" ) func main() { var version bool flag.BoolVar(&version, "v", false, "version string") flag.Parse() if version { fmt.Println("Header: perly.c,v 1.0 87/12/18 15:53:31 root Exp\nPatch level: 0") os.Exit(0) } var sourcetext string if len(os.Args) ...
package main import ( "flag" "io/ioutil" "log" "os" "fmt" ) func main() { var version bool flag.BoolVar(&version, "v", false, "version string") flag.Parse() if version { fmt.Println("Header: perly.c,v 1.0 87/12/18 15:53:31 root Exp\nPatch level: 0") os.Exit(0) } var sourcetext string if len(os.Args) ...
Print out syntax tree on parse failure, to make it easier to debug where the failure happened.
Print out syntax tree on parse failure, to make it easier to debug where the failure happened.
Go
artistic-2.0
allisonrandal/gunie,allisonrandal/gunie,allisonrandal/gunie
246e8bcca34cb2f0b0504cc1eee466cdcac2135c
parse/preprocess/contentscan_test.go
parse/preprocess/contentscan_test.go
package preprocess import ( "testing" "fmt" "io" localtests "github.com/practicum/sandbox/testing" ) // reflectionToy is a dummy type created in the preprocess package as a trick to // retrieve the package name. http://stackoverflow.com/a/25263604/10278 type reflectionToy struct{} func TestScan(t *testing.T) {...
package preprocess import ( "testing" "fmt" "io" localtests "github.com/practicum/sandbox/testing" ) var sampleTxtFilepath string = localtests. DataAssetFullPath("january.txt", reflectionToy{}) // reflectionToy is a dummy type created in the preprocess package as a trick to // retrieve the package name. http:...
Add an Example func to tests that shows up in godoc.
Add an Example func to tests that shows up in godoc.
Go
unlicense
practicum/sandbox
7ee8e946c522c3af50f9fe149516188dec9115ea
user.go
user.go
package main import ( "github.com/ricallinson/forgery" ) func CreateUser(req *f.Request, res *f.Response, next func()) { // res.Send("Not implemented yet.") res.Send("Unknown error while trying to register user", 400) } func Login(req *f.Request, res *f.Response, next func()) { res.Send("Not implemented yet....
package main import ( "github.com/ricallinson/forgery" "github.com/spacedock-io/index/couch/models" ) func CreateUser(req *f.Request, res *f.Response, next func()) { username, email, password := req.Body["username"], req.Body["email"], req.Body["password"] // @TODO: Validate email format if len(password) ...
Implement basic signup and login routes
Implement basic signup and login routes
Go
mit
spacedock-io/index
f136ebade93a5e070f8d57bd5ad53e5191874248
fizzbuzz/fizzbuzz.go
fizzbuzz/fizzbuzz.go
package fizzbuzz import ( "fmt" "log" ) func Generate(count int) ([]string, error) { if count <= 0 { return nil, fmt.Errorf("fizzbuzz: Negative fizzbuzz count provided") } fizzbuzz := make([]string, count) var output string for i := 1; i <= count; i++ { switch { case i%15 == 0: output = "FizzBuzz" ...
package fizzbuzz import ( "fmt" "log" ) func Generate(count int) ([]string, error) { if count <= 0 { return nil, fmt.Errorf("fizzbuzz: Negative fizzbuzz count provided") } fizzbuzz := make([]string, count) var output string for i := 1; i <= count; i++ { switch { case i%15 == 0: output = "FizzBuzz" ...
Fix off by one and string conversion
Fix off by one and string conversion
Go
isc
mulander/goexamples
a1bd184e50c7cf1f18e69259bdbd028c5fcd4821
grumble.go
grumble.go
// Copyright (c) 2010 The Grumble Authors // The use of this source code is goverened by a BSD-style // license that can be found in the LICENSE-file. package main import ( "flag" "fmt" "os" ) var help *bool = flag.Bool("help", false, "Show this help") var port *int = flag.Int("port", 64738, "Default port to list...
// Copyright (c) 2010 The Grumble Authors // The use of this source code is goverened by a BSD-style // license that can be found in the LICENSE-file. package main import ( "flag" "fmt" "os" "log" "mumbleproto" "goprotobuf.googlecode.com/hg/proto" ) var help *bool = flag.Bool("help", false, "Show this help") v...
Add checks for buggy goprotobuf.
Add checks for buggy goprotobuf.
Go
bsd-3-clause
colek42/grumble,colek42/grumble,colek42/grumble
21efb2fc3363b15f7e5aee0d392757f43373e9f9
btree/main.go
btree/main.go
package main import ( "fmt" "github.com/caelifer/data-structures-in-go/btree/tree" ) type IntNode int func (n IntNode) Less(other tree.Node) bool { // TODO: need to handle type assertion error return n < other.(IntNode) } type StringNode string func (n StringNode) Less(other tree.Node) bool { // TODO: need t...
package main import ( "fmt" "github.com/caelifer/data-structures-in-go/btree/tree" ) type IntNode int func (n IntNode) Less(other tree.Node) bool { // TODO: need to handle type assertion error return n < other.(IntNode) } type StringNode string func (n StringNode) Less(other tree.Node) bool { // TODO: need t...
Use function reference as a lambda in tree.Walk() argument
Use function reference as a lambda in tree.Walk() argument
Go
bsd-2-clause
caelifer/data-structures-in-go
5ed9573d163a60a7b50aefa12b0e2330cbd64eda
lifecycle/default.go
lifecycle/default.go
package lifecycle var defaultManager *Manager func init() { defaultManager = NewManager() } // Register registers the argument to the global default one. func Register(f func()) *Manager { return defaultManager.Register(f) } // RegisterChannel registers the argument to the global default one. func RegisterChannel...
package lifecycle var defaultManager *Manager func init() { defaultManager = NewManager() } // Register registers the argument to the global default one. func Register(f func()) *Manager { return defaultManager.Register(f) } // RegisterChannel registers the argument to the global default one. func RegisterChannel...
Add IsStop to the global lifecycle manager
Add IsStop to the global lifecycle manager
Go
apache-2.0
xgfone/go-tools
7ab36cbb37e8a7424080fb8b66edbc1631c1e131
pow/pow.go
pow/pow.go
package pow // TODO: Unwrap recursion func Mod(x, p, n int) int { switch { case p == 0: return 1 case p == 1: return x % n case p%2 == 0: return Mod((x*x)%n, p/2, n) } return (x * Mod((x*x)%n, (p-1)/2, n)) % n }
package pow // TODO: Unwrap recursion func Mod(x, p, n int) int { switch { case p == 0: return 1 case p == 1: return x % n case p%2 == 0: return Mod((x*x)%n, p/2, n) % n } return (x * Mod((x*x)%n, (p-1)/2, n)) % n }
Fix a mistake with large mods.
Fix a mistake with large mods.
Go
apache-2.0
ivankovic/go-competitive
b4a25e9972165a4417f05c54b53a316b3854ac44
assignments/go/binary/binary_test.go
assignments/go/binary/binary_test.go
package binary import "testing" type binaryTest struct { binary string expected int } var binaryTests = []binaryTest{ {"1", 1}, {"10", 2}, {"11", 3}, {"100", 4}, {"1001", 9}, {"10001101000", 1128}, {"12", 0}, } func TestBinary(t *testing.T) { for _, test := range binaryTests { actual := ToDecimal(test.bin...
package binary import "testing" var testCases = []struct { binary string expected int }{ {"1", 1}, {"10", 2}, {"11", 3}, {"100", 4}, {"1001", 9}, {"10001101000", 1128}, {"12", 0}, } func TestBinary(t *testing.T) { for _, tt := range testCases { actual := ToDecimal(tt.binary) if actual != tt.expected ...
Simplify table tests in Go 'binary' exercise.
Simplify table tests in Go 'binary' exercise.
Go
mit
robphoenix/exercism-go,exercism/xgo,pminten/xgo,leenipper/xgo,exercism/xgo,robphoenix/exercism-go,leenipper/xgo,pminten/xgo
9daa63cc652970e5d8255a895ffc010c946b1c8d
stub/cmd/migrate.go
stub/cmd/migrate.go
// Copyright © 2017 Swarm Market <info@swarm.market> // // 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 ...
// Copyright © 2017 Swarm Market <info@swarm.market> // // 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 ...
Fix compilation issue in stub
Fix compilation issue in stub
Go
apache-2.0
swarmdotmarket/perigord,swarmdotmarket/perigord
c9ffb81dfa2102538868027932544517de8931f9
test/restart/restart.go
test/restart/restart.go
// +build !windows package main import ( "os" "syscall" "time" ) func restart() { syscall.Kill(os.Getpid(), syscall.SIGHUP) time.Sleep(10 * time.Millisecond) }
// +build !windows package main import ( "os" "syscall" "time" ) func restart() { syscall.Kill(os.Getpid(), syscall.SIGHUP) time.Sleep(100 * time.Millisecond) }
Extend wait duration to stabilize tests.
Extend wait duration to stabilize tests.
Go
mit
cybozu-go/cmd
e515b222c25a00a674141e0d5fab138cdc9dabfa
dotGo/2014/z.go
dotGo/2014/z.go
// Code from my dotGo.eu 2014 presentation // // Copyright (c) 2014 John Graham-Cumming // // Implement a factory and a task. Call run() on your factory. package main import ( "bufio" "log" "os" "sync" ) type task interface { process() print() } type factory interface { make(line string) task } func run(f f...
// Code from my dotGo.eu 2014 presentation // // Copyright (c) 2014 John Graham-Cumming // // Implement a factory and a task. Call run() on your factory. package main import ( "bufio" "log" "os" "sync" ) type task interface { process() print() } type factory interface { make(line string) task } func run(f f...
Add improvement from eneff that makes program terminate more cleanly
Add improvement from eneff that makes program terminate more cleanly
Go
bsd-3-clause
cloudflare/jgc-talks,robertojrojas/jgc-talks
86ef4815527aaaeede24435b49a6f654da6d9979
cmd_remove.go
cmd_remove.go
package main import ( "errors" "fmt" ) var cmdRemove = &Command{ Run: runRemove, UsageLine: "remove NAME", Short: "Remove saved password", Long: `Remove saved password by input name.`, } func runRemove(ctx context, args []string) error { if len(args) == 0 { return errors.New("item name requir...
package main import ( "errors" "fmt" ) var cmdRemove = &Command{ Run: runRemove, UsageLine: "remove NAME", Short: "Remove saved password", Long: `Remove saved password by input name.`, } func runRemove(ctx context, args []string) error { if len(args) == 0 { return errors.New("item name requir...
Fix create empty item on remove
Fix create empty item on remove
Go
mit
pinzolo/spwd
b4d41c1f7bd95d6dea9abc442f791942cc54b8ae
irukad/iruka.go
irukad/iruka.go
package main import ( "fmt" "net/http" "github.com/codegangsta/negroni" "github.com/gorilla/mux" ) func main() { r := mux.NewRouter() r.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { fmt.Fprint(rw, "hello") }) // Middleware stack n := negroni.New( negroni.NewRecovery(), negroni.NewLo...
package main import ( "fmt" "net/http" "github.com/codegangsta/negroni" "github.com/gorilla/mux" ) func main() { r := mux.NewRouter() r.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { fmt.Fprint(rw, "hello") }) // Middleware stack n := negroni.New( negroni.NewRecovery(), negroni.NewLo...
Change server port to 8080 to use gin Because gin's default port is 3000
Change server port to 8080 to use gin Because gin's default port is 3000
Go
mit
spesnova/iruka,spesnova/iruka,spesnova/iruka,spesnova/iruka
34c466af0ffc077ffaf6ec6a9d357148f76d8303
go/isogram/isogram.go
go/isogram/isogram.go
package isogram import "strings" // IsIsogram returns whether the provided string is an isogram. // In other words, whether the string does not contain any duplicate characters. func IsIsogram(s string) bool { parsed := strings.ToLower(removeWhitespaceAndHyphens(s)) seen := make(map[rune]bool) for _, c := range pa...
package isogram import ( "strings" "unicode" ) // IsIsogram returns whether the provided string is an isogram. // In other words, whether the string does not contain any duplicate characters. func IsIsogram(s string) bool { parsed := strings.ToLower(preserveOnlyLetters(s)) seen := make(map[rune]bool) for _, c :=...
Modify solution to preserve letters
Modify solution to preserve letters
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
e3323a822fd7c666de0b8f90a9b02e63a89df565
listformatter_test.go
listformatter_test.go
package graval import ( . "github.com/smartystreets/goconvey/convey" "os" "testing" "time" ) type TestFileInfo struct{} func (t *TestFileInfo) Name() string { return "file1.txt" } func (t *TestFileInfo) Size() int64 { return 99 } func (t *TestFileInfo) Mode() os.FileMode { return os.ModeSymlink } func (t *...
package graval import ( . "github.com/smartystreets/goconvey/convey" "os" "testing" "time" ) type TestFileInfo struct{} func (t *TestFileInfo) Name() string { return "file1.txt" } func (t *TestFileInfo) Size() int64 { return 99 } func (t *TestFileInfo) Mode() os.FileMode { return os.ModeSymlink } func (t *...
Add test for detailed listformatter.
Add test for detailed listformatter.
Go
mit
yob/graval,yob/graval
225993926840edc55916fd16910e0f62a67d3794
process/command.go
process/command.go
package process import ( "os/exec" "github.com/gonuts/go-shlex" "github.com/yosisa/pave/template" ) type Command struct { Template string PrepareFunc func(*exec.Cmd) Cmd *exec.Cmd } func NewCommand(cmd string) *Command { return &Command{Template: cmd} } func (c *Command) Start() error { command ...
package process import ( "os/exec" "code.google.com/p/go-shlex" "github.com/yosisa/pave/template" ) type Command struct { Template string PrepareFunc func(*exec.Cmd) Cmd *exec.Cmd } func NewCommand(cmd string) *Command { return &Command{Template: cmd} } func (c *Command) Start() error { command ...
Use another version of go-shlex
Use another version of go-shlex
Go
mit
yosisa/pave
273cd3dc935245619f90bc463dbf749bb1651f19
integration/integration_suite_test.go
integration/integration_suite_test.go
package integration_test import ( "io/ioutil" "os" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils" ) var testCpiFilePath string func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) BeforeSuite(func() { err := bmtestu...
package integration_test import ( "io/ioutil" "os" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils" ) var testCpiFilePath string func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) BeforeSuite(func() { err := bmtestu...
Remove environment variable in integration test suit
Remove environment variable in integration test suit Signed-off-by: Phan Le <f2c5995718b197bbd6f63c99e8aab6ee2af1c495@pivotallabs.com>
Go
apache-2.0
forrestsill/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,forrestsill/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,forrestsill/bosh-init
711f6fb274bd9bd483230d0df50a301c64fb9021
website_checking.go
website_checking.go
package main import ( "hash/fnv" "io" ) // FetchWebsiteChecksum downloads the resource at url, // and returns an fnv hash of its content. func FetchWebsiteChecksum(FetchWebsiteChecksum Fetcher, url string) (uint64, error) { website, err := FetchWebsiteChecksum.Fetch(url) if err != nil { return 0, err } defer ...
package main import ( "hash/fnv" "io" ) // FetchWebsiteChecksum downloads the resource at url, // and returns an fnv hash of its content. func FetchWebsiteChecksum(fetcher Fetcher, url string) (uint64, error) { website, err := fetcher.Fetch(url) if err != nil { return 0, err } defer website.Close() hash := ...
Fix name of FetchWebsiteChecksum parameter
Fix name of FetchWebsiteChecksum parameter
Go
agpl-3.0
samdoiron/hermes,samdoiron/hermes
9e0531caab4f0d178986927f7863bdbb0a685a75
server/server.go
server/server.go
package server import ( "fmt" "net/http" "flag" "github.com/gorilla/mux" ) var hostname = flag.String("hostname", "localhost", "The hostname - defaults to localhost") func Serve() { fmt.Println("Starting webserver on :80") fmt.Println(*hostname) r := mux.NewRouter() s := r.Host(*hostname).Subrouter() s.Pat...
package server import ( "fmt" "net/http" "flag" "github.com/gorilla/mux" ) var hostname = flag.String("hostname", "localhost", "The hostname to use for routing.") func Serve() { flag.Parse() r := mux.NewRouter() s := r.Host(*hostname).Subrouter() s.PathPrefix("/").Handler(http.FileServer(http.Dir("./static...
Add flag parsing, remove debug line.
Add flag parsing, remove debug line.
Go
mit
stevemostovoy/cloudpiece,stevemostovoy/cloudpiece,stevemostovoy/cloudpiece
966b35e5088fa6e0bd3e4ada957c1f5412f56170
_draft/simple-http.go
_draft/simple-http.go
package main import ( "fmt" "io/ioutil" "net/http" "encoding/json" ) type JsonData struct { Name string `json:"name"` Struct struct { Integer int `json:"integer"` } `json:"struce"` } func main() { http.HandleFunc("/", hello) http.ListenAndServe(":8001", nil) } func hello(writer http.ResponseWr...
package main import ( "encoding/json" "fmt" "io/ioutil" "net/http" ) type JsonData struct { Name string `json:"name"` Struct struct { Integer int `json:"integer"` } `json:"struce"` } func main() { http.HandleFunc("/", hello) http.ListenAndServe(":8001", nil) } func hello(w http.ResponseWriter, r *http....
Format and update http example
Format and update http example
Go
mit
rollbrettler/go-playground
ecc8d1b6c34c60929ea1ec3f5b3606742ada9bb8
cmd/pkg/mc/interfaces.go
cmd/pkg/mc/interfaces.go
package mc type ProjectDB interface { Project() *Project UpdateProject(project *Project) error InsertDirectory(dir *Directory) (*Directory, error) UpdateDirectory(dir *Directory) error Directories() []Directory Ls(dir Directory) []File InsertFile(f *File) (*File, error) FindFile(fileName string, dirID int64) (...
package mc type ProjectDB interface { Project() *Project UpdateProject(project *Project) error InsertDirectory(dir *Directory) (*Directory, error) UpdateDirectory(dir *Directory) error Directories() []Directory Ls(dir Directory) []File InsertFile(f *File) (*File, error) FindFile(fileName string, dirID int64) (...
Add ProjectExists to ProjectDBOpener interface.
Add ProjectExists to ProjectDBOpener interface.
Go
mit
materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore
141e64298eb5551f3141b8ebe067da951ae1d874
middleware.go
middleware.go
package main import ( "log" "net/http" "time" ) func optionsOk(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { w.Header().Set("access-control-allow-origin", "*") w.Header().Set("access-control-allow-methods", "GET, POST, PATCH, DELETE") w.Header().Set("access-control-a...
package main import ( "net/http" ) func optionsOk(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { w.Header().Set("access-control-allow-origin", "*") w.Header().Set("access-control-allow-methods", "GET, POST, PATCH, DELETE") w.Header().Set("access-control-allow-headers", ...
Remove the logging handler since heroku's log is good enough
Remove the logging handler since heroku's log is good enough
Go
mit
mforman/todo-backend-golang
df76e95defab93e03bc8022bf083182b653901b9
error.go
error.go
// A facebook graph api client in go. // https://github.com/huandu/facebook/ // // Copyright 2012 - 2015, Huan Du // Licensed under the MIT license // https://github.com/huandu/facebook/blob/master/LICENSE package facebook // Error represents Facebook API error. type Error struct { Message string Type ...
// A facebook graph api client in go. // https://github.com/huandu/facebook/ // // Copyright 2012 - 2015, Huan Du // Licensed under the MIT license // https://github.com/huandu/facebook/blob/master/LICENSE package facebook // Error represents Facebook API error. type Error struct { Message string Type ...
Extend Error to add Marketing/Insights API fields
Extend Error to add Marketing/Insights API fields
Go
mit
huandu/facebook
5647a87df12726c2b04bf5a09a89471f91a6c1b8
cmd/atlas/test.go
cmd/atlas/test.go
/* This package is just a collection of test cases */ package main import ( "fmt" "os" "ripe-atlas" ) func main() { p, err := atlas.GetProbe(14037) if err != nil { fmt.Printf("err: %v", err) os.Exit(1) } fmt.Printf("p: %#v\n", p) q, err := atlas.GetProbes() if err != nil { fmt.Printf("err: %...
/* This package is just a collection of test cases */ package main import ( "fmt" "github.com/codegangsta/cli" "os" "ripe-atlas" "strconv" ) // set args for examples sake func main() { app := cli.NewApp() app.Name = "atlas" app.Commands = []cli.Command{ { Name: "probes", Aliases: []string{...
Move to cli to manage flags/cmd/subcmd.
Move to cli to manage flags/cmd/subcmd.
Go
mit
keltia/ripe-atlas
a880609eaacbff9a97b47ce73bd2a8ce7cbfac6d
slackbot-console/main.go
slackbot-console/main.go
package main import ( "bytes" "flag" "fmt" "github.com/cadena-monde/slackbot" "os" "strings" ) var ( channel, message string stdin bool slackURL = os.Getenv("SLACKBOT_URL") token = os.Getenv("SLACKBOT_TOKEN") ) func main() { parseFlags() if stdin { readFromStdin() } post...
package main import ( "bytes" "flag" "fmt" "github.com/cadena-monde/slackbot" "os" "strings" ) var ( channel, message string stdin bool slackURL = os.Getenv("SLACKBOT_URL") token = os.Getenv("SLACKBOT_TOKEN") ) func main() { parseFlags() if stdin { readFromStdin() } post...
Read input from variable, not from buffer again
Read input from variable, not from buffer again
Go
mit
monde-sistemas/slackbot
1a4f82e96cf7e29708a13c83023ff33a576cf45d
retrystrategy/attempt_retry_strategy.go
retrystrategy/attempt_retry_strategy.go
package retrystrategy import ( "time" boshlog "github.com/cloudfoundry/bosh-utils/logger" ) type attemptRetryStrategy struct { maxAttempts int delay time.Duration retryable Retryable logger boshlog.Logger logTag string } func NewAttemptRetryStrategy( maxAttempts int, delay time.Duration, ...
package retrystrategy import ( "reflect" "time" boshlog "github.com/cloudfoundry/bosh-utils/logger" ) type attemptRetryStrategy struct { maxAttempts int delay time.Duration retryable Retryable logger boshlog.Logger logTag string } func NewAttemptRetryStrategy( maxAttempts int, delay time...
Enhance debug output for retry strategies
Enhance debug output for retry strategies Retry strategies outputs the retryable type [#129348495](https://www.pivotaltracker.com/story/show/129348495) Signed-off-by: Beyhan Veli <0702de361e3c91d973ce2c0ee3e34845ebaf95e6@sap.com>
Go
apache-2.0
cloudfoundry/bosh-utils,cloudfoundry/bosh-utils
707d764842f21d05ce300c74012bd63f9fde9a45
serve/main.go
serve/main.go
package main import ( "flag" "log" "net/http" "github.com/gorilla/mux" "github.com/miraclesu/keywords-filter" "github.com/miraclesu/keywords-filter/listener/http.listen" "github.com/miraclesu/keywords-filter/loader/http.load" ) var ( Port = flag.String("p", ":7520", "serve's port") Threshold = flag.Int...
package main import ( "flag" "log" "net/http" "github.com/julienschmidt/httprouter" "github.com/miraclesu/keywords-filter" "github.com/miraclesu/keywords-filter/listener/http.listen" "github.com/miraclesu/keywords-filter/loader/http.load" ) var ( Port = flag.String("p", ":7520", "serve's port") Thresh...
Change httprouter from mux to httprouter
Change httprouter from mux to httprouter
Go
mit
miraclesu/keywords-filter
d5369d03810eaed766d2d35eda2aaaa5cfa9bedc
src/lib/core/function.go
src/lib/core/function.go
package core type functionType struct { signature Signature function func(...*Thunk) Value } func (f functionType) call(args Arguments) Value { ts, err := f.signature.Bind(args) if err != nil { return err } return f.function(ts...) } func NewLazyFunction(s Signature, f func(...*Thunk) Value) *Thunk { ret...
package core type functionType struct { signature Signature function func(...*Thunk) Value } func (f functionType) call(args Arguments) Value { ts, err := f.signature.Bind(args) if err != nil { return err } return f.function(ts...) } // NewLazyFunction creates a function whose arguments are evaluated lazi...
Add documentation on NewLazyFunction and NewStrictFunction
Add documentation on NewLazyFunction and NewStrictFunction
Go
mit
raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp
e7e2f28584a777b6d4dae4f90bf818009183e9a0
cmd/webhook/main.go
cmd/webhook/main.go
/* Copyright 2018 The Jetstack cert-manager contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
/* Copyright 2018 The Jetstack cert-manager contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
Fix "logging before flag.Parse" errors
webhook: Fix "logging before flag.Parse" errors Fixes #932 Signed-off-by: Benjamin Staffin <7ff02effd2e7aa57491d2da194ef1ab398b1a4cf@gmail.com>
Go
apache-2.0
jetstack/cert-manager,jetstack/cert-manager,jetstack/cert-manager,jetstack-experimental/cert-manager,cert-manager/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager
362f173b69176ed41f52d3a67bffe9fc00af1acc
ttl_hash_set/ttl_hash_set_suite_test.go
ttl_hash_set/ttl_hash_set_suite_test.go
package ttl_hash_set_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestTtlHashSet(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "TtlHashSet Suite") }
package ttl_hash_set_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestTTLHashSet(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "TTLHashSet Suite") }
Rename test suite to follow with the object name of `TTLHashSet`
Rename test suite to follow with the object name of `TTLHashSet`
Go
mit
alphagov/govuk_crawler_worker
45a70b6a9b5395f9ecbe72919c714e81494c864f
pkg/core/http/cors.go
pkg/core/http/cors.go
package http import ( "net/http" "strings" ) func FixupCORSHeaders(downstream http.ResponseWriter, upstream *http.Response) { hasCORSHeaders := false for name := range upstream.Header { if strings.HasPrefix(name, "Access-Control-") { hasCORSHeaders = true break } } if !hasCORSHeaders { return } ...
package http import ( "net/http" "strings" ) func parseVaryHeaders(values []string) []string { var headers []string for _, v := range values { for _, h := range strings.Split(v, ",") { h = strings.TrimSpace(h) if h != "" { headers = append(headers, h) } } } return headers } func FixupCORSHeade...
Handle CORS fixup for Vary header
Handle CORS fixup for Vary header
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
f2bae6e09f345adce5e9f24fa3d492c7482867eb
utils_test.go
utils_test.go
package atlas import ( "github.com/stretchr/testify/assert" "testing" ) var TestForm = map[string]string{ "Type": "foo", "AF": "1", "InWifiGroup": "true", "Spread": "1", } func TestFillDefinition(t *testing.T) { err := FillDefinition(nil, TestForm) assert.NoError(t, err) } func TestFil...
package atlas import ( "github.com/stretchr/testify/assert" "testing" ) var TestForm = map[string]string{ "Type": "foo", "AF": "1", "InWifiGroup": "true", "Spread": "1", } var TestForm1 = map[string]string{ "Tags": "foo,bar", } func TestFillDefinition(t *testing.T) { err := FillDefiniti...
Add tests for the new "slice" type in FillDefinition().
Add tests for the new "slice" type in FillDefinition().
Go
mit
keltia/ripe-atlas
f36c12a88ff84ee30415e047aa12dfc27b5d20eb
alarmbot/alarmbot.go
alarmbot/alarmbot.go
package main import ( "fmt" "os" "github.com/jvikstedt/alarm-bot/configuration" "github.com/jvikstedt/alarm-bot/mailer" "github.com/jvikstedt/alarm-bot/tracker" ) var mail *mailer.Mailer var conf *configuration.Configuration func init() { setupConf() setupMailer() } func main() { for _, c := range conf.Te...
package main import ( "fmt" "os" "github.com/jvikstedt/alarm-bot/configuration" "github.com/jvikstedt/alarm-bot/mailer" "github.com/jvikstedt/alarm-bot/tracker" ) var mail *mailer.Mailer var conf *configuration.Configuration func init() { setupConf() setupMailer() } func main() { for _, c := range conf.Te...
Add line break when printing to fmt
Add line break when printing to fmt
Go
mit
jvikstedt/alarm-bot
b126fcf3ad2d45ad58c76dfd317563d399bbc144
pkg/edgectl/misc_noop.go
pkg/edgectl/misc_noop.go
// +build windows package edgectl import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/datawire/ambassador/pkg/supervisor" ) // GuessRunAsInfo attempts to construct a RunAsInfo for the user logged in at // the primary display func GuessRunAsInfo(_ *supervisor.Process) (*RunAsInfo, error) { retu...
// +build windows package edgectl import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/datawire/ambassador/pkg/supervisor" ) // GuessRunAsInfo attempts to construct a RunAsInfo for the user logged in at // the primary display func GuessRunAsInfo(_ *supervisor.Process) (*RunAsInfo, error) { retu...
Change private->public name for Windows
Change private->public name for Windows Signed-off-by: Alvaro Saurin <95275619247e0a0a4a5f7a8d5144a85ee8f50dbb@gmail.com>
Go
apache-2.0
datawire/telepresence,datawire/telepresence,datawire/telepresence
b5d7dbe3a300a0e75bb71b078b75d2df5f0d5c40
activitystreams/person.go
activitystreams/person.go
package activitystreams type Person struct { BaseObject Inbox string `json:"inbox"` Outbox string `json:"outbox"` PreferredUsername string `json:"preferredUsername"` URL string `json:"url"` Name string `json:"name"` Icon Image `js...
package activitystreams type Person struct { BaseObject Inbox string `json:"inbox"` Outbox string `json:"outbox"` PreferredUsername string `json:"preferredUsername"` URL string `json:"url"` Name string `json:"name"` Icon Image `js...
Add support for including a public key on a Person
Add support for including a public key on a Person
Go
mpl-2.0
writeas/web-core,writeas/web-core
d47820507122af1ccbd2f9d26c355a0587986f6e
server/response/login.go
server/response/login.go
package response import ( "github.com/Vladimiroff/vec2d" "warcluster/entities" ) type LoginSuccess struct { baseResponse Username string Position *vec2d.Vector HomePlanet struct { Name string Position *vec2d.Vector } } type LoginFailed struct { baseResponse } type LoginInformation struct { bas...
package response import ( "github.com/Vladimiroff/vec2d" "warcluster/entities" ) type Fraction struct { Id uint16 Color entities.Color Name string } type LoginSuccess struct { baseResponse Username string Position *vec2d.Vector Fraction Fraction HomePlanet struct { Name string Position *...
Update connection protocol for Login success
Update connection protocol for Login success
Go
mit
WarCluster/warcluster-server,WarCluster/warcluster-server
23424811b862be2811dafa3ab9febf35a6dc7071
src/it/targets/go.go
src/it/targets/go.go
package targets import "path" import "os" import "os/exec" import "runtime" import "errors" type Go struct {} func (Go) Compile(mainFile string) error { compile := exec.Command("go", "build", "-tags", "example", "-o", path.Base(mainFile[:len(mainFile)-2])+".gob") compile.Stdout = os.Stdout compile.Stderr = os.S...
package targets import "path" import "os" import "os/exec" import "runtime" import "errors" type Go struct {} func (Go) Compile(mainFile string) error { compile := exec.Command("go", "build", "-tags", "example", "-o", path.Base(mainFile[:len(mainFile)-2])+".gob") compile.Stdout = os.Stdout compile.Stderr = os.S...
Support Go export on windows.
Support Go export on windows.
Go
artistic-2.0
Qlova/ilang,Qlova/ilang,Qlova/ilang,Qlova/ilang,Qlova/ilang
7207ca97b290b1d9fab248a1e4c8f753bdc79086
unlink.go
unlink.go
// Copyright 2016 Tom Thorogood. All rights reserved. // Use of this source code is governed by a // Modified BSD License license that can be found in // the LICENSE file. package shm import ( "os" "github.com/tmthrgd/go-shm" ) // Unlink removes the previously created blocker. // // Taken from shm_unlink(3): // ...
// Copyright 2016 Tom Thorogood. All rights reserved. // Use of this source code is governed by a // Modified BSD License license that can be found in // the LICENSE file. package shm import "github.com/tmthrgd/go-shm" // Unlink removes the previously created blocker. // // Taken from shm_unlink(3): // The operati...
Remove unused import (missing from 0f00944)
Remove unused import (missing from 0f00944)
Go
bsd-3-clause
tmthrgd/shm-go
69b5fef5e2601ed37e789dabc812b9cf0a19de7b
writer.go
writer.go
package stl import ( "fmt" "io" ) // Write writes the triangle mesh to the writer using ASCII STL codec. zfunc Write(w io.Writer, t []Triangle) error { var err error printf := func(format string, a ...interface{}) { if err != nil { return } _, err = fmt.Fprintf(w, format, a...) } printf("solid object\...
package stl import ( "fmt" "io" ) // Write writes the triangle mesh to the writer using ASCII STL codec. func Write(w io.Writer, t []Triangle) error { var err error printf := func(format string, a ...interface{}) { if err != nil { return } _, err = fmt.Fprintf(w, format, a...) } printf("solid object\n...
Fix build to test goci
Fix build to test goci
Go
mit
krasin/stl
0a6fa2bc146c5e8684a1aa23092c6fc9bff19de2
cmd/sorg-serve/main.go
cmd/sorg-serve/main.go
package main import ( "net/http" "path" "strconv" log "github.com/Sirupsen/logrus" "github.com/brandur/sorg" "github.com/joeshaw/envdecode" ) // Conf contains configuration information for the command. type Conf struct { // Port is the port on which the command will serve the site over HTTP. Port int `env:"P...
package main import ( "net/http" "path" "strconv" log "github.com/Sirupsen/logrus" "github.com/brandur/sorg" "github.com/joeshaw/envdecode" ) // Conf contains configuration information for the command. type Conf struct { // Port is the port on which the command will serve the site over HTTP. Port int `env:"P...
Move Conf to a global for consistency with build executable
Move Conf to a global for consistency with build executable Former-commit-id: b47323e5980edce87d5ba5eb277d6ae6d914f711
Go
mit
brandur/sorg,brandur/sorg,brandur/sorg,brandur/sorg,brandur/sorg
5714d21d90e2c5a4bdbb1077157cd4e41ddf4c54
compute/volume_pool.go
compute/volume_pool.go
package compute type VolumePoolRepository interface { List() ([]*VolumePool, error) } type VolumePool struct { Name string Size uint64 // MiB Used uint64 // MiB Free uint64 // MiB } func (pool *VolumePool) UsagePercent() int { return int(100 * pool.Used / pool.Free) } func (pool *VolumePool) FreeGB() uint64 {...
package compute type VolumePoolRepository interface { List() ([]*VolumePool, error) } type VolumePool struct { Name string Size uint64 // MiB Used uint64 // MiB Free uint64 // MiB } func (pool *VolumePool) UsagePercent() int { return int(100 * pool.Used / pool.Size) } func (pool *VolumePool) FreeGB() uint64 {...
Fix pool usage percent calculation
Fix pool usage percent calculation
Go
mit
subuk/vmango,subuk/vmango,subuk/vmango,subuk/vmango,subuk/vmango,subuk/vmango
6995c42cab596acaf8de61ad0e232bb00b5f3f8c
go/libkb/version.go
go/libkb/version.go
// This file is autogenerated, see packaging/increment_build.sh package libkb const Version = "1.0.5" const Build = 6
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package libkb import ( "fmt" ) // NOTE: This file is the source of truth for our version number, but we have a // script that reads it at packaging/version.sh. If you refactor this // ...
Revert "Bumping build number: 1.0.5-6"
Revert "Bumping build number: 1.0.5-6" This reverts commit d765d9c66cfb0659f43c8bdc2dbdde3c2f08a173.
Go
bsd-3-clause
keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client
e8f2bfa311a7353358a9d4ee326880526d4942fc
crypto/openpgp/globals.go
crypto/openpgp/globals.go
package openpgp import ( "os" "path/filepath" ) // Gnupg keyrings files var gPubringFile string = filepath.Join(os.Getenv("HOME"), ".gnupg", "pubring.gpg") var gSecringFile string = filepath.Join(os.Getenv("HOME"), ".gnupg", "secring.gpg") // Gnupg trousseau master gpg key id var gMasterGpgId string = os.Getenv(EN...
package openpgp import ( "os" "path/filepath" ) // Gnupg keyrings files var gPubringFile string = func() string { envPubring := os.Getenv("GNUPG_PUBRING_PATH") if envPubring != "" { return envPubring } return filepath.Join(os.Getenv("HOME"), ".gnupg", "pubring.gpg") }() var gSecringFile string = func() str...
Allow gnupg keyring files to be selected via sys env
Allow gnupg keyring files to be selected via sys env
Go
mit
tomykaira/trousseau,oleiade/trousseau,tomykaira/trousseau,mrnugget/trousseau,oleiade/trousseau,mrnugget/trousseau,mrnugget/trousseau,tomykaira/trousseau
2762e0a70a271c7af3d59ec6ad12d01ef8ef1ccd
jsonutil/jsonutil.go
jsonutil/jsonutil.go
package jsonutil import ( "bytes" "encoding/json" "strings" ) func Encode(v interface{}) (string, error) { var buf bytes.Buffer err := json.NewEncoder(&buf).Encode(v) if err != nil { return "", err } return strings.TrimRight(buf.String(), "\n"), nil } func Decode(s string) (v interface{}, er...
package jsonutil import ( "encoding/json" ) func Encode(v interface{}) (string, error) { bytes, err := json.Marshal(v) if err != nil { return "", err } return string(bytes), nil } func Decode(s string) (v interface{}, err error) { err = json.Unmarshal([]byte(s), &v) return }
Use Marshal and Unmarshal instead of Encode and Decode.
Use Marshal and Unmarshal instead of Encode and Decode.
Go
mit
hnakamur/commango
76b96a7b23ec2679afe32a52616a701067ce4067
xombrero.go
xombrero.go
// Copyright (c) 2014 Josh Rickmar. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package main import ( "github.com/conformal/gotk3/gtk" "runtime" ) const HomePage HTMLPageDescription = "https://www.duckduckgo.com/lite" const ( defaultWinWidth = 1024 default...
// Copyright (c) 2014 Josh Rickmar. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package main import ( "runtime" "github.com/conformal/gotk3/gtk" "github.com/jrick/go-webkit2/wk2" ) const HomePage HTMLPageDescription = "https://www.duckduckgo.com/lite" const...
Use multiple WebKit web processes.
Use multiple WebKit web processes. A new feature for WebKit2GTK+ 2.4, we can now specify to use multiple webkit web processes rather than all webviews sharing the same process. If a tab's web process is not shared with any other's (although currently unimplemented, this may happen when a tab is opened by another webv...
Go
isc
jrick/xombrero2
8d540120084298983ba1f7b3bd5578fd1817157b
main_test.go
main_test.go
package main import ( "bytes" "encoding/json" "fmt" "github.com/beard1ess/gauss/parsing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io/ioutil" "reflect" "testing" ) func TestDiff(t *testing.T) { var expected, actual parsing.ConsumableDifference assert := assert.New(t) re...
package main import ( "bytes" "encoding/json" "fmt" "github.com/beard1ess/gauss/parsing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io/ioutil" "reflect" "testing" ) func TestDiff(t *testing.T) { var expected, actual parsing.ConsumableDifference assert := assert.New(t) re...
Fix println statement to write a string
Fix println statement to write a string
Go
mit
beard1ess/gauss
aafa04c15675bca3c3d65d502a22e2a74b3fa664
log/zapadapter/adapter.go
log/zapadapter/adapter.go
// Package zapadapter provides a logger that writes to a go.uber.org/zap.Logger. package zapadapter import ( "context" "github.com/jackc/pgx/v4" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) type Logger struct { logger *zap.Logger } func NewLogger(logger *zap.Logger) *Logger { return &Logger{logger: logger.Wi...
// Package zapadapter provides a logger that writes to a go.uber.org/zap.Logger. package zapadapter import ( "context" "github.com/jackc/pgx/v4" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) type Logger struct { logger *zap.Logger } func NewLogger(logger *zap.Logger) *Logger { return &Logger{logger: logger.Wi...
Use zap.Any for handling interface{} -> zap.Field conversion
Use zap.Any for handling interface{} -> zap.Field conversion zap.Any falls back to zap.Reflect, but is better for this case, because it first checks for the types that zap handles specially. For example, time.Duration, or error, which zap.Reflect will just treat as untyped int64 or struct objects, but zap.Any is able...
Go
mit
jackc/pgx,jackc/pgx,jackc/pgx,jackc/pgx
12e7913d3c1deaeae1fa76fb0897af48ea4b947b
prgs/prgs.go
prgs/prgs.go
package prgs // Prg is a Program, with all its data (no behavior) type Prg struct{} // PGetter gets programs (from an internal config) type PGetter interface { Get() []*Prg } type defaultGetter struct{} var dg defaultGetter var getter PGetter func init() { dg = defaultGetter{} getter = dg } func (df defaultGett...
package prgs // Prg is a Program, with all its data (no behavior) type prg struct { name string } // Prg defines what kind of service a program has to provide type Prg interface { // Name is the name of a program to install, acts as an id Name() string } // PGetter gets programs (from an internal config) type PGe...
Make Prg an interface instead of a struct
Make Prg an interface instead of a struct
Go
mit
VonC/senvgo,VonC/senvgo
4d827b5ee6927ca922d960b64ec60bea752a16ab
core/geosystems.go
core/geosystems.go
package core import ( "math" ) type GeodeticSystem interface { ToGeographic(point *Point) *Point ToGeodetic(point *Point) *Point } type EllipseGeodetic struct { ellipseParam *EllipseParameters } func (eg *EllipseGeodetic) ToGeographic(point *Point) *Point { var lat float64 var long float64 if x != 0 { lo...
package core import ( "math" ) type GeodeticSystem interface { ToGeographic(point *Point) *Point ToGeodetic(point *Point) *Point } type EllipseGeodetic struct { ellipseParam *EllipseParameters } // This constants are defined for the GeocentricToGeodetic method const ( AD_C_Z1 = 1.0026000 AD_C_Z2 = 1.00092592 ...
Add function for geoentric to geodetic
Add function for geoentric to geodetic
Go
mit
yageek/goproj,go-gis/goproj
14003acd793eb6f1c5d72070c244afc3496c473a
main.go
main.go
package main import ( "flag" "fmt" "log" "net/http" "os" "github.com/google/go-github/github" "golang.org/x/oauth2" ) var ( addr = flag.String("addr", "", "Listen address.") port = flag.Int("port", 8081, "Listen port.") ) func main() { flag.Parse() log.SetOutput(os.Stderr) log.SetFlags(log.LstdFlags) ...
package main import ( "flag" "fmt" "log" "net/http" "os" "github.com/google/go-github/github" "golang.org/x/oauth2" ) var ( addr = flag.String("addr", "", "Listen address.") port = flag.Int("port", 8081, "Listen port.") ) func main() { flag.Parse() log.SetOutput(os.Stderr) log.SetFlags(log.LstdFlags) ...
Build GitHub client from token
Build GitHub client from token
Go
mpl-2.0
andrewslotin/doppelganger
cdb6c521826a1576aacd45467b7b76628100fb65
main.go
main.go
package main import ( "fmt" "log" "net/http" ) func main() { router := NewRouter() // By default, listen to port :9532 (:ykdb) fmt.Println("Listening on port 9532...") log.Fatal(http.ListenAndServe(":9532", router)) }
package main import ( "flag" "fmt" "log" "net/http" "strconv" ) func main() { // Read in the supplied flags from the command line to determine the port. // By default, listen to port :9532 (:ykdb) var portFlag int flag.IntVar(&portFlag, "port", 9532, "Port to listen on for http requests.") flag.Parse() por...
Allow program to listen on user-specified port
Allow program to listen on user-specified port yakdb now supports listening to a user-specified port. It will still run on :9532 if no port is specified. Resolves #1.
Go
mit
needcaffeine/yakdb
b1b2a876812af3705c180677b7309bbe66b65bf7
main.go
main.go
package main import ( "fmt" "io/ioutil" "log" "net/http" utils "github.com/shurcooL/github_flavored_markdown" ) func main() { http.HandleFunc("/", Handler) log.Printf("Listening on port %d\n", 8080) log.Fatal(http.ListenAndServe(":8080", nil)) } func Handler(res http.ResponseWriter, req *http.Request) { re...
package main import ( "flag" "fmt" "io/ioutil" "log" "net/http" utils "github.com/shurcooL/github_flavored_markdown" ) var ( file string bind string ) func init() { flag.StringVar(&bind, "bind", ":8080", "interface to bind to, eg. 0.0.0.0:8080") flag.StringVar(&file, "file", "README.md", "file to render o...
Read binding interface and MD file via flags.
Read binding interface and MD file via flags.
Go
mit
mongrelion/mdp
06796ae471e297dfd34f7a26983735bf1a4979b2
ece/encrypt.go
ece/encrypt.go
// Copyright 2016 Martijn Croonen. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. package ece import ( "crypto/aes" "crypto/cipher" "errors" ) // Encrypt encrypts |plaintext| using AEAD_AES_GCM_128 with the keys in |keys| // add...
// Copyright 2016 Martijn Croonen. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. package ece import ( "crypto/aes" "crypto/cipher" "encoding/binary" "errors" ) // Encrypt encrypts |plaintext| using AEAD_AES_GCM_128 with the ke...
Use 2 octets to indicate padding length.
Use 2 octets to indicate padding length.
Go
mit
Martijnc/gowebpush,Martijnc/gowebpush,Martijnc/gowebpush
3af62e460d8e9b09fb6afc479ca01045a9807f86
Go/go-calc.go
Go/go-calc.go
package main // Build a standalone executable with 'go build go-calc' // Or just do a one time run test with 'go run go-calc 1 / 4' import "fmt" import "os" // For ARGV import "strconv" func main() { var arg_count int = len(os.Args) - 1; if (arg_count != 3) { fmt.Fprintf(os.Stdout,"Usage: %s [num1] [+-/*] [num2...
package main // Build a standalone executable with 'go build go-calc' // Or just do a one time run test with 'go run go-calc 1 / 4' import "fmt" import "os" // For ARGV import "strconv" func main() { var arg_count int = len(os.Args) - 1; if (arg_count != 3) { fmt.Fprintf(os.Stdout,"Usage: %s [num1] [+-/*] [num2...
Add a check for division by zero
Add a check for division by zero
Go
mit
scottieinor/simple-calc-langs,scottieinor/simple-calc-langs
325959b0e0775ce997ca1454b0057e6ebe853918
events/user_events.go
events/user_events.go
package events import ( "encoding/json" ) type ( // UserEvent represents the user related segment of an Event within Ion Channel. // Action is the specific type of User Event that occurred, // Data is information relevant to the type of event, defined by one of the other structs in this file. UserEvent struct { ...
package events import ( "encoding/json" ) type ( // UserEvent represents the user related segment of an Event within Ion Channel. // Action is the specific type of User Event that occurred, // Data is information relevant to the type of event, defined by one of the other structs in this file. UserEvent struct { ...
Add PasswordChangedData struct to UserEvents
Add PasswordChangedData struct to UserEvents
Go
apache-2.0
ion-channel/ionic,ion-channel/ionic
3641040b5597b1b965b719b8fa56fb7641f2780c
pkg/config/config.go
pkg/config/config.go
package config import "runtime/debug" // SemVer is the version of mockery at build time. var SemVer = "v0.0.0-dev" func GetSemverInfo() string { if version, ok := debug.ReadBuildInfo(); ok { return version.Main.Version } return SemVer } type Config struct { All bool BuildTags stri...
package config // SemVer is the version of mockery at build time. var SemVer = "v0.0.0-dev" func GetSemverInfo() string { return SemVer } type Config struct { All bool BuildTags string `mapstructure:"tags"` Case string Config string Cpuprofile ...
Revert "fixed it which mockery's correct version showed."
Revert "fixed it which mockery's correct version showed."
Go
bsd-3-clause
vektra/mockery,vektra/mockery
b1b1b1b40e4ade606a22f8550ec7c14c2692674d
cells_test.go
cells_test.go
package vizzini_test import ( "strings" "code.cloudfoundry.org/bbs/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Cells", func() { It("should return all cells", func() { cells, err := bbsClient.Cells(logger) Expect(err).NotTo(HaveOccurred()) Expect(len(cells)).To(BeNumer...
package vizzini_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Cells", func() { It("should return all cells", func() { cells, err := bbsClient.Cells(logger) Expect(err).NotTo(HaveOccurred()) Expect(len(cells)).To(BeNumerically(">=", 1)) cell0 := cells[0] Expect(...
Remove test for cell name and availability zone.
Remove test for cell name and availability zone.
Go
apache-2.0
cloudfoundry-incubator/vizzini,pivotal-cf-experimental/vizzini,cloudfoundry-incubator/vizzini,pivotal-cf-experimental/vizzini
4258c2e0e7b3f57a5913e2983e316ad2b3e079a5
contrib/fhttp/fhttp.go
contrib/fhttp/fhttp.go
package fhttp import ( "github.com/jung-kurt/gofpdf" "net/http" ) // RegisterRemoteImage registers a remote image. Downloading the image from the // provided URL and adding it to the PDF but not adding it to the page. Use // Image() with the same URL to add the image to the page. func RegisterRemoteImage(f *gofpdf....
package fhttp import ( "github.com/jung-kurt/gofpdf" "net/http" ) // RegisterRemoteImage registers a remote image. Downloading the image from the // provided URL and adding it to the PDF but not adding it to the page. Use // Image() with the same URL to add the image to the page. func RegisterRemoteImage(f *gofpdf....
Use `GetImageInfo` to see if the image is already registered.
Use `GetImageInfo` to see if the image is already registered.
Go
mit
jung-kurt/gofpdf,jelmersnoeck/gofpdf,jelmersnoeck/gofpdf,ledongthuc/gofpdf
a63777686e70587831cabca1e69a2670119553b9
crypto/crypto.go
crypto/crypto.go
package crypto import ( "encoding/base64" "strings" "github.com/pborman/uuid" ) // SecureToken creates a new random token func SecureToken() string { token := uuid.NewRandom() return removePadding(base64.URLEncoding.EncodeToString([]byte(token))) } func removePadding(token string) string { return strings.Trim...
package crypto import ( "crypto/rand" "encoding/base64" "io" "strings" ) // SecureToken creates a new random token func SecureToken() string { b := make([]byte, 16) if _, err := io.ReadFull(rand.Reader, b); err != nil { panic(err.Error()) // rand should never fail } return removePadding(base64.URLEncoding.E...
Use rand.Reader directly instead of relying upon uuid
Use rand.Reader directly instead of relying upon uuid uuid did some bit manipulation so actually only guaranteed 122 bits of random data. This change gets us the full 128 bits.
Go
mit
netlify/gotrue,netlify/gotrue
0bb0ec93302744b468690b2eb5cf31d466375a68
chalk.go
chalk.go
// Package chalk lets you colour you // terminal string styles package chalk // Black colours your string black func Black(s string) string { return "\033[30m" + s + "\033[0m" } // Red colours your string red func Red(s string) string { return "\033[31m" + s + "\033[0m" } // Yellow colours your string yellow func ...
// Package chalk lets you colour you // terminal string styles package chalk // Black colours your string black func Black(s string) string { return "\033[30m" + s + "\033[0m" } // Red colours your string red func Red(s string) string { return "\033[31m" + s + "\033[0m" } // Green colours your string green func Gr...
Fix green and yellow being opposites
Fix green and yellow being opposites
Go
apache-2.0
bentranter/chalk
57d2e92aa2960640063cab007baaaca12050f960
sink/helper.go
sink/helper.go
package sink import ( "fmt" "os" ) // GetSink ... func GetSink() (Sink, error) { sinkType := os.Getenv("SINK_TYPE") if sinkType == "" { return nil, fmt.Errorf("Missing SINK_TYPE: amqp, kafka,kinesis or stdout") } switch sinkType { case "amqp": fallthrough case "rabbitmq": return NewRabbitmq() case "ka...
package sink import ( "fmt" "os" ) // GetSink ... func GetSink() (Sink, error) { sinkType := os.Getenv("SINK_TYPE") if sinkType == "" { return nil, fmt.Errorf("Missing SINK_TYPE: amqp, kafka, kinesis, nsq or stdout") } switch sinkType { case "amqp": fallthrough case "rabbitmq": return NewRabbitmq() ca...
Add the new NSQ sink to the sink list
Add the new NSQ sink to the sink list
Go
bsd-3-clause
seatgeek/nomad-firehose
55f66b1c0ccd2d6f4e0feec45e7a6c661f78f142
version_gen.go
version_gen.go
package wol // WARNING: Auto generated version file. Do not edit this file by hand. // WARNING: go get github.com/sabhiram/gover to manage this file. // Version: 1.0.4 const ( Major = 1 Minor = 0 Patch = 4 Version = "1.0.4" )
package wol // WARNING: Auto generated version file. Do not edit this file by hand. // WARNING: go get github.com/sabhiram/gover to manage this file. // Version: 1.0.4 const ( Major = 1 Minor = 0 Patch = 4 Version = "1.0.4" )
Fix gofmt on generated version file
Fix gofmt on generated version file
Go
mit
sabhiram/go-wol,sabhiram/go-wol
aa4b1c01b0b4eeadab857cca016351a63d7cd1d8
exec.go
exec.go
package codeutilsShared import ( "os" "os/exec" "strings" ) // ExecCommand executes a utility with args and returning the stringified output func ExecCommand(utility string, args []string, liveOutput bool) string { var output []byte runner := exec.Command(utility, args...) if liveOutput { // If we should immed...
package codeutilsShared import ( "os" "os/exec" "strings" ) // ExecCommand executes a utility with args and returning the stringified output func ExecCommand(utility string, args []string, liveOutput bool) string { var output []byte runner := exec.Command(utility, args...) if liveOutput { // If we should immed...
Return inverse boolean of contains for ExecutableExists.
Return inverse boolean of contains for ExecutableExists.
Go
apache-2.0
StroblIndustries/codeutilsShared,StroblIndustries/coreutils
7877a39a708de1a0b40e8f98b5bcffd625c259ff
flex.go
flex.go
/* This is a FLEXible file which can be used by both client and daemon. * Teehee. */ package lxd import ( "bufio" "os" "path/filepath" ) var Version = "0.0.1" /* * Please increment the api compat number every time you change the API. * * Version 1.0: ping */ var APICompat = 1 var APIVersion = "1.0" // VarP...
/* This is a FLEXible file which can be used by both client and daemon. * Teehee. */ package lxd import ( "bufio" "os" "path/filepath" ) var Version = "0.0" /* * Please increment the api compat number every time you change the API. * * Version 1.0: ping */ var APICompat = 1 var APIVersion = "1.0" // VarPat...
Use 0.0 as our version
Use 0.0 as our version Signed-off-by: Tycho Andersen <10c18fcb898ee6b17d6575d444b125d10b3f4d6a@canonical.com>
Go
apache-2.0
benaryorg/lxd,techtonik/lxd,stgraber/lxd,techtonik/lxd,Skarlso/lxd,chrisglass/lxd,basvanbeek/lxd,atxwebs/lxd,stgraber/lxd,rrva/lxd,Skarlso/lxd,hallyn/lxd,beni55/lxd,jumpstarter-io/lxd,tych0/lxd,achanda/lxd,jsavikko/lxd,pcdummy/lxd,pcdummy/lxd,basvanbeek/lxd,hallyn/lxd,hallyn/lxd,pcdummy/lxd,mjeanson/lxd,sl1pm4t/lxd,jen...
8f65a61d67722c256cdcc8f0500aefa2b4e9fab6
nightlies/s3-upload.go
nightlies/s3-upload.go
package main import ( "compress/gzip" "io" "log" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3/s3manager" ) func main() { file, err := os.Open("upload_file.tar") if err != nil { log.Fatal("Failed to open ...
package main import ( "compress/gzip" "io" "log" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3/s3manager" ) var key = "secretKey" var bucket = "theBucket" func main() { file, err := os.Open("upload_file.tar") if...
Move key and bucket strings into variables
Move key and bucket strings into variables
Go
mit
bjwbell/ironframe,bjwbell/ironframe,bjwbell/ironframe,bjwbell/ironframe,bjwbell/ironframe
55683db05ffa84f0c9ef086251139a8e11a18dc0
hosts_file.go
hosts_file.go
package dnsp import ( "fmt" "strings" ) type HostEntry struct { IP string Host string } func (h *HostEntry) String() string { return fmt.Sprintf("%v @ %v", h.Host, h.IP) } func ParseHostLine(line string) HostEntry { result := HostEntry{} if len(line) > 0 { parts := strings.Fields(line) // TODO: More ...
package dnsp import ( "fmt" "strings" ) type HostEntry struct { IP string Host string } func (h *HostEntry) String() string { return fmt.Sprintf("%v @ %v", h.Host, h.IP) } func ParseHostLine(line string) *HostEntry { result := HostEntry{} if len(line) > 0 { parts := strings.Fields(line) // TODO: More...
Return a pointer from ParseHostLine
Return a pointer from ParseHostLine
Go
mit
gophergala/dnsp,gophergala/dnsp,stutiredboy/ddns
94a46963220d3b3cbe4756f7964de495f25c6fc7
cmds/mkfifo/mkfifo.go
cmds/mkfifo/mkfifo.go
// Copyright 2013-2017 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // mkfifo creates a named pipe. // // Synopsis: // mkfifo [OPTIONS] NAME... // // Options: // -m: mode (default 0600) // package main import ( ...
// Copyright 2013-2017 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // mkfifo creates a named pipe. // // Synopsis: // mkfifo [OPTIONS] NAME... // // Options: // -m: mode (default 0600) // package main import ( ...
Remove syscall package in favor of unix package
Remove syscall package in favor of unix package
Go
bsd-3-clause
hugelgupf/u-root,rminnich/u-root,u-root/u-root,hugelgupf/u-root,hugelgupf/u-root,hugelgupf/u-root,rminnich/u-root,GanShun/u-root,rminnich/u-root,u-root/u-root,GanShun/u-root,u-root/u-root,rminnich/u-root,GanShun/u-root
66306253961fbff152d00755910bb1327368055b
go/nucleotide-count/nucleotide_count.go
go/nucleotide-count/nucleotide_count.go
package dna // Histogram is a mapping from nucleotide to its count in given DNA. type Histogram map[rune]int type DNA string // Counts generates a histogram of valid nucleotides in the given DNA. // Returns an error if d contains an invalid nucleotide. func (d DNA) Counts() (Histogram, error) { h := Histogram{ 'A...
package dna import "fmt" // Histogram is a mapping from nucleotide to its count in given DNA. type Histogram map[rune]int type DNA string // Counts generates a histogram of valid nucleotides in the given DNA. // Returns an error if d contains an invalid nucleotide. func (d DNA) Counts() (Histogram, error) { if !d....
Throw error if DNA strand is invalid
Throw error if DNA strand is invalid
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
d24073084723c8426da64d9bff3ac1c7b8034ecc
individual.go
individual.go
package gedcom // Individual represents an individual record in a node structure with links to // other individuals. type Individual struct { Node *Node Father *Individual Mother *Individual }
package gedcom // Individual represents an individual record in a node structure with links to // other individuals. type Individual struct { Node *Node Father *Individual Mother *Individual } // GetName returns the name of the individual. If there is no name attached to // the individual, an empty string is ret...
Add a GetName function that's a wrapper around Node.GetAttribute("NAME")
Add a GetName function that's a wrapper around Node.GetAttribute("NAME") This will return an empty string if there is no name set.
Go
mit
lukevers/gedcom
6de3139072bc6c74cfe672d33d30b0778670eace
lxd/lifecycle/network_load_balancer.go
lxd/lifecycle/network_load_balancer.go
package lifecycle import ( "github.com/lxc/lxd/shared/api" "github.com/lxc/lxd/shared/version" ) // NetworkLoadBalancerAction represents a lifecycle event action for network load balancers. type NetworkLoadBalancerAction string // All supported lifecycle events for network forwards. const ( NetworkLoadBalancerCre...
package lifecycle import ( "github.com/lxc/lxd/shared/api" "github.com/lxc/lxd/shared/version" ) // NetworkLoadBalancerAction represents a lifecycle event action for network load balancers. type NetworkLoadBalancerAction string // All supported lifecycle events for network load balancers. const ( NetworkLoadBalan...
Fix load balancer lifecycle types
lxd/lifecycle/network/load/balancer: Fix load balancer lifecycle types Signed-off-by: Thomas Parrott <6b778ce645fb0e3dde76d79eccad490955b1ae74@canonical.com>
Go
apache-2.0
stgraber/lxd,lxc/lxd,lxc/lxd,lxc/lxd,hallyn/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,lxc/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,hallyn/lxd,stgraber/lxd,stgraber/lxd
577564d1d5603f50e8ecc78362ea520cb12b1e29
fileserver/fileserver.go
fileserver/fileserver.go
package fileserver // FileServer serves web resources from files. type FileServer struct { // ContentRoot is the folder containing the content ContentRoot string Getters []Getter } // NewFileServer creates a new instance with default cacheServ & fileServ func NewFileServer(contentRoot string) (fs FileServer) {...
package fileserver // FileServer serves web resources from files. type FileServer struct { // ContentRoot is the folder containing the content ContentRoot string Getters []Getter } // NewFileServer creates a new instance with default cacheServ & fileServ Getters func NewFileServer(contentRoot string) (fs FileS...
Use constructor rather than object.Param = syntax
Use constructor rather than object.Param = syntax
Go
mit
jacobhands/multiweb,jacobhands/multiweb
2a85f587d3109de5155f500c51042c6cd61dd18b
blorg/config_test.go
blorg/config_test.go
package blorg import ( "fmt" "io/ioutil" "os/exec" "strings" "testing" ) func TestBlorg(t *testing.T) { config, err := ReadConfig("testdata/blorg.org") if err != nil { t.Errorf("Could not read config: %s", err) return } commitedHashBs, err := ioutil.ReadFile("testdata/public.md5") if err != nil { t.Er...
package blorg import ( "fmt" "io/ioutil" "os/exec" "strings" "testing" ) func TestBlorg(t *testing.T) { config, err := ReadConfig("testdata/blorg.org") if err != nil { t.Errorf("Could not read config: %s", err) return } committedHashBs, err := ioutil.ReadFile("testdata/public.md5") if err != nil { t.E...
Fix a typo in blorg test
Fix a typo in blorg test
Go
mit
niklasfasching/go-org,niklasfasching/go-org
680c733882cab51fea3faa7086b053a85df83251
cache/lru_test.go
cache/lru_test.go
package cache import ( "fmt" "strings" "testing" ) func TestLruCache_Get(t *testing.T) { l := NewLRUCache(1024 * 1024) for idx := 0; idx < 100000; idx++ { l.Set(strings.Repeat(fmt.Sprintf("%016d", idx), 16)) } if l.Size() > 2*1024*1024 { t.Fatal(l.Size()) } if l.Count() > 5000 { t.Fatal(l.Size()) } ...
package cache import ( "fmt" "strings" "testing" ) func TestLruCache_Get(t *testing.T) { format := func(idx int) string { return strings.Repeat(fmt.Sprintf("%016d", idx), 16) } l := NewLRUCache(1024 * 1024) for idx := 0; idx < 100000; idx++ { l.Set(format(idx)) } if l.Size() > 2*1024*1024 { t.Fatal(l...
Add a test for the LRU implementation
Add a test for the LRU implementation
Go
mit
flachnetz/dd-zipkin-proxy
3369ca8862c8b7fd99e37bc74155488ea9a346cd
example/router.go
example/router.go
package main import ( "atlantis/router/lb" "flag" ) var servers string func main() { flag.StringVar(&servers, "zk", "localhost:2181", "zookeeper connection string") balancer := lb.New(servers) balancer.Run() }
package main import ( "atlantis/router/lb" "flag" "log" "log/syslog" ) var servers string func main() { // Logging to syslog is more performant, which matters. w, err := syslog.New(syslog.LOG_INFO, "atlantis-router") if err != nil { log.Println("[ERROR] cannot log to syslog!") } else { log.SetOutput(w) ...
Switch logging to syslog for performance.
Switch logging to syslog for performance.
Go
apache-2.0
ooyala/atlantis-router,ooyala/atlantis-router,ooyala/atlantis-router,budhrg/atlantis-router,ooyala/atlantis-router,budhrg/atlantis-router,budhrg/atlantis-router,ooyala/atlantis-router,budhrg/atlantis-router,budhrg/atlantis-router
036080221477ff7cd909d0b5091a319476ad9d67
lib/converter_test.go
lib/converter_test.go
package fm_test import ( "go/ast" "testing" "github.com/enocom/fm/lib" ) func TestConvertBuildsAddsSpyToTypeSpecName(t *testing.T) { converter := &fm.SpyStructConverter{} typeSpec := converter.Convert( &ast.TypeSpec{ Name: ast.NewIdent("Tester"), }, &ast.InterfaceType{ Methods: &ast.FieldList{List:...
package fm_test import ( "go/ast" "testing" "github.com/enocom/fm/lib" ) func TestConvertBuildsAddsSpyToTypeSpecName(t *testing.T) { converter := &fm.SpyStructConverter{} typeSpec := converter.Convert( &ast.TypeSpec{Name: ast.NewIdent("Tester")}, &ast.InterfaceType{ Methods: &ast.FieldList{List: make([]...
Add converter test confirming "_Called" field
Add converter test confirming "_Called" field
Go
unlicense
enocom/fm,enocom/fm
14dc3f5e761ee8f72aa3fc117752a4e5c52381bb
metrics/controller.go
metrics/controller.go
package metrics import "github.com/prometheus/client_golang/prometheus" var ( // PodFailure returns counter for pod_errors_total metric PodFailure = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "pod_errors_total", Help: "Number of failure operation on PODs", }, []string{"operation"}, ) // ...
package metrics import "github.com/prometheus/client_golang/prometheus" var ( // PodFailure returns counter for pod_errors_total metric PodFailure = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "pod_errors_total", Help: "Number of failure operation on PODs", }, []string{"operation"}, ) // ...
Fix typo from comment of a exported type
Fix typo from comment of a exported type
Go
apache-2.0
tczekajlo/kube-consul-register
26fead6a64ec453e40f2bc4fb41ac7148ee6cb3b
doc_test.go
doc_test.go
package opensimplex import "math/rand" func Example() { noise := New(rand.Int63()) w, h := 100, 100 heightmap := make([]float64, w, h) for y := 0; y < h; y++ { for x := 0; x < w; x++ { xFloat := float64(x) / float64(w) yFloat := float64(y) / float64(h) heightmap[(y*w)+x] = noise.Eval2(xFloat, yFloat) ...
package opensimplex import "math/rand" func Example() { noise := New(rand.Int63()) w, h := 100, 100 heightmap := make([]float64, w*h) for y := 0; y < h; y++ { for x := 0; x < w; x++ { xFloat := float64(x) / float64(w) yFloat := float64(y) / float64(h) heightmap[(y*w)+x] = noise.Eval2(xFloat, yFloat) ...
Fix heightmap := make([]float64, w, h)
Fix heightmap := make([]float64, w, h) heightmap := make([]float64, w*h)
Go
unlicense
ojrac/opensimplex-go
e05c5060b15f74428f7464d4e3b09b60d5771fc7
features.go
features.go
package dsbldr // RunFunc holds the computation that processes the API responses to features // is sent a JSON string of the response ??as well as a map of data from the features parent features?? // Basically what you do with the run function is take in a string of // serialized API data (could be in JSON or XML), do...
package dsbldr // RunFunc holds the computation that processes the API responses to features // is sent a JSON string of the response ??as well as a map of data from the features parent features?? // Basically what you do with the run function is take in a string of // serialized API data (could be in JSON or XML), do...
Add RetrieveType, noSave and status fields to Feature struct
Add RetrieveType, noSave and status fields to Feature struct
Go
mit
Korede-TA/dsbldr
fbee2a389140f70ec16be73c09ea9c87c1e2ff16
api_handler.go
api_handler.go
package main import ( "encoding/json" "fmt" "io/ioutil" "github.com/pilu/traffic" "github.com/tealeg/xlsx" ) type ExcelData struct { DocumentName string Sheets [][][]string } func excelResponse(w traffic.ResponseWriter, r *traffic.Request) { file, handler, err := r.FormFile("file") if err != nil { ...
package main import ( "encoding/json" "fmt" "io/ioutil" "github.com/pilu/traffic" "github.com/tealeg/xlsx" ) type ExcelData struct { DocumentName string Sheets [][][]string } func excelResponse(w traffic.ResponseWriter, r *traffic.Request) { file, handler, err := r.FormFile("file") if err != nil { ...
Add debugging println to show content of spreadsheet on the console.
Add debugging println to show content of spreadsheet on the console.
Go
bsd-3-clause
tealeg/helloxl,tealeg/helloxl
2cfc85c8b300c5a727f7caebc8530a8db4e96c43
pkg/kubelet/dockershim/docker_stats_unsupported.go
pkg/kubelet/dockershim/docker_stats_unsupported.go
// +build !linux,!windows /* 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 la...
// +build !linux,!windows /* 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 la...
Fix compile on non windows linux systems
Fix compile on non windows linux systems
Go
apache-2.0
yarntime/kubernetes,roberthbailey/kubernetes,shyamjvs/kubernetes,pmorie/kubernetes,Lion-Wei/kubernetes,ping035627/kubernetes,verb/kubernetes,rrati/kubernetes,deads2k/kubernetes,bparees/kubernetes,coolsvap/kubernetes,cofyc/kubernetes,nikhita/kubernetes,tomzhang/kubernetes,u2takey/kubernetes,dereknex/kubernetes,coolsvap/...
02b9bd83b1c66bbf232d272edcdadd3af9c29e21
client.go
client.go
package main import ( "bufio" "fmt" "net" ) func clientLoop(conn net.Conn, clientId int) { clientWriteBytes(conn, motd) clientWrite(conn, "\nDragonroar!\nV0026\n") reader := bufio.NewReader(conn) for { incoming, err := reader.ReadString('\n') if err != nil { break } if incoming[0] == '"' { chanB...
package main import ( "bufio" "fmt" "net" ) func clientLoop(conn net.Conn, clientId int) { clientWriteBytes(conn, motd) clientWrite(conn, "\nDragonroar!\nV0026\n") reader := bufio.NewReader(conn) for { incoming, err := reader.ReadString('\n') if err != nil { break } if incoming[0] == '"' { chanB...
Fix not prepending output for text display properly
Fix not prepending output for text display properly
Go
unlicense
amaloy/despite
e79f5331726d29c2f1213ffd942d2670d09cb40f
_examples/pull/main.go
_examples/pull/main.go
package main import ( "fmt" "os" "gopkg.in/src-d/go-git.v4" . "gopkg.in/src-d/go-git.v4/_examples" ) // Pull changes from a remote repository func main() { CheckArgs("<path>") path := os.Args[1] // We instance\iate a new repository targeting the given path (the .git folder) r, err := git.PlainOpen(path) Ch...
package main import ( "fmt" "os" "gopkg.in/src-d/go-git.v4" . "gopkg.in/src-d/go-git.v4/_examples" ) // Pull changes from a remote repository func main() { CheckArgs("<path>") path := os.Args[1] // We instantiate a new repository targeting the given path (the .git folder) r, err := git.PlainOpen(path) Chec...
Fix typo on pull example
examples: Fix typo on pull example Signed-off-by: Theodore Keloglou <a07b7322a11cee41c8267d5dc5751e643be543a6@gmail.com>
Go
apache-2.0
mcuadros/go-git,src-d/go-git,mcuadros/go-git,src-d/go-git,go-git/go-git,go-git/go-git
33d58ef5debc48d6d2862005967efeafe935ea35
WebScriptHook.Server/serverconfig.go
WebScriptHook.Server/serverconfig.go
package main import ( "fmt" "io/ioutil" "log" "gopkg.in/gcfg.v1" ) var serverConfig = struct { Server struct { Port string } Message struct { Timeout int } TLS struct { UseHTTPS bool Cert string Key string } WebSocketAuth struct { Username string Password string } }{} func readCon...
package main import ( "fmt" "io/ioutil" "log" "gopkg.in/gcfg.v1" ) var serverConfig = struct { Server struct { Port string } Message struct { Timeout int } TLS struct { UseHTTPS bool Cert string Key string } }{} func readConfig() { log.Println("Reading config") filebytes, _ := ioutil....
Remove auth from server config struct
Remove auth from server config struct
Go
mit
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
58b2bb5c502fd3bddf68ced3b20d0baa9e263603
lua_test.go
lua_test.go
package lua import ( "regexp" "testing" ) // https://github.com/Shopify/go-lua/pull/63 func TestPushFStringPointer(t *testing.T) { l := NewState() l.PushFString("%p %s", l, "test") actual := CheckString(l, -1) ok, err := regexp.MatchString("0x[0-9a-f]+ test", actual) if !ok { t.Error("regex did not match") ...
package lua import ( "fmt" "testing" ) func TestPushFStringPointer(t *testing.T) { l := NewState() l.PushFString("%p %s", l, "test") expected := fmt.Sprintf("%p %s", l, "test") actual := CheckString(l, -1) if expected != actual { t.Errorf("PushFString, expected \"%s\" but found \"%s\"", expected, actual) }...
Use exact string match for PushFString test.
Use exact string match for PushFString test.
Go
mit
Shopify/go-lua
d0c48a1227827cb33e30827738560052010937ee
schema/command_type.go
schema/command_type.go
package schema // CommandType is an enum of the type that can be represented by a schema. type CommandType int //go:generate stringer -type=CommandType :: manual const ( CommandInvalid CommandType = iota CommandList CommandCreate CommandRead CommandUpdate CommandDelete CommandManipulateMulti CommandManipulate...
package schema // CommandType is an enum of the type that can be represented by a schema. type CommandType int //go:generate stringer -type=CommandType :: manual const ( CommandInvalid CommandType = iota CommandList CommandCreate CommandRead CommandUpdate CommandDelete CommandManipulateMulti CommandManipulate...
Make the read command target to only a single resource
Make the read command target to only a single resource
Go
apache-2.0
sacloud/usacloud,sacloud/usacloud,yamamoto-febc/usacloud,yamamoto-febc/usacloud
16b8ee1dcedcaf0ca2434cf90d416671256c3347
errors.go
errors.go
package ebay import "strings" type ebayErrors []ebayResponseError func (err ebayErrors) Error() string { var errors []string for _, e := range err { errors = append(errors, e.LongMessage) } return strings.Join(errors, ",") }
package ebay import "strings" type ebayErrors []ebayResponseError func (err ebayErrors) Error() string { var errors []string for _, e := range err { errors = append(errors, e.LongMessage) } return strings.Join(errors, ",") } func (errs ebayErrors) RevisionError() bool { for _, err := range errs { if err....
Add RevisionError and ListingEnded error functions
Add RevisionError and ListingEnded error functions
Go
isc
zombor/go-ebay
dc75f78d80004b0dc365b7e40e3c040531ffded5
nodes/stampzilla-server/logic/command_pause_test.go
nodes/stampzilla-server/logic/command_pause_test.go
package logic import ( "fmt" "testing" "time" "github.com/stretchr/testify/assert" ) func TestPauseCommandFromJson(t *testing.T) { mapper := NewActionsMapper() a := &ActionService{} mapper.Load(a) if a, ok := a.GetByUuid("actionuuid1").(*action); ok { if c, ok := a.Commands[1].(*command_pause); ok { f...
package logic import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestPauseCommandFromJson(t *testing.T) { mapper := NewActionsMapper() a := &ActionService{} mapper.Load(a) if a, ok := a.GetByUuid("actionuuid1").(*action); ok { if c, ok := a.Commands[1].(*command_pause); ok { t.Logf("...
Fix test issue when using goconvey
Fix test issue when using goconvey
Go
apache-2.0
stampzilla/stampzilla-go,stampzilla/stampzilla-go,stampzilla/stampzilla-go,stampzilla/stampzilla-go,stampzilla/stampzilla-go
caa2d9b5bad5ccf4e3706d2f688d0d1139c4725f
data-reader.go
data-reader.go
package main import ( "os" ) func getBenchmarkInput(filename string) (output []BenchmarkInput, err error) { defer func() { if r := recover(); r != nil { err = r.(error) } }() _ = readRawData(filename) return output, err } func readRawData(filename string) (output []string) { fd, err := os.Open(filen...
package main import ( "bufio" "os" "strings" ) func getBenchmarkInput(filename string) (output []BenchmarkInput, err error) { defer func() { if r := recover(); r != nil { err = r.(error) } }() fd, err := os.Open(filename) if err != nil { panic(err) } defer fd.Close() for scanner := bufio.NewScan...
Remove comment and whitespace in getBenchmarkInput
Remove comment and whitespace in getBenchmarkInput
Go
mit
zhtw/bopomofo-benchmark,zhtw/bopomofo-benchmark
3b087bf8c46bf0fda753d6015c40ede45122b765
transport/internet/tls/config_windows.go
transport/internet/tls/config_windows.go
// +build windows // +build !confonly package tls import "crypto/x509" func (c *Config) getCertPool() (*x509.CertPool, error) { if c.DisableSystemRoot { return c.loadSelfCertPool() } return nil, nil }
// +build windows // +build !confonly package tls import "crypto/x509" func (c *Config) getCertPool() (*x509.CertPool, error) { return c.loadSelfCertPool() }
Fix self-signed certificates on Windows
Fix self-signed certificates on Windows
Go
mit
v2ray/v2ray-core,panzer13/v2ray-core,v2ray/v2ray-core,panzer13/v2ray-core
400764703c931ba79573d1e50b8c0ca5718a782b
web/filters/filters.go
web/filters/filters.go
package filters import ( "bones/repositories" "bones/web/context" "log" "net/http" ) func Params(res http.ResponseWriter, req *http.Request, chain *RequestFilterChain) { err := context.InitParams(req) if err != nil { panic(err) } chain.next() } func Authenticate(res http.ResponseWriter, req *http.Request...
package filters import ( "bones/repositories" "bones/web/context" "log" "net/http" ) func Params(res http.ResponseWriter, req *http.Request, chain *RequestFilterChain) { err := context.InitParams(req) if err != nil { panic(err) } chain.next() } func Authenticate(res http.ResponseWriter, req *http.Request...
Fix "http: multiple response.WriteHeader calls"
Fix "http: multiple response.WriteHeader calls"
Go
mit
peterskeide/bones
ac7c2234a21aec4cccc98ecebb8cfe22a1c47bb2
config_test.go
config_test.go
package oak import ( "os" "testing" "github.com/stretchr/testify/assert" ) func TestDefaultConfig(t *testing.T) { err := LoadConf("default.config") assert.Nil(t, err) assert.Equal(t, conf, SetupConfig) f, err := os.Open("default.config") assert.Nil(t, err) err = LoadConfData(f) assert.Nil(t, err) SetupCon...
package oak import ( "os" "testing" "github.com/stretchr/testify/assert" ) func TestDefaultConfig(t *testing.T) { err := LoadConf("default.config") assert.Nil(t, err) assert.Equal(t, conf, SetupConfig) f, err := os.Open("default.config") assert.Nil(t, err) err = LoadConfData(f) assert.Nil(t, err) SetupCon...
Update TestDefaultConfig to include target dimensions
Update TestDefaultConfig to include target dimensions
Go
apache-2.0
oakmound/oak,oakmound/oak,oakmound/oak
be7aaaa8feaaaea5ca1289d95e3f415db190aff4
countryspec.go
countryspec.go
package stripe // Country is the list of supported countries type Country string // VerificationFieldsList lists the fields needed for an account verification. // For more details see https://stripe.com/docs/api#country_spec_object-verification_fields. type VerificationFieldsList struct { AdditionalFields []string `...
package stripe // Country is the list of supported countries type Country string // VerificationFieldsList lists the fields needed for an account verification. // For more details see https://stripe.com/docs/api#country_spec_object-verification_fields. type VerificationFieldsList struct { AdditionalFields []string `...
Add support for `supported_transfer_countries` on CountrySpec
Add support for `supported_transfer_countries` on CountrySpec
Go
mit
ChannelMeter/stripe-go,stripe/stripe-go,stripe/stripe-go,ChannelMeter/stripe-go
972956f61894958dc1ce5150664aadaa23fcea4b
bundler/backend/FrontendFileHandler.go
bundler/backend/FrontendFileHandler.go
package backend import ( "imperial-splendour-bundler/backend/customErrors" "os" ) func (a *API) SelectSourceDir() (string, error) { dir := a.dialog.SelectDirectory() sourceDir, err := os.Stat(dir) if err != nil || !sourceDir.IsDir() { return "", customErrors.InvalidDir } return dir + "/", nil } func (a *AP...
package backend import ( "imperial-splendour-bundler/backend/customErrors" "os" ) func (a *API) SelectSourceDir() (string, error) { dir := a.dialog.SelectDirectory() sourceDir, err := os.Stat(dir) if err != nil || !sourceDir.IsDir() { return "", customErrors.InvalidDir } return dir + "/", nil } func (a *AP...
Fix broken file list path getter
Fix broken file list path getter
Go
mit
SophieAu/imperial-splendour-launcher,SophieAu/imperial-splendour-launcher,SophieAu/imperial-splendour-launcher,SophieAu/imperial-splendour-launcher
10d67817e85716b9b0cdbc1c819b36feb9ddfbe8
turtle.go
turtle.go
package turtle // Version of the turtle library const Version = "v0.1.0" // Emojis maps a name to an Emoji var Emojis = make(map[string]*Emoji) func init() { for _, e := range emojis { Emojis[e.Name] = e } } // Search emojis by a name func Search(s string) []*Emoji { return search(emojis, s) } // Keyword filt...
package turtle // Version of the turtle library const Version = "v0.1.0" // Emojis maps a name to an Emoji var Emojis = make(map[string]*Emoji) // EmojisByChar maps a character to an Emoji var EmojisByChar = make(map[string]*Emoji) func init() { for _, e := range emojis { Emojis[e.Name] = e EmojisByChar[e.Char...
Add new map for emoji characters to emoji
Add new map for emoji characters to emoji
Go
mit
hackebrot/turtle
300b3ff35e2dd89177b6dcd2b1b86dde60db37b1
scamp/ticket_test.go
scamp/ticket_test.go
package scamp import ( "io/ioutil" "testing" ) var pemPath = "./../fixtures/ticket_verify_public_key.pem" func TestTicket(t *testing.T) { good, err := ioutil.ReadFile("./../fixtures/processor-dispatch.token") if err != nil { t.Fatalf(err.Error()) } if good == nil { t.Fatalf("nil ticket") } tkt, err := ...
package scamp import ( "io/ioutil" "path/filepath" "runtime" "testing" ) var ( // Get root of the project. _, base, _, _ = runtime.Caller(0) basePath = filepath.Dir(base) fixturesPath = basePath + "/../fixtures" pemPath = fixturesPath + "/ticket_verify_public_key.pem" dispatchPath = fixturesPat...
Use project base path to find fixtures
Use project base path to find fixtures
Go
mit
gudTECH/scamp-go,gudTECH/scamp-go