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
b11ea30dd5352e96e5de46f8960895d62478fa95
api/oidc.go
api/oidc.go
package api import ( "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcTokenRequest struct { Audience string `json:"audience"` } type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId string, audience ...st...
package api import ( "errors" "fmt" ) var ErrAudienceTooLong = errors.New("the API only supports at most one element in the audience") type OidcToken struct { Token string `json:"token"` } func (c *Client) OidcToken(jobId string, audience ...string) (*OidcToken, *Response, error) { type oidcTokenRequest struct ...
Make OidcTokenRequest a local struct
Make OidcTokenRequest a local struct
Go
mit
buildkite/agent,buildkite/agent,buildkite/agent
fdddd4a2bf3ee13eebd6699a54a0a86814fae116
service/s3/s3manager/s3manageriface/interface.go
service/s3/s3manager/s3manageriface/interface.go
// Package s3manageriface provides an interface for the s3manager package package s3manageriface import ( "io" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" ) // DownloaderAPI is the interface type for s3manager.Downloader. type DownloaderAPI interface { Download(io.Writ...
// Package s3manageriface provides an interface for the s3manager package package s3manageriface import ( "io" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" ) // DownloaderAPI is the interface type for s3manager.Downloader. type Downloader...
Update s3manageriface with new context methods.
Update s3manageriface with new context methods. Fixes #1142
Go
apache-2.0
aws/aws-sdk-go,xibz/aws-sdk-go,xibz/aws-sdk-go,radeksimko/aws-sdk-go,radeksimko/aws-sdk-go,yxd-hde/aws-sdk-go,yxd-hde/aws-sdk-go,zmarois/aws-sdk-go,myshen/aws-sdk-go,agworld/aws-sdk-go,yxd-hde/aws-sdk-go,xibz/aws-sdk-go,agworld/aws-sdk-go,radeksimko/aws-sdk-go,agworld/aws-sdk-go,myshen/aws-sdk-go,calgaryscientific/aws-...
78ab6d7349839851d0d5cb087fab57ea0d31378a
net2/server/tcp.go
net2/server/tcp.go
// +build go1.9 package server import ( "github.com/xgfone/go-tools/net2" ) type ( // THandle is the type alias of net2.THandle. // // DEPRECATED!!! Please the package net2. THandle = net2.THandle // THandleFunc is the type alias of net2.THandleFunc. // // DEPRECATED!!! Please the package net2. THandleFunc...
// +build go1.9 // Package server is deprecated. which is migrated into net2. package server import ( "github.com/xgfone/go-tools/net2" ) type ( // THandle is the type alias of net2.THandle. // // DEPRECATED!!! Please the package net2. THandle = net2.THandle // THandleFunc is the type alias of net2.THandleFun...
Mark the sub-package server as deprecated
Mark the sub-package server as deprecated
Go
apache-2.0
xgfone/go-tools
9ea1a78bd4c57f0db465342f05496828a7784509
internal/restic/find.go
internal/restic/find.go
package restic import "context" // FindUsedBlobs traverses the tree ID and adds all seen blobs (trees and data // blobs) to the set blobs. Already seen tree blobs will not be visited again. func FindUsedBlobs(ctx context.Context, repo Repository, treeID ID, blobs BlobSet) error { blobs.Insert(BlobHandle{ID: treeID, ...
package restic import "context" // FindUsedBlobs traverses the tree ID and adds all seen blobs (trees and data // blobs) to the set blobs. Already seen tree blobs will not be visited again. func FindUsedBlobs(ctx context.Context, repo Repository, treeID ID, blobs BlobSet) error { h := BlobHandle{ID: treeID, Type: Tr...
Check for seen blobs before loading trees
FindUsedBlobs: Check for seen blobs before loading trees The only effective change in behavior is that that toplevel nodes can also be skipped.
Go
bsd-2-clause
restic/restic,restic/restic
a50380093d409fdda491f1acfbb39c619f78fa5e
moz_test.go
moz_test.go
package moz_test import ( "bytes" "io" "testing" "github.com/influx6/faux/tests" "github.com/influx6/moz" ) // TestFunctionGen validates the expected output of a giving function generator. func TestFunctionGen(t *testing.T) { expected := `func main(v int, m string) { fmt.Printf("Welcome to Lola Land"); }` s...
package moz_test import ( "bytes" "io" "testing" "github.com/influx6/faux/tests" "github.com/influx6/moz" ) // TestFunctionGen validates the expected output of a giving function generator. func TestFunctionGen(t *testing.T) { expected := `func main(v int, m string) { fmt.Printf("Welcome to Lola Land"); }` s...
Fix issues with map seperators
Fix issues with map seperators
Go
mit
influx6/moz
430a6a56aaa63b8236a9b71fb4e4c07d31b68cf9
bosh/ops.go
bosh/ops.go
package bosh const GCPBoshDirectorEphemeralIPOps = ` - type: replace path: /networks/name=default/subnets/0/cloud_properties/ephemeral_external_ip? value: true ` const AWSBoshDirectorEphemeralIPOps = ` - type: replace path: /resource_pools/name=vms/cloud_properties/auto_assign_public_ip? value: true ` const ...
package bosh const GCPBoshDirectorEphemeralIPOps = ` - type: replace path: /networks/name=default/subnets/0/cloud_properties/ephemeral_external_ip? value: true ` const AWSBoshDirectorEphemeralIPOps = ` - type: replace path: /resource_pools/name=vms/cloud_properties/auto_assign_public_ip? value: true ` const ...
Remove public network from openstack jumpbox deployment.
Remove public network from openstack jumpbox deployment. [#155017559]
Go
apache-2.0
pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader
175b0ec7a9def133f0a122f5324f97419f4c0f0c
banner/banner_windows.go
banner/banner_windows.go
package banner import ( "errors" "github.com/variadico/noti" ) // Notify displays a notification. This will always return an error on Windows. func Notify(n noti.Params) error { return errors.New("banner notification not supported on this platform") }
package banner import ( toast "github.com/jacobmarshall/go-toast" "github.com/variadico/noti" ) // Notify displays a Windows 10 Toast Notification. func Notify(n noti.Params) error { notification := toast.Notification{ AppID: "noti", Title: n.Title, Message: n.Message, Icon: "", Actions: nil} re...
Add basic Windows 10 support
Add basic Windows 10 support This adds preliminary support for Windows 10 Toast notifications. Closes #36
Go
mit
variadico/noti,variadico/noti
f929c3791e4c1f05d4bdd507086b0a5befdbffbd
analytics.go
analytics.go
package main import ( "fmt" "encoding/json" "net/http" "menteslibres.net/gosexy/redis" ) var client *redis.Client var redisKey = "analytics" func redisConnect(host string, port uint)(error) { var err error client = redis.New() err = client.Connect(host, port) return err } func jsHandler(w http.Respo...
package analytics import ( "text/template" "encoding/json" "net/http" "log" "menteslibres.net/gosexy/redis" ) var client *redis.Client var redisKey = "analytics" func redisConnect(host string, port uint)(error) { var err error client = redis.New() err = client.Connect(host, port) return err } func...
Use text/template instead of trying to do things myself. Log errors from ListenAndServe
Use text/template instead of trying to do things myself. Log errors from ListenAndServe
Go
mit
joshmcarthur/go-analytics,joshmcarthur/go-analytics
8a650e75480c870c32ed627b80b593a4bb2ae040
data/molecule/messages.go
data/molecule/messages.go
package molecule // InMessage is a message sent to a molecule by an external agent. // // An in-message comprises a request, an optional cookie value and a // dynamic payload. The meaning of the cookie depends on the request. // Similarly, the actual contents of the payload depend on the // request. // // Thus, it is...
package molecule // InMessage is a message sent to a molecule by an external agent. // // An in-message comprises a request, an optional cookie value and a // dynamic payload. The meaning of the cookie depends on the request. // Similarly, the actual contents of the payload depend on the // request. // // Thus, it is...
Correct a minor error in the description of `OutMessage`
Correct a minor error in the description of `OutMessage`
Go
mit
js-ojus/RxnWeaver,RxnWeaver/RxnWeaver
56a8b046f196031932ce8aed7395f5b19257c642
keys.go
keys.go
package sortedmap func (sm *SortedMap) keys(lowerBound, upperBound interface{}) ([]interface{}, bool) { idxBounds := sm.boundsIdxSearch(lowerBound, upperBound) if idxBounds == nil { return nil, false } return sm.sorted[idxBounds[0]:idxBounds[1] + 1], true } // Keys returns a slice containing sorted keys. // The...
package sortedmap func (sm *SortedMap) keys(lowerBound, upperBound interface{}) ([]interface{}, bool) { idxBounds := sm.boundsIdxSearch(lowerBound, upperBound) if idxBounds == nil { return nil, false } return sm.sorted[idxBounds[0]:idxBounds[1] + 1], true } // Keys returns a slice containing sorted keys. // The...
Update code comments for BoundedKeys method
Update code comments for BoundedKeys method
Go
mit
umpc/go-sortedmap
fd93474d17f6a47b38929fd64c3123006d8fe910
drivers/driver_freebsd.go
drivers/driver_freebsd.go
package graphdriver import ( "syscall" ) var ( // Slice of drivers that should be used in an order priority = []string{ "zfs", } ) // Mounted checks if the given path is mounted as the fs type func Mounted(fsType FsMagic, mountPath string) (bool, error) { var buf syscall.Statfs_t if err := syscall.Statfs(mou...
package graphdriver import ( "golang.org/x/sys/unix" ) var ( // Slice of drivers that should be used in an order priority = []string{ "zfs", } ) // Mounted checks if the given path is mounted as the fs type func Mounted(fsType FsMagic, mountPath string) (bool, error) { var buf unix.Statfs_t if err := unix.St...
Use unix.Statfs instead of syscall.Statfs
Use unix.Statfs instead of syscall.Statfs
Go
apache-2.0
containers/storage,containers/storage,rhatdan/storage,rhatdan/storage,containers/storage,rhatdan/storage
569e68da7699969fce989e051a70ffb36c72902e
main.go
main.go
package main import ( "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.Logger()) e.Use(middleware.Recover()) h := Handler{} err := h.initDB() if err != nil { e.Logger.Panic(err) } e.File("/favicon.ico", "images/favicon.png") e.GET("/gith...
package main import ( "github.com/facebookgo/grace/gracehttp" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.Logger()) e.Use(middleware.Recover()) h := Handler{} err := h.initDB() if err != nil { e.Logger.Panic(err) } e.File("/favicon.i...
Handle graceful shutdown using facebookgo/grace
Handle graceful shutdown using facebookgo/grace
Go
mit
hasit/healthyrepo,hasit/healthyrepo,hasit/healthyrepo
b665f1e8f16bf043b9d3c087a60866159d71b48d
common/hugo/version_current.go
common/hugo/version_current.go
// Copyright 2018 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
// Copyright 2018 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
Bump versions for release of 0.103.1
releaser: Bump versions for release of 0.103.1 [ci skip]
Go
apache-2.0
anthonyfok/hugo,anthonyfok/hugo,anthonyfok/hugo,gohugoio/hugo,gohugoio/hugo,gohugoio/hugo
818c54a2ca38f1ec38a03467e2ea573f19fbcd20
ping.go
ping.go
package client import ( "fmt" "github.com/docker/docker/api/types" "golang.org/x/net/context" ) // Ping pings the server and returns the value of the "Docker-Experimental" & "API-Version" headers func (cli *Client) Ping(ctx context.Context) (types.Ping, error) { var ping types.Ping req, err := cli.buildRequest(...
package client import ( "fmt" "github.com/docker/docker/api/types" "golang.org/x/net/context" ) // Ping pings the server and returns the value of the "Docker-Experimental", "OS-Type" & "API-Version" headers func (cli *Client) Ping(ctx context.Context) (types.Ping, error) { var ping types.Ping req, err := cli.bu...
Hide command options that are related to Windows
Hide command options that are related to Windows Signed-off-by: Boaz Shuster <dcfbdecb7964372c22343bdfc0ea59b1d969bfd5@gmail.com>
Go
apache-2.0
Zebrilee/cli,cpuguy83/cli,gdevillele/cli,e11137/cli,thaJeztah/cli,thaJeztah/cli,docker/cli,docker/cli,redpanda/cli,ashfall/cli,riyazdf/cli,redpanda/cli,riyazdf/cli,allencloud/cli,dnephin/cli,e11137/cli,allencloud/cli,dnephin/cli,Zebrilee/cli,cpuguy83/cli,ashfall/cli
564499a0d0a7239d90d65a1f0b4937fc4b103e34
cmd/swagger/commands/expand_test.go
cmd/swagger/commands/expand_test.go
package commands import ( "os" "path/filepath" "testing" flags "github.com/jessevdk/go-flags" ) // Commands requires at least one arg func TestCmd_Expand(t *testing.T) { v := &ExpandSpec{} testRequireParam(t, v) } func TestCmd_Expand_NoError(t *testing.T) { specDoc := filepath.Join(fixtureBase, "bugs", "1536...
package commands import ( "os" "path/filepath" "testing" flags "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" ) // Commands requires at least one arg func TestCmd_Expand(t *testing.T) { v := &ExpandSpec{} testRequireParam(t, v) } func TestCmd_Expand_NoError(t *testing.T) { specDoc := fi...
Add test case without output file for expand.go
Add test case without output file for expand.go Signed-off-by: Sergey <95b6115869faa4e182a269b2ddf6435382b0fe53@gmail.com>
Go
apache-2.0
go-swagger/go-swagger,go-swagger/go-swagger
edee8c8b410816b975fd26d80f11343925930958
strip_vendor_windows.go
strip_vendor_windows.go
package gps import ( "os" "path/filepath" ) func stripVendor(path string, info os.FileInfo, err error) error { if info.Name() == "vendor" { if _, err := os.Lstat(path); err == nil { symlink := (info.Mode() & os.ModeSymlink) != 0 dir := info.IsDir() switch { case symlink && dir: // This could be ...
package gps import ( "os" "path/filepath" ) func stripVendor(path string, info os.FileInfo, err error) error { if info.Name() == "vendor" { if _, err := os.Lstat(path); err == nil { symlink := (info.Mode() & os.ModeSymlink) != 0 dir := info.IsDir() switch { case symlink && dir: // This could be ...
Add TODO note about improving windows symlink support
Add TODO note about improving windows symlink support
Go
mit
sdboyer/vsolver,sdboyer/gps
2a00846b6fe3da7293bbd6f758c3db100654f058
librariesio/cmd/librariesio/main.go
librariesio/cmd/librariesio/main.go
package main import ( "fmt" "os" ) func loadFromEnv(keys ...string) (map[string]string, error) { env := make(map[string]string) for _, key := range keys { v := os.Getenv(key) if v == "" { return nil, fmt.Errorf("environment variable %q is required", key) } env[key] = v } return env, nil } func mai...
package main import ( "fmt" "os" "strings" "github.com/hackebrot/go-librariesio/librariesio" ) func loadFromEnv(keys ...string) (map[string]string, error) { env := make(map[string]string) for _, key := range keys { v := os.Getenv(key) if v == "" { return nil, fmt.Errorf("environment variable %q is req...
Update cmd line to get cookiecutter info
Update cmd line to get cookiecutter info
Go
mit
hackebrot/go-librariesio
1d315088c82360946b127712b38ce28da7b2ee16
timer_loggly_writer.go
timer_loggly_writer.go
package gop import ( "fmt" "github.com/segmentio/go-loggly" ) // A timber.LogWriter for the loggly service. // LogglyWriter is a Timber writer to send logging to the loggly // service. See: https://loggly.com. type LogglyWriter struct { c *loggly.Client } // NewLogEntriesWriter creates a new writer for sending ...
package gop import ( "fmt" "github.com/segmentio/go-loggly" ) // A timber.LogWriter for the loggly service. // LogglyWriter is a Timber writer to send logging to the loggly // service. See: https://loggly.com. type LogglyWriter struct { c *loggly.Client } // NewLogEntriesWriter creates a new writer for sending ...
Write message string direct to loggly
Write message string direct to loggly
Go
bsd-3-clause
cocoonlife/gop
87169a0c3b3ccea9634c7678cc834155641de07a
sparkles.go
sparkles.go
package main import ( "encoding/json" "fmt" "net/http" "time" "github.com/gorilla/mux" ) type Request struct { SparkledBy string `json:"sparkled_by"` Recipient string `json:"recipient"` SparkledAt time.Time `json:"sparkled_at"` } func defaultHandler(w http.ResponseWriter, h *http.Request) { fmt.Fpr...
package main import ( "encoding/json" "fmt" "net/http" "time" "github.com/gorilla/mux" ) type Sparkle struct { Sparkler string `json:"sparkler"` Sparklee string `json:"sparklee"` Reason string `json:"reason,omitempty"` Time time.Time `json:"time,omitempty"` } var sparkles []Sparkle func defaultHand...
Change name to Sparkle instead of boring name before
Change name to Sparkle instead of boring name before
Go
mit
azizshamim/sparkles,pmn/sparkles,pmn/sparkles,azizshamim/sparkles,azizshamim/sparkles,pmn/sparkles
d8603de7acebfbbd54101024afad03781375ea7e
src/main.go
src/main.go
package main import ( "github.com/cunnie/sslip.io/src/xip" "log" "net" ) func main() { conn, err := net.ListenUDP("udp", &net.UDPAddr{Port: 53}) if err != nil { log.Fatal(err.Error()) } query := make([]byte, 512) for { _, addr, err := conn.ReadFromUDP(query) if err != nil { log.Println(err.Error())...
package main import ( "github.com/cunnie/sslip.io/src/xip" "log" "net" ) func main() { conn, err := net.ListenUDP("udp", &net.UDPAddr{Port: 53}) if err != nil { log.Fatal(err.Error()) } query := make([]byte, 512) for { _, addr, err := conn.ReadFromUDP(query) if err != nil { log.Println(err.Error())...
Handle DNS query's processing in a separate thread
Handle DNS query's processing in a separate thread ...because I can. And because it gives me a reason to use `go func()`
Go
apache-2.0
cunnie/sslip.io,cunnie/sslip.io,cunnie/sslip.io,cunnie/sslip.io
cef3ff32d46d0eeafb4dd81d4229d6e538e114f8
staticcheck/testdata/CheckUnreadVariableValues.go
staticcheck/testdata/CheckUnreadVariableValues.go
package pkg func fn1() { var x int x = gen() // MATCH /this value of x is never used/ x = gen() println(x) var y int if true { y = gen() // MATCH /this value of y is never used/ } y = gen() println(y) } func gen() int { return 0 } func fn2() { x, y := gen(), gen() x, y = gen(), gen() println(x, y) } ...
package pkg func fn1() { var x int x = gen() // MATCH /this value of x is never used/ x = gen() println(x) var y int if true { y = gen() // MATCH /this value of y is never used/ } y = gen() println(y) } func gen() int { return 0 } func fn2() { x, y := gen(), gen() x, y = gen(), gen() println(x, y) } ...
Add test for unread variable check that shouldn't trigger
Add test for unread variable check that shouldn't trigger
Go
mit
dominikh/go-tools,dominikh/go-tools,dominikh/go-tools,dominikh/go-tools
9fb325a4c68c9fec93c7ff526b40a862eed695b5
svnwatch.go
svnwatch.go
package main import ( "flag" "fmt" "os" "time" ) func fatalf(format interface{}, a ...interface{}) { fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], fmt.Sprintf(fmt.Sprint(format), a...)) os.Exit(1) } func main() { configDir := flag.String("config", "~/.svnwatch", "the configuration directory for svnwatch") i...
package main import ( "flag" "fmt" "os" "time" ) func fatalf(format interface{}, a ...interface{}) { fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], fmt.Sprintf(fmt.Sprint(format), a...)) os.Exit(1) } func main() { configDir := flag.String("config", "~/.svnwatch", "the configuration directory for svnwatch") i...
Save repositories back to the configuration directory
Save repositories back to the configuration directory
Go
agpl-3.0
jackwilsdon/svnwatch
6aa35591c605be93b71e60e3bca8ea7b926bd449
src/unittest/testing.go
src/unittest/testing.go
package unittest import ( "testing" ) type Any interface{} func Failure(t *testing.T, msg ...Any) { t.Fail() t.Log(msg) } func CheckEqual(t *testing.T, x, y Any) { if x != y { Failure(t, x, "!=", y) } } func CheckNotEqual(t *testing.T, x, y Any) { if x == y { Failure(t, x, "...
package unittest import ( "testing" ) type Any interface{} func Failure(t *testing.T, msg ...Any) { t.Fail() t.Log(msg) } func CheckEqual(t *testing.T, x, y Any) { if x != y { Failure(t, x, "!=", y) } } func CheckNotEqual(t *testing.T, x, y Any) { if x == y { Failure(t, x, "...
Add a couple unittest helpers
Add a couple unittest helpers
Go
mit
quintenpalmer/attempt,quintenpalmer/attempt,quintenpalmer/attempt,quintenpalmer/attempt
e50bfa853942eca1070fc7633acdeb8644bca683
logging/event_logger.go
logging/event_logger.go
package logging import ( "fmt" durationfmt "github.com/cloudfoundry/bosh-micro-cli/durationfmt" "time" bmui "github.com/cloudfoundry/bosh-micro-cli/ui" ) type EventLogger interface { // NEW AddEvent(event Event) } func NewEventLogger(ui bmui.UI) EventLogger { return &eventLogger{ ui: ui, starte...
package logging import ( "fmt" "time" durationfmt "github.com/cloudfoundry/bosh-micro-cli/durationfmt" bmui "github.com/cloudfoundry/bosh-micro-cli/ui" ) type Event struct { Time time.Time Stage string Total int Task string State string Index int } type EventLogger interface { AddEvent(event Event) } ...
Add missing event in previous commit
Add missing event in previous commit
Go
apache-2.0
allomov/bosh-init,forrestsill/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,forrestsill/bosh-init,forrestsill/bosh-init,cloudfoundry/bosh-init,allomov/bosh-init,cloudfoundry/bosh-init
ca73de178216d5584113221f2d35216323e25b31
main.go
main.go
package main import ( "github.com/crockeo/personalwebsite/database" "github.com/crockeo/personalwebsite/handlers" "github.com/go-martini/martini" ) // The main function func main() { m := martini.Classic() m.use(database.Injector()) handlers.InitHandlers(m) m.Run() }
package main import ( "github.com/crockeo/personalwebsite/config" "github.com/crockeo/personalwebsite/database" "github.com/crockeo/personalwebsite/handlers" "github.com/go-martini/martini" "os" ) // Functions initialize the project structure func PreRunInit() { os.Mkdir(config.DataDirectory, 0775) db, err := ...
Revert "Added the database to the martini routes."
Revert "Added the database to the martini routes." This reverts commit 0b23d40df123592624d6774c188bd8d868b14fc2.
Go
mit
crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite,crockeo/personalwebsite
a9b4bbf76b0e9419843075bb73453d55fe988172
main.go
main.go
package main import ( "fmt" "os" "github.com/ksonnet/kubecfg/cmd" ) // Version is overridden using `-X main.version` during release builds var version = "(dev build)" func main() { cmd.Version = version if err := cmd.RootCmd.Execute(); err != nil { fmt.Println("Error:", err) os.Exit(1) } }
package main import ( "fmt" "os" "github.com/ksonnet/kubecfg/cmd" ) // Version is overridden using `-X main.version` during release builds var version = "(dev build)" func main() { cmd.Version = version if err := cmd.RootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, "Error:", err) os.Exit(1) } }
Write error message to stderr
Write error message to stderr
Go
apache-2.0
anguslees/kubecfg-1,ksonnet/kubecfg
d4b1f04fb84b791d32907df184ba5a77173aed9e
main.go
main.go
package main //----------------------------------------------------------------------------- // Package factored import statement: //----------------------------------------------------------------------------- import ( // Native imports: "flag" "fmt" // External imports: "github.com/calavera/dkvolume" ) //--...
package main //----------------------------------------------------------------------------- // Package factored import statement: //----------------------------------------------------------------------------- import ( // Native imports: "flag" "fmt" // External imports: "github.com/calavera/dkvolume" ) //--...
Rename flag_x to flagX to keep GoLint happy
Rename flag_x to flagX to keep GoLint happy
Go
apache-2.0
h0tbird/docker-volume-rsync
9027c2840aee7112d5c8ae0161ac93b2aef7aee1
speaker/templates.go
speaker/templates.go
package speaker const speakerTmpl = `+++ Title = "{{ .Title }}" type = "speaker" {{- with .Website }} website = "{{ . }}" {{- end }} {{- with .Twitter }} twitter = "{{ . }}" {{- end }} {{- with .Facebook }} facebook = "{{ . }}" {{- end }} {{- with .Linkedin }} linkedin = "{{ . }}" {{- end }} {{- with .Github }} github...
package speaker const speakerTmpl = `+++ Title = "{{ .Title }}" type = "speaker" {{- with .Website }} website = "{{ . }}" {{- end }} {{- with .Twitter }} twitter = "{{ . }}" {{- end }} {{- with .Facebook }} facebook = "{{ . }}" {{- end }} {{- with .Linkedin }} linkedin = "{{ . }}" {{- end }} {{- with .Github }} github...
Add newline after Gitlab in speaker file
Add newline after Gitlab in speaker file Fixes #113 Signed-off-by: Matt Stratton <39982728c5a806c113d54b69a3f65ecf65602e8a@gmail.com>
Go
mit
devopsdays/devopsdays-cli,mattstratton/probablyfine,devopsdays/devopsdays-cli
b83e7455bd39cc65c02655241fead1840d826f2b
routers/router.go
routers/router.go
package routers import ( "github.com/gorilla/mux" "github.com/unrolled/secure" ) var secureMiddleware = secure.New(secure.Options{ FrameDeny: true, ContentTypeNosniff: true, BrowserXssFilter: true, IsDevelopment: false, }) func InitRoutes() *mux.Router { router := mux.NewRouter() SetTeamRoute...
package routers import ( "github.com/gorilla/mux" "github.com/unrolled/secure" ) var secureMiddleware = secure.New(secure.Options{ SSLRedirect: true, FrameDeny: true, ContentTypeNosniff: true, BrowserXssFilter: true, IsDevelopment: false, }) func InitRoutes() *mux.Router { router := mu...
Add SSLRedirect to secure middleware config
Add SSLRedirect to secure middleware config
Go
mit
Alex1sz/shotcharter-go-api
3644e23807308fc8d35d078176c8a49415fe1086
ping.go
ping.go
package main import ( "fmt" "log" "net/http" "net/url" "time" "github.com/zenazn/goji" ) func ping(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "") referrer := r.Referer() if referrer == "" { return } url, err := url.Parse(referrer) if err != nil { http.Error(w, "Couldn't parse "+refer...
package main import ( "fmt" "log" "net/http" "net/url" "time" "github.com/zenazn/goji" ) func ping(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/javascript") fmt.Fprintf(w, "(function(){})();") referrer := r.Referer() if referrer == "" { return } url, err := ur...
Set Content-Type header to ensure we're sending javascript
Set Content-Type header to ensure we're sending javascript
Go
mit
parkr/ping,parkr/ping
d15d53c7c197a69b6612b3bb5a46a30a59477a5b
src/cmd/cassandra/main.go
src/cmd/cassandra/main.go
package main import ( "dao" "dto" "fmt" "log" ) //Before you execute the program, Launch `cqlsh` and execute: //create keyspace example with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; //create table example.tweet(timeline text, id UUID, text text, PRIMARY KEY(id)); //create index on e...
package main import ( "dao" "dto" "fmt" "log" ) //sudo docker pull spotify/cassandra //sudo docker run --name cassandra -p 9042:9042 spotify/cassandra //sudo docker exec -it cassandra bash //Before you execute the program, Launch `cqlsh` and execute: //create keyspace example with replication = { 'class' : 'Simp...
Add information about docker and cassandra.
Add information about docker and cassandra.
Go
apache-2.0
jerome-laforge/mytweeter,jerome-laforge/mytweeter,jerome-laforge/mytweeter
df80468eeb1bf83a3b766b324badb36f6f0a6c82
time.go
time.go
package rss import ( "strings" "time" ) func parseTime(s string) (time.Time, error) { formats := []string{ "Mon, _2 Jan 2006 15:04:05 MST", "Mon, _2 Jan 2006 15:04:05 -0700", time.ANSIC, time.UnixDate, time.RubyDate, time.RFC822, time.RFC822Z, time.RFC850, time.RFC1123, time.RFC1123Z, time.RF...
package rss import ( "strings" "time" ) func parseTime(s string) (time.Time, error) { formats := []string{ "Mon, _2 Jan 2006 15:04:05 MST", "Mon, _2 Jan 2006 15:04:05 -0700", time.ANSIC, time.UnixDate, time.RubyDate, time.RFC822, time.RFC822Z, time.RFC850, time.RFC1123, time.RFC1123Z, time.RF...
Format de date chelou pour l'ANSM
Format de date chelou pour l'ANSM
Go
bsd-3-clause
th3oSMith/rss
b0da8cb83e5737c5da4e2c324ea130ed84913e09
safearray.go
safearray.go
package ole import ( "fmt" "syscall" "unicode/utf16" "unsafe" ) type SAFEARRAYBOUND struct { CElements uint32 LLbound int32 } type SAFEARRAY struct { CDims uint16 FFeatures uint16 CbElements uint32 CLocks uint32 PvData uint32 RgsaBound SAFEARRAYBOUND }
package ole import ( ) type SAFEARRAYBOUND struct { CElements uint32 LLbound int32 } type SAFEARRAY struct { CDims uint16 FFeatures uint16 CbElements uint32 CLocks uint32 PvData uint32 RgsaBound SAFEARRAYBOUND }
Remove import since nothing is being used.
Remove import since nothing is being used.
Go
mit
go-ole/go-ole
b7aec6d78fbf88acc71f1fc97c20f2dd67ae9396
pkg/api/norman/server.go
pkg/api/norman/server.go
package norman import ( normanapi "github.com/rancher/norman/api" "github.com/rancher/norman/types" "github.com/rancher/rancher/pkg/settings" ) func NewServer(schemas *types.Schemas) (*normanapi.Server, error) { server := normanapi.NewAPIServer() if err := server.AddSchemas(schemas); err != nil { return nil, e...
package norman import ( normanapi "github.com/rancher/norman/api" "github.com/rancher/norman/types" "github.com/rancher/rancher/pkg/settings" ) func NewServer(schemas *types.Schemas) (*normanapi.Server, error) { server := normanapi.NewAPIServer() if err := server.AddSchemas(schemas); err != nil { return nil, e...
Change filename for api-ui files
Change filename for api-ui files
Go
apache-2.0
rancher/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,rancher/rancher,rancherio/rancher
dc7578aff971e84bed156b00bfef33543bf26249
terraform/eval_refresh.go
terraform/eval_refresh.go
package terraform import ( "log" ) // EvalRefresh is an EvalNode implementation that does a refresh for // a resource. type EvalRefresh struct { Provider *ResourceProvider State **InstanceState Info *InstanceInfo Output **InstanceState } // TODO: test func (n *EvalRefresh) Eval(ctx EvalContext) (interf...
package terraform import ( "fmt" "log" ) // EvalRefresh is an EvalNode implementation that does a refresh for // a resource. type EvalRefresh struct { Provider *ResourceProvider State **InstanceState Info *InstanceInfo Output **InstanceState } // TODO: test func (n *EvalRefresh) Eval(ctx EvalContext) ...
Add resource ID to refresh errors
Add resource ID to refresh errors
Go
mpl-2.0
hashicorp/terraform-plugin-sdk,hashicorp/terraform-plugin-sdk
ceb9c91e2b449142055d4de1f3928b8fa06cb0dd
clibs.go
clibs.go
// +build !no_ldflags package oiio // #cgo LDFLAGS: -L/usr/local/lib -lOpenImageIO -lboost_thread-mt -lboost_system-mt import "C"
// +build !no_ldflags package oiio // #cgo LDFLAGS: -L/usr/local/lib -lOpenImageIO -lboost_thread -lboost_system import "C"
Update LDFLAGS for newer boost libs
Update LDFLAGS for newer boost libs
Go
mit
justinfx/openimageigo,justinfx/openimageigo,justinfx/openimageigo
1be1c86dee54acb44eab9e009e01993eb3f4faf8
challenge51.go
challenge51.go
// Challenge 51 - Compression Ratio Side-Channel Attacks // http://cryptopals.com/sets/7/challenges/51 package cryptopals import ( "bytes" "compress/flate" "crypto/aes" "crypto/cipher" "io" "text/template" ) type challenge51 struct { } var t = template.Must(template.New("request").Parse(`POST / HTTP/1.1 Host:...
// Challenge 51 - Compression Ratio Side-Channel Attacks // http://cryptopals.com/sets/7/challenges/51 package cryptopals import ( "bytes" "compress/flate" "crypto/aes" "crypto/cipher" "io" "text/template" ) type challenge51 struct { } var t = template.Must(template.New("request").Parse(`POST / HTTP/1.1 Host:...
Fix AES-CTR encryption to actually encrypt input data instead of slice of zeroes
Fix AES-CTR encryption to actually encrypt input data instead of slice of zeroes
Go
mit
Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go
4af63e93bb712667decea0e764ed1f6a0fa91cd9
cmd/sirius-cloud/main.go
cmd/sirius-cloud/main.go
package main import ( "github.com/kayex/sirius" "github.com/kayex/sirius/config" "github.com/kayex/sirius/extension" "golang.org/x/net/context" ) func main() { cfg := config.FromEnv() rmt := sirius.NewRemote(cfg.Remote.URL, cfg.Remote.Token) users, err := rmt.GetUsers() if err != nil { panic(err) } l :...
package main import ( "github.com/kayex/sirius" "github.com/kayex/sirius/config" "github.com/kayex/sirius/extension" "golang.org/x/net/context" ) func main() { cfg := config.FromEnv() rmt := sirius.NewRemote(cfg.Remote.URL, cfg.Remote.Token) users, err := rmt.GetUsers() if err != nil { panic(err) } ld ...
Use MQTT sync in sirius-cloud
Use MQTT sync in sirius-cloud
Go
mit
kayex/sirius
bc62a11c24fc6c40d97c4d198fdec9846502bcb0
senv_test.go
senv_test.go
package main import ( "testing" . "github.com/VonC/godbg" "github.com/VonC/godbg/exit" . "github.com/smartystreets/goconvey/convey" ) func TestMain(t *testing.T) { exiter = exit.New(func(int) {}) Convey("senvgo main installation scenario with no command", t, func() { SetBuffers(nil) main() So(ErrString...
package main import ( "testing" . "github.com/VonC/godbg" "github.com/VonC/godbg/exit" . "github.com/smartystreets/goconvey/convey" ) func TestMain(t *testing.T) { exiter = exit.New(func(int) {}) Convey("senvgo main installation scenario with no command", t, func() { SetBuffers(nil) main() So(ErrString...
Test exit status when no program
Test exit status when no program
Go
mit
VonC/senvgo,VonC/senvgo
3c568797015b1bc4c375a72d20b7d603d9779762
webhook/config.go
webhook/config.go
package webhook import ( "os" "strings" "io/ioutil" "encoding/json" ) type Configuration struct { WebServerPort uint16 `json:"webserver-port"` EndpointName string `json:"endpoint-name"` ExchangeName string `json:"exchange-name"` QueueURI string `json:"queue-u...
package webhook import ( "os" "strings" "io/ioutil" "encoding/json" ) type Configuration struct { WebServerPort uint16 `json:"webserver-port"` EndpointName string `json:"endpoint-name"` ExchangeName string `json:"exchange-name"` QueueURI string `json:...
Integrate secure middleware for handling https connections
Integrate secure middleware for handling https connections
Go
mit
tappsi/airbrake-webhook,oscar-lopez/airbrake-webhook
b04166bcf50aa5009a05348be6afd1697bdd3575
conn_test.go
conn_test.go
package pqx import ( "testing" ) func TestConnect(t *testing.T) { conn, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"}) if err != nil { t.Fatal("Unable to establish connection") } err = conn.Close() if err != nil { t.Fatal("Unable to close connection") } } func TestQuery(t *tes...
package pqx import ( "testing" ) func TestConnect(t *testing.T) { conn, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"}) if err != nil { t.Fatal("Unable to establish connection") } if _, present := conn.runtimeParams["server_version"]; !present { t.Error("Runtime parameters not stor...
Add test for runtime parameter storage
Add test for runtime parameter storage
Go
mit
rsto/pgx,jackc/pgx,jackc/tern,silviucm/pgx,deoxxa/pgx,silviucm/pgx,jackc/pgx,jackc/pgx,josephglanville/pgx,jonasi/pgx,silviucm/pgx,plopik/pgx,plopik/pgx,jackc/tern-deb,plopik/pgx,jackc/pgx,axsy-dev/tern,kelvich/pgx
dddcbb71c45932feef3c2d0fe6fbdf375b0de644
graph.go
graph.go
package git /* #include <git2.h> */ import "C" import ( "runtime" ) func (repo *Repository) GraphDescendantOf(commit, ancestor *Oid) (bool, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_graph_descendant_of(repo.ptr, commit.toC(), ancestor.toC()) if ret < 0 { return false, MakeGit...
package git /* #include <git2.h> */ import "C" import ( "runtime" ) func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_graph_descendant_of(repo.ptr, commit.toC(), ancestor.toC()) if ret < 0 { return false, MakeGitError...
Remove "Graph" prefix on method names
Remove "Graph" prefix on method names
Go
mit
orivej/git2go,treejames/git2go,treejames/git2go,Acidburn0zzz/git2go,kissthink/git2go,sygool/git2go,pks-t/git2go,sygool/git2go,hwjeong/git2go,clns/git2go,pks-t/git2go,libgit2/git2go,clearr/git2go,joseferminj/git2go,michaeledgar/git2go,ezwiebel/git2go,TheDahv/git2go,AaronO/git2go,AaronO/git2go,libgit2/git2go,ezwiebel/git...
1d1bad07b82a823e6e1a2bd1d7156ac85bdf43a1
config/config_test.go
config/config_test.go
package config import ( "github.com/stretchr/testify/assert" "regexp" "testing" ) var configYaml = `--- repos: df: zerowidth/dotfiles ` var invalidYaml = "---\nrepos: []" var repoMap = map[string]string{ "df": "zerowidth/dotfiles", } func TestLoad(t *testing.T) { config, _ := Load(configYaml) assert.Equal(t...
package config import ( "reflect" "testing" ) var configYaml = `--- repos: df: zerowidth/dotfiles ` var invalidYaml = "---\nrepos: []" var repoMap = map[string]string{ "df": "zerowidth/dotfiles", } func TestLoad(t *testing.T) { config, _ := Load(configYaml) if !reflect.DeepEqual(config.RepoMap, repoMap) { ...
Update config test to drop assert library
Update config test to drop assert library
Go
mit
zerowidth/gh-shorthand,zerowidth/gh-shorthand
9d5a3cdf1fa4223c0f8da2b74ab0dd3b35df7fda
OneTimeAuthHandler.go
OneTimeAuthHandler.go
package main import ( "crypto/rand" "encoding/binary" "fmt" ) type OneTimeAuthHandler struct { username string password string } func (a *OneTimeAuthHandler) Init(username string) { a.username = username } func (a *OneTimeAuthHandler) AuthenticationInvalidated() { b := make([]byte, 4) _, err := rand.Read(b)...
package main import ( "crypto/rand" "encoding/binary" "fmt" ) type OneTimeAuthHandler struct { username string password string } func (a *OneTimeAuthHandler) Init(username string) { a.username = username } func (a *OneTimeAuthHandler) AuthenticationInvalidated() { b := make([]byte, 4) _, err := rand.Read(b)...
Fix formatting of log message.
Fix formatting of log message. Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com>
Go
mit
ninjasphere/sphere-setup-assistant,ninjasphere/sphere-setup-assistant
df2f61e1c3cf44afb30b7fa9a7a5995ac25af062
execution.go
execution.go
package sirius import ( "time" ) type Execution struct { Ext Extension Msg Message Cfg ExtensionConfig } type ExecutionResult struct { Err error Action MessageAction } type ExtensionRunner interface { Run([]Execution, chan<- ExecutionResult, time.Duration) } type AsyncRunner struct{} func NewExecution(x...
package sirius import ( "time" ) type Execution struct { Ext Extension Msg Message Cfg ExtensionConfig } type ExecutionResult struct { Err error Action MessageAction } type ExtensionRunner interface { Run(exe []Execution, res chan<- ExecutionResult, timeout time.Duration) } type AsyncRunner struct{} fun...
Add named function parameters for clarity
Add named function parameters for clarity
Go
mit
kayex/sirius
23dd91036aaad0bde8cccbf15ecb6d8a4047efee
go-age_test.go
go-age_test.go
package goage import ( "testing" "time" ) type AgeTestCandidate struct { BirthDate time.Time CheckingTime time.Time ExpectedAge int } var AgeTestCandidates = []AgeTestCandidate{ {time.Date(2000, 3, 14, 0, 0, 0, 0, time.UTC), time.Date(2010, 3, 14, 0, 0, 0, 0, time.UTC), 10}, {time.Date(2001, 3, 14, 0, 0, ...
package "go-age" import ( "testing" "time" ) type AgeTestCandidate struct { BirthDate time.Time CheckingTime time.Time ExpectedAge int } var AgeTestCandidates = []AgeTestCandidate{ {time.Date(2000, 3, 14, 0, 0, 0, 0, time.UTC), time.Date(2010, 3, 14, 0, 0, 0, 0, time.UTC), 10}, {time.Date(2001, 3, 14, 0, ...
Change to go with the change.
Change to go with the change.
Go
mit
bearbin/go-age
1e64cdea4514027e815b24f56f68f3f3cdf621ec
src/testhelpers/net/all_requests_called_matcher.go
src/testhelpers/net/all_requests_called_matcher.go
package net import ( "errors" "fmt" "github.com/onsi/gomega" ) func HaveAllRequestsCalled() gomega.OmegaMatcher { return allRequestsCalledMatcher{} } type allRequestsCalledMatcher struct{} func (matcher allRequestsCalledMatcher) Match(actual interface{}) (bool, string, error) { testHandler, ok := actual.(*Test...
package net import ( "errors" "fmt" "github.com/onsi/gomega" ) func HaveAllRequestsCalled() gomega.OmegaMatcher { return allRequestsCalledMatcher{} } type allRequestsCalledMatcher struct{} func (matcher allRequestsCalledMatcher) Match(actual interface{}) (bool, string, error) { testHandler, ok := actual.(*Test...
Fix messages in HaveAllRequestsCalled matcher
Fix messages in HaveAllRequestsCalled matcher
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
706570f82a9a921be943e0c196049969c3eaf25e
main.go
main.go
package main import ( "fmt" "os" "github.com/jutkko/mindown/input" "github.com/urfave/cli" ) func main() { app := cli.NewApp() app.Name = "mindown" app.Usage = "convert mind to files" app.Flags = []cli.Flag{ cli.StringFlag{ Name: "input-file", Value: "input.txt", Usage: "input file name", }, }...
package main import ( "fmt" "os" "github.com/jutkko/mindown/input" "github.com/jutkko/mindown/output" "github.com/urfave/cli" ) func main() { app := cli.NewApp() app.Name = "mindown" app.Usage = "convert mind to files" app.Flags = []cli.Flag{ cli.StringFlag{ Name: "input-file", Value: "input.txt", ...
Add flag for output file
Add flag for output file
Go
mit
jutkko/mindown,jutkko/mindown
57d2287c5cdbd33f08589ca941d887cbad7f3ab9
main.go
main.go
package boardgame type State struct { //The version number of the state. Increments by one each time a Move is //applied. Version int //The schema version that this state object uses. This number will not //change often, but is useful to detect if the state was saved back when a //diferent schema was in use and ...
package boardgame type State struct { //The version number of the state. Increments by one each time a Move is //applied. Version int //The schema version that this state object uses. This number will not //change often, but is useful to detect if the state was saved back when a //diferent schema was in use and ...
Define PropertyReader interface and use it a couple of places.
Define PropertyReader interface and use it a couple of places.
Go
apache-2.0
jkomoros/boardgame,jkomoros/boardgame,jkomoros/boardgame
71092572448c3e529982877e29d7ed0b6da68228
main.go
main.go
package main import ( "fmt" "github.com/cloudfoundry/cli/plugin" ) type BasicPlugin struct{} func (c *BasicPlugin) Run(cliConnection plugin.CliConnection, args []string) { if args[0] == "nuke-pave" { fmt.Println("circumstances are cyclical\n\ndestroying and rebuilding the space you inhabit") } } func (c *Bas...
package main import ( "fmt" "github.com/cloudfoundry/cli/plugin" "strings" ) type NukePlugin struct{} func (c *NukePlugin) Run(cliConnection plugin.CliConnection, args []string) { if args[0] == "nuke-pave" { fmt.Println("\ncircumstances are cyclical\n\ndestroying and rebuilding the space you inhabit...") tar...
Make nuke-pave delete and recreate space.
Make nuke-pave delete and recreate space. Signed-off-by: Jesse Alford <a55b03e87da0542f6cec9c2ad31f0847e861a4d7@pivotallabs.com>
Go
mit
JesseTAlford/nuke-pave,JesseTAlford/nuke-pave
9eb88c578b43a36fca89513f00e4b0cfe3fbbca7
main.go
main.go
package main func main() { }
package main import ( "flag" "fmt" "io/ioutil" ) var flag_profit int func init() { flag.IntVar(&flag_profit, "profit", -1, "a min amount that you want to win") } func parseGames() <-chan []LottoGame { parsedGames := make(chan []LottoGame) go func() { bytes, err := ioutil.ReadFile("scratcher.txt") if err ...
Implement the command and accept the profit value as a command line parameter
Implement the command and accept the profit value as a command line parameter
Go
mit
ghthor/lottery-scraper
9a10b651b45fc520cd73106575371e7024702d0a
qexec.go
qexec.go
package qexec import ( "bytes" "github.com/kballard/go-shellquote" "os" "os/exec" "strings" ) // Run executes the command in parameter after having correctly quoted it. // The command stdout is returned. func Run(cmds ...string) (string, error) { toRun := strings.Join(cmds, " ") input, err := shellquote.Split(...
package qexec import ( "bytes" "github.com/kballard/go-shellquote" "os" "os/exec" "strings" ) // Run executes the command in parameter after having correctly quoted it. // The command stdout is returned. // // It handles a common error when the path to the executable contains one or more // environment variable,...
Handle common mistake when the executable contains a env var
Handle common mistake when the executable contains a env var
Go
mit
tbruyelle/qexec
36289f7a5e1cc17bb19d2c100374120fb97fb157
tcpip.go
tcpip.go
package main import ( "bufio" "fmt" "net/http" "net/http/httptest" "net/http/httputil" "golang.org/x/crypto/ssh" ) func handleDirectTCPIPChannel(channel ssh.Channel, port uint32) (string, error) { switch port { case 80: return handleHTTPChannel(channel) default: return "", fmt.Errorf("unsupported port %...
package main import ( "bufio" "fmt" "net/http" "net/http/httptest" "net/http/httputil" "golang.org/x/crypto/ssh" ) func handleDirectTCPIPChannel(channel ssh.Channel, port uint32) (string, error) { switch port { case 80: return handleHTTPChannel(channel) return "", nil default: return "", fmt.Errorf("u...
Introduce a warning to test the shiny new CI
Introduce a warning to test the shiny new CI
Go
apache-2.0
jaksi/sshesame
a7ca5852fe502197889fe664d95e333897defb73
utils.go
utils.go
// Copyright 2016 Martin Hebnes Pedersen (LA5NTA). All rights reserved. // Use of this source code is governed by the MIT-license that can be // found in the LICENSE file. package main import "unicode" func SplitFunc(c rune) bool { return unicode.IsSpace(c) || c == ',' }
// Copyright 2016 Martin Hebnes Pedersen (LA5NTA). All rights reserved. // Use of this source code is governed by the MIT-license that can be // found in the LICENSE file. package main import "unicode" func SplitFunc(c rune) bool { return unicode.IsSpace(c) || c == ',' || c == ';' }
Split input lists on semicolon
Split input lists on semicolon
Go
mit
la5nta/pat,la5nta/pat,la5nta/pat,la5nta/pat
89f8794cea81b5be2f5cf5377ee2ece011118c3e
app/db/db.go
app/db/db.go
/* * Copyright 2015 Benoit LETONDOR * * 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 la...
/* * Copyright 2015 Benoit LETONDOR * * 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 la...
Remove ParseTime from mysql connection
Remove ParseTime from mysql connection
Go
apache-2.0
benoitletondor/TwitterBot
d64c4059d3dbdc4f0251e98ab9583824a31301d8
perms/perms.go
perms/perms.go
package perms import ( "database/sql" "github.com/techjanitor/pram-libs/db" e "github.com/techjanitor/pram-libs/errors" ) // get the user info from id func Check(uid, ib uint) (allowed bool, err error) { // check for invalid stuff if uid == 0 || uid == 1 || ib == 0 { err = e.ErrInvalidParam return } // ...
package perms import ( "github.com/techjanitor/pram-libs/db" e "github.com/techjanitor/pram-libs/errors" ) // get the user info from id func Check(uid, ib uint) (allowed bool, err error) { // check for invalid stuff if uid == 0 || uid == 1 || ib == 0 { err = e.ErrInvalidParam return } // Get Database hand...
Revert "Revert "add permissions check""
Revert "Revert "add permissions check"" This reverts commit 9513d187c67d7d5d159d18d906c3a3d4ef39514c.
Go
mit
eirka/eirka-libs
b7cac8362a2c6cde5f96a278aefa500e8a8d296f
connection.go
connection.go
package main import ( "log" "net" "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh" ) func handleConnection(conn net.Conn, sshServerConfig *ssh.ServerConfig) { defer conn.Close() defer logrus.WithField("remote_address", conn.RemoteAddr().String()).Infoln("Connection closed") serverConn, newChannels, requ...
package main import ( "log" "net" "strings" "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh" ) func handleConnection(conn net.Conn, sshServerConfig *ssh.ServerConfig) { defer conn.Close() defer logrus.WithField("remote_address", conn.RemoteAddr().String()).Infoln("Connection closed") serverConn, newCha...
Send a hostkeys-00@openssh.com request if the client is an OpenSSH version and we're pretenting to be one too
Send a hostkeys-00@openssh.com request if the client is an OpenSSH version and we're pretenting to be one too
Go
apache-2.0
jaksi/sshesame
1f3f00407aec774e47493353390622ee1efd5a24
internal/stmt/name.go
internal/stmt/name.go
/*- * Copyright (c) 2016, 1&1 Internet SE * Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de> * All rights reserved * * Use of this source code is governed by a 2-clause BSD license * that can be found in the LICENSE file. */ // Package stmt provides SQL statement string constants for SOMA package stmt...
/*- * Copyright (c) 2016, 1&1 Internet SE * Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de> * All rights reserved * * Use of this source code is governed by a 2-clause BSD license * that can be found in the LICENSE file. */ // Package stmt provides SQL statement string constants for SOMA package stmt...
Fix assignment to nil map in init()
Fix assignment to nil map in init()
Go
bsd-2-clause
1and1/soma
c355c0c6adc5c37ff76963240968fbeeb2f8ce55
daemon/daemon_test.go
daemon/daemon_test.go
package daemon import ( "testing" "time" "github.com/elves/elvish/util" ) func TestDaemon(t *testing.T) { util.InTempDir(func(string) { serverDone := make(chan struct{}) go func() { Serve("sock", "db") close(serverDone) }() client := NewClient("sock") for i := 0; i < 10; i++ { client.ResetCon...
package daemon import ( "testing" "time" "github.com/elves/elvish/util" ) func TestDaemon(t *testing.T) { util.InTempDir(func(string) { serverDone := make(chan struct{}) go func() { Serve("sock", "db") close(serverDone) }() client := NewClient("sock") for i := 0; i < 100; i++ { client.ResetCo...
Raise timeout for test to 1s.
daemon: Raise timeout for test to 1s.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
db082120723090c878a54148f2bf40d91b9fbf33
batch_test.go
batch_test.go
package gobatch import ( "errors" "testing" "github.com/MasterOfBinary/gobatch/mocks" ) func TestMust(t *testing.T) { batch := &mocks.Batch{} if Must(batch, nil) != batch { t.Error("Must(batch, nil) != batch") } var panics bool func() { defer func() { if p := recover(); p != nil { panics = true ...
package gobatch_test import ( "errors" "testing" "github.com/MasterOfBinary/gobatch/mocks" ) func TestMust(t *testing.T) { batch := &mocks.Batch{} if Must(batch, nil) != batch { t.Error("Must(batch, nil) != batch") } var panics bool func() { defer func() { if p := recover(); p != nil { panics = t...
Move test to separate package
Move test to separate package
Go
mit
MasterOfBinary/gobatch
01333813814eb47fd91c6181733d921b6e2aa4f4
client.go
client.go
/************************************************ * client.go * Author: Jeramy Singleton * Date: 12 April 2015 * * Description: A client is a remote user that * has connected to the server. Information for * the client should be stored in a struct and * be accessible to the server. ***********************************...
/************************************************ * client.go * Author: Jeramy Singleton * Date: 12 April 2015 * * Description: A client is a remote user that * has connected to the server. Information for * the client should be stored in a struct and * be accessible to the server. ***********************************...
Add net.Conn to Client Struct
Add net.Conn to Client Struct
Go
mit
HamsterWheels/magenta-server-go
e48a9fb49874f322386d04b7cee4e8789154677a
spec_test.go
spec_test.go
package engine_test import ( ".././engine" "github.com/ghthor/gospec/src/gospec" "testing" ) func TestAllSpecs(t *testing.T) { r := gospec.NewRunner() r.AddSpec(engine.DescribeClock) r.AddSpec(engine.DescribeTimeSpan) r.AddSpec(engine.DescribeDirection) r.AddSpec(engine.DescribeWorldCoord) r.AddSpec(engine....
package engine_test import ( ".././engine" "github.com/ghthor/gospec/src/gospec" "testing" ) func TestAllSpecs(t *testing.T) { r := gospec.NewRunner() r.AddSpec(engine.DescribeClock) r.AddSpec(engine.DescribeTimeSpan) r.AddSpec(engine.DescribeDirection) r.AddSpec(engine.DescribeWorldCoord) r.AddSpec(engine...
Rearrange Describes into a logical groups
Rearrange Describes into a logical groups
Go
mit
ghthor/filu
8d972ed4312ed6337878d56e05cf7e5b57bed0db
mock/mock.go
mock/mock.go
package mock import ( "fmt" "io/ioutil" "path/filepath" "runtime" httpmock "gopkg.in/jarcoal/httpmock.v1" ) // RegisterURL for given url and return 200 status register mock http responder func RegisterURL(url string, version string, filename string) { _, f, _, _ := runtime.Caller(0) cwd := filepath.Dir(f) fu...
package mock import ( "fmt" "io/ioutil" "path/filepath" "runtime" httpmock "gopkg.in/jarcoal/httpmock.v1" ) // GetAbsoluteMockPath returns absolute path for given mock file func GetAbsoluteMockPath(filename string, version string) string { _, f, _, _ := runtime.Caller(0) cwd := filepath.Dir(f) return fmt.Spr...
Add a helper function GetAbsoluteMockPath
Add a helper function GetAbsoluteMockPath Split this code into a dedicated function, will use later
Go
apache-2.0
cloudflare/unsee,cloudflare/unsee,cloudflare/unsee,cloudflare/unsee,cloudflare/unsee
3f748b82e899a672665114b3efa600ec8261fbbb
unit_test.go
unit_test.go
package fnlog_test import ( "github.com/northbright/fnlog" "log" ) var ( noTagLog *log.Logger ) func Example() { iLog := fnlog.New("i") wLog := fnlog.New("w") eLog := fnlog.New("e") iLog.Printf("print infos") wLog.Printf("print warnnings") eLog.Printf("print errors") noTagLog.Printf("print messages withou...
package fnlog_test import ( "github.com/northbright/fnlog" "log" ) /*var ( noTagLog *log.Logger ) */ func Example() { iLog := fnlog.New("i") wLog := fnlog.New("w") eLog := fnlog.New("e") iLog.Printf("print infos") wLog.Printf("print warnnings") eLog.Printf("print errors") //noTagLog.Printf("print messages ...
Remove global var to seek if outputs works
Remove global var to seek if outputs works
Go
mit
vonwenm/fnlog
682d2160fb1f53f969736ac90e0ccdf97e4d1127
errors.go
errors.go
package jwp import ( "errors" "fmt" "net/http" ) func CheckHTTPStatus(res *http.Response, body []byte) (err error) { if res.StatusCode >= 400 && res.StatusCode < 600 { fmt.Println("\t...") err = errors.New("Status Code: " + res.Status + ", Body: " + string(body)) } return }
package jwp import ( "errors" "fmt" "net/http" ) func CheckHTTPStatus(res *http.Response, body []byte) (err error) { if res.StatusCode >= 400 && res.StatusCode < 600 { fmt.Println("\t...") err = errors.New("Status Code: " + res.Status + ", Body: " + string(body)) } return } func CheckStatus(status int) (er...
Add function CheckStatus: convert status to error.
Add function CheckStatus: convert status to error.
Go
mit
kofj/go.jwp,kofj/go.jwp
de2a451f9c30ada011f0b5e471fd04a3770f9be1
virtualboxclient/virtualbox.go
virtualboxclient/virtualbox.go
package virtualboxclient import ( "github.com/appropriate/go-virtualboxclient/vboxwebsrv" ) type VirtualBox struct { *vboxwebsrv.VboxPortType username string password string managedObjectId string } func New(username, password, url string) *VirtualBox { return &VirtualBox{ VboxPortType: vboxwebsrv.NewVboxP...
package virtualboxclient import ( "github.com/appropriate/go-virtualboxclient/vboxwebsrv" ) type VirtualBox struct { *vboxwebsrv.VboxPortType username string password string managedObjectId string } func New(username, password, url string) *VirtualBox { return &VirtualBox{ VboxPortType: vboxwebsrv.NewVboxP...
Put VirtualBox functions in alphabetical order
Put VirtualBox functions in alphabetical order
Go
mit
appropriate/go-virtualboxclient
029fd7079281fd491e5b7df9b41dad7c41025984
diff/boshreleasediffer.go
diff/boshreleasediffer.go
package diff import ( "fmt" "github.com/kr/pretty" "github.com/xchapter7x/enaml" ) type boshReleaseDiffer struct { release1 *boshRelease release2 *boshRelease } func (d boshReleaseDiffer) Diff() (result Result, err error) { result = Result{} result.Deltas = pretty.Diff(d.release1, d.release2) return } func...
package diff import ( "github.com/kr/pretty" "github.com/xchapter7x/enaml" ) type boshReleaseDiffer struct { release1 *boshRelease release2 *boshRelease } func (d boshReleaseDiffer) Diff() (result Result, err error) { result = Result{} var jresult Result for _, jname := range d.allJobNames() { jresult, err ...
Add better BOSH release diff output
Add better BOSH release diff output - Ensure all jobs are compared (added, changed, or removed) - Only output property differences instead of all the BOSH release diff noise
Go
apache-2.0
enaml-ops/enaml,xchapter7x/enaml
a6ccdd01a60743d7eae5e5ac3b2df3e697bd0325
kami/main.go
kami/main.go
package main import ( "encoding/json" "log" "net/http" "strconv" "github.com/guregu/kami" "golang.org/x/net/context" ) func main() { kami.Get("/contacts", getContacts) kami.Serve() } func getContacts( ctx context.Context, w http.ResponseWriter, r *http.Request, ) { defer func() { if err := recover(); ...
package main import ( "encoding/json" "log" "net/http" "strconv" "github.com/guregu/kami" ) func main() { kami.Get("/contacts", getContacts) kami.Serve() } func getContacts( w http.ResponseWriter, r *http.Request, ) { defer func() { if err := recover(); err != nil { log.Print(err) } }() page, er...
Remove Context from the arguments list
[kami][getContacts()] Remove Context from the arguments list
Go
mit
konjoot/benches,konjoot/benches,konjoot/benches
2ff2d63c780ab137d6e974ca999bcef9eeb245a0
examples/projects/main.go
examples/projects/main.go
package main import ( "encoding/json" "fmt" "log" "os" "gopkg.in/wolfeidau/go-buildkite.v1" "gopkg.in/alecthomas/kingpin.v2" ) var ( apiToken = kingpin.Flag("token", "API token").Required().String() org = kingpin.Flag("org", "Orginization slug").Required().String() debug = kingpin.Flag("debug", "Ena...
package main import ( "encoding/json" "fmt" "log" "os" "github.com/wolfeidau/go-buildkite/buildkite" "gopkg.in/alecthomas/kingpin.v2" ) var ( apiToken = kingpin.Flag("token", "API token").Required().String() org = kingpin.Flag("org", "Orginization slug").Required().String() debug = kingpin.Flag("de...
Undo using gopkg.in for examples.
Undo using gopkg.in for examples.
Go
bsd-2-clause
buildkite/go-buildkite,wolfeidau/go-buildkite
484f81e1cea226267bb4256bb21ebaa1427d16d0
state/state.go
state/state.go
package state // State represents the state of a hosts type State int const ( None State = iota Running Paused Saved Stopped Stopping Starting Error ) var states = []string{ "", "Running", "Paused", "Saved", "Stopped", "Stopping", "Starting", "Error", } func (s State) String() string { if int(s) < ...
package state // State represents the state of a host type State int const ( None State = iota Running Paused Saved Stopped Stopping Starting Error ) var states = []string{ "", "Running", "Paused", "Saved", "Stopped", "Stopping", "Starting", "Error", } // Given a State type, returns its string repre...
Fix doc typo and add additional if condition
Fix doc typo and add additional if condition Signed-off-by: Ankush Agarwal <fbce221e53f28a6368ebb5e0aa2ee1c79ff12e9e@gmail.com>
Go
apache-2.0
justintung/machine,bfirsh/machine,legal90/machine,abstractitptyltd/machine,kunalkushwaha/machine,danix800/docker.github.io,usmanismail/machine,menglingwei/denverdino.github.io,mjtrefethen/machine,ksasi/machine,rillig/docker.github.io,shot/machine,seegno-forks/machine,emsi/machine,erikdejonge/machine,anweiss/docker.gith...
c1c1776768902f26160af59b689f14c17e80068a
utils/gpg.go
utils/gpg.go
package utils import ( "fmt" "os/exec" "strings" ) // GpgDetachedSign signs file with detached signature in ASCII format func GpgDetachedSign(source string, destination string) error { fmt.Printf("v = %#v\n", strings.Join([]string{"gpg", "-o", destination, "--armor", "--detach-sign", source}, " ")) cmd := exec.C...
package utils import ( "os/exec" ) // Signer interface describes facility implementing signing of files type Signer interface { SetKey(keyRef string) DetachedSign(source string, destination string) error ClearSign(source string, destination string) error } // Test interface var ( _ Signer = &GpgSigner{} ) // G...
Rework Gpg signing to work through interface.
Rework Gpg signing to work through interface.
Go
mit
jola5/aptly,aptly-dev/aptly,scalp42/aptly,jola5/aptly,seaninspace/aptly,adfinis-forks/aptly,adfinis-forks/aptly,ceocoder/aptly,sobczyk/aptly,seaninspace/aptly,gearmover/aptly,vincentbernat/aptly,scalp42/aptly,vincentbernat/aptly,neolynx/aptly,gearmover/aptly,adfinis-forks/aptly,bsundsrud/aptly,ceocoder/aptly,bsundsrud/...
784eed897602168d52d364e2bc9ee4d22a103152
seclab.go
seclab.go
package main import ( "github.com/WhiteHatCP/seclab-listener/backend" "github.com/WhiteHatCP/seclab-listener/server" "log" "net" "os" "syscall" ) func main() { syscall.Umask(0007) socket := "seclab.sock" ln, err := net.Listen("unix", socket) syscall.Chmod(socket, 0770) if err != nil { log.Fatal(err) } ...
package main import ( "github.com/WhiteHatCP/seclab-listener/backend" "github.com/WhiteHatCP/seclab-listener/server" "log" "net" "os" "syscall" ) func main() { syscall.Umask(0007) socket := "seclab.sock" ln, err := net.Listen("unix", socket) syscall.Chmod(socket, 0770) if err != nil { log.Fatal(err) } ...
Make sure the socket closes
Make sure the socket closes
Go
mit
WhiteHatCP/seclab-listener,WhiteHatCP/seclab-listener
fc9ce3b8e8ab11cdb3a804a8ad382e1e509076d4
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; charset=utf-8" )
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" )
Trim space for multiple media type entries
Trim space for multiple media type entries Rack is strict about spaces between entries: https://github.com/rack/rack/blob/master/lib/rack/request.rb#L50-L60
Go
mit
octokit/go-octokit,half-ogre/go-octokit,pcasaretto/go-octokit,calavera/go-octokit,pcasaretto/go-octokit,half-ogre/go-octokit,octokit/go-octokit,calavera/go-octokit
762d4cf4d60a92365c2644cd014ce650553885ac
operation.go
operation.go
package ergo type Handler interface { ServeHTTP(*Response, *Request) } type HandlerFunc func(*Response, *Request) func (f HandlerFunc) ServeHTTP(w *Response, r *Request) { f(w, r) } // Operation type Operation struct { method string name string description string handler Handler } func NewOp...
package ergo type Handler interface { ServeHTTP(*Response, *Request) } type HandlerFunc func(*Response, *Request) func (f HandlerFunc) ServeHTTP(w *Response, r *Request) { f(w, r) } // Operation type Operation struct { method string name string description string handler Handler schemes ...
Define schemes functions for Operation
Define schemes functions for Operation
Go
mit
wlMalk/ergo
db9dc306681fe5ee02de7447f160dead84568d47
sub/client/fetch.go
sub/client/fetch.go
package client import ( "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/sub" ) func fetch(client *srpc.Client, serverAddress string, hashes []hash.Hash) error { request := sub.FetchRequest{serverAddress, hashes} var reply sub.FetchResponse ...
package client import ( "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/lib/srpc" "github.com/Symantec/Dominator/proto/sub" ) func fetch(client *srpc.Client, serverAddress string, hashes []hash.Hash) error { request := sub.FetchRequest{ServerAddress: serverAddress, Hashes: hashes} var re...
Use named initialisers in sub/client.Fetch().
Use named initialisers in sub/client.Fetch().
Go
apache-2.0
keep94/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator
912bbe55b5a3e0288dc073f5416647434d8c59c1
types.go
types.go
package netconf type NetworkConfig struct { PreCmds []string `yaml:"pre_cmds,omitempty"` Dns DnsConfig `yaml:"dns,omitempty"` Interfaces map[string]InterfaceConfig `yaml:"interfaces,omitempty"` PostCmds []string `yaml:"post_cmds,omitempty"` } type I...
package netconf type NetworkConfig struct { PreCmds []string `yaml:"pre_cmds,omitempty"` Dns DnsConfig `yaml:"dns,omitempty"` Interfaces map[string]InterfaceConfig `yaml:"interfaces,omitempty"` PostCmds []string `yaml:"post_cmds,omitempty"` HttpProx...
Add proxy settings to NetworkConfig
Add proxy settings to NetworkConfig
Go
apache-2.0
rancher/netconf
89b6cc633cfe5c7d05d246e3a298e8b718e8777a
utils.go
utils.go
package main // import "eriol.xyz/piken" import ( "io" "net/http" "os" ) func download(url, output string) error { r, err := http.Get(url) if err != nil { return err } defer r.Body.Close() out, err := os.Create(output) if err != nil { return err } defer out.Close() // io.copyBuffer, the actual impl...
package main // import "eriol.xyz/piken" import ( "io" "net/http" "os" "github.com/Sirupsen/logrus" "github.com/mitchellh/go-homedir" ) func download(url, output string) error { r, err := http.Get(url) if err != nil { return err } defer r.Body.Close() out, err := os.Create(output) if err != nil { re...
Add a function to get user $HOME dir (cross platform)
Add a function to get user $HOME dir (cross platform)
Go
bsd-3-clause
eriol/piken
8994563c6d3fd46d9333d7560fe51761c8e7c17c
test/bugs/bug113.go
test/bugs/bug113.go
// $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed) // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type I interface { }; func foo1(i int) int { return i } func foo2(i int...
// $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed) // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type I interface { }; func foo1(i int) int { return i } func foo2(i int...
Call the right function for int32 values.
Call the right function for int32 values. R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=18073 CL=18073
Go
bsd-3-clause
tav/go,tav/go,tav/go,tav/go,tav/go,tav/go,tav/go
b7c9d3a292dc21878b26e437e4f2ed0e8ce911b9
prove_test.go
prove_test.go
package golog import . "github.com/mndrix/golog/term" import "testing" func TestFacts (t *testing.T) { db := NewDatabase(). Asserta(NewTerm("father", NewTerm("michael"))). Asserta(NewTerm("father", NewTerm("marc"))) t.Logf("%s\n", db.String()) // these should be provably true ...
package golog import "github.com/mndrix/golog/read" import "testing" func TestFacts (t *testing.T) { rt := read.Term_ db := NewDatabase(). Asserta(rt(`father(michael).`)). Asserta(rt(`father(marc).`)) t.Logf("%s\n", db.String()) // these should be provably true if !IsTrue...
Simplify prove tests with read.Term_
Simplify prove tests with read.Term_
Go
mit
samuell/golog,mndrix/golog,samuell/golog,bransorem/golog,mndrix/golog,bransorem/golog,vzaramel/golog,vzaramel/golog
393d60c08e460f3af329e3c2bd1d0e15df58e3fc
brokerapi/brokers/cloudsql/credentials_generator.go
brokerapi/brokers/cloudsql/credentials_generator.go
package cloudsql import ( "crypto/rand" "encoding/base64" "fmt" ) const ( maxUsernameLength = 16 // Limit from http://dev.mysql.com/doc/refman/5.7/en/user-names.html generatedPasswordLength = 32 ) func GenerateUsername(instanceID, bindingID string) (string, error) { if len(instanceID)+len(bindingID) == 0...
package cloudsql import ( "crypto/rand" "encoding/base64" "fmt" ) const ( maxUsernameLength = 16 // Limit from http://dev.mysql.com/doc/refman/5.7/en/user-names.html generatedPasswordLength = 32 ) func GenerateUsername(instanceID, bindingID string) (string, error) { if len(instanceID)+len(bindingID) == 0...
Switch the order of the bindingID/instanceID
Switch the order of the bindingID/instanceID Most likely the second guid will never make it into the string anyways so favor the more unique one.
Go
apache-2.0
joshlong/gcp-service-broker,GoogleCloudPlatform/gcp-service-broker,joshlong/gcp-service-broker,rifung/gcp-service-broker,rifung/gcp-service-broker,rifung/gcp-service-broker,GoogleCloudPlatform/gcp-service-broker,rifung/gcp-service-broker
ca4cbeca56eeff402465984327e61c0d1fd9a723
src/github.com/stellar/horizon/db/record_ledger.go
src/github.com/stellar/horizon/db/record_ledger.go
package db import ( "database/sql" sq "github.com/lann/squirrel" "time" ) var LedgerRecordSelect sq.SelectBuilder = sq. Select("hl.*"). From("history_ledgers hl") type LedgerRecord struct { HistoryRecord Sequence int32 `db:"sequence"` ImporterVersion int32 `db:"importer_version...
package db import ( "database/sql" sq "github.com/lann/squirrel" "time" ) var LedgerRecordSelect sq.SelectBuilder = sq.Select( "hl.id", "hl.sequence", "hl.importer_version", "hl.ledger_hash", "hl.previous_ledger_hash", "hl.transaction_count", "hl.operation_count", "hl.closed_at", "hl.created_at", "hl.upd...
Select history_ledger columns directly, to prep for more fields
Select history_ledger columns directly, to prep for more fields
Go
apache-2.0
masonforest/go-horizon,irisli/horizon,irisli/horizon,masonforest/horizon,masonforest/horizon,irisli/horizon,nullstyle/go-horizon,masonforest/horizon,stellar/horizon,nullstyle/go-horizon,stellar/horizon,masonforest/go-horizon,nullstyle/go-horizon,stellar/horizon,masonforest/go-horizon
13cf2a7d4342b448fc2722fb8e5e17f2cbd1bda4
src/eclus/enode.go
src/eclus/enode.go
package main import ( "flag" "github.com/goerlang/node" "log" ) var enableNode bool var nodeName string var nodeCookie string func init() { flag.BoolVar(&enableNode, "node", false, "start erlang node") flag.StringVar(&nodeName, "node-name", "", "name of erlang node") flag.StringVar(&nodeCookie, "node-cookie", ...
package main import ( "flag" "github.com/goerlang/node" "log" ) var enableNode bool var nodeName string var nodeCookie string var nodePort int func init() { flag.BoolVar(&enableNode, "node", false, "start erlang node") flag.StringVar(&nodeName, "node-name", "", "name of erlang node") flag.StringVar(&nodeCookie...
Add flag `-node-port` to specify TCP-port for distribution protocol
Add flag `-node-port` to specify TCP-port for distribution protocol
Go
mit
goerlang/eclus
0467af4b6f410ed145819955547637f704f15d21
pkg/apis/operator/v1alpha1/tektonconfig_defaults.go
pkg/apis/operator/v1alpha1/tektonconfig_defaults.go
/* Copyright 2021 The Tekton 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 2021 The Tekton 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...
Add param to enable/disable servicemonitor
[OpenShift] Add param to enable/disable servicemonitor This adds a param in TektonConfig & TektonPipeline to disable service monitor which is a part of TektonPipelines for OpenShift. Param will be added by default, user can change the value in TektonConfig to false to disable. Value is added in openshift extension a...
Go
apache-2.0
tektoncd/operator,tektoncd/operator,tektoncd/operator
9bdab6faa692cba4e5b21cf9563c41fce06e71ab
diego_errors/sanitization.go
diego_errors/sanitization.go
package diego_errors func SanitizeErrorMessage(message string) string { switch message { case INSUFFICIENT_RESOURCES_MESSAGE, MISSING_APP_BITS_DOWNLOAD_URI_MESSAGE, MISSING_APP_ID_MESSAGE, MISSING_TASK_ID_MESSAGE, NO_COMPILER_DEFINED_MESSAGE: return message default: return "staging failed" } }
package diego_errors func SanitizeErrorMessage(message string) string { switch message { case INSUFFICIENT_RESOURCES_MESSAGE, MISSING_APP_BITS_DOWNLOAD_URI_MESSAGE, MISSING_APP_ID_MESSAGE, MISSING_TASK_ID_MESSAGE, NO_COMPILER_DEFINED_MESSAGE, CELL_MISMATCH_MESSAGE: return message default: return "st...
Allow CELL_MISMATCH to flow back to the stager
Allow CELL_MISMATCH to flow back to the stager [#83638744] Signed-off-by: Michael Fraenkel <ba3744c471de6199d0515ce197b77e0dafd711ed@us.ibm.com>
Go
apache-2.0
cloudfoundry-incubator/runtime-schema
bfbdb15f555956fea7a377be30db31a4e231fb8d
command/swarm/leave.go
command/swarm/leave.go
package swarm import ( "fmt" "golang.org/x/net/context" "github.com/docker/docker/cli" "github.com/docker/docker/cli/command" "github.com/spf13/cobra" ) type leaveOptions struct { force bool } func newLeaveCommand(dockerCli *command.DockerCli) *cobra.Command { opts := leaveOptions{} cmd := &cobra.Command{...
package swarm import ( "fmt" "golang.org/x/net/context" "github.com/docker/docker/cli" "github.com/docker/docker/cli/command" "github.com/spf13/cobra" ) type leaveOptions struct { force bool } func newLeaveCommand(dockerCli *command.DockerCli) *cobra.Command { opts := leaveOptions{} cmd := &cobra.Command{...
Clarify usage of --force when used on a swarm manager
Clarify usage of --force when used on a swarm manager Fixes #26125 Signed-off-by: Misty Stanley-Jones <b9f9ef9e00c258208ea831c64cc129eda4ac78b4@docker.com>
Go
apache-2.0
Zebrilee/cli,allencloud/cli,thaJeztah/cli,ashfall/cli,thaJeztah/cli,cpuguy83/cli,dnephin/cli,riyazdf/cli,redpanda/cli,e11137/cli,Zebrilee/cli,gdevillele/cli,ashfall/cli,riyazdf/cli,dnephin/cli,docker/cli,cpuguy83/cli,e11137/cli,redpanda/cli,docker/cli,allencloud/cli
93a30e648f2001840c5768a840704f2859f85a80
util_test.go
util_test.go
package rev import ( "path" "path/filepath" "testing" ) func TestContentTypeByFilename(t *testing.T) { testCases := map[string]string{ "xyz.jpg": "image/jpeg", "helloworld.c": "text/x-c; charset=utf-8", "helloworld.": "application/octet-stream", "helloworld": "application/octet-stream", "hel...
package rev import ( "path" "path/filepath" "testing" ) func TestContentTypeByFilename(t *testing.T) { testCases := map[string]string{ "xyz.jpg": "image/jpeg", "helloworld.c": "text/x-c; charset=utf-8", "helloworld.": "application/octet-stream", "helloworld": "application/octet-stream", "hel...
Fix test to use new findSrcPaths
Fix test to use new findSrcPaths
Go
mit
zacklin923/revel,cavaliercoder/revel,marklap/revel,James0tang/revel,kaneshin/revel-revel,notzippy/revel,cw2018/revel,cw2018/revel,tempbottle/revel,Gazillion-Platform-Team/revel,robfig/revel,veliamsli/revel,jenalgit/revel,yext/revel,cavaliercoder/revel,zog/revel,Gazillion-Platform-Team/revel,veliamsli/revel,trigrass2/re...
4802cfd22e2ce8d1ee17e171c4543edcc000afe1
model/user.go
model/user.go
package model import ( "errors" "gopkg.in/mgo.v2/bson" ) // A user of the system type User struct { ID bson.ObjectId `json:"-" bson:"_id,omitempty"` Username string `json:"user-name" bson:"user-name"` } // GetID to satisfy jsonapi.MarshalIdentifier interface func (u User) GetID() string { ...
package model import "gopkg.in/mgo.v2/bson" // A user of the system type User struct { ID bson.ObjectId `json:"-" bson:"_id,omitempty"` Username string `json:"user-name" bson:"user-name"` } // GetID to satisfy jsonapi.MarshalIdentifier interface func (u User) GetID() string { return u.ID.Hex(...
Remove id check to debug travis CI
Remove id check to debug travis CI
Go
apache-2.0
LewisWatson/carshare-back
2940f98a891b236f31385344e48691d2e101c2fd
pkg/core/middleware/recover.go
pkg/core/middleware/recover.go
package middleware import ( "net/http" nextSkyerr "github.com/skygeario/skygear-server/pkg/core/skyerr" "github.com/skygeario/skygear-server/pkg/server/skyerr" ) // RecoverHandler provides an interface to handle recovered panic error type RecoverHandler func(http.ResponseWriter, *http.Request, skyerr.Error) // R...
package middleware import ( "net/http" nextSkyerr "github.com/skygeario/skygear-server/pkg/core/skyerr" "github.com/skygeario/skygear-server/pkg/server/skyerr" ) // RecoverHandler provides an interface to handle recovered panic error type RecoverHandler func(http.ResponseWriter, *http.Request, skyerr.Error) // R...
Fix wrong variable name in RecoverMiddleware
Fix wrong variable name in RecoverMiddleware
Go
apache-2.0
SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server
ea5db870b81b0f62a62e21f3c7cf2fedce051255
nsqhandler.go
nsqhandler.go
package nsqhandler import ( "sync" "time" "github.com/apex/log" ) var start = time.Now() type PublishFunc func(topic string, body []byte) error type MarshalFunc func(x interface{}) ([]byte, error) type Handler struct { mu sync.Mutex marshalFunc MarshalFunc publishFunc PublishFunc topic strin...
package nsqhandler import ( "sync" "time" "github.com/apex/log" ) var start = time.Now() type PublishFunc func(topic string, body []byte) error type MarshalFunc func(x interface{}) ([]byte, error) type Handler struct { mu sync.Mutex marshalFunc MarshalFunc publishFunc PublishFunc topic strin...
Return error in HandleLog from h.publishFunc
Return error in HandleLog from h.publishFunc
Go
bsd-3-clause
avct/apexovernsq
0f133ca6e5a18338f2782620d43d5be6148d2b61
apiserver/backups/info.go
apiserver/backups/info.go
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups import ( "github.com/juju/errors" "github.com/juju/juju/apiserver/params" ) func (b *API) Info(args params.BackupsInfoArgs) (params.BackupsMetadataResult, error) { var result params.BackupsMetadataResult ...
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups import ( "github.com/juju/errors" "github.com/juju/juju/apiserver/params" ) // Info provides the implementation of the API method. func (b *API) Info(args params.BackupsInfoArgs) (params.BackupsMetadataRes...
Add a missing doc comment.
Add a missing doc comment.
Go
agpl-3.0
wwitzel3/juju,dooferlad/juju,davecheney/juju,ericsnowcurrently/juju,frankban/juju,tasdomas/juju,jrwren/juju,cloud-green/juju,dimitern/juju,gabriel-samfira/juju,bac/juju,davecheney/juju,makyo/juju,howbazaar/juju,kat-co/juju,mikemccracken/juju,gabriel-samfira/juju,mhilton/juju,jrwren/juju,sinzui/juju,mhilton/juju,howbaza...
c8c481f32f876b848ba05a4dfef2e7f9ef08da9f
data/structs.go
data/structs.go
package data // Definition stores information about a system, used for importing data. type Definition struct { Title string Type string Env string Location string User string Password string URL string Notes string Tags []string } // YamlData stores information about all systems,...
package data // Definition stores information about a system, used for importing data. type Definition struct { Title string Type string Env string Location string User string Password string URL string Notes string Tags []string } // YamlData stores information about all systems,...
Hide the „IsValid“ property in JSON
Hide the „IsValid“ property in JSON
Go
apache-2.0
appPlant/alpinepass,appPlant/alpinepass
2909ffee3945d714a9a028f45066ae2f9a0b4761
xbmc/execute.go
xbmc/execute.go
package xbmc import ( "github.com/streamboat/xbmc_jsonrpc" . "github.com/pdf/xbmc-callback-daemon/log" ) // Execute takes an XBMC JSON-RPC Connection and a callback, and performs the // RPC request contained in the callback func Execute(x *xbmc_jsonrpc.Connection, callback map[string]interface{}) { Logger.Debug(`...
package xbmc import ( "github.com/StreamBoat/xbmc_jsonrpc" . "github.com/pdf/xbmc-callback-daemon/log" ) // Execute takes an XBMC JSON-RPC Connection and a callback, and performs the // RPC request contained in the callback func Execute(x *xbmc_jsonrpc.Connection, callback map[string]interface{}) { Logger.Debug(`...
Fix import case for StreamBoat/xbmc_jsonrpc
Fix import case for StreamBoat/xbmc_jsonrpc
Go
mit
pdf/kodi-callback-daemon,siam28/kodi-callback-daemon
36117bf0dd5eab601ee1996c6392f288efab81f6
virtualboxclient/medium.go
virtualboxclient/medium.go
package virtualboxclient import ( "github.com/appropriate/go-virtualboxclient/vboxwebsrv" ) type Medium struct { managedObjectId string } func (svc *VirtualBoxClient) CreateHardDisk(format, location string) (*Medium, error) { svc.Logon() request := vboxwebsrv.IVirtualBoxcreateHardDisk{This: svc.managedObjectId,...
package virtualboxclient import ( "github.com/appropriate/go-virtualboxclient/vboxwebsrv" ) type Medium struct { client *vboxwebsrv.VboxPortType managedObjectId string } func (svc *VirtualBoxClient) CreateHardDisk(format, location string) (*Medium, error) { svc.Logon() request := vboxwebsrv.IVirtualBo...
Add CreateBaseStorage and DeleteStorage to Medium
Add CreateBaseStorage and DeleteStorage to Medium
Go
mit
appropriate/go-virtualboxclient
759482113028cc097cf3ea5af9786a1f1ab13433
drivers/mgopw/mgo_test.go
drivers/mgopw/mgo_test.go
// Copyright 2015, Klaus Post, see LICENSE for details. package mgopw import ( "testing" "time" "github.com/klauspost/password/drivers" "gopkg.in/mgo.v2" ) // Test a Mongo database func TestMongo(t *testing.T) { session, err := mgo.DialWithTimeout("127.0.0.1:27017", time.Second) if err != nil { t.Skip("No d...
// Copyright 2015, Klaus Post, see LICENSE for details. package mgopw import ( "testing" "time" "github.com/klauspost/password/drivers" "gopkg.in/mgo.v2" ) // Test a Mongo database func TestMongo(t *testing.T) { session, err := mgo.DialWithTimeout("127.0.0.1:27017", time.Second) if err != nil { t.Skip("No d...
Extend timeouts on Mongo sessions to avoid random CI failures.
Extend timeouts on Mongo sessions to avoid random CI failures.
Go
mit
klauspost/password
93900216d8e5f73e0ffe16cbbc44ec4e1f3dca3a
example/multiview/main.go
example/multiview/main.go
package main import ( "github.com/marcusolsson/tui-go" ) func main() { var currentView int views := []tui.Widget{ tui.NewVBox(tui.NewLabel("Press right arrow to continue ...")), tui.NewVBox(tui.NewLabel("Almost there, one more time!")), tui.NewVBox(tui.NewLabel("Congratulations, you've finished the example!...
package main import ( "github.com/marcusolsson/tui-go" ) func main() { var currentView int views := []tui.Widget{ tui.NewVBox(tui.NewLabel("Press right arrow to continue ...")), tui.NewVBox(tui.NewLabel("Almost there, one more time!")), tui.NewVBox(tui.NewLabel("Congratulations, you've finished the example!...
Update to new keybinding API
multiview: Update to new keybinding API
Go
mit
marcusolsson/tui-go
cb9094a671d738607f9af4185c3b8bd722c69b93
api/routes.go
api/routes.go
package api import ( api "github.com/diyan/assimilator/api/endpoints" "github.com/labstack/echo" ) // RegisterAPIRoutes adds API routes to the Echo's route group func RegisterAPIRoutes(g *echo.Group) { // Organizations g.GET("/organizations/", api.OrganizationIndexGetEndpoint) g.GET("/organizations/:organizatio...
package api import ( api "github.com/diyan/assimilator/api/endpoints" mw "github.com/diyan/assimilator/api/middleware" "github.com/labstack/echo" ) // RegisterAPIRoutes adds API routes to the Echo's route group func RegisterAPIRoutes(g *echo.Group) { // Organizations g.GET("/organizations/", api.OrganizationInde...
Remove duplicated code from RegisterAPIRoutes
Remove duplicated code from RegisterAPIRoutes
Go
mit
diyan/assimilator,diyan/assimilator,diyan/assimilator
b542d297643b3872808a65c867e915fa0b6b36c9
app/service.go
app/service.go
package app import ( "github.com/go-kit/kit/log" "github.com/goph/emperror" ) // Service implements the RPC server type Service struct { logger log.Logger errorHandler emperror.Handler } // NewService creates a new service object func NewService(logger log.Logger, errorHandler emperror.Handler) *Service { ...
package app import ( "github.com/go-kit/kit/log" "github.com/goph/emperror" ) // Service implements the RPC server. type Service struct { Logger log.Logger ErrorHandler emperror.Handler } // NewService creates a new service object. func NewService() *Service { return &Service{ Logger: log.NewNopLo...
Make logger and error handler optional
Make logger and error handler optional
Go
mit
deshboard/boilerplate-grpc-service,deshboard/boilerplate-model-service
c24a3e389fc63a2cf3d51e0afd743047514ff1d5
cmd/run.go
cmd/run.go
package caddycmd import ( "log" "bitbucket.org/lightcodelabs/caddy2" ) // Main executes the main function of the caddy command. func Main() { err := caddy2.StartAdmin("127.0.0.1:1234") if err != nil { log.Fatal(err) } defer caddy2.StopAdmin() select {} }
package caddycmd import ( "log" "bitbucket.org/lightcodelabs/caddy2" ) // Main executes the main function of the caddy command. func Main() { addr := ":1234" // TODO: for dev only err := caddy2.StartAdmin(addr) if err != nil { log.Fatal(err) } defer caddy2.StopAdmin() log.Println("Caddy 2 admin endpoint l...
Change admin listener to :1234 for now; output message when listening
Change admin listener to :1234 for now; output message when listening
Go
apache-2.0
mholt/caddy,l3dlp/caddy,l3dlp/caddy,abiosoft/caddy,l3dlp/caddy,mholt/caddy,abiosoft/caddy
6ac9735e4a5b47830bdb2cdaf30bc0c20437157b
dmm/dmm.go
dmm/dmm.go
package dmm // Base may not be needed, but the idea is that there are some functions that // could be abstracted out to the general DMM. type Base interface { DCVolts() (v float64, err error) ACVolts() (v float64, err error) }
package dmm // MeasurementFunction provides the defined values for the Measurement Function defined in // Section 4.2.1 of IVI-4.2: IviDmm Class Specification. type MeasurementFunction int // The MeasurementFunction defined values are the available measurement functions. const ( DCVolts MeasurementFunction = iota A...
Add MeasurementFunction DMM defined values
Add MeasurementFunction DMM defined values
Go
mit
gotmc/ivi
12a3b3fe68cb7ecd7a4ed2d35a25a4ee65f57f1d
cmd/search.go
cmd/search.go
package cmd import ( "context" "fmt" "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/spf13/cobra" ) func init() { RootCmd.AddCommand(searchCommand) } var searchCommand = &cobra.Command{ Use: "search TERM", Short: "Search for packages on Docker Hub", RunE: func(cmd *cobra...
package cmd import ( "context" "fmt" "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/spf13/cobra" "sort" ) func init() { RootCmd.AddCommand(searchCommand) } var searchCommand = &cobra.Command{ Use: "search [TERM]", Short: "Search for packages on Docker Hub", Long: "Sea...
Support for listing all packages
Support for listing all packages
Go
apache-2.0
3846masa/whalebrew,3846masa/whalebrew