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
9f5bd2723198701b417f2deffd8b4f6d39dbf721
proto/imageserver/messages.go
proto/imageserver/messages.go
package imageserver type StatusResponse struct { Success bool ErrorString string } type AddRequest struct { Name string Filter [][]string } type AddResponse StatusResponse type CheckRequest struct { Name string } type CheckResponse struct { ImageExists bool } type DeleteRequest struct { Name string }...
package imageserver type StatusResponse struct { Success bool ErrorString string } const ( UNCOMPRESSED = iota GZIP ) type AddRequest struct { Name string Filter [][]string DataSize uint64 CompressionType uint } type AddResponse StatusResponse type CheckRequest struct { Name...
Add DataSize and CompressionType to AddRequest message.
Add DataSize and CompressionType to AddRequest message.
Go
apache-2.0
keep94/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator
699504d26434f2ba03804e7063823dd536b2e431
db_manager/connection.go
db_manager/connection.go
package db_manager import ( "fmt" "log" "github.com/garyburd/redigo/redis" "encoding/json" "../entities" // "github.com/garyburd/redigo/redisx" ) var connection redis.Conn const ( HOSTNAME = "localhost" PORT = 6379 NETWORK = "tcp" ) func init() { var err error log.Print(...
package db_manager import ( "fmt" "log" "github.com/garyburd/redigo/redis" "encoding/json" "../entities" ) var connection redis.Conn const ( HOSTNAME = "localhost" PORT = 6379 NETWORK = "tcp" ) func init() { var err error log.Print("Initializing database connection... ") ...
Remove the useless import of redisx
Remove the useless import of redisx
Go
mit
WarCluster/warcluster-server,WarCluster/warcluster-server
51b04144d7a863cf32fff51769664ad09a915a4e
asciidocgo.go
asciidocgo.go
package asciidocgo import "io" func Load(input io.Reader) *Document { return nil }
/* Asciidocgo implements an AsciiDoc renderer in Go. */ package asciidocgo import "io" /* Accepts input as an IO (or StringIO), String or String Array object. If the input is a File, information about the file is stored in attributes on the Document object. */ func Load(input io.Reader) *Document { return nil }
Add Package doc, and Lod function doc.
Add Package doc, and Lod function doc.
Go
mit
bep/asciidocgo,VonC/asciidocgo
33e9be254750f2137894f98d51ceb5ee505b6e61
metadata/types.go
metadata/types.go
package metadata type Machine struct { Name string `yaml: "name"` Interfaces []Interface `yaml: "interfaces,omitempty"` } type Interface struct { Name string `yaml: "name"` Ip string `yaml: "ip"` } type Cluster struct { Name string `yaml: "name"` State string `yaml: "sta...
package metadata type Specification struct { Machine string `yaml: "machine"` Cluster Cluster `yaml: "cluster"` } type Machine struct { Name string `yaml: "name"` Interfaces []Interface `yaml: "interfaces,omitempty"` } type Interface struct { Name string `yaml: "name"` Ip string `yaml: "ip"` } t...
Add structure to hold spec from yaml
Add structure to hold spec from yaml
Go
apache-2.0
bernardolins/vandame,bernardolins/vandame
60a6f7c896230d54d7b040d6be332c66d770d703
src/metadata-db/main.go
src/metadata-db/main.go
package main import ( "log" "os" ) const ( DATAFILE_SIZE = 1024 * 1024 * 256 // 256 MB DATABLOCK_SIZE = 1024 * 4 // 4KB ) func main() { file, err := os.Create("metadata-db.dat") if err != nil { panic(err) } log.Println("Creating datafile...") file.Truncate(DATAFILE_SIZE) log.Println("DONE") }
package main import ( "encoding/binary" "io" "log" "os" ) const ( DATAFILE_SIZE = 1024 * 1024 * 256 // 256 MB DATABLOCK_SIZE = 1024 * 4 // 4KB ) var ( DatablockByteOrder = binary.BigEndian ) func main() { file, err := createDatafile() if err != nil { panic(err) } writeInt16(file, 7) writeIn...
Read and write from file
Read and write from file
Go
mit
fgrehm/pucrs-simple-json-db,fgrehm/pucrs-metadata-db
9064c9bd0b7c21c9d4443c2dc3f283516b43e210
octokit/octokit.go
octokit/octokit.go
package octokit const ( gitHubAPIURL = "https://api.github.com" userAgent = "Octokit Go " + version version = "0.3.0" defaultMediaType = "application/vnd.github.v3+json" )
package octokit const ( gitHubAPIURL = "https://api.github.com" userAgent = "Octokit Go " + version version = "0.3.0" defaultMediaType = "application/vnd.github.v3+json; charset=utf-8" )
Add charset to default media type
Add charset to default media type
Go
mit
pcasaretto/go-octokit,pcasaretto/go-octokit,half-ogre/go-octokit,octokit/go-octokit,calavera/go-octokit,octokit/go-octokit,half-ogre/go-octokit,calavera/go-octokit
5d529e84777b5ed00926f6f9fef1d11727780a57
oncall.go
oncall.go
package somaproto type Oncall struct { Id string `json:"id, omitempty"` Name string `json:"name, omitempty"` Number string `json:"number, omitempty"` Details *OncallDetails `json:"details, omitempty"` } type OncallDetails struct { DetailsCreation Members *[]OncallMember `json:"m...
package somaproto type Oncall struct { Id string `json:"id, omitempty"` Name string `json:"name, omitempty"` Number string `json:"number, omitempty"` Members *[]OncallMember `json:"members, omitempty"` Details *OncallDetails `json:"details, omitempty"` } type OncallDetails st...
Move location of OncallMember to be consistent
Move location of OncallMember to be consistent
Go
bsd-2-clause
1and1/soma
f96b19ad63d300927e7837809d041cacc1c44f54
main.go
main.go
package main import ( "fmt" "os" "github.com/minamijoyo/myaws/cmd" ) func main() { if err := cmd.RootCmd.Execute(); err != nil { fmt.Printf("%+v\n", err) os.Exit(-1) } }
package main import ( "fmt" "os" "github.com/minamijoyo/myaws/cmd" ) func main() { if err := cmd.RootCmd.Execute(); err != nil { fmt.Printf("%+v\n", err) os.Exit(1) } }
Change error exit status to -1 to 1
Change error exit status to -1 to 1
Go
mit
minamijoyo/myaws
b1716db73f4526ee0e835610523c47830a2ef364
main.go
main.go
// Copyright 2013 Andreas Koch. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { }
Make the whole project compilable
Make the whole project compilable
Go
bsd-3-clause
andreaskoch/allmark
59539c9c780165d25b588b5c0e02295ca39ca231
main.go
main.go
package main import ( "fmt" "io/ioutil" "os" "github.com/ghodss/yaml" ) func main() { stat, _ := os.Stdin.Stat() var bytes []byte if (stat.Mode() & os.ModeCharDevice) == 0 { bytes, _ = ioutil.ReadAll(os.Stdin) } else { //file, _ := os.Open(os.Args[len(os.Args)-1]) bytes, _ = ioutil.ReadFile(os.Args[le...
package main import ( "fmt" "io/ioutil" "os" "github.com/ghodss/yaml" ) func readData() []byte { var bytes []byte stat, _ := os.Stdin.Stat() if (stat.Mode() & os.ModeCharDevice) == 0 { bytes, _ = ioutil.ReadAll(os.Stdin) } else { bytes, _ = ioutil.ReadFile(os.Args[len(os.Args)-1]) } return bytes } fun...
Isolate input and output into functions
Isolate input and output into functions
Go
apache-2.0
solarkennedy/uq
ca3450e2ac99d1d79c0b34b6201381cde5afc44d
main.go
main.go
package main import ( "log" docker "github.com/fsouza/go-dockerclient" ) const VERSION = "0.1.0" func main() { err := LoadLanguages("./languages.json") if err != nil { log.Fatalln(err) } config, err := NewConfig() if err != nil { log.Fatalln(err) } client, err := docker.NewClient(config.DockerHost) ...
package main import ( "log" docker "github.com/fsouza/go-dockerclient" ) const VERSION = "0.1.0" func main() { log.Printf("bitrun api v%s\n", VERSION) err := LoadLanguages("./languages.json") if err != nil { log.Fatalln(err) } config, err := NewConfig() if err != nil { log.Fatalln(err) } client, er...
Print verison at the start
Print verison at the start
Go
mit
sosedoff/bitrun-api,bitrun/api
f8015cf6a636ac30e8dca27c9a9c5e2a3f2d5016
main.go
main.go
package main import ( "flag" "fmt" "os" "github.com/fatih/color" ) func main() { configurationType := flag.String("type", "deployment", "Kubernetes configuration type, eg: deployment, rc, secret") image := flag.String("image", "", "Docker image name") imageTag := flag.String("tag", "", "Docker image tag") fi...
package main import ( "flag" "fmt" "os" "io/ioutil" "github.com/fatih/color" "github.com/oshalygin/k8s-config/models" "gopkg.in/yaml.v2" ) func main() { configurationFile := models.Deployment{} configurationType := flag.String("type", "deployment", "Kubernetes configuration type, eg: deployment, rc, secre...
Add base logic to unmarshal a yaml
Add base logic to unmarshal a yaml
Go
mit
oshalygin/k8s-config,oshalygin/k8s-config
638d5987e2e1d44402eb9ad5a8b887f71165e5ea
main.go
main.go
package main import "fmt" func main() { fmt.Printf("%v", payload) }
package main import ( "fmt" "net/http" "strings" ) func main() { buf := strings.NewReader(payload) resp, err := http.Post("http://127.0.0.1:8080", "application/json", buf) fmt.Printf("%v\n", resp) fmt.Printf("%v\n", err) }
Send fake JSON payload to 127.0.0.1:8080
Send fake JSON payload to 127.0.0.1:8080
Go
mit
maiconio/fake-github-webhook
cc26e01722baacb23f2302f96ed37f64623e40aa
compiler/natives/src/strconv/atoi.go
compiler/natives/src/strconv/atoi.go
// +build js package strconv import ( "github.com/gopherjs/gopherjs/js" ) const maxInt32 float64 = 1<<31 - 1 const minInt32 float64 = -1 << 31 // Atoi returns the result of ParseInt(s, 10, 0) converted to type int. func Atoi(s string) (int, error) { const fnAtoi = "Atoi" if len(s) == 0 { return 0, syntaxError(...
// +build js package strconv import ( "github.com/gopherjs/gopherjs/js" ) const maxInt32 float64 = 1<<31 - 1 const minInt32 float64 = -1 << 31 // Atoi returns the result of ParseInt(s, 10, 0) converted to type int. func Atoi(s string) (int, error) { const fnAtoi = "Atoi" if len(s) == 0 { return 0, syntaxError(...
Add validate to input for numbers invalid in Go but valid for Number parsing
Add validate to input for numbers invalid in Go but valid for Number parsing
Go
bsd-2-clause
gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs
36ee8777e7f369c143fe0acfe522a3df1a920dc7
netd.go
netd.go
// Package netd provides useful shorthands for building network daemons. package netd
// Package netd provides useful primitives for building network daemons. package netd import "net" // Backend handles incoming connections. type Backend interface { Handle(net.Conn) } // Server handles multiple incoming connections using the specified Backend. type Server interface { Serve(Backend) }
Add basic primitives for building network daemons
Add basic primitives for building network daemons
Go
mit
Invizory/netd
a9851100fe5828794febedc8c553078acdd22ead
doc.go
doc.go
// A set of packages that provide many tools for testifying that your code will behave as you intend. // // testify contains the following packages: // // The assert package provides a comprehensive set of assertion functions that tie in to the Go testing system. // // The http package contains tools to make it easier ...
// A set of packages that provide many tools for testifying that your code will behave as you intend. // // testify contains the following packages: // // The assert package provides a comprehensive set of assertion functions that tie in to the Go testing system. // // The http package contains tools to make it easier ...
Fix dependencies for 'go get'.
Fix dependencies for 'go get'.
Go
mit
ifraixedes/testify,MCProHosting/testify,yxd-hde/testify,liudhzhyym/testify,glittershark/testify,irnnr/testify,brahmaroutu/testify,AnuchitPrasertsang/testify,dvln/testify,betable/testify,codygibb/testify,davelondon/ktest,outrightmental/go-testify,stretchr/testify,embroker/testify,mesosphere/testify,ernesto-jimenez/testi...
c53cf959ec108a4d21d044b0de23f2bcf2526387
appletflag/runtime.go
appletflag/runtime.go
package appletflag import ( "runtime" "strings" ) func getCallerPackage() string { ptr, _, _, ok := runtime.Caller(2) if !ok { panic("Could not obtain caller’s function pointer") } name := runtime.FuncForPC(ptr).Name() return strings.Split(name, ".")[0] }
package appletflag import ( "runtime" "strings" ) func getCallerPackage() string { ptr, _, _, ok := runtime.Caller(2) if !ok { panic("Could not obtain caller’s function pointer") } name := runtime.FuncForPC(ptr).Name() elems := strings.Split(name, ".") return strings.Join(elems[0:len(elems)-1], ".") }
Fix appleflag package name bug
Fix appleflag package name bug
Go
mit
izissise/gobox
9d2e7e9281e270ca62b17f1d77fd1668ae2266e4
src/cmd/linuxkit/pkg_build.go
src/cmd/linuxkit/pkg_build.go
package main import ( "flag" "fmt" "os" "path/filepath" "github.com/linuxkit/linuxkit/src/cmd/linuxkit/pkglib" ) func pkgBuild(args []string) { flags := flag.NewFlagSet("pkg build", flag.ExitOnError) flags.Usage = func() { invoked := filepath.Base(os.Args[0]) fmt.Fprintf(os.Stderr, "USAGE: %s pkg build [o...
package main import ( "flag" "fmt" "os" "path/filepath" "github.com/linuxkit/linuxkit/src/cmd/linuxkit/pkglib" ) func pkgBuild(args []string) { flags := flag.NewFlagSet("pkg build", flag.ExitOnError) flags.Usage = func() { invoked := filepath.Base(os.Args[0]) fmt.Fprintf(os.Stderr, "USAGE: %s pkg build [o...
Make `pkg build` build the image
Make `pkg build` build the image Signed-off-by: Karol Woźniak <0ab7226d9746c57bce329c73e3d8a07dd0812833@gmail.com>
Go
apache-2.0
konstruktoid/linuxkit,djs55/linuxkit,linuxkit/linuxkit,JohnnyLeone/linuxkit,deitch/linuxkit,linuxkit/linuxkit,djs55/linuxkit,justincormack/linuxkit,linuxkit/linuxkit,furious-luke/linuxkit,justincormack/linuxkit,deitch/linuxkit,rn/linuxkit,JohnnyLeone/linuxkit,rn/linuxkit,konstruktoid/linuxkit,furious-luke/linuxkit,furi...
f3c6187e8df2ee60caaf07851535588a20ab14c1
lifecycle/server/shutdown.go
lifecycle/server/shutdown.go
package server import ( "github.com/xgfone/go-tools/atomics" "github.com/xgfone/go-tools/lifecycle" ) var ( manager = lifecycle.GetDefaultManager() shutdowned = atomics.NewBool() shouldShutdown = make(chan bool, 1) ) // RunForever runs for ever. func RunForever() { if shutdowned.Get() { panic("The...
package server import ( "sync" "github.com/xgfone/go-tools/lifecycle" ) var ( manager = lifecycle.GetDefaultManager() locked = new(sync.Mutex) shutdowned = false shouldShutdown = make(chan bool, 1) ) // RunForever runs for ever. func RunForever() { locked.Lock() if shutdowned { locked.U...
Use sync.Mutex to replace atomics.Bool
Use sync.Mutex to replace atomics.Bool
Go
apache-2.0
xgfone/go-tools
40238135fe5870f4816a4a013c69c637ca71965f
client/content/playgrounds/code/fortune/ex0-go/src/client/client.go
client/content/playgrounds/code/fortune/ex0-go/src/client/client.go
// index=3 package main import ( "fmt" "time" _ "v.io/core/veyron/profiles" "v.io/core/veyron2/rt" "fortune" ) func main() { runtime, err := rt.New() if err != nil { panic(err) } defer runtime.Cleanup() ctx := runtime.NewContext() // Create a new stub that binds to address without // using the name s...
// index=3 package main import ( "fmt" "time" _ "v.io/core/veyron/profiles" "v.io/core/veyron2/rt" "fortune" ) func main() { // Create the runtime and context. runtime, err := rt.New() if err != nil { panic(err) } defer runtime.Cleanup() ctx := runtime.NewContext() // Create a new stub that binds to ...
Remove playground-test from make test target.
playground: Remove playground-test from make test target. Prepare for making playground-test a separate test in v23.
Go
bsd-3-clause
vanadium/playground,vanadium/playground,vanadium/playground,vanadium/playground
06524d01fded9e57a05164ac9db285cccca72c58
api/version_test.go
api/version_test.go
package api import ( "encoding/json" "testing" "github.com/keydotcat/server/util" ) func TestGetFullVersion(t *testing.T) { r, err := GetRequest("/version") CheckErrorAndResponse(t, r, err, 200) sga := &versionSendFullResponse{} if err := json.NewDecoder(r.Body).Decode(sga); err != nil { t.Fatal(err) } if...
package api import ( "encoding/json" "net/http" "testing" "github.com/keydotcat/server/util" ) func TestGetFullVersion(t *testing.T) { r, err := http.Get(srv.URL + "/version") CheckErrorAndResponse(t, r, err, 200) sga := &versionSendFullResponse{} if err := json.NewDecoder(r.Body).Decode(sga); err != nil { ...
Make sure we don't use any auth/cookie when testing version
Make sure we don't use any auth/cookie when testing version
Go
mit
keydotcat/backend
4e36046c3a38830152a7e29ad855f69a6a7bacc4
cmd_migrate.go
cmd_migrate.go
package main import ( "errors" "fmt" ) var cmdMigrate = &Command{ Run: runMigrate, UsageLine: "migrate", Short: "Regenerate data file", Long: `Regenerate data file with new key file.`, } // MigrateFileName is file name that created with migrate subcommand. const MigrateFileName = "spwd-migrated....
package main import ( "errors" "fmt" ) var cmdMigrate = &Command{ Run: runMigrate, UsageLine: "migrate NEW_KEY_FILE", Short: "Regenerate data file", Long: `Regenerate data file with new key file.`, } // MigrateFileName is file name that created with migrate subcommand. const MigrateFileName = "s...
Update usage of `migrate` subcommand.
Update usage of `migrate` subcommand.
Go
mit
pinzolo/spwd
7f956da3f46268dc33006bb3222f8cf1213d2e84
configuration/config_flags.go
configuration/config_flags.go
package configuration import ( "flag" "time" ) // parseConfigFlags overwrites configuration with set flags func parseConfigFlags(Conf *SplendidConfig) (*SplendidConfig, error) { // TODO: This should only happen if the flag has been passed flag.StringVar(&Conf.Workspace, "w", "./splendid-workspace", "Workspace") ...
package configuration import ( "flag" "time" ) // parseConfigFlags overwrites configuration with set flags func parseConfigFlags(Conf *SplendidConfig) (*SplendidConfig, error) { // Set to passed flags, otherwise go with config flag.IntVar(&Conf.Concurrency, "c", Conf.Concurrency, "Number of collector processes") ...
Set flags to config file settings if not passed. Will need to set defaults if the var doesn't exist in the config.
Set flags to config file settings if not passed. Will need to set defaults if the var doesn't exist in the config.
Go
mit
slarti5191/splendid,slarti5191/splendid
e2ab8c7392c35e30a1f04a5303e909f1d296667a
cmd/playpen/notify.go
cmd/playpen/notify.go
package main import ( "fmt" "github.com/0xAX/notificator" "github.com/datawire/teleproxy/pkg/supervisor" ) var notifyConfig *notificator.Notificator // Notify displays a desktop banner notification to the user func Notify(p *supervisor.Process, title string, message ...string) { if notifyConfig == nil { notif...
package main import ( "fmt" "github.com/0xAX/notificator" "github.com/datawire/teleproxy/pkg/supervisor" ) var notifyConfig *notificator.Notificator // Notify displays a desktop banner notification to the user func Notify(p *supervisor.Process, title string, message ...string) { if notifyConfig == nil { notif...
Add MaybeNotify for state change notifications
Add MaybeNotify for state change notifications
Go
apache-2.0
datawire/ambassador,datawire/telepresence,datawire/telepresence,datawire/ambassador,datawire/ambassador,datawire/telepresence,datawire/ambassador,datawire/ambassador
085533c17fe0ae2138130554fc6132a833efac88
config_test.go
config_test.go
package main import ( "cgl.tideland.biz/asserts" "testing" ) func TestConfig_ParseConfig_Bad(t *testing.T) { assert := asserts.NewTestingAsserts(t, true) data := ` [commands] foo = bar ` _, err := parseConfig(data) assert.NotNil(err, "should have an error") } func TestConfig_ParseConfig_Good(t *testing.T)...
package main import ( "cgl.tideland.biz/asserts" "testing" ) func TestConfig_ParseConfig_Bad(t *testing.T) { assert := asserts.NewTestingAsserts(t, true) data := ` [commands] foo = bar ` _, err := parseConfig(data) assert.NotNil(err, "should have an error") } func TestConfig_ParseConfig_DefaultConfig(t *t...
Test to ensure the default config can parse
packer: Test to ensure the default config can parse
Go
mpl-2.0
uber/packer,jarl-dk/packer,pvandervelde/packer,manicai/packer,timsutton/packer,higebu/packer,blairham/packer,markpeek/packer,youhong316/packer,sansb/packer,jean/packer,paulmey/packer,dev-head/packer,smaato/packer,jean/packer,burnzy/packer,jen20/packer,marc-ta/packer,tsmolka/packer,markpeek/packer,paulvollmer/packer,tim...
86cf78e9113bdca26f1e5dd6be32e968a92d58c5
diff/differ.go
diff/differ.go
package diff import ( "fmt" "path/filepath" "github.com/xchapter7x/enaml/pull" ) // Result is returned from a diff operation type Result struct { Deltas []string } // Differ implements diffing BOSH or Pivnet releases and their contained entities. type Differ interface { Diff() (DiffResult, error) DiffJob(job ...
package diff import ( "fmt" "path/filepath" "github.com/xchapter7x/enaml/pull" ) // Result is returned from a diff operation type Result struct { Deltas []string } // Differ implements diffing BOSH or Pivnet releases and their contained entities. type Differ interface { Diff() (Result, error) DiffJob(job stri...
Rename diff result to follow Go convention
Rename diff result to follow Go convention
Go
apache-2.0
enaml-ops/enaml,xchapter7x/enaml
e2d59565e612d7d40732c33a7461770169dd6a04
cli/cmd/empire/deploy.go
cli/cmd/empire/deploy.go
package main import ( "fmt" "strings" "github.com/remind101/empire/cli/pkg/plugin" ) var pluginDeploy = plugin.Plugin{ Name: "deploy", Action: runDeploy, } type Image struct { Repo string `json:"repo"` ID string `json:"id"` } type PostDeployForm struct { Image *Image `json:"image"` } func runDeploy(c ...
package main import ( "fmt" "github.com/remind101/empire/cli/pkg/plugin" ) var pluginDeploy = plugin.Plugin{ Name: "deploy", Action: runDeploy, } type PostDeployForm struct { Image string `json:"image"` } func runDeploy(c *plugin.Context) { if len(c.Args) < 1 { fmt.Println("Usage: emp deploy repo:id") ...
Send the image directly as a string.
Send the image directly as a string.
Go
bsd-2-clause
vfulco/empire,zhakui/empire,remind101/empire,markpeek/empire,remind101/empire,remind101/empire,zhakui/empire,zofuthan/empire,vfulco/empire,lihuanghai/empire,mhahn/empire,no2key/empire,iserko/empire,mhahn/empire,zofuthan/empire,markpeek/empire,lihuanghai/empire,mhahn/empire,iserko/empire,iserko/empire,no2key/empire
c3d6cc91ec94de553c65dd3d3358fb9e9c31e80d
fs/http_old.go
fs/http_old.go
// HTTP parts pre go1.7 //+build !go1.7 package fs import ( "net" "net/http" ) // dial with timeouts func (ci *ConfigInfo) dialTimeout(network, address string) (net.Conn, error) { dialer := ci.NewDialer() c, err := dialer.Dial(network, address) if err != nil { return c, err } return newTimeoutConn(c, ci.Ti...
// HTTP parts pre go1.7 //+build !go1.7 package fs import ( "net" "net/http" ) // dial with timeouts func (ci *ConfigInfo) dialTimeout(network, address string) (net.Conn, error) { dialer := ci.NewDialer() c, err := dialer.Dial(network, address) if err != nil { return c, err } return newTimeoutConn(c, ci.Ti...
Fix --bind flag changes under go1.6
Fix --bind flag changes under go1.6 Correcting 9f2463956884c0e995cf6f7140af0dc06af096e0
Go
mit
olihey/rclone,B4dM4n/rclone,ncw/rclone,seuffert/rclone,olihey/rclone,yonjah/rclone,yonjah/rclone,yonjah/rclone,ncw/rclone,seuffert/rclone,ncw/rclone,yonjah/rclone,seuffert/rclone,olihey/rclone,B4dM4n/rclone,olihey/rclone,ncw/rclone,seuffert/rclone,B4dM4n/rclone,B4dM4n/rclone
f457e3573d1339c208d1bead73157f157f0a5dcc
hostnameDNS.go
hostnameDNS.go
package main import ( "fmt" "net" "regexp" ) func revers(ip4 string) { regE := regexp.MustCompile("[-a-z0-9]*") Hostname, err := net.LookupAddr(ip4) if err == nil { fmt.Printf("%s\n", regE.FindString(Hostname[0])) } } func main() { regS := regexp.MustCompile("[0-9.]*") interfaces, _ := net.Interfaces() ...
package main import ( "flag" "fmt" "net" "regexp" ) func revers(ip4 string, fqdn bool, short bool, domain bool) { Hostname, err := net.LookupAddr(ip4) if err == nil { switch { case domain: regE := regexp.MustCompile("^[^.]*[.](.*)[.]$") fmt.Printf("%s\n", regE.FindStringSubmatch(Hostname[0])[1]) cas...
Add short, domain, fqdn flags like hostname command.
Add short, domain, fqdn flags like hostname command.
Go
mit
gauthierc/go-utils
1dc40a4ba39737f7f2b1fbdb71395f7a7b98ed4c
web.go
web.go
package main import ( "gnd.la/app" "gnd.la/apps/docs" "gnd.la/apps/docs/doc" "gnd.la/net/urlutil" "path" ) const ( //gondolaURL = "http://www.gondolaweb.com" gondolaURL = "ssh://abra.rm-fr.net/home/fiam/git/gondola.git" ) func gndlaHandler(ctx *app.Context) { if ctx.FormValue("go-get") == "1" { ctx.MustExe...
package main import ( "path" "gnd.la/app" "gnd.la/apps/docs" "gnd.la/net/urlutil" ) const ( //gondolaURL = "http://www.gondolaweb.com" gondolaURL = "ssh://abra.rm-fr.net/home/fiam/git/gondola.git" ) func gndlaHandler(ctx *app.Context) { if ctx.FormValue("go-get") == "1" { ctx.MustExecute("goget.html", nil)...
Update import from docs to the new API
Update import from docs to the new API
Go
apache-2.0
rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb
01715682eafc2ca7a366f117d5d1e537029cdbd6
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"` } type Mdb struct { Machines []Machine } func (mdb *Mdb) DebugWrite(w io.Writer) error { return mdb.debugWrite(w) } func (mdb *Mdb) Len() int { return len(...
package mdb import ( "io" ) type Machine struct { Hostname string DisableUpdates string `json:",omitempty"` RequiredImage string `json:",omitempty"` PlannedImage string `json:",omitempty"` } type Mdb struct { Machines []Machine } func (mdb *Mdb) DebugWrite(w io.Writer) error { return mdb.debugWrite(...
Add DisableUpdates field to lib/mdb/Machine.
Add DisableUpdates field to lib/mdb/Machine.
Go
apache-2.0
rgooch/Dominator,keep94/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator
ea967ce31e46ab8a3b2414d950c14159f1570df1
main.go
main.go
package main import ( "fmt" "os" "github.com/git-time-metric/gtm/command" "github.com/git-time-metric/gtm/project" "github.com/mitchellh/cli" ) func main() { c := cli.NewCLI("gtm", "1.0.0") c.Args = os.Args[1:] c.Commands = map[string]cli.CommandFactory{ "init": command.NewInit, "record": command.NewR...
package main import ( "fmt" "os" "github.com/git-time-metric/gtm/command" "github.com/git-time-metric/gtm/project" "github.com/mitchellh/cli" ) var version string = "0.0.0" func main() { c := cli.NewCLI("gtm", version) c.Args = os.Args[1:] c.Commands = map[string]cli.CommandFactory{ "init": command.New...
Create version variable to be set by ldflag
Create version variable to be set by ldflag
Go
mit
git-time-metric/gtm,git-time-metric/gtm
fabb67e807d9b3276c51370bdef2697c244e0b19
main.go
main.go
package main import ( "github.com/tinycedar/lily/core" "github.com/tinycedar/lily/gui" ) func main() { // go core.OpenRegistry() go core.FireHostsSwitch() gui.InitMainWindow() }
package main import ( "fmt" "io/ioutil" "os" "strconv" "github.com/tinycedar/lily/common" "github.com/tinycedar/lily/core" "github.com/tinycedar/lily/gui" ) func main() { Init() // go core.OpenRegistry() go core.FireHostsSwitch() gui.InitMainWindow() } func Init() { pidPath := os.TempDir() + "\\lily.pid...
Add pid file for single instance
misc: Add pid file for single instance
Go
mit
tinycedar/lily
d9ab6e7f5257fd596ae91ad0d83b9bec8b0c9dda
init.go
init.go
package main import ( "flag" ) func init() { flag.IntVar(&API_PORT, "port", 10777, "api port") flag.StringVar(&CONFIG_FILE, "conf", "./service.conf", "config file") flag.StringVar(&DATASTORE_DIR, "datastore", "./datastore/", "datastore dir") flag.Parse() }
package main import ( "flag" ) func init() { flag.StringVar(&API_SERVERPORT, "server", "127.0.0.1:10777", "api server port") flag.StringVar(&CONFIG_FILE, "conf", "./service.conf", "config file") flag.StringVar(&DATASTORE_DIR, "datastore", "./datastore/", "datastore dir") flag.Parse() }
Change api port to api server port
Change api port to api server port
Go
mit
DieterReuter/go-webservice
e6876d1cec554d2a7e9238725555d694b534eeee
cmd/wcloud/types.go
cmd/wcloud/types.go
package main import ( "time" ) // Deployment describes a deployment type Deployment struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` ImageName string `json:"image_name"` Version string `json:"version"` Priority int `json:"priority"` State string `json:"stat...
package main import ( "time" ) // Deployment describes a deployment type Deployment struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` ImageName string `json:"image_name"` Version string `json:"version"` Priority int `json:"priority"` State string `json:"stat...
Add template fields to wcloud config.
Add template fields to wcloud config.
Go
apache-2.0
alban/scope,kinvolk/scope,paulbellamy/scope,weaveworks/scope,kinvolk/scope,paulbellamy/scope,alban/scope,weaveworks/scope,kinvolk/scope,alban/scope,weaveworks/scope,paulbellamy/scope,alban/scope,kinvolk/scope,weaveworks/scope,paulbellamy/scope,alban/scope,paulbellamy/scope,kinvolk/scope,alban/scope,weaveworks/scope,wea...
eac0ab520e2f49ac76a92c3b3e072756008a077c
main.go
main.go
package main import ( "fmt" "math/rand" "os" "time" "github.com/erbridge/gotwit" "github.com/erbridge/gotwit/twitter" "github.com/erbridge/wikipaedian/wiki" ) func main() { var ( con twitter.ConsumerConfig acc twitter.AccessConfig ) f := "secrets.json" if _, err := os.Stat(f); err == nil { con, acc...
package main import ( "fmt" "math/rand" "os" "time" "github.com/erbridge/gotwit" "github.com/erbridge/gotwit/twitter" "github.com/erbridge/wikipaedian/wiki" ) func main() { var ( con twitter.ConsumerConfig acc twitter.AccessConfig ) f := "secrets.json" if _, err := os.Stat(f); err == nil { con, acc...
Stop the bot at the end
Stop the bot at the end
Go
mit
erbridge/wikipaedian
be0c92731d6a50b1187dfb7e33b88a6953f94fab
main.go
main.go
package main import ( "fmt" "io/ioutil" "os" "strconv" "github.com/yuya-takeyama/argf" ) var ( name = "ncat" 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 { fmt.Fprintln(os.Stderr, usage)...
package main import ( "fmt" "io/ioutil" "os" "strconv" "github.com/yuya-takeyama/argf" ) var ( name = "ncat" 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....
Print usage if first argument is "--help"
Print usage if first argument is "--help"
Go
mit
kusabashira/catn
f149cc47cd101af1524d46cdadf2e0614026b080
2021/go-postgresql/pq/main.go
2021/go-postgresql/pq/main.go
package main import ( "database/sql" "fmt" "log" _ "github.com/lib/pq" // To use the pgx driver, import this instead of pq. You'll also have to // change the driverName param of sql.Open from "postgres" to "pgx". //_ "github.com/jackc/pgx/v4/stdlib" ) func Check(err error) { if err != nil { log.Fatal(err) ...
package main import ( "database/sql" "fmt" "log" _ "github.com/lib/pq" // To use the pgx driver, import this instead of pq. You'll also have to // change the driverName param of sql.Open from "postgres" to "pgx". // There's no need to update db.go, since pq.Array will work just fine with // pgx (but it does i...
Update comment after trying pq.Array w/ pgx
Update comment after trying pq.Array w/ pgx
Go
unlicense
eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog
402d1a29be3c8ef4c801dc36f6a0a57a6cffd002
lxc/exec_windows.go
lxc/exec_windows.go
// +build windows package main import ( "github.com/gorilla/websocket" "golang.org/x/crypto/ssh/terminal" "github.com/lxc/lxd" ) func controlSocketHandler(c *lxd.Client, control *websocket.Conn) { // TODO: figure out what the equivalent of signal.SIGWINCH is on // windows and use that; for now if you resize yo...
// +build windows package main import ( "github.com/gorilla/websocket" "github.com/lxc/lxd" "github.com/lxc/lxd/shared" ) func controlSocketHandler(c *lxd.Client, control *websocket.Conn) { // TODO: figure out what the equivalent of signal.SIGWINCH is on // windows and use that; for now if you resize your term...
Fix few more Go warnings during build
Fix few more Go warnings during build Signed-off-by: anatoly techtonik <657222fa4408d5fb9c49497617f580f8c5974a3b@gmail.com>
Go
apache-2.0
ollie314/lxd,georghopp/lxd,Skarlso/lxd,mjeanson/lxd,Malizor/lxd,lxc/lxd,jsavikko/lxd,hallyn/lxd,pcdummy/lxd,dustinkirkland/lxd,Malizor/lxd,ollie314/lxd,techtonik/lxd,hallyn/lxd,techtonik/lxd,lxc/lxd,chrisglass/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,atxwebs/lxd,jsavikko/lxd,hallyn/lxd,akshaykarle/lxd,dustinkirkland/lxd,eri...
0e90d07bc3d2c83b1335389c0c7c8e0ea01c277f
model/service_test.go
model/service_test.go
package model import ( "testing" "github.com/stretchr/testify/assert" ) func TestGetOrCreateServiceShouldCreateService(t *testing.T) { service, err := GetOrCreateService(db, "lebron-james") assert.Nil(t, err) assert.NotNil(t, service) assert.Equal(t, "lebron-james", service.Name) var check Service db.Where(...
package model import ( "testing" "github.com/stretchr/testify/assert" ) func TestGetOrCreateServiceShouldCreateService(t *testing.T) { service, err := GetOrCreateService(db, "lebron-james") assert.Nil(t, err) assert.NotNil(t, service) assert.Equal(t, "lebron-james", service.Name) var check Service db.Where(...
Add test for no duplicate services
Add test for no duplicate services
Go
mit
hoop33/limo
d2830824ec84732330f30c5eac19e6062dd36ae6
command.go
command.go
package main import ( "github.com/sivel/overseer/config" "github.com/sivel/overseer/runner" ) func main() { monitors, notifiers := config.ParseConfig() run := runner.NewRunner(monitors, notifiers) run.Loop() }
package main import ( "runtime" "github.com/sivel/overseer/config" "github.com/sivel/overseer/runner" ) func init() { runtime.GOMAXPROCS(runtime.NumCPU()) } func main() { monitors, notifiers := config.ParseConfig() run := runner.NewRunner(monitors, notifiers) run.Loop() }
Increase gomaxprocs to number of CPUs
Increase gomaxprocs to number of CPUs
Go
apache-2.0
sivel/overseer
551e78378a102535fea924ec9a08b865e01aef20
server/http.go
server/http.go
package server import ( "flag" "github.com/zenazn/goji" "net/http" ) var ( defaults *config //decoder = schema.NewDecoder() ) func start(conf *config) { defaults = conf flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange register("/head/:size/:player", serveHeadWithSize) register("/head/:pl...
package server import ( "flag" "github.com/zenazn/goji" "net/http" ) var ( defaults *config //decoder = schema.NewDecoder() ) func start(conf *config) { defaults = conf flag.Set("bind", conf.Address) // Uh, I guess that's a bit strange register("/head/:player", serveHeadNormal) register("/head/:size/:play...
Revert "Swap route registration order to make it work again"
Revert "Swap route registration order to make it work again" This reverts parts of commit 72610622a12983165cddc8837f4eb431e3b1fb21. See zenazn/goji#75
Go
mit
LapisBlue/Lapitar,LapisBlue/Lapitar,LapisBlue/Lapitar
fbba21e532eea9f4d9faf9fbb3af3e91c74c6cdd
view/render.go
view/render.go
package view import ( "encoding/json" "io" "io/ioutil" "net/http" ) type Render struct { URL string Reader io.Reader } type Item struct { HTML string `json:"rendered_body"` Markdown string `json:"body"` Title string `json:"title"` URL string `json:"url"` } func NewRender(url string) *Render...
package view import ( "encoding/json" "io" "io/ioutil" "net/http" "os" ) type Render struct { URL string Reader io.Reader } type Item struct { HTML string `json:"rendered_body"` Markdown string `json:"body"` Title string `json:"title"` URL string `json:"url"` } func NewRender(url string) *...
Add write content that getting from API
Add write content that getting from API
Go
apache-2.0
wataru0225/sreq
1cc93860d474b40efd9217631116f498b6ee5103
gateway/requests/requests.go
gateway/requests/requests.go
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // Package requests package provides a client SDK or library for // the OpenFaaS gateway REST API package requests // AsyncReport is the report from a function e...
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // Package requests package provides a client SDK or library for // the OpenFaaS gateway REST API package requests // AsyncReport is the report from a function e...
Add Namespace to Secret type
Add Namespace to Secret type Signed-off-by: Jonatas Baldin <a7e06ed847507222ad0884f1885f6cbe6160d284@gmail.com>
Go
mit
alexellis/faas,alexellis/faas,rgee0/faas,rgee0/faas,rgee0/faas,rgee0/faas,openfaas/faas,alexellis/faas,rgee0/faas,rgee0/faas,rgee0/faas,alexellis/faas,rgee0/faas,alexellis/faas,alexellis/faas,rgee0/faas,alexellis/faas,rgee0/faas,openfaas/faas,alexellis/faas,openfaas/faas,alexellis/faas
c3fb79c44f6d45413075c1629ae94a7272a7f857
go/cmd/vtctldclient/plugin_grpcvtctlclient.go
go/cmd/vtctldclient/plugin_grpcvtctlclient.go
/* Copyright 2020 The Vitess 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, soft...
/* Copyright 2021 The Vitess 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, soft...
Correct copyright year and comment typo
Correct copyright year and comment typo Signed-off-by: Andrew Mason <8a240ff75aa1467ba5eba4db0c8200b61262547e@slack-corp.com>
Go
apache-2.0
mahak/vitess,tinyspeck/vitess,mahak/vitess,tinyspeck/vitess,tinyspeck/vitess,mahak/vitess,mahak/vitess,mahak/vitess,mahak/vitess,tinyspeck/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,tinyspeck/vitess,vitessio/vitess,tinyspeck/vitess,vi...
737fa28b62919fb295c38a409d40c0243a3b6478
algorithm/tsdfs/tsdfs_test.go
algorithm/tsdfs/tsdfs_test.go
// Output differs every time it runs. /* package tsdfs import ( "testing" "github.com/gyuho/goraph/graph/gs" ) func TestTSDFS(t *testing.T) { g6 := gs.FromJSON("../../files/testgraph.json", "testgraph.006") g6s := TSDFS(g6) g6c := "E → D → C → B → A → F" if g6s != g6c { t.Errorf("Should be same but\n%v\n%v",...
package tsdfs func main() {} // Output differs every time it runs. /* import ( "testing" "github.com/gyuho/goraph/graph/gs" ) func TestTSDFS(t *testing.T) { g6 := gs.FromJSON("../../files/testgraph.json", "testgraph.006") g6s := TSDFS(g6) g6c := "E → D → C → B → A → F" if g6s != g6c { t.Errorf("Should be sa...
Declare package so that "go get" this repo doesn't complain.
Declare package so that "go get" this repo doesn't complain. package github.com/gyuho/goraph/... imports github.com/gyuho/goraph/algorithm/tsdfs imports github.com/gyuho/goraph/algorithm/tsdfs: /usr/local/google/home/samschaevitz/gocode/src/github.com/gyuho/goraph/algorithm/tsdfs/tsdfs_test.go:26:4:...
Go
mit
gale320/goraph,gyuho/goraph,gyuho/goraph,hsavit1/goraph
ccbb9da9503e36853772d93202096157df119690
src/logbook_suite_test.go
src/logbook_suite_test.go
package main import ( "os" "testing" "github.com/boltdb/bolt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = BeforeSuite(func() { config = Config{} config.Database.Path = "test.sqlite" config.Database.LockTimeout = 1 config.Database.RetryDelay = 10 config.Database.MaxOpenConnections = 5 ...
package main import ( "os" "testing" "github.com/boltdb/bolt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = BeforeSuite(func() { config = Config{} config.Database.Path = "test.db" config.Log.Path = "test.log" config.Auth.User = "test" config.Auth.Password = "test" config.Pagination....
Remove legacy config firelds from tests
Remove legacy config firelds from tests
Go
mit
DarthSim/logbook,DarthSim/logbook,DarthSim/logbook
104740c9552270adc635b0447757204a17120b23
plugin/plugin_shim.go
plugin/plugin_shim.go
package plugin import "os" /** * This function is called by the plugin to setup their server. This allows us to call Run on the plugin * os.Args[1] port CF_CLI rpc server is running on * os.Args[2] **OPTIONAL** * SendMetadata - used to fetch the plugin metadata **/ func Start(cmd Plugin) { cliConnection := NewC...
package plugin import "os" /** * This function is called by the plugin to setup their server. This allows us to call Run on the plugin * os.Args[1] port CF_CLI rpc server is running on * os.Args[2] **OPTIONAL** * SendMetadata - used to fetch the plugin metadata **/ func Start(cmd Plugin) { cliConnection := NewC...
Remove move method off of other file's struct
refactor: Remove move method off of other file's struct Signed-off-by: Tyler Schultz <6b7a73f4f7cffc2a148becd12890940350ddfa95@pivotal.io>
Go
apache-2.0
18F/cli,xingzhou/cli,rastasheep/trash-can,cgvarela/cli,pishro-cc/cli,saravana76/cli,EngineerBetter/cli,zhang-hua/cli,carnell69/cli,xingzhou/cli,saravana76/cli,hyenaspots/cli,SrinivasChilveri/cli,mcintyred/cli,EngineerBetter/cli,TomG713/cli,carnell69/cli,zhang-hua/cli,mcowger/cli,ofer43211/cli,zhang-hua/cli,fujitsu-cf/c...
c14c37cbb8361fe1af576a72ef76bec2591e03f7
pkg/sh/run.go
pkg/sh/run.go
// Copyright 2018 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package sh import ( "log" "os" "os/exec" ) // Run runs a command with stdin, stdout and stderr. func Run(arg0 string, args ...string) error { cmd := ex...
// Copyright 2018 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package sh import ( "log" "os" "os/exec" ) // Run runs a command with stdin, stdout and stderr. func Run(arg0 string, args ...string) error { cmd := ex...
Add RunWithLogs function to sh
Add RunWithLogs function to sh Signed-off-by: Ryan O'Leary <32139beaa9c574695821e85473b09a4e33316467@google.com>
Go
bsd-3-clause
hugelgupf/u-root,u-root/u-root,u-root/u-root,hugelgupf/u-root,GanShun/u-root,GanShun/u-root,hugelgupf/u-root,hugelgupf/u-root,GanShun/u-root,u-root/u-root
16b353ce4ff8cab3447b428c6918554bc2917f5b
repository/portfolios.go
repository/portfolios.go
package repository import ( "github.com/mgierok/monujo/db" "github.com/mgierok/monujo/repository/entity" ) func PortfoliosExt() (entity.PortfoliosExt, error) { portfolios := entity.PortfoliosExt{} err := db.Connection().Select(&portfolios, "SELECT portfolio_id, name, currency, cache_value, gain_of_sold_shares, co...
package repository import ( "github.com/mgierok/monujo/db" "github.com/mgierok/monujo/repository/entity" ) func PortfoliosExt() (entity.PortfoliosExt, error) { portfolios := entity.PortfoliosExt{} err := db.Connection().Select(&portfolios, "SELECT portfolio_id, name, currency, cache_value, gain_of_sold_shares, co...
Order portfolio summary by ID
Order portfolio summary by ID
Go
apache-2.0
mgierok/monujo,mgierok/monujo
2de91e48627ccbe8b7c043f6bdfc438f0b8e4919
post-processor/vagrant-cloud/step_confirm_upload.go
post-processor/vagrant-cloud/step_confirm_upload.go
package vagrantcloud import ( "context" "fmt" "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" ) type stepConfirmUpload struct { } func (s *stepConfirmUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Ge...
package vagrantcloud import ( "context" "fmt" "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" ) type stepConfirmUpload struct { } func (s *stepConfirmUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Ge...
Check configuration before running callback for upload confirmation
Check configuration before running callback for upload confirmation
Go
mpl-2.0
rnaveiras/packer,hashicorp/packer,mitchellh/packer,mitchellh/packer,pecigonzalo/packer,mitchellh/packer,rnaveiras/packer,rnaveiras/packer,pecigonzalo/packer,mitchellh/packer,mitchellh/packer,hashicorp/packer,hashicorp/packer,rnaveiras/packer,rnaveiras/packer,pecigonzalo/packer,pecigonzalo/packer,rnaveiras/packer,hashic...
aae7d0beac11cc3f583d9ec194708c7957d53896
shell/init.go
shell/init.go
package shell import ( "fmt" "github.com/kardianos/osext" ) const template = `#!/usr/bin/env zsh ANTIBODY_BINARY="%s" antibody() { case "$1" in bundle|update) while read -u 3 bundle; do touch /tmp/antibody-log && chmod 777 /tmp/antibody-log source "$bundle" 2&> /tmp/antibody-log done 3< <( $ANTIBODY_BI...
package shell import ( "fmt" "github.com/kardianos/osext" ) const template = `#!/usr/bin/env zsh ANTIBODY_BINARY="%s" antibody() { case "$1" in bundle|update) tmp_dir=$(mktemp -d) while read -u 3 bundle; do source "$bundle" 2&> ${temp_dir}/antibody-log done 3< <( $ANTIBODY_BINARY $@ ) ;; *) $ANTIBO...
Save antibody-log at each time in temp directory
Save antibody-log at each time in temp directory
Go
mit
twang817/antibody,twang817/antibody,caarlos0/antibody,caarlos0/antibody,getantibody/antibody,getantibody/antibody
613a5801437faa2425de29bec0ca5ea91109cbc1
service/groupme/gmmessage.go
service/groupme/gmmessage.go
package groupme type gmMessage struct { GID string `json:"group_id"` Name string `json:"name"` MID string `json:"id"` UID string `json:"user_id"` MessageText string `json:"text"` SenderType string `json:"sender_type"` FavoritedBy []string `json:"favorited_by"` } func...
package groupme import "strings" type gmMessage struct { GID string `json:"group_id"` Name string `json:"name"` MID string `json:"id"` UID string `json:"user_id"` MessageText string `json:"text"` SenderType string `json:"sender_type"` FavoritedBy []string `json:"favo...
Fix webs use of non-breaking spaces
Fix webs use of non-breaking spaces
Go
mit
NelsonLeDuc/CalmanBot,NelsonLeDuc/CalmanBot
c47f41e3ae39061da76725981461d79a8c4109b2
open/exec_windows.go
open/exec_windows.go
// +build windows package open import ( "os/exec" ) func open(input string) *exec.Cmd { return exec.Command("start", "", input) } func openWith(input string, appName string) *exec.Cmd { return exec.Command("start", "", appName, input) }
// +build windows package open import ( "os/exec" ) func open(input string) *exec.Cmd { return exec.Command("cmd", "/C", "start", "", input) } func openWith(input string, appName string) *exec.Cmd { return exec.Command("cmd", "/C", "start", "", appName, input) }
Fix 'start' executable not found in %PATH%
Fix 'start' executable not found in %PATH%
Go
apache-2.0
ZhangKuixun/lantern,taohaoge/lantern,fangshili/lantern,ChenZeXian/lantern,taohaoge/lantern,xswm1123/lantern,Nuos/lantern,imcoddy/lantern,MinFu/lantern,whatts/lantern,Denniskevin/lantern,crazypoo/lantern,CJstar/lantern,imcoddy/lantern,willjunspecial/lantern,beealone/lantern,moooy/lantern,luinnx/lantern,zw532781787/lante...
2b3143dfbb318efa6e3789f039375f5f8320be56
skeleton/actions/create.go
skeleton/actions/create.go
package actions import ( "fmt" "github.com/bronzdoc/skeletor/template" "log" "os" ) func Create(template template.Template) { skeleton := template.Skeleton context := template.Context for i := range skeleton { for key, val := range skeleton[i] { if key == "dir" { data := val.(map[interface{}]interfac...
package actions import ( _ "fmt" "github.com/bronzdoc/skeletor/template" "io/ioutil" "log" "os" ) func Create(template template.Template) { skeleton := template.Skeleton context := template.Context for i := range skeleton { for key, val := range skeleton[i] { if key == "dir" { data := val.(map[inter...
Add template content to file
Add template content to file
Go
mit
bronzdoc/orbi
75af16f4b2c1e2f20ed6d215694311a9295ebc83
response_test.go
response_test.go
package whois import ( "fmt" "os" "testing" "github.com/domainr/whoistest" "github.com/nbio/st" ) func TestReadMIME(t *testing.T) { fns, err := whoistest.ResponseFiles() st.Assert(t, err, nil) for _, fn := range fns { fmt.Printf("%s\n", fn) res, err := readMIMEFile(fn) if res != nil && err != nil { ...
package whois import ( "os" "testing" "github.com/domainr/whoistest" "github.com/nbio/st" ) func TestReadMIME(t *testing.T) { fns, err := whoistest.ResponseFiles() st.Assert(t, err, nil) for _, fn := range fns { // fmt.Printf("%s\n", fn) res, err := readMIMEFile(fn) st.Refute(t, res, nil) st.Assert(t,...
Test for flaky/ornery whois.pir.org server
Test for flaky/ornery whois.pir.org server
Go
mit
domainr/whois
0d1ac2a416d4a9b3a0f86b527a0ae9488115e21b
activity/activity.go
activity/activity.go
package activity import ( "reflect" "time" "github.com/tolexo/aero/activity/model" "github.com/tolexo/aero/db/tmongo" mgo "gopkg.in/mgo.v2" ) const ( DB_CONTAINER = "database.omni" ) //Log User activity func LogActivity(url string, body interface{}, resp reflect.Value, respCode int, respTime float64) { apiD...
package activity import ( "time" "github.com/tolexo/aero/activity/model" "github.com/tolexo/aero/db/tmongo" mgo "gopkg.in/mgo.v2" ) const ( DB_CONTAINER = "database.omni" ) //Log User activity func LogActivity(url string, body interface{}, resp interface{}, respCode int, respTime float64) { apiDetail := mode...
Revert "Revert "PRA-410: resp changed to interface""
Revert "Revert "PRA-410: resp changed to interface"" This reverts commit d12fdf8244766409cf0afba7eab9eeb75e0f2708.
Go
mit
tolexo/aero
47a96bff1a1945da3f7f61895340e6841288361a
retrieval/discovery/marathon/constants.go
retrieval/discovery/marathon/constants.go
package marathon import ( clientmodel "github.com/prometheus/client_golang/model" ) const ( // metaLabelPrefix is the meta prefix used for all meta labels in this discovery. metaLabelPrefix = clientmodel.MetaLabelPrefix + "marathon_" // appLabelPrefix is the prefix for the application labels. appLabelPrefix = me...
package marathon import ( clientmodel "github.com/prometheus/client_golang/model" ) const ( // metaLabelPrefix is the meta prefix used for all meta labels in this discovery. metaLabelPrefix = clientmodel.MetaLabelPrefix + "marathon_" // appLabelPrefix is the prefix for the application labels. appLabelPrefix = me...
Update constant names in comments.
Update constant names in comments.
Go
apache-2.0
Gouthamve/prometheus,wrouesnel/prometheus,dmilstein/prometheus,laushinka/prometheus,jbdalido/prometheus,sudhi-vm/prometheus,trigrass2/prometheus,eliothedeman/prometheus,trigrass2/prometheus,dsymonds/prometheus,eliothedeman/prometheus,keegancsmith/prometheus,jbdalido/prometheus,iksaif/prometheus,laushinka/prometheus,gcn...
a8b1f21516f08638a7abc6f1f27d87275740bad9
backend/main.go
backend/main.go
package main import ( "flag" "net" "net/http" "net/http/fcgi" "os" "syscall" ) var prefix = flag.String("prefix", "", "The prefix to use to identify this installation.") var socket = flag.String("socket", "/tmp/eimbu.socket", "The fcgi socket to listen on.") func main() { if !flag.Parsed() { flag.Parse()...
package main import ( "flag" "net/http" ) var prefix = flag.String("prefix", "", "The prefix to use to identify this installation.") func main() { if !flag.Parsed() { flag.Parse() } var regexHandler = NewHttpHandlerRegexMatcher() http.Handle("/", http.StripPrefix(*prefix, regexHandler)) regexHandler.Hand...
Move back to using an http server for the application.
Move back to using an http server for the application. Due to using websockets, fastcgi is no longer an option. Instead move back to using a full HTTP server. Nginx can be used to proxy requests as needed, if a frontend web server is necessary.
Go
agpl-3.0
MJDSys/eimbu,MJDSys/eimbu,MJDSys/eimbu,MJDSys/eimbu
5d73d9bbce416c46c6d9ebdf8491e2f0e69c2236
testtest/main_test.go
testtest/main_test.go
package main import ( "testing" "fmt" ) type squareTest struct { in, out int } var squareTests = []squareTest{ squareTest{1, 1}, squareTest{2, 4}, squareTest{5, 25}, squareTest{-2, 4}, } // テスト. func TestSqure( t *testing.T) { for _, st := range squareTests { v := Square(st.in) if v != st.out { t.Err...
package main import ( "testing" "fmt" ) type squareTest struct { in, out int } var squareTests = []squareTest{ squareTest{1, 1}, squareTest{2, 4}, squareTest{5, 25}, squareTest{-2, 4}, } // テスト. func TestSqure( t *testing.T) { for _, st := range squareTests { v := Square(st.in) if v != st.out { t.Err...
Add a sample code for execution in terminal.
Add a sample code for execution in terminal.
Go
mit
yoheiMune/MyGoProject,yoheiMune/MyGoProject
eab36ad8a39cbe0d33484f40a43d1553661ebd9a
writer.go
writer.go
package logger import ( "io" "os" ) type ioWriterMsgWriter struct { w io.Writer } func (iw *ioWriterMsgWriter) Write(msg Msg) error { bytes := append(msg.Bytes(), '\n') n, err := iw.w.Write(bytes) if err != nil { return err } else if n != len(bytes) { return io.ErrShortWrite } return err } func (iw *io...
package logger import ( "io" "os" ) type ioWriterMsgWriter struct { w io.Writer } func (iw *ioWriterMsgWriter) Write(msg Msg) error { bytes := append(msg.Bytes(), '\n') n, err := iw.w.Write(bytes) if err != nil { return err } else if n != len(bytes) { return io.ErrShortWrite } return nil } func (iw *io...
Return nil on none error
Return nil on none error Instead of err with a value of nil. Now it's easier to spot that everything went ok.
Go
mit
Thomasdezeeuw/logger
de36d391b98c4d26b55c860a0f6dd613786dd42e
src/goat/manager.go
src/goat/manager.go
package goat import ( "fmt" ) func Manager(killChan chan bool, doneChan chan int) { for { select { case <-killChan: //change this to kill workers gracefully and exit fmt.Println("done") doneChan <- 0 // case freeWorker := <-ioReturn: } } }
package goat import ( "fmt" ) func Manager(killChan chan bool, doneChan chan int, port string) { go new(HttpListener).Listen(port) for { select { case <-killChan: //change this to kill workers gracefully and exit fmt.Println("done") doneChan <- 0 // case freeWorker := <-ioReturn: } } }
Add port to Manager, spawn HttpListener
Add port to Manager, spawn HttpListener
Go
mit
mdlayher/goat
894647bf674492b7f0ece5bc6db0c63f275d5661
pkg/auth/dependency/provider/password/tx_provider.go
pkg/auth/dependency/provider/password/tx_provider.go
package password import ( "github.com/sirupsen/logrus" "github.com/skygeario/skygear-server/pkg/core/db" ) type safeProviderImpl struct { impl *providerImpl txContext db.SafeTxContext } func NewSafeProvider( builder db.SQLBuilder, executor db.SQLExecutor, logger *logrus.Entry, txContext db.SafeTxContext...
package password import ( "github.com/sirupsen/logrus" "github.com/skygeario/skygear-server/pkg/core/db" ) type safeProviderImpl struct { impl *providerImpl txContext db.SafeTxContext } func NewSafeProvider( builder db.SQLBuilder, executor db.SQLExecutor, logger *logrus.Entry, txContext db.SafeTxContext...
Fix missed safe provider calling impl method
Fix missed safe provider calling impl method
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
126c1c304a728016bd85301913d6b1c0a69a04a9
myaws/sts_id.go
myaws/sts_id.go
package myaws import ( "fmt" "github.com/aws/aws-sdk-go/service/sts" "github.com/pkg/errors" ) // STSID gets caller identity. func (client *Client) STSID() error { response, err := client.STS.GetCallerIdentity(&sts.GetCallerIdentityInput{}) if err != nil { return errors.Wrap(err, "GetCallerIdentity failed:") ...
package myaws import ( "fmt" "github.com/aws/aws-sdk-go/service/sts" "github.com/pkg/errors" ) // STSID gets caller identity. func (client *Client) STSID() error { response, err := client.STS.GetCallerIdentity(&sts.GetCallerIdentityInput{}) if err != nil { return errors.Wrap(err, "GetCallerIdentity failed:") ...
Remove a new line from formatSTSID()
Remove a new line from formatSTSID()
Go
mit
minamijoyo/myaws
5034d6a7d3f9ff718d5fe94dbdf538d60922c12f
object/types.go
object/types.go
package object type Type string const ( /* Internal Types */ RETURN_VALUE Type = "<return value>" FUNCTION Type = "<function>" NEXT Type = "<next>" BREAK Type = "<break>" /* Special Types */ COLLECTION Type = "<collection>" CONTAINER Type = "<container>" HASHER Type = "<hasher>" ANY...
package object type Type = string const ( /* Internal Types */ RETURN_VALUE = "<return value>" FUNCTION = "<function>" NEXT = "<next>" BREAK = "<break>" /* Special Types */ COLLECTION = "<collection>" CONTAINER = "<container>" HASHER = "<hasher>" ANY = "<any>" /* Normal Typ...
Make object.Type a type alias
Make object.Type a type alias
Go
mit
pluto-language/pluto
78588323dbb12a4769e42e65e8fd6334c5c5a4a6
lrp_convergence_gather_test.go
lrp_convergence_gather_test.go
package benchmark_bbs_test import ( "github.com/cloudfoundry-incubator/bbs/db/etcd" "github.com/cloudfoundry-incubator/benchmark-bbs/reporter" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) const ( ConvergenceGathering = "ConvergenceGathering" ) var BenchmarkConvergenceGathering = func(numTrials int) {...
package benchmark_bbs_test import ( "github.com/cloudfoundry-incubator/bbs/db/etcd" "github.com/cloudfoundry-incubator/benchmark-bbs/reporter" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) const ( ConvergenceGathering = "ConvergenceGathering" ) var BenchmarkConvergenceGathering = func(numTrials int) {...
Use new lrp convergence method
Use new lrp convergence method * GatherDesiredLRPs -> GatherAndPruneDesiredLRPs Signed-off-by: James Myers <44cbd4b2784f900a6fede6279d0b7fdcbfaa89f5@pivotal.io>
Go
apache-2.0
cloudfoundry-incubator/benchmark-bbs
7d756ebd4faa0d587479eba38d34a9c86a27f169
Go/go_radix_performance.go
Go/go_radix_performance.go
package main import ( "fmt" "github.com/fzzy/radix/redis" "strconv" "time" ) const N = 1000000 func main() { c, err := redis.DialTimeout("tcp", "127.0.0.1:6379", time.Duration(10)*time.Second) if err != nil { panic(fmt.Sprintln("error:", err)) } defer c.Close() for i := 0; i < N; i++ { c.Append("set", ...
package main import ( "fmt" "github.com/fzzy/radix/redis" "time" ) const N = 1000000 func main() { c, err := redis.DialTimeout("tcp", "127.0.0.1:6379", time.Duration(10)*time.Second) if err != nil { panic(fmt.Sprintln("error:", err)) } defer c.Close() for i := 0; i < N; i++ { c.Append("set", "foo", "bar...
Remove dead import from Go source
Remove dead import from Go source
Go
apache-2.0
stefanwille/redis-client-benchmarks,stefanwille/redis-client-benchmarks,stefanwille/redis-client-benchmarks,stefanwille/redis-client-benchmarks,stefanwille/redis-client-benchmarks
348c12192961d4ee36303b2d0db61ff98a4734a4
src/libFileSwarm/state.go
src/libFileSwarm/state.go
package libFileSwarm import ( "libGFC" "libytc" ) type State struct { swarmtracker libGFC.GFCChain swarmid string hostcount uint64 hostredundancy uint64 totalspace uint64 piecemapping map[string][]string previousblocks []*Block currentblock *Block } type Block struct { blockNumber uin...
package libFileSwarm import ( "libGFC" "libytc" ) type State struct { swarmtracker libGFC.GFCChain swarmid string hostcount uint64 hostredundancy uint64 totalspace uint64 piecemapping map[string][]string previousblocks []*Block currentblock *Block } type Block struct { BlockNumber uin...
Update Block Definition to have transactions
FileSwarm: Update Block Definition to have transactions
Go
apache-2.0
Jonbeek/bytecoin
69aedd709be7de4b43e32d84b526bca92d5cb0b2
util/channel_util_test.go
util/channel_util_test.go
package util import ( "reflect" "testing" ) func doubleIt(v reflect.Value) reflect.Value { return reflect.ValueOf(v.Int() * 2) } func TestMergeChannel(t *testing.T) { chan1 := make(chan reflect.Value) chan2 := make(chan reflect.Value) go func() { chan1 <- reflect.ValueOf(1) close(chan1) }() go func() {...
package util import ( "reflect" "sort" "testing" ) func doubleIt(v reflect.Value) reflect.Value { return reflect.ValueOf(v.Int() * 2) } func TestMergeChannel(t *testing.T) { chan1 := make(chan reflect.Value) chan2 := make(chan reflect.Value) go func() { chan1 <- reflect.ValueOf(1) close(chan1) }() go ...
Sort the result list to eliminate test flakiness.
Sort the result list to eliminate test flakiness.
Go
apache-2.0
justicezyx/glow,chrislusf/glow,chrislusf/glow,justicezyx/glow
519a78936c598ccb445c7205a2889aaec7f34657
example/main.go
example/main.go
package main import ( "github.com/CaliDog/certstream-go" logging "github.com/op/go-logging" ) var log = logging.MustGetLogger("example") func main() { stream := certstream.CertStreamEventStream(false) for jq := range stream { message_type, err := jq.String("message_type") if err != nil { log.Fatalf("Er...
package main import ( "github.com/CaliDog/certstream-go" logging "github.com/op/go-logging" ) var log = logging.MustGetLogger("example") func main() { stream := certstream.CertStreamEventStream(false) for jq := range stream { message_type, err := jq.String("message_type") if err != nil { log.Fatalf("Er...
Add formatting prefix in example.
Add formatting prefix in example.
Go
mit
CaliDog/certstream-go
43996c7589f17c020526c4a07cb1913580736aad
cli/cli_test.go
cli/cli_test.go
package cli import ( "testing" "github.com/libopenstorage/openstorage/api" "github.com/stretchr/testify/require" ) func TestCmdMarshalProto(t *testing.T) { volumeSpec := &api.VolumeSpec{ Size: 64, Format: api.FSType_FS_TYPE_EXT4, } data := cmdMarshalProto(volumeSpec, false) require.Equal( t, `{ "ep...
package cli import ( "testing" "github.com/libopenstorage/openstorage/api" "github.com/stretchr/testify/require" ) func TestCmdMarshalProto(t *testing.T) { volumeSpec := &api.VolumeSpec{ Size: 64, Format: api.FSType_FS_TYPE_EXT4, } data := cmdMarshalProto(volumeSpec, false) require.Equal( t, `{ "ep...
Add io_profile in cli test
Add io_profile in cli test
Go
apache-2.0
pault84/openstorage,libopenstorage/openstorage,pault84/openstorage,libopenstorage/openstorage,pault84/openstorage,libopenstorage/openstorage
42fb45fefb1a055b29a684fb30515e4d87822cbd
bin/mint-server-https/main.go
bin/mint-server-https/main.go
package main import ( "flag" "fmt" "log" "net/http" "github.com/bifurcation/mint" ) var port string func main() { var config mint.Config config.Init(false) flag.StringVar(&port, "port", "4430", "port") flag.Parse() service := "0.0.0.0:" + port listener, err := mint.Listen("tcp", service, &config) if ...
package main import ( "flag" "fmt" "log" "net/http" "github.com/bifurcation/mint" ) var port string func main() { config := mint.Config{ SendSessionTickets: true, } config.Init(false) flag.StringVar(&port, "port", "4430", "port") flag.Parse() service := "0.0.0.0:" + port listener, err := mint.Liste...
Enable tickets on test server
Enable tickets on test server
Go
mit
bifurcation/mint,yaronf/mint
bf893288b0e5a007b2d9abcd25695eedf11a4d74
cmd/table/main.go
cmd/table/main.go
// Chef client command-line tool. package main import ( "flag" "fmt" "os" "github.com/marpaia/chef-golang" "github.com/shurcooL/go-goon" ) var _ = goon.Dump func chefConnect() *chef.Chef { c, err := chef.Connect() if err != nil { panic(err) } c.SSLNoVerify = true return c } func main() { flag.Parse() ...
// Chef client command-line tool. package main import ( "flag" "fmt" "os" "github.com/marpaia/chef-golang" "github.com/shurcooL/go-goon" ) var _ = goon.Dump func chefConnect() *chef.Chef { c, err := chef.Connect() if err != nil { panic(err) } c.SSLNoVerify = true return c } func main() { flag.Parse() ...
Change interface to search nodes by role.
cmd/table: Change interface to search nodes by role.
Go
mit
shurcooL/go
2ecb93652c275b571cb6d5b620f921aa12abd12c
index/index.go
index/index.go
package index import ( "fmt" "os" "io/ioutil" "text/template" "pkg.re/essentialkaos/ek.v9/fsutil" "github.com/gongled/vgrepo/storage" ) // ////////////////////////////////////////////////////////////////////////////////// // func ExportIndex(index *storage.VStorage, templateFile string, outputFile string) er...
package index import ( "fmt" "os" "io/ioutil" "text/template" "pkg.re/essentialkaos/ek.v9/fsutil" "github.com/gongled/vgrepo/storage" ) // ////////////////////////////////////////////////////////////////////////////////// // func ExportIndex(index *storage.VStorage, templateFile string, outputFile string) er...
Move existance checking before trying to open the output file.
Move existance checking before trying to open the output file.
Go
mit
gongled/vgrepo,gongled/vgrepo
ce572432f91d48f35559925bfa4a15f8dbbce30a
object/types.go
object/types.go
package object type Type string const ( /* Internal Types */ RETURN_VALUE Type = "<return value>" FUNCTION Type = "<function>" NEXT Type = "<next>" BREAK Type = "<break>" APL_BLOCK Type = "<applied block>" /* Special Types */ COLLECTION Type = "<collection>" CONTAINER Type = "<contain...
package object type Type string const ( /* Internal Types */ RETURN_VALUE Type = "<return value>" FUNCTION Type = "<function>" NEXT Type = "<next>" BREAK Type = "<break>" APL_BLOCK Type = "<applied block>" /* Special Types */ COLLECTION Type = "<collection>" CONTAINER Type = "<contain...
Add an 'ANY' object type
Add an 'ANY' object type
Go
mit
pluto-language/pluto
5e59cb93932eeb6b3f725e721d34c596192f7e62
tsdb/engine/pd1/encoding_test.go
tsdb/engine/pd1/encoding_test.go
package pd1_test import ( // "math/rand" // "reflect" "testing" "time" // "github.com/influxdb/influxdb/tsdb/engine/pd1" ) func TestEncoding_FloatBlock(t *testing.T) { // valueCount := 100 // times := getTimes(valueCount, 60, time.Second) // values := make([]Value, len(times)) // for i, t := range times { ...
package pd1_test import ( // "math/rand" "fmt" "reflect" "testing" "time" "github.com/influxdb/influxdb/tsdb/engine/pd1" ) func TestEncoding_FloatBlock(t *testing.T) { valueCount := 1000 times := getTimes(valueCount, 60, time.Second) values := make(pd1.Values, len(times)) for i, t := range times { values...
Update encoding test to work with new interface.
Update encoding test to work with new interface.
Go
mit
Mindera/influxdb,mre/influxdb,jipperinbham/influxdb,lgpeterson/influxdb,nickrobinson/influxdb,CVTJNII/influxdb-tjnii,jipperinbham/influxdb,linearb/influxdb,Mindera/influxdb,Mindera/influxdb,joaopedrotaveira/influxdb,sudabon/influxdb,benbjohnson/influxdb,bluebreezecf/influxdb,mark-rushakoff/influxdb,apigee/influxdb,blue...
00210a807cfa206331a231a1d52f57df2622fca1
core/fsManager.go
core/fsManager.go
package core import ( "log" "github.com/mdlayher/wavepipe/core/models" "github.com/wtolson/go-taglib" ) // fsManager scans for media files in a specified path, and queues them up for inclusion // in the wavepipe database func fsManager(killFSChan chan struct{}) { log.Println("fs: starting...") // For now, thi...
package core import ( "log" "os" "path" "path/filepath" "github.com/mdlayher/wavepipe/core/models" "github.com/mdlayher/goset" "github.com/wtolson/go-taglib" ) // validSet is a set of valid file extensions which we should scan as media var validSet = set.New(".flac", ".mp3") // fsManager scans for media fil...
Add basic filepath walk, recursive media scan
Add basic filepath walk, recursive media scan
Go
mit
mdlayher/wavepipe,mdlayher/wavepipe
fd0ba3a3f5926f6ee31220ce15c2966cd2cf682a
client/reply_test.go
client/reply_test.go
package client import ( "bytes" "testing" ) func TestBytes(t *testing.T) { r := client.Cmd("get", "k").Bytes() if !bytes.Equal(r, []byte("v")) { t.Logf("expect bytes [% #x], but get[ % #x]\n", []byte("v"), r) t.Fail() } } func TestString(t *testing.T) { r := client.Cmd("get", "k").String() if r != "v" {...
package client import ( "bytes" "testing" ) func TestBytes(t *testing.T) { r := client.Cmd("get", "k").Bytes() if !bytes.Equal(r, []byte("v")) { t.Logf("expect bytes [% #x], but get[ % #x]\n", []byte("v"), r) t.Fail() } } func TestString(t *testing.T) { r := client.Cmd("get", "k").String() if r != "v" {...
Test case for Int method of reply.
Test case for Int method of reply.
Go
mit
kofj/redlot
6a21a30d8cf5853e0634b929c21037c526dc4e41
models/user.go
models/user.go
package models import ( "fmt" "github.com/wantedly/developers-account-mapper/services" ) // User stores login user name and accounts information type User struct { LoginName string GitHubUsername string SlackUsername string SlackUserId string } // NewUser creates new User instance func NewUser(loginN...
package models import ( "fmt" "github.com/wantedly/developers-account-mapper/services" ) // User stores login user name and accounts information type User struct { LoginName string GitHubUsername string SlackUsername string SlackUserId string } // NewUser creates new User instance func NewUser(loginN...
Use empty string instead of nil
Use empty string instead of nil
Go
mit
wantedly/developers-account-mapper
1be5cec1838d1b2117433b13e9cb81c811f57a57
tool/teleport/common/usage.go
tool/teleport/common/usage.go
package common const ( usageNotes = `Notes: --roles=node,proxy,auth This flag tells Teleport which services to run. By default it runs all three. In a production environment you may want to separate them. --token=xyz This token is needed to connect a node to an auth server. Obtain it by running "tctl...
package common const ( usageNotes = `Notes: --roles=node,proxy,auth This flag tells Teleport which services to run. By default it runs all three. In a production environment you may want to separate them. --token=xyz This token is needed to connect a node to an auth server. Obtain it by running "tctl...
Update sample config file header
Update sample config file header
Go
apache-2.0
gravitational/teleport,gravitational/teleport,gravitational/teleport,gravitational/teleport,gravitational/teleport,gravitational/teleport
2cc5280564526fe6f1c9731f470c620c83976d29
api/util_test.go
api/util_test.go
package api import ( "launchpad.net/gocheck" "time" "os" ) func (s *S) TestMountDirectoryFromTime(c *gocheck.C){ time := time.Date(2009,time.November,15,21,40,03,0, time.Local) var ret = mountDirectoryPathFromTime(time) c.Assert(ret, gocheck.Equals, "2009/11/15/21/40/") } func (s *S) TestCrea...
package api import ( "launchpad.net/gocheck" "time" "os" ) func (s *S) TestMountDirectoryFromTime(c *gocheck.C){ time := time.Date(2009,time.November,15,21,40,03,0, time.Local) var ret = mountDirectoryPathFromTime(time) c.Assert(ret, gocheck.Equals, "2009/11/15/21/40/") } func (s *S) TestCrea...
Remove Assert for perm of dir.
Remove Assert for perm of dir.
Go
mit
aoqfonseca/mediaRepository
96d8a71dac320477b520f26709ed9d9d0fe8fff0
src/swarm/heartbeat.go
src/swarm/heartbeat.go
package swarm import ( "common" "encoding/json" ) type Heartbeat struct { Id string Blockchain string Host string ParentBlock string EntropyStage1 string EntropyStage2 string FileProofStage1 string FileProofStage2 string } func NewHeartbeat(prevState *Block, Host, Stage1, Stage2 string) (h *H...
package swarm import ( "common" "encoding/json" ) type Heartbeat struct { Id string Blockchain string Host string ParentBlock string EntropyStage1 string EntropyStage2 string FileProofStage1 string FileProofStage2 string } func NewHeartbeat(prevState *Block, Host, Stage1, Stage2 string) (h *H...
Revert removal of host information in Heartbeat.
Revert removal of host information in Heartbeat. Effectively, the host for all heartbeats was the empty string. There is a strong possibility this caused errors when initializing a blockchain.
Go
apache-2.0
emt13/Sia,emt13/Sia,Jonbeek/Sia,Jonbeek/Sia
7e5bd6ebe32743afd64b80ef26c5af7f5ae6b350
compilerutil/immutablemap.go
compilerutil/immutablemap.go
// Copyright 2017 The Serulian 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 compilerutil // ImmutableMap defines an immutable map struct, where Set-ing a new key returns a new ImmutableMap. type ImmutableMap interface { ...
// Copyright 2017 The Serulian 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 compilerutil // ImmutableMap defines an immutable map struct, where Set-ing a new key returns a new ImmutableMap. type ImmutableMap interface { ...
Make sure to specify the length of the map before copy to avoid new allocations
Make sure to specify the length of the map before copy to avoid new allocations
Go
bsd-3-clause
Serulian/compiler,Serulian/compiler
1fb1394e83bb05775e26440ae7b5d51dc4241a32
server/login.go
server/login.go
package server import ( "errors" "net/http" "github.com/flosch/pongo2" "github.com/nathan-osman/informas/db" ) // login presents the login form. func (s *Server) login(w http.ResponseWriter, r *http.Request) { var ( username string password string ) if r.Method == http.MethodPost { err := db.Transaction...
package server import ( "errors" "net/http" "github.com/flosch/pongo2" "github.com/nathan-osman/informas/db" ) // login presents the login form. func (s *Server) login(w http.ResponseWriter, r *http.Request) { var ( username string password string ) if r.Method == http.MethodPost { err := db.Transaction...
Add check for disabled accounts.
Add check for disabled accounts.
Go
mit
nathan-osman/informas,nathan-osman/informas
c0fbe6e233c2bf9cc76012a01deef9885a514879
generator/generator.go
generator/generator.go
/** * Copyright 2014 Paul Querna * * 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 agr...
/** * Copyright 2014 Paul Querna * * 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 agr...
Remove this os.Remove, it is handled inside inceptionmain now.
Remove this os.Remove, it is handled inside inceptionmain now.
Go
apache-2.0
trigrass2/ffjson,cw2018/ffjson,xladykiller/ffjson,cmeon/ffjson,pquerna/ffjson,sunminghong/ffjson,cmeon/ffjson,trigrass2/ffjson,xyliuke/ffjson,xyliuke/ffjson,jamesliu96/ffjson,xiuzhifu/ffjson,pquerna/ffjson,xladykiller/ffjson,cw2018/ffjson,jamesliu96/ffjson,sunminghong/ffjson,xiuzhifu/ffjson
efe7102432f3d147f5d34528682c32b2814e4222
runtime_test.go
runtime_test.go
package notify import "testing" func TestRuntime(t *testing.T) { t.Skip("TODO(rjeczalik)") }
package notify import ( "reflect" "testing" ) func TestRuntime(t *testing.T) { spy, c, cas := &Spy{}, make(chan EventInfo, 1), fixture.Cases(t) r, p := newRuntime(spy), cas.path("github.com/rjeczalik/fakerpc") calls := &Spy{ {T: TypeFanin}, {T: TypeWatch, P: p, E: Delete}, } if err := r.Watch(p, c, Delete)...
Add stub for Runtime test
Add stub for Runtime test
Go
mit
Fiery/notify,rjeczalik/notify,pblaszczyk/notify,Zillode/notify
16e08047861d8a350ae4588a9b370c0d688d47d8
example/main.go
example/main.go
//+build ignore // Simple example that will nuke the contents of a s3 bucket package main import ( "fmt" "runtime" "s3" ) func init() { // multicorebitches runtime.GOMAXPROCS(runtime.NumCPU()) } func printKey(kb s3.KeyBucket) { fmt.Println(kb.Key.Key) } func main() { c := s3.Connection{} err := c.Connect() ...
//+build ignore // Simple example that will nuke the contents of a s3 bucket package main import ( "fmt" "runtime" s3 "s3Manager" ) func init() { // multicorebitches runtime.GOMAXPROCS(runtime.NumCPU()) } func printKey(kb s3.KeyBucket) { fmt.Println(kb.Key.Key) return } func main() { c := s3.Connection{} e...
Comment out uselless stuff, update pkg name.
Comment out uselless stuff, update pkg name.
Go
mit
giulioungaretti/S3
227dac8b50c8817e3a85497e76ad405d5e453d5a
src/hakim/hakim.go
src/hakim/hakim.go
package main import ( "checks" "flag" "log" "github.com/mitchellh/go-ps" ) var ( gardenAddr = flag.String("gardenAddr", "localhost:9241", "Garden host and port (typically localhost:9241)") requiredProcesses = []string{"consul.exe", "containerizer.exe", "garden-windows.exe", "rep.exe", "metron.exe"} bbs...
package main import ( "checks" "flag" "log" "github.com/mitchellh/go-ps" ) var ( gardenAddr = flag.String("gardenAddr", "localhost:9241", "Garden host and port (typically localhost:9241)") requiredProcesses = []string{"consul.exe", "containerizer.exe", "garden-windows.exe", "rep.exe", "metron.exe"} bbs...
Print out all the failing things
Print out all the failing things Instead of just running one check, run them all. Signed-off-by: Anthony Emengo <7b3c5a7825e2f856203b8d882230abcb78036abf@pivotal.io>
Go
apache-2.0
cloudfoundry-incubator/hakim
55fac398421a61cafa751ed030e95f4e8c210844
config/config.go
config/config.go
package config import ( "github.com/elastic/beats/libbeat/outputs" "time" ) // Defaults for config variables which are not set const ( DefaultCron string = "@every 1m" DefaultTimeout time.Duration = 60 * time.Second DefaultDocumentType string = "httpbeat" ) type HttpbeatConfig struct ...
package config import ( "github.com/elastic/beats/libbeat/outputs" "time" ) // Defaults for config variables which are not set const ( DefaultCron string = "@every 1m" DefaultTimeout time.Duration = 60 * time.Second DefaultDocumentType string = "httpbeat" ) /* Configuration for Httpb...
Upgrade to Beats v5.0.0-beta1 - Added comments
Upgrade to Beats v5.0.0-beta1 - Added comments
Go
apache-2.0
christiangalsterer/httpbeat
3080d9b0278d5b191b2bfc992b8593422ae03575
cmd/etcfs.go
cmd/etcfs.go
package main import ( "log" "bazil.org/fuse" "bazil.org/fuse/fs" "github.com/a2sdl/etcfs" ) func main() { mountpoint := "/tmp/nginx" conn, err := fuse.Mount( mountpoint, fuse.FSName("etcfs"), fuse.Subtype("etcfs"), fuse.LocalVolume(), fuse.VolumeName("etcfs"), ) if err != nil { log.Fatal(err) } ...
package main import ( "log" "bazil.org/fuse" "bazil.org/fuse/fs" "github.com/a2sdl/etcfs" ) func main() { mountpoint := "/Users/gtarcea/fuse/nginx" conn, err := fuse.Mount( mountpoint, fuse.FSName("etcfs"), fuse.Subtype("etcfs"), fuse.LocalVolume(), fuse.VolumeName("etcfs"), ) if err != nil { log...
Change hard coded mount point.
Change hard coded mount point.
Go
apache-2.0
a2sdl/etcfs
e4fac5a7d2cbde27f56b1ca9af616cf8f4dbe841
pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
/* Copyright 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, softw...
/* Copyright 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, softw...
Fix golint errors when generating informer code
Fix golint errors when generating informer code Kubernetes-commit: acf78cd6133de6faea9221d8c53b02ca6009b0bb
Go
apache-2.0
kubernetes/csi-api,kubernetes/csi-api
890f0379bb7f8d1009d1fc03ca79f2366f7a0bd2
functional/signing_test.go
functional/signing_test.go
package functional import ( "testing" "github.com/coreos/fleet/functional/platform" ) func TestSignedRequests(t *testing.T) { cluster, err := platform.NewNspawnCluster("smoke") if err != nil { t.Fatal(err) } defer cluster.DestroyAll() cfg := platform.MachineConfig{VerifyUnits: true} if err := cluster.Crea...
package functional import ( "testing" "github.com/coreos/fleet/functional/platform" ) func TestSignedRequests(t *testing.T) { cluster, err := platform.NewNspawnCluster("smoke") if err != nil { t.Fatal(err) } defer cluster.DestroyAll() cfg := platform.MachineConfig{VerifyUnits: true} if err := cluster.Crea...
Add comment to signature test
test(functional): Add comment to signature test
Go
apache-2.0
giantswarm/fleet,dongsupark/fleet,hhoover/fleet,octoblu/fleet,coreos/fleet,wuqixuan/fleet,mischief/fleet,wuqixuan/fleet,coreos/fleet,endocode/fleet,thepwagner/fleet,giantswarm/fleet,WPMedia/fleet,WPMedia/fleet,mwitkow-io/fleet,improbable-io/fleet,improbable-io/fleet,mookjp/fleet,mwhooker/fleet,webwlsong/fleet,thepwagne...
d77af4ce1538f9da5e51e3ecb15a24bbe90358e5
git-checkout-store/main.go
git-checkout-store/main.go
package main import ( "bytes" "fmt" "github.com/teddywing/git-checkout-history/utils" "os" "os/exec" ) func main() { args := os.Args[1:] if len(args) > 0 { utils.Store(args[0]) cmd := exec.Command("git", "checkout", args[0]) var out bytes.Buffer cmd.Stderr = &out err := cmd.Run() if err != nil...
package main import ( "bytes" "fmt" "github.com/teddywing/git-checkout-history/utils" "os" "os/exec" ) func main() { args := os.Args[1:] if len(args) > 0 { utils.Store(args[0]) cmd := exec.Command("git", "checkout", args[0]) var out bytes.Buffer cmd.Stderr = &out err := cmd.Run() if err != nil...
Use Print instead of Println for cmd output
git-checkout-store: Use Print instead of Println for cmd output Since we're just outputting the output of `git-checkout`, there's already a newline at the end. We don't want to output an extra one, so just send the `git-checkout` output to the screen verbatim.
Go
mit
teddywing/git-checkout-history
fd03996764fd8e51e4954110c023ae95bf7c3b4a
examples/line/line-main.go
examples/line/line-main.go
package main import ( "../../../drawer" "fmt" "image" "image/color" "image/png" "os" ) func main() { src := image.NewRGBA(image.Rect(0, 0, 100, 100)) drawer.Fill(src, color.RGBA{0, 255, 255, 255}) start := image.Pt(100, 100) end := image.Pt(0, 0) ld := drawer.NewLineDrawer(src, start, end, color.RGBA{255,...
package main import ( "../../../drawer" "fmt" "image" "image/color" "image/png" "os" ) func main() { src := image.NewRGBA(image.Rect(0, 0, 100, 100)) drawer.Fill(src, color.RGBA{0, 255, 255, 255}) start := image.Pt(100, 100) end := image.Pt(0, 0) ld := drawer.NewLineDrawer(src, start, end, color.RGBA{255,...
Make second line in the example different
Make second line in the example different
Go
bsd-3-clause
ricochet2200/drawer
afa8e5904d449b7d7df4a5a26ea239e2aae28761
bankfile/converter/krspaka.go
bankfile/converter/krspaka.go
package converter import ( "fmt" "log" ) type KrSpaKa struct { comma rune } func NewKrSpaKa() KrSpaKa { return KrSpaKa{ comma: ';', } } func (k KrSpaKa) Comma() rune { return k.comma } func (k KrSpaKa) IsTransaction(record []string) bool { return !(len(record) != 17 || record[0] == "Auftragskonto") } fun...
package converter import ( "fmt" "log" "strings" ) type KrSpaKa struct { comma rune } func NewKrSpaKa() KrSpaKa { return KrSpaKa{ comma: ';', } } func (k KrSpaKa) Comma() rune { return k.comma } func (k KrSpaKa) IsTransaction(record []string) bool { return !(len(record) != 17 || record[0] == "Auftragskon...
Exclude lines that are prescheduled transactions
Exclude lines that are prescheduled transactions
Go
mit
st3sch/whycc,st3sch/whycc
8ff89401f758cf9a3a4cadbdec63d31e8182c160
pkg/apis/management.cattle.io/v3/tools_system_images.go
pkg/apis/management.cattle.io/v3/tools_system_images.go
package v3 import ( projectv3 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3" "github.com/rancher/rke/types/image" ) var ( m = image.Mirror ToolsSystemImages = struct { PipelineSystemImages projectv3.PipelineSystemImages AuthSystemImages AuthSystemImages }{ PipelineSystemImages: projectv3.P...
package v3 import ( projectv3 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3" ) var ( ToolsSystemImages = struct { PipelineSystemImages projectv3.PipelineSystemImages AuthSystemImages AuthSystemImages }{ PipelineSystemImages: projectv3.PipelineSystemImages{ Jenkins: "rancher/pipeline-...
Use mirrored system images with "mirrored" prefix
Use mirrored system images with "mirrored" prefix
Go
apache-2.0
rancher/rancher,rancher/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,rancherio/rancher
5609ecab4d34441d24d6a668dc78b2a97b94130f
examples/chatroom_demo/chatroom_demo.go
examples/chatroom_demo/chatroom_demo.go
package main import ( "github.com/xiaonanln/goworld" "github.com/xiaonanln/goworld/components/game" ) // serverDelegate 定义一些游戏服务器的回调函数 type serverDelegate struct { game.GameDelegate } func main() { goworld.RegisterSpace(&MySpace{}) // 注册自定义的Space类型 // 注册Account类型 goworld.RegisterEntity("Account", &Account{}, ...
package main import ( "github.com/xiaonanln/goworld" ) func main() { goworld.RegisterSpace(&MySpace{}) // 注册自定义的Space类型 // 注册Account类型 goworld.RegisterEntity("Account", &Account{}, false, false) // 注册Avatar类型,并定义属性 goworld.RegisterEntity("Avatar", &Avatar{}, true, true) // 运行游戏服务器 goworld.Run() }
Call NilSpace.OnGameReady to start game logic
Call NilSpace.OnGameReady to start game logic
Go
apache-2.0
xiaonanln/goworld,xiaonanln/goworld
18918fe5ac0a9ade8643630bd86a02931143e8ab
examples/ex13fifo/ex13fifo.go
examples/ex13fifo/ex13fifo.go
package main import ( "fmt" sci "github.com/samuell/scipipe" ) func main() { sci.InitLogDebug() fmt.Println("Starting program!") ls := sci.Shell("ls -l / > {os:lsl}") ls.OutPathFuncs["lsl"] = func(tsk *sci.ShellTask) string { return "lsl.txt" } grp := sci.Shell("grep etc {i:in} > {o:grep}") grp.OutPathFu...
package main import ( "fmt" sci "github.com/samuell/scipipe" ) func main() { sci.InitLogWarn() fmt.Println("Starting program!") ls := sci.Shell("ls -l / > {os:lsl}") ls.OutPathFuncs["lsl"] = func(tsk *sci.ShellTask) string { return "lsl.txt" } grp := sci.Shell("grep etc {i:in} > {o:grep}") grp.OutPathFun...
Adjust log level in example 13
Adjust log level in example 13
Go
mit
scipipe/scipipe,samuell/scipipe,scipipe/scipipe
6413895f46e80ba1bac24941635cd546ed898831
sphericalmercator.go
sphericalmercator.go
package proj import ( "math" ) // A SphericalMercator represents a spherical Mercator projection. type SphericalMercator struct { code int r float64 } // Code returns sm's EPSG code. func (sm *SphericalMercator) Code() int { return sm.code } // Forward converts latitude φ and longitude λ to easting E and nor...
package proj import ( "math" ) // A SphericalMercator represents a spherical Mercator projection. type SphericalMercator struct { code int r float64 } // Code returns sm's EPSG code. func (sm *SphericalMercator) Code() int { return sm.code } // Forward converts latitude lat and longitude lon to easting E and...
Use ASCII instead of Unicode in spherical_mercator.go
Use ASCII instead of Unicode in spherical_mercator.go
Go
bsd-2-clause
twpayne/go-proj,twpayne/go-proj
68294232af91d3e76792433803c91dac44ea1f68
environs/azure/environprovider.go
environs/azure/environprovider.go
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package azure import ( "launchpad.net/juju-core/environs" "launchpad.net/juju-core/environs/config" "launchpad.net/juju-core/instance" "launchpad.net/juju-core/log" ) type azureEnvironProvider struct{} // azureEnvironPr...
// Copyright 2013 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package azure import ( "launchpad.net/juju-core/environs" "launchpad.net/juju-core/environs/config" "launchpad.net/juju-core/instance" "launchpad.net/loggo" ) // Logger for the Azure provider. var logger = loggo.GetLogge...
Switch Azure provider over to loggo logging.
[r=jtv] Switch Azure provider over to loggo logging.
Go
agpl-3.0
reedobrien/juju,makyo/juju,davecheney/juju,frobware/juju,cherylj/juju,anastasiamac/juju,wwitzel3/juju,kat-co/juju,makyo/juju,macgreagoir/juju,Altoros/juju-cloudsigma,mjs/juju,Altoros/juju-vmware,tsakas/juju,frankban/juju-tmp,alesstimec/juju,thomnico/juju,axw/juju,fwereade/juju,bogdanteleaga/juju,tych0/juju,marcmolla/ju...