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
52f5e8da29dc6530400ceb9a0d51c4dedf5fd2ac
test/server.go
test/server.go
package test import ( "testing" "time" "github.com/b2aio/typhon/server" ) // InitServer for testing func InitServer(t *testing.T, name string) server.Server { // Initialize our Server server.Init(&server.Config{ Name: name, Description: "Example service", }) go server.Run() select { case <-serv...
package test import ( "testing" "time" "github.com/b2aio/typhon/server" ) // InitServer for testing func InitServer(t *testing.T, name string) server.Server { // Initialize our Server server.Init(&server.Config{ Name: name, Description: "Example service", }) go server.Run() select { case <-serv...
Fix error logging in test
Fix error logging in test
Go
mit
mondough/typhon,monzo/typhon
e39469e60a903fbd6c4dacd7b2b532eab776fee6
quick_test.go
quick_test.go
package sort import ( "testing" "github.com/ready-steady/support/assert" ) func TestQuickSort(t *testing.T) { data := []float64{3, 1, 6, 9, 4, 2} order1, order2 := Quick(data) assert.Equal(data, []float64{1, 2, 3, 4, 6, 9}, t) assert.Equal(order1, []uint{1, 5, 0, 4, 2, 3}, t) assert.Equal(order2, []uint{2, ...
package sort import ( "testing" "github.com/ready-steady/assert" ) func TestQuickSort(t *testing.T) { data := []float64{3, 1, 6, 9, 4, 2} order1, order2 := Quick(data) assert.Equal(data, []float64{1, 2, 3, 4, 6, 9}, t) assert.Equal(order1, []uint{1, 5, 0, 4, 2, 3}, t) assert.Equal(order2, []uint{2, 0, 4, 5,...
Update the path to assert
Update the path to assert
Go
mit
ready-steady/sort
45e069a7f553085c07c0049a9bce043577276b77
tmpl_test.go
tmpl_test.go
// Copyright (C) 2017 Damon Revoe. All rights reserved. // Use of this source code is governed by the MIT // license, which can be found in the LICENSE file. package main import ( "testing" ) func runTemplateFunctionTest(t *testing.T, funcName, arg, expected string) { result := funcMap[funcName].(func(string) st...
// Copyright (C) 2017 Damon Revoe. All rights reserved. // Use of this source code is governed by the MIT // license, which can be found in the LICENSE file. package main import ( "testing" ) func runTemplateFunctionTest(t *testing.T, funcName, arg, expected string) { result := funcMap[funcName].(func(string) st...
Break a line exceeding 80 chars into two
Break a line exceeding 80 chars into two
Go
mit
revl/autoforge
820964a2e18b16020bd780b86e7722350d7163f1
main.go
main.go
package main import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" ) func main() { svc := ec2.New(session.New(), &aws.Config{Region: aws.String("us-west-2")}) resp, err := svc.DescribeInstances(nil) if err != nil { panic(err) } fmt...
package main import ( "fmt" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" ) func main() { if len(os.Args) != 2 { fmt.Println("Usage:\n\tmain region_name") os.Exit(-1) } region := os.Args[1] if region == "" { fmt.Println("Usage:\n\...
Add defensive check to program arguments
Add defensive check to program arguments
Go
mit
daniel-bryant-uk/go-aws-sdk-exp
10479c4bd846de19bb1842eb06172c7b2c5ce970
main.go
main.go
package main import ( "flag" "github.com/alinpopa/barvin/handlers/slack" "github.com/op/go-logging" "os" "sync" ) func main() { userID := flag.String("userid", "", "The privileged slack userid.") token := flag.String("token", "", "Slack token to connect.") flag.Parse() var format = logging.MustStringFormatt...
package main import ( "flag" "github.com/alinpopa/barvin/handlers/slack" "github.com/op/go-logging" "os" "sync" ) func main() { userID := flag.String("userid", "", "The privileged slack userid.") token := flag.String("token", "", "Slack token to connect.") flag.Parse() var format = logging.MustStringFormatt...
Add date as part of the log messages.
Add date as part of the log messages.
Go
unlicense
alinpopa/barvin
131b04445d5539c6ec67e611792118758aaee414
main.go
main.go
/* Copyright 2018 Padduck, LLC 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, software d...
/* Copyright 2018 Padduck, LLC 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, software d...
Add logging if web server errors
Add logging if web server errors
Go
apache-2.0
PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel
95b12b14c47c6b7bb7d62917d25fb5e04598ecb4
main.go
main.go
package main import "fmt" func main() { fmt.Println("hello app") }
package main import ( "html/template" "net/http" ) var ( homeTmpl = template.Must(template.New("homeTmpl").Parse(baseTemplate + formTemplate)) searchReplyTmpl = template.Must(template.New("searchReplyTmpl").Parse(baseTemplate + searchReplyTemplate)) ) // Pet is the pet of the app. type Pet struct { Name ...
Add http server and search template
Add http server and search template
Go
mit
psimika/secure-web-app
9f2e288b0803d9f607cf8662f73f4513945b7b43
shorteners/picnictrans.go
shorteners/picnictrans.go
package ungo import ( "net/http/cookiejar" "regexp" "fmt" ) func Picnictrans(url string) (string, error) { cookie, _ := cookiejar.New(nil) HH.Host = "picnictrans.com" html := htmlDownload(url, cookie) urlregex := regexp.MustCompile(`window\.location="(.*?)";}`) resutl := urlregex.FindAllStringSubmatch(html....
package ungo import ( "net/http/cookiejar" "regexp" ) func Picnictrans(url string) (string, error) { cookie, _ := cookiejar.New(nil) HH.Host = "picnictrans.com" html := htmlDownload(url, cookie) urlregex := regexp.MustCompile(`window\.location="(.*?)";}`) resutl := urlregex.FindAllStringSubmatch(html.Html, -...
Remove fmt package on picnitrans!
Remove fmt package on picnitrans!
Go
mit
ReiGelado/Ungo
95e619abf226c8ab9d27688f6a0a5b3e52397637
split/responses_packer.go
split/responses_packer.go
package split import ( "bytes" "mime" "mime/multipart" "net/http" "net/textproto" ) // WriteResponses serialize the responses passed as argument into the ResponseWriter func WriteResponses(w http.ResponseWriter, responses []*http.Response) error { var buf bytes.Buffer multipartWriter := multipart.NewWriter(&bu...
package split import ( "bytes" "mime" "mime/multipart" "net/http" "net/textproto" ) // WriteResponses serialize the responses passed as argument into the ResponseWriter func WriteResponses(w http.ResponseWriter, responses []*http.Response) error { var buf bytes.Buffer multipartWriter := multipart.NewWriter(&bu...
Fix the response content type
Fix the response content type
Go
mit
aarnone/httpbatcher
b864cd44a0c77cc7c5b76eb03f266e094b2293f5
path.go
path.go
package main import ( "os" "strings" ) func init() { home := os.Getenv("HOME") paths := []string{ home + "/bin", home + "/.vvmn/vim/current/bin", "/usr/local/bin", "/usr/local/opt/coreutils/libexec/gnubin", } setPath(paths...) } func setPath(args ...string) { s := os.Getenv("PATH") paths := strings.S...
package main import ( "os" "strings" ) func init() { home := os.Getenv("HOME") paths := []string{ home + "/bin", home + "/.vvmn/vim/current/bin", "/usr/local/bin", "/usr/local/opt/coreutils/libexec/gnubin", } setPath(paths...) } func setPath(args ...string) { s := os.Getenv("PATH") paths := strings.S...
Make setPath set $PATH correctly
Make setPath set $PATH correctly
Go
mit
elpinal/coco3
96327f6fb00c1ef2d65028d2b1fd6b0dba4ebf3c
log/logger.go
log/logger.go
package log import ( "fmt" "io" "os" "time" ) type Logger struct { PrintDebug bool Output io.Writer DateFormat string } func NewLogger(opts ...func(*Logger)) *Logger { l := &Logger{ PrintDebug: false, Output: os.Stdout, DateFormat: "15:04", } for _, opt := range opts { opt(l) } return l...
package log import ( "fmt" "io" "os" "time" ) type Logger struct { PrintDebug bool Output io.Writer DateFormat string } func NewLogger(opts ...func(*Logger)) *Logger { l := &Logger{ PrintDebug: false, Output: os.Stdout, DateFormat: "15:04", } for _, opt := range opts { opt(l) } return l...
Fix the debug logging flag
Fix the debug logging flag
Go
unlicense
elwinar/rambler
ad6cc5d0e3d3a1c2772c644f526d2ccdbe88fccb
file.go
file.go
package nzb import "strings" type File struct { Poster string `xml:"poster,attr"` Date int `xml:"date,attr"` Subject string `xml:"subject,attr"` Groups []string `xml:"groups>group,internalxml"` Segments []Segment `xml:"segments>segment"` } //A Segment is a piece to be downloaded separately...
package nzb import ( "fmt" "strings" ) type File struct { Poster string `xml:"poster,attr"` Date int `xml:"date,attr"` Subject string `xml:"subject,attr"` Groups []string `xml:"groups>group,internalxml"` Segments []Segment `xml:"segments>segment"` } //A Segment is a piece to be downloade...
Add possiblity of error to name parsing function
Add possiblity of error to name parsing function
Go
mit
andrewstuart/go-nzb
3faba6bf3cf82dbf8f5eff0a8927d1a8a954d2f3
src/lib/time/tick_test.go
src/lib/time/tick_test.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. package time import ( "testing"; "time"; ) export func TestTick(t *testing.T) { const ( Delta uint64 = 100*1e6; Count uint64 = 10; ); c := Tick(Delta...
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package time import ( "testing"; "time"; ) export func TestTick(t *testing.T) { const ( Delta = 100*1e6; Count = 10; ); c := Tick(Delta); t0 := Nano...
Remove types from constants, since they didn't match what Tick() expected.
Remove types from constants, since they didn't match what Tick() expected. R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=22979 CL=22986
Go
bsd-3-clause
abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go
d5ec187c78a710e84f4124f51fccea14c89157e2
template.go
template.go
package main const entryTmpl = ` entity "{{ .Name }}" { {{- if .Comment.Valid }} {{ .Comment.String }} .. {{- end }} {{- range .Columns }} {{- if .IsPrimaryKey }} + {{ .Name }}:{{ .DDLType }} [PK]{{if .IsForeignKey }}[FK]{{end}}{{- if .Comment.Valid }} : {{ .Comment.String }}{{- end }} {{- end }} {{- end }} ...
package main const entryTmpl = ` entity "**{{ .Name }}**" { {{- if .Comment.Valid }} {{ .Comment.String }} .. {{- end }} {{- range .Columns }} {{- if .IsPrimaryKey }} + ""{{ .Name }}"": //{{ .DDLType }} [PK]{{if .IsForeignKey }}[FK]{{end}}{{- if .Comment.Valid }} : {{ .Comment.String }}{{- end }}// {{- end }...
Format entity to improve readability
Format entity to improve readability * Make entity name bold * Make column names monospaced and descriptions italic * Simplify relations template expression * Put table names in quotes to agree with the entity clause
Go
mit
achiku/planter,achiku/planter
e069b2d669c02a3296abab9cb209d5a836544a2a
common_errors.go
common_errors.go
package meep type ErrInvalidParam struct { TraitAutodescribing TraitTraceable Param string Reason string } type ErrNotYetImplemented struct { TraitAutodescribing TraitTraceable } type ErrProgrammer struct { TraitAutodescribing TraitTraceable TraitCausable }
package meep type ErrInvalidParam struct { TraitAutodescribing TraitTraceable Param string Reason string } type ErrNotYetImplemented struct { TraitAutodescribing TraitTraceable } type ErrProgrammer struct { Msg string TraitAutodescribing TraitTraceable TraitCausable }
Add message field to ErrProgrammer.
Add message field to ErrProgrammer. It seems when raising these there *may* be an existing error, which I would like to continue to raise up unmolested, whilst also tagging it with a brief message about *why* this is semantically a programmer error. Having a field for that message instead of having to double-duty the...
Go
apache-2.0
polydawn/meep,polydawn/meep
4622ddb274a6fb05535cd671316a7e7f883d2fcf
rdp_darwin.go
rdp_darwin.go
// The MIT License (MIT) // // Copyright (c) 2015 Douglas Thrift // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, ...
// The MIT License (MIT) // // Copyright (c) 2015 Douglas Thrift // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, ...
Add Mac OS X stub for rdpLaunchNative.
Add Mac OS X stub for rdpLaunchNative.
Go
mit
douglaswth/rsrdp
6b05c6b149dc64052777b5cda144172e2194081e
api/drive.go
api/drive.go
package api import ( "fmt" "log" "net/http" ) const apiURL string = "https://api.onedrive.com/v1.0/" var client *http.Client func init() { c, err := getClient() if err != nil { log.Fatal(err) } client = c } // GetDriveInfos return the content length of the /drive/ api entry point func GetDriveInfos() stri...
package api import ( "fmt" "log" "net/http" ) const apiURL string = "https://api.onedrive.com/v1.0" var client *http.Client func init() { c, err := getClient() if err != nil { log.Fatal(err) } client = c } // GetDriveInfos return the content length of the /drive/ api entry point func GetDriveInfos() strin...
Correct URI for the API
Correct URI for the API
Go
mit
ggobbe/onedrive-sync
ab30bfd812fc770d2bc8d2918717dc2b81e8fda1
proto/imageserver/gob.go
proto/imageserver/gob.go
package imageserver import ( "encoding/gob" "github.com/Symantec/Dominator/lib/filesystem" ) func init() { gob.Register(&filesystem.RegularInode{}) gob.Register(&filesystem.SymlinkInode{}) gob.Register(&filesystem.SpecialInode{}) gob.Register(&filesystem.DirectoryInode{}) }
package imageserver import ( "encoding/gob" "github.com/Symantec/Dominator/lib/filesystem" ) func init() { gob.Register(&filesystem.RegularInode{}) gob.Register(&filesystem.ComputedRegularInode{}) gob.Register(&filesystem.SymlinkInode{}) gob.Register(&filesystem.SpecialInode{}) gob.Register(&filesystem.Directo...
Add ComputedRegularFile to imageserver protocol definition.
Add ComputedRegularFile to imageserver protocol definition.
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator
e2b896b362fc906d5c883a7e6656633b88dab81e
imageunpacker/rpcd/api.go
imageunpacker/rpcd/api.go
package rpcd import ( "github.com/Symantec/Dominator/imageunpacker/unpacker" "github.com/Symantec/Dominator/lib/srpc" "io" "log" "sync" ) type srpcType struct { unpacker *unpacker.Unpacker logger *log.Logger addDeviceLock sync.Mutex } type htmlWriter srpcType func (hw *htmlWriter) WriteHtml(writ...
package rpcd import ( "github.com/Symantec/Dominator/imageunpacker/unpacker" "github.com/Symantec/Dominator/lib/log" "github.com/Symantec/Dominator/lib/srpc" "io" "sync" ) type srpcType struct { unpacker *unpacker.Unpacker logger log.Logger addDeviceLock sync.Mutex } type htmlWriter srpcType fun...
Switch imageunpacker/rpcd to lib/log/serverlogger package.
Switch imageunpacker/rpcd to lib/log/serverlogger package.
Go
apache-2.0
keep94/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,Symantec/Dominator
d09bdbb3e5da1bbdf0c005359b7a03148308cce0
src/server/pkg/watch/op.go
src/server/pkg/watch/op.go
package watch import etcd "github.com/coreos/etcd/clientv3" // OpOption is a simple typedef for etcd.OpOption. type OpOption etcd.OpOption // WithFilterPut discards PUT events from the watcher. func WithFilterPut() OpOption { return OpOption(etcd.WithFilterPut()) }
package watch import etcd "github.com/coreos/etcd/clientv3" // OpOption is a simple typedef for etcd.OpOption. type OpOption etcd.OpOption // WithFilterPut discards PUT events from the watcher. func WithFilterPut() OpOption { return OpOption(etcd.WithFilterPut()) } // WithFilterDelete discards DELETE events from t...
Add delete filter to watch package
Add delete filter to watch package
Go
apache-2.0
pachyderm/pfs,pachyderm/pfs,pachyderm/pfs
44c830670f242705d17b89225669c2d1fe45c700
main.go
main.go
package main import ( "fmt" "os" "os/exec" ) func main() { command := os.Args[1:] cmd := exec.Command(command[0], command[1:]...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr err := cmd.Run() if err != nil { fmt.Fprintf(os.Stderr, "pew: %v\n", err) os.Exit(1) } }
package main import ( "fmt" "os" "os/exec" ) func main() { command := os.Args[1:] cmd := exec.Command(command[0], command[1:]...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr err := cmd.Start() if err != nil { exit(err) } err = cmd.Wait() if err != nil { exit(err) } } func exit(err error) { fmt.Fp...
Use Start/Wait instead of Run
Use Start/Wait instead of Run
Go
mit
leocassarani/pew
c504d4f85ec22c2915993dc5b634d6d0095103a7
main.go
main.go
package main import ( "fmt" "github.com/krasin/cobra" ) func main() { rootCmd := &cobra.Command{ Use: "steel", Short: "A tool to tinker with STL files", Long: "Command-line processor for STL files", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Steel -- a tool to tinker with STL files....
package main import ( "fmt" "os" "github.com/krasin/cobra" "github.com/krasin/stl" ) func fail(args ...interface{}) { fmt.Fprintln(os.Stderr, args...) os.Exit(1) } func info(cmd *cobra.Command, args []string) { if len(args) == 0 { fail("STL file not specified") } f, err := os.Open(args[0]) if err != nil...
Implement very basic 'info' command, that currently displays number of triangles.
Implement very basic 'info' command, that currently displays number of triangles.
Go
mit
krasin/steel
fa3051a42b3c8a4b5b4b804555b16ae4d0f191dd
builtin/providers/aws/import_aws_opsworks_stack_test.go
builtin/providers/aws/import_aws_opsworks_stack_test.go
package aws import ( "os" "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSOpsWorksStack_importBasic(t *testing.T) { oldvar := os.Getenv("AWS_DEFAULT_REGION") os.Setenv("AWS_DEFAULT_REGION", "us-west-2") defer os.Setenv("AWS_DEFAULT_RE...
package aws import ( "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSOpsworksStackImportBasic(t *testing.T) { name := acctest.RandString(10) resourceName := "aws_opsworks_stack.tf-acc" resource.Test(t, resource.TestCase{ PreCheck: ...
Rename the Import aws_opsworks_stack import test
provider/aws: Rename the Import aws_opsworks_stack import test The casing on the test name was causing it not to run with the entire test suite ``` % make testacc TEST=./builtin/providers/aws % TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go gene...
Go
mpl-2.0
iansheridan/terraform,gechr/terraform,StephenWeatherford/terraform,julia-stripe/terraform,carinadigital/terraform,nathanielks/terraform,heimweh/terraform,hngkr/terraform,evandbrown/terraform,grasshoppergroup/terraform,sl1pm4t/terraform,gh-mlfowler/terraform,tpounds/terraform,jrperritt/terraform,whiskeyjay/terraform,don...
634c7418e45fb68584ae64d5a1c2156fd74d1091
edit/lastcmd_test.go
edit/lastcmd_test.go
package edit import ( "testing" "github.com/elves/elvish/edit/ui" ) var ( theLine = "qw search 'foo bar ~y'" theLastCmd = newLastCmd(theLine) lastcmdFilterTests = []listingFilterTestCases{ {"", []shown{ {"M-,", ui.Unstyled(theLine)}, {"0", ui.Unstyled("qw")}, {"1", ui.Unstyled("search")}, {"2"...
package edit import ( "testing" "github.com/elves/elvish/edit/ui" ) var ( theLine = "qw search 'foo bar ~y'" theLastCmd = newLastCmd(theLine) lastcmdFilterTests = []listingFilterTestCases{ {"", []shown{ {"M-1", ui.Unstyled(theLine)}, {"0", ui.Unstyled("qw")}, {"1", ui.Unstyled("search")}, {"2"...
Fix test for lastcmd mode.
Fix test for lastcmd mode.
Go
bsd-2-clause
elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish
6df26a90341c925b1f2157a0bdef32e3e5394836
core/core.go
core/core.go
package core import ( "fmt" "github.com/akutz/gofig" "github.com/emccode/rexray/util" ) func init() { initDrivers() gofig.SetGlobalConfigPath(util.EtcDirPath()) gofig.SetUserConfigPath(fmt.Sprintf("%s/.rexray", util.HomeDir())) gofig.Register(globalRegistration()) gofig.Register(driverRegistration()) } f...
package core import ( "github.com/akutz/gofig" ) func init() { initDrivers() gofig.Register(globalRegistration()) gofig.Register(driverRegistration()) } func globalRegistration() *gofig.Registration { r := gofig.NewRegistration("Global") r.Yaml(` rexray: host: tcp://:7979 logLevel: warn `) r.Key(gofig...
Revert "Fix for not setting Gofig global/user dirs"
Revert "Fix for not setting Gofig global/user dirs" This reverts commit d04023572e47e5c18fa549fe7f7de301e8470c63.
Go
apache-2.0
thecodeteam/rexray,thecodeteam/rexray,cduchesne/rexray,oppodeldoc/rexray,emccode/rexray,clintonskitson/rexray,oppodeldoc/rexray,emccode/rexray,clintonskitson/rexray,codedellemc/rexray,oppodeldoc/rexray,cduchesne/rexray,oppodeldoc/rexray,cduchesne/rexray,cduchesne/rexray,oppodeldoc/rexray,codedellemc/rexray,cduchesne/re...
6acf8d0fbb33d3fa96af3900ddb9d062df5fa8a5
demo/canvas/testcanvas.go
demo/canvas/testcanvas.go
package main import ( "gform" "syscall" "w32" ) const IDR_PNG1 = 100 func onpaint(arg *gform.EventArg) { if data, ok := arg.Data().(*gform.PaintEventData); ok { if bmp, err := gform.NewBitmapFromResource( gform.GetAppInstance(), w32.MakeIntResource(IDR_PNG1), syscall.StringToUTF16Ptr("PNG"), gform....
package main import ( "syscall" "github.com/AllenDang/gform" "github.com/AllenDang/w32" ) const IDR_PNG1 = 100 func onpaint(arg *gform.EventArg) { if data, ok := arg.Data().(*gform.PaintEventData); ok { if bmp, err := gform.NewBitmapFromResource( gform.GetAppInstance(), w32.MakeIntResource(IDR_PNG1), ...
Update import path of gform and w32.
Update import path of gform and w32.
Go
bsd-3-clause
AllenDang/gform,AllenDang/gform,AllenDang/gform
ed64b27081e9cc7e6c3c0caa5abd8ce905c5ed10
http2/3_5_http2_connection_preface.go
http2/3_5_http2_connection_preface.go
package http2 import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" ) func HTTP2ConnectionPreface() *spec.TestGroup { tg := NewTestGroup("3.5", "HTTP/2 Connection Preface") tg.AddTestCase(&spec.TestCase{ Desc: "Sends invalid connection preface", Requirement: "The endpoint ...
package http2 import ( "github.com/summerwind/h2spec/config" "github.com/summerwind/h2spec/spec" "golang.org/x/net/http2" ) func HTTP2ConnectionPreface() *spec.TestGroup { tg := NewTestGroup("3.5", "HTTP/2 Connection Preface") // The server connection preface consists of a potentially empty // SETTINGS frame (...
Add test case for checking server connection preface
Add test case for checking server connection preface
Go
mit
summerwind/h2spec
823a279eeb4dc4f8714e6441a2c6048320369845
ctxcopy/doc.go
ctxcopy/doc.go
/* ctxcopy is a Golang package which provides helper functions for performing context-aware copy task. */ package ctxcopy
/* Package ctxcopy is a Golang package which provides helper functions for performing context-aware copy task. */ package ctxcopy
Add 'Package' before description to remove golint warnings.
Add 'Package' before description to remove golint warnings.
Go
mit
northbright/ctx
e785014f8ef37cce066b7b25c845ec37e3acf019
power.go
power.go
package gogopro import ( "io/ioutil" ) type Power struct { APIRequester *APIRequester } func (p *Power) Init() *Power { return p } func CreatePower(APIRequester *APIRequester) *Power { power := &Power{} power.APIRequester = APIRequester return power } func (p *Power) GetPowerStatus() (string, error) { resp,...
package gogopro import () type Power struct { APIRequester *APIRequester StatusCommands map[string]StatusCommand } func (p *Power) Init() *Power { return p } func CreatePower(APIRequester *APIRequester) *Power { power := &Power{} power.APIRequester = APIRequester statusCommands := CreateStatusCommands() po...
Move status command to generic object
Move status command to generic object - The StatusCommand type now runs api command and determines the correct value to return. - The Power type will create predetermined StatusCommands with translaters. Power functions will use the correct StatusCommand matching the function called.
Go
apache-2.0
wagnerm/gogopro
859c5921555ff1d21fa446eaabab8feaec1a8f25
2016/day9/day9.go
2016/day9/day9.go
package day9 import "fmt" func Solution() string { return fmt.Sprintf("Part 1: %d, Part 2: %s", len(decode(data)), decode(data)) } func decode(input string) string { return input }
package day9 import ( "fmt" "regexp" "strconv" ) var marker = regexp.MustCompile(`\((\d+)x(\d+)\)`) func Solution() string { return fmt.Sprintf("Part 1: %d, Part 2: %s", len(decode(data)), "Not yet done") } func decode(input string) string { output := "" for i := 0; i < len(input); i++ { c := string(input...
Add day 9 part 1 solution
Add day 9 part 1 solution
Go
mit
domdavis/adventofcode
af77a17aaab97dff22a4e3aeba0a9a8e572d391d
internal/devicescale/impl_mac.go
internal/devicescale/impl_mac.go
// Copyright 2018 The Ebiten 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...
// Copyright 2018 The Ebiten 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...
Use mainScreen instead of screens[0] to get the 'current' screen state
devicescale: Use mainScreen instead of screens[0] to get the 'current' screen state
Go
apache-2.0
hajimehoshi/ebiten,hajimehoshi/ebiten
3de3d059403188fc5efc67d9aecbbc892af49383
play/mime.go
play/mime.go
package main import ( "fmt" "mime" "strings" ) func main() { fmt.Println(strings.SplitN(mime.TypeByExtension(".avi"), "/", 2)[0]) }
package main import ( "../dlna/dms" "flag" "fmt" ) func main() { flag.Parse() for _, arg := range flag.Args() { fmt.Println(dms.MimeTypeByPath(arg)) } }
Update the play file for testing dms.MimeTypeByPath
Update the play file for testing dms.MimeTypeByPath
Go
bsd-3-clause
anacrolix/dms,anacrolix/dms
b9c9f6ee854f9dde42b8f8f170a114497582bac7
trade.go
trade.go
package bittrex // Used in getmarkethistory type Trade struct { OrderUuid string `json:"OrderUuid"` Timestamp jTime `json:"TimeStamp"` Quantity float64 `json:"Quantity"` Price float64 `json:"Price"` Total float64 `json:"Total"` FillType string `json:"FillType"` OrderType string `json:"OrderType"`...
package bittrex // Used in getmarkethistory type Trade struct { OrderUuid int64 `json:"Id"` Timestamp jTime `json:"TimeStamp"` Quantity float64 `json:"Quantity"` Price float64 `json:"Price"` Total float64 `json:"Total"` FillType string `json:"FillType"` OrderType string `json:"OrderType"` }
Change json Tag for Trade struct from OrderUuid to Id for matching the current API
Change json Tag for Trade struct from OrderUuid to Id for matching the current API
Go
mit
jyap808/go-bittrex,toorop/go-bittrex
6f21e960a134a467ebb0bc7bccf43f9c32b04de0
pkg/prometheus/statefulset_test.go
pkg/prometheus/statefulset_test.go
package prometheus import ( "reflect" "testing" "k8s.io/client-go/pkg/api/v1" "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1" ) func TestStatefulSetLabelingAndAnnotations(t *testing.T) { labels := map[string]string{ "testlabel": "testlabelvalue", } annotations := map[string]string{ ...
// Copyright 2016 The prometheus-operator 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 ...
Add license header to test file
Add license header to test file
Go
apache-2.0
mmerrill3/prometheus-operator,sjuxax/prometheus-operator,gianrubio/prometheus-operator,mmerrill3/prometheus-operator,eedugon/prometheus-operator,mmerrill3/prometheus-operator,gianrubio/prometheus-operator,jescarri/prometheus-operator,sjuxax/prometheus-operator,brancz/prometheus-operator,gianrubio/prometheus-operator,ee...
d6851c152024dbff9f8777c6cb6f7b8b0ff1a389
traffic_monitor/experimental/traffic_monitor/manager/dsstats.go
traffic_monitor/experimental/traffic_monitor/manager/dsstats.go
package manager import ( ds "github.com/Comcast/traffic_control/traffic_monitor/experimental/traffic_monitor/deliveryservice" "sync" ) type DSStatsThreadsafe struct { dsStats *ds.Stats m *sync.RWMutex } func NewDSStatsThreadsafe() DSStatsThreadsafe { s := ds.NewStats() return DSStatsThreadsafe{m: &sync.R...
package manager import ( ds "github.com/Comcast/traffic_control/traffic_monitor/experimental/traffic_monitor/deliveryservice" "sync" ) type DSStatsThreadsafe struct { dsStats *ds.Stats m *sync.RWMutex } func NewDSStatsThreadsafe() DSStatsThreadsafe { s := ds.NewStats() return DSStatsThreadsafe{m: &sync.R...
Change TM2 DSStatsThreadsafe to not copy
Change TM2 DSStatsThreadsafe to not copy Fixes #1831
Go
apache-2.0
jeffmart/incubator-trafficcontrol,amiryesh/incubator-trafficcontrol,amiryesh/incubator-trafficcontrol,rscrimojr/incubator-trafficcontrol,alficles/incubator-trafficcontrol,knutsel/traffic_control-1,amiryesh/incubator-trafficcontrol,zhilhuan/incubator-trafficcontrol,naamashoresh/incubator-trafficcontrol,mdb/incubator-tra...
c7dd24fe69bffe6b07407a8cff07b4c3e78cb6e8
src/safe/add.go
src/safe/add.go
package safe import ( "github.com/bndw/pick/errors" ) func (s *Safe) Add(name, username, password string) (*Account, error) { if _, exists := s.Accounts[name]; exists { return nil, &errors.AccountExists{} } account := NewAccount(name, username, password) s.Accounts[name] = account if err := s.save(); err !=...
package safe import ( "github.com/bndw/pick/errors" ) func (s *Safe) Add(name, username, password string) (*Account, error) { if _, exists := s.Accounts[name]; exists { account := s.Accounts[name] return &account, &errors.AccountExists{} } account := NewAccount(name, username, password) s.Accounts[name] = a...
Fix issue when generating a new password for an already existing account.
Fix issue when generating a new password for an already existing account. Issue was introduced in 86787659fd4a75bc2b1a1e02135afddd649a4899
Go
mit
bndw/pick,bndw/pick
7ed88d3e87f15021145c708bacd41ccd030c56ab
slack9gag.go
slack9gag.go
package main import ( "fmt" "net/http" "os" ) func main() { http.HandleFunc("/", handler) fmt.Println("listening...") err := http.ListenAndServe(":"+os.Getenv("PORT"), nil) if err != nil { panic(err) } } func handler(w http.ResponseWriter, r *http.Request) { // Read the Request Parameter "command" comman...
package main import ( "encoding/json" "fmt" "net/http" "os" ) func main() { http.HandleFunc("/", handler) fmt.Println("listening...") err := http.ListenAndServe(":"+os.Getenv("PORT"), nil) if err != nil { panic(err) } } func handler(w http.ResponseWriter, r *http.Request) { // Read the Request Parameter ...
Return json response instead of text.
Return json response instead of text.
Go
mit
jayeshsolanki93/slack9gag
93212deb9715a8e54a8a5ea821dcee6c27d33d6b
src/it/ic.go
src/it/ic.go
package main import ( path "path/filepath" "os" "github.com/qlova/ilang/src" _ "github.com/qlova/ilang/src/modules/all" _ "github.com/qlova/ilang/src/types/all" ) func ic(input, directory string) { file, err := os.Open(input) if err != nil { return } ic := ilang.NewCompiler(file) if directory == "" {...
package main import ( path "path/filepath" "os" "github.com/qlova/ilang/src" _ "github.com/qlova/ilang/src/modules/all" _ "github.com/qlova/ilang/src/types/all" ) func ic(input, directory string) { file, err := os.Open(input) if err != nil { return } ic := ilang.NewCompiler(file) if directory == "" {...
Fix .it directory not being deleted on windows.
Fix .it directory not being deleted on windows.
Go
artistic-2.0
Qlova/ilang,Qlova/ilang,Qlova/ilang,Qlova/ilang,Qlova/ilang
614155f3a0775318f9e22bdd786615551285a428
synchronizer.go
synchronizer.go
package main import ( "log" "fmt" ) type Synchronizer struct { Storage *Storage } func NewSynchronizer(storage *Storage) *Synchronizer { s := new(Synchronizer) s.Storage = storage return s } func (synchronizer *Synchronizer) Start() { provider := NewMattKetmoProvider() domains, _ := provider.Get() for _,...
package main import ( "log" "fmt" ) type Synchronizer struct { Storage *Storage } func NewSynchronizer(storage *Storage) *Synchronizer { synchronizer := new(Synchronizer) synchronizer.Storage = storage return synchronizer } func (synchronizer *Synchronizer) Start() { provider := NewMattKetmoProvider() doma...
Add function for adding domains
Add function for adding domains
Go
mit
asjustas/dea
afa0d213cb73b6c2705dcd6e548a909c9f6ac1f8
u/u5/main.go
u/u5/main.go
// Package u5 currently provides a single utility to fetch the importers of a GoPackage via godoc.org API. package u5 import ( "encoding/json" "net/http" "github.com/shurcooL/go/gists/gist7480523" ) type goPackage struct { Path string Synopsis string } // Importers contains the list of Go packages that imp...
// Package u5 currently provides a single utility to fetch the importers of a GoPackage via godoc.org API. package u5 import ( "encoding/json" "fmt" "net/http" "github.com/shurcooL/go/gists/gist7480523" ) // GoPackage represents a Go package. type GoPackage struct { Path string // Import path of the package...
Check for 200 status code, better documented types.
GetGodocOrgImporters: Check for 200 status code, better documented types.
Go
mit
shurcooL/go
5d17e68c022433f84664dbd69238cfb61f7216e4
pkg/batcher/yield.go
pkg/batcher/yield.go
package batcher import ( "runtime" "time" ) const backoff = time.Microsecond var yield func() func yieldWithSleep() { time.Sleep(backoff) } func yieldWithGoSched() { runtime.Gosched() } func init() { yield = yieldWithSleep }
package batcher import ( "runtime" "time" ) const backoff = time.Microsecond * 10 // a too small backoff will lead to high CPU load var yield func() func yieldWithSleep() { time.Sleep(backoff) } func yieldWithGoSched() { runtime.Gosched() } func init() { yield = yieldWithSleep }
FIX high CPU load issue
FIX high CPU load issue
Go
apache-2.0
funkygao/dbus,funkygao/dbus
a28d7be3abc4923bc48061df17c80117e878bc9f
prove_test.go
prove_test.go
package golog import "testing" func TestFacts (t *testing.T) { db := NewDatabase(). Asserta(NewTerm("father", NewTerm("michael"))). Asserta(NewTerm("father", NewTerm("marc"))) t.Logf("%s\n", db.String()) // these should be provably true if !IsTrue(db, NewTerm("father", NewTerm...
package golog import "testing" func TestFacts (t *testing.T) { db := NewDatabase(). Asserta(NewTerm("father", NewTerm("michael"))). Asserta(NewTerm("father", NewTerm("marc"))) t.Logf("%s\n", db.String()) // these should be provably true if !IsTrue(db, NewTerm("father", NewTerm...
Make sure arity mismatch affects provability
Make sure arity mismatch affects provability
Go
mit
mndrix/golog,vzaramel/golog,bransorem/golog,mndrix/golog,samuell/golog,vzaramel/golog,bransorem/golog,samuell/golog
fba604682b50b71ee56344e203c51b8e70a19642
pkg/sqlutil/sqlutil.go
pkg/sqlutil/sqlutil.go
package sqlutil // Returns a string containing the expression IN with one or more question // marks for parameter interpolation. If numArgs argument is 3, the returned // value would be "IN (?, ?, ?)" func InParamString(numArgs int) string { resLen := 5 + ((numArgs * 3) - 2) res := make([]byte, resLen) res...
package sqlutil import ( "strings" "github.com/go-sql-driver/mysql" ) // Returns a string containing the expression IN with one or more question // marks for parameter interpolation. If numArgs argument is 3, the returned // value would be "IN (?, ?, ?)" func InParamString(numArgs int) string { resLen :=...
Add utility functions for testing duplicate keys
Add utility functions for testing duplicate keys Adds a couple utility functions to pkg/sqlutil that test whether an error is the result of a duplicate key violation and whether an error is a *specific* key violation.
Go
apache-2.0
jaypipes/procession,jaypipes/procession
80273fcbcc880810d8bb3a420513a81721b39c20
connections/output_message.go
connections/output_message.go
package connections type OutputMessageType uint8 const ( OutputMessageTypeGame OutputMessageType = iota OutputMessageTypePlayer OutputMessageTypeBroadcast ) var outputMessageTypeLabels = map[OutputMessageType]string{ OutputMessageTypeGame: "game", OutputMessageTypePlayer: "player", OutputMessageTypeBro...
package connections type OutputMessageType uint8 const ( OutputMessageTypeGame OutputMessageType = iota OutputMessageTypePlayer OutputMessageTypeBroadcast ) var outputMessageTypeLabels = map[OutputMessageType]string{ OutputMessageTypeGame: "game", OutputMessageTypePlayer: "player", OutputMessageTypeBro...
Implement JSON Marshaler interface for OutputMessage
Implement JSON Marshaler interface for OutputMessage
Go
bsd-2-clause
ivan1993spb/clever-snake
1fc892b542818a213e695f50705ec567da08f332
core/shared_state_sink.go
core/shared_state_sink.go
package core import ( "fmt" ) // writer points a shared state. sharedStateSink will point to the same shared state // even after the state is removed from the context. type sharedStateSink struct { writer Writer } // NewSharedStateSink creates a sink that writes to SharedState. func NewSharedStateSink(ctx *Context...
package core import ( "fmt" ) // writer points a shared state. sharedStateSink will point to the same shared state // even after the state is removed from the context. type sharedStateSink struct { writer Writer } // NewSharedStateSink creates a sink that writes to SharedState. func NewSharedStateSink(ctx *Context...
Make sharedStateSink.Close return nil immediately
Make sharedStateSink.Close return nil immediately
Go
mit
sensorbee/sensorbee,sensorbee/sensorbee
9d82577a970814f7ee60cd1ce75db7f74666dfa9
action.go
action.go
package sirius /* The MessageAction interface represents an action that an extension wishes to perform on the current message after execution has finished. A MessageAction may return an error if it could not be performed for any reason. */ type MessageAction interface { Perform(*Message) error } type EmptyAction st...
package sirius /* The MessageAction interface represents an action that an extension wishes to perform on the current message after execution has finished. A MessageAction may return an error if it could not be performed for any reason. */ type MessageAction interface { Perform(*Message) error } type EmptyAction st...
Remove unnecessary receiver variable name
Remove unnecessary receiver variable name
Go
mit
kayex/sirius
4c6829b8f790f173c3fa0bfdab357b24e878df05
doc.go
doc.go
/* Copyright 2014 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 2014 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/examples,kubernetes/examples,kubernetes/examples,kubernetes/examples,kubernetes/examples,kubernetes/examples,kubernetes/examples,kubernetes/examples
8767b28f7025242ade66feee0c7438e69db19efe
src/urlfetch/proxy_test.go
src/urlfetch/proxy_test.go
package urlfetch import "testing" import "fmt" // Local helper functions func test_getdata4urls(urls []string) { // create HTTP client client := HttpClient() ch := make(chan []byte) n := 0 for _, url := range urls { n++ go Getdata(client, url, ch) } for i:=0; i<n; i++ { ...
package urlfetch import "testing" import "regexp" // Local helper functions func parse(output string) bool { test, err := regexp.MatchString("</html>", output) if err != nil { return false } return test } func test_getdata4urls(urls []string) bool { ch := make(chan []byte) for _, url ...
Use regexp to match end of html; let local test function to return bool status
Use regexp to match end of html; let local test function to return bool status
Go
mit
vkuznet/urlfetch2go,vkuznet/urlfetch2go
b38a3185dda1d8c820d604e186de0008343182b3
github/util.go
github/util.go
package github import ( "github.com/github/hub/git" ) func IsHttpsProtocol() bool { httpProtocol, _ := git.Config("hub.protocol") if httpProtocol == "https" { return true } httpClone, _ := git.Config("--bool hub.http-clone") if httpClone == "true" { return true } return false }
package github import ( "github.com/github/hub/git" ) func IsHttpsProtocol() bool { httpProtocol, _ := git.Config("hub.protocol") if httpProtocol == "https" { return true } return false }
Drop support for legacy `hub.http-clone` git config value
Drop support for legacy `hub.http-clone` git config value This was kept for backwards compatibility, but was silently broken for some tiem now. Nobody reported it, so I think it can be safely assumes that nobody uses this config value anymore.
Go
mit
github/hub,github/hub,github/hub,github/hub
214f8cc14203d1a1a1f670e3805b7cb117bc4dfb
golang/ABCDEFGHPPP.go
golang/ABCDEFGHPPP.go
package main import "fmt" // I am using a programming skill call precomputation. // It has a very good performance const ans = ` 34 - 09 ----- 25 + 86 ----- 111 ===== 36 - 09 ----- 27 + 84 ----- 111 ===== 45 - 06 ----- 39 + 72 ----- 111 ===== 52 - 09 ----- 43 + 68 ----- 111 ===== 57 - 08 ---...
package main import "fmt" // I am using a programming skill call precomputation. // It has a very good performance const ans = ` 85 - 46 ----- 39 + 72 ----- 111 ===== 86 - 54 ----- 32 + 79 ----- 111 ===== 90 - 27 ----- 63 + 48 ----- 111 ===== 90 - 63 ----- 27 + 84 ----- 111 ===== 95 - 27 ---...
Remove the solution start with zero
Remove the solution start with zero
Go
mit
dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,mingchuno/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,mingchuno/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,min...
ce90b40072aa2ac1032db2db5584dd6756afe840
scope/coreos/coreos.go
scope/coreos/coreos.go
package coreos import ( "github.com/bernardolins/clustereasy/scope" "github.com/bernardolins/clustereasy/service/etcd" "github.com/bernardolins/clustereasy/service/flannel" "github.com/bernardolins/clustereasy/service/fleet" "github.com/bernardolins/clustereasy/setup/types" "github.com/bernardolins/clustereasy/u...
package coreos import ( "github.com/bernardolins/clustereasy/scope" "github.com/bernardolins/clustereasy/service/etcd" "github.com/bernardolins/clustereasy/service/flannel" "github.com/bernardolins/clustereasy/service/fleet" "github.com/bernardolins/clustereasy/setup/types" "github.com/bernardolins/clustereasy/u...
Fix error of unitdef package import after changing it's name
Fix error of unitdef package import after changing it's name
Go
apache-2.0
bernardolins/clustereasy,bernardolins/clustereasy
90c52bf7d32c3f3daacd59598d6df31dbb1166c5
service/upload/upload.go
service/upload/upload.go
package uploadService import ( "strings" ) func CheckTrackers(trackers []string) bool { // TODO: move to runtime configuration var deadTrackers = []string{ // substring matches! "://open.nyaatorrents.info:6544", "://tracker.openbittorrent.com:80", "://tracker.publicbt.com:80", "://stats.anisource.net:2710"...
package uploadService import ( "strings" ) func CheckTrackers(trackers []string) bool { // TODO: move to runtime configuration var deadTrackers = []string{ // substring matches! "://open.nyaatorrents.info:6544", "://tracker.openbittorrent.com:80", "://tracker.publicbt.com:80", "://stats.anisource.net:2710"...
Update list of dead trackers
Update list of dead trackers
Go
mit
kipukun/nyaa,yueou/nyaa,Nutjob/nyaa,ipatrol/nyaa,moose65468/nyaa,steindornatorinn/nyaa,Nutjob/nyaa,ipatrol/nyaa,moose65468/nyaa,kipukun/nyaa,yueou/nyaa,ElegantMonkey/nyaa,Nutjob/nyaa,steindornatorinn/nyaa,NyaaPantsu/nyaa,Nutjob/nyaa,ipatrol/nyaa,ElegantMonkey/nyaa,ElegantMonkey/nyaa,steindornatorinn/nyaa,majestrate/nya...
32aca3e1323886c478141cd488e1a5221fbaa04f
client.go
client.go
package twigo func NewClient(account_sid, auth_token, number string) (*Client, error) { c := &Client{AccountSid:account_sid,AuthToken:auth_token,Number:number} err := Validate(*c) if err != nil { return nil,err } return c, nil } func (c *Client) Text(msg_sms *SMS) (interface{}, error) { err := Validate(*...
package twigo func NewClient(account_sid, auth_token, number string) (*Client, error) { c := &Client{AccountSid:account_sid,AuthToken:auth_token,Number:number} err := Validate(*c) if err != nil { return nil,err } return c, nil } func (c *Client) Text(msg_sms *SMS) (*SMSResponse, error) { err := Validate(...
Return *SMSResponse for text and *CALLResponse for call
Return *SMSResponse for text and *CALLResponse for call
Go
mit
fibonacci1729/twigo
68581d50c0a53c9fe82484ae55ffb477b457cee6
statik/filesystem.go
statik/filesystem.go
// Copyright 2017 Pilosa Corp. // // 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...
// Copyright 2017 Pilosa Corp. // // 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...
Remove empty line between godoc and package declaration
Remove empty line between godoc and package declaration
Go
apache-2.0
travisturner/pilosa
1442fee229bb6d536fa29d2a3aefccf5786d036a
oci/mounts_freebsd.go
oci/mounts_freebsd.go
/* Copyright The containerd Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
/* Copyright The containerd Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
Remove mountpoints not commonly mounted on FreeBSD
Remove mountpoints not commonly mounted on FreeBSD Signed-off-by: Gijs Peskens <d9554e1af4b1b1025a175a77bdf3230ab752d193@peskens.net>
Go
apache-2.0
mikebrow/containerd,dmcgowan/containerd,dmcgowan/containerd,thaJeztah/containerd,estesp/containerd,estesp/containerd,thaJeztah/containerd,mikebrow/containerd,containerd/containerd,containerd/containerd
5fa17bf98aaab98b5bb47c851924b98df226e80b
agent/handlers/logging_handler.go
agent/handlers/logging_handler.go
// Copyright 2014-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license...
// Copyright 2014-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license...
Change log line handling http request to DEBUG
Change log line handling http request to DEBUG
Go
apache-2.0
aws/amazon-ecs-agent,swipely/amazon-ecs-agent,swipely/amazon-ecs-agent,aws/amazon-ecs-agent,aws/amazon-ecs-agent,swipely/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,swipely/amazon-ecs-agent,aws/amazon-ecs-agent
28ed3c5df6c23ebc3520516f0e993a3fa91c1488
option.go
option.go
package main import ( "github.com/jessevdk/go-flags" ) type Option struct { Delimiter string `short:"d" long:"delimiter" default:""` UseRegexp bool `short:"r" long:"regexp" default:"false"` Count int `short:"c" long:"count" default:"-1"` Margin string `short:"m" long:"margin" default:"1:1"`...
package main import ( "flag" ) type Option struct { Delimiter string UseRegexp bool Count int Margin string Justify string IsHelp bool IsVersion bool Files []string } func ParseOption(args []string) (*Option, error) { opt := &Option{} f := flag.NewFlagSet("alita", flag.ContinueOnError) f...
Switch from go-flags to flag
Switch from go-flags to flag
Go
mit
kusabashira/alita
5a83d85a68ffe2a46a9737a4a578c8b17b7c0f08
common.go
common.go
// config.go // // This file implements the configuration part for when you need the API // key to modify things in the Atlas configuration and manage measurements. package atlas import ( ) const ( apiEndpoint = "https://atlas.ripe.net/api/v2/" )
// common.go // // This file implements the configuration part for when you need the API // key to modify things in the Atlas configuration and manage measurements. package atlas import ( ) const ( apiEndpoint = "https://atlas.ripe.net/api/v2/" )
Fix file name in comment.
Fix file name in comment.
Go
mit
keltia/ripe-atlas
8bb95cb151b733f8263485aa80c6a40a25652bdf
admin/admin.go
admin/admin.go
package admin import ( "net" "net/http" "strings" "github.com/rakyll/statik/fs" _ "github.com/influxdb/influxdb/statik" ) type HttpServer struct { port string listener net.Listener closed bool } // port should be a string that looks like ":8083" or whatever port to serve on. func NewHttpServer(port s...
package admin import ( "net" "net/http" "strings" "github.com/rakyll/statik/fs" _ "github.com/influxdb/influxdb/statik" ) type HttpServer struct { port string listener net.Listener closed bool } // port should be a string that looks like ":8083" or whatever port to serve on. func NewHttpServer(port s...
Stop setting up the listener on an error.
Stop setting up the listener on an error.
Go
mit
jgeiger/influxdb,apigee/influxdb,nickrobinson/influxdb,runcom/influxdb,n1tr0g/influxdb,Yong-Lee/influxdb,mash0304/influxdb,no2key/influxdb,nickrobinson/influxdb,chenziliang/influxdb,toorop/influxdb,atyenoria/influxdb,nickrobinson/influxdb,imcom/influxdb,Yong-Lee/influxdb,paulstuart/influxdb,chenziliang/influxdb,Venu4th...
5f32b70817be38e3ba02530c32dc69df076a3b71
brokers/brokers_add.go
brokers/brokers_add.go
package brokers import ( "github.com/kafkactl/api/client" ) type BrokerAdd struct{} func Add(api client.APIClient, in *BrokerAdd) error {}
package brokers import ( "github.com/eddyzags/kafkactl/api/client" ) type BrokerAdd struct{} func Add(api client.APIClient, in *BrokerAdd) error { return nil }
Add minor error fix (imports & return)
brokers: Add minor error fix (imports & return)
Go
mit
eddyzags/kafkactl
6901af9d7b87c6460438ea379ea532587ef02eac
basiceditor.go
basiceditor.go
package main type basicEditor struct { pos int buf []rune } // move moves the position. // Given invalid position, move sets the position at the end of the buffer. func (e *basicEditor) move(to int) { switch { case to >= len(e.buf): e.pos = len(e.buf) case to <= 0: e.pos = 0 default: e.pos = to } }
package main type basicEditor struct { pos int buf []rune } // move moves the position. // Given a invalid position, move sets the position at the end of the buffer. // Valid positions are in range [0, len(e.buf)]. func (e *basicEditor) move(to int) { switch { case to >= len(e.buf): e.pos = len(e.buf) case to ...
Update the comment of e.move
Update the comment of e.move
Go
mit
elpinal/coco3
8a1c3fb12494bf435a2bcdd536f49b05f71a4585
device.go
device.go
package airplay import "github.com/armon/mdns" // A Device is an AirPlay Device. type Device struct { Name string Addr string Port int } // Devices returns all AirPlay devices in LAN. func Devices() []Device { devices := []Device{} entriesCh := make(chan *mdns.ServiceEntry, 4) defer close(entriesCh) go func(...
package airplay import "github.com/armon/mdns" // A Device is an AirPlay Device. type Device struct { Name string Addr string Port int } // Devices returns all AirPlay devices in LAN. func Devices() []Device { devices := []Device{} entriesCh := make(chan *mdns.ServiceEntry, 4) defer close(entriesCh) go func(...
Support IPv6 address AirServer returns.
Support IPv6 address AirServer returns.
Go
mit
gongo/go-airplay
5f5f9a887a6006803ef30900faaeffb40e19675f
gogeta.go
gogeta.go
package main; import ( "github.com/herman-rogers/kingkai" "github.com/hudl/fargo" ); func main() { RegisterEureka(); kingkai.StartKingKai(routes, ""); } func RegisterEureka() { c := fargo.NewConn("http://eureka-gamebuildr.herokuapp.com") c.GetApps() }
package main; import ( "github.com/herman-rogers/kingkai" //"github.com/hudl/fargo" ); func main() { RegisterEureka(); kingkai.StartKingKai(routes, ""); } func RegisterEureka() { //e := fargo.NewConn("http://eureka-gamebuildr.herokuapp.com"); // // app, _ := e.GetApp("TESTAPP"); //e.GetAp...
Add test for kingkai server running
Add test for kingkai server running
Go
mpl-2.0
herman-rogers/Gogeta,Gamebuildr/Gogeta,Gamebuildr/Gogeta,herman-rogers/Gogeta
84876b147f7e618b588500a54fe2623ec8d20f9f
agent/config/parse_linux.go
agent/config/parse_linux.go
// +build linux // Copyright Amazon.com Inc. or its affiliates. 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. A copy of the // License is located at // // httpaws.amazon.com/apache2.0/ // // or in the "lice...
// +build linux // Copyright Amazon.com Inc. or its affiliates. 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. A copy of the // License is located at // // httpaws.amazon.com/apache2.0/ // // or in the "lice...
Revert "Changes to advertise OSType while registering the container instance with cluster"
Revert "Changes to advertise OSType while registering the container instance with cluster" This reverts commit 2d0efc8a052533aced2b9221a66ca588970f3cf4.
Go
apache-2.0
kiranmeduri/amazon-ecs-agent,swipely/amazon-ecs-agent,swipely/amazon-ecs-agent,aws/amazon-ecs-agent,aws/amazon-ecs-agent,swipely/amazon-ecs-agent,swipely/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,aws/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent,aws/amazon-ecs-agent,kiranmeduri/amazon-ecs-agent
b593fc243e010d1c19416c3b282ca20bca4055d7
devlunch_test.go
devlunch_test.go
// Copyright 2014-2015 Chadev. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "testing" func TestGetMeetupEvents(t *testing.T) { _, err := getTalkDetails() if err != nil { t.Error(err) } }
// Copyright 2014-2015 Chadev. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "os" "testing" ) func TestGetMeetupEvents(t *testing.T) { if os.Getenv("CHADEV_MEETUP") == "" { t.Skip("no meetup API key set, skippin...
Fix tests on Travis CI
Fix tests on Travis CI Signed-off-by: Adam Jimerson <0a1ce5db568b585e24ec79212f7ab30cdb820af8@gmail.com>
Go
bsd-3-clause
chadev/Chadev_ircbot
1719e4ae6067d04d12522aee36b1285f91f3dc1c
init.go
init.go
package dog import "runtime" // DefaultRunner defines the runner to use in case the task does not specify it. // // The value is automatically assigned based on the operating system when the // package initializes. var DefaultRunner string // ProvideExtraInfo specifies if dog needs to provide execution info (duratio...
package dog // DefaultRunner defines the runner to use in case the task does not specify it. var DefaultRunner = "sh" // ProvideExtraInfo specifies if dog needs to provide execution info (duration, // exit status) after task execution. var ProvideExtraInfo bool // deprecation warning flags var deprecationWarningRun ...
Remove Windows support, was not implemented anyway
Remove Windows support, was not implemented anyway
Go
apache-2.0
dogtools/dog,xsb/dog
5de60655cd7172d6c153283489ebd361c26a5819
pkg/apis/storage/v1/doc.go
pkg/apis/storage/v1/doc.go
/* Copyright 2017 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 2017 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, ...
Add canonical import paths to storage packages
Add canonical import paths to storage packages The comment will ensure that only imports with this path will compile.This is needed to make sure that the vanity url k8s.io is used as the import path instead of github.com. See https://golang.org/doc/go1.4#canonicalimports for more details.
Go
apache-2.0
alejandroEsc/kubernetes,wongma7/kubernetes,ravisantoshgudimetla/kubernetes,intelsdi-x/kubernetes,pweil-/kubernetes,liggitt/kubernetes,khenidak/kubernetes,BenTheElder/kubernetes,du2016/kubernetes,tomerf/kubernetes,marun/kubernetes,kevin-wangzefeng/kubernetes,vmware/kubernetes,mahak/kubernetes,luxas/kubernetes,JacobTanen...
78ebc2e8d3e078b6c29cd65f300c2b447bc4679b
main.go
main.go
package main import ( "log" ) func main() { res, err := ping("google.com", 5) if err != nil { log.Fatal(err) } log.Printf("Min: %f ms\n", res.Min) log.Printf("Avg: %f ms\n", res.Avg) log.Printf("Max: %f ms\n", res.Max) log.Printf("Mdev: %f ms\n", res.Mdev) }
package main import ( "log" "os" "os/signal" "syscall" "time" ) func main() { ticker := time.NewTicker(10 * time.Second) go func() { for _ = range ticker.C { log.Println("ping google.com -c 5") res, err := ping("google.com", 5) if err != nil { log.Fatal(err) } log.Printf("Min: %f ms\n", re...
Use a ticker to schedule pings
Use a ticker to schedule pings
Go
mit
grahamrhay/go-ping,grahamrhay/go-ping
3fe576c561ce25c9449a2818c045b5500a66345f
main.go
main.go
package main import ( "cahbot/tgbotapi" "log" ) func main() { bot, err := NewCAHBot(Token) if err != nil { log.Panic(err) } bot.Debug = true log.Printf("Authorized on account %s", bot.Self.UserName) u := tgbotapi.NewUpdate(0) u.Timeout = 60 updates, err := bot.Updat...
package main import ( "cahbot/tgbotapi" "log" "cahbot/secrets" ) func main() { bot, err := NewCAHBot(secrets.Token) if err != nil { log.Panic(err) } bot.Debug = true log.Printf("Authorized on account %s", bot.Self.UserName) u := tgbotapi.NewUpdate(0) u.Timeout = 60 ...
Adjust the way we handle secrets
Adjust the way we handle secrets
Go
mit
thedadams/cahtelegram,thedadams/cahbot
88f114139e84441a059e5ed97422bece3d91b815
example/main.go
example/main.go
package main import "fmt" func a() error { fmt.Println("this function returns an error") return nil } func b() (int, error) { fmt.Println("this function returns an int and an error") return 0, nil } func main() { // Single error return _ = a() a() // Return another value and an error _, _ = b() b() // ...
package main import "fmt" func a() error { fmt.Println("this function returns an error") return nil } func b() (int, error) { fmt.Println("this function returns an int and an error") return 0, nil } func main() { // Single error return _ = a() a() // Return another value and an error _, _ = b() b() // ...
Add extra test cases for blank identifiers
Add extra test cases for blank identifiers
Go
mit
zimmski/errcheck,gdm85/errcheck,dominikh/errcheck,alecthomas/errcheck,kisielk/errcheck
7de7af33013a1756a89752d01af64baafac9029c
example_test.go
example_test.go
package lrserver_test import ( "github.com/jaschaephraim/lrserver" "golang.org/x/exp/fsnotify" "log" "net/http" ) // html includes the client JavaScript const html = `<!doctype html> <html> <head> <title>Example</title> <body> <script src="http://localhost:35729/livereload.js"></script> </body> </html>` func...
package lrserver_test import ( "github.com/jaschaephraim/lrserver" "golang.org/x/exp/fsnotify" "log" "net/http" ) // html includes the client JavaScript const html = `<!doctype html> <html> <head> <title>Example</title> </head> <body> <script src="http://localhost:35729/livereload.js"></script> </body> </html...
Update use of fsnotify in example
Update use of fsnotify in example
Go
mit
jaschaephraim/lrserver
356540cb3c8008ac682f9c4febc37e937cf00410
parrot.go
parrot.go
package main import "github.com/nsf/termbox-go" import "time" import "flag" func main() { loops := flag.Int("loops", 0, "number of times to loop (default: infinite)") delay := flag.Int("delay", 75, "frame delay in ms") orientation := flag.String("orientation", "regular", "regular or aussie") flag.Parse() err :=...
package main import "github.com/nsf/termbox-go" import "time" import "flag" func main() { loops := flag.Int("loops", 0, "number of times to loop (default: infinite)") delay := flag.Int("delay", 75, "frame delay in ms") orientation := flag.String("orientation", "regular", "regular or aussie") flag.Parse() err :=...
Exit on EventInterrupt rather on hardcoded Ctrl+C
Exit on EventInterrupt rather on hardcoded Ctrl+C
Go
mit
jmhobbs/terminal-parrot
1476a2934390afd2dc6520a02a57eee9926d47eb
lib/ratelimit.go
lib/ratelimit.go
package lib import ( "time" ) const windows = 2 type RateLimit struct { Period time.Duration Rate uint toks chan struct{} paused bool } func (r *RateLimit) Start() { r.paused = false if r.toks == nil { r.toks = make(chan struct{}, windows*r.Rate) } go func() { for true { for i := uint(0); i < r....
package lib import ( "time" ) const windows = 1 type RateLimit struct { Period time.Duration Rate uint toks chan struct{} paused bool } func (r *RateLimit) Start() { r.paused = false if r.toks == nil { r.toks = make(chan struct{}, windows*r.Rate) } go func() { for true { for i := uint(0); i < r....
Switch rate limiter windowsize to 1.
Switch rate limiter windowsize to 1. There seem to be occasional errors from the API, so let's be conservative.
Go
apache-2.0
danmarg/outtake
7d59d5a757d427f8c9db4d69ed33762ffe0bf27c
orderer/common/metadata/metadata_test.go
orderer/common/metadata/metadata_test.go
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package metadata_test import ( "fmt" "runtime" "testing" common "github.com/hyperledger/fabric/common/metadata" "github.com/hyperledger/fabric/orderer/common/metadata" "github.com/stretchr/testify/assert" ) func TestGetVersion...
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package metadata_test import ( "fmt" "runtime" "testing" common "github.com/hyperledger/fabric/common/metadata" "github.com/hyperledger/fabric/orderer/common/metadata" "github.com/stretchr/testify/assert" ) func TestGetVersion...
Fix orderer metadata local test
[FAB-5446] Fix orderer metadata local test The orderer metadata test only works if the development environment is setup to set common.Version, because if this is not set, the version is returned as "development version" and compared to the unset empty string. This is very annoying when trying to do development locall...
Go
apache-2.0
binhn/fabric,manish-sethi/fabric-sidedb,manish-sethi/fabric-sidedb,xixuejia/fabric,blockc/fabric,stemlending/fabric,mqshen/fabric,ckeyer/fabric,mqshen/fabric,manish-sethi/fabric,lukehuangch/fabric,blockc/fabric,lukehuangch/fabric,stemlending/fabric,stemlending/fabric,lukehuangch/fabric,ckeyer/fabric,ckeyer/fabric,mqshe...
65796be8032ba01ee7467f63c0429e038868fd0f
msgp/circular.go
msgp/circular.go
package msgp import ( "testing" ) // EndlessReader is an io.Reader // that loops over the same data // endlessly. It is used for benchmarking. type EndlessReader struct { tb *testing.B data []byte offset int } // NewEndlessReader returns a new endless reader func NewEndlessReader(b []byte, tb *testing.B) *...
package msgp type timer interface { StartTimer() StopTimer() } // EndlessReader is an io.Reader // that loops over the same data // endlessly. It is used for benchmarking. type EndlessReader struct { tb timer data []byte offset int } // NewEndlessReader returns a new endless reader func NewEndlessReader(b...
Break dependency on "testing" package
Break dependency on "testing" package Importing the "testing" standard library package automatically registers the testing commandline flags. This side effect cluttered up the output of --help for any program that imported msgp. I replaced the dependency on testing.B with an interface containing the required methods....
Go
mit
appneta/msgp,skatsuta/msgp,appneta/msgp,mengzhuo/msgp,ebfe/msgp,DrGo/msgp,kgrz/msgp,jfbus/msgp,dockbiz/msgp,eliothedeman/msgp,tinylib/msgp,tinylib/msgp,darvik80/msgp
695a2f91d2c89d99cf77f0b535ab0a5d50d96c6f
models/project.go
models/project.go
package models import ( "time" ) // ProjectStatus is a type alias which will be used to create an enum of acceptable project status states. type ProjectStatus string // ProjectStatus pseudo-enum values const ( StatusPublished ProjectStatus = "published" Statuses = []ProjectStatus{StatusPublished} ) // Errors pe...
package models import ( "time" ) // ProjectStatus is a type alias which will be used to create an enum of acceptable project status states. type ProjectStatus string // ProjectStatus pseudo-enum values const ( PStatusPublished ProjectStatus = "published" PStatuses = []ProjectStatus{StatusPublished} ) // Errors ...
Rename some things to avoid name conflicts
Rename some things to avoid name conflicts
Go
mit
georgizk/ims-release,georgizk/ims-release,georgizk/ims-release
996433d42f8ea3467a5e3d6b3ccb484b0bf76c2a
server/transactions/transactions.go
server/transactions/transactions.go
package transactions import ( "errors" "fmt" "github.com/jinzhu/gorm" "github.com/joshheinrichs/geosource/server/config" _ "github.com/lib/pq" ) var db *gorm.DB var ErrInsufficientPermission error = errors.New("Insufficient permission.") func Init(config *config.Config) (err error) { db, err = gorm.Open("pos...
package transactions import ( "errors" "fmt" "github.com/jinzhu/gorm" "github.com/joshheinrichs/geosource/server/config" _ "github.com/lib/pq" ) var db *gorm.DB var ErrInsufficientPermission error = errors.New("Insufficient permission.") func Init(config *config.Config) (err error) { arguments := "" if len(...
Make database config fields optional
Make database config fields optional
Go
mit
Decateron/geosource,Decateron/geosource,Decateron/geosource
cd44a3fcebfc3f67f87a9e4614d1848b0c617204
refctx/refctx.go
refctx/refctx.go
package refctx import ( "context" "sync/atomic" ) // RefCtr cancels a context when no references are held type RefCtr struct { cancel context.CancelFunc refcnt int32 } // Incr increments the refcount func (r *RefCtr) Incr() { r.Add(1) } // Add i refcounts func (r *RefCtr) Add(i int32) { if v := atomic.AddInt32...
package refctx import ( "context" "sync/atomic" "github.com/SentimensRG/ctx" ) // RefCtr cancels a context when no references are held type RefCtr struct { cancel func() refcnt uint32 } // Incr increments the refcount func (r *RefCtr) Incr() { r.Add(1) } // Add i refcounts func (r *RefCtr) Add(i uint32) { if...
Use uint32 for Refctr WithRefCount now accepts a ctx.Doner Add ContextWithRefcount, which accepts a context.Context
Use uint32 for Refctr WithRefCount now accepts a ctx.Doner Add ContextWithRefcount, which accepts a context.Context
Go
mit
SentimensRG/ctx
a8be9c32d0a9567773d06078682251d2efb53ccb
node_freebsd.go
node_freebsd.go
package restic import ( "os" "syscall" "time" ) func (node *Node) OpenForReading() (*os.File, error) { file, err := os.OpenFile(node.path, os.O_RDONLY, 0) if os.IsPermission(err) { return os.OpenFile(node.path, os.O_RDONLY, 0) } return file, err } func (node *Node) fillTimes(stat *syscall.Stat_t) { node.Ch...
package restic import ( "os" "syscall" "time" ) func (node *Node) OpenForReading() (*os.File, error) { return os.OpenFile(node.path, os.O_RDONLY, 0) } func (node *Node) fillTimes(stat *syscall.Stat_t) { node.ChangeTime = time.Unix(stat.Ctimespec.Unix()) node.AccessTime = time.Unix(stat.Atimespec.Unix()) } fun...
Call open file once on FreeBSD.
Call open file once on FreeBSD.
Go
bsd-2-clause
episource/restic,jayme-github/restic,stuertz/restic,jayme-github/restic,pombredanne/restic,ar-jan/restic,arithmetric/restic,intfrr/restic,middelink/restic,ar-jan/restic,bchapuis/restic,restic/restic,fawick/restic,ckemper67/restic,stuertz/restic,kurin/restic,kurin/restic,mappu/restic,klauspost/restic,byo/restic,middelin...
565d8da8471ee5149b65b343eb68ff660e45be0a
server/errors.go
server/errors.go
package server import ( "net/http" "github.com/heroku/busl/assets" "github.com/heroku/busl/broker" "github.com/heroku/busl/storage" "github.com/heroku/busl/util" ) func handleError(w http.ResponseWriter, r *http.Request, err error) { if err == broker.ErrNotRegistered || err == storage.ErrNoStorage { message ...
package server import ( "errors" "net/http" "github.com/heroku/busl/assets" "github.com/heroku/busl/broker" "github.com/heroku/busl/storage" "github.com/heroku/busl/util" ) var errNoContent = errors.New("No Content") func handleError(w http.ResponseWriter, r *http.Request, err error) { if err == broker.ErrNo...
Use errNoContent to signal 204
Use errNoContent to signal 204
Go
mit
cyx/busl,heroku/busl,heroku/busl
4257931f694a0379accdcb3abd47df5147d880e6
ksonnet-gen/ksonnet/util.go
ksonnet-gen/ksonnet/util.go
package ksonnet import ( "log" "os" "os/exec" "strings" "github.com/ksonnet/ksonnet-lib/ksonnet-gen/kubespec" ) const constructorName = "new" var specialProperties = map[kubespec.PropertyName]kubespec.PropertyName{ "apiVersion": "apiVersion", "metadata": "metadata", "kind": "kind", } func isSpecial...
package ksonnet import ( "log" "os" "os/exec" "strings" "github.com/ksonnet/ksonnet-lib/ksonnet-gen/kubespec" ) const constructorName = "new" var specialProperties = map[kubespec.PropertyName]kubespec.PropertyName{ "apiVersion": "apiVersion", "kind": "kind", } func isSpecialProperty(pn kubespec.Proper...
Remove metadata from special properties list
Remove metadata from special properties list Metadata was originally put on the special properties list, since we had plans to ask users to pass metadata in from the API object constructors. Now that this plan is largely abandoned, there is no need to heed to it. This commit will remove it from this set. Signed-off-...
Go
apache-2.0
ksonnet/ksonnet-lib,heptio/kube.libsonnet,Bradamant3/kube.libsonnet,ksonnet/ksonnet-lib
04d70fa168908caef6f43b0620234840ec7b9fa2
exporter/export_statsd.go
exporter/export_statsd.go
// Copyright 2015 Google Inc. All Rights Reserved. // This file is available under the Apache license. package exporter import ( "expvar" "flag" "fmt" "github.com/google/mtail/metrics" ) var ( statsdHostPort = flag.String("statsd_hostport", "", "Host:port to statsd server to write metrics to.") statsdExpor...
// Copyright 2015 Google Inc. All Rights Reserved. // This file is available under the Apache license. package exporter import ( "expvar" "flag" "fmt" "github.com/google/mtail/metrics" ) var ( statsdHostPort = flag.String("statsd_hostport", "", "Host:port to statsd server to write metrics to.") statsdExpor...
Add a todo for statsd gauges.
Add a todo for statsd gauges.
Go
apache-2.0
SuperQ/mtail,4honor/mtail,google/mtail,4honor/mtail,google/mtail,SuperQ/mtail
8359b7406152a9b7562584686e2d7a7ce5bbfe50
alertsv2/execute_custom_action_request.go
alertsv2/execute_custom_action_request.go
package alertsv2 import "net/url" type ExecuteCustomActionRequest struct { *Identifier ActionName string `json:"-"` User string `json:"user,omitempty"` Source string `json:"source,omitempty"` Note string `json:"note,omitempty"` ApiKey string `json:"-"` } func (r *ExecuteCustomActionRequest)...
package alertsv2 import ( "net/url" "errors" ) type ExecuteCustomActionRequest struct { *Identifier ActionName string `json:"-"` User string `json:"user,omitempty"` Source string `json:"source,omitempty"` Note string `json:"note,omitempty"` ApiKey string `json:"-"` } func (r *ExecuteCusto...
Add validation for execute custom action
Add validation for execute custom action
Go
apache-2.0
opsgenie/opsgenie-go-sdk
39e998a44037c182e0debdb83b03472c7da316c1
store.go
store.go
package persona import ( "code.google.com/p/gorilla/sessions" "net/http" ) type Store struct { store sessions.Store } func NewStore(secret string) Store { return Store{sessions.NewCookieStore([]byte(secret))} } func (s Store) Get(r *http.Request) string { session, _ := s.store.Get(r, "session-name") if v, ok...
package persona import ( "net/http" "github.com/gorilla/sessions" ) type Store struct { store sessions.Store } func NewStore(secret string) Store { return Store{sessions.NewCookieStore([]byte(secret))} } func (s Store) Get(r *http.Request) string { session, _ := s.store.Get(r, "session-name") if v, ok := se...
Change gorilla/sessions import path to github
Change gorilla/sessions import path to github
Go
mit
hawx/persona
e8a87530700a1987eef05c94d6b0bbc985bf8f00
cc.go
cc.go
package libclc import ( "text/template" "bufio" ) type File struct { Path string Content string Owner string Permissions string } type CloudConfig struct { DiscoveryUrl string Files []*File } func WriteCloudConfig(config *CloudConfig, t *template.Template, path string) (error) { return WriteTempla...
package libclc import ( "text/template" "bufio" ) type File struct { HostPath string Path string Content string Owner string Permissions string } type CloudConfig struct { DiscoveryUrl string Files []*File } func WriteCloudConfig(config *CloudConfig, t *template.Template, path string) (error) { ...
Add host path to file model.
Add host path to file model.
Go
apache-2.0
winkapp/libclc,winkapp/libclc
a6163f603e23d3174faebb6e47be4e676c7d92a9
pkg/client/fs/fs_windows.go
pkg/client/fs/fs_windows.go
// +build windows /* * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this fs except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appl...
// +build windows /* * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this fs except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appl...
Add missing var error for windows, minor change pushing in
Add missing var error for windows, minor change pushing in
Go
agpl-3.0
vadmeste/mc,abperiasamy/mc,vadmeste/mc,abperiasamy/mc,akiradeveloper/mc,CarterMcClellan/mc,CarterMcClellan/mc,krishnasrinivas/mc,harshavardhana/mc,harshavardhana/mc,krisis/mc,balamurugana/mc,winchram/mc,winchram/mc,balamurugana/mc,krisis/mc,akiradeveloper/mc,minio/mc,krishnasrinivas/mc,minio/mc
cb31e3a15a79059b4b4f2739eb31fe4f999e93bb
convert_test.go
convert_test.go
package plist import ( "testing" "testing/quick" ) func TestCFData(t *testing.T) { f := func(data []byte) []byte { return data } g := func(data []byte) []byte { cfData := convertBytesToCFData(data) defer cfRelease(cfTypeRef(cfData)) return convertCFDataToBytes(cfData) } if err := quick.CheckEqual(f, g, ni...
package plist import ( "testing" "testing/quick" ) func TestCFData(t *testing.T) { f := func(data []byte) []byte { return data } g := func(data []byte) []byte { cfData := convertBytesToCFData(data) if cfData == nil { t.Fatal("CFDataRef is NULL") } defer cfRelease(cfTypeRef(cfData)) return convertCFDa...
Add a test for CFStrings
Add a test for CFStrings
Go
bsd-3-clause
kballard/go-osx-plist
20e2b0dde6f58535d426c4f500bd7cd1a7bd31b8
server_test.go
server_test.go
package cnmidori_test import ( "fmt" "io/ioutil" "os" "path" "github.com/northbright/cnmidori" "github.com/northbright/pathhelper" ) const ( settingsStr string = ` { "redis-servers":[ {"name":"user", "addr":"localhost:6379", "password":"123456"}, {"name":"data", "addr":"localhost:6380", "p...
package cnmidori_test import ( "fmt" "io/ioutil" "os" "path" "github.com/northbright/cnmidori" "github.com/northbright/pathhelper" ) const ( settingsStr string = ` { "redis-servers":[ {"name":"user", "addr":"localhost:6379", "password":"123456"}, {"name":"data", "addr":"localhost:6380", "p...
Remove blank line in JSON string.
Remove blank line in JSON string.
Go
mit
northbright/cnmidori,northbright/cnmidori
1c95b0742837c7651dee104af54f753f66ddd4d9
cmd/mstdn/cmd_toot_test.go
cmd/mstdn/cmd_toot_test.go
package main import ( "fmt" "net/http" "testing" "github.com/urfave/cli" ) func TestCmdToot(t *testing.T) { toot := "" testWithServer( func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/api/v1/statuses": toot = r.FormValue("status") fmt.Fprintln(w, `{"ID": 2345}`) ret...
package main import ( "fmt" "net/http" "testing" "github.com/urfave/cli" ) func TestCmdToot(t *testing.T) { toot := "" testWithServer( func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/api/v1/statuses": toot = r.FormValue("status") fmt.Fprintln(w, `{"id": 2345}`) ret...
Fix test json property name again
Fix test json property name again
Go
mit
178inaba/go-mastodon,mattn/go-mastodon,mattn/go-mastodon
26692a28dc68e1760322314d820391b08ea9270c
example/main.go
example/main.go
package main import ( "../../cmd" "fmt" ) func main() { commander := &cmd.Cmd{} commander.Init() commander.Commands["ls"] = func(line string) (stop bool) { fmt.Println("listing stuff") return } commander.Commands["exit"] = func(line string) (stop bool) { fmt....
package main import ( "github.com/gobs/cmd" "fmt" ) func main() { commander := &cmd.Cmd{} commander.Init() commander.Commands["ls"] = func(line string) (stop bool) { fmt.Println("listing stuff") return } commander.Commands["exit"] = func(line string) (stop bool) { ...
Use the correct import path
Use the correct import path
Go
mit
gobs/cmd,calgaryscientific/cmd
717a9309963d4e4767abf32ef614f33667ce6a07
internal/keys/kind.go
internal/keys/kind.go
package keys import "fmt" // Kind expresses usage of the ambient internal key. type Kind int const ( // Delete represents deletion of this key. Delete = 0 // Value represents value setting of this key. Value = 1 maxKind = Value // Seek is maximum(Value, Delete), which is a valid Kind and // serves as termi...
package keys import "fmt" // Kind expresses usage of the ambient internal key. type Kind int const ( // Delete represents deletion of this key. Delete = 0 // Value represents value setting of this key. Value = 1 maxKind = Value // Seek is maximum(Value, Delete), which is a valid Kind and // serves as start...
Fix document for keys.Kind Seek
Fix document for keys.Kind Seek
Go
mit
kezhuw/leveldb,kezhuw/leveldb
e02909f004d1d83127a43dad74a5217f2445fafd
file_storage.go
file_storage.go
package main import ( "os" "path" "path/filepath" ) func newFileStorage(params *params) storager { return &fileStorage{params} } type fileStorage struct { params *params } func (f fileStorage) isExist() bool { if _, err := os.Stat(f.pathByParams()); err != nil { return false } return true } func (f fileS...
package main import ( "os" "os/exec" "path" "path/filepath" ) func newFileStorage(params *params) storager { return &fileStorage{params} } type fileStorage struct { params *params } func (f fileStorage) isExist() bool { if _, err := os.Stat(f.pathByParams()); err != nil { return false } return true } fu...
Use mv command instead of os.Rename because avoid invalid cross-device link error.
Use mv command instead of os.Rename because avoid invalid cross-device link error.
Go
mit
monochromegane/torokko
51aafa6d23a1c2105a7806de5c3bceeb0783a8f1
vm/null.go
vm/null.go
package vm var ( nullClass *RNull // NULL represents Goby's null objects. NULL *NullObject ) // RNull is the built in class of Goby's null objects. type RNull struct { *BaseClass } // NullObject represnts the null value in Goby. type NullObject struct { Class *RNull } // Inspect returns the name of NullObject ...
package vm var ( nullClass *RNull // NULL represents Goby's null objects. NULL *NullObject ) // RNull is the built in class of Goby's null objects. type RNull struct { *BaseClass } // NullObject represnts the null value in Goby. type NullObject struct { Class *RNull } // Inspect returns the name of NullObject ...
Return nothing when NullObject is inspected (especially when placed in `puts`).
Return nothing when NullObject is inspected (especially when placed in `puts`).
Go
mit
st0012/Rooby,hachi8833/goby,goby-lang/goby,Maxwell-Alexius/goby,goby-lang/goby,hachi8833/goby,hachi8833/goby,goby-lang/goby,Maxwell-Alexius/goby,Maxwell-Alexius/goby,st0012/Rooby
93e00e1656422e6d293917a01f93b373e3d0b83c
pkg/db/db_test.go
pkg/db/db_test.go
package db import ( "testing" "time" ) func TestDbConn(t *testing.T) { conn := func(name string) { t.Log("\t", name) if c1, err1 := Client(); err1 != nil { t.Error(err1) } else { defer Release(c1) } time.Sleep(2 * time.Second) } go conn("c1") conn("c2") conn("c3") }
/** * go test -f ../../config.json */ package db import ( "testing" "time" ) func TestDbConn(t *testing.T) { conn := func(name string) { t.Log("\t", name) if c1, err1 := Client(); err1 != nil { t.Error(err1) } else { defer Release(c1) } time.Sleep(2 * time.Second) } go conn("c1") conn("c2"...
Add comment for db test
Add comment for db test All network i/o tests require config file, so run test with -f flag, e.g.: go test -f ../../config.json
Go
mit
kuba--/yag,kuba--/yag
cc322e9db991a3a566335f22faecb298176f7fe6
filereader.go
filereader.go
package main import ( "bufio" "log" "os" "github.com/flowbase/flowbase" ) // -------------------------------------------------------------------------------- // FileReader // -------------------------------------------------------------------------------- type FileReader struct { InFileName chan string OutLin...
package main import ( "bufio" "log" "os" "github.com/flowbase/flowbase" ) // -------------------------------------------------------------------------------- // FileReader // -------------------------------------------------------------------------------- // FileReader is a process that reads files, based on fi...
Add comments to FileReader process
Add comments to FileReader process
Go
mit
rdfio/rdf2smw,rdfio/rdf2smw
27288b1b7adb8e07ab942b8c6e1f9c0df43fa4ab
isatty_bsd.go
isatty_bsd.go
// +build darwin freebsd openbsd netbsd dragonfly // +build !appengine package isatty import ( "syscall" "unsafe" ) const ioctlReadTermios = syscall.TIOCGETA // IsTerminal return true if the file descriptor is terminal. func IsTerminal(fd uintptr) bool { var termios syscall.Termios _, _, err := syscall.Syscall6...
// +build darwin freebsd openbsd netbsd dragonfly // +build !appengine package isatty import "golang.org/x/sys/unix" // IsTerminal return true if the file descriptor is terminal. func IsTerminal(fd uintptr) bool { _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) return err == nil } // IsCygwinTerminal retur...
Use golang.org/x/sys/unix for IsTerminal on *BSD
Use golang.org/x/sys/unix for IsTerminal on *BSD Use unix.IoctlGetTermios to implement IsTerminal on *BSD and no longer requires to use the frozen syscall package.
Go
mit
mattn/go-isatty,mattn/go-isatty
fde0f4623511455826005e1dda31649c3d41488a
matrix.go
matrix.go
/* Package "matrix" provides types which represent matrix, scalar and iterator of elements. */ package matrix import ( "github.com/mitsuse/matrix-go/internal/types" ) type Matrix interface { types.Matrix } type Cursor interface { types.Cursor }
/* Package "matrix" is an experimental library for matrix manipulation implemented in Golang. */ package matrix import ( "github.com/mitsuse/matrix-go/internal/types" ) type Matrix interface { types.Matrix } type Cursor interface { types.Cursor }
Replace the short description with a sentence to describe the whole of "matirx-go" library.
Replace the short description with a sentence to describe the whole of "matirx-go" library.
Go
mit
mitsuse/matrix-go,jmptrader/matrix-go
801ec2795baad4d74871dbf3c11a0b92809f0500
example/doer.go
example/doer.go
package example // Doer does things, sometimes repeatedly type Doer interface { DoIt(task string, graciously bool) (int, error) } type Delegater struct { Delegate Doer } func (d *Delegater) DoSomething(task string) (int, error) { return d.Delegate.DoIt(task, false) }
package example // Doer does things, sometimes graciously type Doer interface { DoIt(task string, graciously bool) (int, error) } // Delegater employs a Doer to complete tasks type Delegater struct { Delegate Doer } // DoSomething passes the work to Doer func (d *Delegater) DoSomething(task string) (int, error) { ...
Add documentation to Doer and Delegator
Add documentation to Doer and Delegator
Go
unlicense
enocom/fm,enocom/fm
ab43e7899928afbb11add20351517b9486336dd8
fleet/main.go
fleet/main.go
package fleet import ( "encoding/json" "io/ioutil" "net" "net/http" ) type Client struct { http *http.Client } type Unit struct { CurrentState string `json:"currentState"` DesiredState string `json:"desiredState"` MachineID string `json:"machineID"` Name string `json:"name"` } type UnitsResponse...
package fleet import ( "encoding/json" "net" "net/http" ) type Client struct { http *http.Client } type Unit struct { CurrentState string `json:"currentState"` DesiredState string `json:"desiredState"` MachineID string `json:"machineID"` Name string `json:"name"` } type UnitsResponse struct { Un...
Use json.Decoder instead of json.Unmarshal.
Use json.Decoder instead of json.Unmarshal.
Go
mit
bmorton/deployster
50bcc11856a4cf4951234cb29a56993789d69c7e
common/common.go
common/common.go
package common import ( "encoding/base64" "strings" "github.com/ricallinson/forgery" "github.com/spacedock-io/index/models" ) func UnpackAuth(raw string) (creds []string, err error) { auth := strings.Split(raw, " ") decoded, err := base64.StdEncoding.DecodeString(auth[1]) if err != nil { return nil, e...
package common import ( "encoding/base64" "strings" "github.com/ricallinson/forgery" "github.com/spacedock-io/index/models" ) func UnpackAuth(raw string) (creds []string, err error) { auth := strings.Split(raw, " ") decoded, err := base64.StdEncoding.DecodeString(auth[1]) if err != nil { return nil, e...
Add req.Map["admin"], clear req.Map security fields
Add req.Map["admin"], clear req.Map security fields
Go
mit
spacedock-io/index