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
a102f95bc8bf2b00c7dd63481a9d629354a82526
todo.go
todo.go
package main import ( "log" "net/http" "github.com/gorilla/mux" ) const ( PORT = ":8080" ) func main() { router := mux.NewRouter() router.HandleFunc("/", roothandler) err := http.ListenAndServe(PORT, router) if err != nil { log.Fatal(err) } }
package main import ( "log" "net/http" "github.com/gorilla/mux" ) const ( PORT = ":8080" ) func rootHandler(w http.responsewriter, r *http.request) { } func todoHandler(w http.responsewriter, r *http.request) { } func addHandler(w http.responsewriter, r *http.request) { } func editHandler(w http.responsew...
Add base routes and base functions
Add base routes and base functions
Go
mit
ewhal/Todolist,ewhal/Todolist
8dcf62b827456a8196199798b395fd736e631355
uuid.go
uuid.go
// Package uuid creates pseudo uuid by using crypto/rand. package uuid import ( "crypto/rand" "fmt" ) var ( DEBUG bool = false // Enable / disable debug messages from this package. ) // New() creates pseudo uuid. func New() (uuid string, err error) { b := make([]byte, 16) _, err = rand.Read(b) if err != nil {...
// Package uuid creates pseudo uuid by using crypto/rand. package uuid import ( "crypto/rand" "fmt" ) var ( DEBUG bool = false // Enable / disable debug messages from this package. ) // New creates pseudo uuid. func New() (uuid string, err error) { b := make([]byte, 16) _, err = rand.Read(b) if err != nil { ...
Fix func names in comments to remove golint warnings.
Fix func names in comments to remove golint warnings.
Go
mit
northbright/uuid
bf2cd93f50aac0e50acd68d17a2e3c80ca6ed623
ironclad/cmd-tags.go
ironclad/cmd-tags.go
package main import ( "fmt" "os" "path/filepath" "github.com/dmulholland/clio/go/clio" "sort" ) // Help text for the 'tags' command. var tagsHelp = fmt.Sprintf(` Usage: %s tags [FLAGS] [OPTIONS] List the tags in a database. Options: -f, --file <str> Database file. Defaults to the ...
package main import ( "fmt" "os" "path/filepath" "github.com/dmulholland/clio/go/clio" "sort" ) // Help text for the 'tags' command. var tagsHelp = fmt.Sprintf(` Usage: %s tags [FLAGS] [OPTIONS] List the tags in a database. Options: -f, --file <str> Database file. Defaults to the ...
Fix tag command when empty
Fix tag command when empty
Go
mit
dmulholland/ironclad
5ae6f6de53b7cd0f22d1979ac9c76450e6c214e6
example_test.go
example_test.go
package struct_mommy_test import ( "fmt" "github.com/mrfuxi/struct-mommy" ) type MyStruct struct { FieldA float32 FieldB uint8 } func ExampleMake() { obj := MyStruct{} struct_mommy.SetSeed(26) struct_mommy.Make(&obj) fmt.Printf("FieldA %v\nFieldB %v", obj.FieldA, obj.FieldB) //...
package struct_mommy_test import ( "fmt" "github.com/mrfuxi/struct-mommy" ) type MyStruct struct { FieldA float32 FieldB uint8 } func ExampleMake() { obj := MyStruct{} struct_mommy.SetSeed(26) struct_mommy.Make(&obj) fmt.Printf("FieldA %v\nFieldB %v", obj.FieldA, obj.FieldB) //...
Add example for using Define
Add example for using Define
Go
mit
mrfuxi/struct-mommy
50c1804b294cfdebf84285c312124583867d3e34
main.go
main.go
package main import ( "log" "net/http" ) func main() { var g GMHook err := http.ListenAndServe("localhost:4000", g) if err != nil { log.Fatal(err) } }
package main import ( "log" "net/http" "os" ) func main() { var g GMHook err := http.ListenAndServe(":"+os.Getenv("PORT"), g) if err != nil { log.Fatal(err) } }
Make sure to bind to the correct port
Make sure to bind to the correct port
Go
mit
NelsonLeDuc/CalmanBot,NelsonLeDuc/CalmanBot
1b21288e1f9975f7c2be2e9fe248f64235764ec4
misc.go
misc.go
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) cmdReader, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer cmdReader.Close() scanner := bufio...
package main import ( "bufio" "fmt" "log" "os" "os/exec" ) func executeCmd(command string, args ...string) { cmd := exec.Command(command, args...) stdOut, err := cmd.StdoutPipe() if err != nil { log.Fatal(os.Stderr, "Error creating StdoutPipe for Cmd", err) } defer stdOut.Close() scanner := bufio.NewS...
Add listening to the std out as well.
Add listening to the std out as well.
Go
mit
go-playground/generate
d823e5336f389c85c00eedca7220f50adaa85a6a
tour/content/concurrency/mutex-counter.go
tour/content/concurrency/mutex-counter.go
// +build OMIT package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { v map[string]int mux sync.Mutex } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mux.Lock() // Lock so only one goroutine at a time ca...
// +build OMIT package main import ( "fmt" "sync" "time" ) // SafeCounter is safe to use concurrently. type SafeCounter struct { mu sync.Mutex v map[string]int } // Inc increments the counter for the given key. func (c *SafeCounter) Inc(key string) { c.mu.Lock() // Lock so only one goroutine at a time can a...
Rename mux -> mu to follow convention
[x/tour] tour: Rename mux -> mu to follow convention Nearly all sync.Mutex members in the standard library are named mu, or use "mu" as part of the name. While this isn't a documented recommendation anywhere that I can find, it would seem nice to start new users with this same convention. Change-Id: I67cbe2a0052b81d8...
Go
bsd-3-clause
golang/website,golang/website,golang/website,golang/website,golang/website,golang/website,golang/website
1bce3acd3c0fcfdf7334c9e4e47ca23d772d4280
helpers/load.go
helpers/load.go
package helpers import ( "html/template" "github.com/acsellers/multitemplate" ) // Available helper modules "forms", "general", "link", "asset" func LoadHelpers(modules ...string) { loadFuncs(coreFuncs) for _, module := range modules { switch module { case "all": loadFuncs(formTagFuncs) loadFuncs(selec...
package helpers import ( "html/template" "github.com/acsellers/multitemplate" ) // Available helper modules "forms", "general", "link", "asset" func LoadHelpers(modules ...string) { loadFuncs(coreFuncs) for _, module := range modules { switch module { case "all": loadFuncs(formTagFuncs) loadFuncs(selec...
Add new way to retrieve functions from helpers
Add new way to retrieve functions from helpers
Go
bsd-2-clause
acsellers/multitemplate,acsellers/multitemplate
bee300e66d31c2c5f87b391c915cea7bd9261679
decorator/versioning.go
decorator/versioning.go
package decorator import ( "time" sparta "github.com/mweagle/Sparta" gocf "github.com/mweagle/go-cloudformation" "github.com/sirupsen/logrus" ) // LambdaVersioningDecorator returns a TemplateDecorator // that is responsible for including a versioning resource // with the given lambda function func LambdaVersioni...
package decorator import ( "context" "time" sparta "github.com/mweagle/Sparta" gocf "github.com/mweagle/go-cloudformation" "github.com/sirupsen/logrus" ) // LambdaVersioningDecorator returns a TemplateDecorator // that is responsible for including a versioning resource // with the given lambda function func Lam...
Update decorators to new signature
Update decorators to new signature
Go
mit
mweagle/Sparta,mweagle/Sparta,mweagle/Sparta,mweagle/Sparta
ec422fd4080b7b5e21415c32c0615c5afc109695
egpath/src/stm32/hal/tim/instances-f3.go
egpath/src/stm32/hal/tim/instances-f3.go
// +build f030x6 package tim import ( "unsafe" "stm32/hal/raw/mmap" ) //emgo:const var ( // Advanced-control timers. TIM1 = (*Periph)(unsafe.Pointer(mmap.TIM1_BASE)) // General-purpose timers. TIM3 = (*Periph)(unsafe.Pointer(mmap.TIM3_BASE)) // General-purpose timers (1-channel). TIM14 = (*Periph)(unsafe....
// +build f303xe package tim import ( "unsafe" "stm32/hal/raw/mmap" ) //emgo:const var ( // Advanced-control timers. TIM1 = (*Periph)(unsafe.Pointer(mmap.TIM1_BASE)) TIM8 = (*Periph)(unsafe.Pointer(mmap.TIM8_BASE)) TIM20 = (*Periph)(unsafe.Pointer(mmap.TIM20_BASE)) // General-purpose timers. TIM2 = (*Pe...
Fix timer instances for F3.
stm32/hal/tim: Fix timer instances for F3.
Go
bsd-3-clause
ziutek/emgo,ziutek/emgo,ziutek/emgo,ziutek/emgo
c5ee55e74ceefec7148ed8f0587328a94f4bde7b
exporter/reader_unix.go
exporter/reader_unix.go
package exporter import ( "net" "net/url" "time" "github.com/prometheus/common/log" ) // UnixStatsReader reads uwsgi stats from specified unix socket. type UnixStatsReader struct { filename string } func init() { StatsReaderCreators = append(StatsReaderCreators, newHTTPStatsReader) } func newUnixStatsReader(...
package exporter import ( "net" "net/url" "time" "github.com/prometheus/common/log" ) // UnixStatsReader reads uwsgi stats from specified unix socket. type UnixStatsReader struct { filename string } func init() { StatsReaderCreators = append(StatsReaderCreators, newUnixStatsReader) } func newUnixStatsReader(...
Fix wrong unix socket handler
Fix wrong unix socket handler
Go
apache-2.0
timonwong/uwsgi_exporter
571bad4bf39576e70e4a4278ba5753a1b59126a1
nonce.go
nonce.go
package shadowfax import ( "crypto/rand" "io" "gopkg.in/basen.v1" "gopkg.in/errgo.v1" ) // Nonce is a 24-byte number that should be used once per message. type Nonce [24]byte // DecodeNonce decodes a nonce from its Base58 string representation. func DecodeNonce(s string) (*Nonce, error) { var nonce Nonce buf,...
package shadowfax import ( "crypto/rand" "io" "gopkg.in/basen.v1" "gopkg.in/errgo.v1" ) // Nonce is a 24-byte number that should be used once per message. type Nonce [24]byte // DecodeNonce decodes a nonce from its Base58 string representation. func DecodeNonce(s string) (*Nonce, error) { var nonce Nonce buf,...
Remove length assertion, since leading zeroes are not encoded.
Remove length assertion, since leading zeroes are not encoded.
Go
mpl-2.0
cmars/shadowfax,cmars/shadowfax
0663ffd381df7599c7e3961e8638ded0e322b267
tools/retrieveTruststoreFromCADatabase.go
tools/retrieveTruststoreFromCADatabase.go
package main import ( "encoding/csv" "fmt" "log" "net/http" "os" "strings" ) func main() { var ( truststore, csvURL string csvPEMPos int ) if len(os.Args) != 2 { log.Fatalf("usage: %s <mozilla|microsoft>", os.Args[0]) } truststore = os.Args[1] switch truststore { case "mozilla": csvURL =...
package main import ( "encoding/csv" "fmt" "log" "net/http" "os" "strings" ) func main() { var ( truststore, csvURL string csvPEMPos int ) if len(os.Args) != 2 { log.Fatalf("usage: %s <mozilla|microsoft>", os.Args[0]) } truststore = os.Args[1] switch truststore { case "mozilla": csvURL =...
Fix CCADB URLs in truststore retriever
Fix CCADB URLs in truststore retriever
Go
mpl-2.0
jasonthomas/tls-observatory,jasonthomas/tls-observatory,jasonthomas/tls-observatory,mozilla/tls-observatory,jasonthomas/tls-observatory,mozilla/tls-observatory,mozilla/tls-observatory,mozilla/tls-observatory,mozilla/TLS-Observer,jasonthomas/tls-observatory,mozilla/tls-observatory
a294062f368e5e664ce963c8b47fd438bd77918c
core/app/linker/linker_windows.go
core/app/linker/linker_windows.go
// Copyright (C) 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
// Copyright (C) 2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
Fix build failure on windows.
core/app/linker: Fix build failure on windows. Return value was of wrong type
Go
apache-2.0
google/agi,google/gapid,google/gapid,pmuetschard/gapid,Qining/gapid,google/agi,google/gapid,pmuetschard/gapid,pmuetschard/gapid,google/agi,google/agi,Qining/gapid,Qining/gapid,google/agi,pmuetschard/gapid,google/agi,Qining/gapid,google/gapid,pmuetschard/gapid,Qining/gapid,google/gapid,google/agi,google/gapid,pmuetschar...
d2cdac161786fb999e0f563960a81c376c2246fc
parse.go
parse.go
package i18n import ( "net/http" "golang.org/x/text/language" ) // A Parser is a funcion that returns a list of accepted languages, most preferred first. type Parser func(*http.Request) []language.Tag // ParseAcceptLanguage parses the Accept-Language header. func ParseAcceptLanguage(r *http.Request) []language.Ta...
package i18n import ( "net/http" "golang.org/x/text/language" ) // A Parser is a funcion that returns a list of accepted languages, most preferred first. type Parser func(*http.Request) []language.Tag // ParseAcceptLanguage parses the Accept-Language header. func ParseAcceptLanguage(r *http.Request) []language.Ta...
Add ParseCookie and handle parsing errors
Add ParseCookie and handle parsing errors
Go
mit
gowww/i18n
e8da1c83e67a92854a4c6024567d7a4c4578a3da
tools.go
tools.go
package tools import ( "crypto/hmac" "crypto/sha256" "encoding/base64" "strings" "unicode" "unicode/utf8" ) func ComputeHmac256(message string, secret string) string { key := []byte(secret) h := hmac.New(sha256.New, key) h.Write([]byte(message)) return base64.StdEncoding.EncodeToString(h.Sum(nil)) } func C...
package tools import ( "crypto/hmac" "crypto/sha256" "encoding/base64" "strings" "unicode" "unicode/utf8" ) func ComputeHmac256(message string, secret string) string { key := []byte(secret) h := hmac.New(sha256.New, key) h.Write([]byte(message)) return base64.StdEncoding.EncodeToString(h.Sum(nil)) } func C...
Add new case insensitive string contains
Add new case insensitive string contains
Go
mit
scritch007/go-tools
f54319b8b0e0445c21300ada1b3e6f32c60adb94
datastructure/graph/graph.go
datastructure/graph/graph.go
package graph type Vertex struct{} type Edge struct { start Vertex end Vertex } type Graph struct{} func New() *Graph { return &Graph{} } func (g *Graph) Edges(v *Vertex) []*Edge { return nil }
package graph type Vertex struct{} type Edge struct { start Vertex end Vertex } type Graph struct { // All vertexes this Graph has vertexes *vertexSet // Edges per vertex edges map[*Vertex][]*Edge } func New() *Graph { return &Graph{ vertexes: NewVertexSet(100), edges: make(map[*Vertex][]*Edge, 100)...
Add vertexSet and implement Edges method
Add vertexSet and implement Edges method
Go
mit
oinume/algo,oinume/algo
4084b81bd81d38eae24f8cdeff3faf8d75ebd4b9
v1/tasks/validate.go
v1/tasks/validate.go
package tasks import ( "errors" "reflect" ) var ( // ErrTaskMustBeFunc ... ErrTaskMustBeFunc = errors.New("Task must be a func type") // ErrTaskReturnsNoValue ... ErrTaskReturnsNoValue = errors.New("Taks must return at least a single value") // ErrLastReturnValueMustBeError .. ErrLastReturnValueMustBeError = ...
package tasks import ( "errors" "reflect" ) var ( // ErrTaskMustBeFunc ... ErrTaskMustBeFunc = errors.New("Task must be a func type") // ErrTaskReturnsNoValue ... ErrTaskReturnsNoValue = errors.New("Task must return at least a single value") // ErrLastReturnValueMustBeError .. ErrLastReturnValueMustBeError = ...
Fix typo in error message
Fix typo in error message
Go
mpl-2.0
RichardKnop/machinery,RichardKnop/machinery
fe764f09ca3f776eee1f5b5dfa680502f9ae4ede
cloudwatch/client_test.go
cloudwatch/client_test.go
package cloudwatch import ( "os" "testing" ) func TestDefaultSessionConfig(t *testing.T) { cases := []struct { expected string export bool exportVar string exportVal string }{ { expected: "us-east-1", export: false, exportVar: "", exportVal: "", }, { expected: "ap-southeast-1...
package cloudwatch import ( "os" "testing" ) func TestDefaultSessionConfig(t *testing.T) { // Cleanup before the test os.Unsetenv("AWS_DEFAULT_REGION") os.Unsetenv("AWS_REGION") cases := []struct { expected string export bool exportVar string exportVal string }{ { expected: "us-east-1", e...
Update the client test to clean up before tests
Update the client test to clean up before tests
Go
mit
full360/cuckoo,full360/cuckoo
d2983fa99b50c54473920034ab2789b9d2517c8b
app/controllers/init.go
app/controllers/init.go
package controllers import ( "github.com/jgraham909/revmgo" "github.com/robfig/revel" "html/template" ) func init() { revel.TemplateFuncs["add"] = func(a, b int) int { return a + b } revel.TemplateFuncs["get"] = func(a []string, b int) string { return a[b] } revel.TemplateFuncs["html"] = func(s string) template...
package controllers import ( "github.com/jgraham909/revmgo" "github.com/robfig/revel" "html/template" "strings" ) func init() { revel.TemplateFuncs["add"] = func(a, b int) int { return a + b } revel.TemplateFuncs["get"] = func(a []string, b int) string { return a[b] } revel.TemplateFuncs["html"] = func(s strin...
Add html cleaning function as workaround
Add html cleaning function as workaround
Go
mit
shawnps/nihongo,gojp/nihongo,shawnps/nihongo,gojp/nihongo,gojp/nihongo,shawnps/nihongo,gojp/nihongo,shawnps/nihongo
18a691f8dabe1d59554ced1e7f55e91c9409cda5
channels/Thermostat.go
channels/Thermostat.go
package channels type ThermoStatActuator interface { SetTemperatureSetPoint(float64) error } type ThermoStatState struct { Target *float64 `json:"target,omitempty"` } type ThermoStatChannel struct { baseChannel actuator ThermoStatActuator } func NewThermoStatChannel(actuator ThermoStatActuator) *ThermoStatChann...
package channels type ThermoStatActuator interface { SetTemperatureSetPoint(float64) error } type ThermoStatChannel struct { baseChannel actuator ThermoStatActuator } func NewThermoStatChannel(actuator ThermoStatActuator) *ThermoStatChannel { return &ThermoStatChannel{ baseChannel: baseChannel{protocol: "therm...
Make thermostat state just a float64
Make thermostat state just a float64
Go
mit
ninjasphere/go-ninja,ninjasphere/go-ninja
58c332e6cc2c4970735b85a7bab925a45f69c932
uuid_test.go
uuid_test.go
package uuid_test import ( "fmt" "github.com/northbright/uuid" ) func ExampleNew() { for i := 0; i < 5; i++ { uuid, _ := uuid.New() fmt.Printf("%v\n", uuid) } // Output: }
package uuid_test import ( "log" "github.com/northbright/uuid" ) func ExampleNew() { for i := 0; i < 5; i++ { uuid, _ := uuid.New() log.Printf("%v", uuid) } // Output: }
Replace fmt with log to fix test fail
Replace fmt with log to fix test fail
Go
mit
northbright/uuid
a1aa950fb558475b53fe37e6c3fbc141bb51a2d9
source_test.go
source_test.go
package stripe import ( "testing" assert "github.com/stretchr/testify/require" "github.com/stripe/stripe-go/form" ) func TestSourceObjectParams_AppendTo(t *testing.T) { // Test to make sure that TypeData makes it to the root object level of // encoding { params := &SourceObjectParams{ TypeData: map[string...
package stripe import ( "testing" assert "github.com/stretchr/testify/require" "github.com/stripe/stripe-go/form" ) func TestSourceObjectParams_AppendTo(t *testing.T) { // Test to make sure that TypeData makes it to the root object level of // encoding { params := &SourceObjectParams{ Type: "source_type",...
Fix source test to properly verify TypeData encoding
Fix source test to properly verify TypeData encoding
Go
mit
ChannelMeter/stripe-go,stripe/stripe-go,stripe/stripe-go,ChannelMeter/stripe-go
29855b2c742a3cad0c8a3bf7002eadf22116b5ba
stream/river/consts.go
stream/river/consts.go
package river import "github.com/synapse-garden/sg-proto/store" // Survey is a survey request constant. type Survey []byte // Response is a response request constant (may be suffixed with an ID.) type Response []byte var ( // Byte request / response constants. HUP = Survey("HUP") OK = Response("OK") UN...
package river import "github.com/synapse-garden/sg-proto/store" // Survey is a survey request constant. type Survey []byte // Response is a response request constant (may be suffixed with an ID.) type Response []byte var ( // Byte request / response constants. HUP = Survey("HUP") OK = Response("OK") UN...
Add rivers.ResponderBucket for responder hangups
Add rivers.ResponderBucket for responder hangups
Go
agpl-3.0
synapse-garden/sg-proto
3e7cb3760f58c939eb9a6348f4407cf85c4f2d9b
templates/_appengine/main_appengine.go
templates/_appengine/main_appengine.go
// +build appengine package main import ( "net/http" "sync" "time" _ "gnd.la/admin" // required for make-assets command _ "gnd.la/blobstore/driver/gcs" // enable Google Could Storage blobstore driver _ "gnd.la/cache/driver/memcache" // enable memcached cache driver // Uncomment the following ...
// +build appengine package main import ( "net/http" "sync" "time" _ "gnd.la/blobstore/driver/gcs" // enable Google Could Storage blobstore driver _ "gnd.la/cache/driver/memcache" // enable memcached cache driver _ "gnd.la/commands" // required for make-assets command // Uncomment the following ...
Update import in GAE template
Update import in GAE template
Go
apache-2.0
rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb,rainycape/gondolaweb
c137bea82b2bb5c762e0b3bfe86df4164dcf3570
tools/iit/main_test.go
tools/iit/main_test.go
package main import ( "fmt" "testing" ) func TestTax2011QuickDeduction(t *testing.T) { fmt.Println("Year 2011:") afterTax, qdWithTax := tax2011QuickDeduction(0) fmt.Printf("Atfer Tax:%v\n", afterTax) for k, v := range qdWithTax { if k > 0 { fmt.Printf("%v: %v\n", k/12.0, v) } } afterTax, qdWithoutTax ...
package main import ( "fmt" "testing" ) func TestTax2011QuickDeduction(t *testing.T) { fmt.Println("Year 2011:") rate := tax2011Rate() beforeTax := []float64{ 18000, 54000, 108000, 420000, 660000, 960000, -1, } afterTax, qdWithTax := quickDeduction(0, beforeTax, rate) fmt.Printf("Atfer Tax:%v\n"...
Update individual income tax test case
Update individual income tax test case
Go
mit
MarsBighead/garden,MarsBighead/garden,MarsBighead/garden,MarsBighead/garden
b3a94b09e765ea41dac080e8a567038215d8793d
main.go
main.go
package main import ( "log" "fmt" "os" "net/http" "github.com/julienschmidt/httprouter" ) func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { fmt.Fprintln(w, "HTTP working over a socket!") } func Test(w http.ResponseWriter, r * http.Request, params httprouter.Params) { fmt.Fprintln(w, pa...
package main import ( "log" "fmt" "os" "net/http" "github.com/julienschmidt/httprouter" ) func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { fmt.Println("Index!") fmt.Fprintln(w, "HTTP working over a socket!") } func Test(w http.ResponseWriter, r * http.Request, params httprouter.Params...
Put socket in its own directory inside /tmp
Put socket in its own directory inside /tmp
Go
mit
nikelmwann/dokku-api-server
1f49df9e2d9ccfee83a69c75cc6d8f9953a98866
main.go
main.go
package main import "net/http" import "os" import "strings" import "fmt" func main() { port := os.Getenv("PORT") if port == "" { port = "8080" } http.HandleFunc("/", IpResponse) http.ListenAndServe(":" + port, nil) } func IpResponse(response http.ResponseWriter, request *http.Request) { ...
package main import "net/http" import "os" import "strings" import "fmt" func main() { port := os.Getenv("PORT") if port == "" { port = "8080" } http.HandleFunc("/", IpResponse) http.ListenAndServe(":" + port, nil) } func IpResponse(response http.ResponseWriter, request *http.Request) { ...
Add support for ipv6 (which has colons in the IP address)
Add support for ipv6 (which has colons in the IP address)
Go
apache-2.0
mhotchen/IP-echo,mhotchen/IP-echo
c061fab7f4ea14496fbc0b25f269dc3f6815d8cd
models/datacenter/get_deployment_capabilities.go
models/datacenter/get_deployment_capabilities.go
package datacenter type GetDCReq struct { DataCenter string `valid:"required" URIParam:"yes"` } type GetDCRes struct { SupportsPremiumStorage bool SupportsSharedLoadBalancer bool DeployableNetworks []DeployableNetwork Templates []Template } type DeployableNetwork struct { Name ...
package datacenter type GetDCReq struct { DataCenter string `valid:"required" URIParam:"yes"` } type GetDCRes struct { SupportsPremiumStorage bool SupportsSharedLoadBalancer bool SupportsBareMetalServers bool DeployableNetworks []DeployableNetwork Templates []Template ImportableO...
Add some newly appeared props of the deployment capabilities response
Add some newly appeared props of the deployment capabilities response
Go
apache-2.0
CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli
233bcd0bc57c9a12f893f6901bbf60aa30ddcd43
main.go
main.go
package main import ( "os" "github.com/facebookgo/grace/gracehttp" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ Skipper: middleware.DefaultSkipper, Format: "{\"time\"\":\"${time_rfc3339_nano}\",...
package main import ( "os" "github.com/facebookgo/grace/gracehttp" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ Skipper: middleware.DefaultSkipper, Format: "{\"time\":\"${time_rfc3339_nano}\", \...
Remove extra " in logger
Remove extra " in logger
Go
mit
hasit/healthyrepo,hasit/healthyrepo,hasit/healthyrepo
41abeb15720a7c64de3cf7d9f814f14da60d6bcc
main.go
main.go
// Cozy Cloud is a personal platform as a service with a focus on data. // Cozy Cloud can be seen as 4 layers, from inside to outside: // // 1. A place to keep your personal data // // 2. A core API to handle the data // // 3. Your web apps, and also the mobile & desktop clients // // 4. A coherent User Experience // /...
// Cozy Cloud is a personal platform as a service with a focus on data. // Cozy Cloud can be seen as 4 layers, from inside to outside: // // 1. A place to keep your personal data // // 2. A core API to handle the data // // 3. Your web apps, and also the mobile & desktop clients // // 4. A coherent User Experience // /...
Use Error instead of Errorf
Use Error instead of Errorf
Go
agpl-3.0
sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,nono/cozy-stack,sebn/cozy-stack,nono/cozy-stack,nono/cozy-stack,sebn/cozy-stack,sebn/cozy-stack
f74d0221876b5e405c0b5b2fd30eb765812d80ce
main.go
main.go
package main func main() { ci, err := apiConn.allCommits() if err != nil { panic(err) } sortedMsg, _ := sortedChangeLogMessages(ci) //fmt.Printf("Sorted messages:\n%+v\n", sortedMsg) err = generateChangeLogHTML(sortedMsg, "ChangeLog.html") if err != nil { panic(err) } }
package main import "flag" func init() { flag.StringVar(&configInfo.ToSha, "ToSha", configInfo.ToSha, "Set commit hash up to which the change log should be generated") } func main() { flag.Parse() ci, err := apiConn.allCommits() if err != nil { panic(err) } sortedMsg, _ := sortedChangeLogMessages(ci) er...
Enable to set the ToSha hash as a command line option.
Enable to set the ToSha hash as a command line option.
Go
apache-2.0
hheld/ChangeLogFromGitLab
feebe72c1302d3abb3d1bd88585a18f40e3e505b
main.go
main.go
package main import ( "flag" "fmt" "log" "net/http" "strconv" "github.com/rtwire/mock/service" ) var ( port = flag.Int("port", 8085, "service port number") ) func main() { flag.Parse() url := fmt.Sprintf("http://localhost:%d/v1/mainnet/", *port) log.Printf("RTWire service running at %s.", url) addr := ...
package main import ( "flag" "fmt" "log" "net/http" "github.com/rtwire/mock/service" ) var ( addr = flag.String("addr", ":8085", "service address") ) func main() { flag.Parse() url := fmt.Sprintf("http://%s/v1/mainnet/", *addr) log.Printf("RTWire service running at %s.", url) log.Fatal(http.ListenAndSer...
Allow mock to use user specified interface.
Allow mock to use user specified interface.
Go
apache-2.0
rtwire/mock,rtwire/mock
259b3710676492aa98d03afcd14b96c81d098a31
auth/bitbucket/repository_verifier.go
auth/bitbucket/repository_verifier.go
package bitbucket import ( "code.cloudfoundry.org/lager" "github.com/concourse/atc/auth/verifier" "net/http" ) type RepositoryVerifier struct { repositories []RepositoryConfig bitbucketClient Client } func NewRepositoryVerifier(repositories []RepositoryConfig, bitbucketClient Client) verifier.Verifier { ret...
package bitbucket import ( "code.cloudfoundry.org/lager" "github.com/concourse/atc/auth/verifier" "net/http" ) type RepositoryVerifier struct { repositories []RepositoryConfig bitbucketClient Client } func NewRepositoryVerifier(repositories []RepositoryConfig, bitbucketClient Client) verifier.Verifier { ret...
Remove debug logs that were used during development
Remove debug logs that were used during development
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
c349796fef8530d4eb58b417887c314e2fd4465c
errors.go
errors.go
package gocaa import ( "fmt" "net/url" ) type HTTPError struct { StatusCode int Url *url.URL } func (e HTTPError) Error() string { return fmt.Sprintf("%i on %s", e.StatusCode, e.Url.String()) } type InvalidImageSizeError struct { Entitytype string Size int } func (e InvalidImageSizeError) Error...
package gocaa import ( "fmt" "net/url" ) type HTTPError struct { StatusCode int Url *url.URL } func (e HTTPError) Error() string { return fmt.Sprintf("%d on %s", e.StatusCode, e.URL.String()) } type InvalidImageSizeError struct { Entitytype string Size int } func (e InvalidImageSizeError) Error...
Use the correct identifier in Sprintf calls
Use the correct identifier in Sprintf calls
Go
mit
mineo/gocaa
40d4b8e4b1d8d56fc76fec4b0881d99a7970d01f
asciitosvg_test.go
asciitosvg_test.go
// Copyright 2012 - 2015 The ASCIIToSVG Contributors // All rights reserved. package asciitosvg import "testing" func TestNewCanvas(t *testing.T) { data := ` +------+ |Editor|-------------+--------+ +------+ | | | | v v | ...
// Copyright 2012 - 2015 The ASCIIToSVG Contributors // All rights reserved. package asciitosvg import "testing" func TestNewCanvas(t *testing.T) { data := ` +------+ |Editor|-------------+--------+ +------+ | | | | v v | ...
Test complex polygons and nonsensical nested boxes
Test complex polygons and nonsensical nested boxes
Go
mit
asciitosvg/asciitosvg
a384051af7393a915ecab903e118f9722ea04069
graph.go
graph.go
// gogl provides a framework for representing and working with graphs. package gogl // Constants defining graph capabilities and behaviors. const ( E_DIRECTED, EM_DIRECTED = 1 << iota, 1 << iota - 1 E_UNDIRECTED, EM_UNDIRECTED E_WEIGHTED, EM_WEIGHTED E_TYPED, EM_TYPED E_SIGNED, EM_SIGNED E_LOOPS, EM_LOOPS ...
// gogl provides a framework for representing and working with graphs. package gogl // Constants defining graph capabilities and behaviors. const ( E_DIRECTED, EM_DIRECTED = 1 << iota, 1 << iota - 1 E_UNDIRECTED, EM_UNDIRECTED E_WEIGHTED, EM_WEIGHTED E_TYPED, EM_TYPED E_SIGNED, EM_SIGNED E_LOOPS, EM_LOOPS ...
Replace Edge interface with basic struct, add Size and Order methods.
Replace Edge interface with basic struct, add Size and Order methods.
Go
mit
sdboyer/gogl,sdboyer/gogl
b568dcfc06924b832f132f5c028fd61daa3b1755
logo.go
logo.go
package main import ( "os" "fmt" "path/filepath" "os/exec" ) func main() { workingDirectory, error := os.Getwd() if error != nil { fmt.Println(error) os.Exit(1) } workingDirectory, error = filepath.Abs(workingDirectory) if error != nil { fmt.Println(error) os.Exit(1) } os.Setenv("GOPATH", worki...
package main import ( "os" "fmt" "path/filepath" "os/exec" ) func main() { workingDirectory, error := os.Getwd() if error != nil { fmt.Println(error) os.Exit(1) } workingDirectory, error = filepath.Abs(workingDirectory) if error != nil { fmt.Println(error) os.Exit(1) } os.Setenv("GOPATH", worki...
Make sure that we exit with a non-zero status if the command fails
Make sure that we exit with a non-zero status if the command fails
Go
mit
nate/logo
9592c3148aba5ebfe0e6ef1d30b91c86d65ca639
src/github.com/stellar/horizon/db2/main.go
src/github.com/stellar/horizon/db2/main.go
// Package db2 is the replacement for db. It provides low level db connection // and query capabilities. package db2 // PageQuery represents a portion of a Query struct concerned with paging // through a large dataset. type PageQuery struct { Cursor string Order string Limit uint64 }
// Package db2 is the replacement for db. It provides low level db connection // and query capabilities. package db2 // Pageable records have a defined order, and the place withing that order // is determined by the paging token type Pageable interface { PagingToken() string } // PageQuery represents a portion of a...
Fix breakage due to Pageable being removed
Fix breakage due to Pageable being removed
Go
apache-2.0
nullstyle/go-horizon,nullstyle/go-horizon,nullstyle/go-horizon,stellar/horizon,stellar/horizon,stellar/horizon
87a94c9fe9618135282cd43695523a620a9bcc49
main.go
main.go
/* Copyright 2016 Skippbox, Ltd. Copyright 2017 André Cruz 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 agree...
/* Copyright 2016 Skippbox, Ltd. Copyright 2017 André Cruz 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 agree...
Configure glog to output to stderr
Configure glog to output to stderr
Go
apache-2.0
edevil/kubewatch
5561a910c4c29d660bb26e6970b5125fa7e72f96
main.go
main.go
package main import ( "encoding/json" "fmt" "io/ioutil" "os" "code.google.com/p/goauth2/oauth" "github.com/google/go-github/github" ) func ListRepos(config *Config) { t := &oauth.Transport{ Token: &oauth.Token{AccessToken: config.OauthToken}, } client := github.NewClient(t.Client()) // list all reposit...
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "code.google.com/p/goauth2/oauth" "github.com/google/go-github/github" ) func ListRepos(config *Config) { t := &oauth.Transport{ Token: &oauth.Token{AccessToken: config.OauthToken}, } client := github.NewClient(t.Client()) // list all reposi...
Exit with log.Fatal instead of os.Exit
Exit with log.Fatal instead of os.Exit
Go
apache-2.0
thecarlhall/privy
0562aba1db9c44e24a87943a2774a060f8193cc5
main.go
main.go
package main import ( "bytes" "fmt" "net/http" "regexp" ) func main() { resp, _ := http.Get("http://hichannel.hinet.net/radio/mobile/index.do?id=232") defer resp.Body.Close() html := new(bytes.Buffer) html.ReadFrom(resp.Body) //fmt.Println(html.String()) reg := regexp.MustCompile(`var url = '([\S]+)'`) url...
package main import ( "bytes" "fmt" "net/http" "regexp" ) func main() { resp, _ := http.Get("http://hichannel.hinet.net/radio/mobile/index.do?id=232") defer resp.Body.Close() html := new(bytes.Buffer) html.ReadFrom(resp.Body) //fmt.Println(html.String()) reg := regexp.MustCompile(`var url = '([\S]+)'`) url...
Add test mac open, but not work.
Add test mac open, but not work.
Go
mit
lecheel/gohinetradio,toomore/gohinetradio
e08409ee9d120ea512ad676a65c5f13207ebea18
main.go
main.go
package main import ( "fmt" "html" "log" "net/http" ) type item struct { node string value int } type Node struct { head item left item right item } func split(x int) (a, b, c int){ a = 1 b = 2 c = 3 return } func getChildren(a Node) (b, c item) { b = a.left ...
package main import ( "fmt" "log" "net/http" ) type article struct { title string datePosted int desc string content string } func homePage(w http.ResponseWriter, r *http.Request){ fmt.Fprintf(w, "Welcome to the HomePage!") fmt.Println("Endpoint Hit: homePage") } func returnArtic...
Structure of a basic REST API
Structure of a basic REST API
Go
apache-2.0
emforce/GoPlayground,emforce/GoPlayground
bb504e8f4e3ad1ec90ed9ca4af9e3d66fcebaf3a
libfuse/mounter_osx.go
libfuse/mounter_osx.go
// +build darwin package libfuse import ( "os" "bazil.org/fuse" ) func getPlatformSpecificMountOptions(m Mounter) ([]fuse.MountOption, error) { options := []fuse.MountOption{} // Add kbfuse support. // Workaround osxfuse and bazil.org/fuse issue with a required env for the // daemon path. The issue is being ...
// +build darwin package libfuse import ( "os" "bazil.org/fuse" ) func getPlatformSpecificMountOptions(m Mounter) ([]fuse.MountOption, error) { options := []fuse.MountOption{} // Add kbfuse support. // Workaround osxfuse and bazil.org/fuse issue with a required env for the // daemon path. The issue is being ...
Fix osxfuse locations (forgot to add to last commit)
Fix osxfuse locations (forgot to add to last commit)
Go
bsd-3-clause
keybase/kbfs,keybase/client,keybase/client,keybase/client,keybase/client,keybase/kbfs,keybase/client,keybase/kbfs,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/kbfs,keybase/client,keybase/client
57173c6bdc431b867c331f7ab112234e282a44cc
exporter/logexporter.go
exporter/logexporter.go
package exporter import ( log "github.com/sirupsen/logrus" "github.com/foomo/petze/watch" ) func LogResultHandler(result watch.Result) { logger := log.WithFields(log.Fields{ "service_id": result.ID, "runtime": result.RunTime, "timeout": result.Timeout, }) if len(result.Errors) > 0 { for _, err := ...
package exporter import ( log "github.com/sirupsen/logrus" "github.com/foomo/petze/watch" ) func LogResultHandler(result watch.Result) { logger := log.WithFields(log.Fields{ "service_id": result.ID, "runtime": result.RunTime, "timeout": result.Timeout, }) if len(result.Errors) > 0 { for _, err := ...
Update message for run completion
Update message for run completion
Go
mit
foomo/petze
e4a092c0e1f6b1456399c3e9a847b07d0e017d9d
src/cmd/moby/run_fallback.go
src/cmd/moby/run_fallback.go
// +build !darwin package main import ( "log" ) func run(cpus, mem, diskSz int, userData string, args []string) { log.Fatalf("'run' is not support yet on your OS") }
// +build !darwin package main import ( "log" ) func run(cpus, mem, diskSz int, userData string, args []string) { log.Fatalf("'run' is not supported yet on your OS") }
Fix typo in `moby run`
Fix typo in `moby run` Signed-off-by: Thomas Gazagnaire <5f50a84c1fa3bcff146405017f36aec1a10a9e38@gazagnaire.org>
Go
apache-2.0
kencochrane/linuxkit,yankcrime/linuxkit,ndauten/linuxkit,furious-luke/linuxkit,justincormack/linuxkit,thebsdbox/linuxkit,eyz/linuxkit,deitch/linuxkit,zx2c4/linuxkit,davefreitag/linuxkit,JohnnyLeone/linuxkit,t-koulouris/linuxkit,YuPengZTE/linuxkit,konstruktoid/linuxkit,linuxkit/linuxkit,radu-matei/linuxkit,JohnnyLeone/l...
aea5dfb3007912341a0966107f90db8fe58aa2dd
cmd/resourceful/endpoints.go
cmd/resourceful/endpoints.go
package main import ( "context" "errors" "fmt" "github.com/gentlemanautomaton/serviceresolver" "github.com/scjalliance/resourceful/guardian" ) func collectEndpoints(ctx context.Context) (endpoints []guardian.Endpoint, err error) { services, err := serviceresolver.DefaultResolver.Resolve(ctx, "resourceful") if...
package main import ( "context" "errors" "fmt" "strings" "github.com/gentlemanautomaton/serviceresolver" "github.com/scjalliance/resourceful/guardian" ) func collectEndpoints(ctx context.Context) (endpoints []guardian.Endpoint, err error) { services, err := serviceresolver.DefaultResolver.Resolve(ctx, "resour...
Remove trailing dots from collected endpoint domain names
cmd: Remove trailing dots from collected endpoint domain names
Go
mit
scjalliance/resourceful,scjalliance/resourceful,scjalliance/resourceful
7da39310819a84ec9b983beffcaa4bda8cd739aa
storage/mview/doc.go
storage/mview/doc.go
// Copyright 2015-2017, Cyrill @ Schumacher.fm and the CoreStore contributors // // 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 // // Un...
// Copyright 2015-2017, Cyrill @ Schumacher.fm and the CoreStore contributors // // 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 // // Un...
Add more ideas / URLs
storage/mview: Add more ideas / URLs
Go
apache-2.0
corestoreio/csfw,corestoreio/csfw
d5f8440e7e5b30943d23a9adf0039d6aec1436b0
peerid.go
peerid.go
package torrent import ( "encoding/hex" ) type PeerID [20]byte func (me PeerID) String() string { if me[0] == '-' && me[7] == '-' { return string(me[:8]) + hex.EncodeToString(me[8:]) } return hex.EncodeToString(me[:]) }
package torrent import ( "encoding/hex" ) // Peer client ID. type PeerID [20]byte // Pretty prints the ID as hex, except parts that adher to the Peer ID // Conventions of BEP 20. func (me PeerID) String() string { if me[0] == '-' && me[7] == '-' { return string(me[:8]) + hex.EncodeToString(me[8:]) } return hex...
Add some helpful comments to type PeerID
Add some helpful comments to type PeerID
Go
mpl-2.0
anacrolix/torrent,anacrolix/torrent
9ba3d510c2ddf83e8e2dacbfc383cf6e692d9565
gocat.go
gocat.go
package main import ( "fmt" "io" "os" ) var ARGV []string func main() { ARGV = os.Args[1:] if len(ARGV) == 0 { // Read stdin only io.Copy(os.Stdout, os.Stdin) } else { // Read ARGV only for _, filename := range ARGV { if filename == "--" { continue } // - means read stdin as a special c...
package main import ( "fmt" "io" "os" ) var ARGV []string func main() { ARGV = os.Args[1:] if len(ARGV) == 0 { // Read stdin only io.Copy(os.Stdout, os.Stdin) } else { // Read ARGV only for _, filename := range ARGV { // - means read stdin as a special case if filename == "-" { filename = "...
Remove hack for `go run`
Remove hack for `go run`
Go
mit
caius/gocat
886024fe5047d86ec71b20d96c2e51a385dd96de
common/shared_structs.go
common/shared_structs.go
package common import ( "encoding/json" ) type TaskData struct { FullyQualifiedNodeName string RexFullyQualifiedNodeName string Zookeepers []string ClusterName string NodeID string } func (s *TaskData) Serialize() ([]byte, error) { b, err := json.Marshal(s) ...
package common import ( "encoding/json" ) type TaskData struct { FullyQualifiedNodeName string RexFullyQualifiedNodeName string Zookeepers []string ClusterName string NodeID string } func (s *TaskData) Serialize() ([]byte, error) { b, err := json.Marshal(s) ...
Fix gofmt relaxed problem with common
Fix gofmt relaxed problem with common
Go
apache-2.0
calebTomlinson/riak-mesos,sargun/riak-mesos,sargun/riak-mesos,calebTomlinson/riak-mesos,sargun/riak-mesos,sargun/riak-mesos,calebTomlinson/riak-mesos,calebTomlinson/riak-mesos,sargun/riak-mesos
1081c7d2285a4d66ef67f4639d8248ebfc16d95c
cmd/i-sudoku/main.go
cmd/i-sudoku/main.go
/* i-sudoku is an interactive command-line sudoku tool */ package main import ( "github.com/jkomoros/sudoku" "github.com/nsf/termbox-go" "log" "strings" ) type mainModel struct { grid *sudoku.Grid } func main() { if err := termbox.Init(); err != nil { log.Fatal("Termbox initialization failed:", err) } def...
/* i-sudoku is an interactive command-line sudoku tool */ package main import ( "github.com/jkomoros/sudoku" "github.com/nsf/termbox-go" "log" "strings" ) type mainModel struct { grid *sudoku.Grid } func main() { if err := termbox.Init(); err != nil { log.Fatal("Termbox initialization failed:", err) } def...
Fix rendering of the sudoku puzzle.
Fix rendering of the sudoku puzzle.
Go
apache-2.0
jkomoros/sudoku,jkomoros/sudoku,jkomoros/sudoku
12c14bfd34be16ffe6796b24ef7693cfe63ee109
routes.go
routes.go
package main import ( "github.com/ricallinson/forgery" "github.com/spacedock-io/index/common" ) func Routes(server *f.Server) { /* Library repository routes */ server.Put("/v1/repositories/:repo/auth", LibraryAuth) server.Put("/v1/repositories/:repo", CreateLibrary) server.Delete("/v1/repositories/...
package main import ( "github.com/ricallinson/forgery" "github.com/spacedock-io/index/common" ) func Routes(server *f.Server) { /* Library repository routes */ server.Put("/v1/repositories/:repo/auth", LibraryAuth) server.Put("/v1/repositories/:repo", CreateLibrary) server.Delete("/v1/repositories/...
Add :username param to PUT /v1/users/:username
Add :username param to PUT /v1/users/:username
Go
mit
spacedock-io/index
0f1ed576a81ff0d57fe8068b4076f1e15c63e1d3
cmd/modelgen/dbmodel.go
cmd/modelgen/dbmodel.go
package main import ( "text/template" "github.com/ovn-org/libovsdb/ovsdb" ) const MODEL_TEMPLATE = ` // Code generated by "libovsdb.modelgen" // DO NOT EDIT. package {{ .PackageName }} import ( "github.com/ovn-org/libovsdb/client" ) // FullDatabaseModel() returns the DatabaseModel object to be used in libovsdb...
package main import ( "text/template" "github.com/ovn-org/libovsdb/ovsdb" ) const MODEL_TEMPLATE = ` // Code generated by "libovsdb.modelgen" // DO NOT EDIT. package {{ .PackageName }} import ( "github.com/ovn-org/libovsdb/client" ) // FullDatabaseModel returns the DatabaseModel object to be used in libovsdb f...
Fix comment on generated FullDatabaseModel
modelgen: Fix comment on generated FullDatabaseModel This ensures it passes the linter Signed-off-by: Dave Tucker <bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@dtucker.co.uk>
Go
apache-2.0
socketplane/libovsdb
8f1770a777d8e7b971b18850675b70562a72a5ce
main.go
main.go
package main import "log" const ( // outputRoot is the output directory // for the build artifacts. outputRoot = "dist" ) var ( // appName is the name of the // application to be built. appName string // appVersion is the version of // the application to be built. appVersion = "latest" ) func main() { va...
package main import "log" const ( // outputRoot is the output directory // for the build artifacts. outputRoot = "dist" ) var ( // appName is the name of the // application to be built. appName string // appVersion is the version of // the application to be built. appVersion = "latest" ) func main() { va...
Add context to error messages before printing them
Add context to error messages before printing them
Go
mit
samherrmann/gowrap
55101c467486bb8ec8ed0689c46c1bd8313dfb20
main.go
main.go
package main import ( "flag" "fmt" "github.com/samertm/meowy/server" ) func main() { host := flag.String("host", "localhost", "sets the host name.") port := flag.String("port", "5849", "sets the port.") prefix := flag.String("prefix", "", "sets prefix (for if meowy listens on a path that isn't \"/\"") flag.Pa...
package main import ( "flag" "fmt" "github.com/samertm/meowy/server" ) func main() { host := flag.String("host", "localhost", "sets the host name.") port := flag.String("port", "5849", "sets the port.") prefix := flag.String("prefix", "", "sets prefix (for if meowy listens on a path that isn't \"/\"") flag.Pa...
Make prefix conform to application
Make prefix conform to application
Go
agpl-3.0
samertm/meowy,samertm/meowy
757dc366abfa25bad4368835fb52b340b534acff
main.go
main.go
package main import ( "fmt" "log" evdev "github.com/gvalkov/golang-evdev" ) type Event interface { String() string } func main() { kbdEvent, err := NewK().Lookup() if err != nil { log.Fatal(err) } kbd := fmt.Sprintf("/dev/input/%s", kbdEvent) log.Println(kbd) dev, err := evdev.Open(kbd) if err != ni...
package main import ( "fmt" "log" evdev "github.com/gvalkov/golang-evdev" ) type Event interface { String() string } var ( scanCode uint16 ) func main() { keyboard := NewK("iso9995") kbdEvent, err := keyboard.Lookup() if err != nil { log.Fatal(err) } kbd := fmt.Sprintf("/dev/input/%s", kbdEvent) log...
Print text based on stuff
Print text based on stuff
Go
mit
jspc/go-kbd
206cadb425547dc00220e6166dea993fd865058c
main.go
main.go
package main import ( "os" "fmt" "github.com/codegangsta/cli" "github.com/aws/aws-sdk-go/service/cloudformation" ) func main() { app := cli.NewApp() app.Name = "forecast" app.Usage = "cloudformation dry-run" app.Action = func(c *cli.Context) { svc := cloudformation.New(nil) resp, err := svc.Li...
package main import ( "os" "fmt" "github.com/codegangsta/cli" "github.com/aws/aws-sdk-go/service/cloudformation" ) func main() { app := cli.NewApp() app.Name = "forecast" app.Usage = "cloudformation dry-run" app.Commands = []cli.Command{ { Name: "list", Aliases: []string{"l"}...
Add list subcommand to list stacks
Add list subcommand to list stacks
Go
mpl-2.0
leg100/forecast
f556f375693b9892f5c69132c213ab7e96943f4f
main.go
main.go
package main import ( "flag" "log" "net/http" "github.com/jvrplmlmn/nginx-requests-stats/handlers" "github.com/satyrius/gonx" ) const version = "0.1.0" var format string var logFile string func init() { flag.StringVar(&format, "format", `$remote_addr - $remote_user [$time_local] "$request" $status $body_byte...
package main import ( "flag" "log" "net/http" "github.com/jvrplmlmn/nginx-requests-stats/handlers" "github.com/satyrius/gonx" ) const version = "0.1.0" var format string var logFile string func init() { flag.StringVar(&format, "format", `$remote_addr - $remote_user [$time_local] "$request" $status $body_byte...
Update log format to parse logs with upstream and cache fields by default
Update log format to parse logs with upstream and cache fields by default
Go
mit
jvrplmlmn/nginx-requests-stats
997aa4adb9f4ab91833efad688e0a62077eb66f6
main.go
main.go
package main import ( "fmt" "net/http" "github.com/aseure/jagger/query" ) func handler(w http.ResponseWriter, r *http.Request) { query := query.NewQuery(r.Body) if query == nil { w.WriteHeader(400) } else { query.Execute() w.WriteHeader(200) } } func main() { fmt.Println("Listening on :8080...") htt...
package main import ( "fmt" "net/http" "github.com/aseure/jagger/query" ) func handler(w http.ResponseWriter, r *http.Request) { query := query.NewQuery(r.Body) if query == nil { w.WriteHeader(400) } else { go query.Execute() w.WriteHeader(200) } } func main() { fmt.Println("Listening on :8080...") ...
Make the query execution run on a separate goroutine
Make the query execution run on a separate goroutine
Go
mit
aseure/jagger,aseure/jagger
a3af2438d842ad90c103ed152d6e054d226cdc75
main.go
main.go
package main import ( "fmt" "os" "github.com/dcbishop/gim/cli" ) func main() { options, err := cli.ParseArgs(os.Args) if err != nil { fmt.Println(cli.Usage()) os.Exit(1) } if options.Help { fmt.Println(cli.Usage()) os.Exit(0) } }
package main import ( "fmt" "os" "github.com/dcbishop/gim/cli" ) func main() { options, err := cli.ParseArgs(os.Args) if err != nil { fmt.Println("ERROR: Invalid arguments.", err) fmt.Println(cli.Usage()) os.Exit(1) } if options.Help { fmt.Println(cli.Usage()) os.Exit(0) } }
Print error message on bad arguments.
Print error message on bad arguments.
Go
cc0-1.0
dcbishop/jkl
a71884087fbfebe148542030ff6e6ab4bff40d5d
main.go
main.go
package main import ( "fmt" "os" "os/exec" "strings" ) func main() { extArgs, err := LookupExtCmd(os.Args[1:]) if err != nil { fmt.Println(err) } extCmd := exec.Command(extArgs[0], extArgs[1:]...) extCmd.Stdin = os.Stdin extCmd.Stdout = os.Stdout extCmd.Stderr = os.Stderr extCmd.Run() } func LookupEx...
package main import ( "fmt" "os" "os/exec" "strings" ) var version = "0.1.0" var helpMsg = `NAME: ext - An interface for command extensions USAGE: ext commands... ` func main() { if len(os.Args) < 2 { fmt.Println(helpMsg) os.Exit(1) } switch os.Args[1] { case "-h", "--help": fmt.Println(helpMs...
Add -h and -v option
Add -h and -v option
Go
mit
naoty/ext
cbc3b6b036a01c951e2d0549823c16d6be42e071
fly/commands/prune_worker.go
fly/commands/prune_worker.go
package commands import ( "fmt" "github.com/concourse/concourse/fly/rc" ) type PruneWorkerCommand struct { Worker string `short:"w" long:"worker" required:"true" description:"Worker to prune"` } func (command *PruneWorkerCommand) Execute(args []string) error { workerName := command.Worker target, err := rc.L...
package commands import ( "fmt" "github.com/concourse/concourse/fly/commands/internal/displayhelpers" "github.com/concourse/concourse/fly/rc" ) type PruneWorkerCommand struct { Worker string `short:"w" long:"worker" description:"Worker to prune"` AllStalled bool `short:"a" long:"all-stalled" description:...
Add option to prune all stalled workers instead of just one at the time.
Add option to prune all stalled workers instead of just one at the time. Signed-off-by: Alessandro Degano <55cacd5b504daf5c7cafa0b6b8e4521b86a643c4@pix4d.com>
Go
apache-2.0
concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse
29d2b723487b09f8042a955eb8afedb2f7f78a11
conn.go
conn.go
// +build !darwin package tftp import "net" const udp = "udp" func localSystem(c *net.UDPConn) string { return c.LocalAddr().String() }
// +build !darwin package tftp import "net" import "fmt" import "strconv" const udp = "udp" var localhost string = determineLocalhost() func determineLocalhost() string { l, err := net.ListenTCP("tcp", nil) if err != nil { panic(fmt.Sprintf("ListenTCP error: %s", err)) } _, lport, _ := net.SplitHostPort(l.Ad...
Determine correct localhost address for tests.
Determine correct localhost address for tests.
Go
mit
pin/tftp
b059059a68b83f26aeda05e0cabc63423f6424dc
mint.go
mint.go
package mint import "testing" import "fmt" import "os" type ProxyTestee struct { t *testing.T actual interface{} expected interface{} } var ( FailBase = 0 FailType = 1 ) var Scolds = map[int]string{ FailBase: "Expected to be `%+v`, but actual `%+v`\n", FailType: "Expectec type `%+v`, but actual `%T`\...
package mint import "testing" import "fmt" import "os" type ProxyTestee struct { t *testing.T actual interface{} expected interface{} } var ( FailBase = 0 FailType = 1 Scolds = map[int]string{ FailBase: "Expected to be `%+v`, but actual `%+v`\n", FailType: "Expectec type `%+v`, but actual `%T`\n...
Fix coding style a bit
Fix coding style a bit
Go
mit
otiai10/mint
aa95fa34247f685678db7bd47bf1c895eb099d55
go/tricorder/messages/api.go
go/tricorder/messages/api.go
package messages import ( "github.com/Symantec/tricorder/go/tricorder/types" ) type Range struct { Lower *float64 `json:"lower,omitempty"` Upper *float64 `json:"upper,omitempty"` Count uint64 `json:"count"` } type Distribution struct { Min float64 `json:"min"` Max float64 `json:"max"` Avg float64...
package messages import ( "github.com/Symantec/tricorder/go/tricorder/types" ) type Range struct { Lower *float64 `json:"lower,omitempty"` Upper *float64 `json:"upper,omitempty"` Count uint64 `json:"count"` } type Distribution struct { Min float64 `json:"min"` Max float64 `json:"max"` Avg float64...
Make description and unit be required in PathResponse. Add JsonListResponse type.
Make description and unit be required in PathResponse. Add JsonListResponse type.
Go
apache-2.0
Symantec/tricorder
b8c10e7ab332c7f3e32f3a4004fbb122e0ebee4d
imageserver/rpcd/addImage.go
imageserver/rpcd/addImage.go
package rpcd import ( "errors" "fmt" "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/proto/imageserver" ) func (t *rpcType) AddImage(request imageserver.AddImageRequest, reply *imageserver.AddImageResponse) error { if imageDataBase.CheckImage(request.ImageName) { return errors.New("ima...
package rpcd import ( "errors" "fmt" "github.com/Symantec/Dominator/lib/hash" "github.com/Symantec/Dominator/proto/imageserver" ) func (t *rpcType) AddImage(request imageserver.AddImageRequest, reply *imageserver.AddImageResponse) error { if imageDataBase.CheckImage(request.ImageName) { return errors.New("ima...
Fix bug in imageserver AddImage() RPC handler.
Fix bug in imageserver AddImage() RPC handler.
Go
apache-2.0
Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,keep94/Dominator
86c1ced2f5b76aa25a023d342b2379411af94754
tmpl.go
tmpl.go
package goutils import ( "bytes" "text/template" "github.com/hoveychen/go-utils/gomap" ) var ( textTmplCache = gomap.New() ) func Sprintt(textTmpl string, data interface{}) string { ret := textTmplCache.GetOrCreate(textTmpl, func() interface{} { tpl, err := template.New("test").Parse(textTmpl) if err != ni...
package goutils import ( "bytes" "text/template" "github.com/hoveychen/go-utils/gomap" ) var ( textTmplCache = gomap.New() ) type Var map[string]interface{} func Sprintt(textTmpl string, data interface{}) string { ret := textTmplCache.GetOrCreate(textTmpl, func() interface{} { tpl, err := template.New("test...
Add predefined type for temporary varibles.
[Tmpl] Add predefined type for temporary varibles.
Go
apache-2.0
hoveychen/go-utils
575e4a5c5203754b49e9e97a0c6abd4f050b72ac
internal/vm/errors/errors.go
internal/vm/errors/errors.go
// Copyright 2015 Google Inc. All Rights Reserved. // This file is available under the Apache license. package errors import ( "fmt" "strings" "github.com/google/mtail/internal/vm/position" "github.com/pkg/errors" ) type compileError struct { pos position.Position msg string } func (e compileError) Error() s...
// Copyright 2015 Google Inc. All Rights Reserved. // This file is available under the Apache license. package errors import ( "fmt" "github.com/google/mtail/internal/vm/position" "github.com/pkg/errors" ) type compileError struct { pos position.Position msg string } func (e compileError) Error() string { re...
Revert "Use strings.Builder instead of string concatenation."
Revert "Use strings.Builder instead of string concatenation." This reverts commit f10c846ab60d234aa449c042068ce461b2f6ed9a.
Go
apache-2.0
google/mtail,SuperQ/mtail,SuperQ/mtail,google/mtail
809a3a8671cc5a4e4741f70f48cc433dd2d8b9be
traceable_test.go
traceable_test.go
package meep_test import ( "fmt" "." ) func ExampleTraceableErr() { type Woop struct { meep.TraceableError error } err := meep.New(&Woop{}) fmt.Println(err.(*Woop).StackString()) /// Output: // FIXME this is hard to test because of the full local path that pops up :( }
package meep_test import ( "fmt" "strings" "." ) func ExampleTraceableErr() { type Woop struct { meep.TraceableError error } err := meep.New(&Woop{}) str := err.(*Woop).StackString() // The *entire* output probably looks something like this: // ·> /your/build/path/meep/meep.go:8: meep.New // ·> /you...
Build out example|test of TraceableError.
Build out example|test of TraceableError. The hardest part here continues to be hacking around the absolute paths that crop up in strings. I'd really vastly prefer to reference full package paths, independently of the filesystem and totally disregarding the $GOPATH... but that information simply doesn't seem to be ar...
Go
apache-2.0
polydawn/meep,polydawn/meep
d6268844a2e9302243e1410f3c8b496cef53fa2b
util.go
util.go
package main import ( "fmt" "net" "github.com/cmatsuoka/ouidb" "github.com/mostlygeek/arp" ) var db *ouidb.OuiDB func init() { db = ouidb.New("/etc/manuf") if db == nil { db = ouidb.New("manuf") } } func getMAC(s string) (string, error) { ifaces, err := net.Interfaces() checkError(err) for _, i := rang...
package main import ( "fmt" "net" "github.com/cmatsuoka/ouidb" "github.com/mostlygeek/arp" ) var db *ouidb.OuiDB func init() { db = ouidb.New("/etc/manuf") if db == nil { db = ouidb.New("manuf") } } func getMAC(s string) (string, error) { ifaces, err := net.Interfaces() checkError(err) for _, i := rang...
Add host to ARP table if MAC not found
Snoop: Add host to ARP table if MAC not found Signed-off-by: Claudio Matsuoka <ef7f691d9947ca9adbfeb1538a53a661ec9f041b@gmail.com>
Go
mit
cmatsuoka/dhcpcheck
7af43f9d658020c9d5b79f77599670fbe009810e
xmmsclient/serialize_test.go
xmmsclient/serialize_test.go
package xmmsclient import ( "bytes" "reflect" "testing" ) func TestSerializeInt(t *testing.T) { var expected = []byte{ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, } var buffer bytes.Buffer var err = SerializeXmmsValue(XmmsInt(42), &buffer) if err != nil { t.Error(err) } i...
package xmmsclient import ( "bytes" "encoding/hex" "reflect" "testing" ) func checkBuffer(t *testing.T, expected []byte, actual []byte) { if !reflect.DeepEqual(expected, actual) { t.Fatalf("\nwant:\n%s\nhave:\n%s", hex.Dump(expected), hex.Dump(actual)) } } func TestSerializeInt(t *testing.T) { var expected ...
Break out buffer-check and use t.Fatal.
Break out buffer-check and use t.Fatal.
Go
isc
dsvensson/go-xmmsclient
49a7fce941cc46f56e95651925ab2518dfe94940
2deploy.go
2deploy.go
package main import ( "log" "fmt" "os" "path" "golang.org/x/net/context" "github.com/docker/libcompose/docker" "github.com/docker/libcompose/docker/ctx" "github.com/docker/libcompose/project" "github.com/docker/libcompose/project/options" ) func main() { pwd, err := os.Getwd(...
package main import ( "log" "fmt" "os" "path" "github.com/docker/libcompose/config" "github.com/docker/libcompose/project" ) func main() { pwd, err := os.Getwd() if err != nil { fmt.Println(err) os.Exit(1) } _, dir := path.Split(pwd) project := project.New...
Switch to compose parsing from Docker context
Switch to compose parsing from Docker context
Go
apache-2.0
adrahon/deploy-compose
f8fec086c6e009cc7b864ec20a62e6a6f748e762
status.go
status.go
package medtronic const ( status Command = 0xCE ) // StatusInfo represents the pump's status. type StatusInfo struct { Normal bool Bolusing bool Suspended bool } // Status returns the pump's status. func (pump *Pump) Status() StatusInfo { data := pump.Execute(status) if pump.Error() != nil { return Statu...
package medtronic const ( status Command = 0xCE ) // StatusInfo represents the pump's status. type StatusInfo struct { Code byte Bolusing bool Suspended bool } // Normal returns true if the status code indicates normal pump operation. // Observed values: // 0: rewinding // 1: preparing to prime // 2:...
Add Code field and Normal method to StatusInfo
Add Code field and Normal method to StatusInfo
Go
mit
ecc1/medtronic,ecc1/medtronic
9654cdd0492895da43da1572fad7f48fcdea6314
main.go
main.go
package main import ( "flag" "fmt" "os" ) var ( // Flags helpShort = flag.Bool("h", false, "Show usage text (same as --help).") helpLong = flag.Bool("help", false, "Show usage text (same as -h).") ) func main() { flag.Usage = usage flag.Parse() if *helpShort || *helpLong || flag.NArg() == 0 { flag.Usage()...
package main import ( "flag" "fmt" "os" _ "goprotobuf.googlecode.com/hg/compiler/descriptor" _ "goprotobuf.googlecode.com/hg/compiler/plugin" ) var ( // Flags helpShort = flag.Bool("h", false, "Show usage text (same as --help).") helpLong = flag.Bool("help", false, "Show usage text (same as -h).") pluginBi...
Add --plugin flag. Link to goprotobuf libraries.
Add --plugin flag. Link to goprotobuf libraries.
Go
bsd-3-clause
dsymonds/gotoc,dsymonds/gotoc
9ea4830e4f896f3d1094a364416cac95c3f5b022
types.go
types.go
package xyebot // Response to Telegram type Response struct { Chatid int64 `json:"chat_id"` Text string `json:"text"` Method string `json:"method"` } // Chat Telegram structure type Chat struct { ID int64 `json: "chat_id"` } // Message Telegram structure type Message struct { Chat *Chat `json:"chat"` Text ...
package xyebot // Response to Telegram type Response struct { Chatid int64 `json:"chat_id"` Text string `json:"text"` Method string `json:"method"` } // Chat Telegram structure type Chat struct { ID int64 `json: "id"` } // Message Telegram structure type Message struct { Chat *Chat `json:"chat"` Text strin...
Update `chat_id` to be just `id`
Update `chat_id` to be just `id`
Go
apache-2.0
m-messiah/xye-bot
35b2a960fc38124a0dbde849e0fcf67bcbec23c0
types.go
types.go
package main import "encoding/json" // StrSlice representes a string or an array of strings. // We need to override the json decoder to accept both options. type StrSlice struct { parts []string } // UnmarshalJSON decodes the byte slice whether it's a string or an array of strings. // This method is needed to imple...
package main import ( "github.com/drone/drone-go/drone" ) type Params struct { Commands []string `json:"commands"` Login string `json:"user"` Port int `json:"port"` Host drone.StringSlice `json:"host"` Sleep int `json:"sleep"` }
Use the drone-go StringSlice instead of custom implementation
Use the drone-go StringSlice instead of custom implementation
Go
mit
drone-plugins/drone-ssh,appleboy/drone-ssh,appleboy/drone-ssh
7e712dfeb68c142b4f4cb1c6e864afa757342780
pool.go
pool.go
package bytebufferpool import "sync" const ( minBitSize = 8 steps = 20 minSize = 1 << minBitSize maxSize = 1 << (minBitSize + steps - 1) ) type byteBufferPool struct { // Pools are segemented into power-of-two sized buffers // from minSize bytes to maxSize. // // This allows reducing fragmentation of B...
package bytebufferpool import "sync" const ( minBitSize = 8 steps = 20 minSize = 1 << minBitSize maxSize = 1 << (minBitSize + steps - 1) ) type byteBufferPool struct { // Pools are segemented into power-of-two sized buffers // from minSize bytes to maxSize. // // This allows reducing fragmentation of B...
Drop buffers with under-used capacity in order to reduce memory waste
Drop buffers with under-used capacity in order to reduce memory waste
Go
mit
valyala/bytebufferpool
7a2dac8a98c7762410a01456691a61631b7907c3
dht/kv_store_test.go
dht/kv_store_test.go
package dht import ( "testing" assert "github.com/stretchr/testify/assert" ) func TestFindKeysNearestToNotEqual(t *testing.T) { s, err := newStore() assert.Nil(t, err) s.Put(KeyPrefixPeer+"a1", "0.0.0.0", true) s.Put(KeyPrefixPeer+"a2", "0.0.0.1", true) s.Put(KeyPrefixPeer+"a3", "0.0.0.3", true...
package dht import ( "testing" assert "github.com/stretchr/testify/assert" ) func TestFindKeysNearestTo(t *testing.T) { s, err := newStore() assert.Nil(t, err) s.Put(KeyPrefixPeer+"a1", "0.0.0.0", true) s.Put(KeyPrefixPeer+"a2", "0.0.0.1", true) s.Put(KeyPrefixPeer+"a3", "0.0.0.3", true) s.Pu...
Add more assertions find key near
Add more assertions find key near
Go
mit
nimona/go-nimona,nimona/go-nimona,nimona/go-nimona,nimona/go-nimona
bdac81fced51a326481f473704d677f6a73af953
internal/integration/integration_suite_test.go
internal/integration/integration_suite_test.go
package integration_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/sclevine/agouti/dsl" . "github.com/sclevine/agouti/internal/integration" "testing" ) func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Integration Suite") } var _ = BeforeSuite(func(...
package integration_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/sclevine/agouti/dsl" . "github.com/sclevine/agouti/internal/integration" "testing" ) func TestIntegration(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Integration Suite") } var _ = BeforeSuite(func(...
Switch integration specs back to PhantomJS
Switch integration specs back to PhantomJS
Go
mit
sclevine/agouti,abourget/agouti,sclevine/agouti,Etienne42/agouti,abourget/agouti,Etienne42/agouti
594dccc0ddd3eca634e6d3a982f5d729ac0273a5
service/codedeploy/codedeploy_integ_test.go
service/codedeploy/codedeploy_integ_test.go
// +build integration package codedeploy_test import ( "strconv" "testing" "time" "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/service/codedeploy" ) func TestCreateDeleteApplication(t *testing.T) { client := codedeploy.New(aws.DefaultCreds(), "us-east-1", nil) applicationName := "awsgos...
// +build integration package codedeploy_test import ( "strconv" "testing" "time" "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/service/codedeploy" ) func TestCreateDeleteApplication(t *testing.T) { client := codedeploy.New(aws.DefaultCreds(), "us-east-1", nil) applicationName := "awsgo...
Fix build flags integration test
Fix build flags integration test
Go
apache-2.0
jkakar/aws-sdk-go,Onefootball/aws-sdk-go,xibz/aws-sdk-go,euank/aws-sdk-go,rail/aws-sdk-go,matematik7/aws-sdk-go,keithpitt/aws-sdk-go,tml/aws-sdk-go,Onefootball/aws-sdk-go,skyportsystems/aws-sdk-go,euank/aws-sdk-go,dragonfax/aws-sdk-go,rosenhouse/aws-sdk-go,jacobxk/aws-sdk-go,marcosnils/aws-sdk-go,xibz/aws-sdk-go,matema...
1cd89f72170a07c349cbc5b59d53424a57e78c21
chain.go
chain.go
package alice import "net/http" // A constructor for a piece of middleware. // Most middleware use this constructor out of the box, // so in most cases you can just pass somepackage.New type Constructor func(http.Handler) http.Handler type Chain struct { constructors []Constructor } // Creates a new chain, memoriz...
package alice import "net/http" // A constructor for a piece of middleware. // Most middleware use this constructor out of the box, // so in most cases you can just pass somepackage.New type Constructor func(http.Handler) http.Handler type Chain struct { constructors []Constructor } // Creates a new chain, memoriz...
Document the handling of nil.
Document the handling of nil.
Go
mit
justinas/alice,azr/alice,Compufreak345/alice
2bb058685d727c0ae1102169971e5016e35f433d
phases/slack_notifier.go
phases/slack_notifier.go
package phases import ( "github.com/Everlane/evan/common" "github.com/nlopes/slack" ) type SlackNotifierPhase struct { Client *slack.Client Channel string Format func(common.Deployment) (string, error) } func (snp *SlackNotifierPhase) CanPreload() bool { return false } func (snp *SlackNotifierPhase) Execut...
package phases import ( "github.com/Everlane/evan/common" "github.com/nlopes/slack" ) type SlackNotifierPhase struct { Client *slack.Client Channel string Format func(common.Deployment) (*string, *slack.PostMessageParameters, error) } func (snp *SlackNotifierPhase) CanPreload() bool { return false } func (...
Add more options to Slack notifier phase
Add more options to Slack notifier phase
Go
mit
Everlane/evan
7a63dce37a0afd42bd9efc9687c55feeaef04130
src/events.go
src/events.go
package main import ( twodee "../libs/twodee" ) const ( UpLayer twodee.GameEventType = iota DownLayer UpWaterLevel DownWaterLevel PlayerMove GameIsClosing PlayExploreMusic PauseMusic ResumeMusic PlayerPickedUpItem sentinel ) const ( NumGameEventTypes = int(sentinel) ) type MoveDirection int const ( N...
package main import ( twodee "../libs/twodee" ) const ( UpLayer twodee.GameEventType = iota DownLayer UpWaterLevel DownWaterLevel PlayerMove GameIsClosing PlayExploreMusic PauseMusic ResumeMusic PlayerPickedUpItem sentinel ) const ( NumGameEventTypes = int(sentinel) ) type MoveDirection byte const ( ...
Make MoveDirections each a byte.
Make MoveDirections each a byte.
Go
apache-2.0
kurrik/ld29,kurrik/ld29,pikkpoiss/ld29,pikkpoiss/ld29
6d964a6eb6368ed531ad4b5eb475d80f458e1538
fuzzy.go
fuzzy.go
// Copyright © 2013-2017 Pierre Neidhardt <ambrevar@gmail.com> // Use of this file is governed by the license that can be found in LICENSE. package main import ( "regexp" "strings" "github.com/jhprks/damerau" ) var ( reNorm = regexp.MustCompile(`\b0+|[^\pL\pN]`) ) // Remove punctuation and padding zeros for nu...
// Copyright © 2013-2017 Pierre Neidhardt <ambrevar@gmail.com> // Use of this file is governed by the license that can be found in LICENSE. package main import ( "regexp" "strings" "github.com/ambrevar/damerau" ) var ( reNorm = regexp.MustCompile(`\b0+|[^\pL\pN]`) ) // Remove punctuation and padding zeros for ...
Update "damerau" repository URL to github.com/ambrevar
Update "damerau" repository URL to github.com/ambrevar
Go
mit
Ambrevar/Demlo,Ambrevar/Demlo
2fd313d1163cafb64f9a44eb63c367ade8f2a36a
src/webservice/server.go
src/webservice/server.go
package main import ( "net/http" "io/ioutil" "os" ) func saveHandler(w http.ResponseWriter, r *http.Request) { folder := "/PRODUCTION/EXPERIMENT/web/savedfiles/" filename := generateRandomURL() path := folder + filename if _, err := os.Stat(path); err != nil { if os.IsNotExist(err...
package main import ( "net/http" "io/ioutil" "os" ) func saveHandler(w http.ResponseWriter, r *http.Request) { folder := "/PRODUCTION/EXPERIMENT/web/savedfiles/" filename := generateRandomURL() path := folder + filename if _, err := os.Stat(path); err != nil { if os.IsNotExist(err...
Change owner of saved file
Change owner of saved file
Go
mit
elifkus/very-simple-service,elifkus/very-simple-service,elifkus/very-simple-service
3c186c6312297cd39f90d58ef11905306a223ad4
app/App_windows.go
app/App_windows.go
// Copyright (c) 2016 by Richard A. Wilkes. All rights reserved. // // This Source Code Form is subject to the terms of the Mozilla Public // License, version 2.0. If a copy of the MPL was not distributed with // this file, You can obtain one at http://mozilla.org/MPL/2.0/. // // This Source Code Form is "Incompatible ...
// Copyright (c) 2016 by Richard A. Wilkes. All rights reserved. // // This Source Code Form is subject to the terms of the Mozilla Public // License, version 2.0. If a copy of the MPL was not distributed with // this file, You can obtain one at http://mozilla.org/MPL/2.0/. // // This Source Code Form is "Incompatible ...
Implement platformAppName() and platformHideApp(), panic on use of platformHideOtherApps() or platformShowAllApps().
Implement platformAppName() and platformHideApp(), panic on use of platformHideOtherApps() or platformShowAllApps().
Go
mpl-2.0
richardwilkes/ui,richardwilkes/ui,richardwilkes/ui
f1e1e65d69158ebf3b693e786465ce81de973965
server/iceauth.go
server/iceauth.go
package server import ( "crypto/hmac" "crypto/sha1" "encoding/base64" "fmt" "time" ) type ICEAuthServer struct { URLs []string `json:"urls"` Username string `json:"username,omitempty"` Credential string `json:"credential,omitempty"` } func GetICEAuthServers(servers []ICEServer) (result []ICEAuthS...
package server import ( "crypto/hmac" "crypto/sha1" "encoding/base64" "fmt" "time" ) type ICEAuthServer struct { URLs []string `json:"urls"` Username string `json:"username,omitempty"` Credential string `json:"credential,omitempty"` } func GetICEAuthServers(servers []ICEServer) (result []ICEAuthS...
Fix turnserver auth timestamp generation
Fix turnserver auth timestamp generation
Go
mit
jeremija/peer-calls,jeremija/peer-calls,jeremija/peer-calls
13b95f3b9aa2378cd4dbcf540ab755fd66edae50
metrics/histogram.go
metrics/histogram.go
package metrics type Histogram interface { Clear() Update(value int64) Count() uint64 Sum() int64 Min() int64 Max() int64 Mean() float64 Percentiles([]float64) []int64 }
package metrics // import "encoding/json" import ( "bytes" "fmt" "strconv" ) type Histogram interface { Clear() Update(value int64) Count() uint64 Sum() int64 Min() int64 Max() int64 Mean() float64 Percentiles([]float64) []int64 } type HistogramExport struct { Histogram Histogram Percentiles [...
Add HistogramExport to work with expvars
Add HistogramExport to work with expvars
Go
bsd-3-clause
samuel/go-metrics
ff409da5b0d2a49b7cc7861efbec377235d9ab2d
pkg/volume/cinder/doc.go
pkg/volume/cinder/doc.go
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Use Go canonical import paths
Use Go canonical import paths Add canonical imports only in existing doc.go files. https://golang.org/doc/go1.4#canonicalimports Fixes #29014
Go
apache-2.0
kubernetes/cloud-provider-openstack,kubernetes/cloud-provider-openstack,kubernetes/cloud-provider-openstack
844fa0fb81ef01a35d54c2229e359f9afa0bf35c
message_handler.go
message_handler.go
package qbot import ( "strings" "github.com/doozr/guac" "github.com/doozr/jot" "github.com/doozr/qbot/command" "github.com/doozr/qbot/queue" "github.com/doozr/qbot/util" ) // MessageHandler handles an incoming message event. type MessageHandler func(queue.Queue, guac.MessageEvent) (queue.Queue, error) // Comm...
package qbot import ( "strings" "github.com/doozr/guac" "github.com/doozr/jot" "github.com/doozr/qbot/command" "github.com/doozr/qbot/queue" "github.com/doozr/qbot/util" ) // MessageHandler handles an incoming message event. type MessageHandler func(queue.Queue, guac.MessageEvent) (queue.Queue, error) // Comm...
Send help if command not recognised
Send help if command not recognised
Go
mit
doozr/qbot,doozr/qbot
0b90959c5c6885661652c90ac1a51570455fff88
main.go
main.go
package main import ( "context" "fmt" "os" "github.com/docker/engine-api/client" ) func main() { cli, err := client.NewEnvClient() quitOnErr(err) ver, err := cli.ServerVersion(context.Background()) quitOnErr(err) fmt.Println("Was able to connect to docker daemon") fmt.Println(ver) } func quitOnErr(err err...
package main import ( "context" "fmt" "os" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/container" "github.com/docker/engine-api/types/strslice" ) func main() { // Create docker client cli, err := client.NewEnvClient() quitOnErr(err) // Le...
Create and start a container
Create and start a container
Go
apache-2.0
alexbrand/dockerception,alexbrand/dockerception
24821ba1ec0d88207eef3bd012c321673cca0d47
pkg/dbg/profile_dump.go
pkg/dbg/profile_dump.go
package dbg import ( "fmt" "io/ioutil" "os" "runtime" "runtime/pprof" "time" "github.com/Sirupsen/logrus" ) const ( path = "/var/cores/" ) // DumpGoMemoryTrace output memory profile to logs. func DumpGoMemoryTrace() { m := &runtime.MemStats{} runtime.ReadMemStats(m) res := fmt.Sprintf("%#v", m) logrus.I...
package dbg import ( "fmt" "io/ioutil" "os" "runtime" "runtime/pprof" "time" "github.com/Sirupsen/logrus" ) const ( path = "/var/cores/" ) // DumpGoMemoryTrace output memory profile to logs. func DumpGoMemoryTrace() { m := &runtime.MemStats{} runtime.ReadMemStats(m) res := fmt.Sprintf("%#v", m) logrus.I...
Increase the goprofile trace limit to 5M.
Increase the goprofile trace limit to 5M. Signed-off-by: Aditya Dani <5d1852d43efe8f6e393448a3b4d1cd98a4cfd56f@portworx.com>
Go
apache-2.0
pault84/openstorage,libopenstorage/openstorage,pault84/openstorage,pault84/openstorage,libopenstorage/openstorage,libopenstorage/openstorage
9946e63eda172381b163f613991a0283da046223
version/version_test.go
version/version_test.go
package version import "testing" func TestFullversion(t *testing.T) { tests := []struct { name string want string }{ { name: "Get correct name", want: Version + "-" + Revision, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := fullversion(); got != tt.want { t.Er...
package version import "testing" func TestFullversion(t *testing.T) { tests := []struct { name string want string }{ { name: "Get correct name", want: Version + "-" + Revision, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := Fullversion(); got != tt.want { t.Er...
Rename method in test code
Rename method in test code
Go
mit
budougumi0617/tasks,budougumi0617/tasks
0ad0f5c41bf6770e2b3229ca07c27d877d1a5de4
model/request_test.go
model/request_test.go
package model_test import ( "encoding/json" "github.com/crezam/actions-on-google-golang/internal/test" "github.com/crezam/actions-on-google-golang/model" "os" "testing" "time" ) func TestRequestParsing(t *testing.T) { var req model.ApiAiRequest file, _ := os.Open("./data/sample_request1.json") dec := json....
package model_test import ( "encoding/json" "github.com/crezam/actions-on-google-golang/internal/test" "github.com/crezam/actions-on-google-golang/model" "os" "testing" "time" ) func TestRequestParsing(t *testing.T) { var req model.ApiAiRequest file, _ := os.Open("./data/sample_request1.json") dec := json....
Test a non existent parameter
Test a non existent parameter
Go
mit
crezam/actions-on-google-golang
7ddcc5b1b58555ee19f730c4b72318cd38e16db1
pkg/sys/signals_unix.go
pkg/sys/signals_unix.go
// +build !windows,!plan9,!js package sys import ( "os" "os/signal" "syscall" ) func NotifySignals() chan os.Signal { // This catches every signal regardless of whether it is ignored. sigCh := make(chan os.Signal, sigsChanBufferSize) signal.Notify(sigCh) // TODO: Remove this if, and when, job control is imple...
// +build !windows,!plan9,!js package sys import ( "os" "os/signal" "syscall" ) func NotifySignals() chan os.Signal { // This catches every signal regardless of whether it is ignored. sigCh := make(chan os.Signal, sigsChanBufferSize) signal.Notify(sigCh) // Calling signal.Notify will reset the signal ignore s...
Document why it's necessary to call signal.Ignore.
pkg/sys: Document why it's necessary to call signal.Ignore.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
952c13db50da3858e6de7af755a873f30edf74c3
ipjogli.go
ipjogli.go
package ipjogli import ( "fmt" "net/http" ) func init() { http.HandleFunc("/", handler) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, r.RemoteAddr+"\n") }
package ipjogli import ( "fmt" "net" "net/http" ) func init() { http.HandleFunc("/", handler) } func handler(w http.ResponseWriter, r *http.Request) { addr, _, err := net.SplitHostPort(r.RemoteAddr) if err != nil { w.WriteHeader(http.StatusInternalServerError) return } fmt.Fprintf(w, addr+"\n") }
Split IP and port from RemoteAddr
Split IP and port from RemoteAddr Request.RemoteAddr should be an IP:port. GAE must be doing some magic to only provide the IP to the app instance as it never contained the port. This adds it in anyway so that local (non-GAE) apps return the correct thing.
Go
bsd-2-clause
jamesog/ip.jog.li
6945ca5ecf49e994ca80d74981fe2f2a043c2401
serve.go
serve.go
package main import ( "flag" "fmt" "net/http" ) var ( port int dir string ) func init() { flag.IntVar(&port, "port", 8080, "Port to run server on.") flag.StringVar(&dir, "dir", ".", "Directory to serve.") flag.Parse() } func main() { http.ListenAndServe(fmt.Sprintf(":%d", port), http.FileServer(http.Dir(d...
package main import ( "flag" "fmt" "net/http" ) var ( port int dir string ) func init() { flag.IntVar(&port, "port", 8080, "Port to run server on.") flag.StringVar(&dir, "dir", ".", "Directory to serve.") flag.Parse() } func main() { fmt.Printf("Serving files from %s, running on http://localhost:%d\n", di...
Print out the URL when it starts
Print out the URL when it starts
Go
mit
gregjones/serve
2841b05b71095d662ecb47831d88371e9cb033ff
pkg/dmesg/dmesg_linux.go
pkg/dmesg/dmesg_linux.go
package dmesg // import "github.com/docker/docker/pkg/dmesg" import ( "unsafe" "golang.org/x/sys/unix" ) // Dmesg returns last messages from the kernel log, up to size bytes func Dmesg(size int) []byte { t := uintptr(3) // SYSLOG_ACTION_READ_ALL b := make([]byte, size) amt, _, err := unix.Syscall(unix.SYS_SYSLO...
package dmesg // import "github.com/docker/docker/pkg/dmesg" import ( "golang.org/x/sys/unix" ) // Dmesg returns last messages from the kernel log, up to size bytes func Dmesg(size int) []byte { t := 3 // SYSLOG_ACTION_READ_ALL b := make([]byte, size) amt, err := unix.Klogctl(t, b) if err != nil { return []byt...
Use Klogctl from x/sys/unix to read Linux kernel log
Use Klogctl from x/sys/unix to read Linux kernel log Signed-off-by: Tobias Klauser <9249c549618448e4c699e8032ba6c7f0d7fd4b7f@distanz.ch>
Go
apache-2.0
dims/docker,kojiromike/docker,AkihiroSuda/docker,bearstech/moby,nawawi/docker,yongtang/docker,jimjag/docker,jameszhan/docker,gnailuy/docker,nawawi/docker,nalind/docker,ibuildthecloud/docker,bearstech/moby,moby/moby,djs55/docker,yosifkit/docker,justincormack/docker,docker/docker,Ramzec/docker,vdemeester/docker,cpuguy83/...
d7e272fe7b2ae6868b74fe2c109bf4c08da34fa7
limiter.go
limiter.go
package limiter // ----------------------------------------------------------------- // Store // ----------------------------------------------------------------- // Store is the common interface for limiter stores. type Store interface { Get(key string, rate Rate) (Context, error) } // ----------------------------...
package limiter // ----------------------------------------------------------------- // Store // ----------------------------------------------------------------- // Store is the common interface for limiter stores. type Store interface { Get(key string, rate Rate) (Context, error) } // ----------------------------...
Remove useless Used field in Limiter struct.
Remove useless Used field in Limiter struct.
Go
mit
ulule/limiter,manavo/limiter,ulule/limiter