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
b18307394e8b3b2c96d409a5abd74fd2456baf4f
adapters/phoenix.go
adapters/phoenix.go
package adapters import "regexp" // TODO: handle installing js assets? // [error] Could not start node watcher because script "/Users/richard/workspace/moocode/hoot/apps/web/assets/node_modules/brunch/bin/brunch" does not exist. Your Phoenix application is still running, however assets won't be compiled. You may fix ...
package adapters import "regexp" const phoenixShellCommand = `exec bash -c ' cd %s exec mix do deps.get, phx.server' ` // CreatePhoenixAdapter creates a new phoenix adapter func CreatePhoenixAdapter(host, dir string) (Adapter, error) { // TODO: look at the mix.exs file and determine which version of phoenix // we...
Make restart pattern name clearer
Make restart pattern name clearer
Go
mit
moomerman/zap,moomerman/zap,moomerman/zap,moomerman/phx-dev,moomerman/phx-dev,moomerman/phx-dev,moomerman/phx-dev,moomerman/zap
df2a903d9538ac5637f46fc3b88320fba4f18277
io/interfaces.go
io/interfaces.go
package io import "github.com/valep27/GChip8/emu" // Frontend is the basic interface for graphical output. // A frontend might be implemented by SDL, opengl or similar libraries. type Frontend interface { Initialize() Draw(emulator emu.Chip8) Close() }
package io import "github.com/valep27/GChip8/emu" // Frontend is the basic interface for graphical output. // A frontend might be implemented by SDL, opengl or similar libraries. type Frontend interface { Initialize() Draw(emulator emu.Chip8) Close() } // Key is the type for identifying a key on the Chip8 keypad....
Add basic input interface and Key enum
Add basic input interface and Key enum
Go
mit
valep27/GChip8
2249452542dee82b463de4870b40f05ff467a99b
list/list.go
list/list.go
package list import "fmt" type List struct { first *Node last *Node size int } type Node struct { next *Node val int } func (l *List) String() string { if l.IsEmpty() { return "List()" } else { return fmt.Sprintf("List(%s)", l.first.Stringl()) } } func (n *Node) String() string { return fmt.Sprintf...
package list import "fmt" type List struct { first *Node last *Node size int } type Node struct { next *Node val int } func (l *List) String() string { if l.IsEmpty() { return "List()" } else { return fmt.Sprintf("List(%s)", l.first.Stringl()) } } func (n *Node) String() string { return fmt.Sprintf...
Add Shift and you've got a Queue going...
Add Shift and you've got a Queue going...
Go
unlicense
neilvallon/alGo
09a66644df9a7c9e23ddd69dc57298c5de69ffac
file/translator/unknown_key_test.go
file/translator/unknown_key_test.go
package translator import ( "github.com/Shopify/go-lua" "github.com/fsouza/go-dockerclient" "reflect" "testing" ) func TestUnknownPropertiesConfig(t *testing.T) { source := `x = {blah = 5}` expected := docker.Config{} state := lua.NewState() if err := lua.DoString(state, source); err != nil { t.Errorf("Er...
package translator import ( "github.com/Shopify/go-lua" "github.com/fsouza/go-dockerclient" "reflect" "testing" ) func TestUnknownPropertiesConfig(t *testing.T) { source := `x = {blah = 5}` expected := docker.Config{} state := lua.NewState() if err := lua.DoString(state, source); err != nil { t.Errorf("Er...
Fix printf format bug: use %v for structs
Fix printf format bug: use %v for structs
Go
apache-2.0
thriqon/involucro,involucro/involucro
0c643d4144cbffd995d76da04052656aa81b9f62
go/InterfaceValues/main.go
go/InterfaceValues/main.go
package main // safe -- 7.01ns/op // unsafe -- 0.60ns/op import ( "fmt" "syscall" "unsafe" ) // can we unsafe cast to unwrap all the interface layers? Or is the value in // memory different now? No! We have a new layer of indirection... func unsafeErr(err error) uintptr { p1 := (uintptr)(unsafe.Pointer(&err)) ...
package main // safe -- 15.9ns/op // unsafe -- 1.6ns/op import ( "fmt" "syscall" "unsafe" ) // can we unsafe cast to unwrap all the interface layers? Or is the value in // memory different now? No! We have a new layer of indirection... func unsafeErr(err error) uintptr { if err != nil { p1 := (uintptr)(unsa...
Check for nil first in interferace casting (go).
Check for nil first in interferace casting (go).
Go
bsd-3-clause
dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps
459fe1d23ffb6e03ce168ad6fcfe858cb84776b6
storage/regex.go
storage/regex.go
package storage import "regexp" func init() { SupportedStorageTypes["Regex"] = new(interface{}) } type remap struct { Regex *regexp.Regexp Replacement string } type Regex struct { remaps []remap } func NewRegexFromList(redirects map[string]string) (*Regex, error) { remaps := make([]remap, 0, len(redirec...
package storage import ( "fmt" "regexp" ) func init() { SupportedStorageTypes["Regex"] = new(interface{}) } type remap struct { Regex *regexp.Regexp Replacement string } type Regex struct { remaps []remap } func NewRegexFromList(redirects map[string]string) (*Regex, error) { remaps := make([]remap, 0,...
Add SaveName to Regex, but just return an error message
Add SaveName to Regex, but just return an error message
Go
mit
thomaso-mirodin/go-shorten,thomaso-mirodin/go-shorten,thomaso-mirodin/go-shorten
e64cb6727eb613289f51428610899293de452b64
tcp_listeners.go
tcp_listeners.go
// Copyright (c) 2017, Janoš Guljaš <janos@resenje.org> // All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package web import ( "net" "time" ) // TCPKeepAliveListener sets TCP keep alive period. type TCPKeepAliveListener struct { *net.TC...
// Copyright (c) 2017, Janoš Guljaš <janos@resenje.org> // All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package web import ( "net" "time" ) // TCPKeepAliveListener sets TCP keep alive period. type TCPKeepAliveListener struct { *net.TC...
Check for errors from SetKeepAlive and SetKeepAlivePeriod in TCPKeepAliveListener Accept method
Check for errors from SetKeepAlive and SetKeepAlivePeriod in TCPKeepAliveListener Accept method
Go
bsd-3-clause
janos/web,janos/httputils
ff179ac586827cbd0b969abb50818775b6809288
flags/flags_test.go
flags/flags_test.go
package flags_test import ( "github.com/cloudfoundry/bosh-bootloader/flags" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Flags", func() { var ( f flags.Flags // boolVal bool stringVal string ) BeforeEach(func() { f = flags.New("test") f.String(&stringVal, "string", "")...
package flags_test import ( "github.com/cloudfoundry/bosh-bootloader/flags" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Flags", func() { var ( f flags.Flags stringVal string ) BeforeEach(func() { f = flags.New("test") f.String(&stringVal, "string", "") }) Descr...
Remove unused var to flags test.
Remove unused var to flags test.
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader
323289ab27d509f732d2e9055d229de21a4d5d1c
examples/greeter.go
examples/greeter.go
package main import ( "gopkg.in/antage/eventsource.v0" "log" "net/http" "time" ) func main() { es := eventsource.New(nil, nil) defer es.Close() http.Handle("/", http.FileServer(http.Dir("./public"))) http.Handle("/events", es) go func() { for { es.SendEventMessage("hello", "", "") log.Printf("Hello h...
package main import ( eventsource "../." "log" "net/http" "time" ) func main() { es := eventsource.New(nil, nil) defer es.Close() http.Handle("/", http.FileServer(http.Dir("./public"))) http.Handle("/events", es) go func() { for { es.SendEventMessage("hello", "", "") log.Printf("Hello has been sent (...
Revert "Use absolute import URL in example ( doesn't like relative URLs)." Because the root of issue isn't relative URL but '.v0' suffix.
Revert "Use absolute import URL in example ( doesn't like relative URLs)." Because the root of issue isn't relative URL but '.v0' suffix. This reverts commit 68e86d8d9bcd6d636027cadf74e662fd7f74f737.
Go
mit
XuYunnan/eventsource,antage/eventsource,XuYunnan/eventsource,torfuzx/eventsource
ee11e6aded00aa3f8f5fd2b5fd8780238b523c4a
command/v7/rename_service_broker_command.go
command/v7/rename_service_broker_command.go
package v7 import ( "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag" "code.cloudfoundry.org/cli/command/translatableerror" ) type RenameServiceBrokerCommand struct { RequiredArgs flag.RenameServiceBrokerArgs `positional-args:"yes"` usage interface{} `usage:"...
package v7 import ( "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag" "code.cloudfoundry.org/cli/command/translatableerror" ) type RenameServiceBrokerCommand struct { RequiredArgs flag.RenameServiceBrokerArgs `positional-args:"yes"` usage interface{} `usag...
Fix formatting for v7 rename service broker command.
Fix formatting for v7 rename service broker command.
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
ee2d48c1aa78d1ef9aa227d03629298cf4e87e44
models/alert/create.go
models/alert/create.go
package alert import ( "fmt" ) type CreateReq struct { Name string `valid:"required"` Actions []Action Triggers []Trigger } func (c *CreateReq) Validate() error { if len(c.Actions) == 0 { return fmt.Errorf("Actions: non-zero value required.") } else if len(c.Triggers) == 0 { return fmt.Errorf("Trigger...
package alert import ( "fmt" ) type CreateReq struct { Name string `valid:"required"` Actions []Action Triggers []Trigger } func (c *CreateReq) Validate() error { err := validateActions(c.Actions) if err != nil { return err } err = validateTriggers(c.Triggers) if err != nil { return err } return ...
Move actions and triggers validation logic to the separate functions
Move actions and triggers validation logic to the separate functions
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
691d4f94dc338751a31f38828457a5abdaab6336
cpp_format_test.go
cpp_format_test.go
/* Tests */ package main import ( "fmt" // "strings" "testing" ) func TestIndentConnects(t *testing.T) { source := readFileToSlice("./tests_data/source_indentConnects.cpp") result := readFileToSlice("./tests_data/result_indentConnects.cpp") indentConnects(source) for i, line := range source { if line != re...
/* Tests */ package main import ( "fmt" "github.com/fatih/color" "testing" ) func TestIndentConnects(t *testing.T) { source := readFileToSlice("./tests_data/source_indentConnects.cpp") result := readFileToSlice("./tests_data/result_indentConnects.cpp") indentConnects(source) for i, line := range source { i...
Add colors to test output
Add colors to test output
Go
mit
vaz-ar/cpp_format,vaz-ar/cpp_format
05e56f036079dd18514b6d317c43c1d83eca5535
src/builtins/imports/modules_stub.go
src/builtins/imports/modules_stub.go
// +build !linux,!darwin !cgo package imports import ( "github.com/nitrogen-lang/nitrogen/src/eval" "github.com/nitrogen-lang/nitrogen/src/moduleutils" "github.com/nitrogen-lang/nitrogen/src/object" "github.com/nitrogen-lang/nitrogen/src/vm" ) func init() { eval.RegisterBuiltin("module", importModule) eval.Reg...
// +build !linux,!darwin !cgo package imports import ( "github.com/nitrogen-lang/nitrogen/src/eval" "github.com/nitrogen-lang/nitrogen/src/object" "github.com/nitrogen-lang/nitrogen/src/vm" ) func init() { eval.RegisterBuiltin("module", importModule) eval.RegisterBuiltin("modulesSupported", moduleSupport) vm....
Remove VM wrapper from module import stub
Remove VM wrapper from module import stub
Go
bsd-3-clause
nitrogen-lang/nitrogen,nitrogen-lang/nitrogen
59df433c4f34f2d8150b80a45b800d51c5d178bb
wix/replace/replace_windows.go
wix/replace/replace_windows.go
package main import ( "io/ioutil" "log" "os" "strings" ) func main() { if len(os.Args) < 4 { log.Fatal("Usage: replace [filename] [old string] [new string]") } file := os.Args[1] old := os.Args[2] new := os.Args[3] content, err := ioutil.ReadFile(file) if err != nil { log.Fatal(err) } err = ioutil....
package main import ( "io/ioutil" "log" "os" "strings" ) func main() { if len(os.Args) < 4 { log.Fatal("Usage: replace [filename] [old string] [new string]") } file := os.Args[1] oldStr := os.Args[2] newStr := os.Args[3] content, err := ioutil.ReadFile(file) if err != nil { log.Fatal(err) } err = i...
Rename variable to avoid built-in function name
Rename variable to avoid built-in function name
Go
apache-2.0
moznion/mackerel-agent,kamatama41/mackerel-agent,stanaka/mackerel-agent,mackerelio/mackerel-agent,stanaka/mackerel-agent,mackerelio/mackerel-agent,moznion/mackerel-agent,stanaka/mackerel-agent,kamatama41/mackerel-agent,yyljlyy/mackerel-agent,kamatama41/mackerel-agent,yyljlyy/mackerel-agent,moznion/mackerel-agent,stanak...
bca21e3b2a45c0d6521659e87c3ca1132cc38775
resources.go
resources.go
package main import "time" type UserResource struct { ID int `json:"id"` Username string `json:"username"` } type TaskResource struct { ID int `json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` User UserResource `json:"user"` Name string `jso...
package main import "time" type Resource struct { ID int `json:"id"` } type UserResource struct { Resource Username string `json:"username"` } type TaskResource struct { Resource CreatedAt time.Time `db:"created_at" json:"created_at"` User UserResource `json:"user"` Name string `json...
Use a base resource struct type
Use a base resource struct type
Go
mit
yansal/task-manager
075bcf92c669fd55c16629e37626aa94a37fe697
beanstool.go
beanstool.go
package main import ( "os" "github.com/jessevdk/go-flags" "github.com/src-d/beanstool/cli" ) func main() { parser := flags.NewNamedParser("beanstool", flags.Default) parser.AddCommand("stats", "print stats on all tubes", "", &cli.StatsCommand{}) parser.AddCommand("tail", "tails a tube and prints his content", ...
package main import ( "os" "github.com/agtorre/gocolorize" "github.com/jessevdk/go-flags" "github.com/src-d/beanstool/cli" "golang.org/x/crypto/ssh/terminal" ) func main() { if !terminal.IsTerminal(int(os.Stdout.Fd())) { gocolorize.SetPlain(true) } parser := flags.NewNamedParser("beanstool", flags.Default...
Disable colours when the output is not a terminal
Disable colours when the output is not a terminal
Go
mit
src-d/beanstool,tyba/beanstool
d8cdcfcb0ba09bfc1e506b82da0d438e563059c5
challenge41.go
challenge41.go
// Challenge 41 - Implement unpadded message recovery oracle // http://cryptopals.com/sets/6/challenges/41 package cryptopals import ( "crypto/rand" "math/big" ) type challenge41 struct { } func (challenge41) Client(key *publicKey, net Network) string { c := readInt(net) S, _ := rand.Int(rand.Reader, key.n) C...
// Challenge 41 - Implement unpadded message recovery oracle // http://cryptopals.com/sets/6/challenges/41 package cryptopals import ( "crypto/rand" "math/big" ) type challenge41 struct { } func (challenge41) Client(key *publicKey, net Network) string { c := readInt(net) S, _ := rand.Int(rand.Reader, key.n) C...
Fix bad calculations in challenge 41
Fix bad calculations in challenge 41
Go
mit
Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go
c1411e0ad5199695c808c647e066bfc1c7650a7f
output_tests/struct_tags/fieldname/types.go
output_tests/struct_tags/fieldname/types.go
package test type T struct { F1 string `json:"F1"` F2 string `json:"f2"` F3 string `json:"-"` F4 string `json:"-,"` F5 string `json:","` F6 string `json:""` }
package test type E struct { E1 string } type T struct { F1 string `json:"F1"` F2 string `json:"f2"` F3 string `json:"-"` F4 string `json:"-,"` F5 string `json:","` F6 string `json:""` E `json:"e"` }
Add test for json tag on embedded field
Add test for json tag on embedded field
Go
mit
json-iterator/go,json-iterator/go
e91798e5aa7b746a476bf9bfef3317a384ab6af2
protocol/packet/handshake.go
protocol/packet/handshake.go
package packet type Handshake struct { ProtocolVersion uint64 `type:"uvarint"` ServerAddress string `type:"string"` ServerPort uint16 `type:"ushort"` NextState uint64 `type:"uvarint"` }
package packet type Handshake struct { ProtocolVersion uint64 ServerAddress string ServerPort uint16 NextState uint64 }
Remove type annotations from packet.Handshake
Remove type annotations from packet.Handshake
Go
mit
ttaylorr/minecraft
8b827f5f3ebb42dd84dd96b5bc1e082232ef6299
languages_substitution.go
languages_substitution.go
// Copyright 2013 by Dobrosław Żybort. All rights reserved. // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. package slug var deSub = map[rune]string{ '&': "und", ...
// Copyright 2013 by Dobrosław Żybort. All rights reserved. // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. package slug var deSub = map[rune]string{ '&': "und", ...
Fix sad error with spanish substitution.
Fix sad error with spanish substitution.
Go
mpl-2.0
gosimple/slug
3c998bef451ae3e32b9966d4eeaa634665dc2d02
cmd/control/udevsettle.go
cmd/control/udevsettle.go
package control import ( "os" "os/exec" "github.com/rancher/os/pkg/log" "github.com/codegangsta/cli" ) func udevSettleAction(c *cli.Context) { if err := UdevSettle(); err != nil { log.Fatal(err) } } func UdevSettle() error { cmd := exec.Command("udevd", "--daemon") cmd.Stdout = os.Stdout cmd.Stderr = os...
package control import ( "os" "os/exec" "github.com/rancher/os/pkg/log" "github.com/codegangsta/cli" ) func udevSettleAction(c *cli.Context) { if err := UdevSettle(); err != nil { log.Fatal(err) } } func UdevSettle() error { cmd := exec.Command("udevd", "--daemon") defer exec.Command("killall", "udevd")....
Clean up udevd zombie process
Clean up udevd zombie process
Go
apache-2.0
rancherio/os,rancher/os,rancherio/os,rancher/os,rancherio/os
27d5b17096847d16d01421c30151969adda36628
lib/osutil/lowprio_windows.go
lib/osutil/lowprio_windows.go
// Copyright (C) 2018 The Syncthing Authors. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. package osutil // SetLowPriority lowers the process CPU scheduling ...
// Copyright (C) 2018 The Syncthing Authors. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. package osutil import ( "syscall" "github.com/pkg/errors" ) con...
Fix priority lowering on Windows
lib/osutil: Fix priority lowering on Windows GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4686
Go
mpl-2.0
xduugu/syncthing,imsodin/syncthing,rumpelsepp/syncthing,uok/syncthing,syncthing/syncthing,imsodin/syncthing,rumpelsepp/syncthing,imsodin/syncthing,rumpelsepp/syncthing,AudriusButkevicius/syncthing,rumpelsepp/syncthing,AudriusButkevicius/syncthing,xduugu/syncthing,syncthing/syncthing,xduugu/syncthing,AudriusButkevicius/...
4653497dc470d2d9e10d16bf8450d83a47abd522
update_test.go
update_test.go
package aspect import ( "testing" ) func TestUpdate(t *testing.T) { s1 := Update(users, Values{"name": "client"}) expectedSQL( t, s1, `UPDATE "users" SET "name" = $1`, 1, ) values := Values{ "name": "admin", "password": "blank", } s2 := Update(users, values).Where(users.C["id"].Equals(1)) ex...
package aspect import ( "testing" ) func TestUpdate(t *testing.T) { stmt := Update(users, Values{"name": "client"}) expectedSQL( t, stmt, `UPDATE "users" SET "name" = $1`, 1, ) values := Values{ "name": "admin", "password": "blank", } stmt = Update(users, values).Where(users.C["id"].Equals(1)...
Test updates with columns that do not exist
Test updates with columns that do not exist
Go
mit
namesjames/aspect,aodin/aspect
3e1b6d848452ba5f680ecb894884c4d1c542891b
bip38-cracker.go
bip38-cracker.go
package main import ( "encoding/hex" "github.com/piotrnar/gocoin/btc" "log" ) func main() { encryptedKey := "6PfMxA1n3cqYarHoDqPRPLpBBJGWLDY1qX94z8Qyjg7XAMNZJMvHLqAMyS" dec := btc.Decodeb58(encryptedKey)[:39] // trim to length 39 (not sure why needed) if dec == nil { log.Fatal("Cannot decode base58 string " ...
package main import ( "encoding/hex" "github.com/piotrnar/gocoin/btc" "log" ) func main() { encryptedKey := "6PfMxA1n3cqYarHoDqPRPLpBBJGWLDY1qX94z8Qyjg7XAMNZJMvHLqAMyS" dec := btc.Decodeb58(encryptedKey)[:39] // trim to length 39 (not sure why needed) if dec == nil { log.Fatal("Cannot decode base58 string " ...
Add control flow for different cases
Add control flow for different cases
Go
mit
chigley/bip38
327913be97e9a92a4f0c34578b1a5471a21851ec
staticcheck/testdata/CheckLeakyTimeTick.go
staticcheck/testdata/CheckLeakyTimeTick.go
package pkg import "time" func fn1() { for range time.Tick(0) { println("") } } func fn2() { for range time.Tick(0) { // MATCH /leaks the underlying ticker/ println("") if true { break } } } func fn3() { for range time.Tick(0) { // MATCH /leaks the underlying ticker/ println("") if true { ret...
package pkg import "time" func fn1() { for range time.Tick(0) { println("") } } func fn2() { for range time.Tick(0) { // MATCH /leaks the underlying ticker/ println("") if true { break } } } func fn3() { for range time.Tick(0) { // MATCH /leaks the underlying ticker/ println("") if true { ret...
Add test for non-leaky time.Tick in closure
Add test for non-leaky time.Tick in closure Updates gh-62
Go
mit
dominikh/go-tools,dominikh/go-tools,dominikh/go-tools,dominikh/go-tools
b3d5841c2eb1bafb23ac7b8dca8b8f1175f53ffc
net/doc.go
net/doc.go
// Copyright 2015-2016, Cyrill @ Schumacher.fm and the CoreStore 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 // // Un...
// Copyright 2015-2016, Cyrill @ Schumacher.fm and the CoreStore 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 // // Un...
Add TODO for form parsing
net: Add TODO for form parsing
Go
apache-2.0
corestoreio/csfw,corestoreio/csfw
5eae7957e545c730709673dc68647941f4870a14
cmd/toxiproxy.go
cmd/toxiproxy.go
package main import ( "flag" "math/rand" "time" "github.com/Shopify/toxiproxy" ) var host string var port string var config string func init() { flag.StringVar(&host, "host", "localhost", "Host for toxiproxy's API to listen on") flag.StringVar(&port, "port", "8474", "Port for toxiproxy's API to listen on") f...
package main import ( "flag" "math/rand" "os" "os/signal" "syscall" "time" "github.com/Shopify/toxiproxy" ) var host string var port string var config string func init() { flag.StringVar(&host, "host", "localhost", "Host for toxiproxy's API to listen on") flag.StringVar(&port, "port", "8474", "Port for tox...
Handle SIGTERM to exit cleanly
Handle SIGTERM to exit cleanly
Go
mit
Shopify/toxiproxy,Shopify/toxiproxy
4a880b3f1a40ae91794092a9a63bceef1b51631c
src/github.com/stellar/horizon/resource/transaction_success.go
src/github.com/stellar/horizon/resource/transaction_success.go
package resource import ( "github.com/stellar/horizon/httpx" "github.com/stellar/horizon/render/hal" "github.com/stellar/horizon/txsub" "golang.org/x/net/context" ) // Populate fills out the details func (res *TransactionSuccess) Populate(ctx context.Context, result txsub.Result) { res.Hash = result.Hash res.Le...
package resource import ( "github.com/stellar/horizon/httpx" "github.com/stellar/horizon/render/hal" "github.com/stellar/horizon/txsub" "golang.org/x/net/context" ) // Populate fills out the details func (res *TransactionSuccess) Populate(ctx context.Context, result txsub.Result) { res.Hash = result.Hash res.Le...
Fix busted link in transaction success response
Fix busted link in transaction success response
Go
apache-2.0
irisli/horizon,nullstyle/go-horizon,irisli/horizon,nullstyle/go-horizon,stellar/horizon,stellar/horizon,stellar/horizon,irisli/horizon,nullstyle/go-horizon
68d547ec5f8cf5f52b17bd0f608187d64f41ac46
main.go
main.go
package main import ( "flag" "fmt" "net" "os" "time" "strings" ) var argvPort = flag.Int("port", 8117, "port to listen") var argvCandidates = flag.String("nodes", "", "comma separated list of nodes.") var argvRestBind = flag.String("rest", "127.0.0.1:8080", "Network address which will be bind to a restful servi...
package main import ( "flag" "fmt" "net" "os" "time" "strings" ) var argvPort = flag.Int("port", 8117, "port to listen") var argvCandidates = flag.String("nodes", "", "comma separated list of nodes.") var argvRestBind = flag.String("rest", "127.0.0.1:8080", "Network address which will be bind to a restful servi...
Print my id on start
[Mod] Print my id on start
Go
apache-2.0
monnand/bully
ec7f7929b272fc3072d1b2824db3069cdb5cbc7c
state/utils.go
state/utils.go
package state import ( "github.com/centurylinkcloud/clc-go-cli/config" "io/ioutil" "path" "os" ) func readFromFile(name string) ([]byte, error) { p, err := config.GetPath() if err != nil { return nil, err } return ioutil.ReadFile(path.Join(p, name)) } func writeToFile(data []byte, name string, perm os.File...
package state import ( "github.com/centurylinkcloud/clc-go-cli/config" "io/ioutil" "os" "path" ) func readFromFile(name string) ([]byte, error) { p, err := config.GetPath() if err != nil { return nil, err } return ioutil.ReadFile(path.Join(p, name)) } func writeToFile(data []byte, name string, perm os.File...
Make a small gofmt-driven imports fix.
Make a small gofmt-driven imports fix.
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
918b45befd6a8aff7c3941b7022f0d125ada12a4
rdp_darwin.go
rdp_darwin.go
// The MIT License (MIT) // // Copyright (c) 2015 Douglas Thrift // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, ...
// The MIT License (MIT) // // Copyright (c) 2015 Douglas Thrift // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, ...
Create an RDP file on Mac OS X.
Create an RDP file on Mac OS X.
Go
mit
douglaswth/rsrdp
919f1a3ccb9c8fa1a6621db56825f4b9ce25fd8c
utils/utils.go
utils/utils.go
package utils import ( "bytes" "os/exec" ) func ExecCmd(name string, args ...string) (string, error) { cmd := exec.Command(name, args...) var out bytes.Buffer cmd.Stdout = &out err := cmd.Run() if err != nil { return "", err } return out.String(), nil }
package utils import ( "bytes" "os/exec" "syscall" ) const PR_SET_CHILD_SUBREAPER = 36 func ExecCmd(name string, args ...string) (string, error) { cmd := exec.Command(name, args...) var out bytes.Buffer cmd.Stdout = &out err := cmd.Run() if err != nil { return "", err } return out.String(), nil } // S...
Add utility functions to set process as subreaper.
Add utility functions to set process as subreaper. This code is borrowed from libcontainer system package. Signed-off-by: Mrunal Patel <d389837b018b67489df74a2c5f0aca13aaed44b6@gmail.com>
Go
apache-2.0
mrunalp/ocid,mrunalp/ocid
07276ba0ef5ce648bfff4d1146b0ef2cda9cafa2
testdata/files/unusual_types.go
testdata/files/unusual_types.go
package foo type Closer interface { Close() } type ReadCloser interface { Closer Read() } func Basic(s string) { _ = s } func BasicWrong(rc ReadCloser) { // WARN rc can be Closer rc.Close() } func Array(ints [3]int) {} func ArrayIface(rcs [3]ReadCloser) { rcs[1].Close() } func Slice(ints []int) {} func Sl...
package foo type Closer interface { Close() } type ReadCloser interface { Closer Read() } func Basic(s string) { _ = s } func BasicWrong(rc ReadCloser) { // WARN rc can be Closer rc.Close() } func Array(ints [3]int) {} func ArrayIface(rcs [3]ReadCloser) { rcs[1].Close() } func Slice(ints []int) {} func Sl...
Improve test coverage for onDecl()
Improve test coverage for onDecl() Sometimes the *ast.ValueSpec type cast is not succesful. Prove it, also avoiding future panics if we ever remove the ok check.
Go
bsd-3-clause
mvdan/interfacer
1d3abf94f912d1fc3edc8836ddcaf9a5bc725764
schema_gen.go
schema_gen.go
package cloudformation //go:generate go run ./scraper/scrape.go -format=go -out=schema.go //go:generate go run ./scraper/scrape.go -format=json -out=schema.json
package cloudformation //go:generate go test -v ./scraper/.
Update scraper to use new script
Update scraper to use new script
Go
bsd-2-clause
crewjam/go-cloudformation,crewjam/go-cloudformation
8ba518b63573fdf979311a04e3c962f38c8a0dc7
examples/main_freefb_client.go
examples/main_freefb_client.go
package main import ( "fmt" "github.com/joho/godotenv" "github.com/1Conan/transports" "os" ) func main() { godotenv.Load() fmt.Println("Transports test") freefbTransport := transports.FreeFBTransport{ Login: os.Getenv("FB_LOGIN"), Password: os.Getenv("FB_PASSWORD"), Friend: os.Getenv("FB_FRIEND"),...
package main import ( "fmt" "github.com/joho/godotenv" "github.com/matiasinsaurralde/transports" "os" ) func main() { godotenv.Load() fmt.Println("Transports test") freefbTransport := transports.FreeFBTransport{ Login: os.Getenv("FB_LOGIN"), Password: os.Getenv("FB_PASSWORD"), Friend: os.Getenv("F...
Fix the github import link
Fix the github import link
Go
mit
matiasinsaurralde/transports
87ce5635037d59ba58f6a66522b1c0083d06411b
assignments/go/binary/binary_test.go
assignments/go/binary/binary_test.go
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 ...
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 ...
Use default types for printf arguments
Use default types for printf arguments
Go
mit
robphoenix/exercism-go,exercism/xgo,exercism/xgo,leenipper/xgo,pminten/xgo,leenipper/xgo,pminten/xgo,robphoenix/exercism-go
c603ecbfb1621f79ebba6dc4af33e6825fbfbc42
src/mobile/utils.go
src/mobile/utils.go
package mobile import ( "fmt" "os" "github.com/mosaicnetworks/babble/src/crypto/keys" ) // GetPrivPublKeys generates a new public key pair and returns it in the // following formatted string <public key hex>=!@#@!=<private key hex>. func GetPrivPublKeys() string { key, err := keys.GenerateECDSAKey() if err != n...
package mobile import ( "encoding/hex" "fmt" "os" "strings" "github.com/mosaicnetworks/babble/src/crypto/keys" ) // GetPrivPublKeys generates a new public key pair and returns it in the // following formatted string <public key hex>=!@#@!=<private key hex>. func GetPrivPublKeys() string { key, err := keys.Gene...
Add getPublKey function to get public key
Add getPublKey function to get public key From a given private key.
Go
apache-2.0
babbleio/babble,babbleio/babble
68a9954511dd7825dc9b3744a68b51398ce120b1
webhooks.go
webhooks.go
package slack import ( "bytes" "encoding/json" "net/http" "github.com/pkg/errors" ) type WebhookMessage struct { Text string `json:"text,omitempty"` Attachments []Attachment `json:"attachments,omitempty"` } func PostWebhook(url string, msg *WebhookMessage) error { raw, err := json.Marshal(msg) ...
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...
Add webhook runtime customization attributes
Add webhook runtime customization attributes
Go
bsd-2-clause
178inaba/slack,james-lawrence/slack,nlopes/slack
1f8de67efed99d3e94f689b83a897f9af6d70529
pkg/auth/dependency/principal/oauth/oauth.go
pkg/auth/dependency/principal/oauth/oauth.go
package oauth import ( "github.com/skygeario/skygear-server/pkg/auth/dependency/principal" "github.com/skygeario/skygear-server/pkg/core/config" ) type GetByProviderOptions struct { ProviderType string ProviderKeys map[string]interface{} ProviderUserID string } type GetByUserOptions struct { ProviderType s...
package oauth import ( "github.com/skygeario/skygear-server/pkg/auth/dependency/principal" "github.com/skygeario/skygear-server/pkg/core/config" ) type GetByProviderOptions struct { ProviderType string ProviderKeys map[string]interface{} ProviderUserID string } type GetByUserOptions struct { ProviderType s...
Add team ID to provider keys
Add team ID to provider keys
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
ac0d184d51d67fe9eeabd5683bd21c263c55c9e6
pkg/node/host_endpoint.go
pkg/node/host_endpoint.go
// SPDX-License-Identifier: Apache-2.0 // Copyright 2020 Authors of Cilium package node const ( templateHostEndpointID = uint64(0xffff) ) var ( labels map[string]string endpointID = templateHostEndpointID ) // GetLabels returns the labels of this node. func GetLabels() map[string]string { return labels } /...
// SPDX-License-Identifier: Apache-2.0 // Copyright 2020 Authors of Cilium package node import ( "github.com/cilium/cilium/pkg/lock" ) const ( templateHostEndpointID = uint64(0xffff) ) var ( labels map[string]string labelsMu lock.RWMutex endpointID = templateHostEndpointID ) // GetLabels returns the lab...
Fix race condition on labels' getter/setter
node: Fix race condition on labels' getter/setter Our race detection pipeline detected a race condition between the setter and getter for the local node's labels: WARNING: DATA RACE Write at 0x000005882150 by goroutine 154: github.com/cilium/cilium/pkg/node.SetLabels() /go/src/github.com/ciliu...
Go
apache-2.0
cilium/cilium,cilium/cilium,michi-covalent/cilium,cilium/cilium,cilium/cilium,michi-covalent/cilium,tklauser/cilium,michi-covalent/cilium,cilium/cilium,tklauser/cilium,michi-covalent/cilium,tklauser/cilium,michi-covalent/cilium,tklauser/cilium,tklauser/cilium
24dc0a8155aad8de1cc673df5fc14de8bdf9b907
aws/data_source_aws_iam_policy.go
aws/data_source_aws_iam_policy.go
package aws import ( "github.com/hashicorp/terraform/helper/schema" ) func dataSourceAwsIAMPolicy() *schema.Resource { return &schema.Resource{ Read: dataSourceAwsIAMPolicyRead, Schema: map[string]*schema.Schema{ "arn": { Type: schema.TypeString, Optional: true, }, "name": { Type: ...
package aws import ( "github.com/hashicorp/terraform/helper/schema" ) func dataSourceAwsIAMPolicy() *schema.Resource { return &schema.Resource{ Read: dataSourceAwsIAMPolicyRead, Schema: map[string]*schema.Schema{ "arn": { Type: schema.TypeString, Required: true, }, "name": { Type: ...
Set arn attribute as required until other lookups are available
data-source/aws_iam_policy: Set arn attribute as required until other lookups are available
Go
mpl-2.0
Ninir/terraform-provider-aws,nbaztec/terraform-provider-aws,kjmkznr/terraform-provider-aws,nbaztec/terraform-provider-aws,kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,terraform-providers/terraform-provider-aws,kjmkznr/terraform-provider-aws,nbaztec/terraform-provider-aws,Ninir/terraform-provider-aws,terr...
7389bea7c3c144aefed99e25d551eff30aeda29d
resource/lua.go
resource/lua.go
package resource import ( "github.com/layeh/gopher-luar" "github.com/yuin/gopher-lua" ) // LuaRegisterBuiltin registers resource providers in Lua func LuaRegisterBuiltin(L *lua.LState) { for typ, provider := range providerRegistry { // Wrap resource providers, so that we can properly handle any // errors retur...
package resource import ( "github.com/layeh/gopher-luar" "github.com/yuin/gopher-lua" ) // LuaRegisterBuiltin registers resource providers in Lua func LuaRegisterBuiltin(L *lua.LState) { for typ, provider := range providerRegistry { // Wrap resource providers, so that we can properly handle any // errors retur...
Fix Lua resource wrapper function
resource: Fix Lua resource wrapper function
Go
mit
ranjithamca/gru
240828b27288e4f34c1fa9cfd8637dbfae9a9b27
pkg/issuer/acme/dns/acmedns/acmedns_test.go
pkg/issuer/acme/dns/acmedns/acmedns_test.go
package acmedns import ( "github.com/stretchr/testify/assert" "os" "testing" ) var ( acmednsLiveTest bool acmednsHost string acmednsAccountsJson []byte acmednsDomain string ) func init() { acmednsHost = os.Getenv("ACME_DNS_HOST") acmednsAccountsJson = []byte(os.Getenv("ACME_DNS_ACCOUNTS_JS...
package acmedns import ( "github.com/stretchr/testify/assert" "os" "testing" ) var ( acmednsLiveTest bool acmednsHost string acmednsAccountsJson []byte acmednsDomain string ) func init() { acmednsHost = os.Getenv("ACME_DNS_HOST") acmednsAccountsJson = []byte(os.Getenv("ACME_DNS_ACCOUNTS_JS...
Read test host from env variable
Read test host from env variable Signed-off-by: Max Ehrlich <c7cd0513ef0c504f678ca33c2b168f4f84cd4d51@gmail.com>
Go
apache-2.0
jetstack-experimental/cert-manager,jetstack/cert-manager,jetstack/cert-manager,jetstack/cert-manager,jetstack-experimental/cert-manager,cert-manager/cert-manager,cert-manager/cert-manager,cert-manager/cert-manager,jetstack-experimental/cert-manager
a271cf10aff544c8ab29c60fd4d60285d36624d9
player_cache.go
player_cache.go
package youtube import ( "log" "time" ) const defaultCacheExpiration = time.Minute * time.Duration(5) type playerCache struct { key string expiredAt time.Time config playerConfig } // Get : get cache when it has same video id and not expired func (s playerCache) Get(key string) playerConfig { result...
package youtube import ( "time" ) const defaultCacheExpiration = time.Minute * time.Duration(5) type playerCache struct { key string expiredAt time.Time config playerConfig } // Get : get cache when it has same video id and not expired func (s playerCache) Get(key string) playerConfig { return s.GetC...
Remove debug output from playerCache
Remove debug output from playerCache closes #227
Go
mit
kkdai/youtube
1ef5dd3af44bac441c55e8749268a1e2ddedc8f7
pkg/scaler/aggregator/api.go
pkg/scaler/aggregator/api.go
package aggregator import "github.com/GoogleCloudPlatform/kubernetes/pkg/scaler/types" type Node struct { Capacity types.Resource Usage types.Resource } type Aggregator interface { // Returns a map with node name as key. GetClusterInfo() (map[string]Node, error) }
package aggregator import "github.com/GoogleCloudPlatform/kubernetes/pkg/scaler/types" type Node struct { Capacity types.Resource Usage types.Resource NumPods uint32 } type Aggregator interface { // Returns a map with node name as key. GetClusterInfo() (map[string]Node, error) }
Add number of pods to aggregator to identify empty machines. We might not need this when we add actual pod information.
Add number of pods to aggregator to identify empty machines. We might not need this when we add actual pod information.
Go
apache-2.0
rjnagal/kubernetes,rjnagal/kubernetes,rjnagal/kubernetes,rjnagal/kubernetes,rjnagal/kubernetes,rjnagal/kubernetes,rjnagal/kubernetes
f7d1bf45ba8439ba774f9518f9a6e847e616bebe
platform/platform_android.go
platform/platform_android.go
//go:build android // +build android package platform type Platform struct{} const name = "platform" func (self *Platform) Name() string { return name } func (self *Platform) Collect() (result interface{}, err error) { result, err = getPlatformInfo() return } func getPlatformInfo() (platformInfo map[string]str...
//go:build android // +build android package platform type Platform struct{} const name = "platform" func (self *Platform) Name() string { return name } func (self *Platform) Collect() (result interface{}, err error) { result, err = getPlatformInfo() return } func getPlatformInfo() (platformInfo map[string]str...
Add missing android implementation for platform.Get()
Add missing android implementation for platform.Get()
Go
mit
DataDog/gohai,DataDog/gohai
68923c0822b4869fe9554fdaab12df2c88f896d9
platforms/audio/audio_driver_test.go
platforms/audio/audio_driver_test.go
// Based on aplay audio adaptor written by @colemanserious (https://github.com/colemanserious) package audio import ( "testing" "github.com/hybridgroup/gobot/gobottest" ) func TestAudioDriver(t *testing.T) { d := NewAudioDriver(NewAudioAdaptor("conn"), "dev", nil) gobottest.Assert(t, d.Name(), "dev") gobottes...
// Based on aplay audio adaptor written by @colemanserious (https://github.com/colemanserious) package audio import ( "testing" "github.com/hybridgroup/gobot/gobottest" ) func TestAudioDriver(t *testing.T) { d := NewAudioDriver(NewAudioAdaptor("conn"), "dev", nil) gobottest.Assert(t, d.Name(), "dev") gobottes...
Test coverage for execution of audio driver
[audio] Test coverage for execution of audio driver Signed-off-by: deadprogram <b937b287f61b7a223d4aac55072db1a5381d3bb3@hybridgroup.com>
Go
apache-2.0
nzmichaelh/gobot,nzmichaelh/gobot
380c51010be4cbbc498a9e6bdda0a15f98c004dd
alpine/packages/hupper/main.go
alpine/packages/hupper/main.go
package main import ( "flag" "io/ioutil" "log" "os" "strconv" "syscall" ) var ( path string pidfile string ) func init() { flag.StringVar(&path, "path", "/Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live", "path of the file to watch") flag.S...
package main import ( "flag" "io/ioutil" "log" "os" "strconv" "syscall" ) var ( path string pidfile string ) func init() { flag.StringVar(&path, "path", "/Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live", "path of the file to watch") flag.S...
Read exactly 43 bytes from watch
Read exactly 43 bytes from watch More and it hangs forever at present Less and it will not read whole record See https://github.com/docker/pinata/issues/766 Signed-off-by: Justin Cormack <af64ee19f04db9509cb02b0e470e11e5402ef9b3@docker.com>
Go
apache-2.0
kencochrane/linuxkit,samoht/linuxkit,deitch/linuxkit,JohnnyLeone/linuxkit,djs55/linuxkit,zx2c4/linuxkit,samoht/linuxkit,t-koulouris/linuxkit,deitch/linuxkit,t-koulouris/linuxkit,JohnnyLeone/linuxkit,furious-luke/linuxkit,radu-matei/linuxkit,furious-luke/linuxkit,YuPengZTE/linuxkit,djs55/linuxkit,thebsdbox/linuxkit,rn/l...
04200b94882914d8ff470f219713813344291ddd
cmd/aws-gen-gocli/aws-gen-gocli.go
cmd/aws-gen-gocli/aws-gen-gocli.go
// Command aws-gen-gocli parses a JSON description of an AWS API and generates a // Go file containing a client for the API. // // aws-gen-gocli EC2 apis/ec2/2014-10-01.api.json service/ec2/ec2.go package main import ( "flag" "fmt" "os" "github.com/awslabs/aws-sdk-go/model" ) func main() { var svcPath strin...
// Command aws-gen-gocli parses a JSON description of an AWS API and generates a // Go file containing a client for the API. // // aws-gen-gocli EC2 apis/ec2/2014-10-01.api.json service/ec2/ec2.go package main import ( "flag" "fmt" "os" "github.com/awslabs/aws-sdk-go/model" ) func main() { var svcPath strin...
Fix code that gets post-processed command-line args
Fix code that gets post-processed command-line args
Go
apache-2.0
devx/aws-sdk-go,vito/aws-sdk-go,Onefootball/aws-sdk-go,marcosnils/aws-sdk-go,xibz/aws-sdk-go,fwiesel/aws-sdk-go,rikuayanokozy/aws-sdk-go,yxd-hde/aws-sdk-go,calgaryscientific/aws-sdk-go,marcosnils/aws-sdk-go,matematik7/aws-sdk-go,bpot/aws-sdk-go,rail/aws-sdk-go,jacobxk/aws-sdk-go,jacobxk/aws-sdk-go,rail/aws-sdk-go,skypo...
a2d4da609ac43e9edcc3453ca60d2c49dbb8e547
pkg/util/file.go
pkg/util/file.go
package util import ( "os" ) // FileExists returns true if path exists func FileExists(path string) (bool, error) { _, err := os.Stat(path) if err != nil { if os.IsNotExist(err) { return false, nil } return false, err } return true, nil } func DirExists(path string) (bool, error) { fileInfo, err := os...
package util import ( "os" "strings" ) // FileExists returns true if path exists func FileExists(path string) (bool, error) { _, err := os.Stat(path) if err != nil { if isNotExistError(err) { return false, nil } return false, err } return true, nil } func DirExists(path string) (bool, error) { file...
Fix FileExists does not take into account "not a directory" error
[util] Fix FileExists does not take into account "not a directory" error
Go
apache-2.0
flant/dapp,flant/dapp,flant/dapp
0e759c1e5ea129437368e00c70562ab3e9e3bc02
trimcomment_test.go
trimcomment_test.go
package jsonpreprocess import ( "testing" ) func TestUncomment(t *testing.T) { tests := []struct { name string input string expected string }{ {"empty", ``, ``}, {"spaces", " \t\n", " \t\n"}, {"text", `[1, 2]`, `[1, 2]`}, {"text with string", `{"foo": 1}`, `{"foo": 1}`}, {"text with line com...
package jsonpreprocess import ( "testing" ) func TestTrimComment(t *testing.T) { tests := []struct { name string input string expected string }{ {"empty", ``, ``}, {"spaces", " \t\n", " \t\n"}, {"text", `[1, 2]`, `[1, 2]`}, {"text with string", `{"foo": 1}`, `{"foo": 1}`}, {"text with line c...
Rename forgotten Uncomment to TrimComment.
Rename forgotten Uncomment to TrimComment.
Go
mit
hnakamur/jsonpreprocess
418bddf7a30e2788d9c1c93ea6628035f165b44e
app/modules/auth/app/plugin.go
app/modules/auth/app/plugin.go
package auth import ( "github.com/robfig/revel" //_ "github.com/pjvds/acvte/modules/auth/routes" ) type AuthenticatedResource struct { Resource interface{} Role string } func init() { revel.OnAppStart(func() { }) } var SessionAuthenticationFilter = func(c *revel.Controller, fc []revel.Filter) { c.Redire...
package auth import ( "github.com/robfig/revel" //_ "github.com/pjvds/acvte/modules/auth/routes" ) type AuthenticatedResource struct { Resource interface{} Role string } func init() { revel.OnAppStart(func() { }) } var SessionAuthenticationFilter = func(c *revel.Controller, fc []revel.Filter) { // TODO:...
Mark c.Redirect as todo item
Mark c.Redirect as todo item
Go
mit
slogsdon/acvte,slogsdon/acvte
5303926217ba004cd2b399e2693ca7f76a00a126
steps/step_clone_repo_test.go
steps/step_clone_repo_test.go
package steps import ( "github.com/mitchellh/multistep" "os" "os/exec" "testing" ) func TestStepCloneRepo(t *testing.T) { env := make(map[string]interface{}) env["path"] = "tmp" os.MkdirAll("tmp/pearkes/origin", 0777) // Create a fake repository to clone from cmdInit := exec.Command("git", "init", "tmp/pear...
package steps import ( "github.com/mitchellh/multistep" "os" "os/exec" "testing" ) func TestStepCloneRepo(t *testing.T) { env := make(map[string]interface{}) env["path"] = "tmp" originPath := "tmp/pearkes/origin" os.MkdirAll(originPath, 0777) // Create a fake repository to clone from cmdInit := exec.Comm...
Fix the clone path on the cloning test
Fix the clone path on the cloning test
Go
mit
pearkes/gethub
2441f4c8b17aa535b2624e4803190c310f4f4d51
graphs/celebrity.go
graphs/celebrity.go
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package graphs // FindCelebrity returns an index into 2D slice f that represents a celebrity // on the party who doesn't know no one. -1 is returned if ...
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package graphs // FindCelebrity returns an index into 2D slice f that represents a celebrity // on the party who doesn't know no one. -1 is returned if ...
Fix the comment of why column starts at 1
Fix the comment of why column starts at 1
Go
mit
mrekucci/epi,mrekucci/epi
94b26ded69ec220c213a9347f143bd69aa0f2b7f
iterator.go
iterator.go
// Combinatoric is a simple Go port of the "combinatoric" parts of // Python's itertools--specifically, combinations, permutations, and // product. // // None of the iterators are threadsafe. Implement mutexes as required. // Additionally, it should be assumed the return values for First and // Next always share the sa...
// Package combinatoric is a simple Go port of the "combinatoric" parts of // Python's itertools--specifically, combinations, permutations, and // product. // // None of the iterators are threadsafe. Implement mutexes as required. // Additionally, it should be assumed the return values for First and // Next always shar...
Use correct package comment format
Use correct package comment format
Go
mit
ecooper/combinatoric
648c37b49ce6dceb49300c524c7b192c5c970e67
file_test.go
file_test.go
package scipipe import ( "testing" ) const ( TESTPATH = "somepath.txt" ) func TestFileTargetPath(t *testing.T) { ft := NewFileTarget(TESTPATH) path := ft.GetPath() if path != TESTPATH { t.Errorf("Path not properly initialized! (Was", path, "but should be", TESTPATH) } }
package scipipe import ( "github.com/stretchr/testify/assert" "testing" ) const ( TESTPATH = "somepath.txt" ) func TestFileTargetPaths(t *testing.T) { ft := NewFileTarget(TESTPATH) assertPathsEqual(t, ft.GetPath(), TESTPATH) assertPathsEqual(t, ft.GetTempPath(), TESTPATH+".tmp") assertPathsEqual(t, ft.GetFifo...
Test more file path methods
Test more file path methods
Go
mit
scipipe/scipipe,samuell/scipipe,scipipe/scipipe
2f585443eac8c7ca26be923542fcf933b9e84baf
singleton/singleton.go
singleton/singleton.go
package singleton import( "errors" "golang.org/x/net/context" ) var( ErrNoSuchEntity = errors.New("util/singleton: no such entity") ErrSingletonTooBig = errors.New("util/singleton: object too big to write") ) type Singleton struct { Value []byte `datastore:",noindex"` } type SingletonProvider interface { Rea...
package singleton import( "errors" "golang.org/x/net/context" ) /* type Foo struct { S string } sp := some.SingletonProvider{} foo := Foo{S:"hello"} err1 := sp.WriteSingleton(ctx, "Foo_007", &foo) foo2 := Foo{} err2 := sp.ReadSingleton(ctx, "Foo_007", &foo2) */ var( ErrNoSuchEntity = errors.New("util/sing...
Add reminder to use pointers all the time
Add reminder to use pointers all the time
Go
apache-2.0
skypies/util
bf0845baf4f06e46a8a73c87f76b1a63482002b7
example_test.go
example_test.go
package epub_test import ( "fmt" "log" "github.com/bmaupin/go-epub" ) func ExampleAddImage() { // Create a new EPUB e := epub.NewEpub("My title") // Add an image from a local file img1Path, err := e.AddImage("testdata/gophercolor16x16.png", "go-gopher.png") if err != nil { log.Fatal(err) } // Add an im...
package epub_test import ( "fmt" "log" "github.com/bmaupin/go-epub" ) func ExampleEpub_AddImage() { // Create a new EPUB e := epub.NewEpub("My title") // Add an image from a local file img1Path, err := e.AddImage("testdata/gophercolor16x16.png", "go-gopher.png") if err != nil { log.Fatal(err) } // Add ...
Rename example so it gets picked up by godoc.org
Rename example so it gets picked up by godoc.org
Go
mit
bmaupin/go-epub
073ebeca719f9de2e5aa38cad1d95b68b4766983
app/service.go
app/service.go
package app import ( "database/sql" "github.com/goph/stdlib/errors" "github.com/goph/stdlib/log" ) // ServiceOption sets options in the Service. type ServiceOption func(s *Service) // DB returns a ServiceOption that sets the DB object for the service. func DB(db *sql.DB) ServiceOption { return func(s *Service) ...
package app import ( "database/sql" "github.com/goph/stdlib/errors" "github.com/goph/stdlib/log" ) // ServiceOption sets options in the Service. type ServiceOption func(s *Service) // Logger returns a ServiceOption that sets the logger for the service. func Logger(l log.Logger) ServiceOption { return func(s *Se...
Make db a required option
Make db a required option
Go
mit
deshboard/boilerplate-model-service
8ea5301371f54cc9dbc6c603a7ee12f4aa186828
state/backups/sources_test.go
state/backups/sources_test.go
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups_test import ( "sort" gc "launchpad.net/gocheck" "github.com/juju/juju/state/backups" "github.com/juju/juju/testing" ) var getFilesToBackup = *backups.GetFilesToBackup var _ = gc.Suite(&sourcesSuite{}) ...
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups_test import ( jc "github.com/juju/testing/checkers" gc "launchpad.net/gocheck" "github.com/juju/juju/state/backups" "github.com/juju/juju/testing" ) var getFilesToBackup = *backups.GetFilesToBackup var ...
Use the SameContents checker in backups tests.
Use the SameContents checker in backups tests.
Go
agpl-3.0
perrito666/juju,thomnico/juju,ericsnowcurrently/juju,macgreagoir/juju,tasdomas/juju,tasdomas/juju,reedobrien/juju,davecheney/juju,waigani/juju,cmars/juju,kat-co/juju,voidspace/juju,frankban/juju,AdamIsrael/juju,kat-co/juju,bz2/juju,howbazaar/juju,marcoceppi/juju,wwitzel3/juju,marcmolla/juju,mikemccracken/juju,axw/juju,...
f504ff8640d2d5e41feb43665e0168f445db88dd
src/aguin/model/app.go
src/aguin/model/app.go
package model import ( "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "time" ) type Application struct { Id bson.ObjectId `json:"id" bson:"_id,omitempty"` Userid bson.ObjectId Name string Secret string Description string } /* func (m *Application) serialize() map[string]interface{} { ret...
package model import ( "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "time" ) type Application struct { Id bson.ObjectId `json:"id" bson:"_id,omitempty"` Userid bson.ObjectId Name string Secret string Description string } func (m *Application) Save(session *mgo.Session) error { return ...
Remove some functions that not use
Remove some functions that not use
Go
mit
vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin
0c0b382eca61a71c1eb4cb4dea2bc78aa4939d96
lexers/i/ini.go
lexers/i/ini.go
package i import ( . "github.com/alecthomas/chroma" // nolint "github.com/alecthomas/chroma/lexers/internal" ) // Ini lexer. var Ini = internal.Register(MustNewLexer( &Config{ Name: "INI", Aliases: []string{"ini", "cfg", "dosini"}, Filenames: []string{"*.ini", "*.cfg", "*.inf"}, MimeTypes: []string{...
package i import ( . "github.com/alecthomas/chroma" // nolint "github.com/alecthomas/chroma/lexers/internal" ) // Ini lexer. var Ini = internal.Register(MustNewLexer( &Config{ Name: "INI", Aliases: []string{"ini", "cfg", "dosini"}, Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig"}, MimeTy...
Add .gitconfig to Ini lexer filenames.
Add .gitconfig to Ini lexer filenames. Fixes #128.
Go
mit
alecthomas/chroma,alecthomas/chroma,alecthomas/chroma,alecthomas/chroma
d61450a18a537773e091facf8c9653ae85e4aa62
terminal/terminal_freebsd.go
terminal/terminal_freebsd.go
package terminal /* Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and th is could be merged with terminal_darwin. */ import ( "syscall" ) const ioctlReadTermios = syscall.TIOCGETA type termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Cc [20]uint8 Ispe...
package terminal import ( "syscall" ) const ioctlReadTermios = syscall.TIOCGETA /* Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and th is could be merged with terminal_darwin. */ type termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Cc [20]uint8 Ispe...
Move Termios note so it isn't taken as package comment.
Move Termios note so it isn't taken as package comment.
Go
mit
BellerophonMobile/logberry
f514130e12b0caf01f55069cf3c4dba5b5aa1d3f
main_test.go
main_test.go
package main import ( "fmt" "os" "testing" "github.com/nicksnyder/go-i18n/i18n" mylog "github.com/patrickalin/GoMyLog" "github.com/spf13/viper" ) func TestSomething(t *testing.T) { viper.SetConfigName("config") viper.AddConfigPath(".") if err := viper.ReadInConfig(); err != nil { fmt.Printf("%v", err) } ...
package main import ( "fmt" "testing" "github.com/spf13/viper" ) func TestSomething(t *testing.T) { viper.SetConfigName("config") viper.AddConfigPath(".") if err := viper.ReadInConfig(); err != nil { fmt.Printf("%v", err) } } /* func TestMain(m *testing.M) { i18n.MustLoadTranslationFile("lang/en-US.all.js...
Test + travis = error
Test + travis = error
Go
apache-2.0
patrickalin/bloomsky-client-go,patrickalin/bloomsky-client-go,patrickalin/bloomsky-client-go
bf7837c0179609b80febaabc96b239a4bf349eb8
cmp.go
cmp.go
package villa; // CmpFunc is the function compares two elements. type CmpFunc func(interface{}, interface{}) int // IntCmpFunc is the function compares two int elements. type IntCmpFunc func(int, int) int // FloatCmpFunc is the function compares two float elements. type FloatCmpFunc func(float64, float64) int // Co...
package villa; // CmpFunc is the function compares two elements. type CmpFunc func(interface{}, interface{}) int // IntCmpFunc is the function compares two int elements. type IntCmpFunc func(int, int) int // FloatCmpFunc is the function compares two float elements. type FloatCmpFunc func(float64, float64) int // Co...
FIX typo error on comments
FIX typo error on comments
Go
bsd-2-clause
postfix/go-villa,daviddengcn/go-villa
00b792cf6c38a5a62c9b5964957675b8257113f6
p2p/host/peerstore/peerinfo.go
p2p/host/peerstore/peerinfo.go
package peerstore import ( core "github.com/libp2p/go-libp2p-core/peer" ma "github.com/multiformats/go-multiaddr" ) // Deprecated: use github.com/libp2p/go-libp2p-core/peer.Info instead. type PeerInfo = core.AddrInfo // Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrInvalidAddr instead. var ErrInvalidAdd...
package peerstore import ( core "github.com/libp2p/go-libp2p-core/peer" ma "github.com/multiformats/go-multiaddr" ) // Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfo instead. type PeerInfo = core.AddrInfo // Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrInvalidAddr instead. var ErrInvali...
Correct path to peer.AddrInfo in deprecation
Correct path to peer.AddrInfo in deprecation
Go
mit
libp2p/go-libp2p,libp2p/go-libp2p
a6dd8fe58de3df4ccf463e0c9ba17cae699abf42
parser/parser_whitebox_test.go
parser/parser_whitebox_test.go
package parser // This file contains any whitebox tests (with access to package internals), and wrappers // to enable blackbox tests to set up environment. // InitParserVersionForTest allows tests to rerun initParserVersion after initializing // environment variables. func InitParserVersionForTest() { initParserVers...
package parser // This file contains any whitebox tests (with access to package internals), and wrappers // to enable blackbox tests to set up environment. // InitParserVersionForTest allows tests to rerun initParserVersion after initializing // environment variables. // See https://groups.google.com/forum/#!topic/go...
Add link to go-nuts discussion
Add link to go-nuts discussion
Go
apache-2.0
m-lab/etl,m-lab/etl,m-lab/etl
cd2eb9bd90de46575d362cbec07246a1cd949dae
stream.go
stream.go
package fasthttp import ( "bufio" "io" "runtime/debug" "sync" ) // StreamWriter must write data to w. // // Usually StreamWriter writes data to w in a loop (aka 'data streaming'). // // StreamWriter must return immediately if w returns error. // // Since the written data is buffered, do not forget calling w.Flush...
package fasthttp import ( "bufio" "io" "runtime/debug" "sync" ) // StreamWriter must write data to w. // // Usually StreamWriter writes data to w in a loop (aka 'data streaming'). // // StreamWriter must return immediately if w returns error. // // Since the written data is buffered, do not forget calling w.Flush...
Document that Close must be called on the reader returned from NewStreamReader
Document that Close must be called on the reader returned from NewStreamReader
Go
mit
valyala/fasthttp
2ba1652653e620671e75694ac3dbcf3d36315f5e
killbrowser.go
killbrowser.go
package main import ( "log" "net/http" "github.com/gin-gonic/gin" ) func killBrowserHandler(c *gin.Context) { var data struct { Action string `json:"action"` Process string `json:"process"` URL string `json:"url"` } c.BindJSON(&data) command, err := findBrowser(data.Process) log.Println(comman...
package main import ( "errors" "net/http" "github.com/gin-gonic/gin" ) func killBrowserHandler(c *gin.Context) { var data struct { Action string `json:"action"` Process string `json:"process"` URL string `json:"url"` } c.BindJSON(&data) if data.Process != "chrome" && data.Process != "chrom" { ...
Add a bit of safeguard against malicious attacks
Add a bit of safeguard against malicious attacks
Go
agpl-3.0
arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent
431fa015d71a78abafdb71b8ae659088893caa98
cmd/jp2tileserver/iiif_json.go
cmd/jp2tileserver/iiif_json.go
package main // IIIFInfo represents the simplest possible data to provide a valid IIIF // information JSON response type IIIFInfo struct { Context string `json:"@context"` ID string `json:"@id"` Protocol string `json:"protocol"` Width int `json:"width"` Height int `json:"height"` Prof...
package main type tiledata struct { Width int `json:"width"` Height int `json:"height,omitempty"` ScaleFactors []int `json:"scaleFactors"` } // IIIFInfo represents the simplest possible data to provide a valid IIIF // information JSON response type IIIFInfo struct { Context string `json:"@co...
Add some totally arbitrary tile sizes to IIIF
Add some totally arbitrary tile sizes to IIIF This is bad. This needs to be customizable. Or at least somehow generated based on the image being examined, not a default forced value.
Go
cc0-1.0
uoregon-libraries/rais-image-server,uoregon-libraries/newspaper-jp2-viewer,uoregon-libraries/newspaper-jp2-viewer,uoregon-libraries/rais-image-server,uoregon-libraries/newspaper-jp2-viewer,uoregon-libraries/rais-image-server,uoregon-libraries/rais-image-server
979e7db1754e9080cc14c0f3c5e805ba7d53835a
src/launcher.go
src/launcher.go
package main import ( "github.com/bwmarrin/discordgo" Logger "./logger" "os" "os/signal" redis "gopkg.in/redis.v5" "github.com/Jeffail/gabs" ) var ( config *gabs.Container rcli *redis.Client ) func main() { Logger.INF("Bootstrapping...") // Read config config = GetConfig(...
package main import ( "github.com/bwmarrin/discordgo" Logger "./logger" "os" "os/signal" "github.com/Jeffail/gabs" ) var ( config *gabs.Container ) func main() { Logger.INF("Bootstrapping...") // Read config config = GetConfig("config.json") /* // Connect to DB ConnectDB...
Switch from redis to mongo
Switch from redis to mongo
Go
agpl-3.0
Seklfreak/Robyul2,Seklfreak/Robyul2,Seklfreak/Robyul2,Seklfreak/Robyul2
0b1a110f6cb03bf54ab64ff6d58a6d73a807bd5c
xml/text.go
xml/text.go
package xml type TextNode struct { *XmlNode }
package xml /* #include "helper.h" #include <string.h> const xmlChar xmlStringTextNoenc[] = { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 }; const xmlChar* disableEscaping = xmlStringTextNoenc; */ import "C" type TextNode struct { *XmlNode } // DisableOutputEscaping disables the usual safeguards against creating...
Allow output escaping to be disabled on an xml.TextNode
Allow output escaping to be disabled on an xml.TextNode
Go
mit
ThomsonReutersEikon/gokogiri,jmcgill0brightcove/gokogiri,jbowtie/gokogiri,jmcgill0brightcove/gokogiri,ThomsonReutersEikon/gokogiri,moovweb/gokogiri,jmcgill0brightcove/gokogiri,moovweb/gokogiri,jbowtie/gokogiri,moovweb/gokogiri,jbowtie/gokogiri
33d89b69e4babb73c3025eb15a34d3bc49f6ca68
service/gcs/transport/vsock.go
service/gcs/transport/vsock.go
package transport import ( "github.com/sirupsen/logrus" "github.com/linuxkit/virtsock/pkg/vsock" "github.com/pkg/errors" ) const ( vmaddrCidHost = 2 vmaddrCidAny = 0xffffffff ) // VsockTransport is an implementation of Transport which uses vsock // sockets. type VsockTransport struct{} var _ Transport = &Vsoc...
package transport import ( "fmt" "time" "github.com/linuxkit/virtsock/pkg/vsock" "github.com/sirupsen/logrus" ) const ( vmaddrCidHost = 2 vmaddrCidAny = 0xffffffff ) // VsockTransport is an implementation of Transport which uses vsock // sockets. type VsockTransport struct{} var _ Transport = &VsockTranspor...
Add a retry when connecting stdin/stdout/stderr
Add a retry when connecting stdin/stdout/stderr
Go
mit
jterry75/opengcs,rn/opengcs,jterry75/opengcs,jterry75/opengcs,rn/opengcs,Microsoft/hcsshim
695d264c9e955632c09a74741d21f31b26e31d2a
ury-rapid-go.go
ury-rapid-go.go
package main import "os" import "fmt" import "net" import "bufio" import "bytes" import "github.com/UniversityRadioYork/ury-rapid-go/tokeniser" func main() { conn, err := net.Dial("tcp", "127.0.0.1:1350") if err != nil { fmt.Println(err) os.Exit(1) } t := tokeniser.NewTokeniser() for { data, err := bufio....
package main import "os" import "fmt" import "net" import "bufio" import "bytes" import "github.com/UniversityRadioYork/ury-rapid-go/baps3protocol" func main() { conn, err := net.Dial("tcp", "127.0.0.1:1350") if err != nil { fmt.Println(err) os.Exit(1) } t := baps3protocol.NewTokeniser() for { data, err :...
Use baps3protocol package, not old tokeniser
Use baps3protocol package, not old tokeniser
Go
mit
UniversityRadioYork/heimdallr,UniversityRadioYork/bifrost,UniversityRadioYork/bifrost,UniversityRadioYork/bifrost,UniversityRadioYork/heimdallr,UniversityRadioYork/heimdallr
e19823dd5d8228c1c3bbaaeb67f9413906792950
src/server/enterprise/text/text.go
src/server/enterprise/text/text.go
package text // This package contains strings to be used in error messages and calls to // action for the enterprise product. const ( // OpenSourceProduct is the name of opensource Pachyderm. OpenSourceProduct = "Pachyderm Community Edition" // EnterpriseProduct is the name of enterprise Pachyderm. EnterpriseProd...
package text // This package contains strings to be used in error messages and calls to // action for the enterprise product. const ( // OpenSourceProduct is the name of opensource Pachyderm. OpenSourceProduct = "Pachyderm Community Edition" // EnterpriseProduct is the name of enterprise Pachyderm. EnterpriseProd...
Fix error message for community edition
Fix error message for community edition
Go
apache-2.0
pachyderm/pfs,pachyderm/pfs,pachyderm/pfs
5949c5419c466f4f34f9a9cfded31c17d05f185a
basic_limiter.go
basic_limiter.go
package ratelimit import "time" type basicLimiter struct { t *time.Ticker bc ByteCount cbc chan ByteCount } func (bl *basicLimiter) Start() { for { <-bl.t.C bl.cbc <- bl.bc } } func (bl basicLimiter) GetLimit() <-chan ByteCount { return bl.cbc } const TIME_UNIT = 50 * time.Millisecond //BasicLimiter ...
package ratelimit import "time" type basicLimiter struct { t *time.Ticker bc ByteCount cbc chan ByteCount } func (bl *basicLimiter) Start() { for { <-bl.t.C bl.cbc <- bl.bc } } func (bl basicLimiter) GetLimit() <-chan ByteCount { return bl.cbc } const timeSlice = 20 * time.Millisecond //BasicLimiter ...
Rename constant for appropriate metering of bursts
Rename constant for appropriate metering of bursts
Go
mit
andrewstuart/limio
6db9c34f30fa321693da22bb171bdb91a0a3bc1a
client/client.go
client/client.go
package client import "net" type Client struct { conn net.Conn } func NewClient(o *Options) (*Client, error) { conn, err := o.getDialer()() return &Client{ conn: conn, }, err }
package client import "net" type Client struct { conn net.Conn } func NewClient(o *Options) (*Client, error) { conn, err := o.getDialer()() return &Client{ conn: conn, }, err } func (c *Client) Cmd(args ...interface{}) (r *Reply) { return } func (c *Client) Close() { if c.conn != nil { c.conn.Close() } ...
Define empty methods:Cmd, send and recv.
Define empty methods:Cmd, send and recv.
Go
mit
kofj/redlot
0ae2689d0ae8593d6cba0d6dc7ee4c59ac3080cf
events/events.go
events/events.go
package events import ( "fmt" "strconv" "strings" "time" ) type Event struct { Time time.Time Data map[string]*float64 // TODO: change to map[string]struct{} Tags []string } func NewEvent(data map[string]*float64) *Event { return &Event{Time: time.Now(), Data: data, Tags: make([]string, 0)} } func (e *Even...
package events import ( "strconv" "strings" "time" ) type Event struct { Time time.Time Data map[string]*float64 // TODO: change to map[string]struct{} Tags []string } func NewEvent(data map[string]*float64) *Event { return &Event{Time: time.Now(), Data: data, Tags: make([]string, 0)} } func (e *Event) AddT...
Add comment for check for nil receiver.
Add comment for check for nil receiver.
Go
mit
jonog/redalert,jonog/redalert,jonog/redalert
9e13e77631828c04a5cb7ab9b323bd35440a8c97
api.go
api.go
package main import ( log "github.com/sirupsen/logrus" firego "gopkg.in/zabawaba99/firego.v1" ) func apiRemove(path string) { f := firego.New(baseURL+"/"+path, nil) f.Auth(authToken) defer f.Unauth() if err := f.Remove(); err != nil { log.Fatal(err) } } func apiSet(path string, data interface{}) { f := fir...
package main import ( log "github.com/sirupsen/logrus" firego "gopkg.in/zabawaba99/firego.v1" ) //TODO detectr fail and replay //TODO queu FIFO message in order to recover from tiemout and keep message in track func apiRemove(path string) { f := firego.New(baseURL+"data/"+path, nil) f.Auth(authToken) defer f.Un...
Add data/ in relative base path to separte from futur cahnge like config
Add data/ in relative base path to separte from futur cahnge like config
Go
mit
sapk/sca
3e372207a55143035efba7a9aa4d96a6cc0c1cf3
test/bugs/bug125.go
test/bugs/bug125.go
// errchk $G $D/$F.go // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( OS "os" // should require semicolon here; this is no different from other decls IO "io" ) func main() { }
// errchk $G $D/$F.go // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( OS "os" // should require semicolon here; this is no different from other decls IO "io" // ERROR "missing" ) ...
Add ERROR comment for errmsg to look for.
Add ERROR comment for errmsg to look for. R=gri DELTA=1 (0 added, 0 deleted, 1 changed) OCL=19460 CL=19500
Go
bsd-3-clause
tav/go,tav/go,tav/go,tav/go,tav/go,tav/go,tav/go
8bfd3a54a4142c397cab69bfa9699e5b5db9b40b
hugolib/siteJSONEncode_test.go
hugolib/siteJSONEncode_test.go
// Copyright 2019 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
// Copyright 2019 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
Add a simple test for jsonify of Site
hugolib: Add a simple test for jsonify of Site Closes #5780
Go
apache-2.0
gohugoio/hugo,anthonyfok/hugo,gohugoio/hugo,anthonyfok/hugo,gohugoio/hugo,anthonyfok/hugo
529a0697a96a4cdac5e872d54072b90c4a0ae454
global/Global.go
global/Global.go
// Copyright 2013-2016 Adam Presley. All rights reserved // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package global import "github.com/mailslurper/libmailslurper/storage" const ( // Version of the MailSlurper Server application SERVER_VERSION string = "1.9" ...
// Copyright 2013-2016 Adam Presley. All rights reserved // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package global import "github.com/mailslurper/libmailslurper/storage" const ( // Version of the MailSlurper Server application SERVER_VERSION string = "1.9" ...
Debug mode off by default
Debug mode off by default
Go
mit
mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper,mailslurper/mailslurper
cf97444fc21cb98950213d042b248e540e706be9
utils.go
utils.go
// Copyright 2010 The W32 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 w32 import ( "fmt" "syscall" "unicode/utf16" "unsafe" ) func MakeIntResource(id uint16) *uint16 { return (*uint16)(unsafe.Pointer...
// Copyright 2010 The W32 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 w32 import ( "unicode/utf16" "unsafe" ) func MakeIntResource(id uint16) *uint16 { return (*uint16)(unsafe.Pointer(uintptr(id))) } func L...
Remove import reference of "fmt" and "syscall".
Remove import reference of "fmt" and "syscall".
Go
bsd-3-clause
bnagy/w32,NeilBryant/w32,yamnikov-oleg/w32,MeGaPk/w32,yyljlyy/w32,shirou/w32,VividCortex/w32,alaska/w32
441a6b5ddeb046870c7b82dbe1b0604c737c1557
bitbucket/server/team_provider_test.go
bitbucket/server/team_provider_test.go
package server_test import ( "github.com/concourse/skymarshal/bitbucket/server" "github.com/concourse/skymarshal/provider" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Bitbucket Server Provider", func() { Describe("AuthMethod", func() { var ( authMethod provider.AuthMethod au...
package server_test import ( "github.com/concourse/skymarshal/bitbucket/server" "github.com/concourse/skymarshal/provider" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Bitbucket Server Provider", func() { Describe("AuthMethod", func() { var ( authMethod provider.AuthMethod au...
Fix accidental oauth/v1 route rename in bitbucket test
Fix accidental oauth/v1 route rename in bitbucket test
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
4cc9957c6e7fe5de44fc5cb3dc058af136a22cb4
lua/clone.go
lua/clone.go
package lua func (L Lua) CloneTo(newL Lua) error { L.GetGlobal("_G") defer L.Pop(1) err := L.ForInDo(-1, func(src Lua) error { if !src.IsString(-2) { return nil } key, err := src.ToString(-2) if err != nil { return err } println("KEY=", key) // If new instance has already the member, pass it. ...
package lua func (L Lua) CloneTo(newL Lua) error { L.GetGlobal("_G") defer L.Pop(1) err := L.ForInDo(-1, func(src Lua) error { if !src.IsString(-2) { return nil } key, err := src.ToString(-2) if err != nil { return err } //println("KEY=", key) // If new instance has already the member, pass it....
Comment out debug-print in lua.Lua.Clone()
Comment out debug-print in lua.Lua.Clone()
Go
bsd-3-clause
tyochiai/nyagos,tsuyoshicho/nyagos,zetamatta/nyagos,nocd5/nyagos
f3431e75c15a4653d3160125bc5bb38dd6edcb23
minion/minion.go
minion/minion.go
package minion import ( "time" "code.google.com/p/go-uuid/uuid" ) type Minion interface { // Get minion identifier GetUUID() uuid.UUID // Set name of minion SetName(name string) error // Get name of minion GetName() (string, error) // Set the time the minion was last seen in seconds since the Epoch SetL...
package minion import ( "time" "code.google.com/p/go-uuid/uuid" ) type Minion interface { // Get minion identifier GetUUID() uuid.UUID // Set name of minion SetName(name string) error // Get name of minion GetName() (string, error) // Set the time the minion was last seen in seconds since the Epoch SetL...
Add TaskListener method to the required methods for implementing Minion interface
Add TaskListener method to the required methods for implementing Minion interface
Go
mit
ranjithamca/gru
242fd1e6faa4fa76aaa6d5688930bfaa82764b6d
msg.go
msg.go
package testhelpers import "fmt" const ( // ERROR MESSAGEs - Used as first argument in Error() call EM_NEED_ERR = "Should have gotten an error, but didn't" EM_UN_ERR = "Unexpected Error" // ERROR STRINGS - embed in // Could use a VAR block, fmt and %8s, but this is just as easy ES_EXPECTED = "\nexpected:" E...
package testhelpers import "fmt" const ( // ERROR MESSAGEs - Used as first argument in Error() call EM_NEED_ERR = "Should have gotten an error, but didn't" EM_UN_ERR = "Unexpected Error" // ERROR STRINGS - embed in // Could use a VAR block, fmt and %8s, but this is just as easy ES_EXPECTED = "\nexpected:" E...
Add `ValueWasNil` test message function
Add `ValueWasNil` test message function
Go
mit
ErebusBat/go-testhelpers
d27a91cca43780ec8dd0f3c02d7e7d7b49bdcb06
api/projects/inventory_test.go
api/projects/inventory_test.go
package projects import ( "testing" ) func TestIsValidInventoryPath(t *testing.T) { if !IsValidInventoryPath("inventories/test") { t.Fatal(" a path below the cwd should be valid") } if !IsValidInventoryPath("inventories/test/../prod") { t.Fatal(" a path below the cwd should be valid") } if IsValidInventor...
package projects import ( "testing" "runtime" ) func TestIsValidInventoryPath(t *testing.T) { if !IsValidInventoryPath("inventories/test") { t.Fatal(" a path below the cwd should be valid") } if !IsValidInventoryPath("inventories/test/../prod") { t.Fatal(" a path below the cwd should be valid") } if IsVa...
Fix inventory test for windows path
Fix inventory test for windows path
Go
mit
ansible-semaphore/semaphore,ansible-semaphore/semaphore,ansible-semaphore/semaphore,youhong316/semaphore,youhong316/semaphore,ansible-semaphore/semaphore,youhong316/semaphore,youhong316/semaphore
68220865cd8923f551d0c6aeba4229c27916fd6a
db/datasource.go
db/datasource.go
package db import "gopkg.in/mgo.v2" // Interface for generic data source (e.g. database). type DataSource interface { // Returns collection by name C(name string) Collection // Returns copy of data source (may be copy of session as well) Copy() DataSource } // Override Source method of mgo.Session to return wra...
package db import "gopkg.in/mgo.v2" // Interface for generic data source (e.g. database). type DataSource interface { // Returns collection by name C(name string) Collection // Returns copy of data source (may be copy of session as well) Copy() DataSource // Closes data source (it will be runtime error to use ...
Add close to DataSource interface.
Add close to DataSource interface.
Go
mit
DVI-GI-2017/Jira__backend
cece2c35381eba83611603c4c66e4dff0267e96c
provision/packet/delete.go
provision/packet/delete.go
package packet import "github.com/spf13/cobra" func deleteCmd() *cobra.Command { cmd := &cobra.Command{} return cmd }
package packet import ( "errors" "fmt" "github.com/spf13/cobra" ) func deleteCmd() *cobra.Command { var deleteAll bool cmd := &cobra.Command{ Use: "delete", Short: "Delete machines from the Packet.net project. This will destroy machines. Be ready.", Long: `Delete machines from the Packet.net project. T...
Add support for deleting packet machines
Add support for deleting packet machines
Go
apache-2.0
sashajeltuhin/ket,apprenda/kismatic-provision,apprenda/kismatic-provision,sashajeltuhin/ket
ed9b4cfbfcd651a08713d30fcd556ac4ec4699b6
oddb/database.go
oddb/database.go
package oddb import ( "fmt" ) // A RecordNotFoundError is an implementation of error which represents // a record is not found in a Database type RecordNotFoundError struct { Key string Conn Conn } func (e *RecordNotFoundError) Error() string { return fmt.Sprintf("Record of %v not found in Database", e.Key) } ...
package oddb import ( "fmt" ) // A RecordNotFoundError is an implementation of error which represents // that a record is not found in a Database. type RecordNotFoundError struct { Key string Conn Conn } func (e *RecordNotFoundError) Error() string { return fmt.Sprintf("Record of %v not found in Database", e.Ke...
Add a Query method to Database interface
Add a Query method to Database interface
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,rickmak/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server
e4276c1fd8bc13eae2bcd6fc84ccd9055b3d64f6
gipl.go
gipl.go
package main import ( "bufio" "fmt" "github.com/JacobHayes/locus" "log" "os" "strings" ) func check(err error) { if err != nil { log.Fatal(err) } } func open(filename string) *os.File { file, err := os.Open(filename) check(err) return file } func readLine(scanner *bufio.Scanner) string { check(scanne...
package main import ( "bufio" "fmt" "github.com/JacobHayes/locus" "log" "os" "strings" ) func check(err error) { if err != nil { log.Fatal(err) } } func open(filename string) *os.File { file, err := os.Open(filename) check(err) return file } func readLine(scanner *bufio.Scanner) string { scanner.Scan...
Use file lookup api to simplify logic
Use file lookup api to simplify logic
Go
mit
JacobHayes/gIPl
621f96386155fd79afc42b50aa2d840ddf025fea
drivers/store/memory/store_test.go
drivers/store/memory/store_test.go
package memory_test import ( "testing" "time" "github.com/ulule/limiter/v3" "github.com/ulule/limiter/v3/drivers/store/memory" "github.com/ulule/limiter/v3/drivers/store/tests" ) func TestMemoryStoreSequentialAccess(t *testing.T) { tests.TestStoreSequentialAccess(t, memory.NewStoreWithOptions(limiter.StoreOpti...
package memory_test import ( "testing" "time" "github.com/ulule/limiter/v3" "github.com/ulule/limiter/v3/drivers/store/memory" "github.com/ulule/limiter/v3/drivers/store/tests" ) func TestMemoryStoreSequentialAccess(t *testing.T) { tests.TestStoreSequentialAccess(t, memory.NewStoreWithOptions(limiter.StoreOpti...
Add benchmark for memory store
chore(store/memory): Add benchmark for memory store
Go
mit
ulule/limiter,ulule/limiter
2202c34207ac92ebd0821274aaed9a018de609d3
client/content/playgrounds/code/fortune/ex0-go/src/client/client.go
client/content/playgrounds/code/fortune/ex0-go/src/client/client.go
// index=3 package main import ( "fmt" "log" "time" _ "veyron.io/veyron/veyron/profiles" "veyron.io/veyron/veyron2/rt" "fortune" ) func main() { var err error runtime, err := rt.New() if err != nil { log.Fatal("failure creating runtime: ", err) } // Create a new stub that binds to address without // ...
// index=3 package main import ( "fmt" "log" "time" _ "veyron.io/veyron/veyron/profiles" "veyron.io/veyron/veyron2/rt" "fortune" ) func main() { runtime, err := rt.New() if err != nil { log.Fatal("failure creating runtime: ", err) } // Create a new stub that binds to address without // using the name ...
Fix playground fortune example to work without rt.Init() Addressed nit by @nlacasse.
Fix playground fortune example to work without rt.Init() Addressed nit by @nlacasse.
Go
bsd-3-clause
vanadium/playground,vanadium/playground,vanadium/playground,vanadium/playground
512df45ca4878766730a97c819edbb41499e7c6c
pool/pool.go
pool/pool.go
package pool import ( "runtime" "sync" ) type Pool struct { wg *sync.WaitGroup completion chan bool m sync.Mutex } const ( MaxConcurrencyLimit = -1 ) func New(concurrencyLimit int) *Pool { if concurrencyLimit == MaxConcurrencyLimit { concurrencyLimit = runtime.NumCPU() } wg := sync.Wait...
package pool import ( "runtime" "sync" ) type Pool struct { wg *sync.WaitGroup completion chan bool m sync.Mutex } const ( MaxConcurrencyLimit = -1 ) func New(concurrencyLimit int) *Pool { if concurrencyLimit == MaxConcurrencyLimit { // Completely arbitrary. Most of the time we could proba...
Increase max concurrency by 10x
Increase max concurrency by 10x
Go
mit
buildkite/agent,buildkite/agent,buildkite/agent
867d25f21f55fa6400e68e2bf82f98159fbc97f6
helpers/channels/objectWriteChannelBuilder.go
helpers/channels/objectWriteChannelBuilder.go
package channels import ( "io" "os" helperModels "github.com/SpectraLogic/ds3_go_sdk/helpers/models" ) // Implements the WriteChannelBuilder interface and uses a file as the WriteCloser implementation. // This channel functions as a random-access and can be used concurrently so long as two writers // are ...
package channels import ( "io" "os" helperModels "github.com/SpectraLogic/ds3_go_sdk/helpers/models" ) // Implements the WriteChannelBuilder interface and uses a file as the WriteCloser implementation. // This channel functions as a random-access and can be used concurrently so long as two writers // are ...
Fix for jira neo 996. BP GetObject() does not return an entire object, if the original file had been blobbed. Using a bulk get per object restored. Making write channel builder create the file if it doesn't exist.
Fix for jira neo 996. BP GetObject() does not return an entire object, if the original file had been blobbed. Using a bulk get per object restored. Making write channel builder create the file if it doesn't exist.
Go
apache-2.0
SpectraLogic/ds3_go_sdk,SpectraLogic/ds3_go_sdk,RachelTucker/ds3_go_sdk,RachelTucker/ds3_go_sdk
c6a6a0cfc1752b48763d764c92b8caf74b0cf522
utils/utils.go
utils/utils.go
package utils import ( "os" "os/user" ) /*GetUserHomeDir returns the home directory of the current user. */ func GetUserHomeDir() string { usr, err := user.Current() // If the current user cannot be reached, get the HOME environment variable if err != nil { return os.Getenv("$HOME") } return usr.HomeDir }
package utils import ( "os" "os/user" ) /*GetUserHomeDir returns the home directory of the current user. */ func GetUserHomeDir() string { usr, err := user.Current() // If the current user cannot be reached, get the HOME environment variable if err != nil { return os.Getenv("$HOME") } return usr.HomeDir } ...
Add a function to get the localhost
Add a function to get the localhost
Go
mit
k0pernicus/goyave
0c367e466de5c5345593d1846a62493883084981
main.go
main.go
package main import ( "fmt" "github.com/adrien-f/gotify/config" sp "github.com/op/go-libspotify" ) func Ascii() { fmt.Println(" _ _ __") fmt.Println(" __ _ ___ | |_(_)/ _|_ _") fmt.Println(" / _` |/ _ \\| __| | |_| | | |") fmt.Println("| (_| | (_) | |_| | _| |_| |") fmt.Println(" \\__, |\\...
// This is gotify, a lightweight Spotify player written in Go package main import ( "flag" "fmt" "github.com/adrien-f/gotify/config" sp "github.com/op/go-libspotify" ) func Ascii() { fmt.Println(" _ _ __") fmt.Println(" __ _ ___ | |_(_)/ _|_ _") fmt.Println(" / _` |/ _ \\| __| | |_| | | |") ...
Add godoc string and debug flag parsing
Add godoc string and debug flag parsing
Go
mit
adrien-f/gotify
9fb34977a61320eca65e75e33c01c6ef71fbb6eb
menu.go
menu.go
package chalmers_chop import "time" type Menu struct { Title string `json:"title"` Date string `json:"date"` Dishes []Dish `json:"dishes"` } func (m *Menu) AddDish(dish Dish) { m.Dishes = append(m.Dishes, dish) } func (r *Restaurant) TodaysMenu() *Menu { found, menu := r.findMenuByTime(time.Now()) if !fou...
package chalmers_chop import "time" type Menu struct { Title string `json:"title"` Date string `json:"date"` Dishes []Dish `json:"dishes"` } func (m *Menu) AddDish(dish Dish) { m.Dishes = append(m.Dishes, dish) } func (r *Restaurant) TodaysMenu() *Menu { found, menu := r.findMenuByTime(time.Now()) if !fou...
Rename variable to avoid confusion with time package
Rename variable to avoid confusion with time package
Go
mit
kayex/chalmers-chop
f016d747d66357e2fb84572f4eb8f0d2e1d5360a
main.go
main.go
package main import ( "fmt" "os" "github.com/codegangsta/cli" _ "github.com/go-sql-driver/mysql" "github.com/containerops/vessel/cmd" "github.com/containerops/wrench/setting" ) func main() { if err := setting.SetConfig("conf/containerops.conf"); err != nil { fmt.Printf("Read config error: %v", err.Error())...
package main import ( "fmt" "os" "github.com/codegangsta/cli" "github.com/containerops/vessel/cmd" "github.com/containerops/wrench/setting" ) func main() { if err := setting.SetConfig("conf/containerops.conf"); err != nil { fmt.Printf("Read config error: %v", err.Error()) return } app := cli.NewApp() ...
Remove the unuse mysql driver
Remove the unuse mysql driver
Go
mit
zenlinTechnofreak/vessel,huangliangjun/vessel