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
f65c87730f5be0982d9607f97953a80a02e53e94
pkg/client/fs/fs_windows.go
pkg/client/fs/fs_windows.go
// +build windows /* * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this fs 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 appl...
// +build windows /* * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this fs 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 appl...
Define error for windows, minor fix pushing in
Define error for windows, minor fix pushing in
Go
agpl-3.0
harshavardhana/mc,balamurugana/mc,winchram/mc,winchram/mc,CarterMcClellan/mc,abperiasamy/mc,abperiasamy/mc,vadmeste/mc,vadmeste/mc,CarterMcClellan/mc,balamurugana/mc,krisis/mc,minio/mc,akiradeveloper/mc,harshavardhana/mc,akiradeveloper/mc,krisis/mc,minio/mc
297dd000cad23a2416a40be48c86d58dc3ab8d2c
resources/rds/db_subnet_group.go
resources/rds/db_subnet_group.go
package rds import ( "github.com/jagregory/cfval/constraints" "github.com/jagregory/cfval/resources/common" . "github.com/jagregory/cfval/schema" ) // see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html var DBSubnetGroup = Resource{ AwsType: "AWS::RDS::DBSubnetG...
package rds import ( "github.com/jagregory/cfval/constraints" "github.com/jagregory/cfval/resources/common" . "github.com/jagregory/cfval/schema" ) // see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html var DBSubnetGroup = Resource{ AwsType: "AWS::RDS::DBSubnetG...
Set ReturnValue for DBSubnetGroup after docs were updated
Set ReturnValue for DBSubnetGroup after docs were updated Fixes #33
Go
mit
jagregory/cfval,jagregory/cfval
e0f4429387f46ea32bc58f5ee852959156fef27d
server/server_suite_test.go
server/server_suite_test.go
package server_test import ( "code.cloudfoundry.org/garden/client" "code.cloudfoundry.org/garden/client/connection" "code.cloudfoundry.org/garden/server" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestServer(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Server Suite") } ...
package server_test import ( "testing" "code.cloudfoundry.org/garden/client" "code.cloudfoundry.org/garden/client/connection" "code.cloudfoundry.org/garden/server" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func TestServer(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Server Suite") } ...
Increase listenAndServe timeout to 2s
Increase listenAndServe timeout to 2s We *think* that tests fails sometimes because the server isn't quite ready. [#154516396] Signed-off-by: Georgi Sabev <cd7643e50243a10153b49cb72b4bdbf8b48cb045@gmail.com>
Go
apache-2.0
cloudfoundry-incubator/garden,cloudfoundry-incubator/garden
d3b8ebded88529ae95523d7529837b6c2ab27792
non_rest_routes.go
non_rest_routes.go
package main import ( "github.com/dynport/dgtk/cli" "github.com/phrase/phraseapp-go/phraseapp" ) func ApplyNonRestRoutes(r *cli.Router, cfg *phraseapp.Config) { r.Register("pull", &PullCommand{Config: *cfg}, "Download locales from your PhraseApp project.\n You can provide parameters supported by the locales#downl...
package main import ( "github.com/dynport/dgtk/cli" "github.com/phrase/phraseapp-go/phraseapp" ) func ApplyNonRestRoutes(r *cli.Router, cfg *phraseapp.Config) { r.Register("pull", &PullCommand{Config: *cfg}, "Download locales from your PhraseApp project.\n You can provide parameters supported by the locales#downl...
Use new api docs urls
Use new api docs urls
Go
mit
phrase/phraseapp-client,phrase/phraseapp-client
ab4fddb895d221ecbbb096b43a5ece3d193dfdc0
models/volume_mount.go
models/volume_mount.go
package models import ( "errors" "code.cloudfoundry.org/bbs/format" ) func (*VolumePlacement) Version() format.Version { return format.V1 } func (*VolumePlacement) Validate() error { return nil } // while volume mounts are experimental, we should never persist a "old" volume // mount to the db layer, so the ha...
package models import ( "errors" "code.cloudfoundry.org/bbs/format" ) func (*VolumePlacement) Version() format.Version { return format.V1 } func (*VolumePlacement) Validate() error { return nil } func (v *VolumeMount) Validate() error { var ve ValidationError if v.Driver == "" { ve = ve.Append(errors.New("...
Remove comment referencing volume mounts as experimental
Remove comment referencing volume mounts as experimental Co-authored-by: Amin Jamali <828117156edecfc83d6e458626bc6ccd219cba0e@pivotal.io>
Go
apache-2.0
cloudfoundry-incubator/bbs,cloudfoundry-incubator/bbs
10e10a0d172706241d350bfbfe9ac027006dbd86
main.go
main.go
package main import ( "fmt" "os" "github.com/bfirsh/whalebrew/cmd" ) func main() { if len(os.Args) > 1 { // Check if not command exists if _, _, err := cmd.RootCmd.Find(os.Args); err != nil { // Check if file exists if _, err := os.Stat(os.Args[1]); err == nil { cmd.RootCmd.SetArgs(append([]string...
package main import ( "fmt" "os" "strings" "github.com/bfirsh/whalebrew/cmd" ) func main() { // HACK: if first argument starts with "/", prefix the subcommand run. // This allows us to use this command as a shebang, because we can't pass // the argument "run" in the shebang on Linux. if len(os.Args) > 1 && s...
Revert "Fix checking args (for working on windows)"
Revert "Fix checking args (for working on windows)" This reverts commit 926f422e1dffdc35444e74bde2f52279a65cb3c3.
Go
apache-2.0
3846masa/whalebrew,3846masa/whalebrew
446d4bd25367aaa46bb11a2317c5fbf980734639
pkg/core/model/app.go
pkg/core/model/app.go
package model import ( "net/http" "strconv" "github.com/skygeario/skygear-server/pkg/core/config" ) type KeyType int const ( // NoAccessKey means no correct access key NoAccessKey KeyType = iota // APIAccessKey means request is using api key APIAccessKey // MasterAccessKey means request is using master key ...
package model import ( "net/http" "strconv" "github.com/skygeario/skygear-server/pkg/core/config" ) type KeyType int const ( // NoAccessKey means no correct access key NoAccessKey KeyType = iota // APIAccessKey means request is using api key APIAccessKey // MasterAccessKey means request is using master key ...
Fix api key in http request header
Fix api key in http request header Follow the header name of skygear-server.
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
cdb28cf4335fa829b9ab040554c34bf3ac76f641
render/decoder_test.go
render/decoder_test.go
package render import ( "testing" "github.com/stretchr/testify/assert" ) func TestRegisterDecoder(t *testing.T) { assert.NotNil(t, RegisterDecoder("too long", nil)) short := "s" assert.NotNil(t, RegisterDecoder(short, nil)) assert.NotNil(t, RegisterDecoder(".png", nil)) assert.Nil(t, RegisterDecoder(".new", n...
package render import ( "testing" "github.com/stretchr/testify/assert" ) func TestRegisterDecoder(t *testing.T) { assert.NotNil(t, RegisterDecoder(".png", nil)) assert.Nil(t, RegisterDecoder(".new", nil)) }
Update decoder tests for more lenient extension registration
Update decoder tests for more lenient extension registration
Go
apache-2.0
oakmound/oak,oakmound/oak,oakmound/oak
8857d2a3ff761d0a8c846bb1afb80b4889bbad87
main.go
main.go
package main import ( "fmt" "log" "os" "github.com/spf13/cobra" "github.com/hellofresh/kandalf/cmd" ) var ( version string configPath string versionFlag bool ) func main() { versionString := "Kandalf v" + version cobra.OnInitialize(func() { if versionFlag { fmt.Println(versionString) os.Exit...
package main import ( "log" "github.com/spf13/cobra" "github.com/hellofresh/kandalf/cmd" ) var ( version string configPath string ) func main() { var RootCmd = &cobra.Command{ Use: "kandalf", Version: version, Short: `RabbitMQ to Kafka bridge.`, Long: `RabbitMQ to Kafka bridge. Complete doc...
Use built-in cobra version parameter
Use built-in cobra version parameter
Go
mit
hellofresh/kandalf,hellofresh/kandalf
a3feb3131f2021d4f5a09a110981377e2c1cbfe8
main.go
main.go
package main import ( "flag" "log" "os" "runtime/pprof" "github.com/hajimehoshi/ebiten" "github.com/ranchblt/labyrinthofthechimera/labyrinth" ) // Version is autoset from the build script var Version string // Build is autoset from the build script var Build string var cpuprofile = flag.String("cpuprofile", ...
package main import ( "flag" "log" "os" "runtime/pprof" "github.com/hajimehoshi/ebiten" "github.com/ranchblt/labyrinthofthechimera/labyrinth" ) // Version is autoset from the build script var Version string // Build is autoset from the build script var Build string var cpuprofile = flag.String("cpuprofile", ...
Add version + build to window title
Add version + build to window title
Go
mit
ranchblt/labyrinthofthechimera
79d16f53d1dbdd35b7420504a93a868fbf718177
svnwatch/repository.go
svnwatch/repository.go
package svnwatch import ( "encoding/xml" "github.com/jackwilsdon/svnwatch/svn" "github.com/pkg/errors" ) type Repositories struct { XMLName xml.Name `xml:"repositories"` Repositories []Repository `xml:"repository"` } func (r *Repositories) ForURL(url string) *Repository { for i, _ := range r.Reposito...
package svnwatch import ( "encoding/xml" "github.com/jackwilsdon/svnwatch/svn" "github.com/pkg/errors" ) type Repositories struct { XMLName xml.Name `xml:"repositories"` Repositories []Repository `xml:"repository"` } func (r *Repositories) ForURL(url string) *Repository { for i, _ := range r.Reposito...
Swap URL and Revision attributes of Repository
Swap URL and Revision attributes of Repository
Go
agpl-3.0
jackwilsdon/svnwatch
cb5f63f336aa9db497f72cbae2b742bff4155d51
bouncermain/bouncer.go
bouncermain/bouncer.go
package bouncermain import ( "net/http" "os" "runtime" "time" "github.com/op/go-logging" ) var logger = logging.MustGetLogger("bouncer") var decoder = newDecoder() var format = logging.MustStringFormatter( "%{color}%{time:15:04:05.000} %{level:.4s} %{id:03x}%{color:reset} %{message}", ) func setupLogging() ...
package bouncermain import ( "net/http" "os" "runtime" "time" "github.com/op/go-logging" ) var logger = logging.MustGetLogger("bouncer") var decoder = newDecoder() var format = logging.MustStringFormatter( "%{color}%{time:15:04:05.000} %{level:.4s} %{id:03x}%{color:reset} %{message}", ) func setupLogging() ...
Modify default port to 5505
Modify default port to 5505
Go
apache-2.0
pjwerneck/bouncer
e6fc0ed22d3f670597c9a363810d5e1dbd7f192e
client_windows_test.go
client_windows_test.go
/* Copyright The containerd 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...
/* Copyright The containerd 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...
Convert Windows CI to use Microsoft MCR image urls
Convert Windows CI to use Microsoft MCR image urls Signed-off-by: Justin Terry (VM) <f0c38945ef01caad6a7c3d4b90a29703264b34a4@microsoft.com>
Go
apache-2.0
vdemeester/containerd,estesp/containerd,thaJeztah/containerd,containerd/containerd,mikebrow/containerd,dmcgowan/containerd,thaJeztah/containerd,vdemeester/containerd,containerd/containerd,crosbymichael/containerd,dmcgowan/containerd,mikebrow/containerd,estesp/containerd,crosbymichael/containerd
843f0d4612cd2ee120b227a03b55aa7b1569e846
storage/uploads.go
storage/uploads.go
// Copyright 2015 Jeff Martinez. All rights reserved. // Use of this source code is governed by a // license that can be found in the LICENSE.txt file // or at http://opensource.org/licenses/MIT package storage import ( "fmt" "github.com/jeffbmartinez/log" ) func StoreUpload(uuid string, originalFilename string, ...
// Copyright 2015 Jeff Martinez. All rights reserved. // Use of this source code is governed by a // license that can be found in the LICENSE.txt file // or at http://opensource.org/licenses/MIT package storage import ( "fmt" "github.com/jeffbmartinez/log" ) func StoreUpload(uuid string, originalFilename string, ...
Add uploaded file info to db
Add uploaded file info to db
Go
mit
jeffbmartinez/analyzedata,jeffbmartinez/analyzedata
ee383e2257b5b4a76efcef0ef4bced9755229a45
main.go
main.go
// Copyright © 2016 Sidharth Kshatriya // // 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 agre...
// Copyright © 2016 Sidharth Kshatriya // // 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 agre...
Add a light red background for the dontbug prefix for fatal errors
Add a light red background for the dontbug prefix for fatal errors
Go
apache-2.0
sidkshatriya/dontbug,sidkshatriya/dontbug
38ab565ef74832ddb8375b77db8b661fc71cc9f9
main.go
main.go
package main import ( "fmt" "os" "github.com/kori/surt/pkg" ) func main() { switch os.Args[1] { case "build": file := os.Args[2] p := pkg.Prepare(file) fmt.Println(p.Info.Name) case "add": fmt.Println("not implemented yet!") } }
package main import ( "fmt" "os" "github.com/kori/surt/pkg" ) func main() { switch os.Args[1] { default: fmt.Println("no operation specified") case "build": file := os.Args[2] p := pkg.Build(file) fmt.Println(p.Info.Name) case "add": fmt.Println("not implemented yet!") } }
Add default case to operation switch
Add default case to operation switch
Go
isc
kori/surt,darthlukan/surt
21c391cd7e97a2baf8d89457b64424744fa088dc
modules/middleware/vhost.go
modules/middleware/vhost.go
package middleware import ( "fmt" "github.com/gin-gonic/gin" "regexp" ) // Dynamic routing based on host given by a map. func VHOST(plan Plan) func(*gin.Context) { portmatch := regexp.MustCompile(":.*$") return func(c *gin.Context) { host := c.Request.Host hostwithoutport := portmatch.ReplaceAllLiteralString...
package middleware import ( "fmt" "github.com/gin-gonic/gin" "regexp" ) // Dynamic routing based on host given by a map. func VHOST(plan Plan) func(*gin.Context) { portmatch := regexp.MustCompile(":.*$") return func(c *gin.Context) { host := c.Request.Host hostwithoutport := portmatch.ReplaceAllLiteralString...
Revert "Produce proper 404 when route not found."
Revert "Produce proper 404 when route not found." This reverts commit 1099c4f3773f2a2d9629b8ca28205359f8ac824e.
Go
mit
carbonsrv/carbon,vifino/carbon,vifino/carbon,carbonsrv/carbon,carbonsrv/carbon,vifino/carbon
488bbcb9a0210fb716275fb308356daaf0eb8b8e
newedit/editor_test.go
newedit/editor_test.go
package newedit import ( "os" "testing" "github.com/elves/elvish/eval" ) func TestNs(t *testing.T) { ev := eval.NewEvaler() ed := NewEditor(os.Stdin, os.Stdout, ev) ev.Global.AddNs("edit", ed.Ns()) ev.EvalSource(eval.NewScriptSource("[t]", "[t]", "edit:max-height = 20")) if ed.core.Config.Raw.MaxHeight != 2...
package newedit import ( "os" "testing" "github.com/elves/elvish/eval" ) var devNull *os.File func init() { f, err := os.Open(os.DevNull) if err != nil { panic(err) } devNull = f } func TestNs(t *testing.T) { ev := eval.NewEvaler() ed := NewEditor(devNull, devNull, ev) ev.Global.AddNs("edit", ed.Ns()) ...
Use the null device in editor test.
newedit: Use the null device in editor test.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
3a114e9550073cf66c07f9656d13277607c7027e
adapters/semtech/adapter_test.go
adapters/semtech/adapter_test.go
// Copyright © 2015 The Things Network // Use of this source code is governed by the MIT license that can be found in the LICENSE file. package semtech import ( . "github.com/thethingsnetwork/core/utils/testing" "testing" ) func TestNewAdapter(t *testing.T) { Ok(t, "pending") } func TestSend(t *testing.T) { Ok(...
// Copyright © 2015 The Things Network // Use of this source code is governed by the MIT license that can be found in the LICENSE file. package semtech import ( "github.com/thethingsnetwork/core" . "github.com/thethingsnetwork/core/utils/testing" "testing" ) func TestNewAdapter(t *testing.T) { Ok(t, "pending") }...
Write tests for unsupported methods
[broker] Write tests for unsupported methods
Go
mit
TheThingsNetwork/ttn,LoRaWanSoFa/ttn,mgranberry/ttn,TheThingsNetwork/ttn,TheThingsNetwork/ttn,mgranberry/ttn,LoRaWanSoFa/ttn,jvanmalder/ttn,jvanmalder/ttn,mgranberry/ttn,jvanmalder/ttn
8ae18ede39728d61830544ae795a7fa36bf42ea6
zoom.go
zoom.go
// Copyright 2015 Alex Browne. All rights reserved. // Use of this source code is governed by the MIT // license, which can be found in the LICENSE file. // Package zoom is a blazing-fast datastore and querying engine for // Go built on Redis. It supports models of any arbitrary struct // type and provides basic quer...
// Copyright 2015 Alex Browne. All rights reserved. // Use of this source code is governed by the MIT // license, which can be found in the LICENSE file. // Package zoom is a blazing-fast datastore and querying engine for // Go built on Redis. It supports models of any arbitrary struct // type and provides basic quer...
Make Init return an error
Make Init return an error
Go
mit
albrow/zoom
50001effe889735d21610042062806aa61714407
src/packaging/main.go
src/packaging/main.go
package main import ( "fmt" "packaging/math" ) func main() { xs := []float64{1, 2, 3, 4} avg := math.Average(xs) fmt.Println(avg) }
package main import ( "fmt" m "packaging/math" ) func main() { xs := []float64{1, 2, 3, 4} avg := m.Average(xs) fmt.Println(avg) }
Add alias in packaging example
Add alias in packaging example
Go
apache-2.0
jsenon/golearning
376283d9b93d7e99a61a630c42b8feb9e60bb459
split/responses_packer.go
split/responses_packer.go
package split import ( "bytes" "mime" "mime/multipart" "net/http" "net/textproto" ) // WriteResponses serialize the responses passed as argument into the ResponseWriter func WriteResponses(w http.ResponseWriter, responses []*http.Response) error { var buf bytes.Buffer multipartWriter := multipart.NewWriter(&bu...
package split import ( "bytes" "mime" "mime/multipart" "net/http" "net/textproto" ) // WriteResponses serialize the responses passed as argument into the ResponseWriter func WriteResponses(w http.ResponseWriter, responses []*http.Response) error { var buf bytes.Buffer multipartWriter := multipart.NewWriter(&bu...
Fix the response adding the closing delimiter
Fix the response adding the closing delimiter
Go
mit
aarnone/httpbatcher
7a4d445c8640aaf050a281059143cef50ec8271c
admin.go
admin.go
package gapi import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "github.com/grafana/grafana/pkg/api/dtos" ) func (c *Client) CreateUserForm(settings dtos.AdminCreateUserForm) error { data, err := json.Marshal(settings) req, err := c.newRequest("POST", "/api/admin/users", bytes.NewBuffer(data)) if e...
package gapi import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "github.com/grafana/grafana/pkg/api/dtos" ) func (c *Client) CreateUserForm(settings dtos.AdminCreateUserForm) error { data, err := json.Marshal(settings) req, err := c.newRequest("POST", "/api/admin/users", bytes.NewBuffer(data)) if e...
Add generic method to create a new user
Add generic method to create a new user
Go
apache-2.0
raintank/grafana-api-golang-client
92409766a3c69ef9024f729c59a2514316dc88a8
stackinternal_test.go
stackinternal_test.go
package stack import ( "runtime" "testing" ) func TestFindSigpanic(t *testing.T) { t.Parallel() sp := findSigpanic() if got, want := sp.Name(), "runtime.sigpanic"; got != want { t.Errorf("got == %v, want == %v", got, want) } } func TestCaller(t *testing.T) { t.Parallel() c := Caller(0) _, file, line, ok ...
package stack import ( "runtime" "testing" ) func TestFindSigpanic(t *testing.T) { t.Parallel() sp := findSigpanic() if got, want := sp.Name(), "runtime.sigpanic"; got != want { t.Errorf("got == %v, want == %v", got, want) } } func TestCaller(t *testing.T) { t.Parallel() c := Caller(0) _, file, line, ok ...
Add additional test for Trace().
Add additional test for Trace().
Go
mit
go-stack/stack
13698b7b1f38ebc2a6b94985df740215321ed370
extra/parser/errors.go
extra/parser/errors.go
package parser import ( "fmt" "strings" ) type ParseError struct { // starts with 1 Line uint Column uint Msg string Src string } func (p *ParseError) Error() string { return fmt.Sprintf("[%d:%d]: %s", p.Line, p.Column, p.Msg) } func (p *ParseError) Verbose() string { l := fmt.Sprintf("%d: ", p.Line) ...
package parser import ( "fmt" "strings" ) type ParseError struct { // starts with 1 Line uint Column uint Msg string Src string } func (p *ParseError) Error() string { return fmt.Sprintf("%d:%d: %s", p.Line, p.Column, p.Msg) } func (p *ParseError) Verbose() string { l := fmt.Sprintf("%d: ", p.Line) re...
Update the behavior of formatting ParseError
Update the behavior of formatting ParseError
Go
mit
elpinal/coco3
f460c300cbafcadf65edff59285d6bd346b9fc16
build.go
build.go
package cmdtest import ( "io/ioutil" "os" "os/exec" "path/filepath" ) func Build(mainPath string, args ...string) (string, error) { return BuildIn(os.Getenv("GOPATH"), mainPath, args...) } func BuildIn(gopath string, mainPath string, args ...string) (string, error) { if len(gopath) == 0 { panic("$GOPATH not ...
package cmdtest import ( "io/ioutil" "os" "os/exec" "path/filepath" ) func Build(mainPath string, args ...string) (string, error) { return BuildIn(os.Getenv("GOPATH"), mainPath, args...) } func BuildIn(gopath string, mainPath string, args ...string) (string, error) { if len(gopath) == 0 { panic("$GOPATH not ...
Include existing env vars in Build
Include existing env vars in Build Signed-off-by: Max Brunsfeld <8ee73e75b50cc292b5052b11f2ca25336d3e974e@pivotallabs.com>
Go
apache-2.0
vito/cmdtest
f959081f681ba63c006eeb0dbc77a21f8d5b22c3
utils.go
utils.go
package scipipe import ( // "github.com/go-errors/errors" //"os" "os/exec" re "regexp" ) func ExecCmd(cmd string) { Info.Println("Executing command: ", cmd) combOutput, err := exec.Command("bash", "-lc", cmd).CombinedOutput() if err != nil { Error.Println("Could not execute command `" + cmd + "`: " + string(...
package scipipe import ( // "github.com/go-errors/errors" //"os" "os" "os/exec" re "regexp" ) func ExecCmd(cmd string) string { Info.Println("Executing command: ", cmd) combOutput, err := exec.Command("bash", "-lc", cmd).CombinedOutput() if err != nil { Error.Println("Could not execute command `" + cmd + "`...
Return output from ExecCmd function
Return output from ExecCmd function
Go
mit
scipipe/scipipe,scipipe/scipipe,samuell/scipipe
2e616b842c1127f0f4f1e49fcf2765d347bcaea1
content/concurrency/mutex-counter.go
content/concurrency/mutex-counter.go
// +build OMIT package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { v map[string]int mux sync.Mutex } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mux.Lock() // Lock so only one goroutine at a time ca...
// +build OMIT package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { mu sync.Mutex v map[string]int } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mu.Lock() // Lock so only one goroutine at a time can a...
Rename mux -> mu to follow convention
tour: Rename mux -> mu to follow convention Nearly all sync.Mutex members in the standard library are named mu, or use "mu" as part of the name. While this isn't a documented recommendation anywhere that I can find, it would seem nice to start new users with this same convention. Change-Id: I67cbe2a0052b81d8bb57d5ece...
Go
bsd-3-clause
golang/tour,zorion/go-tour-ca,zorion/go-tour-ca,dupoxy/go-tour-fr,dupoxy/go-tour-fr,dupoxy/go-tour-fr
81cbba68d09edf8c1ab70f439f1254f238e1ab16
perf_test.go
perf_test.go
package router import ( "encoding/base64" "testing" ) const ( Host = "1.2.3.4" Port = 1234 SessionKey = "14fbc303b76bacd1e0a3ab641c11d114" Session = "QfahjQKyC6Jxb/JHqa1kZAAAAAAAAAAAAAAAAAAAAAA=" ) func BenchmarkEncryption(b *testing.B) { s, _ := NewAESSessionEncoder([]byte(SessionKey), base64.StdEncoding) ...
package router import ( "encoding/base64" "testing" ) const ( Host = "1.2.3.4" Port = 1234 SessionKey = "14fbc303b76bacd1e0a3ab641c11d114" Session = "QfahjQKyC6Jxb/JHqa1kZAAAAAAAAAAAAAAAAAAAAAA=" ) func BenchmarkEncryption(b *testing.B) { s, _ := NewAESSessionEncoder([]byte(SessionKey), base64.StdEncoding) ...
Fix sessionKey typing for benchmark
Fix sessionKey typing for benchmark Change-Id: I6f7e4bad5c5124ca34e947ec0096b4d26829a40b
Go
apache-2.0
dramich/cf-bigip-ctlr,ryan-talley/cf-bigip-ctlr,ryan-talley/cf-bigip-ctlr,ryan-talley/cf-bigip-ctlr,ryan-talley/cf-bigip-ctlr,dramich/cf-bigip-ctlr,dramich/cf-bigip-ctlr,dramich/cf-bigip-ctlr
75b1585be48e1d8d3a27bde635f33a22893c04ea
cmd/merkleeyes/merkleeyes.go
cmd/merkleeyes/merkleeyes.go
package main import ( "github.com/codegangsta/cli" . "github.com/tendermint/go-common" "github.com/tendermint/tmsp/server" "os" application "github.com/tendermint/merkleeyes/app" ) func main() { app := cli.NewApp() app.Name = "cli" app.Usage = "cli [command] [args...]" app.Commands = []cli.Command{ { N...
package main import ( "github.com/codegangsta/cli" . "github.com/tendermint/go-common" "github.com/tendermint/tmsp/server" "os" application "github.com/tendermint/merkleeyes/app" ) func main() { app := cli.NewApp() app.Name = "cli" app.Usage = "cli [command] [args...]" app.Commands = []cli.Command{ { N...
Connect to unix://data.sock by default
Connect to unix://data.sock by default
Go
apache-2.0
tendermint/merkleeyes,tendermint/merkleeyes
fb3bfa09e7af7b4bd1fc2766ea8a6cf2baea6731
db/db.go
db/db.go
package db import ( "database/sql" "fmt" "github.com/rafaeljusto/cctldstats/config" ) // Connection database connection. var Connection *sql.DB // Connect performs the database connection. Today the following databases are supported: mysql and postgres func Connect() (err error) { var connParams string switch ...
package db import ( "database/sql" "fmt" "github.com/rafaeljusto/cctldstats/config" ) // Connection database connection. var Connection *sql.DB // Connect performs the database connection. Today the following databases are supported: mysql and postgres func Connect() (err error) { var connParams string switch ...
Disable SSL in database connection for now
Disable SSL in database connection for now
Go
mit
rafaeljusto/cctldstats
ae01a3dc387a96fefd6595f031ea50e253126225
web/views/list.go
web/views/list.go
package views const list = ` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>alexandria</title> <link rel="stylesheet" href="/assets/styles.css" /> </head> <body> <h1>alexandria</h1> {{if .}} <div id="cover"> <a id="browserid" href="#" title="Sign-in with Persona...
package views const list = ` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>alexandria</title> <link rel="stylesheet" href="/assets/styles.css" /> </head> <body> <h1>alexandria</h1> {{if .}} <div id="cover"> <a id="browserid" href="#" title="Sign-in with Persona...
Remove protocol on jquery include
Remove protocol on jquery include
Go
mit
hawx/alexandria,hawx/alexandria
27a30ad59a93c22962db76c69f49bc46b4a9e7f8
middleware/configuration/command_line_args.go
middleware/configuration/command_line_args.go
package configuration import "flag" func FromCommandLineArgs() *ApplicationConfiguration { hostPort := flag.String("hostPort", ":9000", "Host:port of the greenwall HTTP server") staticDir := flag.String("staticDir", "frontend", "Path to frontend static resources") flag.Parse() return &ApplicationConfiguration{ ...
package configuration import "flag" func FromCommandLineArgs() *ApplicationConfiguration { hostPort := flag.String("hostPort", ":9001", "Host:port of the greenwall HTTP server") staticDir := flag.String("staticDir", "frontend", "Path to frontend static resources") flag.Parse() return &ApplicationConfiguration{ ...
Change listening port to 9001
Change listening port to 9001
Go
mit
mtojek/greenwall,mtojek/greenwall
01c91bef6938e4e4db78fa8e6b2a6b58215140b3
infrastructure/agentlogger/signalable_logger_test.go
infrastructure/agentlogger/signalable_logger_test.go
package agentlogger_test import ( "bytes" "fmt" "os" "syscall" "github.com/cloudfoundry/bosh-agent/infrastructure/agentlogger" "github.com/cloudfoundry/bosh-utils/logger" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Signalable logger debug", func() { Describe("when SIGSEGV is re...
package agentlogger_test import ( "bytes" "os" "syscall" "github.com/cloudfoundry/bosh-agent/infrastructure/agentlogger" "github.com/cloudfoundry/bosh-utils/logger" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Signalable logger debug", func() { Describe("when SIGSEGV is recieved"...
Remove println from signalablelogger test
Remove println from signalablelogger test Signed-off-by: Charlie Vieth <ea3f0b85bda195c42ceb97da0f596f9d6d014e12@pivotal.io>
Go
apache-2.0
cloudfoundry/bosh-agent,mattcui/bosh-agent,mattcui/bosh-agent,mattcui/bosh-agent,cloudfoundry/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent,gu-bin/bosh-agent
b53161eb2a8b28016d80a87472201667bce4841c
pkg/netutils/ip_allocator_test.go
pkg/netutils/ip_allocator_test.go
package netutils import ( "testing" ) func TestAllocateIP(t *testing.T) { ipa, err := NewIPAllocator("10.1.2.0/24") if err != nil { t.Fatal("Failed to initialize IP allocator: %v", err) } t.Log(ipa.GetIP()) }
package netutils import ( "testing" ) func TestAllocateIP(t *testing.T) { ipa, err := NewIPAllocator("10.1.2.0/24", nil) if err != nil { t.Fatal("Failed to initialize IP allocator: %v", err) } ip, err := ipa.GetIP() if err != nil { t.Fatal("Failed to get IP: ", err) } if ip.String() != "10.1.2.1/24" { ...
Add tests for IP Allocator.
Add tests for IP Allocator.
Go
apache-2.0
danwinship/openshift-sdn,rootfs/origin,deads2k/origin,dmage/origin,dinhxuanvu/origin,dobbymoodge/origin,stevekuznetsov/origin,nak3/origin,gabemontero/origin,markllama/origin,kargakis/origin,goern/origin,dmage/origin,mdshuai/openshift-sdn,tnozicka/origin,xiuwang/origin,tracyrankin/origin,hferentschik/origin,jprukner/ori...
6ef2491e2edce6d001fd49def5240b770026abb4
toglacier.go
toglacier.go
package main import ( "fmt" "log" "os" "time" "github.com/jasonlvhit/gocron" ) func main() { scheduler := gocron.NewScheduler() scheduler.Every(1).Day().At("00:00").Do(runSchedulerTask, nil) <-scheduler.Start() } func runSchedulerTask() { archive, err := buildArchive(os.Getenv("TOGLACIER_PATH")) if err !=...
package main import ( "fmt" "log" "os" "time" "github.com/jasonlvhit/gocron" ) func main() { scheduler := gocron.NewScheduler() scheduler.Every(1).Day().At("00:00").Do(runSchedulerTask, nil) <-scheduler.Start() } func runSchedulerTask() { archive, err := buildArchive(os.Getenv("TOGLACIER_PATH")) if err !=...
Remove temporary tarball after using it
Remove temporary tarball after using it
Go
mit
rafaeljusto/toglacier,rafaeljusto/toglacier,rafaeljusto/toglacier
fbae2dba2ba0f095e7ebba7a07a0751448d39061
partition/mbr/types.go
partition/mbr/types.go
package mbr // Type constants for the GUID for type of partition, see https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries type Type byte // List of GUID partition types const ( Empty Type = 0x00 Fat12 Type = 0x01 XenixRoot Type = 0x02 XenixUsr Type = 0x03 Fat16 T...
package mbr // Type constants for the GUID for type of partition, see https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries type Type byte // List of GUID partition types const ( Empty Type = 0x00 Fat12 Type = 0x01 XenixRoot Type = 0x02 XenixUsr Type = 0x03 Fat16 T...
Fix GPTProtective partition type (0xee) for hybrid/protective MBRs
Fix GPTProtective partition type (0xee) for hybrid/protective MBRs
Go
mit
diskfs/go-diskfs
f97a196a40767fc931ecab2c9e9486674a8177d8
loadpath_test.go
loadpath_test.go
package goref import ( "github.com/stretchr/testify/assert" "go/ast" "testing" ) func TestCleanImportSpec(t *testing.T) { assert.Equal(t, "foo/bar/baz", cleanImportSpec(&ast.ImportSpec{Path: &ast.BasicLit{Value: "foo/bar/baz"}})) assert.Equal(t, "foo/bar/baz", cleanImportSpec(&ast.ImportSpec{Path: &ast.BasicLit{...
package goref import ( "github.com/stretchr/testify/assert" "go/ast" "testing" ) func TestCleanImportSpec(t *testing.T) { assert.Equal(t, "foo/bar/baz", cleanImportSpec(&ast.ImportSpec{Path: &ast.BasicLit{Value: "foo/bar/baz"}})) assert.Equal(t, "foo/bar/baz", cleanImportSpec(&ast.ImportSpec{Path: &ast.BasicLit{...
Add a test for candidatePaths
Add a test for candidatePaths
Go
apache-2.0
korfuri/goref
dfd6d4a85181cd463b57dbc3fb9a6fb17ed6d212
cmd/bytemark/main_test.go
cmd/bytemark/main_test.go
package main import ( "github.com/BytemarkHosting/bytemark-client/lib" "github.com/BytemarkHosting/bytemark-client/mocks" "github.com/urfave/cli" ) var defVM lib.VirtualMachineName var defGroup lib.GroupName func baseTestSetup() (config *mocks.Config, client *mocks.Client) { config = new(mocks.Config) client = ...
package main import ( "github.com/BytemarkHosting/bytemark-client/lib" "github.com/BytemarkHosting/bytemark-client/mocks" "github.com/urfave/cli" ) var defVM lib.VirtualMachineName var defGroup lib.GroupName func baseTestSetup() (config *mocks.Config, client *mocks.Client) { config = new(mocks.Config) client = ...
Revert "Add ZoneName to FixtureVM"
Revert "Add ZoneName to FixtureVM" This reverts commit 90860c6650ef70608e6a83ffd9e09e94cfe7d5c0.
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
07b04c7a0112bcb7430f4277772d03a918963f51
utils.go
utils.go
package cml import ( "github.com/dgryski/go-farm" "github.com/lazybeaver/xorshift" ) var rnd = xorshift.NewXorShift64Star(42) func randFloat() float64 { return float64(rnd.Next()%10e5) / 10e5 } func hash(s []byte, i, w uint) uint { return uint(farm.Hash64WithSeed(s, uint64(i))) % w }
package cml import ( "github.com/dgryski/go-farm" "github.com/dgryski/go-pcgr" ) var rnd = pcgr.Rand{0x0ddc0ffeebadf00d, 0xcafebabe} func randFloat() float64 { return float64(rnd.Next()%10e5) / 10e5 } func hash(s []byte, i, w uint) uint { return uint(farm.Hash64WithSeed(s, uint64(i))) % w }
Use pcgr instead of xorshift
Use pcgr instead of xorshift
Go
mit
seiflotfy/count-min-log,seiflotfy/cmsketch
be16a810967bb89bf12f1e838112785fe0a851d2
terminal_check_unix.go
terminal_check_unix.go
// +build linux aix // +build !js package logrus import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TCGETS func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil }
// +build linux aix zos // +build !js package logrus import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TCGETS func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil }
Add build tag to enable a successful build for zos
Add build tag to enable a successful build for zos
Go
mit
Sirupsen/logrus,penhauer-xiao/logrus,sirupsen/logrus,sirupsen/logrus,penhauer-xiao/logrus
e81a69b44a8a63e7cd4a85351686de4d26fc7345
log/tty_safe.go
log/tty_safe.go
// +build appengine package log import ( "io" ) func isatty(w io.Writer) bool { return false }
// +build appengine package log import ( "io" "gnd.la/internal" ) func isatty(w io.Writer) bool { if internal.InAppEngineDevServer() { return true } return false }
Add colored logging for GAE dev server
Add colored logging for GAE dev server
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
30c0200fb35e73377c62888fafb6702bac1df343
client_structs.go
client_structs.go
package goNessus type Nessus struct { Ip string Port string AccessKey string SecretKey string Token string }
// Package goNessus provides a Golang based interface to Nessus 6 package goNessus // Nessus struct is used to contain information about a Nessus scanner. This // will be used to connect to the scanner and make API requests. type Nessus struct { Ip string Port string AccessKey string SecretKey string ...
Add godocs for the client struct
Add godocs for the client struct
Go
apache-2.0
kkirsche/go-nessus
7257a8c0978aa02f7807d7a68ea8880681b5a42c
app/models/blog.go
app/models/blog.go
package models import ( "github.com/jinzhu/gorm" "github.com/qor/accessibility/hyperlink" ) type Article struct { gorm.Model Author User AuthorID uint Title string Content string `gorm:"type:text"` FromURL hyperlink.HyperLink }
package models import ( "github.com/jinzhu/gorm" "github.com/qor/accessibility/hyperlink" "github.com/qor/publish2" ) type Article struct { gorm.Model Author User AuthorID uint Title string Content string `gorm:"type:text"` FromURL hyperlink.HyperLink publish2.Version publish2.Schedule publish2.Vis...
Add publish Version, Schedule, Visible to Blog
Add publish Version, Schedule, Visible to Blog
Go
mit
firestudios/qor-example,qor/qor-example,qor/qor-example,firestudios/qor-example,qor/qor-example,firestudios/qor-example
47be27ccd4e907bbf90ee9d33ab263866c26357d
cells_test.go
cells_test.go
package vizzini_test import ( "code.cloudfoundry.org/bbs/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Cells", func() { It("should return all cells", func() { cells, err := bbsClient.Cells(logger) Expect(err).NotTo(HaveOccurred()) Expect(len(cells)).To(BeNumerically(">=",...
package vizzini_test import ( "strings" "code.cloudfoundry.org/bbs/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Cells", func() { It("should return all cells", func() { cells, err := bbsClient.Cells(logger) Expect(err).NotTo(HaveOccurred()) Expect(len(cells)).To(BeNumer...
Fix cell id vizzini test
Fix cell id vizzini test [#116491021] Signed-off-by: Nima Kaviani <0ebde517669f70c2aec92dc89d4950413b825ec0@us.ibm.com>
Go
apache-2.0
cloudfoundry-incubator/vizzini,cloudfoundry-incubator/vizzini,pivotal-cf-experimental/vizzini,pivotal-cf-experimental/vizzini
c986e37d3f5d5d8c918e2a1a52bba58162ba3b4d
request/request_manager.go
request/request_manager.go
package request import ( "context" "github.com/ory/fosite" "github.com/ory/fosite/handler/oauth2" "github.com/ory/fosite/handler/openid" ) // Manager provides a generic interface to clients in order to build a DataStore type Manager interface { Storer } // Storer conforms to fosite.Requester and provides method...
package request import ( "context" "github.com/ory/fosite" "github.com/ory/fosite/handler/oauth2" "github.com/ory/fosite/handler/openid" ) // Manager provides a generic interface to clients in order to build a DataStore type Manager interface { Storer } // Storer conforms to fosite.Requester and provides method...
Add methods into the storage interface as they are now supported
:arrow_up: Add methods into the storage interface as they are now supported
Go
apache-2.0
MatthewHartstonge/storage
863ba3029d64b5ec1ab68b383249dd4c044b3838
web/middleware/subrouter.go
web/middleware/subrouter.go
package middleware import ( "net/http" "github.com/zenazn/goji/web" ) type subrouter struct { c *web.C h http.Handler } func (s subrouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.c.URLParams != nil { if path, ok := s.c.URLParams["*"]; ok { oldpath := r.URL.Path r.URL.Path = path def...
package middleware import ( "net/http" "github.com/zenazn/goji/web" ) type subrouter struct { c *web.C h http.Handler } func (s subrouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.c.URLParams != nil { path, ok := s.c.URLParams["*"] if !ok { path, ok = s.c.URLParams["_"] } if ok { ...
Allow regexps to take advantage of SubRouter
Allow regexps to take advantage of SubRouter Go's regular expressions don't allow you to create a capturing group named "*", which previously made using SubRouter with regular expression patterns impossible. This change introduces the alternate key "_", which happens to be a legal capturing group name. Fixes #98.
Go
mit
zenazn/goji,dbmlabs/goji,yangou/goji,beni55/goji,Invacio/goji,vsco/goji,cognusion/goji,w4ngyi/goji,tchssk/goji,unixorn/goji
82ada726b6e4b28a0e0d553127173e8ac2f6c827
domain/domain.go
domain/domain.go
package domain import "time" // Trace represents a full trace of a request // comprised of a number of frames type Trace []Frame // FrameType represents an Enum of types of Events which Phosphor can record type FrameType int const ( // Calls Req = FrameType(1) // Client Request dispatch Rsp = FrameType(2...
package domain import "time" // Trace represents a full trace of a request // comprised of a number of frames type Trace []Frame // FrameType represents an Enum of types of Frames which Phosphor can record type FrameType int32 const ( // Calls Req = FrameType(1) // Client Request dispatch Rsp = FrameType...
Switch frametype to int32 to bring in line with proto
Switch frametype to int32 to bring in line with proto
Go
apache-2.0
mattheath/phosphor,mondough/phosphor,mattheath/phosphor,mondough/phosphor
641a383de83ab026f6c14a51bb1185fbbe32e661
assignment_test.go
assignment_test.go
package main import ( "github.com/stretchr/testify/assert" "io/ioutil" "testing" ) func TestSavingAssignment(t *testing.T) { tmpDir, err := ioutil.TempDir("", "") assert.NoError(t, err) assignment := Assignment{ Track: "ruby", Slug: "bob", Files: map[string]string{ "bob_test.rb": "Tests text", ...
package main import ( "github.com/stretchr/testify/assert" "io/ioutil" "testing" ) func TestSavingAssignment(t *testing.T) { tmpDir, err := ioutil.TempDir("", "") assert.NoError(t, err) assignment := Assignment{ Track: "ruby", Slug: "bob", Files: map[string]string{ "bob_test.rb": "Tests text", ...
Use relative path in assignment test
Use relative path in assignment test This is likely the existing behavior, it seemed best to make it explicit.
Go
mit
lcowell/cli,Tonkpils/cli,neslom/cli,zabawaba99/cli,arvidsaur/cli,exercism/cli,lcowell/cli,zabawaba99/cli,arvidsaur/cli,Tonkpils/cli,yeah-right/cli,neslom/cli,arvidsaur/cli,neslom/cli,yeah-right/cli,Tonkpils/cli,zabawaba99/cli,lcowell/cli,yeah-right/cli,exercism/cli
457c1eda5f6025f80e8dda547ade623e11be30b3
package_test.go
package_test.go
package main import ( "testing" ) var sourceURITests = []struct { src string dst string }{ { "https://github.com/sunaku/vim-unbundle", "https://github.com/sunaku/vim-unbundle", }, { "Shougo/neobundle.vim", "https://github.com/Shougo/neobundle.vim", }, { "thinca/vim-quickrun", "https://github.com/...
package main import ( "testing" ) var sourceURITests = []struct { src string dst string }{ //Full URI { "https://github.com/sunaku/vim-unbundle", "https://github.com/sunaku/vim-unbundle", }, //Short GitHub URI { "Shougo/neobundle.vim", "https://github.com/Shougo/neobundle.vim", }, { "thinca/vim-q...
Add comment for each test cases
Add comment for each test cases
Go
mit
kusabashira/vub
960c91c8cdda43751abd8494d5277292711d9469
backend/viewers.go
backend/viewers.go
package main import ( "github.com/grsakea/kappastat/common" "github.com/mrshankly/go-twitch/twitch" "log" "time" ) func loopViewers(client *twitch.Client, c chan Message, infos chan kappastat.ViewerCount) { followed := []string{} ticker := time.NewTicker(time.Minute).C for { select { case msg := <-c: f...
package main import ( "github.com/grsakea/kappastat/common" "github.com/mrshankly/go-twitch/twitch" "log" "time" ) func loopViewers(client *twitch.Client, c chan Message, infos chan kappastat.ViewerCount) { followed := []string{} ticker := time.NewTicker(time.Minute).C for { select { case msg := <-c: f...
Stop an api error from crashing the program
Stop an api error from crashing the program
Go
mit
grsakea/kappastat,grsakea/kappastat,grsakea/kappastat
c6691557cbbdc0d1358b0b6c2031b89f3acbf136
graphs/minconnected.go
graphs/minconnected.go
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package graphs type state byte const ( undiscovered state = iota discovered processed ) // Vertex represents a Graph vertex with its connection edg...
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package graphs type state byte const ( undiscovered state = iota discovered processed ) // Vertex represents a Graph vertex with its connection edg...
Rename variables inside the graphs.hasCycle function in order to improve readability
Rename variables inside the graphs.hasCycle function in order to improve readability
Go
mit
mrekucci/epi,mrekucci/epi
f1aa2ea7bf9f2d25a361aaba017da45044531bd3
command/router/main.go
command/router/main.go
package main import ( "flag" "log" "net/http" ) var pubAddr = flag.String("pubAddr", ":8080", "Address on which to serve public requests") var apiAddr = flag.String("apiAddr", ":8081", "Address on which to receive reload requests") var mongoUrl = flag.String("mongoUrl", "localhost", "Address of mongo cluster (e.g....
package main import ( "flag" "log" "net/http" "runtime" ) var pubAddr = flag.String("pubAddr", ":8080", "Address on which to serve public requests") var apiAddr = flag.String("apiAddr", ":8081", "Address on which to receive reload requests") var mongoUrl = flag.String("mongoUrl", "localhost", "Address of mongo cl...
Use all available cores in the router program
Use all available cores in the router program
Go
mit
nickstenning/router-archive,lukaszraczylo/router,lukaszraczylo/router,alphagov/router
b6ce8a8067d5a32c0772efc4e3b51241eee0294a
social/twitter/handlers.go
social/twitter/handlers.go
package twitter import ( "gnd.la/app" ) // Handler represents a function type which receives the // result of authenticating a Twitter user. type Handler func(*app.Context, *User, *Token) // AuthHandler takes a Handler a returns a app.Handler which // can be added to a app. When users are directed to this // handle...
package twitter import ( "gnd.la/app" ) // Handler represents a function type which receives the // result of authenticating a Twitter user. type Handler func(*app.Context, *User, *Token) // AuthHandler takes a Handler a returns a app.Handler which // can be added to a app. When users are directed to this // handle...
Clone the App with the current Context in the handler
Clone the App with the current Context in the handler This makes it work on App Engine
Go
mpl-2.0
rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola
568a305bc9fdf370d7afab3bf46989182d73f1ce
cmd/list_devices.go
cmd/list_devices.go
package cmd import ( "bytes" "fmt" "github.com/achilleasa/go-pathtrace/tracer/opencl" "github.com/codegangsta/cli" ) // List available opencl devices. func ListDevices(ctx *cli.Context) { var storage []byte buf := bytes.NewBuffer(storage) clPlatforms := opencl.GetPlatformInfo() buf.WriteString(fmt.Sprintf("...
package cmd import ( "bytes" "fmt" "os" "github.com/achilleasa/go-pathtrace/tracer/opencl/device" "github.com/codegangsta/cli" ) // List available opencl devices. func ListDevices(ctx *cli.Context) { var storage []byte buf := bytes.NewBuffer(storage) clPlatforms, err := device.GetPlatformInfo() if err != n...
Update list-devices CLI command to use the new device package
Update list-devices CLI command to use the new device package
Go
mit
achilleasa/go-pathtrace,achilleasa/go-pathtrace,achilleasa/go-pathtrace
a30a47b712e37d50147090c0ae5f14e8a31880e2
redis_consumer.go
redis_consumer.go
package incus import "log" type RedisConsumer struct { commands <-chan RedisCommand pool *redisPool } func NewRedisConsumer(commands <-chan RedisCommand, pool *redisPool) *RedisConsumer { consumer := &RedisConsumer{ commands: commands, pool: pool, } go consumer.ConsumeForever() return consumer } ...
package incus import "log" type RedisConsumer struct { commands <-chan RedisCommand pool *redisPool } func NewRedisConsumer(commands <-chan RedisCommand, pool *redisPool) *RedisConsumer { consumer := &RedisConsumer{ commands: commands, pool: pool, } go consumer.ConsumeForever() return consumer } ...
Return the conn to the pool after consuming
fix: Return the conn to the pool after consuming
Go
mit
AdriVanHoudt/incus,samuelebistoletti/incus,AdriVanHoudt/incus,AdriVanHoudt/incus,Imgur/incus,samuelebistoletti/incus,Imgur/incus,Imgur/incus,samuelebistoletti/incus
0b7f4888b0e336ae1d2dbfc1b499888d764a3124
examples/simple/main.go
examples/simple/main.go
// Copyright 2015 The Prometheus 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...
// Copyright 2015 The Prometheus 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...
Update simple example to use custom registry
Update simple example to use custom registry Signed-off-by: Jéssica Lins <cdcbb7b12268316ca09e62f2c9c76365993642da@gmail.com>
Go
apache-2.0
prometheus/client_golang
69a59bf6604d802ed5c6ca6ad5f42e74d9f93482
database/database.go
database/database.go
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // // Contributor: Julien Vehent jvehent@mozilla.com [:ulfr] package database /* import "github.com/mozilla/mig/datab...
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // // Contributor: Julien Vehent jvehent@mozilla.com [:ulfr] package database /* import "github.com/mozilla/mig/datab...
Check for ping when connecting to postgresql db
Check for ping when connecting to postgresql db
Go
mpl-2.0
mozilla/mig,mozilla/mig,mozilla/mig,mozilla/mig,mozilla/mig
2eb8c83adffb1796ea00e83e9b6794abe30baf33
batch/item_mock.go
batch/item_mock.go
package batch import "sync" // MockItemGenerator generates mock Items with unique IDs. Items are generated in a // separate goroutine and added to a channel, which can be retrieved by calling // GetCh. type MockItemGenerator struct { closeOnce sync.Once done chan struct{} ch chan *Item mu sync.Mu...
package batch import "sync" // MockItemGenerator generates mock Items with unique IDs. Items are generated in a // separate goroutine and added to a channel, which can be retrieved by calling // GetCh. type MockItemGenerator struct { closeOnce sync.Once done chan struct{} ch chan *Item } // NewMockIte...
Remove unused fields in MockItemGenerator
Remove unused fields in MockItemGenerator
Go
mit
MasterOfBinary/gobatch
2bf3be675739e3e2794239f9e6463cd9d48e3a97
defaults.go
defaults.go
package socket import ( "time" "github.com/neliseev/logger" ) // Defaults vars var msgSep = byte(":") // Constants const maxTCPQueries int = 256 const tcpIdleTimeout time.Duration = 60 * time.Second const rtimeout time.Duration = 2 * time.Second // Socket read timeout const udpMsgSize int ...
package socket import ( "time" "github.com/neliseev/logger" ) // Defaults vars var msgSep = byte(':') // Constants const maxTCPQueries int = 256 const tcpIdleTimeout time.Duration = 60 * time.Second const rtimeout time.Duration = 2 * time.Second // Socket read timeout const udpMsgSize int ...
Fix errors with types in conditions
Fix errors with types in conditions
Go
mit
neliseev/socket
8fd714e2da341766cbb44aac635c614a55003deb
runner/runner.go
runner/runner.go
package runner import ( "net/http" "fmt" "sync" "github.com/dudang/golt/parser" ) func ExecuteJsonGolt(testPlan parser.GoltJsons) { for _, element := range testPlan.Golt { executeElement(element) } } func executeElement(testElement parser.GoltJson) { waitGroup := sync.WaitGroup waitGroup.Add(testElement.Th...
package runner import ( "net/http" "fmt" "sync" "github.com/dudang/golt/parser" ) func ExecuteJsonGolt(testPlan parser.GoltJsons) { for _, element := range testPlan.Golt { executeElement(element) } } func executeElement(testElement parser.GoltJson) { var wg sync.WaitGroup wg.Add(testElement.Threads) for i...
Fix variable initialization which failed travis build
Fix variable initialization which failed travis build
Go
mit
dudang/golt
746064bba56d7e3d1dd44317e00d93d28bb9a526
lib/mdb/updateFrom.go
lib/mdb/updateFrom.go
package mdb func (dest *Machine) updateFrom(source Machine) { if dest.Hostname != source.Hostname { return } if source.IpAddress != "" { dest.IpAddress = source.IpAddress } if source.RequiredImage != "" { dest.RequiredImage = source.RequiredImage dest.DisableUpdates = source.DisableUpdates } if source.P...
package mdb func (dest *Machine) updateFrom(source Machine) { if dest.Hostname != source.Hostname { return } if source.IpAddress != "" { dest.IpAddress = source.IpAddress } if source.RequiredImage != "" { dest.RequiredImage = source.RequiredImage dest.DisableUpdates = source.DisableUpdates } if source.P...
Improve lib/mdb.Machine.UpdateFrom() to avoid some pointer changes.
Improve lib/mdb.Machine.UpdateFrom() to avoid some pointer changes.
Go
apache-2.0
keep94/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator
bb6d294cb978864b28d05d12308867039509c87f
dataBase/fakeUserDB.go
dataBase/fakeUserDB.go
package dataBase import "Jira__backend/models" var UsersListFromFakeDB = models.Users{ models.User{Name: "User1", Data: "21.08.1997", Phone: "8(999)999-99-99"}, models.User{Name: "User2", Data: "10.01.1997", Phone: "8(999)999-99-99"}, }
package dataBase import "Jira__backend/models" var UsersListFromFakeDB = models.Users{ models.User{ Email: "mbazley1@a8.net", FirstName: "Jeremy", LastName: "Moore", Tasks: models.Tasks{}, Password: "??04*products*GRAIN*began*58??", Bio: `Spent childhood selling wooden tops in Pensacola, FL. In 2008 I was test...
Put some random generated data for seed fake db.
Put some random generated data for seed fake db.
Go
mit
DVI-GI-2017/Jira__backend
3ad8e58b7dbf222403235021cc397e351b790582
list-duration-sort.go
list-duration-sort.go
package trello type ByFirstEntered []*ListDuration func (durs ByFirstEntered) Len() int { return len(durs) } func (durs ByFirstEntered) Less(i, j int) bool { return durs[i].FirstEntered.Before(durs[j].FirstEntered) } func (durs ByFirstEntered) Swap(i, j int) { durs[i], durs[j] = durs[j], durs[i] }
package trello // ByFirstEntered is a slice of ListDurations type ByFirstEntered []*ListDuration // ByFirstEntered returns the length of the receiver. func (durs ByFirstEntered) Len() int { return len(durs) } // Less takes two indexes i and j and returns true exactly if the ListDuration // at i was entered before j....
Add comments to public members of list-duration (golint)
Add comments to public members of list-duration (golint)
Go
mit
adlio/trello
abc47d4e0a720a25233450619ba2a461ba8f4ccb
cmd/banksaurus/configurations/configurations.go
cmd/banksaurus/configurations/configurations.go
package configurations import ( "os" "os/user" "path" ) var applicationName = "banksaurus" // IsDev returns if in dev environment or not func IsDev() bool { if os.Getenv("GO_BANK_CLI_DEV") == "true" { return true } return false } // DatabasePath returns the path nad name for the database // taking into acco...
package configurations import ( "os" "os/user" "path" ) var applicationName = "banksaurus" // IsDev returns if in dev environment or not func IsDev() bool { if os.Getenv("GO_BANK_CLI_DEV") == "true" { return true } return false } // DatabasePath returns the path nad name for the database // taking into acco...
Fix for wrong application home path
Fix for wrong application home path
Go
mit
luistm/expensetracker,luistm/go-bank-cli
dd573be853474dae1d39a99f5aa7f1987e3dfcf9
cmd/mccli/download_cmd.go
cmd/mccli/download_cmd.go
package mccli import "github.com/codegangsta/cli" var DownloadCommand = cli.Command{ Name: "download", Aliases: []string{"down", "d"}, Usage: "Downloads files, directories or projects", Subcommands: []cli.Command{ downloadProjectCommand, downloadFileCommand, downloadDirCommand, }, }
package mccli import "github.com/codegangsta/cli" var DownloadCommand = cli.Command{ Name: "download", Aliases: []string{"down", "d"}, Usage: "Downloads files, directories or projects", Subcommands: []cli.Command{ downloadProjectCommand, downloadFileCommand, //downloadDirCommand, }, }
Remove download directory as an option.
Remove download directory as an option.
Go
mit
materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore
612c4db4d5ad057730ca61ed643a733b7fec22b0
announcements.go
announcements.go
package main import ( "github.com/gbl08ma/disturbancesmlx/dataobjects" "github.com/gbl08ma/disturbancesmlx/scraper" ) var annStore AnnouncementStore // AnnouncementStore implements dataobjects.AnnouncementStore type AnnouncementStore struct { scrapers map[string]scraper.AnnouncementScraper } // AddScraper regist...
package main import ( "github.com/gbl08ma/disturbancesmlx/dataobjects" "github.com/gbl08ma/disturbancesmlx/scraper" ) var annStore AnnouncementStore // AnnouncementStore implements dataobjects.AnnouncementStore type AnnouncementStore struct { scrapers map[string]scraper.AnnouncementScraper } // AddScraper regist...
Fix assignment to nil map
Fix assignment to nil map
Go
apache-2.0
gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx
f4fe0d50cf466689342031cac16be757d342c992
handlers/masking.go
handlers/masking.go
package handlers import ( "go-message-masking/persistence" "net/http" "regexp" "github.com/ant0ine/go-json-rest/rest" ) // Message is a code representation of the data sent by the API user through the wire type Message struct { Locale string Text string MaskString string } // MaskSensitiveData is t...
package handlers import ( "go-message-masking/persistence" "net/http" "regexp" "github.com/ant0ine/go-json-rest/rest" ) // Message is a code representation of the data sent by the API user through the wire type Message struct { Locale string Text string MaskString string } // MaskSensitiveData is t...
Move error validation to the top of the scope
chore: Move error validation to the top of the scope Signed-off-by: Adrian Oprea <a1b909ec1cc11cce40c28d3640eab600e582f833@codesi.nz>
Go
agpl-3.0
opreaadrian/message-masking-service
70cc52f880604a274e60d10c0c9c71d4e8070dfd
block_context.go
block_context.go
package slack // ContextBlock defines data that is used to display message context, which can // include both images and text. // // More Information: https://api.slack.com/reference/messaging/blocks#actions type ContextBlock struct { Type MessageBlockType `json:"type"` BlockID string `json:"block_id,...
package slack // ContextBlock defines data that is used to display message context, which can // include both images and text. // // More Information: https://api.slack.com/reference/messaging/blocks#actions type ContextBlock struct { Type MessageBlockType `json:"type"` BlockID string `json:"block_id,...
Add convenience method for ContextElements
Add convenience method for ContextElements
Go
bsd-2-clause
nlopes/slack,james-lawrence/slack,178inaba/slack
705103a553e1ec634158deb081b4156a629f102e
cmd/cmd.go
cmd/cmd.go
package cmd import ( "fmt" "net/url" ) type Cmd interface { Run(name string, args ...string) (string, string, error) Start(name string, args ...string) (Cmd, error) Wait() error Output(name string, args ...string) (string, string, error) URL(path string) *url.URL } func Scp(src, dest *url.URL) error { scpCmd...
package cmd import ( "fmt" "net/url" ) type Cmd interface { Run(name string, args ...string) (string, string, error) Start(name string, args ...string) (Cmd, error) Wait() error Output(name string, args ...string) (string, string, error) URL(path string) *url.URL } func Scp(src, dest *url.URL) error { scpCmd...
Use SCP gateway when copying file between hosts
Use SCP gateway when copying file between hosts
Go
mit
marcosnils/cmt,marcosnils/cmt
649b0d0237096545cbef18e0b0ccf8a9672d983c
config.go
config.go
package rice // LocateMethod defines how a box is located. type LocateMethod int const ( LocateFS = LocateMethod(iota) // Locate on the filesystem according to package path. LocateAppended // Locate boxes appended to the executable. LocateEmbedded ...
package rice // LocateMethod defines how a box is located. type LocateMethod int const ( LocateFS = LocateMethod(iota) // Locate on the filesystem according to package path. LocateAppended // Locate boxes appended to the executable. LocateEmbedded ...
Add MustFindBox method to Config
Add MustFindBox method to Config
Go
bsd-2-clause
GeertJohan/go.rice
cb72581a19a259b2eac58c2fcdd361ae3764fae5
config.go
config.go
package adapt // Config represents a configuration of the algorithm. type Config struct { // The refinement rate of the algorithm. The parameter specifies the // fraction of the nodes queued for refinement to be taken from the queue at // each iteration. Rate float64 // ⊆ (0, 1] // The minimal level of interpola...
package adapt // Config represents a configuration of the algorithm. type Config struct { // The refinement rate of the algorithm. The parameter specifies the // fraction of the nodes queued for refinement to be taken from the queue at // each iteration. Rate float64 // ⊆ (0, 1] // The minimum level of interpola...
Adjust the description of Config
Adjust the description of Config
Go
mit
ready-steady/adapt
74788afc2b0f03051b0fd92db0c0d1664dffd28c
config.go
config.go
package main import "github.com/BurntSushi/toml" type Config struct { App App `toml:"application"` Deps Deps `toml:"dependencies"` } type App struct { Name string Version string Authors []string } type Deps map[string]string func loadConfig() (*Config, error) { var c Config _, err := toml.DecodeFile(se...
package main import "github.com/BurntSushi/toml" type Config struct { App ConfigApp `toml:"application"` Deps ConfigDeps `toml:"dependencies"` } type ConfigApp struct { Name string Version string Authors []string } type ConfigDeps map[string]string func loadConfig() (*Config, error) { var c Config _, e...
Rename `App` to `ConfigApp`, `Deps` to `ConfigDeps`
Rename `App` to `ConfigApp`, `Deps` to `ConfigDeps`
Go
mit
jingweno/nut
309929481e1e5074241053571827951094ca7f50
handle.go
handle.go
//+build go1.17 // This variant contains a trivial wrapper around "runtime/cgo".Handle. package yara import "runtime/cgo" type cgoHandle cgo.Handle func cgoNewHandle(v interface{}) cgoHandle { return cgo.NewHandle(v) }
//+build go1.17 // This variant contains a trivial wrapper around "runtime/cgo".Handle. package yara import "runtime/cgo" type cgoHandle cgo.Handle func (h cgoHandle) Value() interface{} { return cgo.Handle(h).Value() } func (h cgoHandle) Delete() { cgo.Handle(h).Delete() } func cgoNewHandle(v interface{}) cgoHa...
Replace cbpool...: Fix botched non-legacy version
Replace cbpool...: Fix botched non-legacy version
Go
bsd-2-clause
hillu/go-yara,hillu/go-yara
337f5fe789330cbaed5593c40a2dd52a924a4179
lunchy.go
lunchy.go
package main import( "fmt" "os" ) const( LUNCHY_VERSION = "0.1.0" ) func printUsage() { fmt.Printf("Lunchy %s, the friendly launchctl wrapper\n", LUNCHY_VERSION) fmt.Println("Usage: lunchy [start|stop|restart|list|status|install|show|edit] [options]") } func main() { args := os.Args if (len(args) == ...
package main import( "fmt" "os" "io/ioutil" "path/filepath" ) const( LUNCHY_VERSION = "0.1.0" ) func printUsage() { fmt.Printf("Lunchy %s, the friendly launchctl wrapper\n", LUNCHY_VERSION) fmt.Println("Usage: lunchy [start|stop|restart|list|status|install|show|edit] [options]") } func findPlists(path...
Add method to print plists
Add method to print plists
Go
mit
sosedoff/lunchy-go,sosedoff/lunchy-go
e0729751ac189f746a0322b36e0f33911e624846
error_test.go
error_test.go
package sqlite3 import ( "database/sql" "io/ioutil" "os" "path" "testing" ) func TestFailures(t *testing.T) { dirName, err := ioutil.TempDir("", "sqlite3") if err != nil { t.Fatal(err) } defer os.RemoveAll(dirName) dbFileName := path.Join(dirName, "test.db") f, err := os.Create(dbFileName) if err != ni...
package sqlite3 import ( "database/sql" "io/ioutil" "os" "path" "testing" ) func TestFailures(t *testing.T) { dirName, err := ioutil.TempDir("", "sqlite3") if err != nil { t.Fatal(err) } defer os.RemoveAll(dirName) dbFileName := path.Join(dirName, "test.db") f, err := os.Create(dbFileName) if err != ni...
Update test expectations follow change of concrete error type
Update test expectations follow change of concrete error type
Go
mit
larsmans/go-sqlite3,gmarik/go-sqlite3,danderson/go-sqlite3,joewalnes/go-sqlite3,danderson/go-sqlite3,wuranbo/go-sqlite3,Schumix/go-sqlite3,marccampbell/go-sqlite3,mdevan/go-sqlite3,mdevan/go-sqlite3,shaxbee/go-sqlite3,xeodou/go-sqlcipher,kiwih/go-sqlite3,jabgibson/go-sqlite3,mattn/go-sqlite3,shaxbee/go-sqlite3,Jonathan...
18dfa036b24c90548aa9e8d6157bf9feb324c889
content.go
content.go
package main var APPCONTENT = `package main import ( "net/http" "log" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/", DefaultHandler) log.Panic(http.ListenAndServe(":8080", mux)) } func DefaultHandler(rw http.ResponseWriter, req *http.Request) { rw.Write([]byte("Server Running")) } `
package main var APPCONTENT = `package main import ( "net/http" "log" ) const ( STATIC = "/public/" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/", DefaultHandler) mux.Handle(STATIC, http.StripPrefix(STATIC, http.FileServer(http.Dir("public")))) log.Panic(http.ListenAndServe(":8080", mux)) ...
Add Static FileServer by default
Add Static FileServer by default
Go
mit
squiidz/flea
c31fc60b8c177aacf91ae0b197ebe7484fbc6d90
gosnitch_test.go
gosnitch_test.go
package gosnitch import "testing" func TestPidof(t *testing.T) { _, err := Pidof("go") if err != nil { t.Error("Did not find pid of 'go'") } } func TestPidofNotExisting(t *testing.T) { pid, err := Pidof("fake-process") if err == nil { t.Errorf("Found pid %s when expected to find nothing", pid) } } func Te...
package gosnitch import "testing" func TestPidof(t *testing.T) { _, err := Pidof("go") if err != nil { t.Error("Did not find pid of 'go'") } } func TestPidofNotExisting(t *testing.T) { pid, err := Pidof("fake-process") if err == nil { t.Errorf("Found pid %s when expected to find nothing", pid) } } func Te...
Make sure that Probe called on unexisting pid does not crash
Make sure that Probe called on unexisting pid does not crash
Go
bsd-2-clause
mulander/gosnitch
f38321fc81802bb3d67519cf249409275f09366a
pkg/model/mapinfo.go
pkg/model/mapinfo.go
// Copyright (c) 2017, CodeBoy. All rights reserved. // // This Source Code Form is subject to the terms of the // license that can be found in the LICENSE file. package model import ( "time" ) // MapInfo is info struct for FileMap. type MapInfo struct { ID int `json:"id"` Title string `json:"title"...
// Copyright (c) 2017, CodeBoy. All rights reserved. // // This Source Code Form is subject to the terms of the // license that can be found in the LICENSE file. package model import ( "time" ) // MapInfo is info struct for FileMap. type MapInfo struct { ID int `json:"id"` Title string `json:"title"...
Sort map list: last opened first
Sort map list: last opened first
Go
mpl-2.0
filemaps/filemaps-backend
709b0efdc4d70a49e67d60ef31bd24dc8ce169b1
lerror.go
lerror.go
package drain import ( "fmt" "regexp" "strconv" ) type LogplexError struct { Code int // L11, L12, etc. Count int // Count of logs referenced in the error Msg string } func parseLogplexError(msg string) (*LogplexError, error) { // Data:Error L10 (output buffer overflow): // 491 messages dropped since 2...
package drain import ( "fmt" "regexp" "strconv" ) type LogplexError struct { Code int // L11, L12, etc. Count int // Count of logs referenced in the error Msg string } func parseLogplexError(msg string) (*LogplexError, error) { // Data:Error L10 (output buffer overflow): // 491 messages dropped since 2...
Fix parsing of L errors without parenthesis
Fix parsing of L errors without parenthesis example: ``` Error L12: 14000 messages dropped since 2015-09-15T17:38:54.097612+00:00 ```
Go
mit
heroku/drain
e72181571c442e9cc84439352e986a510cc61eec
server.go
server.go
package servo import "net/http" // The Server is responsible for running the server process. // It can be injected via the goldi type "kernel.server" type Server interface { // Run starts the server and blocks until it has finished Run() error } // DefaultServer is the standard implementation of the Server interfa...
package servo import "net/http" // The Server is responsible for running the server process. // It can be injected via the goldi type "kernel.server" type Server interface { // Run starts the server and blocks until it has finished Run() error } // DefaultServer is the standard implementation of the Server interfa...
Work with http handler func
Work with http handler func
Go
mit
fgrosse/servo,fgrosse/servo
4a4bdcb83ba0afecd1d1b69bd882c8ed90030491
store/consul_store.go
store/consul_store.go
package store import ( "errors" consul "github.com/armon/consul-api" ) type ConsulStore struct { Client *consul.Client } func (c *ConsulStore) Get(key string) (Item, error) { kv, _, err := c.Client.KV().Get(key, nil) if err != nil { return nil, err } if kv == nil { return nil, errors.New("key not found")...
package store import ( "errors" consul "github.com/hashicorp/consul/api" ) type ConsulStore struct { Client *consul.Client } func (c *ConsulStore) Get(key string) (Item, error) { kv, _, err := c.Client.KV().Get(key, nil) if err != nil { return nil, err } if kv == nil { return nil, errors.New("key not fou...
Update the api in store package, github.com/armon/consul-api is deprecated
Update the api in store package, github.com/armon/consul-api is deprecated
Go
apache-2.0
uffy/go-micro,micro/go-micro,gpavlidi/go-micro,Taik/go-micro,kgrvamsi/go-micro,divisionone/go-micro,iheitlager/go-micro,jmptrader/go-micro,myodc/go-micro
908a02f76e2ae8cbcf977a6ee870785b37af617e
verfix.go
verfix.go
package main import ( "log" "os" "os/exec" "path/filepath" ) func init() { if Version == "" || Branch == "" { log.Printf("Version info isn't set. Must be on openshift. Let's try to get it from the environment") os.Chdir(filepath.Join(os.Getenv("HOME"), "git", "sdesearch.git")) cmd := exec.Co...
package main import ( "log" "os" "os/exec" "path/filepath" ) func init() { if Version == "" || Branch == "" { log.Printf("Version info isn't set. Must be on openshift. Let's try to get it from the environment") os.Chdir(filepath.Join(os.Getenv("HOME"), "git", "sdesearch.git")) cmd := exec.Co...
Trim garbage byte from git output
Trim garbage byte from git output
Go
mit
THUNDERGROOVE/sde-search,THUNDERGROOVE/sde-search
e9198d76b5defec077706b94b7d832c4f4c12523
stdlib.go
stdlib.go
package multitemplate import ( "text/template" "text/template/parse" "github.com/acsellers/multitemplate" ) type defaultParser struct{} func (ms *multiStruct) ParseTemplate(name, src string, funcs template.FuncMap) (map[string]*parse.Tree, error) { t, e := template.New(name).Funcs(funcs).Parse(src) if e != nil...
package multitemplate import ( "text/template" "text/template/parse" ) var GoLeftDelim, GoRightDelim string type defaultParser struct { left, right string } func (ms *defaultParser) ParseTemplate(name, src string, funcs template.FuncMap) (map[string]*parse.Tree, error) { var t *template.Template var e error i...
Clean up default parser, expose Delims
Clean up default parser, expose Delims
Go
bsd-2-clause
acsellers/multitemplate,acsellers/multitemplate
0e3181a0b0ab36c750708324599a368f69bab601
system/setns_linux.go
system/setns_linux.go
package system import ( "fmt" "runtime" "syscall" ) // Via http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7b21fddd087678a70ad64afc0f632e0f1071b092 // // We need different setns values for the different platforms and arch // We are declaring the macro here because the SETNS syscall does n...
package system import ( "fmt" "runtime" "syscall" ) // Via http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7b21fddd087678a70ad64afc0f632e0f1071b092 // // We need different setns values for the different platforms and arch // We are declaring the macro here because the SETNS syscall does n...
Fix setns syscall number for ARM, this has been wrong all along.
Fix setns syscall number for ARM, this has been wrong all along. See: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=571503e10045c89af951962ea0bb783482663aad Signed-off-by: Adam Conrad <6afcdb68eb9b55ab20be6196a160d519aa4934fb@0c3.net>
Go
apache-2.0
jhjeong-kr/runc,han-wang/runc,rhatdan/runc,mapk0y/runc,chenchun/runc,runcom/libcontainer,mYmNeo/runc,whosthatknocking/runc,intfrr/runc,docker/runc,dieface/runc,rootfs/runc,kolyshkin/runc,fabiokung/runc,stefanberger/runc,maxamillion/runc,inatatsu/runc,cloudfoundry-incubator/runc,haijunTan/runc,mikebrow/runc,adrianreber/...
0399746b4eeefaf599079643f5710b4fb76a4733
handlers/logout_test.go
handlers/logout_test.go
package handlers import ( "net/http" "net/http/httptest" "testing" ) func TestLogoutHandler(t *testing.T) { setUp("/config/testing/handler_logout_url.yml") handler := http.HandlerFunc(LogoutHandler) tests := []struct { name string url string wantcode int }{ {"allowed", "http://myapp.example.c...
package handlers import ( "net/http" "net/http/httptest" "testing" ) func TestLogoutHandler(t *testing.T) { setUp("/config/testing/handler_logout_url.yml") handler := http.HandlerFunc(LogoutHandler) tests := []struct { name string url string wantcode int }{ {"allowed", "http://myapp.example.c...
Validate redirect for logout tests
Validate redirect for logout tests
Go
mit
bnfinet/lasso,bnfinet/lasso
ffb534a1c2f2024ccafe4965f1a3bea5145c7524
meek-client-torbrowser/mac.go
meek-client-torbrowser/mac.go
// +build darwin // This file is compiled only on mac. It contains paths used by the mac // browser bundle. // http://golang.org/pkg/go/build/#hdr-Build_Constraints package main const ( // The TorBrowser.app.meek-http-helper directory is a special case for // the mac bundle. It is a copy of TorBrowser.app that has ...
// +build darwin // This file is compiled only on mac. It contains paths used by the mac // browser bundle. // http://golang.org/pkg/go/build/#hdr-Build_Constraints package main const ( // The TorBrowser.app.meek-http-helper directory is a special case for // the mac bundle. It is a copy of TorBrowser.app that has ...
Put the headless TorBrowser.app under PluggableTransports.
Put the headless TorBrowser.app under PluggableTransports. https://trac.torproject.org/projects/tor/ticket/10935#comment:28
Go
cc0-1.0
scucoco/meek,projectarkc/meek,projectarkc/meek,projectarkc/meek,projectarkc/meek,Yawning/meek,projectarkc/meek,wyuelin/mymeek,infinity0/meek,wyuelin/mymeek,gorshell/forkmeek,Yawning/meek,gorshell/forkmeek,wyuelin/mymeek,arlolra/meek,Yawning/meek,gorshell/forkmeek,arlolra/meek,infinity0/meek,infinity0/meek,Yawning/meek,...
072568f64861329b996635a4c286c9929f678895
q.go
q.go
package q import ( "fmt" "os" "path/filepath" "runtime" ) var ( LogFile = "/var/log/q" ) func Println(a ...interface{}) { fd, err := os.OpenFile(LogFile, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) if err != nil { panic(err) } defer fd.Close() ptr, file, line, ok := runtime.Caller(1) if ok { file = fi...
package q import ( "fmt" "os" "path/filepath" "runtime" ) var ( LogFile = "q.log" ) func Println(a ...interface{}) { f := filepath.Join("/tmp", LogFile) fd, err := os.OpenFile(f, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) if err != nil { panic(err) } defer fd.Close() ptr, file, line, ok := runtime.Call...
Put log in /tmp to avoid perm issues
Put log in /tmp to avoid perm issues
Go
mit
y0ssar1an/qq,soider/d,y0ssar1an/qq,y0ssar1an/q
53fc6712cedfc1b0f9aa4623ac953162c61599d7
sub/httpd/api.go
sub/httpd/api.go
package httpd import ( "fmt" "github.com/Symantec/Dominator/sub/scanner" "io" "net" "net/http" ) type HtmlWriter interface { WriteHtml(writer io.Writer) } var onlyHtmler HtmlWriter func StartServer(portNum uint, fsh *scanner.FileSystemHistory) error { listener, err := net.Listen("tcp", fmt.Sprintf(":%d", por...
package httpd import ( "fmt" "io" "net" "net/http" ) type HtmlWriter interface { WriteHtml(writer io.Writer) } var onlyHtmler HtmlWriter func StartServer(portNum uint, htmlWriter HtmlWriter) error { listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum)) if err != nil { return err } onlyHtmler = ...
Switch sub.http.StartServer() to HtmlWriter interface.
Switch sub.http.StartServer() to HtmlWriter interface.
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,rgooch/Dominator
ed6f7e390f705143cdfa449b4dc83f45092aabb0
twse/qfiis.go
twse/qfiis.go
package twse import ( "encoding/csv" "fmt" "strings" "time" "github.com/toomore/gogrs/utils" ) type QFIIS struct { Date time.Time } func (q QFIIS) URL() string { return fmt.Sprintf("%s%s", utils.TWSEHOST, fmt.Sprintf(utils.QFIISTOP20, q.Date.Year(), q.Date.Month(), q.Date.Day())) } func (q *QFIIS) Get() ([]...
package twse import ( "encoding/csv" "fmt" "strings" "time" "github.com/toomore/gogrs/utils" ) // QFIISTOP20 取得「外資及陸資持股比率前二十名彙總表」 type QFIISTOP20 struct { Date time.Time } // URL 擷取網址 func (q QFIISTOP20) URL() string { return fmt.Sprintf("%s%s", utils.TWSEHOST, fmt.Sprintf(utils.QFIISTOP20, q.Date.Year(), q....
Add note and tiny changed.
Add note and tiny changed.
Go
mit
toomore/gogrs,toomore/gogrs
59bb68fc295665df6807ec32234c34421aef93c9
model/template_generation_type.go
model/template_generation_type.go
package model // TemplateGenerationType is the model class what represents template generation type TemplateGenerationType struct { TemplateGeneration } // NewTemplateGenerationType creates a template generation model instance func NewTemplateGenerationType() *TemplateGenerationType { return &TemplateGenerationType...
package model import "github.com/qb0C80aE/clay/extension" // TemplateGenerationType is the model class what represents template generation type TemplateGenerationType struct { TemplateGeneration } // NewTemplateGenerationType creates a template generation model instance func NewTemplateGenerationType() *TemplateGen...
Fix template generation type model to register its model
Fix template generation type model to register its model
Go
mit
qb0C80aE/clay
9bce6cad74f30ccc1117f4a76f25d8737213c6cb
game/game.go
game/game.go
package game import ( "fmt" ) type Game struct { Name string SetupRules []SetupRule } func NewGame(name string, rules []SetupRule) *Game { return &Game{ Name: name, SetupRules: rules, } } func (game *Game) PrintSetupRules() { for _,r := range game.SetupRules { fmt.Printf("%s\t%s\n", r.Descri...
package game import ( "fmt" ) type Game struct { Id uint `json:"id"` Name string `json:"name"` SetupRules []SetupRule } func NewGame(name string, rules []SetupRule) *Game { return &Game{ Name: name, SetupRules: rules, } } func (game *Game) PrintSetupRules() { for _,r := range game.SetupRules {...
Add id and make fields work with Ember default JSON serialization
Add id and make fields work with Ember default JSON serialization
Go
mit
rkbodenner/parallel_universe
2fa00279bfb36f6ff83a923a26e719a2f3e2f3cc
database/schema/post.go
database/schema/post.go
package schema import ( "github.com/coopernurse/gorp" "log" "time" ) func toString(t time.Time) string { return t.Format(time.UnixDate) } func fromString(st string) time.Time { t, err := time.Parse(time.UnixDate, st) if err != nil { log.Fatal(err) } return t } // A post to be displayed on the blog type Po...
package schema import "time" // A post to be displayed on the blog type Post struct { Id int64 `db:"id"` // The indexed ID of the blog post Title string `db:"title"` // The title of the blog post Author string `db:"author"` // The blog post's author Body string `db:"body"` // Th...
Revert "Added some functions to deal with the abstraction of converting a time.Time to a string and back."
Revert "Added some functions to deal with the abstraction of converting a time.Time to a string and back." This reverts commit df0098a42e25b2100fe87349814d2d6581dca061.
Go
mit
crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite
50284cdfda2142263ff7ba33c6c3bff46f26bea4
config/config_windows.go
config/config_windows.go
// +build windows // Package config wraps xdgdir.Config to allow for OS-independent configuration. package config import ( "fmt" "os" "path/filepath" ) func Open(filename string) (*os.File, error) { dir := os.Getenv("USERPROFILE") if dir == "" { return nil, fmt.Errorf("Could not find %%USERPROFILE%% envar") ...
// +build windows package config import ( "fmt" "os" "path/filepath" ) func Open(filename string) (*os.File, error) { dir := os.Getenv("LOCALAPPDATA") if dir == "" { return nil, fmt.Errorf("Could not find %%LOCALAPPDATA%% envar") } f, err := os.Open(filepath.Join(dir, filename)) return f, err }
Use the correct envar for Windows
Use the correct envar for Windows
Go
mit
adam000/goutils,adam000/goutils
02e2eebf07da56ec80b2a13a4c4784a34368883c
models/server/server_res.go
models/server/server_res.go
package server type ServerRes struct { Server string IsQueued bool ErrorMessage string }
package server import ( "github.com/centurylinkcloud/clc-go-cli/models" ) type ServerRes struct { Server string IsQueued bool ErrorMessage string Links []models.LinkEntity }
Add the missing Links field to the ServerRes type.
Add the missing Links field to the ServerRes type.
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
18d00f79e0ec80e65714bb4e1fea20dd122e11b3
backend/package_test.go
backend/package_test.go
package backend import ( "fmt" "net/http" "testing" "github.com/stretchr/testify/assert" ) type recordingHTTPTransport struct { req *http.Request } func (t *recordingHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) { t.req = req return nil, fmt.Errorf("recording HTTP transport impl") } fu...
package backend import ( "fmt" "net/http" "testing" "github.com/stretchr/testify/assert" ) type recordingHTTPTransport struct { req *http.Request } func (t *recordingHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) { t.req = req return nil, fmt.Errorf("recording HTTP transport impl") } fu...
Include a critical truthy value in asBool test
Include a critical truthy value in asBool test
Go
mit
solarce/worker,solarce/worker,solarce/worker,travis-ci/worker,travis-ci/worker,travis-ci/worker
cb0d7d0cfbe88c944bc42f01c372f9aa23e12214
main/doc.go
main/doc.go
/* Package main provides go-bigv, the command line interface to Bytemark's BigV service */ package main // TODO(telyn): Change all instances of uk0 to api when we move to api.bigv.io - `make find-uk0` will help
/* Package main provides go-bigv, the command line interface to Bytemark's BigV service */ package main // TODO(telyn): Change all instances of uk0 to api when we move to api.bigv.io - `make find-uk0` will help // TODO(telyn): Make usage info use $0 instead of 'go-bigv'
Add a todo for usage info
Add a todo for usage info
Go
mit
BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client
c6e8a8aeb93d1f565081758efb40a63bd4b85cd1
behaviors/main_test.go
behaviors/main_test.go
package behaviors import ( "testing" "github.com/workfit/tester/assert" ) func TestRoundRobin(t *testing.T) { var b interface{} b = &RoundRobin{} _, ok := b.(Interface) assert.For(t).ThatActual(ok).IsTrue() } func TestCurrentPlayer(t *testing.T) { var b interface{} b = &CurrentPlayer{} _, ok := b.(Interfac...
package behaviors import ( "testing" "github.com/jkomoros/boardgame/moves/interfaces" "github.com/workfit/tester/assert" ) func TestRoundRobin(t *testing.T) { var b interface{} b = &RoundRobin{} _, ok := b.(Interface) assert.For(t).ThatActual(ok).IsTrue() _, ok = b.(interfaces.RoundRobinProperties) assert....
Add tests that verify that behaviors.RoundRobin and CurrentPlayer implement the moves/interfaces they intend to implement, which will help detect drift if those interfaces change.
Add tests that verify that behaviors.RoundRobin and CurrentPlayer implement the moves/interfaces they intend to implement, which will help detect drift if those interfaces change. Part of #741.
Go
apache-2.0
jkomoros/boardgame,jkomoros/boardgame,jkomoros/boardgame
b242877875fad0b7d485d3af8cdcee6cabf0c2ee
main.go
main.go
package main import ( "bufio" "fmt" "log" "os" "github.com/jessevdk/go-flags" "github.com/tarm/serial" ) type Options struct { Port string `short:"p" long:"port" description:"Serial Port"` Baud int `short:"b" long:"baud" description:"Baud Rate"` } var opts Options func main() { _, err := flags.Parse(&o...
package main import ( "bufio" "fmt" "log" "os" "github.com/jessevdk/go-flags" "github.com/tarm/serial" ) type Options struct { Port string `short:"p" long:"port" description:"Serial Port"` Baud int `short:"b" long:"baud" description:"Baud Rate"` } var opts Options func main() { _, err := flags.Parse(&o...
Fix infinite loop writing style
Fix infinite loop writing style
Go
mit
nocd5/serial
1bf8f5b45ec96e26ca50a162c0090612a171fe06
main.go
main.go
package main import ( "database/sql" "fmt" "log" "net/http" "os" "github.com/sotoz/Ferrytale/controller" "github.com/sotoz/Ferrytale/database" ) // Config describes the configuration struct for the application. type Config struct { Host string Port string } func main() { db, err := sql.Open( "mysql", ...
package main import ( "database/sql" "fmt" "log" "net/http" "os" "github.com/sotoz/Ferrytale/controller" "github.com/sotoz/Ferrytale/database" ) // Config describes the configuration struct for the application. type Config struct { Host string Port string } func main() { db, err := sql.Open("mysql", fmt....
Use only one env var for the database url
Use only one env var for the database url
Go
apache-2.0
sotoz/Ferrytale