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
8b4d7b298ed528544e88f601ce92f4a1caac8f99
term/term.go
term/term.go
package term import ( "os" "os/exec" "runtime" ) func Clear() { var cmd *exec.Cmd switch os := runtime.GOOS; os { case "linux": cmd = exec.Command("clear") case "windows": cmd = exec.Command("cls") } cmd.Stdout = os.Stdout cmd.Run() }
package term import ( "os" "os/exec" "runtime" ) func Clear() { var cmd *exec.Cmd switch os := runtime.GOOS; os { case "linux": cmd = exec.Command("clear") case "windows": cmd = exec.Command("cmd", "/C", "cls") } cmd.Stdout = os.Stdout cmd.Run() }
Fix clear screen on windows
Fix clear screen on windows
Go
bsd-3-clause
d-bf/client,d-bf/client
c641bba3196a7dc345fea05036d5ca9c2f95aadb
pkg/util/retry/util.go
pkg/util/retry/util.go
package retry import ( "time" ) // Func is the function to retry returning true if it's successfully completed type Func = func() bool // Do retries provided function "attempts" times with provided interval and returning true if it's successfully completed func Do(attempts int, interval time.Duration, f Func) bool ...
package retry import ( "fmt" "time" ) // Func is the function to retry returning true if it's successfully completed type Func = func() bool // Do retries provided function "attempts" times with provided interval and returning true if it's successfully completed func Do(attempts int, interval time.Duration, f Func...
Make retry.Do panic if it's started with interval less then 1/10 second
Make retry.Do panic if it's started with interval less then 1/10 second
Go
apache-2.0
Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi
ae4d399cfce162f6b8b5f0fa9fe902239cf6f9f4
divsd/config.go
divsd/config.go
package divsd // The top configuration structure for the DiVS daemon type Config struct { Global globalConfig Raft raftConfig Discover discoverConfig Mdns mdnsConfig Tun tunConfig } // Global config type globalConfig struct { Name string Host string Port int Serial string } // RAFT type...
package divsd // The top configuration structure for the DiVS daemon type Config struct { Global globalConfig Raft raftConfig Discover discoverConfig Mdns mdnsConfig Tun tunConfig } // Global config type globalConfig struct { Name string Host string Port int Serial UUID } // RAFT type r...
Use proper UUIDs and not just strings: we will perform conversion later on...
Use proper UUIDs and not just strings: we will perform conversion later on...
Go
mit
inercia/divs
95843c93cfab657ee8972509409a37054cdd2c2e
agent/action/compile_package_with_signed_url.go
agent/action/compile_package_with_signed_url.go
package action import ( boshcomp "github.com/cloudfoundry/bosh-agent/agent/compiler" boshcrypto "github.com/cloudfoundry/bosh-utils/crypto" ) type CompilePackageWithSignedURLRequest struct { SignedURL string `json:"signed_url"` MultiDigest boshcrypto.MultipleDigest `json:"multi_digest"` Name string ...
package action import ( boshcomp "github.com/cloudfoundry/bosh-agent/agent/compiler" boshcrypto "github.com/cloudfoundry/bosh-utils/crypto" ) type CompilePackageWithSignedURLRequest struct { PackageGetSignedURL string `json:"package_get_signed_url"` UploadSignedUrl string `json:"upload_signed_url"` MultiDig...
Fix missing signedUrl for uploading compiled pkg
Fix missing signedUrl for uploading compiled pkg * We expect 2 signed urls from the director, one for downloading the source uncompiled package, and one for uploading the compiled package. [#167582819] Co-authored-by: Chris Tarazi <52172d1cc353fd06218578cc1e854d12546b9ed2@pivotal.io>
Go
apache-2.0
mattcui/bosh-agent,mattcui/bosh-agent,cloudfoundry/bosh-agent,gu-bin/bosh-agent,mattcui/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent,cloudfoundry/bosh-agent
db1a85cd360a55632d78df9c5e3aad4ec765eeb5
text_test.go
text_test.go
package main import ( "testing" log "github.com/Sirupsen/logrus" ) func TestLineBreaking(t *testing.T) { log.SetLevel(log.DebugLevel) var tests = []struct { text string result string }{ { `\\name[Domestic scent](…Properly……I want to take a bath……  today…Let's go home.……)`, `\\name[Domestic scent]...
package main import "testing" func TestLineBreaking(t *testing.T) { var tests = []struct { text string result string }{ { `\\name[Domestic scent](…Properly……I want to take a bath……  today…Let's go home.……)`, `\\name[Domestic scent](…Properly……I want to take a bath……  today…Let's go home.……)`, }, {...
Remove debug output from test
Remove debug output from test
Go
mit
softashell/rpgmaker-patch-translator
8350e81f8f574adfca1112ae26b2f38fa0587a96
nom/query.go
nom/query.go
package nom import ( "encoding/gob" "time" ) // NodeQuery queries the information of a node. type NodeQuery struct { Node UID } // NodeQueryResult is the result for NodeQuery. type NodeQueryResult struct { Err error Node Node } // PortQuery queries the information of a port. type PortQuery struct { Port UID ...
package nom import ( "encoding/gob" "time" ) // NodeQuery queries the information of a node. type NodeQuery struct { Node UID } // NodeQueryResult is the result for NodeQuery. type NodeQueryResult struct { Err error Node Node } // PortQuery queries the information of a port. type PortQuery struct { Port UID ...
Change flow stat reply to include multiple stats
Change flow stat reply to include multiple stats
Go
apache-2.0
soheilhy/beehive-netctrl,kandoo/beehive-netctrl
0db9a9e40e2299bbf2fcc97b16f2dd2469edc58d
force/error.go
force/error.go
package force import ( "fmt" ) // Custom Error to handle salesforce api responses. type ApiErrors []*ApiError type ApiError struct { Fields []string `json:"fields,omitempty" force:"fields,omitempty"` Message string `json:"message,omitempty" force:"message,omitempty"` ErrorCode string ...
package force import ( "fmt" "strings" ) // Custom Error to handle salesforce api responses. type ApiErrors []*ApiError type ApiError struct { Fields []string `json:"fields,omitempty" force:"fields,omitempty"` Message string `json:"message,omitempty" force:"message,omitempty"` ErrorCode ...
Use Stringer interface for ApiErrors and ApiError.
Use Stringer interface for ApiErrors and ApiError.
Go
mit
sarahyablok/go-force,coreos/go-force,nimajalali/go-force,omniprojects/go-force,ecnahc515/go-force,egtann/go-force
8fe41cce33b227d001107a63dec675a61dfbd5cd
i18n/string.go
i18n/string.go
package i18n // TranslatableString is the interface implemented // by strings that can be translated. type TranslatableString interface { TranslatedString(lang Languager) string } // String is an alias for string, but variables // or constants declared with the type String will // be extracted for translation. type ...
package i18n import ( "gnd.la/util/textutil" ) // TranslatableString is the interface implemented // by strings that can be translated. type TranslatableString interface { TranslatedString(lang Languager) string } // String is an alias for string, but variables // or constants declared with the type String will //...
Add support for i18n.String with multiple fields
Add support for i18n.String with multiple fields 1 field => singular 2 fields => context|singular 3 fields => context|singular|plural
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
d2e80daca0de30a0fc9c8821b0b7610d272a231c
sub/rpcd/setConfiguration.go
sub/rpcd/setConfiguration.go
package rpcd import ( "github.com/Symantec/Dominator/lib/filter" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/sub" ) func (t *rpcType) SetConfiguration(conn *srpc.Conn, request sub.SetConfigurationRequest, reply *sub.SetConfigurationResponse) error { t.scannerConfiguration.FsSca...
package rpcd import ( "github.com/Symantec/Dominator/lib/filter" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/sub" ) func (t *rpcType) SetConfiguration(conn *srpc.Conn, request sub.SetConfigurationRequest, reply *sub.SetConfigurationResponse) error { t.scannerConfiguration.FsSca...
Add logging for Sub.SetConfiguration SRPC method.
Add logging for Sub.SetConfiguration SRPC method.
Go
apache-2.0
rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator
a810920f7ff0f7bea0b597e2e3d3a8cf1e0b5888
discountcalculator/discountcalculator.go
discountcalculator/discountcalculator.go
package discountcalculator type discountCalculator struct { strategy func() (rate float64, strategyCode int) strategyCode int } func New() *discountCalculator { return &discountCalculator{} } func (calculator *discountCalculator) DiscountFor(customer *customer) *discount { switch c := customer.category; c { ...
package discountcalculator type discountCalculator struct { strategy func() (rate float64, strategyCode int) } func New() *discountCalculator { return &discountCalculator{} } func (calculator *discountCalculator) DiscountFor(customer *customer) *discount { switch c := customer.category; c { case STANDARD: retu...
Remove unused field in the calculator struct.
Remove unused field in the calculator struct.
Go
mit
ihcsim/go101,ihcsim/golang-tutorial
ade493263bf3b21894caa220bd08de9544954f41
state/migration/package_test.go
state/migration/package_test.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package migration import ( "testing" gc "gopkg.in/check.v1" ) // Useful test constants. const gig uint64 = 1024 * 1024 * 1024 // None of the tests in this package require mongo. func TestPackage(t *testing.T) { gc.Test...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package migration import ( "testing" gc "gopkg.in/check.v1" ) // Useful test constants. // Constraints and CloudInstance store megabytes const gig uint64 = 1024 // None of the tests in this package require mongo. func T...
Change the gig constant to reflect state values.
Change the gig constant to reflect state values.
Go
agpl-3.0
perrito666/juju,waigani/juju,alesstimec/juju,gabriel-samfira/juju,marcmolla/juju,bogdanteleaga/juju,gabriel-samfira/juju,dimitern/juju,makyo/juju,alesstimec/juju,reedobrien/juju,gabriel-samfira/juju,macgreagoir/juju,perrito666/juju,makyo/juju,mjs/juju,bz2/juju,kat-co/juju,bz2/juju,frankban/juju,gabriel-samfira/juju,eri...
03d53d7265e2f1a708d7e560f6a2d0e1a5fa0b6b
app/controllers/static.go
app/controllers/static.go
package controllers import ( "github.com/julienschmidt/httprouter" "github.com/raggaer/castro/app/util" "net/http" ) func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) { // Get extension identifier id := ps.ByName("id") // Check if static file exists dir, exists := util.Exten...
package controllers import ( "github.com/julienschmidt/httprouter" "github.com/raggaer/castro/app/util" "net/http" ) func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) { // Get extension identifier id := ps.ByName("id") // Check if static file exists dir, exists := util.Exten...
Use proper filename for http.ServeContent
Use proper filename for http.ServeContent
Go
mit
Raggaer/castro,Raggaer/castro,Raggaer/castro
598310d7ba550f65f475734cb5b624343f0ef387
rapi/endpoint_test.go
rapi/endpoint_test.go
package rapi_test import ( "net/http" "net/http/httptest" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/waltzofpearls/relay-api/rapi" ) func TestEndpoint(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http...
package rapi_test import ( "io/ioutil" "net/http" "net/http/httptest" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/waltzofpearls/relay-api/rapi" ) func TestEndpointUnchanged(t *testing.T) { var requestContent string expectedResult := `test` t...
Validate that the request body is unchanged by default
Validate that the request body is unchanged by default
Go
mit
waltzofpearls/relay-api
1f1e739ef21f8c63ebb997f935b3a4e34dbf2da1
sys/tc.go
sys/tc.go
package sys /* #include <unistd.h> int f(int fd, pid_t pid) { return tcsetpgrp(fd, pid); } */ import "C" import "syscall" func Tcsetpgrp(fd int, pid int) error { i := syscall.Errno(C.f(C.int(fd), C.pid_t(pid))) if i != 0 { return syscall.Errno(i) } return nil }
package sys /* #include <unistd.h> #include <errno.h> int f(int fd, pid_t pid) { return tcsetpgrp(fd, pid); } int e() { return errno; } */ import "C" import "syscall" func Tcsetpgrp(fd int, pid int) error { i := C.f(C.int(fd), C.pid_t(pid)) if i != 0 { return syscall.Errno(C.e()) } return nil }
Fix error reporting of Tcsetgrp.
sys: Fix error reporting of Tcsetgrp.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
2061dbf5ab13e17f256c35e21c60207a74cd6b5c
pkg/api/unversioned/well_known_labels.go
pkg/api/unversioned/well_known_labels.go
/* Copyright 2015 The Kubernetes 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 law or ag...
/* Copyright 2015 The Kubernetes 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 law or ag...
Add instance-type label to cloud providers
Add instance-type label to cloud providers Fully implemented for AWS and GCE Kubernetes-commit: b3863eae82b48603d2623c43d3b7d5ff5f837a65
Go
apache-2.0
kubernetes/api
c312d0485f02b60b412a41394f98dd8d45a4576c
commands/cleanup_leftovers.go
commands/cleanup_leftovers.go
package commands import ( "fmt" "github.com/cloudfoundry/bosh-bootloader/flags" "github.com/cloudfoundry/bosh-bootloader/storage" ) type FilteredDeleter interface { Delete(filter string) error } type CleanupLeftovers struct { deleter FilteredDeleter } func NewCleanupLeftovers(deleter FilteredDeleter) CleanupL...
package commands import ( "fmt" "github.com/cloudfoundry/bosh-bootloader/flags" "github.com/cloudfoundry/bosh-bootloader/storage" ) type FilteredDeleter interface { Delete(filter string) error } type CleanupLeftovers struct { deleter FilteredDeleter } func NewCleanupLeftovers(deleter FilteredDeleter) CleanupL...
Fix leftovers panic on vSphere
Fix leftovers panic on vSphere Signed-off-by: Rowan Jacobs <f6a1b0cdf5ee40839db77d8af28f9a0cbe9aba71@pivotal.io>
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader
9a43c31ea5caa1b405e9caa91ce6aeea534041ac
norway/main.go
norway/main.go
package main import ( "flag" "log" "net/http" "strings" ) func main() { httpListen := flag.String("http", "127.0.0.1:8080", "host:port to listen on") // basePath := flag.String("base", ".", "base path for web interface templates and static resources") // cvsPath := flag.String("cvs", ".", "path to the cvs repo...
package main import ( "flag" "log" "net/http" "os" "strings" "github.com/mulander/norway" ) var cvs norway.Entries func Init(cvsPath string) { entriesFile, err := os.Open(cvsPath + "/CVS/Entries") if err != nil { log.Fatal(err) } defer entriesFile.Close() cvs, err = norway.ParseEntries(entriesFile) i...
Add basic single directory entries parse on startup
Add basic single directory entries parse on startup
Go
bsd-3-clause
mulander/norway
645ef489efa037919f4f1c90129a8cd5a831a0c9
copy/links.go
copy/links.go
package copy import ( "strings" ) // Use the object Meta from files (move to other file?) type LinkService struct { client *Client } var ( // Links paths linksTopLevelSuffix = "links" linksGetSuffix = strings.Join([]string{linksTopLevelSuffix, "%v"}, "/") // https://.../links/TOKEN ) func NewLinkService(...
package copy import ( "strings" ) // Use the object Meta from files (move to other file?) type LinkService struct { client *Client } var ( // Links paths linksTopLevelSuffix = "links" linksGetSuffix = strings.Join([]string{linksTopLevelSuffix, "%v"}, "/") // https://.../links/TOKEN ) func NewLinkService(...
Fix return types to return correct number of values
Fix return types to return correct number of values
Go
mit
slok/go-copy
ab1b4bf8697a7ddc84a23407beea7cb8ef9593e0
jsonHandler.go
jsonHandler.go
package ambition import ( "encoding/json" ) func PostOccurrenceByActionIdJson(ActionId int, occurrenceJson []byte) error { var occurrence Occurrence err := json.Unmarshal(occurrenceJson, occurrence) occurrence.ActionId = ActionId database.InsertOccurrence(&occurrence) return err } func PostActionBySetIdJson(...
package ambition import ( "encoding/json" ) func PostOccurrenceByActionIdJson(ActionId int, occurrenceJson []byte) error { var occurrence Occurrence err := json.Unmarshal(occurrenceJson, &occurrence) occurrence.ActionId = ActionId database.InsertOccurrence(&occurrence) return err } func PostActionBySetIdJson...
Fix passing json unmarshal non-pointer values
Fix passing json unmarshal non-pointer values
Go
unlicense
lelandbatey/ambition,lelandbatey/ambition,lelandbatey/ambition
82fd6f9d4125f8daf16fbdbd88678b5c2a67b6e5
mat64/inner.go
mat64/inner.go
// Copyright ©2014 The gonum 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 mat64 // Inner computes the generalized inner product between x and y with matrix A. // x^T A y // This is only a true inner product if m is symme...
// Copyright ©2014 The gonum 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 mat64 // Inner computes the generalized inner product // x^T A y // between vectors x and y with matrix A. This is only a true inner product if /...
Reformat and update comment for func Inner()
Reformat and update comment for func Inner()
Go
bsd-3-clause
gonum/gonum,gonum/gonum,gonum/gonum
405ffed173eae9eea616acbad33565b5a5a035c0
controller/examples/config.go
controller/examples/config.go
package main import ( "fmt" "io" "io/ioutil" "os" ) type config struct { controllerKey string ourPort string logOut io.Writer } func loadConfigFromEnv() (*config, error) { c := &config{} c.controllerKey = os.Getenv("CONTROLLER_KEY") if c.controllerKey == "" { return nil, fmt.Errorf("CONTROLL...
package main import ( "fmt" "io" "os" ) type config struct { controllerKey string ourPort string logOut io.Writer } func loadConfigFromEnv() (*config, error) { c := &config{} c.controllerKey = os.Getenv("CONTROLLER_KEY") if c.controllerKey == "" { return nil, fmt.Errorf("CONTROLLER_KEY is req...
Send log output to STDERR by default
controller/examples: Send log output to STDERR by default The previous default was to discard any messages, which will suppress errors. Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>
Go
bsd-3-clause
pkdevbox/flynn,kgrz/flynn,flynn/flynn,justintung/flynn,shads196770/flynn,TribeMedia/flynn,technosophos/flynn,philiplb/flynn,benbjohnson/flynn,GrimDerp/flynn,jzila/flynn,tonicbupt/flynn,tonicbupt/flynn,benbjohnson/flynn,felixrieseberg/flynn,shads196770/flynn,Brandywine2161/flynn,flynn/flynn,Brandywine2161/flynn,benbjohn...
9febd0d4ed12ea2f345cc3835bd9a7de1d43cca8
common/data.go
common/data.go
package common const ( OpGet = iota OpSet OpDel OpLst ) var opNames map[byte]string func init() { opNames = make(map[byte]string, 0) opNames[OpGet] = "GET" opNames[OpSet] = "SET" opNames[OpDel] = "DEL" opNames[OpLst] = "LST" } type Operation struct { OpCode byte Key []byte Val []byte WID int /...
package common const ( OpGet = iota OpSet OpDel OpLst ) var opNames map[byte]string func init() { opNames = make(map[byte]string, 0) opNames[OpGet] = "GET" opNames[OpSet] = "SET" opNames[OpDel] = "DEL" opNames[OpLst] = "LST" } type Operation struct { OpCode byte Key []byte Val []byte WID int /...
Add field in Response indicating presence of key in store.
Add field in Response indicating presence of key in store.
Go
isc
gokyle/kludge
265c3e0418946f7332d951a4556e2b446b4408b7
tenets/codelingo/cockroachdb/avoid-bool-params/example.go
tenets/codelingo/cockroachdb/avoid-bool-params/example.go
package main func main() { doThisOrThat(false) } func doThisOrThat(flag bool) { // Issue if flag { doThis() } else { doThat() } } func returnsTrue() bool { return true } func doThis() {} func doThat() {}
//Package main is an example package package main func main() { doThisOrThat(false) } func doThisOrThat(flag bool) { // Issue if flag { doThis() } else { doThat() } } func returnsTrue() bool { return true } func doThis() {} func doThat() {}
Add package comment to adhere to CodeLingo review bot
Add package comment to adhere to CodeLingo review bot
Go
agpl-3.0
lingo-reviews/lingo,lingo-reviews/lingo
0ad017c5d5b4a85a1a43f783c093d566ac076566
lib/net/measuringDialer.go
lib/net/measuringDialer.go
package net import ( "time" ) func newMeasuringDialer(dialer Dialer) *MeasuringDialer { return &MeasuringDialer{dialer: dialer} } func (d *MeasuringDialer) Dial(network, address string) ( *MeasuringConnection, error) { startTime := time.Now() netConn, err := d.dialer.Dial(network, address) d.cumulativeDialTime...
package net import ( "net" "time" ) func newMeasuringDialer(dialer Dialer) *MeasuringDialer { return &MeasuringDialer{dialer: dialer} } func (d *MeasuringDialer) Dial(network, address string) (net.Conn, error) { startTime := time.Now() netConn, err := d.dialer.Dial(network, address) d.cumulativeDialTime += tim...
Make lib/net.MeasuringDialer.Dial() conform to Dialer.Dial().
Make lib/net.MeasuringDialer.Dial() conform to Dialer.Dial().
Go
apache-2.0
Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator
7aa75fc746a579e91feb3ec0e9a8c1e42cf3b0a0
main.go
main.go
package main import ( "log" "os" ) func main() { if len(os.Args) != 3 { log.Fatalf("Usage: %s data_file pattterns_file", os.Args[0]) } dataFile, err := os.Open(os.Args[1]) if err != nil { log.Fatalf("Error occurred while opening data_file: %v", err) } defer dataFile.Close() patternsFile, err := os.Open...
package main import ( "os" "flag" "log" ) func main() { var pArg = flag.String("p", "patterns", "patterns file") flag.Parse() patternsFile, err := os.Open(*pArg) if err != nil { log.Fatalf("Error occurred while opening patterns_file: %v", err) } defer patternsFile.Close() var dataFile = os.Stdin if len...
Support reading data from stdin
Support reading data from stdin
Go
mit
mtojek/oi
39a071aa01998a4efc4a36b8737909fef3f2d968
main.go
main.go
package main import ( "context" "log" "fmt" "encoding/json" "github.com/google/go-github/github" "golang.org/x/oauth2" ) var Configuration = Config{} func main() { Configuration = Configuration.Init() ctx := context.Background() ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: Configuration....
package main import ( "context" "log" "fmt" "encoding/json" "github.com/google/go-github/github" "golang.org/x/oauth2" ) var Configuration = Config{} func main() { Configuration = Configuration.Init() ctx := context.Background() ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: Configuration....
Use the built in getters
Use the built in getters
Go
mit
HippieStation/PRMirror
63dfe5fa377844a5e2fca137bc9ab8d0562ddc38
main.go
main.go
package main import ( "bufio" "flag" "log" "os" ) type host struct { name string protocol string endpoint string } var hosts []host // readHosts reads in hosts from a file and populates hosts []host. func readHosts() { f, err := os.Open(filename) if err != nil { log.Println(err) } defer f.Close() ...
package main import ( "bufio" "flag" "log" "os" ) type host struct { name string protocol string endpoint string } var hosts []host // readHosts reads in hosts from a file and populates hosts []host. func readHosts() { f, err := os.Open(filename) if err != nil { log.Fatal(err) } defer f.Close() s...
Change fail to open hosts file to log.Fatal()
Change fail to open hosts file to log.Fatal()
Go
mit
wgjohnson/chooch
5789101f3be0afefd58c7aa0d5496b47a9488ad3
gapis/gfxapi/gles/vertex_attribute_array.go
gapis/gfxapi/gles/vertex_attribute_array.go
// Copyright (C) 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
// Copyright (C) 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
Add GLenum_GL_UNSIGNED_INT_2_10_10_10_REV case to DataTypeSize()
gles: Add GLenum_GL_UNSIGNED_INT_2_10_10_10_REV case to DataTypeSize()
Go
apache-2.0
dsrbecky/gapid,google/agi,google/gapid,google/gapid,google/agi,dsrbecky/gapid,pmuetschard/gapid,ek9852/gapid,pmuetschard/gapid,baldwinn860/gapid,Qining/gapid,ek9852/gapid,ben-clayton/gapid,google/gapid,Qining/gapid,baldwinn860/gapid,pmuetschard/gapid,pmuetschard/gapid,ben-clayton/gapid,ben-clayton/gapid,google/agi,ek98...
20eb7dded33a842282fd8604c9c31d7875f79c64
helper/safe.go
helper/safe.go
package helper func SafeMap(m map[string]interface{}, key string, def interface{}) interface{} { var outp interface{} = def switch def.(type) { case string: if val, ok := m[key].(string); ok { outp = val } case int: if val, ok := m[key].(int); ok { outp = val } case []interface{}: if val, ok := m[...
package helper func SafeMap(m map[string]interface{}, key string, def interface{}) interface{} { var outp interface{} = def switch def.(type) { case string: if val, ok := m[key].(string); ok { outp = val } case int: if val, ok := m[key].(int); ok { outp = val } case int64: if val, ok := m[key].(in...
Add type int64 to SafeMap.
Add type int64 to SafeMap.
Go
apache-2.0
Hu13er/Palette
9885f7c948fb4b76a7def7ef77083666e8d5cd1a
engine/url.go
engine/url.go
package engine import ( "os/exec" log "github.com/sirupsen/logrus" ) // OpenURL tries to open an URL with the system browser func (ac *Config) OpenURL(host, colonPort string, httpsPrefix bool) { if host == "" { host = "localhost" } protocol := "http://" if httpsPrefix { protocol = "https://" } url := pro...
package engine import ( "os/exec" "strings" log "github.com/sirupsen/logrus" ) // OpenURL tries to open an URL with the system browser func (ac *Config) OpenURL(host, cPort string, httpsPrefix bool) { // Build the URL var sb strings.Builder if httpsPrefix { sb.WriteString("https://") } else { sb.WriteStri...
Use strings.Builder when opening an URL
Use strings.Builder when opening an URL
Go
bsd-3-clause
xyproto/algernon,xyproto/algernon,xyproto/algernon,xyproto/algernon
f196de5ecad49bc9c75072a618ef48aab0f2d798
backends/file_store.go
backends/file_store.go
package backends import ( "io" "os" ) type FileStore interface { // write content at given path WriteFile(path string, reader io.Reader) (err error) // create dir at given path CreateDir(path string) (err error) // generate a checksum for a given path (file or directory) Checksum(path string) (err error) ...
package backends import ( "io" "os" ) type FileStore interface { // write content at given path WriteFile(path string, reader io.Reader) (err error) // create dir at given path CreateDir(path string) (err error) // generate a checksum for a given path (file or directory) Checksum(path string) (err error) ...
Add ReadRoot() to file store interface.
Add ReadRoot() to file store interface.
Go
mit
Marktown/frontend,Marktown/frontend,Marktown/frontend
9a61d62680df62ca01570b62607cd3a80ea47b55
blocks_test.go
blocks_test.go
package main import ( "testing" ) func TestRandomCodePoint(t *testing.T) { for _, b := range Blocks { var cp rune cp = b.RandomCodePoint() if cp < b.start || cp > b.end { t.Fail() } } } func BenchmarkRandomCodePoint(b *testing.B) { testBlock := Blocks["math_alnum"] for i := 0; i < b.N; i++ { testB...
package main import ( "testing" ) func TestRandomCodePoint(t *testing.T) { for _, b := range Blocks { var cp rune cp = b.RandomCodePoint() if cp < b.start || cp > b.end { t.Fail() } } } func BenchmarkRandomCodePoint(b *testing.B) { testBlock := &UnicodeBlock{0x0000, 0x10ffff} for i := 0; i < b.N; i+...
Use block spanning all unicode planes for BenchmarkRandomCodePoint
Use block spanning all unicode planes for BenchmarkRandomCodePoint
Go
mit
qjcg/horeb
b94a92cf64244ac9fe52d122cc6351a91a253462
cmdretrieve.go
cmdretrieve.go
package main import ( "fmt" "github.com/atotto/clipboard" ) func init() { registerSubcommand(&Subcommand{ Name: "retrieve", Aliases: []string{"r", "load", "l", "checkout", "co"}, Usage: "<website> [username]", Hint: "Load a password from storage to clipboard", Handler: cmdRetrieve, }) } func c...
package main import ( "fmt" "github.com/atotto/clipboard" ) func init() { registerSubcommand(&Subcommand{ Name: "retrieve", Aliases: []string{"r", "checkout", "co"}, Usage: "<website> [username]", Hint: "Load a password from storage to clipboard", Handler: cmdRetrieve, }) } func cmdRetrieve(ar...
Resolve name conflict between commands "list" and "retrieve"
Resolve name conflict between commands "list" and "retrieve"
Go
mit
yamnikov-oleg/pss
94ccbefcd4f98949222f061032b192563eb76d7e
go/src/c3/feature/singleton.go
go/src/c3/feature/singleton.go
package feature import ( "sync" ) var onlyonce sync.Once var protect chan int var singleton *Feature func getSingleton() (r *Feature) { onlyonce.Do(func() { singleton = New() }) return singleton } // ClearCache clears the cached features that were loaded from the object server. func ClearCache() { p...
package feature import "sync" var onlyonce sync.Once var protect chan int var singleton *Feature func getSingleton() (r *Feature) { onlyonce.Do(func() { singleton = New() }) return singleton } // ClearCache clears the cached features that were loaded from the object server. func ClearCache() { protect <- 1 d...
Update the formatting using goimports
Update the formatting using goimports `goimports` tool is integrated into GoSublime package of Sublime Text 2 editor.
Go
bsd-3-clause
cention/ferite-module-webframework,cention/ferite-module-webframework,cention/ferite-module-webframework
5fceb7eb772c8fa1a50bbbc828da748c1e7232af
composer_test.go
composer_test.go
package tusd_test import ( "github.com/tus/tusd" "github.com/tus/tusd/consullocker" "github.com/tus/tusd/filestore" "github.com/tus/tusd/limitedstore" ) func ExampleNewStoreComposer() { composer := tusd.NewStoreComposer() fs := filestore.New("./data") fs.UseIn(composer) cl := consullocker.New(nil) cl.UseIn...
package tusd_test import ( "github.com/tus/tusd" "github.com/tus/tusd/filestore" "github.com/tus/tusd/limitedstore" "github.com/tus/tusd/memorylocker" ) func ExampleNewStoreComposer() { composer := tusd.NewStoreComposer() fs := filestore.New("./data") fs.UseIn(composer) ml := memorylocker.New() ml.UseIn(co...
Use memorylocker in example for composer
Use memorylocker in example for composer
Go
mit
tus/tusd,tus/tusd
1ccdfcc41eeb5060416d67593c6dd727d7331b0a
config/config.go
config/config.go
package config import "fmt" type Config struct { Secret string Host string Port int DB *DBConfig SlackApp *SlackAppConfig } type DBConfig struct { Dialect string Username string Password string Name string Charset string } type SlackAppConfig struct { ClientId string ClientSecr...
package config import ( "os" ) type Config struct { Secret string Host string Port int DB *DBConfig SlackApp *SlackAppConfig } type DBConfig struct { Dialect string Username string Password string Name string Charset string } type SlackAppConfig struct { ClientID string Client...
Use system env for secret values
Use system env for secret values
Go
mit
mingrammer/meetup-api
3a5cbb599dde6cba4bd05e4e217bab702d74b27d
models/sensors.go
models/sensors.go
package models import "time" type Sensor struct { Name string `json:"name"` Type string `json:"type"` GenTime time.Time `json:"gen_time"` } // Struct for Gyro Sensor type GyroSensor struct { Sensor AngleVelocityX float32 `json:"x_axis_angle_velocity"` AngleVelocityY float32 `json:"y_axis_angle_velo...
package models import "time" // Sensor has common fields for any sensors type Sensor struct { Name string `json:"name"` Type string `json:"type"` GenTime time.Time `json:"gen_time"` } // GyroSensor produces x-y-z axes angle velocity values type GyroSensor struct { Sensor AngleVelocityX float32 `json...
Rewrite the comments for sensor structs
Rewrite the comments for sensor structs
Go
mit
mingrammer/go-codelab
33f7cda183142e721e18de96b5fbdb5b50984444
domain/domain.go
domain/domain.go
package domain import "time" // Trace represents a full trace of a request // comprised of a number of events and annotations type Trace []Event // EventType represents an Enum of types of Events which Phosphor can record type EventType int const ( // RPC Calls Req = EventType(1) // Client Request dispatch Rsp =...
package domain import "time" // Trace represents a full trace of a request // comprised of a number of events and annotations type Trace []Event // EventType represents an Enum of types of Events which Phosphor can record type EventType int const ( // RPC Calls Req = EventType(1) // Client Request dispatch Rsp =...
Update span terminology to match dapper & zipkin
Update span terminology to match dapper & zipkin
Go
apache-2.0
mattheath/phosphor,mondough/phosphor,mondough/phosphor,mattheath/phosphor
b4629c8108bed714bd79781863d4d163a9480b09
name-generator.go
name-generator.go
package main import ( "encoding/json" "flag" "io/ioutil" "log" ) // define CLI flags //TODO: add default path for default file var filepath = flag.String("filepath", "./names.json", "The path to the file with the names") var removeName = flag.Bool("remove", true, "if true the name will be removed from list") // ...
package main import ( "encoding/json" "flag" "io/ioutil" "log" ) // define CLI flags //TODO: add default path for default file var filepath = flag.String("filepath", "./names.json", "The path to the file with the names") var shouldNameBeRemoved = flag.Bool("remove", true, "if true the name will be removed from li...
Add method to return next name
Add method to return next name
Go
mit
rotespferd/name-generator
2aeed84fcb825e9e0db0219e282b5addfcfaf27c
flect/kinds.go
flect/kinds.go
package flect import "reflect" func IsSlice(i interface{}) bool { return IsA(i, reflect.Slice) } func IsA(i interface{}, kind reflect.Kind) bool { return reflect.TypeOf(i).Kind() == kind } func NotA(i interface{}, kind reflect.Kind) bool { return !IsA(i, kind) }
package flect import "reflect" func IsSlice(i interface{}) bool { return IsA(i, reflect.Slice) } func IsA(i interface{}, kind reflect.Kind) bool { if i == nil { return false } return reflect.TypeOf(i).Kind() == kind } func NotA(i interface{}, kind reflect.Kind) bool { return !IsA(i, kind) }
Fix TypeOf check on nil interface
Fix TypeOf check on nil interface
Go
apache-2.0
eyecuelab/kit
4e746575bb94c6347febb0c176e6f0dfdbde2dd4
alg/transition/featurereader.go
alg/transition/featurereader.go
package transition import ( "io/ioutil" "launchpad.net/goyaml" // "log" ) type FeatureGroup struct { Group string Transition string Features []string Idle bool Associated bool } type MorphTemplate struct { Group string Combinations []string } type FeatureSetup struct { FeatureGroups ...
package transition import ( "io/ioutil" "gopkg.in/yaml.v2" // "log" ) type FeatureGroup struct { Group string Transition string Features []string Idle bool Associated bool } type MorphTemplate struct { Group string Combinations []string } type FeatureSetup struct { FeatureGroups []Fe...
Update goyaml dependency to new location
Update goyaml dependency to new location
Go
apache-2.0
habeanf/yap,habeanf/yap
289317f7082e35f2103d70449a3dd4db6861a5a1
2deploy.go
2deploy.go
package main import ( "log" "fmt" "os" "path" "github.com/docker/libcompose/config" "github.com/docker/libcompose/project" ) func main() { pwd, err := os.Getwd() if err != nil { fmt.Println(err) os.Exit(1) } _, dir := path.Split(pwd) project := project.New...
package main import ( "log" "fmt" "os" "path" "github.com/docker/libcompose/config" "github.com/docker/libcompose/project" ) func main() { // # Get stack name from --name // # Get stack name from directory if not passed pwd, err := os.Getwd() if err != nil { fmt.Println...
Define general workflow, detailed Network logic
Define general workflow, detailed Network logic
Go
apache-2.0
adrahon/deploy-compose
82075d1868bd82c9ccf81af20c221b2b00df0467
common/buf/readv_constraint_windows.go
common/buf/readv_constraint_windows.go
// +build windows package buf import ( "syscall" ) func checkReadVConstraint(conn syscall.RawConn) (bool, error) { var isSocketReady = false var reason error /* In Windows, WSARecv system call only support socket connection. It it required to check if the given fd is of a socket type Fix https://github...
// +build windows package buf import ( "syscall" ) func checkReadVConstraint(conn syscall.RawConn) (bool, error) { var isSocketReady = false var reason error /* In Windows, WSARecv system call only support socket connection. It it required to check if the given fd is of a socket type Fix https://github.co...
Fix test break for windows: better error handling
Fix test break for windows: better error handling
Go
mit
panzer13/v2ray-core,v2ray/v2ray-core,panzer13/v2ray-core,v2ray/v2ray-core
82116cc68f18a7d4cb2850fb9ac7143a2a77e637
example/ask.go
example/ask.go
package main import ( "log" "os" "github.com/tcnksm/go-input" ) func main() { ui := &input.UI{ Writer: os.Stdout, Reader: os.Stdin, } query := "What is your name?" ans, err := ui.Ask(query, &input.Options{ Default: "tcnksm", }) if err != nil { log.Fatal(err) } log.Printf("Answer is %s\n", ans) }...
package main import ( "log" "os" "github.com/tcnksm/go-input" ) func main() { ui := &input.UI{ Writer: os.Stdout, Reader: os.Stdin, } query := "What is your name?" ans, err := ui.Ask(query, &input.Options{ // Read the default val from env var Default: os.Getenv("NAME"), }) if err != nil { log.Fat...
Read default val from env var
Read default val from env var
Go
mit
tcnksm/go-input,OneCloudInc/go-input
0225a379518fa292d5808fe1ef31947d0ce30577
execdriver/lxc/info.go
execdriver/lxc/info.go
package lxc import ( "bufio" "errors" "strconv" "strings" ) var ( ErrCannotParse = errors.New("cannot parse raw input") ) type lxcInfo struct { Running bool Pid int } func parseLxcInfo(raw string) (*lxcInfo, error) { if raw == "" { return nil, ErrCannotParse } var ( err error s = bufio.NewSc...
package lxc import ( "bufio" "errors" "strconv" "strings" ) var ( ErrCannotParse = errors.New("cannot parse raw input") ) type lxcInfo struct { Running bool Pid int } func parseLxcInfo(raw string) (*lxcInfo, error) { if raw == "" { return nil, ErrCannotParse } var ( err error s = bufio.NewSc...
Update parseLxcInfo to comply with new lxc1.0 format
Update parseLxcInfo to comply with new lxc1.0 format Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Go
apache-2.0
tutumcloud/docker,tutumcloud/docker,tutumcloud/docker,tutumcloud/docker
c72cdae5d6ad3b70b627fcd1d54c9590763a698a
column/column.go
column/column.go
package column type Column interface { Len() uint Append(row interface{}) error At(index uint) (value interface{}, exists bool) }
package column type Column interface { Len() uint Append(row interface{}) error At(index uint) (value interface{}, exists bool) String() string }
Add missing String() method in interface
Add missing String() method in interface
Go
mit
hgfischer/textable
6019eea9f23cd8a2f02cae134cd95f0ea65963b7
models/gopher.go
models/gopher.go
package models type Direction int const ( North Direction = 1 << iota South East West ) type Coordinate struct { X, Y int } type Gopher struct { // Current direction Direction Direction X, Y int Path []Coordinate Score int }
package models type Direction int const ( North Direction = 1 << iota South East West ) type Coordinate struct { X, Y int } type Gopher struct { // Current direction Direction Direction X, Y int Path []Coordinate Score int Paths chan map[int][]Coordinate Close chan struct{} } func...
Add NewGopher(), Paths and Close channels
Add NewGopher(), Paths and Close channels
Go
mit
gophergala2016/gophertron,gophergala2016/gophertron,gophergala2016/gophertron
a7c6c39200782ea2e1a1b005d56e3edd51e761a7
gateway/queue/types.go
gateway/queue/types.go
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. package queue import "net/url" import "net/http" // Request for asynchronous processing type Request struct { Header http.Header Host string Body...
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. package queue import ( "net/http" "net/url" ) // Request for asynchronous processing type Request struct { // Header from HTTP request Header http.Header ...
Add QueueName to async requests
Add QueueName to async requests The queue's name will be consumed by the queue worker to publish to other topics / slow queues. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <5f7133baa0f5c7ca63ff11e11f2e2b0d2cf077c8@gmail.com>
Go
mit
alexellis/faas,alexellis/faas,alexellis/faas,openfaas/faas,openfaas/faas,alexellis/faas,openfaas/faas,alexellis/faas,alexellis/faas,alexellis/faas,alexellis/faas,alexellis/faas
67c05a5d7585e9bed136e9b09a3bffe6a69f48fb
ouitools_test.go
ouitools_test.go
// Package go-oui provides functions to work with MAC and OUI's package ouidb import ( "fmt" "log" "testing" ) func Test(*testing.T) { d := &OuiDb{} err := d.Load("oui.txt") if err != nil { log.Fatal("Error %v", err) } address, _ := ParseMAC("60:03:08:a0:ec:a6") block := d.Lookup(address) fmt.Println("...
// Package go-oui provides functions to work with MAC and OUI's package ouidb import ( "fmt" "testing" ) var db OuiDb func init() { db = OuiDb{} err := db.Load("oui.txt") if err != nil { panic(err.Error()) } } func lookup(t *testing.T, mac, org string) { address, err := ParseMAC(mac) if err != nil { t.F...
Refactor tests to use testing package errors
Refactor tests to use testing package errors Signed-off-by: Claudio Matsuoka <ef7f691d9947ca9adbfeb1538a53a661ec9f041b@gmail.com>
Go
mit
cmatsuoka/ouidb,dutchcoders/go-ouitools
f9784b202625b37312b0f10a869b73bf049e71f6
api/middleware_auth.go
api/middleware_auth.go
package api import ( "net/http" "github.com/gin-gonic/gin" ) func (api *API) TokenAuth() gin.HandlerFunc { return func(c *gin.Context) { if api.token != c.Request.Header.Get("token") { c.AbortWithStatus(http.StatusUnauthorized) return } } }
package api import ( "net/http" "github.com/gin-gonic/gin" ) func (api *API) TokenAuth() gin.HandlerFunc { return func(c *gin.Context) { if api.token != c.Request.Header.Get("Authorization") { c.AbortWithStatus(http.StatusUnauthorized) return } } }
Rename auth header to Authorization
Rename auth header to Authorization
Go
mit
nimona/go-nimona,nimona/go-nimona,nimona/go-nimona,nimona/go-nimona
87fec6c5abba85df8be26a846af77eb31506ccb5
router/notFoundHandler.go
router/notFoundHandler.go
package router import ( "html/template" "net/http" "github.com/gorilla/mux" ) var notFoundTemplate = template.Must(template.New("NotFound").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/404.html")) func init() { // common template.Must(notFoundTemplate.ParseGlob("templates/_*.html")) } func Not...
package router import ( "html/template" "net/http" "github.com/gorilla/mux" ) var notFoundTemplate = template.Must(template.New("NotFound").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/404.html")) func init() { // common template.Must(notFoundTemplate.ParseGlob("templates/_*.html")) } func Not...
Return status code 404 on 404 page
Return status code 404 on 404 page The NotFoundHandler previously returned status code 200 because WriteHeader wasn't called.
Go
mit
NyaaPantsu/nyaa,ipatrol/nyaa,ipatrol/nyaa,ElegantMonkey/nyaa,majestrate/nyaa,steindornatorinn/nyaa,yueou/nyaa,NyaaPantsu/nyaa,ipatrol/nyaa,ElegantMonkey/nyaa,kipukun/nyaa,steindornatorinn/nyaa,majestrate/nyaa,steindornatorinn/nyaa,Nutjob/nyaa,moose65468/nyaa,yueou/nyaa,ElegantMonkey/nyaa,yueou/nyaa,ipatrol/nyaa,kipukun...
8557ea26fef3ebfe206775b47fc9f86f8776a943
datastore/mocks/Context.go
datastore/mocks/Context.go
// Copyright 2016 The Serviced Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
// Copyright 2016 The Serviced Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
Add Metrics() to the mock
Add Metrics() to the mock
Go
apache-2.0
control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced,control-center/serviced
c179e9583f01fcd3d204ea588c0da3ce59eeff93
monitor/statusstore.go
monitor/statusstore.go
package monitor import "time" // StatusStore is an interface of storage of availability statuses. // Standart implementation of this interface (RedisStore) uses Redis as backend, // but some user may reimplement interface to store data in a RDB or in memory. type StatusStore interface { GetStatus(t Target) (Status, ...
package monitor import ( "time" "github.com/pkg/errors" ) // StatusStore is an interface of storage of availability statuses. // Standart implementation of this interface (RedisStore) uses Redis as backend, // but some user may reimplement interface to store data in a RDB or in memory. type StatusStore interface {...
Implement SimpleStore - slice-based StatusStore
:hammer: Implement SimpleStore - slice-based StatusStore
Go
mit
yamnikov-oleg/avamon-bot,yamnikov-oleg/avamon-bot
2f0b92274bac779147883f9052ffba27462194da
models/node_session.go
models/node_session.go
package models import "github.com/brocaar/lorawan" // NodeSession contains the informatio of a node-session (an activated node). type NodeSession struct { DevAddr lorawan.DevAddr `json:"devAddr"` AppEUI lorawan.EUI64 `json:"appEUI"` DevEUI lorawan.EUI64 `json:"devEUI"` AppSKey lorawan.AES128Key `j...
package models import "github.com/brocaar/lorawan" // NodeSession contains the informatio of a node-session (an activated node). type NodeSession struct { DevAddr lorawan.DevAddr `json:"devAddr"` AppEUI lorawan.EUI64 `json:"appEUI"` DevEUI lorawan.EUI64 `json:"devEUI"` AppSKey lorawan.AES128Key `j...
Use type instead of uint8.
Use type instead of uint8.
Go
mit
brocaar/loraserver,brocaar/loraserver,ymkins/brocaar-loraserver,ymkins/brocaar-loraserver
a43cd10bdaf04c43df44f8e77753775ff8749661
stravade/db.go
stravade/db.go
package main import ( "database/sql" _ "github.com/mattn/go-sqlite3" ) const TRACKSQL = ` select time, latitude, longitude, elevation, heartrate, cadence from points where track = ? order by time ` // TODO: Possible to hint at how many tracks are coming? func GetTrackpoints(db *sql.DB, id int) ([]Trkpt, error...
package main import ( "database/sql" _ "github.com/mattn/go-sqlite3" ) const TRACKSQL = ` select time, latitude, longitude, elevation, heartrate, cadence from trackpoints where track = ? order by time ` // TODO: Possible to hint at how many tracks are coming? func GetTrackpoints(db *sql.DB, id int) ([]Trkpt, ...
Fix broken scanning in stravade
Fix broken scanning in stravade
Go
bsd-2-clause
arsatiki/gpsport260tool
8de85d2f144a4e56b05233b97efaf246224b9179
gopherjs_only.go
gopherjs_only.go
//+build !js package vecty func init() { panic("vecty: only GopherJS compiler is supported") }
// +build !js package vecty func init() { panic("vecty: only GopherJS compiler is supported") }
Use canonical format for build constraint.
Use canonical format for build constraint. This improves consistency. See https://godoc.org/go/build#hdr-Build_Constraints for definition of a build constraint: > A build constraint, also known as a build tag, is a line comment that begins > > // +build
Go
bsd-3-clause
gopherjs/vecty
e77590f914a430618ce2f61dc5f1627ce3a2612f
cmd/user/internal/domain/user/models.go
cmd/user/internal/domain/user/models.go
package user import ( "encoding/json" "github.com/asaskevich/govalidator" "github.com/vardius/go-api-boilerplate/internal/errors" ) // EmailAddress is an email address value object type EmailAddress string // UnmarshalJSON implements Unmarshal interface func (e *EmailAddress) UnmarshalJSON(b []byte) error { var...
package user import ( "encoding/json" "github.com/asaskevich/govalidator" "github.com/vardius/go-api-boilerplate/internal/errors" ) // EmailAddress is an email address value object type EmailAddress string // UnmarshalJSON implements Unmarshal interface func (e *EmailAddress) UnmarshalJSON(b []byte) error { var...
Fix email address UnmarshalJSON method
Fix email address UnmarshalJSON method
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
008ccaf4f5ea94e1ee3a17419ad209b883d55fdd
dgc/dgc.go
dgc/dgc.go
package main import ( "fmt" "os" "os/exec" "github.com/codegangsta/cli" ) func runDgc(c *cli.Context) { fmt.println("Hello Test") } func main() { app := cli.NewApp() dgc.Name = "dgc" dgc.Usage = "A minimal docker garbage collector" dgc.Version = "0.1.0" dgc.Author = "David J Felix <davidjfelix@davidjfelix....
package main import ( "fmt" "os" "os/exec" "github.com/codegangsta/cli" ) func runDgc(c *cli.Context) { fmt.println("Hello Test") } func main() { app := cli.NewApp() dgc.Name = "dgc" dgc.Usage = "A minimal docker garbage collector" dgc.Version = "0.1.0" dgc.Author = "David J Felix <davidjfelix@davidjfelix....
Create command line args to simulate old script
Create command line args to simulate old script
Go
mit
hatchery/dgc
4e480c1e9e657018ba3c8d6d7c85b9cdea7c7aca
useful/pathwd.go
useful/pathwd.go
package useful import ( "fmt" "os" "runtime" ) // GetPwd1 return .go file path, where func really is // // Useful only with .go file // With binary file always return path of source .go file func GetPwd1() string { _, pwd, _, ok := runtime.Caller(0) if !ok { panic("No caller information") } return pwd } // ...
package useful import ( "fmt" "os" "runtime" ) // GetPwd1 return .go file path, where func really is // // Useful only with .go file // With binary file always return path of source .go file func GetPwd1() string { _, pwd, _, ok := runtime.Caller(0) if !ok { panic("No caller information") } return pwd } // ...
Add additional comments to command for clarity
Add additional comments to command for clarity
Go
mit
dematron/go-useful
983bc728fa719b4827bfdbbcec41ff76a85b499f
emitter.go
emitter.go
package main import ( "io" "time" ) func Start(stop chan int) { for _, in := range Plugins.Inputs { go CopyMulty(in, Plugins.Outputs...) } for { select { case <-stop: return case <-time.After(1 * time.Second): } } } // Copy from 1 reader to multiple writers func CopyMulty(src io.Reader, writers ....
package main import ( "io" "time" ) func Start(stop chan int) { for _, in := range Plugins.Inputs { go CopyMulty(in, Plugins.Outputs...) } for { select { case <-stop: return case <-time.After(1 * time.Second): } } } // Copy from 1 reader to multiple writers func CopyMulty(src io.Reader, writers ....
Increase buffer to 5 megabytes
Increase buffer to 5 megabytes
Go
apache-2.0
bunnyblue/gor,MenZil/gor,on99/gor,wxdublin/gor,jmptrader/gor,no2key/gor,jakubholynet/gor,davidwalter0/gor,treejames/gor-1,dt/gor,wfxiang08/gor,cregev/gor,torfuzx/gor,daodaoliang/gor,insionng/gor,Sk464036801/gor,jasonchaffee/gor,ironsmile/gor,dshamaeli/gor,chinanjjohn2012/gor,chengky/gor,cemkoc/gor,chenwenbin928/gor-1,r...
44e8e8616c88984ae4448c76e0bdcaed0305d91f
doc.go
doc.go
/* Package spreed-turnservicecli is providing sub packages to interact with the Spreed.ME TURN service. It contains the following packages: The `turnservicecli` package provides a client implementation for the TURN service api's endpoints. */ package spreedturnservicecli import ( _ "github.com/strukturag/spreed-tur...
/* Package spreed-turnservicecli is providing sub packages to interact with the Spreed TURN service. It contains the following packages: The `turnservicecli` package provides a client implementation for the TURN service api's endpoints. */ package spreedturnservicecli import ( _ "github.com/strukturag/spreed-turnse...
Call the service Spreed TURN service
Call the service Spreed TURN service
Go
agpl-3.0
strukturag/spreed-turnservicecli
57c069b14e0a8e4a88c872395a0fce26127402de
presentation/router/router.go
presentation/router/router.go
package router import ( "github.com/labstack/echo" "github.com/labstack/echo/middleware" "github.com/photoshelf/photoshelf-storage/infrastructure/container" "github.com/photoshelf/photoshelf-storage/presentation/controller" ) func Load() (*echo.Echo, error) { e := echo.New() photoController := controller.New()...
package router import ( "github.com/labstack/echo" "github.com/labstack/echo/middleware" "github.com/photoshelf/photoshelf-storage/infrastructure/container" "github.com/photoshelf/photoshelf-storage/presentation/controller" ) func Load() (*echo.Echo, error) { e := echo.New() photoController := controller.New()...
Add middleware for body limit
Add middleware for body limit
Go
mit
photoshelf/photoshelf-storage
a639e78ce515ad5ca74909eea628ad772b7e3cd1
pkg/request/client_mock.go
pkg/request/client_mock.go
package request type MockClient struct { Client Method chan string URL chan []string Parameters chan []Parameter OutResponse *Response OutError error } func NewMockExecutor(r *Response, err error) *MockExecutor { return &MockExecutor{ Method: make(chan string, 1), URL: make(chan ...
package request type MockClient struct { Client Method chan string URL chan string Parameters chan []Parameter OutResponse chan *Response OutError error } func NewMockClient(l int) *MockClient { return &MockClient{ Method: make(chan string, 1), URL: make(chan string, 1), Parame...
Add output channel to mock request.client
Add output channel to mock request.client
Go
apache-2.0
tmrts/flamingo,maxamillion/flamingo,tmrts/flamingo,maxamillion/flamingo
04012f64520bf23a9325c09ba5dc66dc4fdea426
certifications_test.go
certifications_test.go
package tmdb import ( . "gopkg.in/check.v1" ) func (s *TmdbSuite) TestGetCertificationsMovieList(c *C) { movieResult, err := s.tmdb.GetCertificationsMovieList() s.baseTest(&movieResult, err, c) usMovieCerts := movieResult.Certifications["US"] usMovieCertsOpts := "NR|G|PG|PG-13|R|NC-17" for _, movieCert := range...
package tmdb import ( . "gopkg.in/check.v1" ) func (s *TmdbSuite) TestGetCertificationsMovieList(c *C) { movieResult, err := s.tmdb.GetCertificationsMovieList() s.baseTest(&movieResult, err, c) usMovieCerts := movieResult.Certifications["US"] c.Assert(usMovieCerts, NotNil) // usMovieCertsOpts := "NR|G|PG|PG-13|...
Disable detailed certifications tests until bug fix
Disable detailed certifications tests until bug fix Movies and TV certifications are randomly returned for each other See #1
Go
mit
ryanbradynd05/go-tmdb,ryanbradynd05/go-tmdb,ryanbradynd05/go-tmdb
1abbb149be0e99525ee766c86d76120c4b40caaa
tweet.go
tweet.go
package anaconda type Tweet struct { Source string Id int64 Retweeted bool Favorited bool //User TwitterUser Truncated bool Text string Retweet_count int64 Id_str string Created_at string Entities TwitterEntities }
package anaconda type Tweet struct { Source string Id int64 Retweeted bool Favorited bool User TwitterUser Truncated bool Text string Retweet_count int64 Id_str string Created_at string Entities TwitterEntities }
Include User field (TwitterUser) in Tweet struct
Include User field (TwitterUser) in Tweet struct
Go
mit
rfsbraz/anaconda,amit-lulla/twitterapi,Fe4nn0r/anaconda,aatishnn/anaconda,ifross89/anaconda,140proof/anaconda,jeffk/anaconda,intfrr/anaconda,cgag/anaconda,josephyzhou/anaconda,rendon/anaconda,jmptrader/anaconda,azr/anaconda,logashoff/anaconda
01847f69b11049fc500684016ee5074caa4c4da0
src/storage_node/metadata/field_type_internal.go
src/storage_node/metadata/field_type_internal.go
package metadata func listInternalFieldTypes() []*FieldType { return []*FieldType{ &FieldType{ Name: "_bool", DatamanType: Bool, }, &FieldType{ Name: "_datetime", DatamanType: DateTime, }, &FieldType{ Name: "_document", DatamanType: Document, }, &FieldType{ Name...
package metadata func listInternalFieldTypes() []*FieldType { return []*FieldType{ &FieldType{ Name: "_bool", DatamanType: Bool, }, &FieldType{ Name: "_datetime", DatamanType: DateTime, }, &FieldType{ Name: "_document", DatamanType: Document, }, &FieldType{ Name...
Add example type with constraint
Add example type with constraint
Go
mit
jacksontj/dataman
7b7522dc3423763b0127c7fac0689c8439d77405
conv/conversion_test.go
conv/conversion_test.go
package conv import ( "testing" "github.com/stretchr/testify/assert" ) func TestFleat64ToString(t *testing.T) { fs := []float64{1.2, -12, 4.14, 9.72, 6.666666} transformable := Float64Slice(fs) strs := transformable.String('f', 2) assert.NotNil(t, strs) assert.Len(t, strs, len(fs)) assert.Equal(t, "1.20", st...
package conv import ( "testing" "github.com/stretchr/testify/assert" ) // TestFleat64ToString tests the conversion of float slice to string slice. func TestFleat64ToString(t *testing.T) { fs := []float64{1.2, -12, 4.14, 9.72, 6.666666} transformable := Float64Slice(fs) strs := transformable.String('f', 2) asse...
Add doc to test in conv package
Add doc to test in conv package
Go
mit
bpicode/fritzctl,bpicode/fritzctl
173a41dd536bf2d7cac4126950c698c590f1f3fd
drivers/virtualbox/vtx_intel.go
drivers/virtualbox/vtx_intel.go
// +build 386 amd64 package virtualbox import "github.com/intel-go/cpuid" // IsVTXDisabled checks if VT-x is disabled in the CPU. func (d *Driver) IsVTXDisabled() bool { if cpuid.HasFeature(cpuid.VMX) || cpuid.HasFeature(cpuid.SVM) { return false } return true }
// +build 386 amd64 package virtualbox import "github.com/intel-go/cpuid" // IsVTXDisabled checks if VT-x is disabled in the CPU. func (d *Driver) IsVTXDisabled() bool { if cpuid.HasFeature(cpuid.VMX) || cpuid.HasExtraFeature(cpuid.SVM) { return false } return true }
Fix broken IsVTXDisabled detection on AMD CPU
Fix broken IsVTXDisabled detection on AMD CPU VMX is in FeatureNames, but SVM is in ExtraFeatureNames This meant that detection *always* failed for SVM (AMD) Thanks to user @hilbertxia Signed-off-by: Anders F Björklund <c6169fcaa665ed956024051b5047d142d4ac3fe5@gmail.com>
Go
apache-2.0
dweomer/docker-machine,docker/machine,dweomer/docker-machine,docker/machine
34d99ff2c2406eb420be2727f0045f0b673a7df6
backoff_test.go
backoff_test.go
package grpc import ( "testing" "math/rand" "time" ) func TestBackoffConfigDefaults(t *testing.T) { b := BackoffConfig{} setDefaults(&b) if b != DefaultBackoffConfig { t.Fatalf("expected BackoffConfig to pickup default parameters: %v != %v", b, DefaultBackoffConfig) } } func TestBackoffWitDifferentNumberOf...
package grpc import "testing" func TestBackoffConfigDefaults(t *testing.T) { b := BackoffConfig{} setDefaults(&b) if b != DefaultBackoffConfig { t.Fatalf("expected BackoffConfig to pickup default parameters: %v != %v", b, DefaultBackoffConfig) } }
Revert "added two new testcases for backoff.go"
Revert "added two new testcases for backoff.go"
Go
bsd-3-clause
mpl/grpc-go,thinkerou/grpc-go,rakyll/grpc-go,menghanl/grpc-go,fuchsia-mirror/third_party-grpc-grpc-go,rakyll/grpc-go,stanley-cheung/grpc-go,dsymonds/grpc-go,bradfitz/grpc-go,dfawley/grpc-go,improbable-io/grpc-go,dsymonds/grpc-go,andreimatei/grpc-go,fuchsia-mirror/third_party-grpc-grpc-go,thinkerou/grpc-go,MakMukhi/grpc...
029ba91b90dd6971e9c9ff5eca53f537218d709f
nvd-cli.go
nvd-cli.go
package main import ( "fmt" "github.com/docopt/docopt-go" ) func main() { usage := `Usage: nvd-search [-c CVE | -k KEY] [-v VENDOR] [-p PRODUCT] [-n NVD] Options: -h --help show this -c CVE --cve CVE CVE-ID of the vulnerability [default: ] -k KEY --key KEY keyw...
package main import ( "log" "github.com/docopt/docopt-go" "github.com/mitchellh/go-homedir" ) func main() { usage := `Usage: nvd-search [-c CVE | -k KEY] [-v VENDOR] [-p PRODUCT] [-n NVD] Options: -h --help show this -c CVE --cve CVE CVE-ID of the vulnerability [default: ] ...
Clean the local NVD dir using homedir.Expand
Clean the local NVD dir using homedir.Expand
Go
mit
okuuva/nvd-search-cli
28748acc82edfc70a5db8d3727496508dafbe82c
cmds/core/cpio/testdata/dir-hard-link.go
cmds/core/cpio/testdata/dir-hard-link.go
// Copyright 2020 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. // +build ignore // This program was used to generate dir-hard-link.cpio, which is // an archive containing two directories with the same inode (0). // Depe...
// Copyright 2020 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. // This program was used to generate dir-hard-link.cpio, which is // an archive containing two directories with the same inode (0). // Depending on how the c...
Remove "+build ignore" from test command
Remove "+build ignore" from test command We want to make sure the command still builds in the CI. Signed-off-by: Ryan O'Leary <32139beaa9c574695821e85473b09a4e33316467@google.com>
Go
bsd-3-clause
u-root/u-root,u-root/u-root,u-root/u-root
561b98067f90326cc3c1d73cab6836a2e50728cd
opts/ip.go
opts/ip.go
package opts import ( "fmt" "net" ) type IpOpt struct { *net.IP } func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt { o := &IpOpt{ IP: ref, } o.Set(defaultVal) return o } func (o *IpOpt) Set(val string) error { ip := net.ParseIP(val) if ip == nil { return fmt.Errorf("incorrect IP format") } (*o.IP...
package opts import ( "fmt" "net" ) type IpOpt struct { *net.IP } func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt { o := &IpOpt{ IP: ref, } o.Set(defaultVal) return o } func (o *IpOpt) Set(val string) error { ip := net.ParseIP(val) if ip == nil { return fmt.Errorf("%s is not an ip address", val) ...
Fix inconsistency in IP address parsing errors
Fix inconsistency in IP address parsing errors Signed-off-by: Solomon Hykes <510d74b69d9d43b60b6f6aa9d95e9f9c9497f815@docker.com>
Go
apache-2.0
riyazdf/cli,cpuguy83/cli,thaJeztah/cli,ashfall/cli,cpuguy83/cli,Zebrilee/cli,docker/cli,e11137/cli,dnephin/cli,dnephin/cli,ashfall/cli,riyazdf/cli,e11137/cli,redpanda/cli,thaJeztah/cli,allencloud/cli,Zebrilee/cli,allencloud/cli,docker/cli,redpanda/cli
493ec859891f2c96d429312ce5cbe39e8faa7846
api_test.go
api_test.go
package api_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "../go-webservice" "net/http" "net/http/httptest" ) var _ = Describe("Web", func() { var ( page *Page ) BeforeEach(func() { page = &Page{Title: "foo", Body: []byte("Example body")} page.Save() }) D...
package api_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "../go-webservice" "net/http" "net/http/httptest" ) var _ = Describe("Web", func() { var ( page *Page ) BeforeEach(func() { page = &Page{Title: "foo", Body: []byte("Example body")} page.Save() }) D...
Update contexts to be correct for test.
Update contexts to be correct for test.
Go
mit
glenngillen/go-webservice
583f7f7dd73d76217c5bb72ac22ef30430d58911
pkg/defaults/defaults_suite_test.go
pkg/defaults/defaults_suite_test.go
package defaults_test import ( "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func TestDefaults(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Defaults Suite") }
package defaults import ( "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func TestDefaults(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Defaults Suite") }
Switch pkg/defaults to whitebox testing
Switch pkg/defaults to whitebox testing Ginkgo encourages blackbox testing, which means tests live in a separate package from the implementation. It generates test files with a package name that adds a `_test` suffix. pkg/defaults uses whitebox testing, allowing the tests to live in the same package. Unfortunately, t...
Go
apache-2.0
grpc/test-infra,grpc/test-infra
c447a86b2209052fb8b71cfc4555097d6f595f40
cmd/slave/main.go
cmd/slave/main.go
package main import ( "log" flag "github.com/ogier/pflag" "github.com/aaronang/cong-the-ripper/lib/slave" ) func main() { log.Println("slave starting...") portPtr := flag.String("port", "8080", "Web server port") masterIpPtr := flag.String("master-ip", "localhost", "Ip address of the master") masterPortPtr :...
package main import ( "log" "github.com/aaronang/cong-the-ripper/lib/slave" flag "github.com/ogier/pflag" ) func main() { log.Println("slave starting...") port := flag.String("port", "8080", "Web server port") masterIP := flag.String("master-ip", "localhost", "Ip address of the master") masterPort := flag.Str...
Remove Ptr from the variable names
Remove Ptr from the variable names
Go
mit
aaronang/cong-the-ripper,aaronang/cong-the-ripper
4026e82322e45b8de5afa6f4d491ed1200d0846f
elf/perf_unsupported.go
elf/perf_unsupported.go
// +build !linux package elf import "fmt" type PerfMap struct{} func InitPerfMap(b *Module, mapName string, receiverChan chan []byte) (*PerfMap, error) { return nil, fmt.Errorf("not supported") } func (pm *PerfMap) PollStart() {} func (pm *PerfMap) PollStop() {}
// +build !linux package elf import "fmt" type PerfMap struct{} func InitPerfMap(b *Module, mapName string, receiverChan chan []byte) (*PerfMap, error) { return nil, fmt.Errorf("not supported") } func (pm *PerfMap) SetTimestampFunc(timestamp func(*[]byte) uint64) {} func (pm *PerfMap) PollStart() {} func (pm *P...
Add dummy SetTimestampFunc for unsupported systems
Add dummy SetTimestampFunc for unsupported systems
Go
apache-2.0
louism517/gobpf,louism517/gobpf,louism517/gobpf
a27a91a9d151c339b9c81bebbc5af74cc5b05aa0
siren/ntp.go
siren/ntp.go
package siren import ( "fmt" "os" "os/exec" "strconv" "strings" ) func NTP(w, f int) Status { out, err := exec.Command("ntpq", "-c", "rv 0 offset").Output() if err != nil { fmt.Fprintf(os.Stdout, "\n%s: unable to determine NTP drift. %s\n", warn, err) return warn } // Output: offset=72.062 floatStr := ...
package siren import ( "fmt" "math" "os" "os/exec" "strconv" "strings" ) func NTP(w, f int) Status { out, err := exec.Command("ntpq", "-c", "rv 0 offset").Output() if err != nil { fmt.Fprintf(os.Stdout, "\n%s: unable to determine NTP drift. %s\n", warn, err) return warn } // Output: offset=72.062 floa...
Use absolute value for NTP drift
Use absolute value for NTP drift
Go
mit
cotap/siren
6968c88743d5c7ff863c5a944ddf773da0a9dc43
types/search_result.go
types/search_result.go
package types import ( "encoding/json" ) type SearchResult struct { Collection json.RawMessage Documents json.RawMessage Total int Fetched int Aggregations json.RawMessage Options QueryOptions Filters *SearchFilters } //NewSearchResult Search Result constructor func NewSearchResult...
package types import ( "encoding/json" ) type SearchResult struct { Collection json.RawMessage Documents json.RawMessage Total int Fetched int Aggregations json.RawMessage Options QueryOptions Filters *SearchFilters } //NewSearchResult Search Result constructor func NewSearchResult...
Apply From & Size requested changes from scottinet
Apply From & Size requested changes from scottinet
Go
apache-2.0
kuzzleio/sdk-go,kuzzleio/sdk-go
1891e2bbff1edeec391fee46918b58b374d48c7e
sd_test.go
sd_test.go
package winio import "testing" func TestLookupInvalidSid(t *testing.T) { _, err := LookupSidByName(".\\weoifjdsklfj") aerr, ok := err.(*AccountLookupError) if !ok || aerr.Err != cERROR_NONE_MAPPED { t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err) } } func TestLookupValidSid(t *testi...
package winio import "testing" func TestLookupInvalidSid(t *testing.T) { _, err := LookupSidByName(".\\weoifjdsklfj") aerr, ok := err.(*AccountLookupError) if !ok || aerr.Err != cERROR_NONE_MAPPED { t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err) } } func TestLookupValidSid(t *testi...
Call Fatalf to use the format specifier
Call Fatalf to use the format specifier Signed-off-by: John Stephens <7eec02f6af4e6b1fb20edca992e35ddef4347d3d@docker.com>
Go
mit
microsoft/go-winio,Microsoft/go-winio
3130bfe9d25027c43d2a90dee7a3f0180cd3258f
cmd/root.go
cmd/root.go
package cmd import ( "fmt" "os" "github.com/spf13/cobra" ) // RootCmd define root command var RootCmd = &cobra.Command{ Use: "s3-edit", Short: "Edit directly a file on Amazon S3", Long: "Edit directly a file on Amazon S3", Run: func(cmd *cobra.Command, args []string) { if isShowVersion { ShowVersion()...
package cmd import ( "fmt" "os" "github.com/spf13/cobra" ) // RootCmd define root command var RootCmd = &cobra.Command{ Use: "s3-edit", Short: "Edit directly a file on Amazon S3", Long: "Edit directly a file on Amazon S3", Run: func(cmd *cobra.Command, args []string) { if isShowVersion { ShowVersion()...
Set profile "default" as a default
Set profile "default" as a default
Go
mit
tsub/s3-edit
0d3805555e09575831e89eee453af8dfce703b12
xstrings/chomp_test.go
xstrings/chomp_test.go
package xstrings import ( "github.com/wallclockbuilder/testify/assert" "testing" ) func TestChomp(t *testing.T) { assert := assert.New(t) assert.Equal("hello", Chomp("hello", "")) assert.Equal("hello", Chomp("hello\n", "")) assert.Equal("hello", Chomp("hello\r\n", "")) assert.Equal("hello\n", Chomp("hello\n\r"...
package xstrings import ( "fmt" "github.com/wallclockbuilder/testify/assert" "testing" ) func ExampleChomp() { fmt.Println(Chomp("hello", "llo")) fmt.Println(Chomp("hello\n", "")) fmt.Println(Chomp("hello\r\n", "")) // Output: he // hello // hello } func TestChomp(t *testing.T) { assert := assert.New(t) a...
Add examples to Chomp documentation.
Add examples to Chomp documentation.
Go
bsd-2-clause
wallclockbuilder/gstrings,wallclockbuilder/stringutil
afda151f08b4df562dd3c2b69e90bfa72cfa3d86
src/redoctober/passvault/passvault_test.go
src/redoctober/passvault/passvault_test.go
package passvault import ( "testing" ) var emptyKey = make([]byte, 16) var dummy = make([]byte, 16) func TestUsesFlush(t *testing.T) { singleUse := ActiveUser{ Admin: true, Expiry: nextYear, Uses: 1, key: emptyKey, } LiveKeys["first"] = singleUse FlushCache() if len(LiveKeys) != 1 { t.Fatalf("Error...
package passvault import ( "testing" ) func TestRSAEncryptDecrypt(t *testing.T) { myRec, err := createPasswordRec("mypasswordisweak", true) if err != nil { t.Fatalf("Error creating record") } _, err = myRec.GetKeyRSAPub() if err != nil { t.Fatalf("Error extracting RSA Pub") } rsaPriv, err := myRec.GetKe...
Add real test cases for passvault.
Add real test cases for passvault.
Go
bsd-2-clause
dullgiulio/redoctober,Bren2010/redoctober,ejcx/redoctober,dullgiulio/redoctober,Bren2010/redoctober,ejcx/redoctober
7e94266ebe91c55d88acdf9b8d33c0d9f235e6ee
static/static.go
static/static.go
//go:generate go-bindata -pkg ctstatic -ignore .../.DS_Store -o files.go files/... package ctstatic import ( "net/http" "os" "github.com/elazarl/go-bindata-assetfs" ) // all static/ files embedded as a Go library func FileSystemHandler() http.Handler { var h http.Handler if info, err := os.Stat("static/files/"...
//go:generate go-bindata -pkg ctstatic -ignore .../.DS_Store -o files.go files/... package ctstatic import ( "net/http" "os" "github.com/elazarl/go-bindata-assetfs" ) // all static/ files embedded as a Go library func FileSystemHandler() http.Handler { var h http.Handler if info, err := os.Stat("static/files/"...
Fix for update of go-bindata-assetfs
Fix for update of go-bindata-assetfs
Go
mit
suryadewa/ForNesiaToRrent,adiev13/cloud-torrent,adiev13/cloud-torrent,Mysecretid/mysecretid,FreeIDMZone/torrent-test,FreeIDMZone/torrent-test,jpillora/cloud-torrent,anmolmonga2009/toru,jpillora/cloud-torrent,Thenast/Harryhs,gamerstt/Actsg,Mysecretid/mysecretid,Mysecretid/mysecretid,adiev13/cloud-torrent,Mysecretid/Myse...
9678edd6e6dd2409b00bcd3c94fe710f0c28b1a0
commands/hide_pipeline.go
commands/hide_pipeline.go
package commands import ( "fmt" "github.com/concourse/fly/commands/internal/displayhelpers" "github.com/concourse/fly/commands/internal/flaghelpers" "github.com/concourse/fly/rc" ) type HidePipelineCommand struct { Pipeline flaghelpers.PipelineFlag `short:"p" long:"pipeline" required:"true" description:"Pipelin...
package commands import ( "fmt" "github.com/concourse/fly/commands/internal/displayhelpers" "github.com/concourse/fly/commands/internal/flaghelpers" "github.com/concourse/fly/rc" ) type HidePipelineCommand struct { Pipeline flaghelpers.PipelineFlag `short:"p" long:"pipeline" required:"true" description:"Pipelin...
Fix typo in 'hide-pipeline' description
Fix typo in 'hide-pipeline' description
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
4fa436fd05c49693a7679b0af0e394d71d5ed3f7
command/beeroclock.go
command/beeroclock.go
package command import ( "fmt" "time" ) const ( Beer = "\U0001f37a" ) func BeerOclock(query string) []string { hour := time.Now().Hour() var result string if hour >= 18 { result = fmt.Sprintf("YES! %s", Beer) } else { result = "Not yet. :(" } return []string{result} }
package command import ( "fmt" "regexp" "time" ) const ( Beer = "\U0001f37a" Clock = "\U000023f0" StartingHour = 18 ) var queryRegexp *regexp.Regexp func init() { queryRegexp = regexp.MustCompile(`(?i)time|long|til|left|remaining|eta`) } func BeerOclock(query string) []string { now := time.N...
Improve beer oclock with queries for time remaining.
Improve beer oclock with queries for time remaining.
Go
mit
caiofilipini/got
3c7163ef66daa946f960961aeff2f555d753d6e9
version.go
version.go
package sarama import "runtime/debug" var v string func version() string { if v == "" { bi, ok := debug.ReadBuildInfo() if ok { v = bi.Main.Version } else { // if we can't read a go module version then they're using a git // clone or vendored module so all we can do is report "dev" for // the vers...
package sarama import ( "runtime/debug" "sync" ) var ( v string vOnce sync.Once ) func version() string { vOnce.Do(func() { bi, ok := debug.ReadBuildInfo() if ok { v = bi.Main.Version } else { // if we can't read a go module version then they're using a git // clone or vendored module so all ...
Fix a potential data race on a global variable
Fix a potential data race on a global variable
Go
mit
Shopify/sarama,DataDog/sarama,Shopify/sarama,DataDog/sarama
4fa62767d3b5ea65e3ae211c1f6ba28cdcb0c7ea
fileinfo/fileinfo.go
fileinfo/fileinfo.go
/* rulehunter - A server to find rules in data based on user specified goals Copyright (C) 2016 vLife Systems Ltd <http://vlifesystems.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation,...
/* rulehunter - A server to find rules in data based on user specified goals Copyright (C) 2016 vLife Systems Ltd <http://vlifesystems.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation,...
Use Equal() to compare FileInfo time
Use Equal() to compare FileInfo time This is because on some systems it is necessary to accurately compare time.
Go
unknown
vlifesystems/rulehunter,vlifesystems/rulehunter,vlifesystems/rulehuntersrv,vlifesystems/rulehuntersrv
c8a46f504f90eb1f049025f531d046fa2631594d
vm/null.go
vm/null.go
package vm var ( nullClass *RNull // NULL represents Goby's null objects. NULL *NullObject ) // RNull is the built in class of Goby's null objects. type RNull struct { *BaseClass } // NullObject represnts the null value in Goby. type NullObject struct { Class *RNull } // toString returns the name of NullObject...
package vm var ( nullClass *RNull // NULL represents Goby's null objects. NULL *NullObject ) // RNull is the built in class of Goby's null objects. type RNull struct { *BaseClass } // NullObject (`nil`) represents the null value in Goby. // `nil` is convert into `null` when exported to JSON format. // Cannot per...
Add API doc to NullObject
Add API doc to NullObject
Go
mit
Maxwell-Alexius/goby,hachi8833/goby,Maxwell-Alexius/goby,Maxwell-Alexius/goby,goby-lang/goby,goby-lang/goby,goby-lang/goby,st0012/Rooby,hachi8833/goby,st0012/Rooby,hachi8833/goby
ed0a57ba99d9cdab0167e4df1851f8755fd5217d
insenced/insenced.go
insenced/insenced.go
package main import ( "flag" "github.com/anchor/picolog" "github.com/fractalcat/emogo" zmq "github.com/pebbe/zmq4" "os" ) var Logger *picolog.Logger func main() { listen := flag.String("listen", "tcp://*:9424", "ZMQ URI to listen on.") flag.Parse() Logger = picolog.NewLogger(picolog.LogDebug, "insenced", os....
package main import ( "flag" "fmt" "github.com/anchor/picolog" "github.com/fractalcat/emogo" zmq "github.com/pebbe/zmq4" "os" ) var Logger *picolog.Logger func readFrames(e *emogo.EmokitContext, out chan *emogo.EmokitFrame) { for { f, err := e.WaitGetFrame() if err != nil { fmt.Printf("error reading fr...
Read frames from EPOC and publish them over zmq
Read frames from EPOC and publish them over zmq
Go
bsd-3-clause
olorin/insensate,fractalcat/insensate
c60959a8ef9850b8425e31014f24c13d68cda50a
build_test.go
build_test.go
package static_test import ( "." "fmt" "net/http" ) func ExampleBuild() { handler := http.NewServeMux() paths := []string{} handler.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello %s!", r.URL.Path) }) paths = append(paths, "/") paths = append(paths, "/world") paths =...
package static_test import ( "." "fmt" "net/http" ) func ExampleBuild() { handler := http.NewServeMux() paths := []string{} handler.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello %s!", r.URL.Path) }) paths = append(paths, "/") paths = append(paths, "/world") paths =...
Add an example for BuildSingle.
Add an example for BuildSingle. What === Add an example for BuildSingle. Why === For go docs.
Go
mit
leighmcculloch/static
3ab496965a1ef36f4f6f0f682bf5f62916fd9e1f
lib/matrix/matrix.go
lib/matrix/matrix.go
package matrix import ( "os" ) func Invert(frame [][]float32) [][]float32 { } func ExtractChannel(frame [][]float32, channel int) []float32 { out := make([]float32, len(frame)) for i, v := range frame { } return out }
package matrix /** * Given a slice of samples, returns a slice of channels, or visa-versa */ func Invert(frame [][]float32) [][]float32 { out := make([][]float32, len(frame[0])) for i := range out { out[i] = make([]float32, len(frame)) } for i := range frame { for j := range frame[i] { out[j][i] = fram...
Complete drafts of Invert and ExtractChannel
Complete drafts of Invert and ExtractChannel
Go
mit
jesusaurus/afp,jesusaurus/afp,jesusaurus/afp,jesusaurus/afp
8075e54722f7603d4e7cf43b4925690516493ce2
lib/wavreader/chunker/chunker_test.go
lib/wavreader/chunker/chunker_test.go
package chunker import ( "testing" "bytes" "io" "io/ioutil" "time" ) func TestReadAll(t *testing.T) { n := 60 l := 1 buf := make([]byte, l*n) for i := 0; i < n; i++ { for j := 0; j < l; j++ { buf[l*i+j] = byte(i) } } t.Logf("Input bytes: (%d) %x", len(buf), buf) emb := time.Now().Add(-10 * time...
package chunker import ( "testing" "bytes" "io" "io/ioutil" "time" ) func TestReadAll(t *testing.T) { n := 60 l := 1 buf := make([]byte, l*n) for i := 0; i < n; i++ { for j := 0; j < l; j++ { buf[l*i+j] = byte(i) } } t.Logf("Input bytes: (%d) %x", len(buf), buf) emb := time.Now().Add(-10 * time...
Update test to reflect new reality
Update test to reflect new reality
Go
bsd-3-clause
thijzert/speeldoos
045c936958d45ce76820d0f7aad5f9d9c782d5f5
server/endpoint_registry.go
server/endpoint_registry.go
package server import ( "regexp" "sync" ) type EndpointRegistry struct { sync.RWMutex endpoints map[string]*Endpoint } func NewEndpointRegistry() *EndpointRegistry { return &EndpointRegistry{ endpoints: make(map[string]*Endpoint), } } func (r *EndpointRegistry) Get(endpointName string) *Endpoint { r.RLock(...
package server import ( "regexp" "sync" "github.com/b2aio/typhon/auth" ) type EndpointRegistry struct { sync.RWMutex endpoints map[string]*Endpoint } func NewEndpointRegistry() *EndpointRegistry { return &EndpointRegistry{ endpoints: make(map[string]*Endpoint), } } func (r *EndpointRegistry) Get(endpointN...
Add a DefaultAuthorizer to all endpoints on registration
Add a DefaultAuthorizer to all endpoints on registration
Go
mit
mondough/typhon,monzo/typhon
970f2a52738f73cc8c63f4323b07a4b33fe3fddd
librariesio/projects.go
librariesio/projects.go
package librariesio import ( "fmt" "net/http" ) // Project that holds a name field type Project struct { Name string `json:"name,omitempty"` } // GetProject returns information about a project and it's versions. // GET https://libraries.io/api/:platform/:name func (c *Client) GetProject(platform string, name stri...
package librariesio import ( "fmt" "net/http" ) // Project that holds a name field type Project struct { Name string `json:"name"` } // GetProject returns information about a project and it's versions. // GET https://libraries.io/api/:platform/:name func (c *Client) GetProject(platform string, name string) (*Proj...
Remove json omitempty option from Project
Remove json omitempty option from Project
Go
mit
hackebrot/go-librariesio
3c22fb745f49a6d9d2189b83a76becc2fbb18c36
examples/color/app.go
examples/color/app.go
package main import ( "log" "time" "github.com/briandowns/spinner" ) func main() { s := spinner.New(spinner.CharSets[0], 100*time.Millisecond) s.Prefix = "Colors: " if err := s.Color("yellow"); err != nil { log.Fatalln(err) } s.Start() time.Sleep(4 * time.Second) s.Color("red") s.UpdateCharSet(spinner....
package main import ( "log" "time" "github.com/briandowns/spinner" ) func main() { s := spinner.New(spinner.CharSets[0], 100*time.Millisecond) s.Prefix = "Colors: " if err := s.Color("yellow"); err != nil { log.Fatalln(err) } s.Start() time.Sleep(4 * time.Second) if err := s.Color("red"); err != nil { ...
Update color example to work the way it should.
Update color example to work the way it should.
Go
apache-2.0
diddledan/spinner,briandowns/spinner,mjmac/spinner
ad7edb7b3136ca4b8abacf56ce7682bd6a46bc9c
pprint_test.go
pprint_test.go
// Copyright 2015 Jean Niklas L'orange. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package edn import ( "bytes" "testing" ) func TestPPrintSimple(t *testing.T) { inputs := []string{ "{}", "[]", "{:a 42}", } for _, input :=...
// Copyright 2015 Jean Niklas L'orange. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package edn import ( "bytes" "testing" ) func TestPPrint(t *testing.T) { inputs := map[string]string{ "{}": "{}", "[]": "[]", ...
Make TestPPrintSimple easier to extend
Make TestPPrintSimple easier to extend
Go
bsd-3-clause
go-edn/edn
c6388c5255fa615fbdab081374d50000cc6ce027
protocol/internal.go
protocol/internal.go
package protocol import ( . "github.com/Philipp15b/go-steam/protocol/steamlang" "io" ) type JobId uint64 type Serializer interface { Serialize(w io.Writer) error } type Deserializer interface { Deserialize(r io.Reader) error } type Serializable interface { Serializer Deserializer } type MessageBody interfac...
package protocol import ( "io" "math" "strconv" . "github.com/Philipp15b/go-steam/protocol/steamlang" ) type JobId uint64 func (j JobId) String() string { if j == math.MaxUint64 { return "(none)" } return strconv.FormatUint(uint64(j), 10) } type Serializer interface { Serialize(w io.Writer) error } type...
Add String() method to JobId
Protocol: Add String() method to JobId
Go
bsd-3-clause
juRiii/go-steam,juRiii/go-steam
8beca790d3797d63dccc71d645645c9aee9045b9
cmd/gcm-logger.go
cmd/gcm-logger.go
// Program gcm-logger logs and echoes as a GCM "server". package main import ( "github.com/alecthomas/kingpin" "github.com/aliafshar/toylog" "github.com/google/go-gcm" ) var ( serverKey = kingpin.Flag("server_key", "The server key to use for GCM.").Short('k').Required().String() senderId = kingpin.Flag("sender_...
// Program gcm-logger logs and echoes as a GCM "server". package main import ( "github.com/alecthomas/kingpin" "github.com/aliafshar/toylog" "github.com/google/go-gcm" ) var ( serverKey = kingpin.Flag("server_key", "The server key to use for GCM.").Short('k').Required().String() senderId = kingpin.Flag("sender_...
Change onMessage signature to match MessageHandler
Change onMessage signature to match MessageHandler
Go
apache-2.0
kikinteractive/go-gcm,googlearchive/go-gcm,kikinteractive/go-gcm,rounds/go-gcm
aefb3b76f97b704b18b8f0590745c55eee09241c
internal/test/test.go
internal/test/test.go
package test import ( "fmt" "math/rand" "strconv" "time" ) func init() { rand.Seed(time.Now().Unix()) } // StringsToInterfaceSlice converts strings to a slice of interfaces containing the strings. func StringsToInterfaceSlice(strings ...string) []interface{} { args := make([]interface{}, len(strings)) for i, ...
package test import ( "fmt" "math/rand" "strconv" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } // StringsToInterfaceSlice converts strings to a slice of interfaces containing the strings. func StringsToInterfaceSlice(strings ...string) []interface{} { args := make([]interface{}, len(strings)) for...
Change random seed to UnixNano
Change random seed to UnixNano
Go
mit
MasterOfBinary/redistypes
0dcaad90af049c068bb199fa9e900598b63ebabb
kami/contact.go
kami/contact.go
package main type Contact struct { Id int Email string FirstName string LastName string MiddleName string DateOfBirth string Sex int }
package main import ( "bytes" "database/sql" "database/sql/driver" "encoding/json" "github.com/lib/pq" "reflect" ) func NewContact() *Contact { return &Contact{} } type Contact struct { Id sql.NullInt64 Email sql.NullString FirstName sql.NullString LastName sql.NullString MiddleName ...
Implement right jron marshaling for Contact
Implement right jron marshaling for Contact
Go
mit
konjoot/benches,konjoot/benches,konjoot/benches