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
1cdaf06b7edc343a0846f82053aaf9a0d5581e57
python/util.go
python/util.go
package python import ( "log" "os" "os/exec" "path/filepath" "strings" "sourcegraph.com/sourcegraph/toolchain" ) func runCmdLogError(cmd *exec.Cmd) { err := runCmdStderr(cmd) if err != nil { log.Printf("Error running `%s`: %s", strings.Join(cmd.Args, " "), err) } } func runCmdStderr(cmd *exec.Cmd) error ...
package python import ( "log" "os" "os/exec" "path/filepath" "strings" "sourcegraph.com/sourcegraph/srclib/toolchain" ) func runCmdLogError(cmd *exec.Cmd) { err := runCmdStderr(cmd) if err != nil { log.Printf("Error running `%s`: %s", strings.Join(cmd.Args, " "), err) } } func runCmdStderr(cmd *exec.Cmd)...
Fix `goimports` fail, no idea how it compiles on local machine.
Fix `goimports` fail, no idea how it compiles on local machine.
Go
mit
sourcegraph/srclib-python,alexsaveliev/srclib-python,alexsaveliev/srclib-python,alexsaveliev/srclib-python
3e84fbe28510417aa31508d0bf68cdfa11d96760
generic/test/Debounce/example_test.go
generic/test/Debounce/example_test.go
package Debounce import ( "time" ) func Example_debounce() { i := 1 due := []time.Duration{ 0, 300 * time.Millisecond, 80 * time.Millisecond, // 80ms < 100ms => '2' is ignored 110 * time.Millisecond, 0, } source := MakeTimedInt(due[0], func(Next func(int), Error func(error), Complete func()) time.Du...
package Debounce import ( "fmt" "time" ) func Example_debounce() { i := 1 due := []time.Duration{ 0, 300 * time.Millisecond, 80 * time.Millisecond, // 80ms < 100ms => '2' is ignored 110 * time.Millisecond, 0, } source := MakeTimedInt(due[0], func(Next func(int), Error func(error), Complete func()) ...
Handle error in Debounce test
Handle error in Debounce test
Go
mit
ReactiveGo/rx
948077e8695fb4d44c178521a8e7c6ce0434ca44
git/remote.go
git/remote.go
package git import ( "errors" "regexp" ) type GitRemote struct { Name string URL string } func Remotes() ([]GitRemote, error) { r := regexp.MustCompile("(.+)\t(.+github.com.+) \\(push\\)") output, err := execGitCmd("remote", "-v") if err != nil { return nil, errors.New("Can't load git remote") } remotes...
package git import ( "errors" "regexp" ) type GitRemote struct { Name string URL string } func Remotes() ([]*GitRemote, error) { r := regexp.MustCompile("(.+)\t(.+github.com.+) \\(push\\)") output, err := execGitCmd("remote", "-v") if err != nil { return nil, errors.New("Can't load git remote") } remote...
Use pointers to be more efficient
Use pointers to be more efficient
Go
mit
ryo33/hub,nmfzone/hub,whilp/hub,ASidlinskiy/hub,nmfzone/hub,RichardLitt/hub,xantage/hub,aereal/hub,ryo33/hub,boris-rea/hub,pankona/hub,adjohnson916/hub,hopil/hub,nlutsenko/hub,RichardLitt/hub,pwaller/hub,jingweno/hub,elancom/hub,rlugojr/hub,sbp/hub,whilp/hub,aereal/hub,sbp/hub,rlugojr/hub,xantage/hub,naru0504/hub,panko...
ff758e9bb9ca6a6750d21f17cd9653126c467cef
pkg/api/resources.go
pkg/api/resources.go
package radosAPI // Usage represents the response of usage requests type Usage struct { Entries []struct { Buckets []struct { Bucket string `json:"bucket"` Categories []struct { BytesReceived int `json:"bytes_received"` BytesSent int `json:"bytes_sent"` Category string `json:"ca...
package radosAPI type apiError struct { Code string `json:"Code"` } // Usage represents the response of usage requests type Usage struct { Entries []struct { Buckets []struct { Bucket string `json:"bucket"` Categories []struct { BytesReceived int `json:"bytes_received"` BytesSent int `...
Add apiError struct to handle errors
Add apiError struct to handle errors
Go
mit
QuentinPerez/go-radosgw
85688bc383685f33e748a151a6f56216772d7d5d
cmd/lhsmd/agent/fileid.go
cmd/lhsmd/agent/fileid.go
package agent import ( "github.intel.com/hpdd/lustre" "github.intel.com/hpdd/lustre/fs" "github.intel.com/hpdd/lustre/pkg/xattr" ) const xattrFileID = "trusted.hsm_file_id" func updateFileID(mnt fs.RootDir, fid *lustre.Fid, fileID []byte) error { p := fs.FidPath(mnt, fid) err := xattr.Lsetxattr(p, xattrFileID,...
package agent import ( "github.intel.com/hpdd/logging/debug" "github.intel.com/hpdd/lustre" "github.intel.com/hpdd/lustre/fs" "github.intel.com/hpdd/lustre/pkg/xattr" ) const xattrFileID = "trusted.hsm_file_id" func updateFileID(mnt fs.RootDir, fid *lustre.Fid, fileID []byte) error { p := fs.FidPath(mnt, fid) ...
Add debug to fileID stuff
Add debug to fileID stuff Show the xattr added after archive completes.
Go
mit
intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur
f0c4fb26374b905ca6e5163fcb984d4a9b932b1d
internal/example/example_test.go
internal/example/example_test.go
/* * Copyright (c) 2015 Kurt Jung (Gmail: kurt.w.jung) * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TH...
/* * Copyright (c) 2015 Kurt Jung (Gmail: kurt.w.jung) * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TH...
Change example test function name to comply with go vet
Change example test function name to comply with go vet
Go
mit
jung-kurt/gofpdf
854ef6c2e241d628c6d221b6b015bcfcbe77f3bd
src/github.com/stellar/go-horizon/actions_root.go
src/github.com/stellar/go-horizon/actions_root.go
package horizon import ( "net/http" "github.com/jagregory/halgo" "github.com/stellar/go-horizon/render/hal" ) // RootResource is the initial map of links into the api. type RootResource struct { halgo.Links } var globalRootResource = RootResource{ Links: halgo.Links{}. Self("/"). Link("account", "/accounts...
package horizon import ( "net/http" "github.com/jagregory/halgo" "github.com/stellar/go-horizon/render/hal" ) // RootResource is the initial map of links into the api. type RootResource struct { halgo.Links } var globalRootResource = RootResource{ Links: halgo.Links{}. Self("/"). Link("account", "/accounts...
Correct root resource link to real order_book route
Correct root resource link to real order_book route
Go
apache-2.0
lackac/horizon,stellar/horizon,masonforest/horizon,masonforest/horizon,irisli/horizon,masonforest/go-horizon,lackac/horizon,stellar/horizon,nullstyle/go-horizon,masonforest/go-horizon,masonforest/go-horizon,irisli/horizon,irisli/horizon,lackac/horizon,nullstyle/go-horizon,nullstyle/go-horizon,masonforest/horizon,stella...
ba19b6927fd79be4d676ff228128d72393cbf76a
integration-cli/docker_cli_oom_killed_test.go
integration-cli/docker_cli_oom_killed_test.go
// +build !windows package main import ( "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { testRequires(c, DaemonIsLinux, memoryLimitSupport) name := "testoomkilled" _, exitCode, _ := dockerCmdWithError("run", "--name",...
// +build !windows package main import ( "github.com/docker/docker/pkg/integration/checker" "github.com/go-check/check" ) func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) { testRequires(c, DaemonIsLinux, memoryLimitSupport) name := "testoomkilled" _, exitCode, _ := dockerCmdWithError("run", "--name",...
Increase integration cli test memory
Increase integration cli test memory Signed-off-by: Euan <82ce0a5f500076a0414f27984d8e19adc458729b@amazon.com>
Go
apache-2.0
lixiaobing10051267/docker,kolyshkin/moby,mikebrow/docker,jzwlqx/denverdino.github.io,jlebon/docker,PatrickLang/moby,mahak/docker,estesp/docker,bearstech/moby,sunyuan3/docker,danyalKhaliq10p/moby,docker/docker.github.io,hallyn/docker,sfsmithcha/docker,thaJeztah/docker.github.io,rhardih/docker,bdwill/docker.github.io,cyp...
c7d2135698065951b052631de42bfdea3983bf06
turtle.go
turtle.go
package turtle // Version of the turtle library const Version = "v0.1.0" // Emojis maps a name to an Emoji var Emojis = make(map[string]*Emoji) // EmojisByChar maps a character to an Emoji var EmojisByChar = make(map[string]*Emoji) func init() { for _, e := range emojis { Emojis[e.Name] = e EmojisByChar[e.Char...
package turtle // Version of the turtle library const Version = "v0.1.0" // Emojis maps a name to an Emoji var Emojis = make(map[string]*Emoji) // EmojisByChar maps a character to an Emoji var EmojisByChar = make(map[string]*Emoji) func init() { for _, e := range emojis { Emojis[e.Name] = e EmojisByChar[e.Char...
Add new public Filter function for custom filters
Add new public Filter function for custom filters
Go
mit
hackebrot/turtle
5f59e45d281886a81d4ae811fe70da96c836f080
premailer/util.go
premailer/util.go
package premailer import ( "github.com/vanng822/css" ) func copyRule(selector string, rule *css.CSSRule) *css.CSSRule { // copy rule for each selector copiedStyle := css.CSSStyleRule{SelectorText: selector, Styles: rule.Style.Styles} copiedRule := &css.CSSRule{Type: rule.Type, Style: copiedStyle} return copiedRu...
package premailer import ( "github.com/vanng822/css" ) func copyRule(selector string, rule *css.CSSRule) *css.CSSRule { // copy rule for each selector styles := make(map[string]*css.CSSStyleDeclaration) for prop, s := range rule.Style.Styles { styles[prop] = css.NewCSSStyleDeclaration(s.Property, s.Value, s.Imp...
Copy rule entirely to avoid buggy in the future
Copy rule entirely to avoid buggy in the future
Go
mit
vanng822/go-premailer,vanng822/go-premailer
37438757788d279c839506d54f460b2ab37db164
tpl/tplimpl/amber_compiler.go
tpl/tplimpl/amber_compiler.go
// Copyright 2017 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 2017 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 ...
Fix compiling Amber templates that import other templates
tpl/tplimpl: Fix compiling Amber templates that import other templates Without this patch, amber would try to load templates from the OS filesystem instead of the layouts virtual filesystem.
Go
apache-2.0
fedelibre/hugo,gohugoio/hugo,mdhender/hugo,gohugoio/hugo,anthonyfok/hugo,gohugoio/hugo,fedelibre/hugo,mdhender/hugo,fedelibre/hugo,anthonyfok/hugo,mdhender/hugo,fedelibre/hugo,anthonyfok/hugo,mdhender/hugo
330e205512f849e85a0e01e7c82246eb5aac5927
net.go
net.go
package gothink import ( "encoding/json" "io/ioutil" ) type Net interface { Epoch() } type Layer struct { Activation string Weights [][]float64 } /* A feed forward type neural network */ type FFNet struct { //Net Layers []Layer } /* func NewFFNet (filePath string) *FFNet { f :=...
package gothink import ( "encoding/json" "io/ioutil" ) type Net interface { Epoch() } type Layer struct { Activation string Weights [][]float64 } /* A feed forward type neural network */ type FFNet struct { //Net Layers []Layer } func NewFFNet (filepath string) (*FFNet, error) { ...
Change FromJSON to NewFFNet struct initializer function
Change FromJSON to NewFFNet struct initializer function
Go
mit
jaybutera/gothink
e3cd0f6cf45d55343c49262277997935b4931e8b
test/bugs/bug126.go
test/bugs/bug126.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 const none = 0 // same const identifier declared twice should not be accepted const none = 1 // ERROR "redeclared"
// 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 // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1 //...
Tweak comments so that this test passes with gccgo.
Tweak comments so that this test passes with gccgo. bug126.go:7:7: error: redefinition of 'none' bug126.go:6:7: note: previous definition of 'none' was here R=gri DELTA=3 (1 added, 0 deleted, 2 changed) OCL=20563 CL=20723
Go
bsd-3-clause
abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go
57b4eebab3f63c37e892bfd57ca0f719a9b02697
web/server/system/file_system.go
web/server/system/file_system.go
package system import ( "log" "os" "path/filepath" "strings" ) type FileSystem struct{} func (self *FileSystem) Walk(root string, step filepath.WalkFunc) { err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if self.isMetaDirectory(info) { return filepath.SkipDir } return...
package system import ( "log" "os" "path/filepath" "strings" ) type FileSystem struct{} func (self *FileSystem) Walk(root string, step filepath.WalkFunc) { err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if self.isMetaDirectory(info) { return filepath.SkipDir } return...
Expand ignored directories to match behaviour of the go tool
Expand ignored directories to match behaviour of the go tool The go tool currently ignore directories that start with a dot or an underscore, or are called 'testdata'. This patch augments the ignore logic of goconvey to match what Go does by default.
Go
mit
wallclockbuilder/goconvey,zj8487/goconvey,springning/goconvey,wallclockbuilder/goconvey,springning/goconvey,zj8487/goconvey,aquilax/goconvey,yaoshipu/goconvey,wallclockbuilder/convey,ansiz/goconvey,springning/goconvey,ansiz/goconvey,wallclockbuilder/assertions,springning/assertions,zj8487/goconvey,leeola/goconvey,aquil...
eadbe6d5a4a92da8eef924ac9cbe953131ccef73
settings/config_unix.go
settings/config_unix.go
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
Fix logic error in loading unix config.
Fix logic error in loading unix config.
Go
apache-2.0
Matir/webborer,Matir/gobuster,Matir/gobuster,Matir/webborer
4e1d54ad511525fe04df9e6b352450237a2539f8
builtin/providers/aws/import_aws_sqs_queue_test.go
builtin/providers/aws/import_aws_sqs_queue_test.go
package aws import ( "testing" "fmt" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSSQSQueue_importBasic(t *testing.T) { resourceName := "aws_sqs_queue.queue-with-defaults" queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5)) reso...
package aws import ( "testing" "fmt" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSSQSQueue_importBasic(t *testing.T) { resourceName := "aws_sqs_queue.queue" queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5)) resource.Test(t, r...
Change the resource name expected as part of sqs queue import test
provider/aws: Change the resource name expected as part of sqs queue import test
Go
mpl-2.0
evalphobia/saas-ci-performance-compare-terraform,kjmkznr/terraform,gh-mlfowler/terraform,ValFadeev/terraform,GrayCoder/terraform,huydinhle/terraform,harijayms/terraform,hrach/hashicorp-terraform,kristinn/terraform,brandontosch/terraform,finanzcheck/terraform,antonbabenko/terraform,jhedev/terraform,hpcloud/terraform,xse...
5fb651ea19dce69cf0fba0cfe945cafc5cb1e76f
main.go
main.go
// Count lines of input per second on stdin package main import ( "bufio" "fmt" "os" "time" "flag" ) func readLines(c chan int) { count := 0 bio := bufio.NewReader(os.Stdin) for { _, more, err := bio.ReadLine() if err != nil { fmt.Println(err) os.Exit(1) } if more { continue } count += 1 ...
// Count lines of input per second on stdin package main import ( "bufio" "flag" "fmt" "os" "time" ) func readLines(c chan int) { count := 0 bio := bufio.NewReader(os.Stdin) for { _, more, err := bio.ReadLine() if err != nil { fmt.Println(err) os.Exit(1) } if more { continue } count += 1 ...
Add flag to print timestamp with rate
Add flag to print timestamp with rate
Go
mit
aerissecure/lps
d1f45de88f0c5fe6b27fde59015b156294bda1be
main.go
main.go
package main import ( "flag" "fmt" "os" "os/exec" ) var output string func init() { flag.Usage = func() { fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0]) flag.PrintDefaults() } flag.StringVar(&output, "out", "out.go", "Specify a path to the output file") flag.Parse() } func main() { c...
package main import ( "flag" "fmt" "log" "os" "os/exec" ) var output string func init() { flag.Usage = func() { fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0]) flag.PrintDefaults() } flag.StringVar(&output, "out", "out.go", "Specify a path to the output file") flag.Parse() } func main...
Use `log` package instead of `fmt` for logging and exiting
Use `log` package instead of `fmt` for logging and exiting
Go
mit
konjoot/go-inspect
80676500e346b75b91a3b7c73de891e029660bbe
main.go
main.go
package main import ( "encoding/json" "fmt" "github.com/zerowidth/alfred-gh-shorthand/alfred" "os" ) func main() { var input string if len(os.Args) < 2 { input = "" } else { input = os.Args[1] } fmt.Fprintf(os.Stderr, "input: %#v\n", input) item := alfred.Item{ Title: "hello", Valid: false, } item...
package main import ( "encoding/json" "fmt" "github.com/zerowidth/alfred-gh-shorthand/alfred" "os" "strings" ) func main() { var input string if len(os.Args) < 2 { input = "" } else { input = strings.Join(os.Args[1:], " ") } fmt.Fprintf(os.Stderr, "input: %#v\n", input) item := alfred.Item{ Title: "h...
Concatenate all args for easier CLI-based debugging
Concatenate all args for easier CLI-based debugging
Go
mit
zerowidth/gh-shorthand,zerowidth/gh-shorthand
f1971811af539a0799064d6bd89785d79b322fef
main.go
main.go
package main import ( "net/http" "fmt" "encoding/json" ) func handlePing(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "OK") } func handleRequest(w http.ResponseWriter, r *http.Request) { type Input struct { FeedUrl string `json:"feed_url"` } if r.Method != http.MethodP...
package main import ( "net/http" "fmt" "encoding/json" ) func handlePing(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "OK") } func handleRequest(w http.ResponseWriter, r *http.Request) { type Input struct { FeedId string `json:"feed_id"` FeedUrl string `json:"feed_url"`...
Add feed id as a parameter
Add feed id as a parameter
Go
mit
mhaligowski/paperboy-crawler
c2fe954e806086fe16ac318dc078914d0a715d54
stemmer.go
stemmer.go
package fate import "strings" // Stemmer normalizes a string to its stem. type Stemmer interface { Stem(string) string } type stemFunc func(string) string func (s stemFunc) Stem(str string) string { return s(str) } // DefaultStemmer is a stemmer that lowercases its tokens, making // replies case-insensitive. var...
package fate import ( "strings" "unicode" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" ) // Stemmer normalizes a string to its stem. type Stemmer interface { Stem(string) string } type stemFunc func(string) string func (s stemFunc) Stem(str string) string { return s(str) } // DefaultStemme...
Add punctuation and accent normalization to DefaultStemmer
Add punctuation and accent normalization to DefaultStemmer
Go
mit
pteichman/fate
11d69ff86621a407de96ed5562e3df58d411d873
document_test.go
document_test.go
package asciidocgo import ( "testing" . "github.com/smartystreets/goconvey/convey" ) var dm = new(Document).Monitor() var dnm = new(Document) var notMonitoredError = &NotMonitoredError{"test"} func TestDocumentMonitor(t *testing.T) { Convey("A Document can be monitored", t, func() { Convey("By default, a Docume...
package asciidocgo import ( "fmt" "reflect" "testing" . "github.com/smartystreets/goconvey/convey" ) var dm = new(Document).Monitor() var dnm = new(Document) var notMonitoredError = &NotMonitoredError{"test"} var monitorFNames = [1]string{"ReadTime"} func TestDocumentMonitor(t *testing.T) { Convey("A Document c...
Use reflect to test time access methods on Document
Use reflect to test time access methods on Document
Go
mit
VonC/asciidocgo,bep/asciidocgo
34c54dde28d2f253f8c7e265150cf64422f1dc1e
app/gonduit/extensions/requests/phabulous_toslack.go
app/gonduit/extensions/requests/phabulous_toslack.go
package requests import "github.com/etcinit/gonduit/requests" // PhabulousToSlackRequest represets a request to phabulous.toslack. type PhabulousToSlackRequest struct { UserPHIDs []string `json:"userPHIDs"` requests.Request }
package requests import "github.com/etcinit/gonduit/requests" // PhabulousToSlackRequest represets a request to phabulous.toslack. type PhabulousToSlackRequest struct { UserPHIDs []string `json:"UserPHIDs"` requests.Request }
Fix parameter name for `phabulous.toslack` conduit call
fix(conduit): Fix parameter name for `phabulous.toslack` conduit call
Go
mit
etcinit/phabricator-slack-feed,etcinit/phabulous,etcinit/phabulous
53539e67f175062c95ab3ee351fb05bcc2c7ed00
monitor/monitor.go
monitor/monitor.go
package monitor import "fmt" // Target is a URL, which has to be polled for availability. type Target struct { // Unique identifier of this target. Targets' IDs cannot intercept. Target's // ID must be constant between GetTargets() calls. ID uint // User-supplied target title, used purely for display. Title stri...
package monitor import "fmt" // Target is a URL, which has to be polled for availability. type Target struct { // Unique identifier of this target. Targets' IDs cannot intercept. Target's // ID must be constant between GetTargets() calls. ID uint // User-supplied target title, used purely for display. Title stri...
Add a basic slice implementation of TargetsGetter
:hammer: Add a basic slice implementation of TargetsGetter
Go
mit
yamnikov-oleg/avamon-bot,yamnikov-oleg/avamon-bot
1f47358226bda2017dc37720fc7e1666ae2a4b06
main.go
main.go
package main import ( "github.com/neilvallon/cmplr/project" "fmt" ) func main() { cfg, err := project.ReadConfig() if err != nil { panic("Error parsing config file.") } fmt.Printf("Project: %s\n", cfg.ProjectName) for _, j := range cfg.Jobs { if err := j.Run(); err != nil { fmt.Printf("\nCould not co...
package main import ( "github.com/neilvallon/cmplr/project" "fmt" "strings" "path/filepath" ) func main() { cfg, err := project.ReadConfig() if err != nil { panic("Error parsing config file.") } fmt.Printf("Project: %s\n", cfg.ProjectName) for _, j := range cfg.Jobs { PrintHeader(filepath.Base(j.Outpu...
Print center padded file names to console before compiling
Print center padded file names to console before compiling
Go
mit
neilvallon/Cmplr
0e51b561eae9a6716e7e73c7220538771ab6f2ed
testdata/main3.go
testdata/main3.go
package main import ( "bytes" "fmt" "os" "strings" ) func testfprintf() { f, err := os.Create("/tmp/blah") if err != nil { panic(err) } buf := bytes.Buffer{} s := strings.Builder{} fmt.Fprintln(f, "blah") // UNCHECKED fmt.Fprintln(os.Stderr, "blah") fmt.Fprintln(&buf, "blah") fmt.Fprintln(&s, "blah") ...
package main import ( "bytes" "fmt" "os" ) func testfprintf() { f, err := os.Create("/tmp/blah") if err != nil { panic(err) } buf := bytes.Buffer{} fmt.Fprintln(f, "blah") // UNCHECKED fmt.Fprintln(os.Stderr, "blah") fmt.Fprintln(&buf, "blah") }
Remove tests that use strings.Builder.
Remove tests that use strings.Builder. It's not supported by older Go.
Go
mit
kisielk/errcheck
765ea25c049fb91fcaf116204a30b7580dbea674
main.go
main.go
package main import ( "flag" "log" "net/http" "strconv" ) var fs http.Handler func main() { // setup, then parse flags var port int var host string flag.IntVar(&port, "port", 3000, "The port to bind to") flag.StringVar(&host, "host", "127.0.0.1", "The host to bind to") flag.Parse() addr := host + ":" + ...
package main import ( "flag" "github.com/ciarand/martini-fileindex" "github.com/codegangsta/martini" "net/http" ) func main() { port := parseFlags() m := martini.Classic() m.Handlers( martini.Logger(), martini.Static("."), fileindex.ListFiles("."), ) http.ListenAndServe(":"+port, m) } func parseFla...
Use Martini, use my "martini-fileindex" package
Use Martini, use my "martini-fileindex" package Martini has logging builtin, it makes it much simpler. Also removing the host flag - this isn't intended for anything but local dev testing, no point in giving people the ability to make really, really, really bad decisions.
Go
mit
ciarand/deserv
44c917ee05e63a4f32cec3abc6990f4137a1a08b
main/main_suite_test.go
main/main_suite_test.go
package main_test import ( "os" "os/exec" "path" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestMain(t *testing.T) { RegisterFailHandler(Fail) dir, err := os.Getwd() Expect(err).NotTo(HaveOccurred()) cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl...
package main_test import ( "os" "os/exec" "path" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestMain(t *testing.T) { RegisterFailHandler(Fail) dir, err := os.Getwd() Expect(err).NotTo(HaveOccurred()) cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl...
Add debugging info to the main test
Add debugging info to the main test
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
c3a633c440d6658490191a819be4f33b909f808a
util.go
util.go
package main import ( // "bufio" // "fmt" // "os" // "regexp" ) func findDeviceFromMount (mount string) (string, error) { // stub for Mac devel return "/dev/xvda", nil /* var device string = "" // Serious Linux-only stuff happening here... file := "/proc/mounts" v, err := os.Open(file) if err !...
package main import ( "bufio" "fmt" "os" "regexp" ) func findDeviceFromMount (mount string) (string, error) { // stub for Mac devel //return "/dev/xvda", nil var device string = "" // Serious Linux-only stuff happening here... file := "/proc/mounts" v, err := os.Open(file) if err != nil { ...
Put the device lookup code back for Linux
Put the device lookup code back for Linux
Go
mit
pforman/ebs-snap
e6e39af7479a2881d11efe81089ed7288d24dfd5
web/server.go
web/server.go
// Package web Cozy Stack API. // // Cozy is a personal platform as a service with a focus on data. package web import ( "strings" "github.com/cozy/cozy-stack/pkg/instance" "github.com/cozy/cozy-stack/web/middlewares" "github.com/labstack/echo" ) func splitHost(host string) (instanceHost string, appSlug string) ...
// Package web Cozy Stack API. // // Cozy is a personal platform as a service with a focus on data. package web import ( "strings" "github.com/cozy/cozy-stack/pkg/instance" "github.com/cozy/cozy-stack/web/middlewares" "github.com/labstack/echo" ) func splitHost(host string) (instanceHost string, appSlug string) ...
Move appsHandler creation outside of the closure
Move appsHandler creation outside of the closure
Go
agpl-3.0
nono/cozy-stack,sebn/cozy-stack,sebn/cozy-stack,sebn/cozy-stack,sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,nono/cozy-stack,nono/cozy-stack
ace7cf53104f050034a239d462a12d56cfd1368d
github/repository.go
github/repository.go
package github import ( "context" ) type Repo struct { Name *string `json:"name, omitempty"` } func (github *Client) Repos(user string) ([]*Repo, error) { ctx := context.Background() repos, _, err := github.client.Repositories.List(ctx, user, nil) if err != nil { return nil, err } result := make([]*Repo, ...
package github import ( "context" ) type Repo struct { Name *string `json:"name"` } func (github *Client) Repos(user string) ([]*Repo, error) { ctx := context.Background() repos, _, err := github.client.Repositories.List(ctx, user, nil) if err != nil { return nil, err } result := make([]*Repo, 0) for _, ...
Update struct field on json tag
Update struct field on json tag
Go
mit
proshik/githubstatbot,proshik/githubstatbot
301bd192d1f81ed0eb95d86f8eb028586e8dbf6b
api/oidc.go
api/oidc.go
package api import ( "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId string, audience ...string) (*OidcToken, *Response, error) { type oidcTokenRequest struct ...
package api import ( "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId string, audience ...string) (*OidcToken, *Response, error) { type oidcTokenRequest struct ...
Fix empty object instead of no body for default audience
Fix empty object instead of no body for default audience The ticket seemed to indicate that if there is no audience specified, then the request was to have an empty body. However, that leads to a 500 from the API. Reading the associated plugin show that an empty object is expected in that case.
Go
mit
buildkite/agent,buildkite/agent,buildkite/agent
2b404dbe33ca5562ef5ac67b8040a4b86a067cb4
lxd/main_import.go
lxd/main_import.go
package main import ( "fmt" "net/url" "os" "github.com/spf13/cobra" "github.com/lxc/lxd/client" ) type cmdImport struct { global *cmdGlobal flagForce bool flagProject string } func (c *cmdImport) Command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = "import <container name>" cmd.Short = "Impor...
package main import ( "fmt" "github.com/spf13/cobra" ) type cmdImport struct { global *cmdGlobal } func (c *cmdImport) Command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = "import" cmd.Short = `Command has been replaced with "lxd recover"` cmd.Long = `Description: This command has been replaced wit...
Modify lxd import to error with instructions to use lxd recover command
lxd/main/import: Modify lxd import to error with instructions to use lxd recover command Signed-off-by: Thomas Parrott <6b778ce645fb0e3dde76d79eccad490955b1ae74@canonical.com>
Go
apache-2.0
lxc/lxd,stgraber/lxd,lxc/lxd,lxc/lxd,atxwebs/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,hallyn/lxd,lxc/lxd,atxwebs/lxd,hallyn/lxd,stgraber/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,atxwebs/lxd,atxwebs/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,stgraber/lxd,stgraber/lxd,stgraber/lxd
deb89e2191301c40a58fb67ab02331d9859300fe
dp/fibonacci/go/fibonacci_test.go
dp/fibonacci/go/fibonacci_test.go
package main import "testing" func TestFibonacci(t *testing.T) { tcs := map[string]struct { n int expected int }{ "n = 1": {1, 1}, "n = 2": {2, 1}, "n = 50": {50, 12586269025}, "n = 200": {200, 280571172992510140037611932413038677189525}, } for name, tc := range tcs { t.Run(name, func(t...
package main import ( "math/big" "testing" ) func TestFibonacci(t *testing.T) { tcs := map[string]struct { n int expected string //Use string to allow for values that overflow an int64 }{ "n = 0": {0, "0"}, "n = 1": {1, "1"}, "n = 2": {2, "1"}, "n = 50": {50, "12586269025"}, "n = 100":...
Change expected value in test cases to string to allow for values that don't fit in an int64
Change expected value in test cases to string to allow for values that don't fit in an int64
Go
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
fcf2fb08bc454237d55c88c6e0331735703962fd
generation/output/helpers_test.go
generation/output/helpers_test.go
package output
package output import ( "testing" ) func TestExport(t *testing.T) { if r := export(""); r != "" { t.Errorf(`Empty input, the same string was expected as a result. Got "%s".`, r) } if r := export("a"); r != "A" { t.Errorf(`Incorrect result. Expected "A", got "%s".`, r) } if r := export("int"); r != "Int" { ...
Test coverage for export template helper
Test coverage for export template helper
Go
bsd-2-clause
runner-mei/goal,runner-mei/goal,runner-mei/goal
5901da0a257566afd9dd19059ec55bfa3bbc78c6
bump_version/main.go
bump_version/main.go
package main import ( "flag" "fmt" "log" "os" "os/exec" "github.com/Shyp/bump_version" ) const VERSION = "4.1.1" func usage() { fmt.Fprintf(os.Stderr, "Usage: bump_version <major|minor|patch> <filename>\n") } func main() { flag.Usage = usage flag.Parse() args := flag.Args() if len(args) != 2 { usage()...
package main import ( "flag" "fmt" "log" "os" "os/exec" "github.com/Shyp/bump_version" ) const VERSION = "0.1" func usage() { fmt.Fprintf(os.Stderr, "Usage: bump_version <major|minor|patch> <filename>\n") } func runCommand(binary string, args ...string) { out, err := exec.Command(binary, args...).CombinedO...
Add new commit/tag when bumping version
Add new commit/tag when bumping version
Go
mit
Shyp/bump_version
abcb562402dffca3006b3e20273841c0293c21cf
resultProcessor/structsMatchCriteria.go
resultProcessor/structsMatchCriteria.go
package nessusProcessor // PolicyViolationMatchCriteria holds what criteria should be checked when checking for a // policy violation. type PolicyViolationMatchCriteria struct { ExternallyAccessible bool IgnoreViolationWithCriteriaMatch bool PreviousViolationCheck bool CountIf ...
package nessusProcessor // PolicyViolationMatchCriteria holds what criteria should be checked when checking for a // policy violation. type PolicyViolationMatchCriteria struct { ExternallyAccessible bool IgnoreViolationWithCriteriaMatch bool PreviousViolationCheck bool CountIf ...
Make ports a slice for consistency with policy violations
Make ports a slice for consistency with policy violations Signed-off-by: Kevin Kirsche <18695bc9b6a48cd25cda049e45c04495c905a059@gmail.com>
Go
apache-2.0
kkirsche/nessusControl
7486296ced4144579eb8d02c2931870d37056b00
cgoflags.go
cgoflags.go
package clang // #cgo LDFLAGS: -lclang // #cgo linux CFLAGS: -I. import "C" //EOF
package clang // #cgo LDFLAGS: -lclang // #cgo CFLAGS: -I. import "C" //EOF
Add the repository root to CFLAGS -I
Add the repository root to CFLAGS -I We are compiling this under MacOSX. Removing the "linux" constraint solved our compiling errors.
Go
bsd-2-clause
surullabs/go-clang,sbinet/go-clang,surullabs/go-clang,sbinet/go-clang
aa9e4840c5789a65d2fd9c35d5475b01360dc7bf
error.go
error.go
package hdfs import ( "os" "syscall" ) const ( fileNotFoundException = "java.io.FileNotFoundException" permissionDeniedException = "org.apache.hadoop.security.AccessControlException" pathIsNotEmptyDirException = "org.apache.hadoop.fs.PathIsNotEmptyDirectoryException" ) // Error represents a remote java ex...
package hdfs import ( "os" "syscall" ) const ( fileNotFoundException = "java.io.FileNotFoundException" permissionDeniedException = "org.apache.hadoop.security.AccessControlException" pathIsNotEmptyDirException = "org.apache.hadoop.fs.PathIsNotEmptyDirectoryException" FileAlreadyExistsException = "org.apac...
Add support for file already Exists exception
Add support for file already Exists exception
Go
mit
ashishgandhi/hdfs,ashishgandhi/hdfs,colinmarc/hdfs,colinmarc/hdfs
499e64eac56f7c6563ea3ca028c0d19d9f9718e8
workq/queue.go
workq/queue.go
package workq import "sync" type Queue struct { items []*Item mutex sync.Mutex } func (q *Queue) Push(item *Item) { q.mutex.Lock() defer q.mutex.Unlock() q.items = append(q.items, item) go item.Translate() } func (q *Queue) Pop() *Item { q.mutex.Lock() defer q.mutex.Unlock() if !q.IsEmpty() { item := (...
package workq type Queue struct { ch chan *Item } func NewQueue() *Queue { q := new(Queue) q.ch = make(chan *Item, 10) return q } func (q *Queue) Push(item *Item) { q.ch <- item go item.Translate() } func (q *Queue) Pop() <-chan *Item { ch := make(chan *Item) go func() { for item := range q.ch { <-item...
Use a channel inside the Queue
Use a channel inside the Queue
Go
mit
MStoykov/mazungumzo
759cbd58e1770a7e3c176e9e1727805640d9247e
lib/persistedretry/tagreplication/fixtures.go
lib/persistedretry/tagreplication/fixtures.go
package tagreplication import ( "fmt" "io/ioutil" "os" "path/filepath" "code.uber.internal/infra/kraken/core" "code.uber.internal/infra/kraken/utils/randutil" "code.uber.internal/infra/kraken/utils/testutil" ) // StoreFixture creates a fixture of tagreplication.Store. func StoreFixture(rv RemoteValidator) (*S...
package tagreplication import ( "fmt" "io/ioutil" "os" "path/filepath" "code.uber.internal/infra/kraken/core" "code.uber.internal/infra/kraken/utils/randutil" "code.uber.internal/infra/kraken/utils/testutil" ) // StoreFixture creates a fixture of tagreplication.Store. func StoreFixture(rv RemoteValidator) (*S...
Add origin address to build-index configuration
Add origin address to build-index configuration Summary: Somehow this never got populated. We now validate that the origin address is non-empty on startup, so this was causing build-index to crash. Reviewers: #kraken, yiran, evelynl Reviewed By: #kraken, yiran, evelynl Subscribers: jenkins Differential Revision: h...
Go
apache-2.0
uber/kraken,uber/kraken,uber/kraken,uber/kraken,uber/kraken
8d4a94bd00f829b4d290625a6870ca30f2614e5f
sack/shell_init.go
sack/shell_init.go
package sack import ( "fmt" "github.com/codegangsta/cli" ) func shellInit(c *cli.Context) { sh := ` sack=$(which sack) alias S="${sack} -s" alias F="${sack} -e" ` fmt.Println(sh) } func shellEval(c *cli.Context) { sh := "eval \"$(sack init)\"" fmt.Println(sh) } /* // TODO: Add bash and zsh a...
package sack import ( "fmt" "github.com/codegangsta/cli" ) func shellInit(c *cli.Context) { sh := ` sack=$(which sack) alias S="${sack} -s" alias E="${sack} -e" ` fmt.Println(sh) } func shellEval(c *cli.Context) { sh := "eval \"$(sack init)\"" fmt.Println(sh) } /* // TODO: Add bash and zsh a...
Change alias from F to E
Change alias from F to E
Go
mit
zph/go-sack,zph/go-sack
35328eeaa96910031af7f667559e2f992d6ac010
lexer.go
lexer.go
package asyncpi //go:generate go tool yacc -p asyncpi -o parser.y.go asyncpi.y import "io" // Lexer for asyncpi. type Lexer struct { scanner *Scanner Errors chan error } // NewLexer returns a new yacc-compatible lexer. func NewLexer(r io.Reader) *Lexer { return &Lexer{scanner: NewScanner(r), Errors: make(chan e...
package asyncpi //go:generate goyacc -p asyncpi -o parser.y.go asyncpi.y import "io" // Lexer for asyncpi. type Lexer struct { scanner *Scanner Errors chan error } // NewLexer returns a new yacc-compatible lexer. func NewLexer(r io.Reader) *Lexer { return &Lexer{scanner: NewScanner(r), Errors: make(chan error, ...
Update go tool yacc → goyacc
Update go tool yacc → goyacc
Go
apache-2.0
nickng/asyncpi
8819410721824ce2557617419905398aa75cee1f
cmd/kf/main.go
cmd/kf/main.go
// Copyright 2019 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
// Copyright 2019 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
Remove duplicate error message cobra Commands already print out errors
Remove duplicate error message cobra Commands already print out errors
Go
apache-2.0
google/kf,google/kf,google/kf
bd5ebd96d250ee7108b1b22688eb14546a618b1a
pkg/common/log/example_test.go
pkg/common/log/example_test.go
package log_test import ( "log" "net/http" "net/http/httptest" ) func ExampleLogger_LogRequest() { l := log.New("development") h := l.LogRequest("testserver")(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {})) w := httptest.NewRecorder() req, _ := http.NewRequest("GET", "/", nil) h.ServeHTTP...
package log_test import ( "net/http" "net/http/httptest" "github.com/vardius/go-api-boilerplate/pkg/common/log" ) func ExampleLogger_LogRequest() { l := log.New("development") h := l.LogRequest("testserver")(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {})) w := httptest.NewRecorder() req, _...
Fix logger test import path
Fix logger test import path
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
7c14876990f9fa0b204a25aa1333613e75296611
ch1/server/main.go
ch1/server/main.go
package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", handler) log.Fatal(http.ListenAndServe("localhost:8000", nil)) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "URL.Path = %q\n", r.URL.Path) }
package main import ( "fmt" "log" "net/http" "sync" ) var mu sync.Mutex var count int func main() { log.Print("Server running...") http.HandleFunc("/", handler) http.HandleFunc("/count", counter) log.Fatal(http.ListenAndServe("localhost:8000", nil)) } func handler(w http.ResponseWriter, r *http.Request) { ...
Add counter, mutexes, and request echo to server.
Add counter, mutexes, and request echo to server.
Go
mit
jimlawton/gopl
ed994e1fe2ae37e6e5c9a8bff5db021af5e154ad
src/app/execution.go
src/app/execution.go
package app import ( "encoding/json" "fmt" "github.com/urfave/cli" "github.com/appPlant/alpinepass/src/filters" "github.com/appPlant/alpinepass/src/io" "github.com/appPlant/alpinepass/src/util" "github.com/appPlant/alpinepass/src/validation" ) //execute reads the input, filters it and writes the output. func...
package app import ( "encoding/json" "fmt" "github.com/urfave/cli" "github.com/appPlant/alpinepass/src/filters" "github.com/appPlant/alpinepass/src/io" "github.com/appPlant/alpinepass/src/util" "github.com/appPlant/alpinepass/src/validation" ) //execute reads the input, filters it and writes the output. func...
Allow skipping the validation with the -s flag
Allow skipping the validation with the -s flag
Go
apache-2.0
appPlant/alpinepass,appPlant/alpinepass
2ccc308efac8988744e595f759464c2bbcb92904
demos/main.go
demos/main.go
package main import ( "hagerbot.com/vox" "time" ) func main() { err := vox.Init("", 44100, 2, 0) if err != nil { panic(err) } defer vox.Quit() println(vox.Version) song, err := vox.Open("../data/songs/test.sunvox") if err != nil { panic(err) } defer song.C...
package main import ( "github.com/ajhager/vox" "time" ) func main() { err := vox.Init("", 44100, 2, 0) if err != nil { panic(err) } defer vox.Quit() println(vox.Version) song, err := vox.Open("../data/songs/test.sunvox") if err != nil { panic(err) } defer song.Close() println(song.Name()) song.Se...
Update demo to use new path
Update demo to use new path
Go
bsd-2-clause
ajhager/vox,ajhager/vox
dfc421824ce6c146ff9d9062ad25748c0f8c9990
pending-requests.go
pending-requests.go
package torrent import ( rbm "github.com/RoaringBitmap/roaring" roaring "github.com/RoaringBitmap/roaring/BitSliceIndexing" ) type pendingRequests struct { m *roaring.BSI } func (p *pendingRequests) Dec(r RequestIndex) { _r := uint64(r) prev, _ := p.m.GetValue(_r) if prev <= 0 { panic(prev) } p.m.SetValue(...
package torrent type pendingRequests struct { m []int } func (p *pendingRequests) Dec(r RequestIndex) { prev := p.m[r] if prev <= 0 { panic(prev) } p.m[r]-- } func (p *pendingRequests) Inc(r RequestIndex) { p.m[r]++ } func (p *pendingRequests) Init(maxIndex RequestIndex) { p.m = make([]int, maxIndex) } fu...
Use a flat slice for pending request counts
Use a flat slice for pending request counts Under heavy load, seems to be 2-3x faster.
Go
mpl-2.0
anacrolix/torrent,anacrolix/torrent
3cdef47ac75e0e12c2bf95e63ab8eb0d5012181d
exp/14/main.go
exp/14/main.go
package exp14 import ( . "gist.github.com/7480523.git" . "gist.github.com/7802150.git" "gist.github.com/8018045.git" ) type GoPackages struct { Entries []*GoPackage DepNode2 } func (this *GoPackages) Update() { // TODO: Have a source? // TODO: Make it load in background, without blocking, etc. { goPacka...
package exp14 import ( . "gist.github.com/7480523.git" . "gist.github.com/7802150.git" "gist.github.com/8018045.git" ) type GoPackages struct { SkipGoroot bool // Currently, works on initial run only; changing its value afterwards has no effect. Entries []*GoPackage DepNode2 } func (this *GoPackages) Update...
Add support to include/skip packages in GOROOT.
Add support to include/skip packages in GOROOT.
Go
mit
shurcooL/go
2276e12adf11903225eec3ee2b33c6195685eab0
lambdabinaryshims.go
lambdabinaryshims.go
// +build lambdabinary package sparta // Provides NOP implementations for functions that do not need to execute // in the Lambda context import ( "errors" "io" "github.com/Sirupsen/logrus" ) func Delete(serviceName string, logger *logrus.Logger) error { logger.Error("Delete() not supported in AWS Lambda binary...
// +build lambdabinary package sparta // Provides NOP implementations for functions that do not need to execute // in the Lambda context import ( "errors" "io" "github.com/Sirupsen/logrus" ) func Delete(serviceName string, logger *logrus.Logger) error { logger.Error("Delete() not supported in AWS Lambda binary...
Correct lambda execution `Explore` signature
Correct lambda execution `Explore` signature
Go
mit
mweagle/Sparta,mweagle/Sparta,mweagle/Sparta,mweagle/Sparta
2e145609dbccdae3f245b9699bab5d550de591c1
compat_go18.go
compat_go18.go
// +build go1.8 package avatica import ( "database/sql/driver" "fmt" ) type namedValue struct { Name string Ordinal int Value driver.Value } func driverValueToNamedValue(values []driver.Value) []namedValue { list := make([]namedValue, len(values)) for i, v := range values { list[i] = namedValue{ O...
package avatica import ( "database/sql/driver" "fmt" ) type namedValue struct { Name string Ordinal int Value driver.Value } func driverValueToNamedValue(values []driver.Value) []namedValue { list := make([]namedValue, len(values)) for i, v := range values { list[i] = namedValue{ Ordinal: i + 1, ...
Remove go 1.8 build tag for compatibility structs and constants
Remove go 1.8 build tag for compatibility structs and constants
Go
apache-2.0
Boostport/avatica,Boostport/avatica
094bc9c35b9711ea101138af9cd7cc4aa464b1f9
config_test.go
config_test.go
package aranGO // Configure to start testing var ( TestCollection = "" TestDoc DocTest TestDbName = "" TestUsername = "" TestPassword = "" TestString = "test string" verbose = false TestServer = "http://localhost:8529" s *Session ) // document to test type DocTest s...
package aranGO // Configure to start testing var ( TestCollection = "TestCollection" TestDoc DocTest TestDbName = "TestDbName" TestUsername = "TestUsername" TestPassword = "TestPassword" TestString = "test string" verbose = false TestServer = "http://localhost:8529" s ...
Add name to test objects to fix tests.
Add name to test objects to fix tests.
Go
apache-2.0
diegogub/aranGO
a6c9aa2d29e727ff0ea252a2040fd347e0c07e80
google_test.go
google_test.go
package jap import ( "testing" "golang.org/x/net/context" ) func TestGoogleHandlerPanicsWithoutCID(t *testing.T) { defer func() { if r := recover(); r == nil { t.Error("Expected GoogleLogin to panic if CID missing from context") } }() _ = GoogleLogin(context.Background(), nil) }
package jap import ( "testing" "golang.org/x/net/context" ) func TestGoogleHandlerPanicsWithoutCID(t *testing.T) { defer func() { if r := recover(); r == nil { t.Error("Expected GoogleLogin to panic if CID missing from context") } }() _ = GoogleLogin(context.Background(), nil) } func TestGoogleHandlerDo...
Add negative test for GoogleLogin panic behavior
Add negative test for GoogleLogin panic behavior
Go
bsd-2-clause
jitsi/jap,jitsi/jap
8badf487b1ac1a242d439285600eef79349f0944
form/types.go
form/types.go
package form type Type int const ( // <input type="text"> TEXT Type = iota + 1 // <input type="password"> PASSWORD // <input type="hidden"> HIDDEN // <textarea> TEXTAREA // <input type="checkbox"> CHECKBOX // <input type="radio"> RADIO // <select> SELECT )
package form type Type int const ( // <input type="text"> TEXT Type = iota + 1 // <input type="password"> PASSWORD // <input type="hidden"> HIDDEN // <textarea> TEXTAREA // <input type="checkbox"> CHECKBOX // <input type="radio"> RADIO // <select> SELECT ) // HasChoices returns wheter the type has mult...
Add HasChoices method to Type
Add HasChoices method to Type
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
341b0dbec1f637d27b52830c15d36f846c1db3e8
context.go
context.go
package chuper import ( "net/url" "github.com/PuerkitoBio/fetchbot" ) type Context struct { *fetchbot.Context C Cache } func (c *Context) SourceURL() *url.URL { switch cmd := c.Cmd.(type) { case Cmd: return cmd.SourceURL() } return nil }
package chuper import ( "net/url" "github.com/PuerkitoBio/fetchbot" ) type Context struct { *fetchbot.Context Cache Cache } func (c *Context) SourceURL() *url.URL { switch cmd := c.Cmd.(type) { case Cmd: return cmd.SourceURL() default: return nil } }
Rename Context field C to Cache
Rename Context field C to Cache
Go
bsd-3-clause
sluceno/chuper,oli-g/chuper
9cdd2bae74534668c45e561bd266a2518bcf9c3c
goluago.go
goluago.go
package goluago import ( "github.com/Shopify/go-lua" "github.com/Shopify/goluago/encoding/json" "github.com/Shopify/goluago/regexp" "github.com/Shopify/goluago/strings" ) func Open(l *lua.State) { regexp.Open(l) strings.Open(l) json.Open(l) }
package goluago import ( "github.com/Shopify/go-lua" "github.com/Shopify/goluago/encoding/json" "github.com/Shopify/goluago/regexp" "github.com/Shopify/goluago/strings" "github.com/Shopify/goluago/time" ) func Open(l *lua.State) { regexp.Open(l) strings.Open(l) json.Open(l) time.Open(l) }
Add time to the catchall Open.
Add time to the catchall Open.
Go
mit
Shopify/goluago,Shopify/goluago
f0ea8147f57c810e8bfe32d3a7e103d1e333d8bb
imageserver/rpcd/getImage.go
imageserver/rpcd/getImage.go
package rpcd import ( "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/imageserver" ) func (t *srpcType) GetImage(conn *srpc.Conn, request imageserver.GetImageRequest, reply *imageserver.GetImageResponse) error { var response imageserver.GetImageResponse response.Image = t.imageData...
package rpcd import ( "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/imageserver" "time" ) func (t *srpcType) GetImage(conn *srpc.Conn, request imageserver.GetImageRequest, reply *imageserver.GetImageResponse) error { var response imageserver.GetImageResponse response.Image = t.i...
Add timeout support to ImageServer.GetImage SRPC method.
Add timeout support to ImageServer.GetImage SRPC method.
Go
apache-2.0
rgooch/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator
026ef6da6aa58df7488c8a374c979926554445ba
gpsutil.go
gpsutil.go
package gpsutil import ( "math" ) type LatLng struct { lat float64 lng float64 } func (latlng *LatLng) Lat() float64 { return latlng.lat } func (latlng *LatLng) Lng() float64 { return latlng.lng } type GeohashDecoded struct { lat float64 lng float64 err struct { lat float64 lgn float64 } } type BBox ...
package gpsutil import ( "math" ) type LatLng struct { lat float64 lng float64 } func (latlng *LatLng) Lat() float64 { return latlng.lat } func (latlng *LatLng) Lng() float64 { return latlng.lng } type GeohashDecoded struct { lat float64 lng float64 latErr float64 lgnErr float64 } func (ghd *Geohas...
Redefine BBox and GeohashDecoded type
Redefine BBox and GeohashDecoded type
Go
mit
vanng822/gpsutil
1db70d420169efbde41b768ca8a4d24ec2162ac1
utils/buffer.go
utils/buffer.go
package utils import ( "bytes" ) // ClosingBuffer implement Closer interface for Buffer type ClosingBuffer struct { *bytes.Buffer } // Close implement Closer interface for Buffer func (ClosingBuffer) Close() error { return nil }
package utils import "io" // ClosingReadSeeker implement Closer interface for ReadSeeker type ClosingReadSeeker struct { io.ReadSeeker } // Close implement Closer interface for Buffer func (ClosingReadSeeker) Close() error { return nil }
Apply Close method for ReadSeeker
Apply Close method for ReadSeeker
Go
mit
qor/qor,qor/qor,qor/qor
cd5de9eb93772540bc8d72de87c1b5883c3d0460
direct_io_darwin.go
direct_io_darwin.go
// Direct IO for darwin package main import ( "fmt" "os" "syscall" ) const ( // OSX doesn't need any alignment AlignSize = 0 ) func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, err error) { file, err = os.OpenFile(name, flag, perm) if err != nil { return } // Set F_NOCACHE to avoid ...
// Direct IO for darwin package main import ( "fmt" "os" "syscall" ) const ( // OSX doesn't need any alignment AlignSize = 0 ) func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, err error) { file, err = os.OpenFile(name, flag, perm) if err != nil { return } // Set F_NOCACHE to avoid ...
Fix OSX build and incorrect treatment of errors from Syscall
Fix OSX build and incorrect treatment of errors from Syscall
Go
mit
ncw/stressdisk
7ec75cab4de3ebcae40b90076b893b74bd08e3da
gospel_test.go
gospel_test.go
package gospel import "testing" func TestDescribe(t *testing.T) { Describe(t, "gospel.Expectation#ToEqual", func(context Context, it It) { context("with 1 & 1", func() { it("compares integers by ==", func(expect Expect) { expect(1).ToEqual(1) }) }) context("with `1` & `1`", func() { it("compares s...
package gospel import "testing" func TestDescribe(t *testing.T) { Describe(t, "gospel.Expectation#ToEqual", func(context Context, it It) { context("with 1 & 1", func() { it("compares integers by ==", func(expect Expect) { expect(1).ToEqual(1) }) }) context("with `1` & `1`", func() { it("compares s...
Add tests about ToExist() & ToNotExist()
Add tests about ToExist() & ToNotExist()
Go
mit
r7kamura/gospel
4cc944bb3ac0e56e31524943e51afc0c6349ea76
generate_bot.go
generate_bot.go
package twitterbot import ( "fmt" "time" "github.com/ChimeraCoder/anaconda" ) type TBot struct { api *anaconda.TwitterApi keys *Keys } func New(config string) (*TBot, error) { keys, err := ReadConfig(config) if err != nil { return nil, err } anaconda.SetConsumerKey(keys.consumerPublic) anaconda.SetCon...
package twitterbot import ( "fmt" "time" "github.com/ChimeraCoder/anaconda" ) type TBot struct { api *anaconda.TwitterApi } func New(config string) (*TBot, error) { keys, err := ReadConfig(config) if err != nil { return nil, err } anaconda.SetConsumerKey(keys.consumerPublic) anaconda.SetConsumerSecret(...
Remove `keys` from the TBot struct.
Remove `keys` from the TBot struct. The keys struct is not needed after we have initialized the bot.
Go
mit
timwilkens/twitterbot
d97eec611f2048911f229909ea6d49c22ca6d035
modules/fs/fs_test.go
modules/fs/fs_test.go
package fs import ( "testing" "github.com/robertkrimen/otto" ) func TestFS(t *testing.T) { vm := otto.New() vm.Set("error", func(call otto.FunctionCall) otto.Value { name, _ := call.Argument(0).ToString() t.Error(name) return otto.UndefinedValue() }) vm.Set("FS", NewFS(vm)) var fsTest = ` try{ // Open a...
package fs import ( "testing" "github.com/robertkrimen/otto" ) func TestFS(t *testing.T) { vm := otto.New() vm.Set("error", func(call otto.FunctionCall) otto.Value { name, _ := call.Argument(0).ToString() t.Error(name) return otto.UndefinedValue() }) vm.Set("FS", NewFS(vm)) var fsTest = ` try{ // Open a...
Update test for fs module
Update test for fs module
Go
mit
gernest/wuxia,gernest/wuxia,gernest/wuxia,gernest/wuxia
6af6e599525d539aa15564e37dae2da9534286b7
src/functorama.com/demo/libgodelbrot/redscale.go
src/functorama.com/demo/libgodelbrot/redscale.go
package libgodelbrot type RedscalePalette CachePalette func NewRedscalePalette(iterateLimit uint8) RedscalePalette { return NewCachePalette(iterateLimit, &redscaleCacher) } // Cache redscale colour values func redscaleCacher(limit uint8, index uint8) color.NRGBA { return color.NRGBA{ R: limit - ind...
package libgodelbrot type RedscalePalette CachePalette func NewRedscalePalette(iterateLimit uint8) RedscalePalette { return NewCachePalette(iterateLimit, &redscaleCacher) } // Cache redscale colour values func redscaleCacher(limit uint8, index uint8) color.NRGBA { return color.NRGBA{ R: index * (25...
Move up scale increments of intensity max / limit
Move up scale increments of intensity max / limit
Go
mit
johnny-morrice/webdelbrot-static,johnny-morrice/webdelbrot,johnny-morrice/godelbrot,johnny-morrice/webdelbrot,johnny-morrice/webdelbrot-static
273a3770eb2085336d65a2584b5d792a3493016c
pkg/stripper/comments_example_test.go
pkg/stripper/comments_example_test.go
package stripper_test import ( "io" "os" "strings" "github.com/docker-library/go-dockerlibrary/pkg/stripper" ) func ExampleCommentStripper() { r := strings.NewReader(` # opening comment a: b # comment! c: d # not a comment # another cheeky comment e: f `) comStrip := stripper.NewCommentStripper(r) io.Copy(...
package stripper_test import ( "io" "os" "strings" "github.com/docker-library/go-dockerlibrary/pkg/stripper" ) func ExampleCommentStripper() { r := strings.NewReader(` # opening comment a: b # comment! c: d # not a comment # another cheeky comment e: f `) comStrip := stripper.NewCommentStripper(r) // using...
Update "pkg/stripper" coverage to 100% with a smaller buffer size
Update "pkg/stripper" coverage to 100% with a smaller buffer size
Go
apache-2.0
docker-library/go-dockerlibrary
7f8ab450a5fc5a210bdfa4eb54ac1735e3d1a4c1
pkg/daemon/activate_test.go
pkg/daemon/activate_test.go
package daemon import ( "io" "testing" "src.elv.sh/pkg/daemon/daemondefs" "src.elv.sh/pkg/testutil" ) func TestActivate_WhenServerExists(t *testing.T) { setup(t) startServer(t) _, err := Activate(io.Discard, &daemondefs.SpawnConfig{DbPath: "db", SockPath: "sock", RunDir: "."}) if err != nil { t.Errorf("g...
package daemon import ( "io" "testing" "src.elv.sh/pkg/daemon/daemondefs" "src.elv.sh/pkg/testutil" ) func TestActivate_WhenServerExists(t *testing.T) { setup(t) startServer(t) _, err := Activate(io.Discard, &daemondefs.SpawnConfig{DbPath: "db", SockPath: "sock", RunDir: "."}) if err != nil { t.Errorf("g...
Disable test that may have inadvertently triggered daemon spawning.
Disable test that may have inadvertently triggered daemon spawning.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
4b0c210cef50437844302f2a98292c68793a1144
integration-test/actors/boshcli.go
integration-test/actors/boshcli.go
package actors import ( "fmt" "os/exec" ) type BOSHCLI struct{} func NewBOSHCLI() BOSHCLI { return BOSHCLI{} } func (BOSHCLI) DirectorExists(address, caCertPath string) (bool, error) { _, err := exec.Command("bosh", "--ca-cert", caCertPath, "-e", address, "env", ).Output() return err == nil, err } fun...
package actors import ( "fmt" "os/exec" ) type BOSHCLI struct{} func NewBOSHCLI() BOSHCLI { return BOSHCLI{} } func (BOSHCLI) DirectorExists(address, caCertPath string) (bool, error) { _, err := exec.Command("bosh", "--ca-cert", caCertPath, "-e", address, "env", ).Output() return err == nil, err } fun...
Use new bosh cli flags in integration tests
Use new bosh cli flags in integration tests [#137733131] Signed-off-by: Rizwan Reza <7bb171e28cf6d8766fe0bf45299a778734390391@pivotal.io>
Go
apache-2.0
niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader
c60f4f5c4be6769f1cdbf05712d295bc9238ccdb
model/const.go
model/const.go
package model const ( EventPush = "push" EventPull = "pull_request" EventTag = "tag" EventDeploy = "deployment" ) const ( StatusSkipped = "skipped" StatusPending = "pending" StatusRunning = "running" StatusSuccess = "success" StatusFailure = "failure" StatusKilled = "killed" StatusError = "error"...
package model const ( EventPush = "push" EventPull = "pull_request" EventTag = "tag" EventDeploy = "deployment" EventBranch = "branch" ) const ( StatusSkipped = "skipped" StatusPending = "pending" StatusRunning = "running" StatusSuccess = "success" StatusFailure = "failure" StatusKilled = "killed" ...
Manage TAG and BRANCH events sent from gogs
Manage TAG and BRANCH events sent from gogs
Go
apache-2.0
vaijab/drone,masarakki/drone,bsauvajon/drone,vtolstov/drone,donatj/drone,donatj/drone,masarakki/drone,NamPNQ/drone,carnivalmobile/drone,vaijab/drone,NamPNQ/drone,donatj/drone,bsauvajon/drone,vtolstov/drone,lins05/drone,veghead/drone,carnivalmobile/drone,veghead/drone,carnivalmobile/drone,lins05/drone
1b6a07ca98ce4b6630a1a8fca288aac9837345c5
rsa.go
rsa.go
package cryptopals import "math/big" type privateKey struct { e *big.Int n *big.Int d *big.Int } type publicKey struct { e *big.Int n *big.Int } func generateRsaPrivateKey(bits int) *privateKey { p := randPrime(bits / 2) q := randPrime(bits / 2) e := big.NewInt(3) n := new(big.Int).Mul(p, q) t1 := new(b...
package cryptopals import "math/big" type privateKey struct { e *big.Int n *big.Int d *big.Int } type publicKey struct { e *big.Int n *big.Int } func generateRsaPrivateKey(bits int) *privateKey { e := big.NewInt(3) for { p := randPrime(bits / 2) t1 := new(big.Int).Sub(p, big.NewInt(1)) if new(big.Int...
Fix RSA bug where check if t was divisible by e was missing
Fix RSA bug where check if t was divisible by e was missing
Go
mit
Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go
0bf0ec4ab65777753fb87d3dc3cdf4204349e84d
nimble/Color.go
nimble/Color.go
package nimble type Pixel uint32 const ( alphaShift = 24 redShift = 16 greenShift = 8 blueShift = 0 ) func component(c float32) Pixel { return Pixel(c*255 + (0.5 - 1.0/256)) } // RGB constructs a Pixel from its red, green, and blue components. func RGB(red float32, green float32, blue float32) Pixel { ret...
package nimble type Pixel uint32 const ( alphaShift = 24 redShift = 16 greenShift = 8 blueShift = 0 ) func component(c float32) Pixel { return Pixel(c*255 + (0.5 - 1.0/256)) } // RGB constructs a Pixel from its red, green, and blue components. func RGB(red float32, green float32, blue float32) Pixel { ret...
Add Black and White constants.
Add Black and White constants.
Go
apache-2.0
ArchRobison/Gophetica
0cb149b277c07799fee1a5d38d633cba772ea9d4
sentry/import_sentry_team.go
sentry/import_sentry_team.go
package sentry import ( "errors" "log" "strings" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceSentryTeamImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { addrID := d.Id() log.Printf("[DEBUG] Importing key using ADDR ID %s", addrID) parts := string...
package sentry import ( "errors" "log" "strings" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceSentryTeamImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { addrID := d.Id() log.Printf("[DEBUG] Importing key using ADDR ID %s", addrID) parts := string...
Fix wrong wording in error msg on import team
Fix wrong wording in error msg on import team The copy-pasta was just a little too saucy.
Go
mit
jianyuan/terraform-provider-sentry
e37dbfeeb30815fe82b51c633097e1d62bbed874
integration/_fixtures/coverage_fixture/coverage.go
integration/_fixtures/coverage_fixture/coverage.go
package coverage_fixture func A() string { return "A" } func B() string { return "B" } func C() string { return "C" } func D() string { return "D" } func E() string { return "untested" }
package coverage_fixture import ( _ "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture" ) func A() string { return "A" } func B() string { return "B" } func C() string { return "C" } func D() string { return "D" } func E() string { return "untested" }
Update fixtures to work using go1.10
Update fixtures to work using go1.10 In go 1.10 the `-coverpkg` flag does not load new packages, but allow users to provide a list of patterns (see https://golang.org/doc/go1.10#test). For this reason, we need to import the package in the fixture.
Go
mit
onsi/ginkgo,onsi/ginkgo
77c0614b21649263e59a5bd61d60ebdcf75dc16d
misc_test.go
misc_test.go
package gofakeit import "testing" func TestRandIntRange(t *testing.T) { if randIntRange(5, 5) != 5 { t.Error("You should have gotten 5 back") } } func TestGetRandValueFail(t *testing.T) { if getRandValue([]string{"not", "found"}) != "" { t.Error("You should have gotten no value back") } } func TestRandFloat...
package gofakeit import "testing" func TestRandIntRange(t *testing.T) { if randIntRange(5, 5) != 5 { t.Error("You should have gotten 5 back") } } func TestGetRandValueFail(t *testing.T) { if getRandValue([]string{"not", "found"}) != "" { t.Error("You should have gotten no value back") } } func TestGetRandIn...
Add a testcase for a new misc function
Add a testcase for a new misc function
Go
mit
brianvoe/gofakeit
cf147b5746d4d323fbca2ffb3bf479965146b754
client_test.go
client_test.go
package mayaclient import "testing" func TestMayaClient(t *testing.T) { instanceID := "\"any-compute\"" c := Client{URL: "http://127.0.0.1:5656/latest/meta-data/instance-id"} response := c.MayaClient() if response != instanceID { t.Error("Expected response ", instanceID, " got ", response) } }
package mayaclient import "testing" func TestMayaClient(t *testing.T) { instanceID := "\"any-compute\"" c := Client{URL: "http://127.0.0.1:5656/latest/meta-data/instance-id"} response := c.MayaClient() if response != instanceID { t.Error("Expected response ", instanceID, " got ", response) } }
Format go files using gofmt
Format go files using gofmt
Go
apache-2.0
satyamz/mayaclient
af76da8fca7f8a0f80f7b6f54d64362ab2415b43
sysinfo.go
sysinfo.go
// Copyright © 2016 Zlatko Čalušić // // Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. // Package sysinfo is a pure Go library providing Linux OS / kernel / hardware system information. package sysinfo // SysInfo struct encapsulates all other information structs. t...
// Copyright © 2016 Zlatko Čalušić // // Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. // Package sysinfo is a pure Go library providing Linux OS / kernel / hardware system information. package sysinfo // SysInfo struct encapsulates all other information structs. t...
Use omitempty tag for storage & network arrays
Use omitempty tag for storage & network arrays
Go
mit
zcalusic/sysinfo
cb9d4254409a81f9520f9aab90acd7ced2d2f25d
process/main.go
process/main.go
package main import ( "flag" "fmt" ) var UniqueId string var heartbeatChan chan bool func processCommandLineArguments() (int, int, error) { var hostId = flag.Int("hostId", 0, "The unique id for the host.") var port = flag.Int("port", 0, "The per-host unique port") flag.Parse() if *hostId == 0 || *port == 0 {...
package main import ( "flag" "fmt" "log" ) var UniqueId string var heartbeatChan chan bool func processCommandLineArguments() (int, int, error) { var hostId = flag.Int("hostId", 0, "The unique id for the host.") var port = flag.Int("port", 0, "The per-host unique port") flag.Parse() if *hostId == 0 || *port...
Make sure we are part of the config.
Make sure we are part of the config.
Go
isc
pooya/craft
743ec61addb8426bf8692a5c63c830c393bd5f12
src/matrix/matrix.go
src/matrix/matrix.go
package matrix import "point" type Matrix [8][8]byte var starting = Matrix{ {'r', 'n', 'b', 'k', 'q', 'b', 'n', 'r'}, {'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ',...
package matrix import "point" type Matrix [8][8]byte var starting = Matrix{ {'r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'}, {'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ',...
Fix swapped king and queen
Fix swapped king and queen
Go
mit
Roadagain/Chess
a0cb02c4ea2aee903bad6b7762887e1830337e77
doc.go
doc.go
// Copyright 2011 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The uuid package generates and inspects UUIDs. // // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services. // // This package is a part...
// Copyright 2011 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The uuid package generates and inspects UUIDs. // // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security // Services. // // This package is a p...
Fix up formatting of comment.
Fix up formatting of comment.
Go
bsd-3-clause
yxd-hde/uuid,pborman/uuid
e426c2fd3d932a3fe6cbc5d054c46d73e6eefe02
go/pig-latin/pig_latin.go
go/pig-latin/pig_latin.go
package piglatin import "strings" func Sentence(sentence string) string { if startsWithVowel(sentence) || strings.HasPrefix(sentence, "xr") || strings.HasPrefix(sentence, "yt") { return sentence + "ay" } return sentence } func startsWithVowel(sentence string) bool { return strings.HasPrefix(sentence, "a") ...
package piglatin import "strings" func Sentence(sentence string) string { if startsWithVowel(sentence) || strings.HasPrefix(sentence, "xr") || strings.HasPrefix(sentence, "yt") { return sentence + "ay" } if strings.HasPrefix(sentence, "p") { return strings.TrimPrefix(sentence, "p") + "p" + "ay" } return...
Implement rule 2 for p
Implement rule 2 for p
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
2252004e8c6c3fa3bdeb3dfdbda671f4f4e6a7b7
pkg/util/timeout.go
pkg/util/timeout.go
package util import ( "fmt" "time" ) // TimeoutError is error returned after timeout occured. type TimeoutError struct { after time.Duration } // Error implements the Go error interface. func (t *TimeoutError) Error() string { return fmt.Sprintf("calling the function timeout after %v", t.after) } // TimeoutAfte...
package util import ( "fmt" "time" ) // TimeoutError is error returned after timeout occured. type TimeoutError struct { after time.Duration } // Error implements the Go error interface. func (t *TimeoutError) Error() string { return fmt.Sprintf("calling the function timeout after %v", t.after) } // TimeoutAfte...
Revert "Fix potential panic in TimeoutAfter"
Revert "Fix potential panic in TimeoutAfter" This reverts commit 74a86c1b5e13feab29a7b1c4ed10e62d33109f42.
Go
apache-2.0
mfojtik/source-to-image,guangxuli/source-to-image,php-coder/source-to-image,liggitt/source-to-image,shrutikamendhe/source-to-image,gabemontero/source-to-image,bparees/source-to-image,liggitt/source-to-image,openshift/source-to-image,rhcarvalho/source-to-image,PI-Victor/source-to-image,guangxuli/source-to-image,php-code...
ea6091c031f366da49f1357136357956e7008e42
errors.go
errors.go
package plist // #include <CoreFoundation/CoreFoundation.h> import "C" import "reflect" import "strconv" // An UnsupportedTypeError is returned by Marshal when attempting to encode an // unsupported value type. type UnsupportedTypeError struct { Type reflect.Type } func (e *UnsupportedTypeError) Error() string { r...
package plist // #include <CoreFoundation/CoreFoundation.h> import "C" import "reflect" import "strconv" // An UnsupportedTypeError is returned by Marshal when attempting to encode an // unsupported value type. type UnsupportedTypeError struct { Type reflect.Type } func (e *UnsupportedTypeError) Error() string { r...
Update UnknownCFTypeError to print the type name
Update UnknownCFTypeError to print the type name
Go
bsd-3-clause
kballard/go-osx-plist
d8c31c9199e354c0af050736836af6ca765f2ee5
schemas/schemas.go
schemas/schemas.go
package schemas // This method takes the topic name as a parameter // and determines the struct to return as a schema. func IdentifySchema(topicName string) interface{} { switch topicName { case "tx-closed": return &TxClosed{} case "document-generation-started": return &DocumentGeneration...
package schemas // This method takes the topic name as a parameter // and determines the struct to return as a schema. func IdentifySchema(topicName string) interface{} { switch topicName { case "tx-closed": return &TxClosed{} case "document-generation-started": return &DocumentGeneration...
Add filing-procesed to switch case
Add filing-procesed to switch case
Go
mit
companieshouse/kafka-management-tool
768abf16229eb021af66f57739880a62367101b0
src/lib/ast/output.go
src/lib/ast/output.go
package ast type Output struct { expr interface{} } func NewOutput(expr interface{}) Output { return Output{expr} } func (o Output) Expr() interface{} { return o.expr }
package ast type Output struct { expr interface{} expanded bool } func NewOutput(expr interface{}, expanded bool) Output { return Output{expr, expanded} } func (o Output) Expr() interface{} { return o.expr }
Add expanded property to Output
Add expanded property to Output
Go
mit
raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp
4f2765c68f306c9f95afb59ff65a471ae1c8eb20
cmd/apid/main.go
cmd/apid/main.go
package main import ( // import plugins to ensure they're bound into the executable _ "github.com/30x/apidApigeeSync" _ "github.com/30x/apidVerifyAPIKey" _ "github.com/30x/apidGatewayDeploy" // other imports "github.com/30x/apid" "github.com/30x/apid/factory" "flag" "os" ) func main() { configFlag := flag....
package main import ( // import plugins to ensure they're bound into the executable _ "github.com/30x/apidApigeeSync" //_ "github.com/30x/apidVerifyAPIKey" _ "github.com/30x/apidGatewayDeploy" // other imports "github.com/30x/apid" "github.com/30x/apid/factory" "flag" "os" ) func main() { configFlag := fla...
Add a -clean flag to the cmd
Add a -clean flag to the cmd
Go
apache-2.0
apid/apid,apid/apid,apid/apid-core,apid/apid-core,apid/apid
67719d691d596688fc606d189469ecece5e5e690
api/server/routes_delete.go
api/server/routes_delete.go
package server import ( "context" "net/http" "path" "github.com/gin-gonic/gin" "gitlab-odx.oracle.com/odx/functions/api" ) func (s *Server) handleRouteDelete(c *gin.Context) { ctx := c.MustGet("ctx").(context.Context) appName := c.MustGet(api.AppName).(string) routePath := path.Clean(c.MustGet(api.Path).(st...
package server import ( "context" "net/http" "path" "github.com/gin-gonic/gin" "gitlab-odx.oracle.com/odx/functions/api" ) func (s *Server) handleRouteDelete(c *gin.Context) { ctx := c.MustGet("ctx").(context.Context) appName := c.MustGet(api.AppName).(string) routePath := path.Clean(c.MustGet(api.Path).(st...
Check if route exist before attempting to delete it
Check if route exist before attempting to delete it xFixes: #76
Go
apache-2.0
fnproject/fn,fnproject/fn,fnproject/fn
2c333be0f110c91c4ea4e849c9844de7fe3ae2f5
consts/consts.go
consts/consts.go
/*Package consts implements constants for the entire project */ package consts const DefaultUserName = "Thor" // VisibleFlag is the constant given for a visible repository const VisibleFlag = "VISIBLE" // HiddenFlag is the constant given for an hidden repository const HiddenFlag = "HIDDEN" // ConfigurationFileName...
/*Package consts implements constants for the entire project */ package consts // DefaultUserName is a constant to define a new user, if the // user local name can't be found const DefaultUserName = "Thor" // VisibleFlag is the constant given for a visible repository const VisibleFlag = "VISIBLE" // HiddenFlag is t...
Add comment and remove code
Add comment and remove code
Go
mit
k0pernicus/goyave
3043285bae5f621c7b92ea5ccad619590d271867
consumer_pool.go
consumer_pool.go
package beanstalk import "sync" // ConsumerPool maintains a pool of Consumer objects. type ConsumerPool struct { C chan *Job consumers []*Consumer sync.Mutex } // NewConsumerPool creates a pool of Consumer objects. func NewConsumerPool(sockets []string, tubes []string, options *Options) *ConsumerPool { p...
package beanstalk import "sync" // ConsumerPool maintains a pool of Consumer objects. type ConsumerPool struct { // The channel on which newly reserved jobs are offered. C <-chan *Job c chan *Job consumers []*Consumer sync.Mutex } // NewConsumerPool creates a pool of Consumer objects. func NewConsumerP...
Change the exposed channel to receive-only
Change the exposed channel to receive-only
Go
bsd-3-clause
prep/beanstalk
7adf477e2d5ca17a04b47f66b335dc94b5ff3665
ql/test/query-tests/Security/CWE-079/ReflectedXssGood.go
ql/test/query-tests/Security/CWE-079/ReflectedXssGood.go
package main import ( "fmt" "html" "net/http" ) func serve1() { http.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { r.ParseForm() username := r.Form.Get("username") if !isValidUsername(username) { // BAD: a request parameter is incorporated without validation into the response fmt....
package main import ( "fmt" "html" "net/http" ) func serve1() { http.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { r.ParseForm() username := r.Form.Get("username") if !isValidUsername(username) { // GOOD: a request parameter is escaped before being put into the response fmt.Fprint...
Update bad / good message for CWE 079
Update bad / good message for CWE 079 Previously, the "good" example still had the "BAD: " comment in it which was confusing. This change updates the good example to have a "GOOD: " comment instead.
Go
mit
github/codeql,github/codeql-go,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go
e8881d28fe3257f651c6a42902924840ca5e8607
monitor/bin/avamon-poll/main.go
monitor/bin/avamon-poll/main.go
package main import ( "flag" "fmt" "time" "github.com/yamnikov-oleg/avamon-bot/monitor" ) func main() { timeout := flag.Duration("timeout", 3*time.Second, "Timeout for network request") flag.Parse() poller := monitor.NewPoller() poller.Timeout = *timeout urls := flag.Args() for _, url := range urls { ...
package main import ( "flag" "fmt" "time" "github.com/yamnikov-oleg/avamon-bot/monitor" ) func main() { timeout := flag.Duration("timeout", 3*time.Second, "Timeout for network request") flag.Parse() poller := monitor.NewPoller() poller.Timeout = *timeout urls := flag.Args() for _, url := range urls { ...
Make avamon-poll command print expanded statuses
:wrench: Make avamon-poll command print expanded statuses
Go
mit
yamnikov-oleg/avamon-bot,yamnikov-oleg/avamon-bot
bae1161b3393b1b4aa87527bc2adb88f933410f2
src/bb/buildinit.go
src/bb/buildinit.go
package main import ( "log" "os" "os/exec" "path" ) func buildinit() { e := os.Environ() for i := range e { if e[i][0:6] == "GOPATH" { e[i] = e[i] + ":" + path.Join(config.Uroot, "src/bb/bbsh") } } cmd := exec.Command("go", "build", "-o", "init", ".") cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout c...
package main import ( "log" "os" "os/exec" "path" ) func buildinit() { e := os.Environ() for i := range e { if e[i][0:6] == "GOPATH" { e[i] = e[i] + ":" + path.Join(config.Uroot, "src/bb/bbsh") } } e = append(e, "CGO_ENABLED=0") cmd := exec.Command("go", "build", "-o", "init", ".") cmd.Stderr = os.S...
Make sure CGO_ENABLED is 0
Make sure CGO_ENABLED is 0 Signed-off-by: Ronald G. Minnich <f569d0af9a3481c4007b95c7180d6c41009f2513@gmail.com>
Go
bsd-3-clause
rminnich/u-root,GanShun/u-root,hugelgupf/u-root,rminnich/u-root,u-root/u-root,hugelgupf/u-root,hugelgupf/u-root,hugelgupf/u-root,u-root/u-root,GanShun/u-root,GanShun/u-root,u-root/u-root,rminnich/u-root,rminnich/u-root
e3dd8d343a8a6cd96dfc6fd9c794bae8ea0b833f
v23/cmd.go
v23/cmd.go
// Copyright 2015 The Vanadium 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 FILE IS DEPRECATED!!! // Please edit the new "jiri" tool in release/go/src/v.io/jiri. package main import ( "os" "os/exec" ) // main calls "j...
// Copyright 2015 The Vanadium 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 FILE IS DEPRECATED!!! // Please edit the new "jiri" tool in release/go/src/v.io/jiri. package main import ( "fmt" "os" "os/exec" "strings" ...
Add deprecation notice for v23 tool.
devtools/v23: Add deprecation notice for v23 tool. Change-Id: I2525ff0d6c4b1f07296070f54d8dd040e7ed18a0
Go
bsd-3-clause
vanadium/go.devtools,vanadium/go.devtools,vanadium/go.devtools
74023cdb8a3fda1f02405d2a7bed29204c174425
webapp/main.go
webapp/main.go
// Copyright 2017 The WPT Dashboard Project. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package webapp import ( "html/template" "net/http" ) var templates = template.Must(template.ParseGlob("templates/*.html")) func init() { http.H...
// Copyright 2017 The WPT Dashboard Project. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package webapp import ( "html/template" "net/http" ) var templates = template.Must(template.ParseGlob("templates/*.html")) func init() { // Tes...
Add some comments to the wpt.fyi paths
Add some comments to the wpt.fyi paths Improves documentation of the endpoints that exist in the one place that they're exhaustively listed.
Go
apache-2.0
GoogleChrome/wptdashboard,GoogleChrome/wptdashboard,GoogleChrome/wptdashboard
e144c966cab7ef8d4945c47bf6c03899b6f9c553
composition/cache_invalidation_handler_test.go
composition/cache_invalidation_handler_test.go
package composition import ( "github.com/golang/mock/gomock" mockhttp "github.com/tarent/lib-compose/composition/mocks/net/http" "net/http" "testing" ) func Test_CacheInvalidationHandler_Invalidation(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() //given cacheMocK := NewMockCache(ctrl) ...
package composition import ( "github.com/golang/mock/gomock" mockhttp "github.com/tarent/lib-compose/composition/mocks/net/http" "net/http" "testing" ) func Test_CacheInvalidationHandler_Invalidation(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() //given cacheMocK := NewMockCache(ctrl) ...
Change unit tests for cache invalidation handler to include the constructor
Change unit tests for cache invalidation handler to include the constructor
Go
mit
tarent/lib-compose,tarent/lib-compose,tarent/lib-compose
4c9fe1bade31c0a9ba3e35ddaf81613de97dbbdf
vertical-pod-autoscaler/pkg/admission-controller/certs.go
vertical-pod-autoscaler/pkg/admission-controller/certs.go
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Use ioutil for certificate file reading.
Use ioutil for certificate file reading. Currently we read certificate files into a buffer of 5000 bytes. This sets a max size for our certificates; above this max, we will get invalid certs, most likely, leading to runtime bad certificate errors.
Go
apache-2.0
bskiba/autoscaler,mmerrill3/autoscaler,kubernetes/autoscaler,mmerrill3/autoscaler,mmerrill3/autoscaler,mmerrill3/autoscaler,kubernetes/autoscaler,bskiba/autoscaler,bskiba/autoscaler,kubernetes/autoscaler,kubernetes/autoscaler
7660839973a483007ceed9f0f137f5f3b0f79c31
provider/lxd/lxdclient/utils.go
provider/lxd/lxdclient/utils.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build go1.3 package lxdclient import ( "bytes" ) type closingBuffer struct { bytes.Buffer } // Close implements io.Closer. func (closingBuffer) Close() error { return nil }
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build go1.3 package lxdclient import ( "bytes" "github.com/juju/errors" "github.com/juju/utils/series" "github.com/juju/juju/service" "github.com/juju/juju/service/common" ) type closingBuffer struct { bytes.Buf...
Add IsInstalledLocally and IsRunningLocally lxdclient helpers.
Add IsInstalledLocally and IsRunningLocally lxdclient helpers.
Go
agpl-3.0
dimitern/juju,wwitzel3/juju,dimitern/juju,bz2/juju,macgreagoir/juju,perrito666/juju,wwitzel3/juju,gabriel-samfira/juju,waigani/juju,marcmolla/juju,bz2/juju,gabriel-samfira/juju,reedobrien/juju,ericsnowcurrently/juju,dooferlad/juju,frankban/juju,marcmolla/juju,mjs/juju,AdamIsrael/juju,dooferlad/juju,perrito666/juju,mjs/...
cbbb5a3dce743d72399a1dc49630090a55e1b0d4
cc_messages/lrp_instance.go
cc_messages/lrp_instance.go
package cc_messages import "time" type LRPInstanceState string const ( LRPInstanceStateStarting LRPInstanceState = "STARTING" LRPInstanceStateRunning LRPInstanceState = "RUNNING" LRPInstanceStateCrashed LRPInstanceState = "CRASHED" LRPInstanceStateUnknown LRPInstanceState = "UNKNOWN" ) type LRPInstance struc...
package cc_messages import "time" type LRPInstanceState string const ( LRPInstanceStateStarting LRPInstanceState = "STARTING" LRPInstanceStateRunning LRPInstanceState = "RUNNING" LRPInstanceStateCrashed LRPInstanceState = "CRASHED" LRPInstanceStateUnknown LRPInstanceState = "UNKNOWN" ) type LRPInstance struc...
Add Since to LRPInstance struct
Add Since to LRPInstance struct [#97600328]
Go
apache-2.0
cloudfoundry-incubator/runtime-schema
526e8d765a8fcaed0241be65b95bd757aa061fd6
main.go
main.go
package main import ( "flag" "log" "net/http" "net/url" "strings" "text/template" "github.com/rollbrettler/daily-stars/stars" ) var port string func init() { flag.StringVar(&port, "port", ":8001", "Port to listen on") } func main() { flag.Parse() http.HandleFunc("/", showStar) fs := http.FileServer(htt...
package main import ( "flag" "log" "net/http" "net/url" "os" "strings" "text/template" "github.com/rollbrettler/daily-stars/stars" ) var port string func init() { flag.StringVar(&port, "port", ":8001", "Port to listen on") } func main() { flag.Parse() envPort := os.Getenv("PORT") if envPort != "" { ...
Add posibility to use env variable for the port
Add posibility to use env variable for the port
Go
mit
rollbrettler/daily-stars
b33c088d266fd972a090029bb12d1509b1507d93
main.go
main.go
package main import "os" func main() { parser := NewParser() var err error if len(os.Args) < 2 { err = parser.ParseInput() } else { err = parser.ParseFile(os.Args[1]) } if err != nil { panic(err) } }
package main import ( "fmt" "os" ) func main() { parser := NewParser() var err error if len(os.Args) < 2 { err = parser.ParseInput() } else { err = parser.ParseFile(os.Args[1]) } if err != nil { fmt.Fprintln(os.Stderr, "Parse error:", err) os.Exit(1) } }
Print to stderr instead of panicking
Print to stderr instead of panicking
Go
mit
james9909/graphics-engine,james9909/graphics-engine
8bede4273a263b2b0f0af2ac06f78b17f80ea41d
main.go
main.go
package main import ( "fmt" "os" "golang.org/x/tools/go/loader" ) func main() { var conf loader.Config conf.CreateFromFilenames(".", os.Args[1:]...) p, err := conf.Load() if err != nil { fmt.Println(err) return } w := NewWalker(p) for _, pkg := range p.InitialPackages() { for _, file := range pkg....
package main import ( "fmt" "os" "golang.org/x/tools/go/loader" ) func main() { var conf loader.Config //conf.CreateFromFilenames(".", os.Args[1:]...) conf.FromArgs(os.Args[1:], false) p, err := conf.Load() if err != nil { fmt.Println(err) return } w := NewWalker(p) for _, pkg := range p.InitialPac...
Add correct path and args
Add correct path and args
Go
mit
divan/depscheck