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
220aaabb37888f9ed137558613c40010fb70888a
send.go
send.go
// // Copyright © 2011 Guy M. Allard // // 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...
// // Copyright © 2011 Guy M. Allard // // 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...
Add more logging data in Send.
Add more logging data in Send.
Go
apache-2.0
gmallard/stompngo
127d51abc31132564e54280022195157879ab473
main/main_suite_test.go
main/main_suite_test.go
package main_test import ( "os" "os/exec" "path" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestMain(t *testing.T) { RegisterFailHandler(Fail) dir, err := os.Getwd() Expect(err).NotTo(HaveOccurred()) cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl...
package main_test import ( "os" "os/exec" "path" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "testing" ) func TestMain(t *testing.T) { RegisterFailHandler(Fail) dir, err := os.Getwd() Expect(err).NotTo(HaveOccurred()) cmd := exec.Command("go", "build", "-o", path.Join(dir, "..", "fixtures", "pl...
Add ginkgo defer to allow us to see error message
Add ginkgo defer to allow us to see error message -This is when the main_suite_test fails before running the main_test
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
b8b3602976fd85e310d7cb718c6654617a1b4c94
cmd/print-metadata/main.go
cmd/print-metadata/main.go
package main import ( "encoding/json" "os" "strings" "syscall" "github.com/concourse/docker-image-resource/cmd/print-metadata/passwd" ) type imageMetadata struct { User string `json:"user"` Env []string `json:"env"` } var blacklistedEnv = map[string]bool{ "HOSTNAME": true, } func main() { err := json.N...
package main import ( "encoding/json" "fmt" "os" "strings" "syscall" "github.com/concourse/docker-image-resource/cmd/print-metadata/passwd" ) type imageMetadata struct { User string `json:"user,omitempty"` Env []string `json:"env"` } var blacklistedEnv = map[string]bool{ "HOSTNAME": true, } func main()...
Handle when /etc/passwd is missing because the image is built using scratch or another base layer that does not provide that file.
Handle when /etc/passwd is missing because the image is built using scratch or another base layer that does not provide that file.
Go
apache-2.0
ggeorgiev/docker-image-resource,concourse/docker-image-resource,barthy1/docker-image-resource,barthy1/docker-image-resource,SillyMoo/docker-image-resource,concourse/docker-image-resource,ggeorgiev/docker-image-resource,SillyMoo/docker-image-resource
4eba8f1ba77dec3bbf9127a4121046441d9c51a8
cmd/atlas/cmd_ip.go
cmd/atlas/cmd_ip.go
package main import ( "fmt" "github.com/keltia/ripe-atlas" "github.com/urfave/cli" "log" "os" "strconv" ) // init injects our "ip" related commands/options. func init() { // Fill-in the various commands cliCommands = append(cliCommands, cli.Command{ Name: "ip", Usage: "returns current ip", ...
package main import ( "fmt" "github.com/urfave/cli" "log" "os" "strconv" ) // init injects our "ip" related commands/options. func init() { // Fill-in the various commands cliCommands = append(cliCommands, cli.Command{ Name: "ip", Usage: "returns current ip", Description: "shorthand for gett...
Use new API. Reorder & simplify.
Use new API. Reorder & simplify.
Go
mit
keltia/ripe-atlas
99b4364f58cb587c0174b745c76c7158d737313d
cgoflags_darwin.go
cgoflags_darwin.go
package clang // #cgo darwin LDFLAGS: -L/opt/local/libexec/llvm-3.5/lib import "C" //EOF
package clang // #cgo darwin LDFLAGS: -L/usr/local/opt/llvm35/lib/llvm-3.5/lib import "C" //EOF
Use homebrew version of llvm
Use homebrew version of llvm
Go
bsd-2-clause
surullabs/go-clang,surullabs/go-clang
4ab900d14eb2fafec4b92c9a08d085259da489ea
testutil/testclient/main.go
testutil/testclient/main.go
package testclient import ( "io/ioutil" "net/http" "net/http/httptest" "testing" "github.com/parnurzeal/gorequest" ) // TODO consider drop *testing.T parameter func New(t *testing.T, handler http.Handler) *gorequest.SuperAgent { mockTransport := mockTransport{ handler: handler, } // Don't replace httpClien...
package testclient import ( "io/ioutil" "net/http" "net/http/httptest" "testing" "github.com/parnurzeal/gorequest" ) // TODO consider drop *testing.T parameter func New(t *testing.T, handler http.Handler) *gorequest.SuperAgent { mockTransport := mockTransport{ handler: handler, } // Don't replace httpClien...
Change naming for method receiver
Change naming for method receiver
Go
mit
diyan/assimilator,diyan/assimilator,diyan/assimilator
4eb32e5330ef57c9488f6cd483743979276cf3a4
main.go
main.go
package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello Go!! Brought to you by Travis CI.") }) log.Fatal(http.ListenAndServe(":8080", nil)) }
package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello Go!!") }) log.Fatal(http.ListenAndServe(":8080", nil)) }
Revert message to Hello Go
Revert message to Hello Go
Go
mit
breerly/hellogo
268e0768a3cc63b48bbce34a3d53f870a50d168a
resolver/dir/resolver_test.go
resolver/dir/resolver_test.go
package dir_test import ( "os" "path" "testing" "github.com/mlafeldt/chef-runner/resolver/dir" "github.com/mlafeldt/chef-runner/util" "github.com/stretchr/testify/assert" ) const CookbookPath = "test-cookbooks" func TestResolve(t *testing.T) { if err := os.Chdir("../../testdata"); err != nil { panic(err) ...
package dir_test import ( "os" "path" "testing" "github.com/mlafeldt/chef-runner/resolver/dir" "github.com/mlafeldt/chef-runner/util" "github.com/stretchr/testify/assert" ) func TestResolve(t *testing.T) { util.InDir("../../testdata", func() { cookbookPath := "test-cookbooks" defer os.RemoveAll(cookbookPa...
Fix Dir resolver test to succeed with multiple CPUs
Fix Dir resolver test to succeed with multiple CPUs Fixes this problem: $ go test -cpu=1,2 ./... ... --- FAIL: TestResolve (0.00 seconds) panic: chdir ../../testdata: no such file or directory [recovered] See https://blog.splice.com/lesser-known-features-go-test/
Go
apache-2.0
mlafeldt/chef-runner,mlafeldt/chef-runner,mlafeldt/chef-runner,rajthilakmca/chef-runner,rajthilakmca/chef-runner,rajthilakmca/chef-runner
9966e68f5cd9ad3c77cede7578e1b32fa5d0a42b
scoring/entries_test.go
scoring/entries_test.go
package scoring import ( "reflect" "sort" "testing" ) func TestEntriesSort(t *testing.T) { e1 := Entry{"/foo", &Score{100, Now}} e2 := Entry{"/foo/bar", &Score{200, Now}} entries := Entries([]Entry{e1, e2}) expectedEntries := Entries([]Entry{e1, e2}) sort.Sort(entries) if !reflect.DeepEqual(expectedEntrie...
package scoring import ( "reflect" "testing" ) func TestEntriesSort(t *testing.T) { e1 := Entry{"/foo", &Score{100, Now}} e2 := Entry{"/foo/bar", &Score{200, Now}} entries := Entries([]Entry{e1, e2}) expectedEntries := Entries([]Entry{e1, e2}) entries.Sort() if !reflect.DeepEqual(expectedEntries, entries) ...
Fix a typo in a test
Fix a typo in a test
Go
mit
gsamokovarov/jump
c7eb483f56d7429faa440c9a63d3935ea9360d7f
validate.go
validate.go
package main // Validate the provided user and database name func validateUserDB(user string, db string) error { errs := validate.Var(user, "required,alphanum,min=3,max=63") if errs != nil { return errs } errs = validate.Var(db, "required,alphanum|contains=.,min=1,max=1024") if errs != nil { return errs } ...
package main // Validate the provided user and database name func validateUserDB(user string, db string) error { errs := validate.Var(user, "required,alphanum,min=3,max=63") if errs != nil { return errs } errs = validate.Var(db, "required,alphanum|contains=.,min=1,max=1024") if errs != nil { return errs } ...
Add -, -, ., to allowed characters in table names
Add -, -, ., to allowed characters in table names
Go
agpl-3.0
sqlitebrowser/dbhub.io,sqlitebrowser/dbhub-application,sqlitebrowser/dbhub.io,sqlitebrowser/dbhub-application
b1dbaed4bbcd324754a604657224b2484f8df2fb
go/space-age/space_age.go
go/space-age/space_age.go
package space // Planet names type Planet string const secondsInEarthYear = 31557600 var orbitalPeriods = map[Planet]float64{ "Mercury": 0.2408467, "Venus": 0.61519726, "Mars": 1.8808158, "Jupiter": 11.862615, "Saturn": 29.447498, "Uranus": 84.016846, "Neptune": 164.79132, } // Age returns the age in ...
package space // Planet names type Planet string const secondsInEarthYear = 31557600 var orbitalPeriods = map[Planet]float64{ "Mercury": 0.2408467, "Venus": 0.61519726, "Earth": 1, "Mars": 1.8808158, "Jupiter": 11.862615, "Saturn": 29.447498, "Uranus": 84.016846, "Neptune": 164.79132, } // Age retu...
Remove special case for Earth
Remove special case for Earth
Go
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
0b871e418a39c5637d235e4eb6f412aa7188bb5f
drivers/gl/draw_mode.go
drivers/gl/draw_mode.go
// Copyright 2015 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 gl import ( "fmt" "github.com/go-gl/gl/v3.2-core/gl" ) type DrawMode int const ( POINTS DrawMode = gl.POINTS LINE_STRIP DrawMode = g...
// Copyright 2015 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 gl import ( "fmt" "github.com/go-gl/gl/v3.2-core/gl" ) type DrawMode int const ( POINTS DrawMode = gl.POINTS LINE_STRIP DrawMode = g...
Fix typo in method name.
Fix typo in method name. This method does not appear to be used within the gxui codebase.
Go
bsd-3-clause
ylong/gxui,Anaminus/gxui,rnubel/gxui,mzgnr/gxui,henrikhodne/gxui,treejames/gxui,xinhuang327/gxui,leelib/gxui,crr0004/gxui,MeGaPk/gxui,CodyGuo/gxui,abadojack/gxui,cainiaocome/gxui,insionng/gxui,henrylee2cn/gxui,pombredanne/gxui,jmptrader/gxui,UIKit0/gxui,Drahoslav7/gxui,google/gxui
8804623c7fe4f9daf73505ed7f8e56e51f224077
historypage.go
historypage.go
package medtronic const ( LastHistoryPage Command = 0x9D HistoryPage Command = 0x80 ) func (pump *Pump) LastHistoryPage() int { data := pump.Execute(LastHistoryPage) if pump.Error() != nil { return 0 } if len(data) < 5 || data[0] != 4 { pump.BadResponse(LastHistoryPage, data) return 0 } page := four...
package medtronic const ( LastHistoryPage Command = 0x9D HistoryPage Command = 0x80 ) func (pump *Pump) LastHistoryPage() int { data := pump.Execute(LastHistoryPage) if pump.Error() != nil { return 0 } if len(data) < 5 || data[0] != 4 { pump.BadResponse(LastHistoryPage, data) return 0 } page := four...
Use unsigned history page number
Use unsigned history page number
Go
mit
ecc1/medtronic,ecc1/medtronic
043804af00d3b1f10100c616a5cd00dd1db52c86
geoip/geo_ip_test.go
geoip/geo_ip_test.go
package geoip import ( "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "log" "testing" ) // todo: Write meaningful test func TestGeoIP(t *testing.T) { assert.IsType(t, &cobra.Command{}, Command(log.Printf)) }
package geoip import ( "github.com/spf13/cobra" "github.com/stretchr/testify/require" "log" "testing" "net" "github.com/stretchr/testify/assert" ) // todo: Write meaningful test func TestGeoIP(t *testing.T) { require.IsType(t, &cobra.Command{}, Command(log.Printf)) } func TestIP(t *testing.T) { r, err := Rea...
Add some IP to test db
Add some IP to test db
Go
bsd-3-clause
sima-land/go-toolkit
7b24330b68d8ddc5a5d8b83d09002580140b5211
mux/helpers.go
mux/helpers.go
package mux import ( "errors" "fmt" "strings" ) // Converts patterns like "/users/:id" to "/users/(?P<id>\d+)" func convertSimplePatternToRegexp(pattern string) string { parts := strings.Split(pattern, "/") for i, part := range parts { if len(part) != 0 && part[0] == ':' { parts[i] = fmt.Sprintf(`(?P<%s>[a...
package mux import ( "errors" "fmt" "regexp" ) var paramRegexp = regexp.MustCompile(`:([[:lower:]]|_)+`) // Converts patterns like "/users/:id" to "/users/(?P<id>\d+)" func convertSimplePatternToRegexp(pattern string) string { patternWithParams := paramRegexp.ReplaceAllStringFunc(pattern, func(param string) stri...
Remove unnecessary complex operations in path params regexp builder.
Remove unnecessary complex operations in path params regexp builder.
Go
mit
DVI-GI-2017/Jira__backend
07abde73cf7dea2d4bf8d364449362885582eb81
goanna/requestlogger.go
goanna/requestlogger.go
package goanna import ( "bytes" "log" "runtime/debug" "strings" "time" ) const LogRequestTemplate = ` ---------------------------------------------------------------------- %s Url: %s Method: %s Timestamp: %s Request Headers: %s Request Body: %s Stack trace: %s -----------------------------------------------...
package goanna import ( "bytes" "log" "net/http" "runtime/debug" "strings" "time" ) const LogRequestTemplate = ` ---------------------------------------------------------------------- %s Url: %s Method: %s Timestamp: %s Request Headers: %s Request Body: %s Stack trace: %s -----------------------------------...
Add a function to log http requests
Add a function to log http requests
Go
mit
99designs/goodies
3204745417d2011c065d70c4b290e5704f9b7dfc
integration/docker_registry_test.go
integration/docker_registry_test.go
package integration import ( "os" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("kismatic docker registry feature", func() { BeforeEach(func() { dir := setupTestWorkingDir() os.Chdir(dir) }) Describe("using an existing private docker registry", func() { ItOnAWS("should install...
package integration import ( "os" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("kismatic docker registry feature", func() { BeforeEach(func() { dir := setupTestWorkingDir() os.Chdir(dir) }) Describe("using an existing private docker registry", func() { ItOnAWS("should install...
Fix docker registry docker login test
Fix docker registry docker login test
Go
apache-2.0
apprenda/kismatic,apprenda/kismatic,apprenda/kismatic
320753771b94e52d85c27570dd9ebb1d606a5154
integration_test.go
integration_test.go
// +build integration package main import ( "os" "os/exec" "testing" ) var artifacts = []struct { in string out string }{ {"fixtures/virtualbox-ovf.json", "packer_virtualbox-ovf_virtualbox.vhd"}, {"fixtures/virtualbox-ova.json", "packer_virtualbox-ova_virtualbox.vhd"}, } func TestIntegration(t *testing.T) {...
// +build integration package main import ( "log" "os" "os/exec" "testing" ) var artifacts = []struct { in string out string }{ {"fixtures/virtualbox-ovf.json", "packer_virtualbox-ovf_virtualbox.vhd"}, {"fixtures/virtualbox-ova.json", "packer_virtualbox-ova_virtualbox.vhd"}, } // Build the source artifacts...
Set up VirtualBox integration test with OVA/OVF artifacts
Set up VirtualBox integration test with OVA/OVF artifacts
Go
mpl-2.0
benwebber/packer-post-processor-vhd,benwebber/packer-post-processor-vhd
2bac908d8f8fe2d17d6fe61c7c4e7d806251af25
lists/mergesorted.go
lists/mergesorted.go
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package lists // MergeSorted merges int nodes from l and f sorted lists into the ordered list m. // Note: when l or f contains different type from int t...
// Copyright (c) 2015, Peter Mrekaj. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE.txt file. package lists // MergeSorted merges int nodes from l and f sorted lists into the ordered list m. // Note: when l or f contains different type from int t...
Simplify checking when pop-ed value isn't int
Simplify checking when pop-ed value isn't int
Go
mit
mrekucci/epi,mrekucci/epi
e11b881c126b3fe2c31bdc1691ae6efa969062cd
util/appdefaults/appdefaults_windows.go
util/appdefaults/appdefaults_windows.go
package appdefaults const ( Address = "npipe:////./pipe/buildkitd" Root = ".buildstate" ConfigDir = "" ) func UserAddress() string { return Address } func EnsureUserAddressDir() error { return nil } func UserRoot() string { return Root } func UserConfigDir() string { return ConfigDir }
package appdefaults import ( "os" "path/filepath" ) const ( Address = "npipe:////./pipe/buildkitd" ) var ( Root = filepath.Join(os.Getenv("ProgramData"), "buildkitd", ".buildstate") ConfigDir = filepath.Join(os.Getenv("ProgramData"), "buildkitd") ) func UserAddress() string { return Address } func Ensur...
Set sensible defaults for Windows installations
Set sensible defaults for Windows installations Non-packaged execution will need this to be overridden anyway, and it avoids a surprise "Drop state data into the current working directory" event. Signed-off-by: Paul "TBBle" Hampson <220d126b3d70d9d7b0fda508e4cb236265bccc41@Pobox.com>
Go
apache-2.0
tonistiigi/buildkit_poc,tonistiigi/buildkit_poc
73dd2ae69c4b915faa51e7f582bf93453e9f8419
shared/api/instance_console.go
shared/api/instance_console.go
package api // InstanceConsoleControl represents a message on the instance console "control" socket. // // API extension: instances type InstanceConsoleControl struct { Command string `json:"command" yaml:"command"` Args map[string]string `json:"args" yaml:"args"` } // InstanceConsolePost represents a...
package api // InstanceConsoleControl represents a message on the instance console "control" socket. // // API extension: instances type InstanceConsoleControl struct { Command string `json:"command" yaml:"command"` Args map[string]string `json:"args" yaml:"args"` } // InstanceConsolePost represents a...
Add Type field to InstanceConsolePost
shared/api: Add Type field to InstanceConsolePost Signed-off-by: Free Ekanayaka <04111f73b2d444cf053b50d877d79556bf34f55a@canonical.com>
Go
apache-2.0
hallyn/lxd,stgraber/lxd,atxwebs/lxd,lxc/lxd,stgraber/lxd,hallyn/lxd,lxc/lxd,atxwebs/lxd,lxc/lxd,Skarlso/lxd,stgraber/lxd,Skarlso/lxd,stgraber/lxd,atxwebs/lxd,stgraber/lxd,hallyn/lxd,stgraber/lxd,Skarlso/lxd,mjeanson/lxd,Skarlso/lxd,lxc/lxd,lxc/lxd,lxc/lxd,lxc/lxd,hallyn/lxd,atxwebs/lxd,hallyn/lxd,stgraber/lxd,mjeanson/...
5bc9b7a6744253f155d17c77fb3cc0b380e7b7b2
stow_test.go
stow_test.go
package stow_test import ( "errors" "net/url" "testing" "github.com/cheekybits/is" "github.com/graymeta/stow" ) func TestKindByURL(t *testing.T) { is := is.New(t) u, err := url.Parse("test://container/item") is.NoErr(err) kind, err := stow.KindByURL(u) is.NoErr(err) is.Equal(kind, testKind) } func TestKi...
package stow_test import ( "errors" "net/url" "testing" "github.com/cheekybits/is" "github.com/graymeta/stow" ) func TestKindByURL(t *testing.T) { is := is.New(t) u, err := url.Parse("test://container/item") is.NoErr(err) kind, err := stow.KindByURL(u) is.NoErr(err) is.Equal(kind, testKind) } func TestKi...
Write test for duplicate kinds
Write test for duplicate kinds
Go
apache-2.0
graymeta/stow
5e73619f8e2f98fa7ac2cefe533472acd1f783a0
plugin_test.go
plugin_test.go
package pluggo import "testing" func TestRegister1(t *testing.T) { err := Register("ep1", func() interface{} { return "1" }) if err != nil { t.Fatal(err) } } func TestRegister2(t *testing.T) { err := Register("ep2", func() interface{} { return "2" }) if err != nil { t.Fatal(err) } } func TestRegiste...
package pluggo import "testing" func TestRegister1(t *testing.T) { err := Register("ep1", func() interface{} { return "1" }) if err != nil { t.Fatal(err) } } func TestRegister2(t *testing.T) { err := Register("ep2", func() interface{} { return "2" }) if err != nil { t.Fatal(err) } } func TestRegiste...
Add test case for unknown extension point
Add test case for unknown extension point
Go
mit
CAFxX/pluggo
4c1189010453905be238298049a6ff245619a5a9
src/cf/requirements/api_endpoint.go
src/cf/requirements/api_endpoint.go
package requirements import ( "cf" "cf/configuration" "cf/terminal" "fmt" ) type ApiEndpointRequirement struct { ui terminal.UI config configuration.Reader } func NewApiEndpointRequirement(ui terminal.UI, config configuration.Reader) ApiEndpointRequirement { return ApiEndpointRequirement{ui, config} } fu...
package requirements import ( "cf" "cf/configuration" "cf/terminal" "fmt" ) type ApiEndpointRequirement struct { ui terminal.UI config configuration.Reader } func NewApiEndpointRequirement(ui terminal.UI, config configuration.Reader) ApiEndpointRequirement { return ApiEndpointRequirement{ui, config} } fu...
Fix command suggestions when an endpoint needs to be targetted
Fix command suggestions when an endpoint needs to be targetted [Finishes #65764594]
Go
apache-2.0
cf-routing/cli,nimbus-cloud/cli,cgvarela/cli,zhang-hua/cli,nttlabs/cli,18F/cli,srikanth88infy/cli,EngineerBetter/cli,simonleung8/cli,SrinivasChilveri/cli,HuaweiTech/cli,cgvarela/cli,rastasheep/trash-can,ofer43211/cli,xingzhou/cli,xingzhou/cli,18F/cli,pishro-cc/cli,nimbus-cloud/cli,saurabhguptasg/cli,nttlabs/cli,markstg...
a4f07ee962cf45bbf6c309d3b604281e64ed2b11
server/config/config.go
server/config/config.go
package config import ( "path" "github.com/octavore/naga/service" "github.com/octavore/nagax/config" ) type Config struct { DataDir string `json:"data_dir"` // themes, plugins } type Module struct { *config.Module Config Config } func (m *Module) Init(c *service.Config) { c.Setup = func() error { return m...
package config import ( "path" "github.com/octavore/naga/service" "github.com/octavore/nagax/config" ) const defaultDataDir = "data" type Config struct { DataDir string `json:"data_dir"` // themes, plugins } type Module struct { *config.Module Config Config } func (m *Module) Init(c *service.Config) { c.Se...
Make ./data the default data dir.
server: Make ./data the default data dir.
Go
apache-2.0
ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup
9d94bb83334c9bf2230be28246437987ec22e9e5
backend/medias/mediamanager.go
backend/medias/mediamanager.go
package medias import ( "io/ioutil" "encoding/json" "errors" "log" "github.com/mitchellh/mapstructure" ) var Medias []Media const path_to_config string = "data/medias.config.json" func LoadMedias() { //Medias configurations are loaded from a JSON file on the FS. content, err := ioutil.ReadFile(path_to_config...
package medias import ( "encoding/json" "errors" "github.com/mitchellh/mapstructure" "io/ioutil" "log" "github.com/Zenika/MARCEL/backend/commons" ) var Medias []Media const path_to_config string = "data/medias.config.json" func LoadMedias() { //Medias configurations are loaded from a JSON file on the FS. co...
Create and return a new empty media
[Add] Create and return a new empty media
Go
mit
Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL,Zenika/MARCEL
6e4e98cc5a52142df1d883c977cf99e4ebc8b490
redirect/client.go
redirect/client.go
package redirect import ( "fmt" "github.com/fabioberger/airtable-go" ) const ( // DefaultRedirectKey should be fetched if the requested key is not found. DefaultRedirectKey = "default" redirectTableName = "Redirects" ) // Client uses Airtable to implement Redirector. type Client struct { airtableGo *airtable...
package redirect import ( "fmt" "github.com/fabioberger/airtable-go" ) const ( // DefaultRedirectKey should be fetched if the requested key is not found. DefaultRedirectKey = "default" redirectTableName = "Redirects" ) // Client uses Airtable to implement Redirector. type Client struct { airtableGo *airtable...
Use %q to generate quoted values in airtable query
[Client] Use %q to generate quoted values in airtable query
Go
mit
zqureshi/go
4f460e6b719c15fcc11caf2da29723dc20a36e38
rulehunter_unix_test.go
rulehunter_unix_test.go
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris package main // Users that are known on a Unix system to try using var knownUsers = []string{"", "root"}
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris package main import "fmt" // Users that are known on a Unix system to try using var knownUsers = []string{"", "root"} func init() { fmt.Printf("in unix\n") }
Add debug "in unix" message
Add debug "in unix" message
Go
unknown
vlifesystems/rulehuntersrv,vlifesystems/rulehuntersrv,vlifesystems/rulehunter,vlifesystems/rulehunter
d76054118c5c82990465a1f216deb0aec7da1773
src/github.com/keichi/friend/friend-client/main.go
src/github.com/keichi/friend/friend-client/main.go
package main import "fmt" func main() { fmt.Printf("Hello, world.\n") }
package main import ( "bufio" "bytes" "encoding/json" "errors" "fmt" "github.com/keichi/friend/common" "net/http" "os" "strings" ) func main() { createUserPrompt() } func createUserPrompt() { // if alreadyUser { // confirm // } // scan var name, password string s := bufio.NewScanner(os.Stdin) fmt...
Implement process to create user for client
Implement process to create user for client
Go
mit
keichi/friend
6c4726e879b3e8662632615c24cf1ca9bf906d6d
output/text_test.go
output/text_test.go
package output import ( "reflect" "testing" "github.com/stretchr/testify/assert" ) func TestTextDoesRegisterItself(t *testing.T) { assert.Equal(t, "*output.Text", reflect.TypeOf(ForName("text")).String()) }
package output import ( "reflect" "testing" "time" "github.com/hoop33/limo/model" "github.com/stretchr/testify/assert" ) var text Text func TestTextDoesRegisterItself(t *testing.T) { assert.Equal(t, "*output.Text", reflect.TypeOf(ForName("text")).String()) } func ExampleText_Info() { text.Info("This is info...
Add example tests for text
Add example tests for text
Go
mit
hoop33/limo
2a0ebf7c4fd958ac0ee0b25d74f3aaa98e49fea2
avalanche/http_writer.go
avalanche/http_writer.go
package avalanche import ( "fmt" "io/ioutil" "net/http" ) type HTTPWriterConfig struct { Host string Generator Generator } type HTTPWriter struct { c HTTPWriterConfig } func NewHTTPWriter(c HTTPWriterConfig) Writer { return &HTTPWriter{c: c} } func (w *HTTPWriter) Write() error { g := w.c.Generator() re...
package avalanche import ( "fmt" "github.com/valyala/fasthttp" ) type HTTPWriterConfig struct { Host string Generator Generator } type HTTPWriter struct { client fasthttp.Client c HTTPWriterConfig url []byte } func NewHTTPWriter(c HTTPWriterConfig) Writer { return &HTTPWriter{ client: fasthttp.Client...
Use fasthttp client in avalanche.HTTPWriter
Use fasthttp client in avalanche.HTTPWriter benchmark old ns/op new ns/op delta BenchmarkHTTPSmallPoints1-4 97655 75615 -22.57% BenchmarkHTTPSmallPoints2-4 111484 73023 -34.50% BenchmarkHTTPSmallPoints4-4 107066 72719 ...
Go
mit
mark-rushakoff/mountainflux
95a3a717ed8f5ed245147a1b214218a8ad904098
id/random.go
id/random.go
package id import ( "fmt" "crypto/rand" ) // GenerateRandomString creates a random string of characters of the given // length from the given dictionary of possible characters. // // This example generates a hexadecimal string 6 characters long: // GenerateRandomString("0123456789abcdef", 6) func GenerateRandom...
package id import ( "crypto/rand" "fmt" ) // GenerateRandomString creates a random string of characters of the given // length from the given dictionary of possible characters. // // This example generates a hexadecimal string 6 characters long: // GenerateRandomString("0123456789abcdef", 6) func GenerateRandom...
Move remaining writeas/nerds/store funcs to web-core
Move remaining writeas/nerds/store funcs to web-core Finishes the work started in #8.
Go
mpl-2.0
writeas/web-core,writeas/web-core
8702a31d404b4ecaa096553133676dbc97686204
server/main.go
server/main.go
package main import ( "fmt" "net/http" "github.com/zenazn/goji" "github.com/zenazn/goji/web" ) func put(c web.C, w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Put a thing") } func get(c web.C, w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Got a thing") } func main() { goji.Put("/stat...
package main import ( "fmt" "io/ioutil" "log" "net/http" "github.com/zenazn/goji" "github.com/zenazn/goji/web" ) // For now, the server stores a great deal of state in memory, although it will // write as much as it can out to directories that will look reasonable to afl. var binary []byte type QueueMember [...
Add a thing to serve the target binary
Add a thing to serve the target binary
Go
mit
richo/roving,richo/roving,richo/roving,richo/roving
ee32d63b4ba635c2a23cb9503d22b4513ff6a892
kami/main.go
kami/main.go
package main import ( "encoding/json" "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, ) { page, err := strconv.Atoi(r.FormValue("page"...
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();...
Add recovering to getContacts handler
Add recovering to getContacts handler
Go
mit
konjoot/benches,konjoot/benches,konjoot/benches
97bbf8713c67e3c6bfc1178eee130b3a0253dbc5
bots.go
bots.go
package slackapi // ResponseBot defines the JSON-encoded output for Bot. type ResponseBot struct { Response Bot BotEntity `json:"bot"` } // BotEntity defines the expected data from the JSON-encoded API response. type BotEntity struct { ID string `json:"id"` Deleted bool `json:"deleted...
package slackapi // ResponseBot defines the JSON-encoded output for Bot. type ResponseBot struct { Response Bot Bot `json:"bot"` } // Bot defines the expected data from the JSON-encoded API response. type Bot struct { ID string `json:"id"` Deleted bool `json:"deleted"` Name string...
Modify name of the data type that holds the bot entity
Modify name of the data type that holds the bot entity
Go
mit
cixtor/slackapi
92f040c291bf5e56d9f1be3ad4943642f6afdfb8
bin/worker/main.go
bin/worker/main.go
package main import ( "github.com/hanwen/go-fuse/termite" "flag" "io/ioutil" "log" ) var _ = log.Printf func main() { cachedir := flag.String("cachedir", "/tmp/worker-cache", "content cache") secretFile := flag.String("secret", "/tmp/secret.txt", "file containing password.") port := flag.Int("port", 1235, "Wh...
package main import ( "github.com/hanwen/go-fuse/termite" "flag" "io/ioutil" "log" ) var _ = log.Printf func main() { cachedir := flag.String("cachedir", "/var/cache/termite/worker-cache", "content cache") secretFile := flag.String("secret", "/tmp/secret.txt", "file containing password.") port := flag.Int("po...
Put default worker cache under /var/cache.
Put default worker cache under /var/cache.
Go
bsd-3-clause
hanwen/termite,hanwen/termite,hanwen/termite
0467c0c38ca2d4197a5180c45fc29baf80dad0a0
hclpack/exprsourcetype_string.go
hclpack/exprsourcetype_string.go
// Code generated by "stringer -type ExprSourceType"; DO NOT EDIT. package hclpack import "strconv" const ( _ExprSourceType_name_0 = "ExprNative" _ExprSourceType_name_1 = "ExprTemplate" ) func (i ExprSourceType) String() string { switch { case i == 78: return _ExprSourceType_name_0 case i == 84: return _Ex...
// Code generated by "stringer -type ExprSourceType"; DO NOT EDIT. package hclpack import "strconv" const ( _ExprSourceType_name_0 = "ExprLiteralJSON" _ExprSourceType_name_1 = "ExprNative" _ExprSourceType_name_2 = "ExprTemplate" ) func (i ExprSourceType) String() string { switch { case i == 76: return _ExprS...
Update ExprSourceType.String to include ExprLiteralJSON
hclpack: Update ExprSourceType.String to include ExprLiteralJSON
Go
mpl-2.0
strivecast/hcl,hashicorp/hcl,hashicorp/hcl,strivecast/hcl,strivecast/hcl,hashicorp/hcl,strivecast/hcl,hashicorp/hcl,strivecast/hcl,hashicorp/hcl
68a64d1b90a498bc576df3483f5d8a28e5625d88
helpers/process_group_windows.go
helpers/process_group_windows.go
package helpers import ( "os/exec" ) func SetProcessGroup(cmd *exec.Cmd) { } func KillProcessGroup(cmd *exec.Cmd) { if cmd == nil || cmd.Process == nil { return } cmd.Process.Kill() }
package helpers import ( "os/exec" "strconv" ) func SetProcessGroup(cmd *exec.Cmd) { } func KillProcessGroup(cmd *exec.Cmd) { if cmd == nil || cmd.Process == nil { return } exec.Command("taskkill", "/F", "/T", "/PID", strconv.Itoa(cmd.Process.Pid)).Run() cmd.Process.Kill() }
Use taskkill on Windows to kill all processes in group
Use taskkill on Windows to kill all processes in group
Go
mit
soiff/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner,soiff/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner,soiff/gitlab-ci-multi-runner,ayufan/gitlab-ci-multi-runner,ayufan/gitlab-ci-multi-runner,hu19891110/gitlab-ci-multi-runner,ayufan/gitlab-ci-multi-runner
2221b5b30a285d01220a26a82305906ad3291880
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.107.0
releaser: Bump versions for release of 0.107.0 [ci skip]
Go
apache-2.0
gohugoio/hugo,gohugoio/hugo,gohugoio/hugo
d0034c1c6a36f75cf8f086ca7e13ab144902bb5c
g/const.go
g/const.go
package g import ( "time" ) // changelog: // 3.1.3: code refactor // 3.1.4: bugfix ignore configuration // 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小 // 5.1.0: 同步插件的时候不再使用checksum机制 const ( VERSION = "5.1.2" COLLECT_INTERVAL = time.Second URL_CHECK_HEALTH = "url.check.health" NET_PORT_LISTEN = "net....
package g import ( "time" ) // changelog: // 3.1.3: code refactor // 3.1.4: bugfix ignore configuration // 5.0.0: 支持通过配置控制是否开启/run接口;收集udp流量数据;du某个目录的大小 // 5.1.0: 同步插件的时候不再使用checksum机制 // 5.1.3: Fix config syntax error when deploying const ( VERSION = "5.1.3" COLLECT_INTERVAL = time.Second URL_CHECK_HEAL...
Fix config syntax error when deploying
Fix config syntax error when deploying
Go
apache-2.0
Cepave/open-falcon-backend,Cepave/agent,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/agent,Cepave/agent,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/agent,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-fal...
524561a02a86159dc335c276cd1c8a287d8e7ad6
general.go
general.go
// Copyright 2015 Jonathan J Lawlor. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package matrixexp import ( "github.com/gonum/blas/blas64" ) // General is a typical matrix literal type General struct { blas64.General } // Dims return...
// Copyright 2015 Jonathan J Lawlor. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package matrixexp import ( "github.com/gonum/blas/blas64" ) // General is a typical matrix literal type General struct { blas64.General } // Dims return...
Rename matrix receiver for General to m
Rename matrix receiver for General to m I'll try to keep names consistent.
Go
mit
jonlawlor/matrixexp
f7929c0b4c656af1219802524fa724a3e744f614
useragent.go
useragent.go
package main import ( "net/http" "strings" ) var ( // Whitelist crawlers here crawlerPatterns = [...]string{ "Google (+https://developers.google.com/+/web/snippet/)", "Googlebot", "bingbot", "MSNbot", "facebookexternalhit", "PlurkBot", "Twitterbot", "CloudFlare-AlwaysOnline", } ) func isCrawlerU...
package main import ( "net/http" "strings" ) var ( // Whitelist crawlers here crawlerPatterns = [...]string{ "Google (+https://developers.google.com/+/web/snippet/)", "Googlebot", "bingbot", "MSNbot", "facebookexternalhit", "PlurkBot", "Twitterbot", "TelegramBot", "CloudFlare-AlwaysOnline", } )...
Add Telegram preview to crawler list
Add Telegram preview to crawler list This fixes #3
Go
mit
ptt/pttweb
84754d34a09bcadc95d689470dd5ea7de77cb78b
gobreak.go
gobreak.go
package gobreak import "time" type runFunc func() error type fallbackFunc func(error) error const ( Success = "success" ErrReject = "reject" ErrFail = "fail" ) // Do runs your function in a synchronous manner, blocking until either your function succeeds // or an error is returned, including circuit errors f...
package gobreak import "time" type runFunc func() error type fallbackFunc func(error) error const ( Success = "success" ErrReject = "reject" ErrFallBack = "fallback" ErrFail = "fail" ErrPanic = "panic" ) // Do runs your function in a synchronous manner, blocking until either your function succeeds...
Add recovery and improve errType
Add recovery and improve errType
Go
mit
hnlq715/gobreak
4be8c98cf87aaadd3c8f8ce81dc69e43e5a29446
pkg/hooks/driver_notification.go
pkg/hooks/driver_notification.go
package hooks import ( "bytes" "github.com/deckarep/gosx-notifier" ) import "text/template" // NotificationDriver is a driver that notifications some texts to the terminal type NotificationDriver struct { line string } // NewNotificationDriver returns a NotificationDriver instance func NewNotificationDriver(line...
package hooks import ( "bytes" "github.com/haklop/gnotifier" ) import "text/template" // NotificationDriver is a driver that notifications some texts to the terminal type NotificationDriver struct { line string } // NewNotificationDriver returns a NotificationDriver instance func NewNotificationDriver(line strin...
Switch to crossplatform notification library
Switch to crossplatform notification library
Go
mit
moul/advanced-ssh-config,moul/advanced-ssh-config,moul/advanced-ssh-config
8fe48dcb1ebbdd4d705000ad20077a7dbeec19ab
pkg/sentry/syscalls/linux/linux64.go
pkg/sentry/syscalls/linux/linux64.go
// Copyright 2019 The gVisor 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 agree...
// Copyright 2019 The gVisor 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 agree...
Add sublevel to kernel version
Add sublevel to kernel version Standard Linux kernel versions are VERSION.PATCHLEVEL.SUBLEVEL. e.g., 4.4.0, even when the sublevel is 0. Match this standard. PiperOrigin-RevId: 275125715
Go
apache-2.0
google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor,google/gvisor
8c7db7220495d7d173942d37a049434b83c4d7fd
gen/config.go
gen/config.go
package gen type Config struct { Source string `json:"source"` Destination string `json:'destination"` Safe bool `json:"safe"` Excluede []string `json:"exclude"` Include string `json""include"` KeepFiles string `json:"keep_files"` TimeZone string `json:"timezone"` Encoding...
package gen type Config struct { Source string `json:"source"` Destination string `json:'destination"` Safe bool `json:"safe"` Excluede []string `json:"exclude"` Include []string `json""include"` KeepFiles string `json:"keep_files"` TimeZone string `json:"timezone"` Encoding...
Include a list of files
Include a list of files
Go
mit
gernest/wuxia,gernest/wuxia,gernest/wuxia,gernest/wuxia
9cc78714d5355f8a8036d9a5e34de6b37dd40cf8
modules/redhat/yum/yum_test.go
modules/redhat/yum/yum_test.go
package yum import ( "testing" "github.com/hnakamur/commango/jsonutil" ) func TestInstalled(t *testing.T) { result, err := Installed("kernel") if err != nil { t.Fatal(err) } _, err = jsonutil.Encode(result) if err != nil { t.Fatal(err) } } func TestNotInstalled(t *testing.T) { result, err := Instal...
package yum import ( "testing" "github.com/hnakamur/commango/jsonutil" ) func TestInstalled(t *testing.T) { result, err := Installed("kernel") if err != nil { t.Fatal(err) } _, err = jsonutil.Encode(result) if err != nil { t.Fatal(err) } } func TestNotInstalled(t *testing.T) { result, err := Instal...
Remove debug prints in test.
Remove debug prints in test.
Go
mit
hnakamur/commango
00b07aebe897112da160810b5ce3365638d7936e
igo.go
igo.go
// The igo command starts a Go kernel for IPython. package main import ( "flag" "io" "log" "os" igo "github.com/takluyver/igo/igopkg" ) func main() { debug := flag.Bool("debug", false, "Log extra info to stderr") flag.Parse() if flag.NArg() < 1 { log.Fatalln("Need a command lin...
// The igo command starts a Go kernel for IPython. package main import ( "flag" "io" "io/ioutil" "log" "os" igo "github.com/takluyver/igo/igopkg" ) func main() { debug := flag.Bool("debug", false, "Log extra info to stderr") flag.Parse() if flag.NArg() < 1 { log.Fatalln("Ne...
Use ioutil.Discard instead of opening /dev/null
Use ioutil.Discard instead of opening /dev/null
Go
mit
takluyver/igo,axw/go-jupyter
e41ed07b5b098a59f9b792856ebe7b83bd7dbd9d
helloworld.go
helloworld.go
package main import ( "fmt" "io" "os" ) const version = "0.1.3" func testPrint(w io.Writer) { fmt.Fprint(w, "Hello world!! "+version+"\n") } func main() { testPrint(os.Stdout) }
package main import ( "fmt" "io" "os" ) const version = "0.1.3" func testPrint(w io.Writer) { fmt.Fprint(w, "Hello world!! ["+version+"]\n") } func main() { testPrint(os.Stdout) }
Change output format without change version
Change output format without change version
Go
mit
manabu/wercker-golang-helloworld-build-cmd
987488ab356a17cb3337495a916596c578f3b424
client/iruka.go
client/iruka.go
package iruka import ( "encoding/json" "net/http" ) type Client struct { // The URL of the iruka API to communicate with. URL string } func NewClient() *Client { url := "http://localhost:3000/api/v1" return &Client{ URL: url, } } func (c *Client) Get(v interface{}, path string) error { req, err := http.N...
package iruka import ( "encoding/json" "net/http" ) type Client struct { // The URL of the iruka API to communicate with. URL string } func NewClient() *Client { url := "http://localhost:3000/api/v1-alpha" return &Client{ URL: url, } } func (c *Client) Get(v interface{}, path string) error { req, err := ...
Change default url to /api/v1-alpha
client: Change default url to /api/v1-alpha
Go
mit
spesnova/iruka,spesnova/iruka,spesnova/iruka,spesnova/iruka
0f9bff359e2a09146cd671150c8e873296191ba9
cmd/sensorbee/genmain.go
cmd/sensorbee/genmain.go
//go:generate build_sensorbee --output-dir=. --output-filename=default_main.go package main
//go:generate build_sensorbee --output-dir=. --output-filename=default_main.go --download-plugins=false package main
Disable auto downloading of plugins in sensorbee binary
Disable auto downloading of plugins in sensorbee binary
Go
mit
sensorbee/sensorbee,sensorbee/sensorbee
b720face45ad6c89ae631885582ccf62c2dddec7
http2/3_starting_http2.go
http2/3_starting_http2.go
package http2 import "github.com/summerwind/h2spec/spec" func StartingHTTP2() *spec.TestGroup { tg := NewTestGroup("3", "Starting HTTP/2") tg.AddTestGroup(StartingHTTP2ForHTTPURIs()) tg.AddTestGroup(HTTP2ConnectionPreface()) return tg }
package http2 import "github.com/summerwind/h2spec/spec" func StartingHTTP2() *spec.TestGroup { tg := NewTestGroup("3", "Starting HTTP/2") tg.AddTestGroup(HTTP2ConnectionPreface()) return tg }
Remove test cases for RFC7540 3.2 (again)
Remove test cases for RFC7540 3.2 (again)
Go
mit
summerwind/h2spec
615b894aab2d9ee84a7cea6ef72d7fccf15216f8
util/checkers_test.go
util/checkers_test.go
package util_test import ( . "github.com/naaman/busl/util" "testing" ) func TestIsTrueTrueValueIsTrue(t *testing.T) { trueCheck, _ := IsTrue.Check([]interface{}{true}, []string{}) if !trueCheck { t.Errorf("Expected IsTrue to return true, but got false.") } } func TestIsTrueFalseValueIsFalse(t *testing.T) { t...
package util_test import ( . "github.com/naaman/busl/util" check "gopkg.in/check.v1" "testing" ) type checkerTest struct { check check.Checker input []interface{} expected bool } var checkerTests = []checkerTest{ checkerTest{IsTrue, []interface{}{true}, true}, checkerTest{IsTrue, []interface{}{false}, ...
Rewrite checkers tests as a table.
Rewrite checkers tests as a table.
Go
mit
heroku/busl,heroku/busl,cyx/busl
cfb4962efb1ea40322b99ada892bc3203dce6d7c
examples/simple/main.go
examples/simple/main.go
package main import ( "fmt" "github.com/brettbuddin/victor" "os" "os/signal" ) func main() { bot := victor.New("campfire", "victor", ":8000") bot.HandleFunc(bot.Direct("hello|hi|howdy"), func(s *victor.State) { s.Chat().Send(s.Message().ChannelID(), fmt.Sprintf("Hello, %s", s.Message().UserName())) }) go ...
package main import ( "fmt" "github.com/brettbuddin/victor" "os" "os/signal" ) func main() { bot := victor.New("shell", "victor", ":8000") bot.HandleFunc(bot.Direct("hello|hi|howdy"), func(s *victor.State) { s.Chat().Send(s.Message().ChannelID(), fmt.Sprintf("Hello, %s", s.Message().UserName())) }) go bot...
Make the example runnable in CLI
Make the example runnable in CLI
Go
mit
thebyrd/victor,brettbuddin/victor,FogCreek/victor
eafb5565c9cb876fb2de19c4d02bf4462f9d6310
service_update.go
service_update.go
package client import ( "encoding/json" "net/url" "strconv" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "golang.org/x/net/context" ) // ServiceUpdate updates a Service. func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swa...
package client import ( "encoding/json" "net/url" "strconv" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "golang.org/x/net/context" ) // ServiceUpdate updates a Service. func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swa...
Implement server-side rollback, for daemon versions that support this
Implement server-side rollback, for daemon versions that support this Server-side rollback can take advantage of the rollback-specific update parameters, instead of being treated as a normal update that happens to go back to a previous version of the spec. Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a...
Go
apache-2.0
allencloud/cli,cpuguy83/cli,redpanda/cli,thaJeztah/cli,gdevillele/cli,redpanda/cli,Zebrilee/cli,e11137/cli,dnephin/cli,allencloud/cli,ashfall/cli,riyazdf/cli,Zebrilee/cli,ashfall/cli,thaJeztah/cli,e11137/cli,docker/cli,cpuguy83/cli,dnephin/cli,riyazdf/cli,docker/cli
3416a80f4fb79493fa62faf62d463374e2747eb2
keg/keg.go
keg/keg.go
package keg import ( "time" "net" "log" ) type KegStatus struct { Temperature float64 CurrentFlow float64 Capacity float64 Available float64 LastUpdate time.Time Connection* net.UDPConn } func Initialize() (KegStatus, error) { status := KegStatus {} socket, err := net.ListenUDP("udp4", &net.UDPAddr { IP...
package keg import ( "time" "net" "log" ) type KegStatus struct { Temperature float64 CurrentFlow float64 Capacity float64 Available float64 LastUpdate time.Time Connection* net.UDPConn } func Initialize() (KegStatus, error) { status := KegStatus {} socket, err := net.ListenUDP("udp4", &net.UDPAddr { IP...
Switch UDP to listen on all interfaces
Switch UDP to listen on all interfaces
Go
mit
Aspenware/ardrinko-server
82c0d4527af6b3cf9510020517ccd4552da23bdc
agent/sender.go
agent/sender.go
package agent import ( "time" "fmt" "github.com/crowdmob/goamz/aws" "github.com/crowdmob/goamz/cloudwatch" ) const ( SCHEDULED_LOOP = 6 ) var cw *cloudwatch.CloudWatch func init() { region := aws.Regions["eu-west-1"] auth, err := aws.EnvAuth() if err != nil { L.Err("Unable t...
package agent import ( "time" "fmt" "github.com/crowdmob/goamz/aws" "github.com/crowdmob/goamz/cloudwatch" ) const ( SCHEDULED_LOOP = 60 ) var cw *cloudwatch.CloudWatch func init() { region := aws.Regions["eu-west-1"] auth, err := aws.EnvAuth() if err != nil { L.Err("Unable ...
Send to cloud every 60 seconds
Send to cloud every 60 seconds
Go
mit
wdalmut/cloudwatch-agent
022e2514f0d22ea9799edfd31f0396f8bad0ea77
logging.go
logging.go
// +build !windows package main import ( "log" "log/syslog" ) func initLogger(slog bool) { if slog { lw, err := syslog.New(syslog.LOG_INFO, "cbfs") if err != nil { log.Fatalf("Can't initialize syslog: %v", err) } log.SetOutput(lw) } }
// +build !windows package main import ( "log" "log/syslog" ) func initLogger(slog bool) { if slog { lw, err := syslog.New(syslog.LOG_INFO, "cbfs") if err != nil { log.Fatalf("Can't initialize syslog: %v", err) } log.SetOutput(lw) log.SetFlags(0) } }
Disable time output when using syslog.
Disable time output when using syslog.
Go
apache-2.0
couchbaselabs/cbfs,couchbaselabs/cbfs,couchbaselabs/cbfs
24b77db0ed9042c1c916d1bbd9f02fe8fb1bd153
message.go
message.go
package gdax type Message struct { Type string `json:"type"` ProductId string `json:"product_id"` TradeId int `json:"trade_id,number"` OrderId string `json:"order_id"` Sequence int64 `json:"sequence,number"` MakerOrderId string `json:"maker_order_id"` T...
package gdax type Message struct { Type string `json:"type"` ProductId string `json:"product_id"` TradeId int `json:"trade_id,number"` OrderId string `json:"order_id"` Sequence int64 `json:"sequence,number"` MakerOrderId string `json:"maker_order_id"` T...
Add fields to Message to support the ticker channel
Add fields to Message to support the ticker channel
Go
mit
preichenberger/go-coinbase-exchange
e15b4156a8b66145ec0a162244b0e0d9582af6f7
provider/vsphere/init.go
provider/vsphere/init.go
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build !gccgo package vsphere import ( "github.com/juju/utils/featureflag" "github.com/juju/juju/environs" "github.com/juju/juju/feature" "github.com/juju/juju/juju/osenv" "github.com/juju/juju/storage/provider/regi...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. // +build !gccgo package vsphere import ( "github.com/juju/juju/environs" "github.com/juju/juju/storage/provider/registry" ) const ( providerType = "vsphere" ) func init() { environs.RegisterProvider(providerType, prov...
Drop feature flag handling for vsphere.
Drop feature flag handling for vsphere.
Go
agpl-3.0
voidspace/juju,marcmolla/juju,axw/juju,mhilton/juju-juju,anastasiamac/juju,tych0/juju,frankban/juju,macgreagoir/juju,fwereade/juju,waigani/juju,bac/juju,anastasiamac/juju,tsakas/juju,mhilton/juju,tych0/juju,howbazaar/juju,frankban/juju,axw/juju,voidspace/juju,reedobrien/juju,cloud-green/juju,gabriel-samfira/juju,mikemc...
d83f19128560cc9ee325b61b384243185c4dc285
tests/modelstest.go
tests/modelstest.go
package tests import ( "github.com/gojp/nihongo/app/models" "github.com/robfig/revel" ) type ModelsTest struct { revel.TestSuite } func (s *ModelsTest) Before() { } func (s *ModelsTest) After() { } func (s *ModelsTest) TestHighlightQuery() { // some basic checks w := models.Word{ English: []string{"test"},...
package tests import ( "github.com/gojp/nihongo/app/models" "github.com/robfig/revel" ) type ModelsTest struct { revel.TestSuite } func (s *ModelsTest) Before() { } func (s *ModelsTest) After() { } func (s *ModelsTest) TestHighlightQuery() { // some basic checks w := models.Word{ English: []string{"test"},...
Test romaji and katakana input to highlightQuery
Test romaji and katakana input to highlightQuery
Go
mit
shawnps/nihongo,shawnps/nihongo,gojp/nihongo,shawnps/nihongo,gojp/nihongo,gojp/nihongo,shawnps/nihongo,gojp/nihongo
dcd47ba6c002705500a0a57276c83e3a9a3d5101
processes.go
processes.go
package hsup import ( "errors" "os" "runtime" ) var ErrNoReleases = errors.New("No releases found") type Notifier interface { Notify() <-chan *Processes } type Processes struct { Rel *Release Forms []Formation Dd DynoDriver OneShot bool Executors []*Executor } type Formation interface { Args(...
package hsup import ( "bitbucket.org/kardianos/osext" "errors" "log" "runtime" ) var ErrNoReleases = errors.New("No releases found") type Notifier interface { Notify() <-chan *Processes } type Processes struct { Rel *Release Forms []Formation Dd DynoDriver OneShot bool Executors []*Executor } ...
Make self-executable location work when in $PATH
Make self-executable location work when in $PATH When invoking without a relative path, "hsup" cannot adequately find itself (or its Linux AMD64 variant) to inject into the container. There is no portable way to do this, so rely on an external project with a simple interface that exists for that express purpose.
Go
bsd-2-clause
heroku/hsup,heroku/hsup,fdr/hsup-fdr,fdr/hsup-fdr
d8c56a9536ea3aba8b44cdc08947422f7c2d3780
num/t_nlsolverconfig_test.go
num/t_nlsolverconfig_test.go
// Copyright 2016 The Gosl 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 num import ( "testing" "gosl/chk" ) func TestNlsConfig01(tst *testing.T) { // verbose() chk.PrintTitle("NlsConfig01") c := NewNlSolverConfig...
// Copyright 2016 The Gosl 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 num import ( "testing" "gosl/chk" ) func TestNlsConfig01(tst *testing.T) { // verbose() chk.PrintTitle("NlsConfig01") c := NewNlSolverConfig...
Fix test in num about la flags
Fix test in num about la flags
Go
bsd-3-clause
cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl,cpmech/gosl
9d4fc977e481f2f1e38021e78100d445dc1b9a82
Tamalou.go
Tamalou.go
package main import ( "fmt" "log" mgo "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "github.com/blevesearch/bleve" ) func main() { } // Bleve example func bleveExample() { // open a new index mapping := bleve.NewIndexMapping() index, err := bleve.New("example.bleve", mapping) if err != nil { fmt.Println(err...
package main import ( "fmt" "github.com/blevesearch/bleve" ) func main() { } // Bleve example func bleveExample() { // open a new index mapping := bleve.NewIndexMapping() index, err := bleve.New("example.bleve", mapping) if err != nil { fmt.Println(err) return } data := struct { Name string }{ Na...
Remove MongoDB Example from main file
Remove MongoDB Example from main file
Go
mit
artonge/Tamalou,artonge/Tamalou
45d3882de1772ba4d9d07d7cbc920ae544871b3d
app.go
app.go
package gogist import ( "fmt" "net/http" "github.com/gorilla/mux" ) const t = ` <html> <head> <meta name="go-import" content="%s git https://gist.github.com/%s.git" /> <script>window.location='https://github.com/ImJasonH/go-gist/';</script> </head> </html> ` func init() { r := mux.NewRouter() h := ...
package gogist import ( "fmt" "net/http" "github.com/gorilla/mux" ) const t = ` <html> <head> <meta name="go-import" content="%s git https://gist.github.com/%s.git" /> <script>window.location='https://github.com/ImJasonH/go-gist/';</script> </head> </html> ` func init() { r := mux.NewRouter() h := ...
Reorder route ordering for great justice
Reorder route ordering for great justice
Go
apache-2.0
ImJasonH/go-gist
8d60934d211f5c161246dfd3168013edef59ebda
database/client_test.go
database/client_test.go
package database_test import ( "os" "testing" "github.com/josephspurrier/gocleanarchitecture/database" "github.com/josephspurrier/gocleanarchitecture/domain/user" ) // TestClient ensures the client works properly. func TestClient(t *testing.T) { c := database.NewClient("db.json") // Check the output. AssertE...
package database_test import ( "io/ioutil" "os" "testing" "github.com/josephspurrier/gocleanarchitecture/database" "github.com/josephspurrier/gocleanarchitecture/domain/user" ) // TestClient ensures the client works properly. func TestClient(t *testing.T) { c := database.NewClient("db.json") // Check the out...
Add additional failure checks on client.
Add additional failure checks on client.
Go
mit
josephspurrier/gocleanarchitecture,pt-arvind/gocleanarchitecture
3dbae591d8779dc08f641adfad75290fe68b6999
db/model/offer_group_post.go
db/model/offer_group_post.go
package model import ( "time" "gopkg.in/mgo.v2/bson" ) const OfferGroupPostCollectionName = "offer_group_post" type ( OfferGroupPost struct { ID bson.ObjectId `json:"_id,omitempty" bson:"_id,omitempty"` RestaurantID bson.ObjectId `json:"restaurant_id" bson:"restaurant_id"` ...
package model import ( "time" "gopkg.in/mgo.v2/bson" ) const OfferGroupPostCollectionName = "offer_group_post" type ( OfferGroupPost struct { ID bson.ObjectId `json:"_id,omitempty" bson:"_id,omitempty"` RestaurantID bson.ObjectId `json:"restaurant_id" bson:"restaurant_id"` Date ...
Reorder struct fields by relevance
Reorder struct fields by relevance The first 3 can uniquely identify a post.
Go
bsd-3-clause
Lunchr/luncher-api
e0fc0a527e23889f1c835208d65c65f4f8684602
fsm.go
fsm.go
package raft import ( "io" ) // FSM provides an interface that can be implemented by // clients to make use of the replicated log type FSM interface { // Apply log is invoked once a log entry is commited Apply(*Log) interface{} // Snapshot is used to support log compaction. This call should // return an FSMSnap...
package raft import ( "io" ) // FSM provides an interface that can be implemented by // clients to make use of the replicated log type FSM interface { // Apply log is invoked once a log entry is commited Apply(*Log) interface{} // Snapshot is used to support log compaction. This call should // return an FSMSnap...
Clarify how Persist() is supposed to work.
Clarify how Persist() is supposed to work.
Go
mpl-2.0
wantonsolutions/raft,otoolep/raft,dgnorton/raft,hashicorp/raft,hashicorp/raft,sean-/raft,tempbottle/raft-2,PattyW/raft_govec,jmptrader/raft-1
41c77d92452c138c4aec8fe3190431aa6b525659
scandir.go
scandir.go
package dirscanner import ( "fmt" "io/ioutil" "path" ) func ScanDir(a_path string, a_fileMsgs chan FileMsg, a_events chan Event) { if files, err := ioutil.ReadDir(a_path); err == nil { for _, file := range files { if file.IsDir() { ScanDir(path.Join(a_path, fi...
package dirscanner import ( "fmt" "io/ioutil" "path" ) func ScanDir(a_path string, a_fileMsgs chan FileMsg, a_events chan Event) { if files, err := ioutil.ReadDir(a_path); err == nil { for _, file := range files { if file.IsDir() { a_fileMsgs <- FileMsg{a_path...
Send events for dirs to...
Send events for dirs to...
Go
mit
odanielson/dirscanner
81be4fbc6e5935f53e57961728c836fcf0ac3db4
rc4/rc4.go
rc4/rc4.go
package rc4 // #cgo LDFLAGS: -lcrypto // #include <openssl/rc4.h> import "C" import ( "strconv" ) type Cipher struct { key *_Ctype_RC4_KEY } type KeySizeError int func (k KeySizeError) Error() string { return "rc4: invalid key size " + strconv.Itoa(int(k)) } func NewCipher(key []byte) (*Cipher, error) { k :=...
package rc4 // #cgo LDFLAGS: -lcrypto // #include <openssl/rc4.h> import "C" import ( "strconv" ) type Cipher struct { key *_Ctype_RC4_KEY } type KeySizeError int func (k KeySizeError) Error() string { return "rc4: invalid key size " + strconv.Itoa(int(k)) } func NewCipher(key []byte) (*Cipher, error) { k := ...
Remove blank line that breaks cgo
Remove blank line that breaks cgo
Go
bsd-3-clause
jgrahamc/go-openssl
e1f20b9613cfd1c2d31b1fac5de4614d0af4559a
sh_test.go
sh_test.go
// Copyright (c) 2016, Daniel Martí <mvdan@mvdan.cc> // See LICENSE for licensing information package sh import ( "os" "path/filepath" "testing" ) func TestParse(t *testing.T) { paths, err := filepath.Glob("testdata/*.sh") if err != nil { t.Fatal(err) } for _, path := range paths { testParse(t, path) } }...
// Copyright (c) 2016, Daniel Martí <mvdan@mvdan.cc> // See LICENSE for licensing information package sh import ( "os" "path/filepath" "strings" "testing" ) func TestParse(t *testing.T) { paths, err := filepath.Glob("testdata/*.sh") if err != nil { t.Fatal(err) } for _, path := range paths { testParse(t,...
Add expected parse error tests
Add expected parse error tests
Go
bsd-3-clause
mvdan/sh,mvdan/sh,mvdan/sh,mvdan/sh
3e02622ac624b15363b38c3e5f13f65c83408f65
examples/simple/main.go
examples/simple/main.go
package main import ( // "fmt" "log" "net/http" "github.com/codykrieger/jeeves" ) func main() { j := jeeves.New() j.RegisterSkill(&jeeves.Skill{ Name: "Hello", Endpoint: "/skills/hello", ApplicationID: "amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe", Handler: helloHandle...
package main import ( // "fmt" "log" "net/http" "github.com/codykrieger/jeeves" ) func main() { j := jeeves.New() j.RegisterSkill(&jeeves.Skill{ Name: "Hello", Endpoint: "/skills/hello", ApplicationID: "amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe", Handler: helloHandle...
Make it easier to see when the example app is listening.
Make it easier to see when the example app is listening.
Go
mit
codykrieger/jeeves
0a933492b0feee22f3b5f73fa6eb432d8d217348
observers/snake_observer.go
observers/snake_observer.go
package observers import ( "github.com/sirupsen/logrus" "github.com/ivan1993spb/snake-server/objects/corpse" "github.com/ivan1993spb/snake-server/objects/snake" "github.com/ivan1993spb/snake-server/world" ) type SnakeObserver struct{} func (SnakeObserver) Observe(stop <-chan struct{}, w *world.World, logger log...
package observers import ( "github.com/sirupsen/logrus" "github.com/ivan1993spb/snake-server/objects/corpse" "github.com/ivan1993spb/snake-server/objects/snake" "github.com/ivan1993spb/snake-server/world" ) const chanSnakeObserverEventsBuffer = 32 type SnakeObserver struct{} func (SnakeObserver) Observe(stop <...
Create error logging in snake observer
Create error logging in snake observer
Go
bsd-2-clause
ivan1993spb/clever-snake
9b7cd3ec74750744ec31303411a216b35f712930
lisp_test.go
lisp_test.go
// Copyright 2014 SteelSeries ApS. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This package implements a basic LISP interpretor for embedding in a go program for scripting. // This file runs lisp based tests. package golisp import (...
// Copyright 2014 SteelSeries ApS. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This package implements a basic LISP interpretor for embedding in a go program for scripting. // This file runs lisp based tests. package golisp import (...
Fix for new lisp test runner
Fix for new lisp test runner
Go
bsd-3-clause
SteelSeries/golisp,SteelSeries/golisp,SteelSeries/golisp
a182d8c416747c42cf9fa35a8841da98ab7675df
main_test.go
main_test.go
package main import ( "reflect" "testing" ) // TODO: Write required setup for a local resolver with a variety of domains and test cases func TestCheckWildcard(t *testing.T) { // A simple test domain -- please don't abuse it ips := checkWildcard("glugger.ss23.geek.nz") expected := []string{"127.0.0.23"} if refle...
package main import ( "reflect" "testing" ) // TODO: Write required setup for a local resolver with a variety of domains and test cases func TestCheckWildcard(t *testing.T) { // A simple test domain -- please don't abuse it ips := checkWildcard("glugger.ss23.geek.nz") expected := []string{"127.0.0.23"} if refle...
Add a test for zonetransfer
Add a test for zonetransfer
Go
mit
zxsecurity/glugger
3200a600ce392c6c7e4a61adaeed5b6d3f091f70
structs.go
structs.go
package main import ( "github.com/aws/aws-sdk-go/service/cloudwatchevents" ) type Rules struct { Rules []Rule } type Rule struct { Description string `yaml:"description"` EventPattern string `yaml:"event_pattern"` Name string `yaml:"name"` ScheduleExpression string `yaml:"sch...
package main import ( "github.com/aws/aws-sdk-go/service/cloudwatchevents" ) type Rules struct { Rules []Rule } type Rule struct { Description string `yaml:"description"` EventPattern string `yaml:"event_pattern"` Name string `yaml:"name"` ScheduleExpression string `yaml:"sch...
Change type of ActualTarget in Target
Change type of ActualTarget in Target
Go
mit
unasuke/maekawa
a7fd34d84d66a44b95e0b51cb38aa7895bb489a4
test/fixedbugs/bug215.go
test/fixedbugs/bug215.go
// errchk $G $D/$F.go // 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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=158 package main type A struct { a A; } // ERROR "rec...
// errchk $G $D/$F.go // 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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=158 package main type A struct { a A } // ERROR "recursi...
Tweak test to work with both 6g and gccgo.
Tweak test to work with both 6g and gccgo. Pull the struct into a single line, since 6g reports the error on the last line of the struct definition and gccgo reports it on the first line. 6g: bug215.go:12: invalid recursive type A gccgo: bug215.go:12:6: error: invalid recursive type ‘A’ R=rsc http://codereview.apps...
Go
bsd-3-clause
tav/go,tav/go,tav/go,tav/go,tav/go,tav/go,tav/go
cb99b9dafe92b22e8ed5fee286e70bc7fc3bc2e8
cf/actors/i18n_init.go
cf/actors/i18n_init.go
package actors import ( "github.com/cloudfoundry/cli/cf/i18n" goi18n "github.com/nicksnyder/go-i18n/i18n" ) var T goi18n.TranslateFunc func init() { T = i18n.Init("actors", i18n.GetResourcesPath()) }
package actors import ( "github.com/cloudfoundry/cli/cf/i18n" goi18n "github.com/nicksnyder/go-i18n/i18n" ) var T goi18n.TranslateFunc func init() { T = i18n.Init("actors", i18n.GetResourcesPath()) }
Add newline at end of some random file
Add newline at end of some random file
Go
apache-2.0
cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli
06af3f578394079592b0d18924eb6c08e0e77416
acctest/doc.go
acctest/doc.go
// Package acctest provides the ability to opt in to the new binary test driver. The binary // test driver allows you to run your acceptance tests with a binary of Terraform instead of // an emulated version packaged inside the SDK. This allows for a number of important // enhancements, but most notably a more realisti...
// Package acctest provides the ability to use the binary test driver. The binary // test driver allows you to run your acceptance tests with a binary of Terraform. // This is currently the only mechanism for driving tests. It provides a realistic testing // experience and matrix testing against multiple versions of Te...
Update wording for a V2 context
Update wording for a V2 context
Go
mpl-2.0
hashicorp/terraform-plugin-sdk,hashicorp/terraform-plugin-sdk
ab746d068e6b193ed3db170b79d489f5ab782069
api/query.go
api/query.go
package api import ( "github.com/matttproud/prometheus/rules" "github.com/matttproud/prometheus/rules/ast" "time" ) func (serv MetricsService) Query(Expr string, Json string, Start string, End string) (result string) { exprNode, err := rules.LoadExprFromString(Expr) if err != nil { ...
package api import ( "code.google.com/p/gorest" "github.com/matttproud/prometheus/rules" "github.com/matttproud/prometheus/rules/ast" "time" ) func (serv MetricsService) Query(Expr string, Json string, Start string, End string) (result string) { exprNode, err := rules.LoadExprFromString(Expr)...
Set correct Content-Type header based on output format.
Set correct Content-Type header based on output format.
Go
apache-2.0
PrFalken/prometheus,mtanda/prometheus,kangwoo/prometheus,ton31337/prometheus,msiebuhr/prometheus,slok/prometheus,dpatel06/prometheus,Conorbro/prometheus,Conorbro/prometheus,datajet-io/prometheus,fabric8io/prometheus,abhishekamralkar/prometheus,dln/prometheus,Stackdriver/stackdriver-prometheus,agaoglu/prometheus,GoogleC...
512d010076e6be8565b0047bbdcb19761b36f45c
transformations.go
transformations.go
package main import ( "container/ring" ) type Color string type Face []Color type Cube map[Color]Face type ThreeDTransformer struct { faceRing ring.Ring edgeRing ring.Ring } func main() { }
package main import ( "container/ring" ) type Color string var colors = [...]Color {"white","blue","red","yellow","orange","green"} type Face []Color type Cube map[Color]Face type ThreeDTransformer struct { faceRing ring.Ring edgeRing ring.Ring } func main() { }
Declare a sequence for the colors.
Declare a sequence for the colors.
Go
mpl-2.0
rwbogy/innercube
be737cadee3981d450bfe7072bd2974b82f38976
commands.go
commands.go
package main import ( "log" "os" "fmt" "github.com/timakin/ts/loader" "github.com/codegangsta/cli" ) var Commands = []cli.Command{ commandAll, commandBiz, commandHack, } var commandAll = cli.Command{ Name: "all", Usage: "", Description: ` `, Action: doAll, } var commandBiz = cli.Command{ Name: "biz",...
package main import ( "log" "os" "github.com/timakin/ts/loader" "github.com/codegangsta/cli" ) var Commands = []cli.Command{ commandAll, commandBiz, commandHack, } var commandAll = cli.Command{ Name: "all", Usage: "", Description: ` `, Action: doAll, } var commandBiz = cli.Command{ Name: "biz", Usage...
Fix with interface and display method
Fix with interface and display method
Go
mit
timakin/ts,timakin/ts
685257ee0c059ce3e395de606e29fe1f7188d391
example/gosensors.go
example/gosensors.go
package main import ( "fmt" "github.com/md14454/gosensors" ) func main() { gosensors.Init() defer gosensors.Cleanup() chips := gosensors.GetDetectedChips() for i := 0; i < len(chips); i++ { chip := chips[i] fmt.Printf("%v\n", chip) fmt.Printf("Adapter: %v\n", chip.AdapterName()) features := chip.Ge...
package main import ( "fmt" "github.com/md14454/gosensors" ) func main() { gosensors.Init() defer gosensors.Cleanup() chips := gosensors.GetDetectedChips() for i := 0; i < len(chips); i++ { chip := chips[i] fmt.Printf("%v\n", chip) fmt.Printf("Adapter: %v\n", chip.AdapterName()) features := chip.Ge...
Fix to generate identical output to PySensors
Fix to generate identical output to PySensors
Go
mit
md14454/gosensors
3aa439b17e1cdc99545770639d28e730d82e035e
examples/embedded/main.go
examples/embedded/main.go
package main import ( _ "github.com/sheenobu/quicklog/filters/uuid" "github.com/sheenobu/quicklog/inputs/stdin" _ "github.com/sheenobu/quicklog/outputs/stdout" _ "github.com/sheenobu/quicklog/parsers/plain" "golang.org/x/net/context" "github.com/sheenobu/quicklog/ql" ) func main() { chain := ql.Chain{ Inp...
package main import ( "github.com/sheenobu/quicklog/filters/uuid" "github.com/sheenobu/quicklog/inputs/stdin" "github.com/sheenobu/quicklog/outputs/debug" "github.com/sheenobu/quicklog/parsers/plain" "golang.org/x/net/context" "github.com/sheenobu/quicklog/ql" ) func main() { chain := ql.Chain{ Input: &st...
Convert embedded example to use objects directly
Convert embedded example to use objects directly
Go
mit
sheenobu/quicklog,sheenobu/quicklog,sheenobu/quicklog
e9240292ea960d075aebd23ee1c8930ccfa56e07
pair/pairing_handler.go
pair/pairing_handler.go
package pair import( "io" "fmt" ) type PairingHandler interface { Handle(Container) (Container, error) } func HandleReaderForHandler(r io.Reader, h PairingHandler) (io.Reader, error) { cont_in, err := NewTLV8ContainerFromReader(r) if err != nil { return nil, err } fmt.Println...
package pair import( "io" "fmt" ) type PairingHandler interface { Handle(Container) (Container, error) } func HandleReaderForHandler(r io.Reader, h PairingHandler) (r_out io.Reader, err error) { cont_in, err := NewTLV8ContainerFromReader(r) if err != nil { return nil, err } f...
Update log output when handling pairing requests
Update log output when handling pairing requests
Go
apache-2.0
sjfloat/hc,bahlo/hc,mxlje/hc,savaki/hc,ninjasphere/hc,brutella/hc
4d66a86150e620f96c777fbd2db1accc737bddb4
fetch/fetch.go
fetch/fetch.go
package main import ( "log" "github.com/coreos/go-etcd/etcd" ) func main() { client := etcd.NewClient([]string{"http://104.130.8.142:4001"}) resp, err := client.Get("testcluster", false, false) if err != nil { log.Fatal(err) } for _, n := range resp.Node.Nodes { log.Printf("%s: %s\n", n.Key, n.Value) } }...
package main import ( "flag" "fmt" "log" "os" "sort" "github.com/coreos/go-etcd/etcd" ) type NodeGroup []*etcd.Node //NodeGroup is a slice of pointers to etcd Nodes // Sort Interface implementation methods func (n NodeGroup) Len() int { return len(n) } func (n NodeGroup) Less(i, j int) bool { if n[i].Key <...
Sort nodes by uuid, add discovery info via flags
Sort nodes by uuid, add discovery info via flags
Go
apache-2.0
cedbossneo/corekube,kitwalker12/corekube,jyidiego/corekube,million12/corekube,invenfantasy/corekube,v1k0d3n/corekube,jamiehannaford/corekube
46b45d47e7638b8843087788eff31cbdb2bc4b20
plugins/golang/golang.go
plugins/golang/golang.go
// Package golang implements the "golang" runtime. package golang import ( "github.com/apex/apex/function" "github.com/apex/apex/plugins/nodejs" ) func init() { function.RegisterPlugin("golang", &Plugin{}) } const ( // Runtime name used by Apex Runtime = "golang" ) // Plugin implementation. type Plugin struct{...
// Package golang implements the "golang" runtime. package golang import ( "github.com/apex/apex/function" "github.com/apex/apex/plugins/nodejs" ) func init() { function.RegisterPlugin("golang", &Plugin{}) } const ( // Runtime name used by Apex Runtime = "golang" ) // Plugin implementation. type Plugin struct{...
Allow to build all Golang source files for function
Allow to build all Golang source files for function
Go
mit
llun/apex,llun/apex,apex/apex,ianrtracey/apex,apex/apex,DaveBlooman/apex,ianrtracey/apex,ianrtracey/apex,llun/apex,DaveBlooman/apex,llun/apex,DaveBlooman/apex,DaveBlooman/apex,tobyjoe/apex,ianrtracey/apex,DaveBlooman/apex,tobyjoe/apex,apex/apex,DaveBlooman/apex,ianrtracey/apex,apex/apex,tobyjoe/apex,apex/apex,apex/apex...
27f418ce9da5a3cf0be752a7c47d938237c266bf
kami/main.go
kami/main.go
package main import ( "encoding/json" "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) { page, err := strconv.Atoi(r.FormValue("page")) if...
package main import ( "encoding/json" "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, ) { page, err := strconv.Atoi(r.FormValue("page"...
Make getContacts signature more readable
Make getContacts signature more readable
Go
mit
konjoot/benches,konjoot/benches,konjoot/benches
fec55e7fe9f34ab5ea4eb54df8c945dc5ab46e70
learn/ui.go
learn/ui.go
package learn import ( "davidb.org/x/stenome/timelearn" ) // The UI is responsible for asking the user a question, and // determining if they got it right. The prob argument will always // point to the problem to learn. 'next' may point to an upcoming // problem. type UI interface { Single(prob, next *timelearn.P...
package learn import ( "davidb.org/x/stenome/timelearn" ) // The UI is responsible for asking the user a question, and // determining if they got it right. The prob argument will always // point to the problem to learn. 'next' may point to an upcoming // problem. type UI interface { Single(prob, next *timelearn.P...
Use map literal instead of init func
Use map literal instead of init func
Go
mit
d3zd3z/stenome,d3zd3z/stenome
21fb4878fff9d58759bebca6b6c5ccb094ee4d29
editor/insert_test.go
editor/insert_test.go
package editor import ( "strings" "testing" ) func TestInsertMode(t *testing.T) { i := insert{} i.init() input := "abc" i.in = NewReader(strings.NewReader(input)) for n := range input { c, _, err := i.Run() if err != nil { t.Errorf("Run: %v", err) } if c != cont { t.Errorf("Run: want %v, but got ...
package editor import ( "strings" "testing" ) func TestInsertMode(t *testing.T) { i := insert{} i.init() input := "abc" i.in = NewReader(strings.NewReader(input)) for n := range input { c, _, err := i.Run() if err != nil { t.Errorf("Run: %v", err) } if c != cont { t.Errorf("Run: want %v, but got ...
Add test for input of matching characters
Add test for input of matching characters
Go
mit
elpinal/coco3
a5456f98186a108f1ea57b33724f3b5fae624c63
lib/msg/supervisor.go
lib/msg/supervisor.go
/*- * 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 msg type Supervisor struct { Verdict uint16 RemoteAddr string KexId string Data []byte ...
/*- * 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 msg type Supervisor struct { Verdict uint16 RemoteAddr string KexId string Data ...
Add BasicAuth fields to msg.Supervisor
Add BasicAuth fields to msg.Supervisor
Go
bsd-2-clause
1and1/soma
6b98a7793d78c8ca51293400263e17da6936580e
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...
Return error if file already exists
Return error if file already exists
Go
mit
elifkus/very-simple-service,elifkus/very-simple-service,elifkus/very-simple-service
e27c615a9099a872b19a5f86ef7500db5a8e9da4
geocodio.go
geocodio.go
package geocodio import ( "errors" ) const ( // GeocodioAPIBaseURLv1 is the Geocod.io Base URL GeocodioAPIBaseURLv1 = "https://api.geocod.io/v1.4" ) // NewGeocodio is a helper to create new Geocodio pointer func NewGeocodio(apiKey string) (*Geocodio, error) { if apiKey == "" { return nil, errors.New("apiKey i...
package geocodio import ( "errors" ) const ( // GeocodioAPIBaseURLv1 is the Geocod.io Base URL GeocodioAPIBaseURLv1 = "https://api.geocod.io/v1.5" ) // NewGeocodio is a helper to create new Geocodio pointer func NewGeocodio(apiKey string) (*Geocodio, error) { if apiKey == "" { return nil, errors.New("apiKey i...
Update to use api 1.5
Update to use api 1.5
Go
mit
stevepartridge/geocodio
829dec7b60276e766c2b0a298f70174b5fa4e8ee
hashvalues.go
hashvalues.go
package hashvalues import ( "hash" "net/url" ) type HashValues struct { Values *url.Values hashfunc hash.Hash hashkey []byte } func NewHashValues(hashkey []byte, hashfunc hash.Hash) *HashValues { return &HashValues{ Values: &url.Values{}, hashfunc: hashfunc, hashkey: hashkey, } }
package hashvalues import ( "hash" "net/url" ) type HashValues struct { Values *url.Values hashfunc hash.Hash hashkey []byte } func NewHashValues(hashkey []byte, hashfunc hash.Hash) *HashValues { return &HashValues{ Values: &url.Values{}, hashfunc: hashfunc, hashkey: hashkey, } } func (h *HashVal...
Add Get, Set, Del, Add.
Add Get, Set, Del, Add.
Go
mit
toomore/hashvalues
35a21eec968d7a7a325a70ba42f30cb32e9f4102
src/goat/connHandler.go
src/goat/connHandler.go
package goat import ( "net" ) // ConnHandler interface method Handle defines how to handle incoming network connections type ConnHandler interface { Handle(c net.Conn) bool } // HttpConnHandler handles incoming HTTP (TCP) network connections type HttpConnHandler struct { } func (h HttpConnHandler) Handle(c net.Co...
package goat import ( "fmt" "net" "strings" ) // ConnHandler interface method Handle defines how to handle incoming network connections type ConnHandler interface { Handle(c net.Conn) bool } // HttpConnHandler handles incoming HTTP (TCP) network connections type HttpConnHandler struct { } // Handle an incoming ...
Add basic HTTP read/write over socket
Add basic HTTP read/write over socket
Go
mit
mdlayher/goat
3642a072c6f9c0a7c6313b52a864968a0b079a77
slides/HighOrderFunctions/currying.go
slides/HighOrderFunctions/currying.go
package main import ( . "github.com/stefanhans/go-present/slides/HighOrderFunctions/hof" "fmt" ) func main() { var list = ListOfInt{-2, -1, 0, 2, 2, 3} tenTimes := func(x int) int { return x * 10 } isEven := func(x int) bool { return x%2 == 0 } fmt.Printf("List %v: Map(tenTimes).Filter(isEven) yields %v\n", l...
package main import ( . "github.com/stefanhans/go-present/tree/master/slides/HighOrderFunctions/hof" "fmt" ) func main() { var list = ListOfInt{-2, -1, 0, 2, 2, 3} tenTimes := func(x int) int { return x * 10 } isEven := func(x int) bool { return x%2 == 0 } fmt.Printf("List %v: Map(tenTimes).Filter(isEven) yie...
Correct hof path from bitbucket to github
Correct hof path from bitbucket to github
Go
mit
stefanhans/go-present,stefanhans/go-present
9e6db73b9cece24d3a5813af5847e8b8390f1d6b
amqp.go
amqp.go
// Copyright (c) 2019 Sick Yoon // This file is part of gocelery which is released under MIT license. // See file LICENSE for full license details. package gocelery import ( "log" "github.com/streadway/amqp" ) // deliveryAck acknowledges delivery message with retries on error func deliveryAck(delivery amqp.Delive...
// Copyright (c) 2019 Sick Yoon // This file is part of gocelery which is released under MIT license. // See file LICENSE for full license details. package gocelery import ( "log" "github.com/streadway/amqp" ) // deliveryAck acknowledges delivery message with retries on error func deliveryAck(delivery amqp.Delive...
Fix infinite loop bug in deliveryAck
Fix infinite loop bug in deliveryAck
Go
mit
shicky/gocelery,shicky/gocelery
8b64f546caf55d1050f9118c01c4ae096d067efa
spikes/config/main.go
spikes/config/main.go
package main import ( "fmt" "os" "path" ) const BUFFER_SIZE = 1024 // fatal crashes the program if the given error is non-nil // This isn't a good way to perform production error-handling, // but it will serve for this demo. func fatal(err error) { if err != nil { fmt.Println(err) os.Exit(1) } } func main(...
package main import ( "encoding/json" "fmt" "os" "path" ) const BUFFER_SIZE = 1024 // fatal crashes the program if the given error is non-nil // This isn't a good way to perform production error-handling, // but it will serve for this demo. func fatal(err error) { if err != nil { fmt.Println(err) os.Exit(1)...
Implement conversion of json file to golang map
Implement conversion of json file to golang map To try this program, put a valid json file at $XDG_CONFIG_HOME/matterleast.conf Then execute this code and you should see it print the contents of that json file as a golang map, ready for normal programmatic access.
Go
mit
NaturalFractals/matterleast,LinuxAtApp/matterleast
acc398fbd68973900a45d1ed0443666788d2d599
file.go
file.go
package pgpass import ( "os" "os/user" "path" ) // OpenDefault opens default pgpass file, which is ~/.pgpass func OpenDefault() (f *os.File, err error) { usr, err := user.Current() if err != nil { return } // TODO: check file permission is 0600 return os.Open(path.Join(usr.HomeDir, ".pgpass")) }
package pgpass import ( "os" "os/user" "path" ) // OpenDefault opens default pgpass file, which is ~/.pgpass. // Current homedir will be retrieved by calling user.Current // or using $HOME on failure. func OpenDefault() (f *os.File, err error) { var homedir = os.Getenv("HOME") usr, err := user.Current() if err ...
Use $HOME for user's home directory if user.Current fails.
Use $HOME for user's home directory if user.Current fails. This allows for cross-compiling code importing this library as user.Current uses cgo.
Go
mit
tg/pgpass
8f4c0844faa0a40594b59dd21e682ce73543997d
src/utils.go
src/utils.go
package apollostats import ( "html" "strings" ) // Func to take care of garbled text data. func filter_string(s string) string { // Fuck it, might aswell assume all text has been escaped. tmp := html.UnescapeString(s) // Usually seen in the character table. tmp = strings.Replace(tmp, "&amp;", "&", -1) // Usu...
package apollostats import ( "html" "strings" ) // Func to take care of garbled text data. func filter_string(s string) string { // Fuck it, might aswell assume all text has been escaped. tmp := html.UnescapeString(s) // Usually seen in the room names in the death table. tmp = strings.Trim(tmp, "ÿ") tmp = s...
Remove unneeded html entity filter.
Remove unneeded html entity filter.
Go
mit
lmas/ApolloStats,Apollo-Community/ApolloStats,lmas/ApolloStats,Apollo-Community/ApolloStats