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
e002607a44f4bfbc36f6be6be6f7077b0073bae3
watch_test.go
watch_test.go
package devd
package devd import ( "io/ioutil" "os" "strings" "sync" "testing" "time" "github.com/cortesi/termlog" ) func addTempFile(wg *sync.WaitGroup, t *testing.T, tmpFolder string, fname string, content string) { if err := ioutil.WriteFile(tmpFolder+"/"+fname, []byte(content), 0644); err != nil { t.Error(err) } ...
Add test for the Route.Watch/3 method.
Add test for the Route.Watch/3 method.
Go
mit
cortesi/devd,cortesi/devd,cortesi/devd,cortesi/devd
3341cf60f76b52b73408c9dce4108ad37510afbe
register.go
register.go
package moka import "testing" type Register struct{} func New(testingT *testing.T) Register { return Register{} } func (r Register) Allow(double Double) Subject { return Subject{double: double} } func (r Register) Expect(double Double) Subject { return Subject{} } func (r Register) Verify() {}
package moka import "testing" type Register struct{} func New(testingT *testing.T) Register { return Register{} } func (r Register) Allow(double Double) Subject { return Subject{double: double} }
Remove Register.Expect and Register.Verify for now
Remove Register.Expect and Register.Verify for now
Go
apache-2.0
gcapizzi/moka
f9d787a45976c8dc0eafb564a67124d6b385293a
src/dotnetcore/integration/deploy_app_with_multiple_projects_test.go
src/dotnetcore/integration/deploy_app_with_multiple_projects_test.go
package integration_test import ( "path/filepath" "github.com/cloudfoundry/libbuildpack/cutlass" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CF Dotnet Buildpack", func() { var ( app *cutlass.App fixtureName string ) AfterEach(func() { app = DestroyApp(app) }) JustB...
package integration_test import ( "path/filepath" "time" "github.com/cloudfoundry/libbuildpack/cutlass" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CF Dotnet Buildpack", func() { var ( app *cutlass.App fixtureName string ) AfterEach(func() { app = DestroyApp(app) })...
Test correctly waits for expected log output
Test correctly waits for expected log output [#153093345]
Go
apache-2.0
cloudfoundry-community/asp.net5-buildpack
0e8f50ede6cdb1d39c095e050db0f64522e33fdf
pkg/scwversion/version_test.go
pkg/scwversion/version_test.go
package scwversion import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestInit(t *testing.T) { Convey("Testing init()", t, func() { So(VERSION, ShouldNotEqual, "") So(GITCOMMIT, ShouldNotEqual, "") }) }
package scwversion import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestInit(t *testing.T) { Convey("Testing init()", t, func() { So(VERSION, ShouldNotEqual, "") // So(GITCOMMIT, ShouldNotEqual, "") }) }
Disable version test for GITCOMMIT
Disable version test for GITCOMMIT
Go
mit
QuentinPerez/scaleway-cli,QuentinPerez/scaleway-cli,QuentinPerez/scaleway-cli
a39bbc7f52c0ae1356610a5f1eaf1b31c8821956
pkg/parsers/kernel/uname_unsupported.go
pkg/parsers/kernel/uname_unsupported.go
//go:build openbsd // +build openbsd package kernel import ( "fmt" "runtime' ) // A stub called by kernel_unix.go . func uname() (*Utsname, error) { return nil, fmt.Errorf("Kernel version detection is not available on %s", runtime.GOOS) }
//go:build openbsd // +build openbsd package kernel import ( "fmt" "runtime" ) // A stub called by kernel_unix.go . func uname() (*Utsname, error) { return nil, fmt.Errorf("Kernel version detection is not available on %s", runtime.GOOS) }
Fix a typo that breaks build / vedoring
Fix a typo that breaks build / vedoring Signed-off-by: Miloslav Trmač <9c008e38982a5397deb855345fb164f0558459ae@redhat.com>
Go
apache-2.0
containers/storage,containers/storage,containers/storage
64ca0405ad515b212c4869fcc2e56138f5227b18
middleware/requestid.go
middleware/requestid.go
package middleware import ( "context" "net/http" "github.com/nats-io/nuid" ) type ctxRequestIDKeyType int const CtxRequestIDKey int = 0 const ( headerXRequestID = "X-Request-ID" ) type RequestID struct { SetHeader bool n *nuid.NUID } func NewRequestID() *RequestID { return &RequestID{ SetHeader:...
package middleware import ( "context" "net/http" "github.com/nats-io/nuid" ) type ctxRequestIDKeyType int const CtxRequestIDKey ctxRequestIDKeyType = 0 const ( headerXRequestID = "X-Request-ID" ) type RequestID struct { SetHeader bool n *nuid.NUID } func NewRequestID() *RequestID { return &Request...
Fix request id ctx key
Fix request id ctx key
Go
mit
celrenheit/lion
0942997609b90a6b1bd031d628503f7387840a61
http.go
http.go
package main import ( "encoding/base64" "net/http" "strings" ) func BasicAuth(handler http.HandlerFunc, username, password string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { authError := func() { w.Header().Set("WWW-Authenticate", "Basic realm=\"Zork\"") http.Error(w, "author...
package main import ( "net/http" ) func BasicAuth(handler http.Handler, username, password string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if u, p, ok := r.BasicAuth(); !ok || !(u == username && p == password) { w.Header().Set("WWW-Authenticate", "Basic realm=\"Zork\"") http...
Simplify basic auth code signifigantly
Simplify basic auth code signifigantly
Go
mit
donatj/explainer
22ed8ff68ecef07fd1433e0a148c49e89e870a38
api/command_me.go
api/command_me.go
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api import ( "github.com/dotcominternet/platform/model" ) type MeProvider struct { } const ( CMD_ME = "me" ) func init() { RegisterCommandProvider(&MeProvider{}) } func (me *MeProvider) GetTrigger() ...
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package api import ( "github.com/dotcominternet/platform/model" ) type MeProvider struct { } const ( CMD_ME = "me" ) func init() { RegisterCommandProvider(&MeProvider{}) } func (me *MeProvider) GetTrigger() ...
Make the /me command prefix the action with the invoking user's name, and then assign an "action" class property to alter the appearance of the post.
Make the /me command prefix the action with the invoking user's name, and then assign an "action" class property to alter the appearance of the post.
Go
agpl-3.0
dotcominternet/platform,dotcominternet/platform,dotcominternet/platform,dotcominternet/platform
02b17f39ca22db1414899965b9a17b1e171baa48
looping/looping.go
looping/looping.go
package main import "fmt" func main() { loop(100000) } func loop(duration int) { for i := 0; i < duration; i++ { fmt.Println(fmt.Sprintf("Loop number %d", i)) } }
package main import "fmt" func main() { loop(100000) } func loop(duration int) { for i := 0; i < duration; i++ { fmt.Println(fmt.Sprintf("Loop number %d", i+1)) } }
Use the same number operation in go as in hack.
Use the same number operation in go as in hack. Instead of having it print 0-999999 we want it to print 1-100000 because "loop number 0" is really the first of the loops.
Go
mit
lukevers/go-and-hack,lukevers/go-and-hack
bc76cf8d6c5690df7f769d7919fcc37206a5aea3
landoblog/landoblog.go
landoblog/landoblog.go
// Copyright 2013 Landon Wainwright. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Starts up the blog system using the default values package main import ( "flag" "github.com/landonia/simplegoblog/blog" "log" "os" ) // Starts a new...
// Copyright 2013 Landon Wainwright. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Starts up the blog system using the default values package main import ( "flag" "github.com/landonia/simplegoblog/blog" "log" "os" ) // Starts a new...
Allow the port to be defined
Allow the port to be defined
Go
bsd-3-clause
landonia/landotube,landonia/landotube
5241cdb4403e99e6debd06c2d6ed2d8e4d1f3bfd
wiki.go
wiki.go
package main import "net/http" // Wiki represents the entire Wiki, contains the db type Wiki struct { store Storage } // NewWiki creates a new Wiki func NewWiki(s Storage) *Wiki { // Setup the wiki. w := &Wiki{store: s} return w } // DB returns the database associated with the handler. func (w *Wiki) Store() S...
package main import ( "net/http" "strings" ) // Wiki represents the entire Wiki, contains the db type Wiki struct { store Storage } // NewWiki creates a new Wiki func NewWiki(s Storage) *Wiki { // Setup the wiki. w := &Wiki{store: s} return w } // DB returns the database associated with the handler. func (w ...
Make / required for dirs
Make / required for dirs
Go
mit
kalafut/finiki,kalafut/finiki,kalafut/finiki,kalafut/finiki
8eda5a1e6afc21ad5231db1e6ade6e772df9a263
faker/range.go
faker/range.go
package faker import ( "math/rand" "time" ) func getRandValueInRange(rangeSize int, epsilon float64) float64 { rand.Seed(time.Now().UTC().UnixNano()) maxDataWithError := float64(rangeSize) + 2*epsilon dataInRange := rand.Float64()*maxDataWithError - epsilon return dataInRange } func GenerateAngleVelocity(ep...
package faker import ( "math/rand" "time" ) // getRandValueInRange creates random value in (range size - error, range size + error) func getRandValueInRange(rangeSize int, epsilon float64) float64 { rand.Seed(time.Now().UTC().UnixNano()) maxDataWithError := float64(rangeSize) + 2*epsilon dataInRange := rand.Fl...
Add comments to all functions
Add comments to all functions
Go
mit
mingrammer/go-codelab
e000fec3c0d47b5752523614bf52ed120936a7da
pubsub/consumer.go
pubsub/consumer.go
package pubsub type Subscriber interface { Subscribe(name, topic string) (<-chan Event, error) } func (p *Inmem) Subscribe(name, topic string) (<-chan Event, error) { events := make(chan Event) sub := subscription{ name: name, topic: topic, eventChan: events, } p.mtx.Lock() p.subscriptions[topic]...
package pubsub type Subscriber interface { Subscribe(name, topic string) (<-chan Event, error) } func (p *Inmem) Subscribe(name, topic string) (<-chan Event, error) { events := make(chan Event) sub := subscription{ name: name, topic: topic, eventChan: events, } p.mtx.Lock() p.subscriptions[topic]...
Fix race condition in pubsub package.
Fix race condition in pubsub package. Closes #97
Go
mit
groob/micromdm,micromdm/micromdm,mosen/micromdm,micromdm/micromdm,natewalck/micromdm,mosen/micromdm,groob/micromdm
94eb97bfe9d18ee8093b83562e17ee600c055a1b
context.go
context.go
package chuper import ( "net/url" "github.com/PuerkitoBio/fetchbot" ) type Context struct { *fetchbot.Context C Cache } func (c *Context) Cache() Cache { return c.C } func (c *Context) Queue() *fetchbot.Queue { return c.Q } func (c *Context) URL() *url.URL { return c.Cmd.URL() } func (c *Context) SourceUR...
package chuper import ( "net/url" "github.com/PuerkitoBio/fetchbot" ) type Context struct { *fetchbot.Context C Cache } func (c *Context) Cache() Cache { return c.C } func (c *Context) Queue() *fetchbot.Queue { return c.Q } func (c *Context) URL() *url.URL { return c.Cmd.URL() } func (c *Context) SourceUR...
Add SourceUrl to Context when it's a command with BasicAuth.
Add SourceUrl to Context when it's a command with BasicAuth.
Go
bsd-3-clause
sluceno/chuper,oli-g/chuper
6bfb9080471305e088ad2ecd39313e404106ddf8
coordinator.go
coordinator.go
package metafora // CoordinatorContext is the context passed to coordinators by the core // consumer. type CoordinatorContext interface { Logger } // Coordinator is the core interface Metafora uses to discover, claim, and // tasks as well as receive commands. type Coordinator interface { // Init is called once by t...
package metafora // CoordinatorContext is the context passed to coordinators by the core // consumer. type CoordinatorContext interface { Logger } // Coordinator is the core interface Metafora uses to discover, claim, and // tasks as well as receive commands. type Coordinator interface { // Init is called once by t...
Make return values for Watch/Command clear in interface docs
Make return values for Watch/Command clear in interface docs
Go
apache-2.0
schmichael/metafora,lytics/metafora,schmichael/metafora,lytics/metafora
7495e1c99c57f91d9a150af200d4d91b407907e0
pkg/env/script.go
pkg/env/script.go
package env import "io/ioutil" func WriteScriptTo(fileName string, contents string) error { return ioutil.WriteFile(fileName, []byte(contents), 0744) } func ExecuteScript(scriptPath string) (string, error) { return ExecuteCommand("bash", scriptPath) }
package env import "io/ioutil" func WriteScriptTo(filename string, contents string) error { return ioutil.WriteFile(filename, []byte(contents), 0744) } func ExecuteScript(scriptPath string) (string, error) { return ExecuteCommand("bash", scriptPath) }
Change fileName to filename in pkg/env
Change fileName to filename in pkg/env
Go
apache-2.0
maxamillion/flamingo,tmrts/flamingo,maxamillion/flamingo,rtnpro/flamingo,tmrts/flamingo
23980c088a37d685af70acf5eef51356b77acecc
service/builder.go
service/builder.go
package service import "fmt" //Builder is a simple implementation of ContainerBuilder type Builder struct { definitions []Definition } //Insert a new definition into the Builder func (b *Builder) Insert(def Definition) { b.definitions = append(b.definitions, def) } //Build builds the container once all definition...
package service import "fmt" //Builder is a simple implementation of ContainerBuilder type Builder struct { definitions []Definition } //Insert a new definition into the Builder func (b *Builder) Insert(def Definition) { b.definitions = append(b.definitions, def) } //Build builds the container once all definition...
Fix spaces in error message
Fix spaces in error message
Go
agpl-3.0
FriendlyLinuxPlayers/flip.earth
106a9e92176ce276487d495d0f9f84bb57efbb1f
place_fuzz.go
place_fuzz.go
// +build gofuzz package types import "encoding/json" func FuzzPlaceCountainer(data []byte) int { var pc = &PlaceCountainer{} // Let's unmarshal, this is not our job so "bleh" err := json.Unmarshal(data, pc) if err != nil { return 0 } // Now that it is unmarshalled, let's test the Place method ! place, er...
// +build gofuzz package types import "encoding/json" func FuzzPlaceCountainer(data []byte) int { var pc = &PlaceCountainer{} // Let's unmarshal, this is not our job so "bleh" err := json.Unmarshal(data, pc) if err != nil { return 0 } // Now that it is unmarshalled, let's test the Place method ! place, er...
Add String method testing to FuzzJourney
Add String method testing to FuzzJourney
Go
unlicense
aabizri/navitia,aabizri/navitia
d2b095b1ca312192b022d8a3c1ea0f490548a059
engines/qemu/fetcher.go
engines/qemu/fetcher.go
package qemuengine import ( "fmt" "github.com/taskcluster/taskcluster-worker/runtime" "github.com/taskcluster/taskcluster-worker/runtime/fetcher" ) // A fetcher for downloading images. var imageFetcher = fetcher.Combine( // Allow fetching images from URL fetcher.URL, // Allow fetching images from queue artifac...
package qemuengine import ( "fmt" "github.com/taskcluster/taskcluster-worker/runtime" "github.com/taskcluster/taskcluster-worker/runtime/fetcher" ) // A fetcher for downloading images. var imageFetcher = fetcher.Combine( // Allow fetching images from URL fetcher.URL, // Allow fetching images from queue artifac...
Allow referencing QEMU images by index namespace and artifact name
Allow referencing QEMU images by index namespace and artifact name
Go
mpl-2.0
walac/taskcluster-worker,walac/taskcluster-worker
b334e8e896d41a860013216910c95565fa07883e
vendor/github.com/cloudfoundry/bosh-utils/crypto/interfaces.go
vendor/github.com/cloudfoundry/bosh-utils/crypto/interfaces.go
package crypto import ( "io" boshsys "github.com/cloudfoundry/bosh-utils/system" ) type Digest interface { Verify(io.Reader) error VerifyFilePath(filePath string, fs boshsys.FileSystem) error Algorithm() Algorithm String() string } var _ Digest = digestImpl{} type Algorithm interface { CreateDigest(io.Reade...
package crypto import ( "io" boshsys "github.com/cloudfoundry/bosh-utils/system" ) type Digest interface { Verify(io.Reader) error VerifyFilePath(filePath string, fs boshsys.FileSystem) error Algorithm() Algorithm String() string } var _ Digest = digestImpl{} var _ Digest = MultipleDigest{} type Algorithm in...
Update crypto interface to ensure MultipleDigest conforms
Update crypto interface to ensure MultipleDigest conforms
Go
apache-2.0
gu-bin/bosh-agent,mattcui/bosh-agent,mattcui/bosh-agent,mattcui/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent,cloudfoundry/bosh-agent,cloudfoundry/bosh-agent
eba2804e3318b997b120fdbf9fa7a2f57949f8dc
gister_test.go
gister_test.go
package gister import ( "bytes" "encoding/json" "flag" "fmt" "io/ioutil" "log" "net/http" "os" "strings" ) func Test_main() { }
package main func Test_main() { }
Move test to package main to make gister go gettable
Move test to package main to make gister go gettable
Go
mit
delta24/gist
9689d029f76ee968a224644a2bdfd0363271747b
rules/rules.go
rules/rules.go
// Package rules contains specific rules as subpackages to check a Makefile against package rules import ( "github.com/mrtazz/checkmake/parser" ) // Rule is the type of a rule function type Rule interface { Name() string Description() string Run(parser.Makefile, RuleConfig) RuleViolationList } // RuleViolation r...
// Package rules contains specific rules as subpackages to check a Makefile against package rules import ( "github.com/mrtazz/checkmake/parser" ) // Rule is the type of a rule function type Rule interface { Name() string Description() string Run(parser.Makefile, RuleConfig) RuleViolationList } // RuleViolation r...
Add FileName string to RuleViolation struct
Add FileName string to RuleViolation struct
Go
mit
mrtazz/checkmake
242acf38561a7eeb35eba2bec04cafb14f12dd74
cmd/format/main.go
cmd/format/main.go
package main import ( "encoding/json" "flag" "fmt" "os" ) var ( format string ) func main() { var jsonObjects []map[string]interface{} enc := json.NewDecoder(os.Stdin) _ = enc.Decode(&jsonObjects) for _, obj := range jsonObjects { if val, ok := obj[format]; ok { fmt.Println(val) } } } func init()...
package main import ( "encoding/json" "flag" "fmt" "os" "text/template" ) const ( baseTemplate = "{{ if .errors }}{{ range .errors }}{{ . }}\n{{ end }}{{ else }}{{ range .columns }}{{ bold .name }}\t{{end}}\n{{ range .data }}{{ range . }}{{ . }}\t{{ end }}\n{{ end }}{{ end }}" BoldCode = "\033[1m" ResetCode...
Use a go template (buggy b/c maps are unordered)
Formatter: Use a go template (buggy b/c maps are unordered)
Go
mit
carlmjohnson/junix
1f5dd7a5e07da465712eb2b558af27e3714f010d
commands/config.go
commands/config.go
package commands import ( "log" "os" "os/exec" "path" "syscall" "github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/spf13/cobra" "github.com/khlieng/name_pending/storage" ) var ( editors = []string{"nano", "notepad", "vi", "emacs"} configCmd = &cobra.Command{ Use: "config", Short: "Edi...
package commands import ( "log" "os" "os/exec" "path" "github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/spf13/cobra" "github.com/khlieng/name_pending/storage" ) var ( editors = []string{"nano", "notepad", "vi", "emacs"} configCmd = &cobra.Command{ Use: "config", Short: "Edit config fi...
Use os/exec to run editor
Use os/exec to run editor
Go
mit
khlieng/name_pending,postfix/name_pending,khlieng/dispatch,khlieng/dispatch,postfix/name_pending,khlieng/name_pending,khlieng/name_pending,postfix/name_pending,khlieng/dispatch,postfix/name_pending,khlieng/name_pending
6a5a115fedc5ce48cc016a3ca4809356882fbc4f
commands/create.go
commands/create.go
package commands import ( "fmt" "github.com/codegangsta/cli" "github.com/brooklyncentral/brooklyn-cli/api/application" "github.com/brooklyncentral/brooklyn-cli/command_metadata" "github.com/brooklyncentral/brooklyn-cli/net" "github.com/brooklyncentral/brooklyn-cli/scope" ) type Deploy struct { network *net.Net...
package commands import ( "fmt" "github.com/codegangsta/cli" "github.com/brooklyncentral/brooklyn-cli/api/application" "github.com/brooklyncentral/brooklyn-cli/command_metadata" "github.com/brooklyncentral/brooklyn-cli/net" "github.com/brooklyncentral/brooklyn-cli/scope" ) type Deploy struct { network *net.Net...
Fix description in help text
Fix description in help text
Go
apache-2.0
brooklyncentral/brooklyn-cli,brooklyncentral/brooklyn-cli,lloyddave/brooklyn-cli,lloyddave/brooklyn-cli
a6bcef8e744492c3b2bb1ca31f6ecb2690b5c11d
src/matrix.go
src/matrix.go
package main import ( "errors" ) type row []int type matrix []row // check returns an error if matrix is irregular // and cannot be transposed. func (m matrix) check() (err error) { l := len(m[0]) for _, x := range m { // as long as first line is the longest we're fine if len(x) > l { return errors.New("fi...
package main import ( "errors" ) type row []int type matrix []row func (r1 row) eq(r2 row) bool { if len(r1) != len(r2) { return false } for i := range r1 { if r1[i] != r2[i] { return false } } return true } // check returns an error if matrix is irregular // and cannot be transposed. func (m matrix)...
Add row equality method, at least needed for tests
Add row equality method, at least needed for tests
Go
isc
sstark/droguedrums,sstark/droguedrums,sstark/droguedrums,sstark/droguedrums
818de6e7da67a15639653699d03281b9471715aa
meta/padding.go
meta/padding.go
package meta import ( "errors" "io" ) // VerifyPadding verifies that the padding metadata block only contains 0 bits. // The provided io.Reader should limit the amount of data that can be read to // header.Length bytes. func VerifyPadding(r io.Reader) (err error) { // Verify up to 4 kb of padding each iteration. ...
package meta import ( "errors" "io" ) // VerifyPadding verifies that the padding metadata block only contains 0 bits. // The provided io.Reader should limit the amount of data that can be read to // header.Length bytes. func VerifyPadding(r io.Reader) (err error) { // Verify up to 4 kb of padding each iteration. ...
Use array instead of slice in VerifyPadding.
meta: Use array instead of slice in VerifyPadding.
Go
unlicense
mewkiz/flac
3ed5e772cf8d104238ec083432151f391e12476e
router/router_test.go
router/router_test.go
/* Copyright 2016 The Fission Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
/* Copyright 2016 The Fission Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
Update test to include method
Update test to include method
Go
apache-2.0
life1347/fission,platform9/fission,ktrance/fission,ktrance/fission,life1347/fission,life1347/fission,platform9/fission,ktrance/fission,platform9/fission,ktrance/fission,life1347/fission,ktrance/fission,fission/fission,life1347/fission,life1347/fission,ktrance/fission,life1347/fission,platform9/fission,fission/fission,l...
298b727472f2de7563955a6e8414ce2502ecca2c
lexers/fortran_fixed.go
lexers/fortran_fixed.go
package lexers import ( . "github.com/alecthomas/chroma/v2" // nolint ) // FortranFixed lexer. var FortranFixed = Register(MustNewLexer( &Config{ Name: "FortranFixed", Aliases: []string{"fortranfixed"}, Filenames: []string{"*.f", "*.F"}, MimeTypes: []string{"text/x-fortran"}, ...
package lexers import ( . "github.com/alecthomas/chroma/v2" // nolint ) // FortranFixed lexer. var FortranFixed = Register(MustNewLexer( &Config{ Name: "FortranFixed", Aliases: []string{"fortranfixed"}, Filenames: []string{"*.f", "*.F"}, MimeTypes: []string{"text/x-fortran"}, ...
Revise fortran fixed format lexer to recognize comments using the "!" mark in columns 1-5 and columns > 6. Remove incorrect "0" label being a comment.
Revise fortran fixed format lexer to recognize comments using the "!" mark in columns 1-5 and columns > 6. Remove incorrect "0" label being a comment.
Go
mit
alecthomas/chroma,alecthomas/chroma,alecthomas/chroma,alecthomas/chroma
9de9885e958bd7cbbdb26aa325e477d841f82e18
oauto/client/authenticate.go
oauto/client/authenticate.go
package client import ( "github.com/ibrt/go-oauto/oauto/api" "net/http" "fmt" "encoding/json" "github.com/go-errors/errors" "bytes" ) func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) { body, err := json.Marshal(request) if err != nil { return nil, errors...
package client import ( "github.com/ibrt/go-oauto/oauto/api" "net/http" "fmt" "encoding/json" "github.com/go-errors/errors" "bytes" ) func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) { body, err := json.Marshal(request) if err != nil { return nil, errors...
Improve error reporting in client.
Improve error reporting in client.
Go
mit
ibrt/go-oauto,ibrt/go-oauto
4e189ddc0fc04691e2f5821ac9172b7747879a26
common/versions.go
common/versions.go
package common const ( THRUST_VERSION = "0.7.5" THRUST_GO_VERSION = "0.2.7" )
package common const ( THRUST_VERSION = "0.7.5" THRUST_GO_VERSION = "0.3.0" )
Update Version to 0.3.0 - Stable Windows
Update Version to 0.3.0 - Stable Windows
Go
mit
miketheprogrammer/go-thrust,melvinodsa/go-thrust
908a92f10083be6315736df9d7a8dab39d188997
etcdutil/etcdutil.go
etcdutil/etcdutil.go
package etcdutil import ( "path" "github.com/coreos/go-etcd/etcd" ) // Creates the given dir (and all of its parent directories if they don't // already exist). Will not return an error if the given directory already // exists func MkDirP(ec *etcd.Client, dir string) error { parts := make([]string, 0, 4) f...
package etcdutil import ( "path" "github.com/coreos/go-etcd/etcd" ) // Creates the given dir (and all of its parent directories if they don't // already exist). Will not return an error if the given directory already // exists func MkDirP(ec *etcd.Client, dir string) error { parts := make([]string, 0, 4) f...
Revert "make MkDirP a bit faster"
Revert "make MkDirP a bit faster" This reverts commit ebf15f9de4418ec0ca477c6aa9a43b90d5c08f77.
Go
apache-2.0
grooveshark/golib,grooveshark/golib
a15624341856ac04f7aab1ee1014cebb1066f5fa
irc/message_test.go
irc/message_test.go
package irc import( "testing" ) func TestParseMessage(t *testing.T) { msg_string := ":kyle!~kyle@localhost PRIVMSG #tenyks :tenyks: messages are awesome" msg := ParseMessage(msg_string) if msg == nil { t.Error("Expected", Message{}, "got", msg) } if msg.Command != "PRIVMSG" { t.Error("Expected", Message{},...
package irc import( "testing" ) func TestParseMessage(t *testing.T) { msg_string := ":kyle!~kyle@localhost PRIVMSG #tenyks :tenyks: messages are awesome" msg := ParseMessage(msg_string) if msg == nil { t.Error("Expected", Message{}, "got", msg) } if msg.Command != "PRIVMSG" { t.Error("Expected", Message{},...
Test params for things like target
Test params for things like target
Go
mit
kyleterry/tenyks,kyleterry/tenyks,jtperreault/tenyks,jtperreault/tenyks
871f9265c92d361e33efef58bb075ccb0189225a
autoprofile/internal/timer_test.go
autoprofile/internal/timer_test.go
// (c) Copyright IBM Corp. 2021 // (c) Copyright Instana Inc. 2020 package internal_test import ( "sync/atomic" "testing" "time" "github.com/instana/go-sensor/autoprofile/internal" "github.com/instana/testify/assert" ) func TestTimer_Stop(t *testing.T) { var fired int64 timer := internal.NewTimer(0, 60*time....
// (c) Copyright IBM Corp. 2021 // (c) Copyright Instana Inc. 2020 package internal_test import ( "sync/atomic" "testing" "time" "github.com/instana/go-sensor/autoprofile/internal" "github.com/instana/testify/assert" ) func TestTimer_Stop_Restart(t *testing.T) { var fired int64 timer := internal.NewTimer(0, ...
Make the test failure message for timer restart more explicit
Make the test failure message for timer restart more explicit
Go
mit
instana/golang-sensor,instana/golang-sensor
a167a78ccb5bd10686d3f578da9513edbcaebf47
command/syslog_plugin.go
command/syslog_plugin.go
package command import ( "os" "strings" "github.com/hashicorp/go-plugin" "github.com/hashicorp/nomad/client/driver" ) type SyslogPluginCommand struct { Meta } func (e *SyslogPluginCommand) Help() string { helpText := ` This is a command used by Nomad internally to launch a syslog collector" ` return strin...
package command import ( "os" "strings" "github.com/hashicorp/go-plugin" "github.com/hashicorp/nomad/client/driver" ) type SyslogPluginCommand struct { Meta } func (e *SyslogPluginCommand) Help() string { helpText := ` This is a command used by Nomad internally to launch a syslog collector" ` return strin...
Return when nomad syslog command has invalid number of argument
Return when nomad syslog command has invalid number of argument
Go
mpl-2.0
barnardb/nomad,hooklift/nomad,novilabs/nomad,nak3/nomad,hashicorp/nomad,kmalec/nomad,achanda/nomad,novilabs/nomad,Ashald/nomad,frundh/nomad,novilabs/nomad,Ashald/nomad,kmalec/nomad,Ashald/nomad,burdandrei/nomad,kmalec/nomad,xytis/nomad,mattyr/nomad,xytis/nomad,frundh/nomad,nak3/nomad,novilabs/nomad,kmalec/nomad,achanda...
894c043193fefb2dcb9cc86b346f95a067adbc4c
examples/server.go
examples/server.go
package main import ( "fmt" "net/http" "github.com/ymichael/sessions" "github.com/zenazn/goji" "github.com/zenazn/goji/web" ) var ( Sessions = sessions.NewSessionOptions("thisismysecret.", &sessions.MemoryStore{}) ) func hello(c web.C, w http.ResponseWriter, r *http.Request) { x := Sessions.GetSession(&c) i...
package main import ( "fmt" "net/http" "github.com/ymichael/sessions" "github.com/zenazn/goji" "github.com/zenazn/goji/web" ) var ( Sessions = sessions.NewSessionOptions("thisismysecret.", &sessions.MemoryStore{}) ) func hello(c web.C, w http.ResponseWriter, r *http.Request) { x := Sessions.GetSessionObject(...
Add ability to delete sessions.
Add ability to delete sessions.
Go
mit
ymichael/sessions
8e6a074643bcc89143ffa38b8bbdfaf50c4b1bbf
state/action.go
state/action.go
package state import () type actionDoc struct { Id string `bson:"_id"` Name string Payload map[string]interface{} } // Action represents an instruction to do some "action" and is expected to match // an action definition in a charm. type Action struct { st *State doc actionDoc } func newAction(st *Sta...
package state import () type actionDoc struct { Id string `bson:"_id"` //Name string //Payload map[string]interface{} } // Action represents an instruction to do some "action" and is expected to match // an action definition in a charm. type Action struct { st *State doc actionDoc } func newAction(st *Stat...
Comment Action members 'Name', and 'Payload', pending clarification on these
Comment Action members 'Name', and 'Payload', pending clarification on these
Go
agpl-3.0
wwitzel3/juju,howbazaar/juju,ericsnowcurrently/juju,frankban/juju-tmp,bogdanteleaga/juju,mattyw/juju,AdamIsrael/juju,axw/juju,frankban/juju,bac/juju,makyo/juju,cherylj/juju,sinzui/juju,dimitern/juju,bac/juju,dooferlad/juju,Altoros/juju-vmware,Altoros/juju-vmware,alesstimec/juju,cmars/juju,reedobrien/juju,tasdomas/juju,...
18d63456bc4be5f5d7c8aac402b8758a73e23b38
nativesequence/nativesequentialrender_test.go
nativesequence/nativesequentialrender_test.go
package nativesequence import ( "testing" "github.com/johnny-morrice/godelbrot/base" "github.com/johnny-morrice/godelbrot/nativebase" ) func TestSequence(t *testing.T) { if testing.Short() { panic("nativesequence testing impossible in short mode") } const iterateLimit = 10 app := &nativebase.MockRenderApplic...
package nativesequence import ( "testing" "github.com/johnny-morrice/godelbrot/base" "github.com/johnny-morrice/godelbrot/nativebase" ) func TestSequence(t *testing.T) { if testing.Short() { panic("nativesequence testing impossible in short mode") } const iterateLimit = 10 app := &nativebase.MockRenderApplic...
Fix failing unit tests for nativesequence
Fix failing unit tests for nativesequence
Go
mit
johnny-morrice/godelbrot
e15e9acf4cad6dd04a36131bff2cf42fd059e022
buffer.go
buffer.go
package cypress import "sync" var pbBufPool sync.Pool func init() { pbBufPool.New = newBuf } func newBuf() interface{} { return make([]byte, 128) }
package cypress import "sync" var pbBufPool sync.Pool func init() { pbBufPool.New = func() interface{} { return make([]byte, 128) } }
Use a closure rather than a standalone func
Use a closure rather than a standalone func
Go
bsd-3-clause
vektra/cypress,vektra/cypress
622c9c8e75c5ba11f3d931333bc641b605dbc823
envd.go
envd.go
package main import ( "flag" "fmt" "os" ) const ( VERSION = "0.1.0" ) var options struct { Path string Port int Token string Auth bool } var services []Service func main() { flag.StringVar(&options.Path, "c", "", "Path to config directory") flag.IntVar(&options.Port, "p", 3050, "Port to listen on") f...
package main import ( "flag" "fmt" "os" ) const ( VERSION = "0.1.0" ) var options struct { Path string Port int Token string Auth bool } var services []Service func main() { flag.StringVar(&options.Path, "c", "", "Path to config directory") flag.IntVar(&options.Port, "p", 3050, "Port to listen on") f...
Set authentication from env variable if provided
Set authentication from env variable if provided
Go
mit
sosedoff/envd
6007f1a99b0127608c7072b12684060a615b777e
gzippool.go
gzippool.go
package main import ( "compress/gzip" "io" "io/ioutil" "sync" ) type gzipPool struct { mutex sync.Mutex top *gzipPoolEntry } type gzipPoolEntry struct { gz *gzip.Writer next *gzipPoolEntry } func newGzipPool(n int) *gzipPool { pool := new(gzipPool) for i := 0; i < n; i++ { pool.grow() } return p...
package main import ( "compress/gzip" "io" "io/ioutil" "sync" ) type gzipPool struct { mutex sync.Mutex top *gzipPoolEntry } type gzipPoolEntry struct { gz *gzip.Writer next *gzipPoolEntry } func newGzipPool(n int) *gzipPool { pool := new(gzipPool) for i := 0; i < n; i++ { pool.grow() } return p...
Reset gzip encoder on put to pool
Reset gzip encoder on put to pool
Go
mit
DarthSim/imgproxy,DarthSim/imgproxy
79f2b0bcc73158b3bccdadc20de513bd7f14b74d
images/identity.go
images/identity.go
package images import ( "encoding/json" "errors" ) type IdentityImage struct { KeyUID string Name string Payload []byte Width int Height int FileSize int ResizeTarget int } func (i IdentityImage) GetType() (ImageType, error) { it := GetType(i.Payload) if it == UNKNOWN {...
package images import ( "encoding/json" "errors" ) type IdentityImage struct { KeyUID string Name string Payload []byte Width int Height int FileSize int ResizeTarget int } func (i IdentityImage) GetType() (ImageType, error) { it := GetType(i.Payload) if it == UNKNOWN {...
Address consistent json field case convention - use camelCase
Address consistent json field case convention - use camelCase
Go
mpl-2.0
status-im/status-go,status-im/status-go,status-im/status-go
2c6774b38ec06c84bff0feb701935ceab2f5b131
fastly.go
fastly.go
package fastly import ( "bytes" "encoding" ) type statusResp struct { Status string Msg string } func (t *statusResp) Ok() bool { return t.Status == "ok" } // Ensure Compatibool implements the proper interfaces. var ( _ encoding.TextMarshaler = new(Compatibool) _ encoding.TextUnmarshaler = new(Compatibo...
package fastly import ( "bytes" "encoding" ) type statusResp struct { Status string Msg string } func (t *statusResp) Ok() bool { return t.Status == "ok" } // Ensure Compatibool implements the proper interfaces. var ( _ encoding.TextMarshaler = new(Compatibool) _ encoding.TextUnmarshaler = new(Compatibo...
Fix UnmarshalText implementation on Compatibools.
Fix UnmarshalText implementation on Compatibools.
Go
mit
alienth/go-fastly,sethvargo/go-fastly,aerostitch/go-fastly,aerostitch/go-fastly
84246047aab398a8f6c54e3ea5f13b14154fb01f
providers/providers_suite_test.go
providers/providers_suite_test.go
package providers import ( . "bitbucket.org/sinbad/git-lob/Godeps/_workspace/src/github.com/onsi/ginkgo" . "bitbucket.org/sinbad/git-lob/Godeps/_workspace/src/github.com/onsi/gomega" . "bitbucket.org/sinbad/git-lob/util" "testing" ) func TestAll(t *testing.T) { // Connect Ginkgo to Gomega RegisterFailHandler(Fa...
package providers import ( . "bitbucket.org/sinbad/git-lob/Godeps/_workspace/src/github.com/onsi/ginkgo" . "bitbucket.org/sinbad/git-lob/Godeps/_workspace/src/github.com/onsi/gomega" . "bitbucket.org/sinbad/git-lob/util" "testing" ) func TestAll(t *testing.T) { // Connect Ginkgo to Gomega RegisterFailHandler(Fa...
Fix name of providers test suite
Fix name of providers test suite
Go
apache-2.0
atlassian/git-lob,atlassian/git-lob
8b3863b00d216214994608ebb88d0cf6bbdaa290
pkg/http/response/json.go
pkg/http/response/json.go
/* Package response provides helpers and utils for working with HTTP response */ package response import ( "context" "encoding/json" "net/http" ) // JSON returns data as json response func JSON(ctx context.Context, w http.ResponseWriter, statusCode int, payload interface{}) error { w.Header().Set("Content-Type", ...
/* Package response provides helpers and utils for working with HTTP response */ package response import ( "context" "encoding/json" "net/http" ) // JSON returns data as json response func JSON(ctx context.Context, w http.ResponseWriter, statusCode int, payload interface{}) error { w.Header().Set("Content-Type", ...
Set header only if not OK
Set header only if not OK
Go
mit
vardius/go-api-boilerplate,vardius/go-api-boilerplate,vardius/go-api-boilerplate
1274b90cdba187b7e915de2155ea0a66b6a92032
product.go
product.go
package main type Productor struct { items [][]string indexes []int ch chan []int } func NewProductor(items [][]string, ch chan []int) *Productor { return &Productor{ items: items, indexes: make([]int, len(items)), ch: ch, } } func (p *Productor) FindProduct(index_i int) { if index_i == len...
package main type Productor struct { items [][]string indexes []int ch chan []int } func NewProductor(items [][]string, ch chan []int) *Productor { return &Productor{ items: items, indexes: make([]int, len(items)), ch: ch, } } func (p *Productor) findProduct(index_i int) { if index_i == len...
Remove an argument of Productor.FindProduct
Remove an argument of Productor.FindProduct
Go
mit
kusabashira/prod
969ed9e69a9f594cf3c63c453a04479fd62ea981
profile.go
profile.go
package tmsh // ClientSSLProffile contains information about Client SSL profile type ClientSSLProfile struct { Name string `ltm:"name"` Component string `ltm:"component"` Cert string `ltm:"cert"` CertKeyChain map[string]map[string]string `ltm:"cert-key-chain"` Cha...
package tmsh import ( "fmt" "strings" ) // ClientSSLProffile contains information about Client SSL profile type ClientSSLProfile struct { Name string `ltm:"name"` Component string `ltm:"component"` Cert string `ltm:"cert"` CertKeyChain map[string]map[string]stri...
Add functions for Client SSL Profile
Add functions for Client SSL Profile
Go
mit
shiftky/go-tmsh
692ad988d2c678785832561ea999fa22486baba1
channels/Fanstat.go
channels/Fanstat.go
package channels import ( "log" ) type FanState struct { Speed *float64 `json:"speed,omitempty"` // the speed of the fan as a percentage of maximum Direction *string `json:"direction,omitempty"` // the direction of the fan: "forward" or "reverse" } type FanStatActuator interface { SetFanState(fanState *...
package channels type FanState struct { Speed *float64 `json:"speed,omitempty"` // the speed of the fan as a percentage of maximum Direction *string `json:"direction,omitempty"` // the direction of the fan: "forward" or "reverse" } type FanStatActuator interface { SetFanState(fanState *FanState) error } ...
Clean up log message in FanStatChannel
Clean up log message in FanStatChannel
Go
mit
ninjasphere/go-ninja,ninjasphere/go-ninja
b880ac214cfaefc9f35c93b464c2dfadc26cfbfe
resource/origin.go
resource/origin.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package resource import ( "github.com/juju/errors" ) // These are the valid kinds of resource origin. var ( OriginKindUpload = OriginKind{"upload"} OriginKindStore = OriginKind{"store"} ) var knownOriginKinds = map[Orig...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package resource import ( "github.com/juju/errors" ) // These are the valid kinds of resource origin. const ( originKindUnknown OriginKind = iota OriginKindUpload OriginKindStore ) var knownOriginKinds = map[OriginKind]...
Make OriginKind an int "enum".
Make OriginKind an int "enum".
Go
agpl-3.0
AdamIsrael/juju,reedobrien/juju,reedobrien/juju,dooferlad/juju,bogdanteleaga/juju,AdamIsrael/juju,macgreagoir/juju,axw/juju,ericsnowcurrently/juju,macgreagoir/juju,howbazaar/juju,alesstimec/juju,ericsnowcurrently/juju,makyo/juju,reedobrien/juju,kat-co/juju,frankban/juju,mjs/juju,marcmolla/juju,bz2/juju,reedobrien/juju,...
70837d9759641a6e6c4a8b3869ff2faff35ca267
cliext/flags.go
cliext/flags.go
package cliext import ( "flag" "fmt" ) // FlagsFlag is a github.com/codegangsta/cli.Flag based on a golang flag.Flag. type FlagsFlag struct { *flag.Flag } // Apply adds a FlagsFlag to a flag.FlagSet. func (f FlagsFlag) Apply(fs *flag.FlagSet) { fs.Var(f.Flag.Value, f.Name, f.Usage) } // GetName returns the Flag...
package cliext import ( "flag" "fmt" ) // FlagsFlag is a github.com/codegangsta/cli.Flag based on a golang flag.Flag. type FlagsFlag struct { *flag.Flag Hidden bool } // Apply adds a FlagsFlag to a flag.FlagSet. func (f FlagsFlag) Apply(fs *flag.FlagSet) { fs.Var(f.Flag.Value, f.Name, f.Usage) } // GetName ret...
Fix --help with newest codegangsta/cli
Fix --help with newest codegangsta/cli
Go
apache-2.0
sttts/elastic-etcd
309349c61b7d68a003b45605b8b79cf4663dfeae
example_test.go
example_test.go
// Copyright 2015 The syscallinfo 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 syscallinfo_test import ( "fmt" "github.com/jroimartin/syscallinfo" "github.com/jroimartin/syscallinfo/linux_386" ) func ExampleRepr() { ...
// Copyright 2015 The syscallinfo 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 syscallinfo_test import ( "fmt" "github.com/jroimartin/syscallinfo" "github.com/jroimartin/syscallinfo/linux_386" ) func ExampleSyscall_R...
Modify example name to be included by godoc
Modify example name to be included by godoc
Go
bsd-3-clause
jroimartin/syscallinfo,jroimartin/syscallinfo
ea3ece9b2a792cf634aff93b1b4a951f6218ab9f
main.go
main.go
package main import ( "log" "net/http" ) const VERSION = "0.1.0" func main() { log.Printf("resolutionizerd %s starting...", VERSION) log.Fatalln(http.ListenAndServe(":8080", http.FileServer(http.Dir("./client")))) }
package main import ( "flag" "log" "net/http" "os" ) const VERSION = "0.1.0" var clientDir string func init() { flag.StringVar(&clientDir, "client", "./client", "the directory where the client data is stored") } func main() { log.Printf("resolutionizerd %s starting...", VERSION) log.Fatalln(http.ListenAndS...
Add support for injecting the port and client dir.
Add support for injecting the port and client dir.
Go
mpl-2.0
smkell/resolutionizerd
aae6f952495e2ec28264a58fa96a32787164f0ce
main.go
main.go
package main import ( "fmt" "io/ioutil" "os" "strconv" "github.com/yuya-takeyama/argf" ) var ( name = "catn" usage = fmt.Sprintf("usage: %s N [FILE]...", name) ) func printErr(err error) { fmt.Fprintf(os.Stderr, "%s: %s\n", name, err) } func main() { if len(os.Args) < 2 || os.Args[1] == "--help" { fmt....
package main import ( "fmt" "io/ioutil" "os" "strconv" "github.com/yuya-takeyama/argf" ) var ( name = "catn" usage = fmt.Sprintf("usage: %s N [FILE]...", name) ) func printErr(err error) { fmt.Fprintf(os.Stderr, "%s: %s\n", name, err) } func main() { if len(os.Args) < 2 || os.Args[1] == "--help" { fmt....
Use if-else instead of switch if branches are two
Use if-else instead of switch if branches are two
Go
mit
kusabashira/catn
f0d17c4283b4252b6d5cac6b8e0275f538a6765e
minionmsg.go
minionmsg.go
// Copyright 2014, Truveris Inc. All Rights Reserved. // Use of this source code is governed by the ISC license in the LICENSE file. package ygor import ( "regexp" "strings" ) var ( // Detect a MINIOMSG (minion communications). reMinionMsg = regexp.MustCompile(`^MINIONMSG (.*)`) ) type MinionMsg struct { // Th...
// Copyright 2014, Truveris Inc. All Rights Reserved. // Use of this source code is governed by the ISC license in the LICENSE file. // // Defines all the tools to handle the MINIONMSG messages coming from the // minions. // // TODO: We need to reject unauthenticated messages (wrong user id). // package ygor import (...
Make the minion name mandatory and passed before MINIONMSG.
Make the minion name mandatory and passed before MINIONMSG.
Go
isc
cnejame/ygor,truveris/ygor,cnejame/ygor,cnejame/ygor,cnejame/ygor,truveris/ygor,truveris/ygor
eaa30a038b8ab4e82f27c6289f4dedd09634f405
main.go
main.go
package main import ( "flag" "fmt" log "github.com/Sirupsen/logrus" "github.com/bobtfish/AWSnycast/daemon" "os" ) var ( debug = flag.Bool("debug", false, "Enable debugging") f = flag.String("f", "/etc/awsnycast.yaml", "Configration file") oneshot = flag.Bool("oneshot", false, "Run route...
package main import ( "flag" "fmt" log "github.com/Sirupsen/logrus" logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" "github.com/bobtfish/AWSnycast/daemon" "log/syslog" "os" ) var ( debug = flag.Bool("debug", false, "Enable debugging") f = flag.String("f", "/etc/awsnycast.yaml", "Con...
Add the ability to send logs to syslog
Add the ability to send logs to syslog
Go
apache-2.0
bobtfish/docker-consul-awsnycast,bobtfish/docker-consul-awsnycast,bobtfish/AWSnycast,bobtfish/docker-consul-awsnycast,bobtfish/AWSnycast,bobtfish/AWSnycast
f5c692b31dadeaccb8227508f53136dcf58b0ab6
main.go
main.go
package main import ( "fmt" "github.com/codegangsta/cli" "os" "time" ) func main() { app := cli.NewApp() app.Name = "tad" app.Usage = "print the date and time" app.Action = func(c *cli.Context) { const layout = "Jan 2, 2006 at 3:04pm (MST)" t := time.Now() fmt.Println(t.Format(layout)) } app.Run(os.Ar...
package main import ( "fmt" "github.com/codegangsta/cli" "os" "time" ) func main() { app := cli.NewApp() app.Name = "dat" app.Usage = "print the date and time" app.Action = func(c *cli.Context) { const layout = "Jan 2, 2006 at 3:04pm (MST)" t := time.Now() fmt.Println(t.Format(layout)) } app.Run(os.Ar...
Update the name to dat
Update the name to dat instead of "time and date" change the name to "date and time"
Go
mit
brettchalupa/dat
614446ef01af9ab900027b2c3515d847a0a1c347
src/goat/logger.go
src/goat/logger.go
package goat import ( "bufio" "fmt" "log" "os" "time" ) func LogMng(doneChan chan bool, logChan chan string) { // create log file and pull current time to add to logfile name currentTime := time.Now().String() logFile, err := os.Create("GoatLog" + currentTime + ".log") if err != nil { fmt.Println(err) } ...
package goat import ( "bufio" "fmt" "log" "os" "time" ) func LogMng(doneChan chan bool, logChan chan string) { // Create log directory and file, and pull current date to add to logfile name now := time.Now() os.Mkdir("logs", os.ModeDir|os.ModePerm) logFile, err := os.Create(fmt.Sprintf("logs/goat-%d-%d-%d.lo...
Make logs directory, simplify log to goat-yyyy-mm-dd.log
Make logs directory, simplify log to goat-yyyy-mm-dd.log
Go
mit
mdlayher/goat
a036b58e836fd4bbdc25f83ac658e04aa3ea8d80
dom/mdb/api.go
dom/mdb/api.go
package mdb import ( "io" "log" ) type Machine struct { Hostname string RequiredImage string PlannedImage string } type Mdb struct { Machines []Machine } func (mdb *Mdb) Len() int { return len(mdb.Machines) } func (mdb *Mdb) DebugWrite(w io.Writer) error { return mdb.debugWrite(w) } func StartMdbDae...
package mdb import ( "io" "log" ) type Machine struct { Hostname string RequiredImage string PlannedImage string } type Mdb struct { Machines []Machine } func (mdb *Mdb) Len() int { return len(mdb.Machines) } func (mdb *Mdb) DebugWrite(w io.Writer) error { return mdb.debugWrite(w) } func StartMdbDae...
Fix variable name for StartMdbDaemon() to reflect reality.
Fix variable name for StartMdbDaemon() to reflect reality.
Go
apache-2.0
Symantec/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator
be1c037dea6f41b0029af0ee176ce054dbcda3c7
examples/channels/channels.go
examples/channels/channels.go
package main import ( "fmt" "github.com/nlopes/slack" ) func main() { api := slack.New("YOUR_TOKEN_HERE") channels, err := api.GetChannels(false) if err != nil { fmt.Printf("%s\n", err) return } for _, channel := range channels { fmt.Println(channel.ID) } }
package main import ( "fmt" "github.com/nlopes/slack" ) func main() { api := slack.New("YOUR_TOKEN_HERE") channels, err := api.GetChannels(false) if err != nil { fmt.Printf("%s\n", err) return } for _, channel := range channels { fmt.Println(channel.Name) // channel is of type conversation & groupConv...
Print readable names for example 👀
Print readable names for example 👀
Go
bsd-2-clause
nlopes/slack,james-lawrence/slack,178inaba/slack
14e0cac4fd556844afa0caa972129253eb82bf58
nospace_test.go
nospace_test.go
package main import "testing" func TestNoSpacePackage(t *testing.T) { buffer := `packagenospace type T Peg {} Grammar <- !. ` p := &Peg{Tree: New(false, false), Buffer: buffer} p.Init() err := p.Parse() if err == nil { t.Error("packagenospace was parsed without error") } } func TestNoSpaceType(t *testing.T) ...
package main import "testing" func TestCorrect(t *testing.T) { buffer := `package p type T Peg {} Grammar <- !. ` p := &Peg{Tree: New(false, false), Buffer: buffer} p.Init() err := p.Parse() if err != nil { t.Error(err) } } func TestNoSpacePackage(t *testing.T) { buffer := `packagenospace type T Peg {} Gram...
Add test that correctly spaced code parses
Add test that correctly spaced code parses
Go
bsd-3-clause
pointlander/peg
98858f51dad950dddaa665096d4952b01c89528e
ggircd/main.go
ggircd/main.go
package main import ( "flag" "log" "github.com/fimad/ggircd/irc" ) var configFile = flag.String("config", "/etc/ggircd.conf", "Path to a file containing the irc daemon's configuration.") func main() { flag.Parse() log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) cfg := irc.ConfigFromJSONFile(*con...
package main import ( "flag" "log" "runtime" "github.com/fimad/ggircd/irc" ) var configFile = flag.String("config", "/etc/ggircd.conf", "Path to a file containing the irc daemon's configuration.") func main() { runtime.GOMAXPROCS(runtime.NumCPU()) flag.Parse() log.SetFlags(log.Ldate | log.Ltime | l...
Set max procs to num cpus.
Set max procs to num cpus.
Go
mit
fimad/ggircd
bf030de1d0a769654eebe474c66fb55cf4b3152b
hostaccess/instance.go
hostaccess/instance.go
package hostaccess import ( "fmt" "github.com/gorilla/websocket" "github.com/rancher/go-rancher/client" ) type RancherWebsocketClient client.RancherClient func (c *RancherWebsocketClient) GetHostAccess(resource client.Resource, action string, input interface{}) (*websocket.Conn, error) { var resp client.HostAcc...
package hostaccess import ( "fmt" "github.com/gorilla/websocket" "github.com/rancher/go-rancher/v2" ) type RancherWebsocketClient client.RancherClient func (c *RancherWebsocketClient) GetHostAccess(resource client.Resource, action string, input interface{}) (*websocket.Conn, error) { var resp client.HostAccess ...
Switch host access to v2-beta
Switch host access to v2-beta
Go
apache-2.0
rancherio/go-rancher,rancher/go-rancher,rancherio/go-rancher,rancher/go-rancher
226d4725bf5aa05eda7ba36f28ac2f222aac8508
itertools/iterutils.go
itertools/iterutils.go
package itertools import "math/rand" type seq struct { i []int } // Creates sequence of values from [0, n) func newSeq(n int) seq { return seq{make([]int, n, n)} } func (me seq) Index(i int) (ret int) { ret = me.i[i] if ret == 0 { ret = i } return } func (me seq) Len() int { return len(me.i) } // Remove ...
package itertools import "math/rand" type seq struct { i []int } // Creates sequence of values from [0, n) func newSeq(n int) seq { return seq{make([]int, n, n)} } func (me seq) Index(i int) (ret int) { ret = me.i[i] if ret == 0 { ret = i } return } func (me seq) Len() int { return len(me.i) } // Remove ...
Rename seq.Delete to DeleteIndex to better reflect its purpose
itertools: Rename seq.Delete to DeleteIndex to better reflect its purpose
Go
mit
anacrolix/missinggo
5362cf69e61de98adbc9e1150116ea98c27fd6b2
user.go
user.go
/*§ =========================================================================== Caravel =========================================================================== Copyright (C) 2015 Gianluca Costa =========================================================================== Licensed under the Apache License,...
/*§ =========================================================================== Caravel =========================================================================== Copyright (C) 2015 Gianluca Costa =========================================================================== Licensed under the Apache License,...
Support /home/gian environment variable in GetUserDirectory()
Support /home/gian environment variable in GetUserDirectory()
Go
apache-2.0
giancosta86/caravel
16bf85fc85d292271efdd3b9fcbc91abe1e2c4de
dom/herd/mdb.go
dom/herd/mdb.go
package herd import ( "github.com/Symantec/Dominator/dom/mdb" ) func (herd *Herd) mdbUpdate(mdb *mdb.Mdb) { herd.subsByIndex = nil if herd.subsByName == nil { herd.subsByName = make(map[string]*Sub) } for _, sub := range herd.subsByName { sub.hostname = "" } for _, machine := range mdb.Machines { sub := ...
package herd import ( "github.com/Symantec/Dominator/dom/mdb" ) func (herd *Herd) mdbUpdate(mdb *mdb.Mdb) { herd.subsByIndex = nil if herd.subsByName == nil { herd.subsByName = make(map[string]*Sub) } for _, sub := range herd.subsByName { sub.hostname = "" } for _, machine := range mdb.Machines { sub := ...
Fix Dominator memory leak with explicit sub.connection.Close() call.
Fix Dominator memory leak with explicit sub.connection.Close() call.
Go
apache-2.0
rgooch/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator
9b970240ad45f3004841296c14e93f25838ce341
lib/mdb/api.go
lib/mdb/api.go
package mdb import ( "io" ) type Machine struct { Hostname string RequiredImage string `json:",omitempty"` PlannedImage string `json:",omitempty"` DisableUpdates bool `json:",omitempty"` OwnerGroup string `json:",omitempty"` } func (dest *Machine) UpdateFrom(source Machine) { dest.updateFrom(so...
/* Package mdb implements a simple in-memory Machine DataBase. */ package mdb import ( "io" ) // Machine describes a single machine with a unique Hostname and optional // metadata about the machine. type Machine struct { Hostname string RequiredImage string `json:",omitempty"` PlannedImage string `json:...
Add documentation for lib/mdb package.
Add documentation for lib/mdb package.
Go
apache-2.0
Symantec/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator
e3da8c499b3233806806732f357831bd0ae71e65
infrastructure/container/container_test.go
infrastructure/container/container_test.go
package container import ( "fmt" "github.com/stretchr/testify/assert" "os" "reflect" "testing" ) type testtype struct { Foo string Bar string } type testdata struct { emp interface{} val interface{} } var testdataSet = []testdata{ {new(string), "value"}, {new(int), 1234}, {new(float64), 12.34}, {new(te...
package container import ( "fmt" "github.com/stretchr/testify/assert" "os" "reflect" "testing" ) type testtype struct { Foo string Bar string } type testdata struct { emp interface{} val interface{} } var testdataSet = []testdata{ {new(string), "value"}, {new(int), 1234}, {new(float64), 12.34}, {new(te...
Add test data and Fix assertion
Add test data and Fix assertion
Go
mit
photoshelf/photoshelf-storage
86179ee4fda0562db48f7ceb6d7d7cae962a2d1c
fiber/fiberbrake.go
fiber/fiberbrake.go
package fiber import ( "context" "errors" "github.com/airbrake/gobrake/v5" "github.com/gofiber/fiber/v2" ) // New returns a function that satisfies fiber.Handler interface func New(notifier *gobrake.Notifier) fiber.Handler { return func(c *fiber.Ctx) error { if notifier == nil { return errors.New("airbrak...
package fiber import ( "context" "errors" "github.com/airbrake/gobrake/v5" "github.com/gofiber/fiber/v2" ) // New returns a function that satisfies fiber.Handler interface func New(notifier *gobrake.Notifier) fiber.Handler { return func(c *fiber.Ctx) error { if notifier == nil { return errors.New("airbrak...
Move c.Next() to the correct place.
Move c.Next() to the correct place.
Go
mit
airbrake/gobrake
3c0befa89f1d87ac7699a2d63febc0242aeeb582
jabmud-server/iq.go
jabmud-server/iq.go
package main import ( "github.com/emgee/go-xmpp/src/xmpp" "github.com/trasa/jabmud/commands" "github.com/trasa/jabmud/world" "log" "strings" ) func HandleIq(iq *xmpp.Iq) *xmpp.Iq { log.Printf("iq: %T: %v", iq.Payload, iq.Payload) if strings.HasPrefix(iq.Payload, "<command") { return handleIqCommand(iq) } el...
package main import ( "github.com/emgee/go-xmpp/src/xmpp" "github.com/trasa/jabmud/commands" "github.com/trasa/jabmud/world" "log" "strings" ) func HandleIq(iq *xmpp.Iq) *xmpp.Iq { log.Printf("Handle IQ: %T: %v", iq.Payload, iq.Payload) if strings.HasPrefix(iq.Payload, "<command") { return handleIqCommand(iq...
Return error IQ when player is not logged in.
Return error IQ when player is not logged in.
Go
mit
trasa/watchmud,trasa/jabmud,trasa/watchmud,trasa/jabmud,trasa/jabmud,trasa/jabmud
efe4422c9a5df7ed826f989d867e1ec9bc9d3b75
config/flags.go
config/flags.go
package config import "flag" /* Gets config from command line arguments */ func FromFlags() *Config { var expConf ExportConfig flag.StringVar(&expConf.URL, "url", "", "Export target") flag.StringVar(&expConf.Token, "token", "", "Authentication token") flag.Parse() return &Config{ Export: expConf, Res...
package config import "flag" /* Gets config from command line arguments */ func FromFlags() *Config { var expConf ExportConfig flag.StringVar(&expConf.URL, "url", "", "Export target") flag.StringVar(&expConf.Token, "token", "", "Export authentication token") flag.Parse() return &Config{ Export: expConf...
Update command line argument help text
Update command line argument help text
Go
mit
kayex/chalmers-chop
3e1567bd2e5f46fcc91c395834527e9b195f13cf
aguin.go
aguin.go
package main import ( aguin_api "aguin/api" "aguin/config" "flag" "fmt" "github.com/go-martini/martini" "github.com/martini-contrib/render" "net/http" "aguin/utils" ) func main() { var ( host string port int ) log := utils.GetLogger("system") flag.StringVar(&host, "h", "", "Host to listen on") flag.I...
package main import ( aguin_api "aguin/api" "aguin/config" "flag" "fmt" "github.com/go-martini/martini" "github.com/martini-contrib/render" "net/http" "aguin/utils" ) func main() { var ( host string port int ) log := utils.GetLogger("system") flag.StringVar(&host, "h", "", "Host to listen on") flag.I...
Make the port larger then zero
Make the port larger then zero
Go
mit
vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin,vanng822/aguin
37d23e90183fd4f88613441444b5459ec84513b3
example/main.go
example/main.go
package main import ( "log" "net" "net/http" ) // In most projects, you'd copy asset.go into the current directory, // and the below would say "go run asset.go". // //go:generate -command asset go run ../asset.go //go:generate asset index.html type HTML struct { asset } func html(a asset) HTML { return HTML{a}...
package main import ( "log" "net" "net/http" ) //go:generate go run github.com/tv42/becky index.html type HTML struct { asset } func html(a asset) HTML { return HTML{a} } func main() { l, err := net.Listen("tcp", "localhost:0") if err != nil { log.Fatal(err) } log.Printf("Serving at http://%s/", l.Addr(...
Fix example to not use old asset.go
Fix example to not use old asset.go
Go
mit
tv42/becky,tv42/becky
a22b83d754a105e7a2002519178e549528b2ab44
consensus_requestvote_test.go
consensus_requestvote_test.go
package raft import ( "reflect" "testing" ) func makeRVWithTerm(term TermNo) *RpcRequestVote { return &RpcRequestVote{term, 0, 0} } // 1. Reply false if term < currentTerm (#5.1) // Note: this test assumes server in sync with the Figure 7 leader func TestCM_RpcRV_TermLessThanCurrentTerm(t *testing.T) { f := func...
package raft import ( "reflect" "testing" ) // 1. Reply false if term < currentTerm (#5.1) // Note: test based on Figure 7; server is leader line; peer is case (a) func TestCM_RpcRV_TermLessThanCurrentTerm(t *testing.T) { f := func(setup func(t *testing.T) (mcm *managedConsensusModule, mrs *mockRpcSender)) { mcm...
Update RequestVote step 1 test data
Update RequestVote step 1 test data
Go
mit
divtxt/raft-consensus,divtxt/raft
08263c059743d87503b8004a951d2ec90bcc71ed
internal/taskfile/read/taskfile.go
internal/taskfile/read/taskfile.go
package read import ( "fmt" "os" "path/filepath" "runtime" "github.com/go-task/task/internal/taskfile" "gopkg.in/yaml.v2" ) // Taskfile reads a Taskfile for a given directory func Taskfile(dir string) (*taskfile.Taskfile, error) { path := filepath.Join(dir, "Taskfile.yml") t, err := readTaskfile(path) if e...
package read import ( "fmt" "os" "path/filepath" "runtime" "github.com/go-task/task/internal/taskfile" "gopkg.in/yaml.v2" ) // Taskfile reads a Taskfile for a given directory func Taskfile(dir string) (*taskfile.Taskfile, error) { path := filepath.Join(dir, "Taskfile.yml") if _, err := os.Stat(path); err !=...
Fix wrong error message beingg print when the file has a syntax error
Fix wrong error message beingg print when the file has a syntax error Fixes #137
Go
mit
go-task/task,go-task/task
d71de790d449a80a283ae6c0c88ee277182d33af
leetcode/002-Add-Two-Numbers/go/Solution.go
leetcode/002-Add-Two-Numbers/go/Solution.go
/** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { p := new(ListNode) dump := p l1_val, l2_val, c, sum := 0, 0, 0, 0 for l1 != nil || l2 != nil { if l1 != nil { l1_val = l1.Val l1 = l1....
package _go /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { p := new(ListNode) dump := p l1_val, l2_val, c, sum := 0, 0, 0, 0 for l1 != nil || l2 != nil { if l1 != nil { l1_val = l1.Va...
Add Two Numbers - go - check if the leftmost int exists
[LEETCODE] Add Two Numbers - go - check if the leftmost int exists
Go
mit
Chasego/cod,Chasego/codi,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codi,Chasego/cod,Chasego/codi,Chasego/cod,Chasego/codirit
cac90d50a1f81b223f5b111e0a943c386499b906
web-ide/main.go
web-ide/main.go
package main import ( "log" "net/http" ) func main() { // Simple static webserver: log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("./webroot")))) }
package main import ( "log" "net/http" ) // To try out: https://github.com/pressly/chi func main() { // Simple static webserver: log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("./webroot")))) }
Add some notes as to what Go router to use
Add some notes as to what Go router to use
Go
mit
yumaikas/PISC-mirror,yumaikas/PISC-mirror,yumaikas/PISC-mirror,yumaikas/PISC-mirror
c65f894816be85903e392ce6e4d79cde6b81bfed
loaders/httpfs/loader.go
loaders/httpfs/loader.go
package httpfs import ( "io" "net/http" "os" "github.com/CloudyKit/jet" ) type httpFileSystemLoader struct { fs http.FileSystem } // NewLoader returns an initialized loader serving the passed http.FileSystem. func NewLoader(fs http.FileSystem) jet.Loader { return &httpFileSystemLoader{fs: fs} } // Open opens...
package httpfs import ( "io" "net/http" "os" "github.com/CloudyKit/jet" ) type httpFileSystemLoader struct { fs http.FileSystem } // NewLoader returns an initialized loader serving the passed http.FileSystem. func NewLoader(fs http.FileSystem) jet.Loader { return &httpFileSystemLoader{fs: fs} } // Open opens...
Fix `httpFileSystemLoader.Open` to not crash on nil
Fix `httpFileSystemLoader.Open` to not crash on nil The reason is that in certain cases (mainly in development) this loader might be configured with an empty file system – it accepts an interface so passing nil just works. If `Open` is called it shouldn’t crash.
Go
apache-2.0
CloudyKit/jet,CloudyKit/jet,CloudyKit/jet
23148addf0cb09e7fdd537272312e05823def0a5
inv.go
inv.go
// Copyright 2015 Jonathan J Lawlor. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package matrixexp // not yet implemented
// Copyright 2015 Jonathan J Lawlor. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package matrixexp // Not yet implemented. I'm hoping to use getrf -> getri from gonum/lapack, but // getri is not yet implemented. There will be some othe...
Add some comments to Inv
Add some comments to Inv
Go
mit
jonlawlor/matrixexp
b6652b04b20f1387f8988fb6c9c2da1838fd383b
serve/serve.go
serve/serve.go
// Copyright (C) 2015 Thomas de Zeeuw. // // Licensed onder the MIT license that can be found in the LICENSE file. package main import ( "flag" "fmt" "net/http" "os" "path/filepath" ) const ( portDesc = "The port to listen on, defaults to 8000" dirDesc = "The directory to serve, defaults to the working direc...
// Copyright (C) 2015 Thomas de Zeeuw. // // Licensed onder the MIT license that can be found in the LICENSE file. package main import ( "flag" "fmt" "net/http" "os" "path/filepath" ) const ( portDesc = "The port to listen on, defaults to 8000" dirDesc = "The directory to serve, defaults to the working direc...
Allow first argument as directory
Serve: Allow first argument as directory Now you can call `serve dir` or `server -d dir`.
Go
mit
Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools,Thomasdezeeuw/tools
5c817a75b291ed88406ff259ed72c4f774decde5
pkg/apis/apiextensions/v1beta1/doc.go
pkg/apis/apiextensions/v1beta1/doc.go
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Consolidate local OpenAPI specs and APIServices' spec into one data structure
Consolidate local OpenAPI specs and APIServices' spec into one data structure Remove APIService OpenAPI spec when it is deleted Add eTag support and returning httpStatus to OpenAPI spec downloader Update aggregated OpenAPI spec periodically Use delegate chain Refactor OpenAPI aggregator to have separate controller...
Go
apache-2.0
kubernetes/apiextensions-apiserver,kubernetes/apiextensions-apiserver
98fe683f3a67d95435642002a181cc4959ff7e81
files/copy.go
files/copy.go
package files import ( "io" "os" "path/filepath" ) // Copy copies a file to a given destination. It makes sur parent folders are // created on the way. Use `-` to copy to stdout. func Copy(src, dst string) error { if dst != "-" { if err := MkdirAll(filepath.Dir(dst)); err != nil { return err } } in, err...
package files import ( "io" "os" "path/filepath" ) // Copy copies a file to a given destination. It makes sur parent folders are // created on the way. Use `-` to copy to stdout. func Copy(src, dst string) error { in, err := os.Open(src) if err != nil { return err } defer in.Close() return CopyFrom(dst, 06...
Support output to stdout for any action
Support output to stdout for any action Signed-off-by: David Gageot <aa743a0aaec8f7d7a1f01442503957f4d7a2d634@gageot.net>
Go
apache-2.0
dgageot/getme
779bc0d9a001c7cfdf7b170f33b731c832ac56ab
challenge2/challenge2_test.go
challenge2/challenge2_test.go
package challenge2 import "testing" func TestCase1(t *testing.T) { cases := []struct { in int want bool }{ {120, false}, {166, true}, {141, true}, {79, false}, {26, true}, {158, true}, {174, false}, {141, true}, {169, true}, {129, false}, {199, false}, {27, false}, {57, true}, {183...
package challenge2 import "testing" func TestCase1(t *testing.T) { cases := []struct { in int want bool }{ {120, false}, {166, true}, {141, true}, {79, false}, {26, true}, {158, true}, {174, false}, {141, true}, {169, true}, {129, true}, {199, false}, {27, false}, {57, true}, {183,...
Fix test case for challenge2
Fix test case for challenge2
Go
mit
royvandewater/go-to-hell,royvandewater/go-to-hell
048d623df27426fed084c29773216f08a40de38c
skeleton/win.go
skeleton/win.go
// Graceful restarts and shutdowns are not supported // on windows, so using usual http.Serve instead. // // +build windows package main import ( "net/http" ) // serve is a wrapper on standard http.Serve method. func serve(s *http.Server) error { return http.Serve(s) }
// Graceful restarts and shutdowns are not supported // on windows, so using usual http.Serve instead. // // +build windows package main import ( "net/http" ) // serve is a wrapper on standard http.Serve method. func serve(s *http.Server) error { return s.ListenAndServe() }
Fix Win's version of serve
Fix Win's version of serve
Go
bsd-2-clause
runner-mei/goal,runner-mei/goal,runner-mei/goal
c24799383bd539dc332fa8612523068a6eb25b45
cmd/playing/main.go
cmd/playing/main.go
// Copyright 2016 Marc-Antoine Ruel. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. // playing is a small app to play with the pins, nothing more. You are not // expected to use it as-is. package main import ( "fmt" "os" ...
// Copyright 2016 Marc-Antoine Ruel. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. // playing is a small app to play with the pins, nothing more. You are not // expected to use it as-is. package main import ( "fmt" "os" "...
Generalize the printing of APA102 encoded buffers
Generalize the printing of APA102 encoded buffers
Go
apache-2.0
maruel/dlibox,maruel/dotstar,maruel/dotstar,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dlibox,maruel/dlibox
3d5157391c693f892c9c25eeebb5fef4ac83cd81
web/index/handler.go
web/index/handler.go
package index import ( "database/sql" "html/template" "log" "net/http" "github.com/concourse/atc" "github.com/concourse/atc/db" "github.com/pivotal-golang/lager" ) type TemplateData struct{} func NewHandler( logger lager.Logger, pipelineDBFactory db.PipelineDBFactory, pipelineHandler func(db.PipelineDB) h...
package index import ( "database/sql" "html/template" "log" "net/http" "github.com/concourse/atc" "github.com/concourse/atc/db" "github.com/pivotal-golang/lager" ) type TemplateData struct{} func NewHandler( logger lager.Logger, pipelineDBFactory db.PipelineDBFactory, pipelineHandler func(db.PipelineDB) h...
Add return in index to prevent 2 write responses
Add return in index to prevent 2 write responses
Go
apache-2.0
simonjjones/atc,pivotal-devin-fallak/atc,zachgersh/atc,zachgersh/atc,savaki/atc,zachgersh/atc,savaki/atc,utako/atc,simonjjones/atc,savaki/atc,utako/atc,pivotal-devin-fallak/atc,pivotal-devin-fallak/atc,simonjjones/atc,zachgersh/atc,utako/atc
81a277da2b320e5a73164436fd62a41f30a9beaf
announce_test.go
announce_test.go
package dht import ( "testing" "github.com/stretchr/testify/require" ) func TestAnnounceNoStartingNodes(t *testing.T) { s, err := NewServer(&ServerConfig{ Conn: mustListen(":0"), NoSecurity: true, }) require.NoError(t, err) defer s.Close() var ih [20]byte copy(ih[:], "blah") _, err = s.Announce(ih...
package dht import ( "testing" "github.com/stretchr/testify/require" ) func TestAnnounceNoStartingNodes(t *testing.T) { s, err := NewServer(&ServerConfig{ Conn: mustListen(":0"), NoSecurity: true, }) require.NoError(t, err) defer s.Close() var ih [20]byte copy(ih[:], "blah") _, err = s.Announce(ih...
Add test logging bloom filter characteristics
Add test logging bloom filter characteristics
Go
mpl-2.0
anacrolix/dht
349d830a609415002acfabe14e8932057eff780d
stats/server.go
stats/server.go
package stats import ( "encoding/json" "fmt" "net/http" "time" ) type Server struct { base history map[string][]*baseSnapshot } const ( serverSnapshotIntervl = 5 * time.Second serverHistorySize = 360 // 30 minutes of 5 second snapshots ) func NewServer() *Server { s := &Server{} s.init() s.history =...
package stats import ( "encoding/json" "fmt" "net/http" "time" ) type Server struct { base history map[string][]*baseSnapshot } const ( serverSnapshotIntervl = 5 * time.Second serverHistorySize = 360 // 30 minutes of 5 second snapshots ) func NewServer() *Server { s := &Server{} s.init() s.history =...
Reset stats after taking a snapshot
Reset stats after taking a snapshot
Go
mit
localhots/satan,localhots/satan,localhots/satan,localhots/satan
28ec40d32246cbb81166970843da2cf83b0535df
image/file.go
image/file.go
package image import ( "github.com/thoas/gostorages" "math" "mime" "path" "strings" ) type ImageFile struct { Source []byte Processed []byte Key string Headers map[string]string Filepath string Storage gostorages.Storage } func (i *ImageFile) Content() []byte { if i.Processed != nil { ret...
package image import ( "github.com/thoas/gostorages" "mime" "path" "strings" ) type ImageFile struct { Source []byte Processed []byte Key string Headers map[string]string Filepath string Storage gostorages.Storage } func (i *ImageFile) Content() []byte { if i.Processed != nil { return i.Pr...
Remove non-used method in image package
Remove non-used method in image package
Go
mit
thoas/picfit,slidenetwork/picfit,lizdeika/picfit,lizdeika/picfit,nsf/picfit,thoas/picfit,slidenetwork/picfit,lizdeika/picfit,nsf/picfit,slidenetwork/picfit,nsf/picfit
b7a5fbfb72860baabe2a27ff38a6e637258ea2a4
atom/parser_test.go
atom/parser_test.go
package atom_test import ( "bytes" "encoding/json" "fmt" "io/ioutil" "path/filepath" "strings" "testing" "github.com/mmcdole/gofeed/atom" "github.com/stretchr/testify/assert" ) // Tests func TestParser_Parse(t *testing.T) { files, _ := filepath.Glob("../testdata/parser/atom/*.xml") for _, f := range file...
package atom_test import ( "bytes" "encoding/json" "fmt" "io/ioutil" "path/filepath" "strings" "testing" "github.com/mmcdole/gofeed/atom" "github.com/stretchr/testify/assert" ) // Tests func TestParser_Parse(t *testing.T) { files, _ := filepath.Glob("../testdata/parser/atom/*.xml") for _, f := range file...
Fix transposed 'expected' and 'actual' arguments
Fix transposed 'expected' and 'actual' arguments Also: No need to pass address of pointer to json.Unmarshal
Go
mit
mmcdole/gofeed
30dfb23cefd77d780e4db4952e1b271394eb3f4f
src/rabbitmq-cluster-migration-tool/main.go
src/rabbitmq-cluster-migration-tool/main.go
package main import ( "fmt" "github.com/pivotal-cf/cf-rabbit-release/src/rabbitmq-cluster-migration-tool/configuration" ) func main() { migrator := configuration.NewMigrator("") err := migrator.MigrateConfiguration() if err != nil { fmt.Printf("Finished with error: %s", err) } }
package main func main() { }
Revert "allow the migration tool to run"
Revert "allow the migration tool to run" This reverts commit 4268b9e76a322ae9f873687b5f53aa8e776e5546.
Go
apache-2.0
pivotal-cf/cf-rabbitmq-release,pivotal-cf/cf-rabbitmq-release,ryheena/rabbitmq,ryheena/rabbitmq,pivotal-cf/cf-rabbitmq-release,shinji62/cf-rabbitmq-release,pivotal-cf/cf-rabbitmq-release,shinji62/cf-rabbitmq-release
27c8260ed71ba621a06991c97213ad0f6da52b44
src/tritium/tritium.go
src/tritium/tritium.go
package tritium import ( "tritium/linker" tp "athena/proto" "tritium/packager" "os" ) func Compile(file string) (*tp.Transform, os.Error) { defaultPackage := packager.LoadDefaultPackage(PackagePath) defaultPackage.BuildUserPackage(UserPackagePath, PackagePath) return linker.RunWithPackage(file, defaultPackag...
package tritium import ( "tritium/linker" ap "athena/proto" "tritium/packager" "os" "fmt" "path/filepath" "strings" ) func Compile(file string, rootPackage *ap.Package) (*ap.Transform, os.Error) { // defaultPackage := packager.LoadDefaultPackage(PackagePath) // defaultPackage.BuildUserPackage(UserPackagePath,...
Add mixer support. Now compile takes a package object as input to link / etc
Add mixer support. Now compile takes a package object as input to link / etc
Go
mpl-2.0
moovweb/tritium,moovweb/tritium,moovweb/tritium,moovweb/tritium,moovweb/tritium
7c1a9c7aabcd9f4a6cfb1a18c2b82f6144e7479c
pkg/minikube/cluster/cluster_windows.go
pkg/minikube/cluster/cluster_windows.go
/* Copyright (C) 2016 Red Hat, 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 to in writing, softwa...
/* Copyright (C) 2016 Red Hat, 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 to in writing, softwa...
Add docker ssh user to hyperv config
Add docker ssh user to hyperv config
Go
apache-2.0
jimmidyson/minishift,thatdocslady/minishift,LalatenduMohanty/minishift,jimmidyson/minishift,minishift/minishift,Preeticp/minishift,minishift/minishift,LalatenduMohanty/minishift,praveenkumar/minishift,budhrg/minishift,praveenkumar/minishift,Preeticp/minishift,minishift/minishift,jimmidyson/minishift,thatdocslady/minish...
3ecb98129a0d5191969bc4c4046aa0a8d893852d
testcmd/main.go
testcmd/main.go
package main import ( "flag" "os" "os/exec" "os/signal" "syscall" "time" "github.com/cybozu-go/log" ) var ( flgIgnoreSigPipe = flag.Bool("i", false, "ignore SIGPIPE") flgClearErrorHandler = flag.Bool("c", false, "clear error handler") flgStdout = flag.Bool("s", false, "output to stdout") ) ...
package main import ( "flag" "fmt" "os" "os/exec" "os/signal" "syscall" "time" "github.com/cybozu-go/log" ) var ( flgIgnoreSigPipe = flag.Bool("i", false, "ignore SIGPIPE") flgClearErrorHandler = flag.Bool("c", false, "clear error handler") flgStdout = flag.Bool("s", false, "output to stdou...
Add test for error handling in WriteThrough
Add test for error handling in WriteThrough
Go
mit
cybozu-go/log
6137b401eec5a96101a6acb3c3547e7269d7eeb6
cli/create_admin.go
cli/create_admin.go
// Copyright 2018 Frédéric Guillot. All rights reserved. // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. package cli // import "miniflux.app/cli" import ( "fmt" "os" "miniflux.app/model" "miniflux.app/storage" ) func createAdmin(store *storage.Storage) ...
// Copyright 2018 Frédéric Guillot. All rights reserved. // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. package cli // import "miniflux.app/cli" import ( "fmt" "os" "miniflux.app/logger" "miniflux.app/model" "miniflux.app/storage" ) func createAdmin(s...
Make user creation via environment variables idempotent
Make user creation via environment variables idempotent
Go
apache-2.0
xqin/miniflux,miniflux/miniflux,xqin/miniflux,xqin/miniflux,miniflux/miniflux,xqin/miniflux,miniflux/miniflux
8884771ea88c8361f37ca313b9507ac55e68c97f
aws/ec2/availability_zone_retriever.go
aws/ec2/availability_zone_retriever.go
package ec2 import ( "errors" goaws "github.com/aws/aws-sdk-go/aws" awsec2 "github.com/aws/aws-sdk-go/service/ec2" ) type AvailabilityZoneRetriever struct { ec2ClientProvider ec2ClientProvider } func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever { return Availabili...
package ec2 import ( "errors" goaws "github.com/aws/aws-sdk-go/aws" awsec2 "github.com/aws/aws-sdk-go/service/ec2" ) type AvailabilityZoneRetriever struct { ec2ClientProvider ec2ClientProvider } func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever { return Availabili...
Fix bbl up for AWS
Fix bbl up for AWS - Different calls to AWS return different lists of availability zones - Short-term fix ignores the az that is not returned by cloudformation call [#139857703]
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader,niroyb/bosh-bootloader
3f37792b1335cf3e0a31f55f3b33840d6c760688
config/track_test.go
config/track_test.go
package config import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestTrackIgnoreString(t *testing.T) { track := &Track{ IgnorePatterns: []string{ "con[.]txt", "pro.f", }, } testCases := map[string]bool{ "falcon.txt": false, "beacon|txt": true, "beacon.ext": true, "proof": ...
package config import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestAcceptFilename(t *testing.T) { testCases := []struct { desc string filenames []string expected bool }{ {"allowed filename", []string{"beacon.ext", "falcon.zip"}, true}, {"ignored filename", []string{"beacon...
Update test cases in track
Update test cases in track This renames TestTrackIngoreString to TestAcceptFilename. This refactor also changes the name of the subtests to give a better understanding of why the test is failing.
Go
mit
exercism/cli,exercism/cli
6ad242e0633e22f1fd16c28200b33e37cd8dedde
version/version_test.go
version/version_test.go
package version import ( "testing" ) func TestVersioning(t *testing.T) { if !NewVersionAvailable("v0.1.0") { t.Error("should be a version newer than v0.1.0") } }
package version import ( "testing" ) func TestVersioning(t *testing.T) { if !NewVersionAvailable("v1.0.0") { t.Error("should be a version newer than v1.0.0") } }
Fix version check test too
Fix version check test too
Go
mit
tardisx/discord-auto-upload,tardisx/discord-auto-upload,tardisx/discord-auto-upload
73f5faba9cd044a44c3b2e25f4f8a8fd5327567d
cloudconfig/openstack/base_ops_template.go
cloudconfig/openstack/base_ops_template.go
package openstack const ( BaseOps = `--- - type: replace path: /azs value: - name: z1 cloud_properties: availability_zone: ((az)) - name: z2 cloud_properties: availability_zone: ((az)) - name: z3 cloud_properties: availability_zone: ((az)) - type: replace path: /compilation ...
package openstack const ( BaseOps = `--- - type: replace path: /azs value: - name: z1 cloud_properties: availability_zone: ((az)) - name: z2 cloud_properties: availability_zone: ((az)) - name: z3 cloud_properties: availability_zone: ((az)) - type: replace path: /vm_types v...
Add vm types to openstack cloud config.
Add vm types to openstack cloud config. [#155017559] Signed-off-by: Rowan Jacobs <f6a1b0cdf5ee40839db77d8af28f9a0cbe9aba71@pivotal.io>
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader
eac65a0084f6e99cbebbbcd24ca71851b74643e9
lib/raczlib/make_cgo.go
lib/raczlib/make_cgo.go
// Copyright 2019 The Wuffs 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
// Copyright 2019 The Wuffs 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
Fix lib/raczlib build for CGO_ENABLED=0
Fix lib/raczlib build for CGO_ENABLED=0
Go
apache-2.0
google/wuffs,google/wuffs,google/wuffs,google/wuffs,google/wuffs
111efbfcf660b9fe15dfa608657e2f4274002339
src/cred-alert/db/db_suite_test.go
src/cred-alert/db/db_suite_test.go
package db_test import ( "cred-alert/mysqlrunner" "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestDB(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "DB Suite") } var dbRunner mysqlrunner.Runner var _ = BeforeSuite(func() { dbRunner = mysqlrunner.Runner{ DBName: fm...
package db_test import ( "cred-alert/mysqlrunner" "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestDB(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "DB Suite") } var dbRunner mysqlrunner.Runner var _ = BeforeSuite(func() { dbRunner = mysqlrunner.Runner{ DBName: fm...
Truncate test db in AfterEach
Truncate test db in AfterEach [#128790261] Signed-off-by: Christopher Brown <eb0819782e2e967e3d4f4d71eab0c647ed2659cf@pivotal.io>
Go
apache-2.0
pivotal-cf/cred-alert,pivotal-cf/cred-alert