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 |
|---|---|---|---|---|---|---|---|---|---|
ae0dc43daca9932a09cf01d3ee67e5e8ea6b6d55 | clearable.go | clearable.go | package gfx
// ClearMask represents a bitmask to choose which buffers to clear during a
// framebuffer clearing operation. It must be one of the predefined constants.
type ClearMask int
// Clearing masks to select the color, depth, and stencil buffers. They can be
// bitwise OR'd together to select multiple:
//
// c... | package gfx
// ClearMask represents a bitmask to choose which buffers to clear during a
// framebuffer clearing operation. It must be one of the predefined constants.
type ClearMask int
// Clearing masks to select the color, depth, and stencil buffers. They can be
// bitwise OR'd together to select multiple:
//
// c... | Fix declaration of ClearMask bitmasks. | Fix declaration of ClearMask bitmasks.
| Go | bsd-3-clause | slimsag/gfx,slimsag/gfx |
90c8b6eeed58626686f31832aa3024d2859bb918 | probe/topology_tagger.go | probe/topology_tagger.go | package probe
import (
"github.com/weaveworks/scope/report"
)
type topologyTagger struct{}
// NewTopologyTagger tags each node with the topology that it comes from. It's
// kind of a proof-of-concept tagger, useful primarily for debugging.
func NewTopologyTagger() Tagger {
return &topologyTagger{}
}
func (topolog... | package probe
import (
"github.com/weaveworks/scope/report"
)
type topologyTagger struct{}
// NewTopologyTagger tags each node with the topology that it comes from. It's
// kind of a proof-of-concept tagger, useful primarily for debugging.
func NewTopologyTagger() Tagger {
return &topologyTagger{}
}
func (topolog... | Add ECS topologies to tagger | Add ECS topologies to tagger
| Go | apache-2.0 | paulbellamy/scope,alban/scope,kinvolk/scope,weaveworks/scope,weaveworks/scope,kinvolk/scope,alban/scope,alban/scope,alban/scope,kinvolk/scope,paulbellamy/scope,alban/scope,paulbellamy/scope,paulbellamy/scope,weaveworks/scope,weaveworks/scope,weaveworks/scope,paulbellamy/scope,kinvolk/scope,paulbellamy/scope,weaveworks/... |
a6a42d16f3cb1e84df29aba0d1531d5bfb069b13 | lib/fsutil/copy.go | lib/fsutil/copy.go | package fsutil
import (
"bufio"
"fmt"
"io"
"os"
)
func copyToFile(destFilename string, perm os.FileMode, reader io.Reader,
length uint64) error {
tmpFilename := destFilename + "~"
destFile, err := os.OpenFile(tmpFilename, os.O_CREATE|os.O_WRONLY, perm)
if err != nil {
return err
}
defer os.Remove(tmpFilen... | package fsutil
import (
"fmt"
"io"
"os"
)
func copyToFile(destFilename string, perm os.FileMode, reader io.Reader,
length uint64) error {
tmpFilename := destFilename + "~"
destFile, err := os.OpenFile(tmpFilename, os.O_CREATE|os.O_WRONLY, perm)
if err != nil {
return err
}
defer os.Remove(tmpFilename)
def... | Fix ignore of error when calling Flush() in lib/fsutil.CopyToFile(). | Fix ignore of error when calling Flush() in lib/fsutil.CopyToFile().
| Go | apache-2.0 | rgooch/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator |
6b1ce991282be24d4a112cd5a20a0ed476a834c1 | stats/stats.go | stats/stats.go | package stats
type SingleStat struct {
TotalGB float32
UsedGB float32
AvailableGB float32
UsagePercentage float32
}
type MultipleStat struct {
AverageUsagePercentage float32
UsagePercentagePerCore []float32
}
| package stats
type SingleStat struct {
TotalGB float32 `json:"totalGB"`
UsedGB float32 `json:"usedGB"`
AvailableGB float32 `json:"availableGB"`
UsagePercentage float32 `json:"usagePercentage"`
}
type MultipleStat struct {
AverageUsagePercentage float32 `json:"averageUsagePercentage"`
Usag... | Define JSON data structure serialization. | Define JSON data structure serialization.
| Go | mit | julianespinel/mbu |
bc0237986cbbbf3a36436e16c103ca18918bc907 | core/matching/state_matcher.go | core/matching/state_matcher.go | package matching
import "github.com/SpectoLabs/hoverfly/core/state"
func StateMatcher(currentState *state.State, requiredState map[string]string) *FieldMatch {
score := 0
matched := true
if requiredState == nil || len(requiredState) == 0 {
return &FieldMatch{
Matched: true,
Score: 0,
}
}
currentSt... | package matching
import "github.com/SpectoLabs/hoverfly/core/state"
func StateMatcher(currentState *state.State, requiredState map[string]string) *FieldMatch {
score := 0
matched := true
if requiredState == nil || len(requiredState) == 0 {
return &FieldMatch{
Matched: true,
Score: 0,
}
}
currentSt... | Copy state before checking values | Copy state before checking values
| Go | apache-2.0 | SpectoLabs/hoverfly,SpectoLabs/hoverfly |
fdb36c2c6e8f3691253317620fa7c59380933dd8 | examples/getstr/getstr.go | examples/getstr/getstr.go | /* This example demonstrates reading a string from input, rather than a
* single character. Note that only the 'n' versions of getstr have been
* implemented in goncurses to ensure buffer overflows won't exist */
package main
import gc "code.google.com/p/goncurses"
func main() {
stdscr, _ := gc.Init()
defer gc.... | /* This example demonstrates reading a string from input, rather than a
* single character. Note that only the 'n' versions of getstr have been
* implemented in goncurses to ensure buffer overflows won't exist */
package main
import gc "code.google.com/p/goncurses"
func main() {
stdscr, _ := gc.Init()
defer gc.... | Update form example for MovePrint | Update form example for MovePrint
| Go | bsd-3-clause | nodar-chkuaselidze/goncurses,aquarat/goncurses,snuk182/goncurses,cha87de/goncurses,bluzye/goncurses,cha87de/goncurses,nodar-chkuaselidze/goncurses,bluzye/goncurses,aquarat/goncurses,cha87de/goncurses,snuk182/goncurses |
be82a08f8a94f04c2c58939587eb1a7a3c0e47cd | examples/pullup/pullup.go | examples/pullup/pullup.go | package main
import (
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
)
var (
// Use mcu pin 22, corresponds to GPIO3 on the pi
pin = rpio.Pin(22)
)
func main() {
// Open and map memory to access gpio, check for errors
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Unmap gpio memory... | package main
import (
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
)
var (
// Use mcu pin 22, corresponds to GPIO3 on the pi
pin = rpio.Pin(22)
)
func main() {
// Open and map memory to access gpio, check for errors
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Unmap gpio memory... | Expand example to cover new Pi 4 ReadPull() interface | Expand example to cover new Pi 4 ReadPull() interface
| Go | mit | stianeikeland/go-rpio |
0e1c34ad3af773d7fe8399bbcd0181d471949566 | model/Site.go | model/Site.go | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *... | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *... | Extend site model with storage for a defaultRoomID. | Extend site model with storage for a defaultRoomID.
This is used in conjunction with autopromote to allow homecloud
to auto-promote all newly created devices.
Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com>
| Go | mit | ninjasphere/go-ninja,ninjasphere/go-ninja |
6df018a222ab835f16b3b59af903c0cebe6f9ce8 | server/src/dto/packet.go | server/src/dto/packet.go | package dto
// type MessageIn struct {
// Id string `json:"-"`
// Topic string `json:"topic"`
// Payload string `json:"payload"`
// }
// type MessageOut struct {
// Id string `json:"-"`
// Topic string `json:"topic"`
// Payload interface{} `json:"payload"`
// }
// Packet -
type Packet s... | package dto
// type MessageIn struct {
// Id string `json:"-"`
// Topic string `json:"topic"`
// Payload string `json:"payload"`
// }
// type MessageOut struct {
// Id string `json:"-"`
// Topic string `json:"topic"`
// Payload interface{} `json:"payload"`
// }
// Packet -
type Packet s... | Set a proper name for the dto | Set a proper name for the dto
Related to #64
| Go | mit | jbrodriguez/unbalance,jbrodriguez/unbalance,jbrodriguez/unbalance,jbrodriguez/unbalance |
c0885bdf4ad7dc8622133cdc3176c7dca64afa9c | src/Martini/Templates.go | src/Martini/Templates.go | package main
import (
"fmt"
"github.com/go-martini/martini"
"html/template"
"io/ioutil"
"net/http"
"os"
)
type Human struct {
Name string
Age string
}
func main() {
f, err := os.Open("/home/user/GoCode/src/html/SimpleTemplate.html")
defer f.Close()
if err != nil {
fmt.Println(err)
}
data, err := iout... | package main
import (
"fmt"
"github.com/go-martini/martini"
"html/template"
"io/ioutil"
"net/http"
"os"
)
type Human struct {
Name string
Age string
}
func main() {
f, err := os.Open("src/html/SimpleTemplate.html")
defer f.Close()
if err != nil {
fmt.Println(err)
}
data, err := ioutil.ReadAll(f)
if ... | Fix path to be cross-platform | Fix path to be cross-platform
| Go | apache-2.0 | cube2222/GoCode,cube2222/GoCode |
cf34b6ba08cd5c5350c1529d60c4488fed3080b2 | resolution.go | resolution.go | package monk
import (
"fmt"
)
type Resolution struct {
Resolved []string
Seen []string
}
// Resolve the asset at assetPath and its dependencies.
//
// TODO should return error
func (r *Resolution) Resolve(assetPath string, context *Context) error {
r.Seen = append(r.Seen, assetPath)
asset, err := context.l... | package monk
import (
"fmt"
)
type Resolution struct {
Resolved []string
Seen []string
}
// Resolve the asset at assetPath and its dependencies.
func (r *Resolution) Resolve(assetPath string, context *Context) error {
r.Seen = append(r.Seen, assetPath)
asset, err := context.lookup(assetPath)
if err != nil... | Resolve already returns an error. | Resolve already returns an error.
| Go | mit | jim/monk,jim/monk |
8e4f6b4578486663193ef76d6aa6be42bbbc0709 | geocodio.go | geocodio.go | 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... | package geocodio
import (
"os"
"strings"
)
const (
// GeocodioAPIBaseURLv1 is the Geocod.io Base URL
GeocodioAPIBaseURLv1 = "https://api.geocod.io/v1.6"
)
// Geocodio is the base struct
type Geocodio struct {
APIKey string
}
type Input struct {
AddressComponents Components `json:"address_components"`
Formatt... | Add simplified New and support env value | Add simplified New and support env value
| Go | mit | stevepartridge/geocodio |
d9fc6d9455e6977c61ef04eb5d0ebbeb8ad1f321 | plugin/meta_data_store.go | plugin/meta_data_store.go | package plugin
import (
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
)
type metaDataStore struct {
dir string
installTarget *installTarget
}
var errDisaleMetaDataStore = errors.New("MetaData disabled. could not detect owner/repo")
func newMetaDataStore(pluginDir string, target *installT... | package plugin
import (
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
)
type metaDataStore struct {
dir string
installTarget *installTarget
}
var errDisaleMetaDataStore = errors.New("MetaData disabled. could not detect owner/repo")
func newMetaDataStore(pluginDir string, target *installT... | Use ioutil.ReadFile instead of os.Openfile with O_CREATE. | Use ioutil.ReadFile instead of os.Openfile with O_CREATE.
No need to create an empty file if meta data key is not found.
| Go | apache-2.0 | mackerelio/mkr,mackerelio/mkr |
d4877bef50e73ad39bea7207f29aa5572f640ebc | providertests/exercise.go | providertests/exercise.go | // +build go1.7
package providertests
import (
"testing"
saml2 "github.com/russellhaering/gosaml2"
"github.com/stretchr/testify/require"
)
func ExerciseProviderTestScenarios(t *testing.T, scenarios []ProviderTestScenario) {
println("TESTING")
for _, scenario := range scenarios {
t.Run(scenario.ScenarioName, ... | // +build go1.7
package providertests
import (
"testing"
saml2 "github.com/russellhaering/gosaml2"
"github.com/stretchr/testify/require"
)
func ExerciseProviderTestScenarios(t *testing.T, scenarios []ProviderTestScenario) {
for _, scenario := range scenarios {
t.Run(scenario.ScenarioName, func(t *testing.T) {... | Remove extraneous println during tests | Remove extraneous println during tests
| Go | apache-2.0 | russellhaering/gosaml2,russellhaering/gosaml2 |
b53a6ff1b02f8d63ecfc21c9f6be3d529bed5800 | main.go | main.go | package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"strings"
)
var f = flag.String("f", "", "Output file, else stdout.")
var p = flag.String("p", "main", "Package.")
var fRE = regexp.MustCompile("[a-zA-Z0-9_]+")
func main() {
flag.Parse()
w := os.Stdout
var err error
if *f != "" {
if w,... | package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"strings"
)
var f = flag.String("f", "", "Output file, else stdout.")
var p = flag.String("p", "main", "Package.")
var fRE = regexp.MustCompile("[a-zA-Z0-9_]+")
func main() {
flag.Parse()
w := os.Stdout
var err error
if *f != "" {
if w,... | Correct newlines for gofmt comapt | Correct newlines for gofmt comapt
| Go | mit | mjibson/esc,mjibson/esc,mweagle/esc,slavikm/esc,mjibson/esc |
bed13b0916edd31ad1e85bd74bea71dd8b4276fb | config/file.go | config/file.go | package config
import (
"os"
"syscall"
)
func createOrOpenLockedFile(name string) (file *os.File, err error) {
if _, err := os.Stat(name); os.IsNotExist(err) {
file, err = os.Create(name)
} else {
file, err = os.OpenFile(name, os.O_RDWR, 0644)
}
if err != nil {
return
}
if flerr := syscall.Flock(int(f... | package config
import (
"errors"
"fmt"
"os"
"syscall"
)
type closedError struct {
flockErr error
fileErr error
}
func (ce closedError) Error() string {
return fmt.Sprintf("%s, %s", ce.fileErr.Error(), ce.flockErr.Error())
}
func newClosedError(flockErr, fileErr error) error {
if fileErr == nil {
fileErr ... | Handle the flock errors while closing | Handle the flock errors while closing
Multierrors are nice.
| Go | mit | gsamokovarov/jump |
8da2627b5db875c12e852c4bcc864fde6b28f68e | workload/plugin.go | workload/plugin.go | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package workload
import (
"gopkg.in/juju/charm.v5"
)
// Plugin represents the functionality of a workload plugin.
type Plugin interface {
// Launch runs the plugin's "launch" command, passing the provided
// workload defi... | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package workload
import (
"gopkg.in/juju/charm.v5"
)
// Plugin represents the functionality of a workload plugin.
type Plugin interface {
// Launch runs the plugin's "launch" command, passing the provided
// workload defi... | Add blank lines in an interface. | Add blank lines in an interface.
| Go | agpl-3.0 | gabriel-samfira/juju,bz2/juju,dimitern/juju,mikemccracken/juju,AdamIsrael/juju,macgreagoir/juju,reedobrien/juju,bogdanteleaga/juju,voidspace/juju,marcmolla/juju,wwitzel3/juju,mjs/juju,reedobrien/juju,AdamIsrael/juju,anastasiamac/juju,bac/juju,dimitern/juju,marcmolla/juju,alesstimec/juju,bac/juju,davecheney/juju,daveche... |
269ac84b5d1905c513554f6d5d5c5725c172e9f6 | integration/helpers/os.go | integration/helpers/os.go | package helpers
import (
"runtime"
)
func IsWindows() bool {
return runtime.GOOS == "windows"
}
| package helpers
import (
"runtime"
. "github.com/onsi/ginkgo"
)
func IsWindows() bool {
return runtime.GOOS == "windows"
}
func SkipIfWindows() {
if IsWindows() {
Skip("the OS is Windows")
}
}
| Add helper Skip test if OS is Windows | Add helper Skip test if OS is Windows
context: https://www.pivotaltracker.com/story/show/167232547/comments/204542288
[#167232547](https://www.pivotaltracker.com/story/show/167232547)
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
d562e5909e3153a00d3171b14c31adc70fd9e5d6 | client/internal/client/proccess_commits.go | client/internal/client/proccess_commits.go | package client
import (
"sync"
"github.com/calebamiles/github-client/comments"
"github.com/calebamiles/github-client/commits"
)
func (c *DefaultClient) processCommits(commitWithoutComments commits.CommitWithoutComments, cs *commitAccumulator, ready chan struct{}, wg *sync.WaitGroup, errs *errorAccumulator) {
def... | package client
import (
"sync"
"github.com/calebamiles/github-client/comments"
"github.com/calebamiles/github-client/commits"
)
func (c *DefaultClient) processCommits(commitWithoutComments commits.CommitWithoutComments, cs *commitAccumulator, ready chan struct{}, wg *sync.WaitGroup, errs *errorAccumulator) {
def... | Fix bug in rate limiting when processing commits | Fix bug in rate limiting when processing commits
| Go | bsd-3-clause | calebamiles/github-client |
66cd6ff8f6f3ba914df6bc7fa3359e50077ef3c3 | io.go | io.go | package intern
import (
"bufio"
"io"
"sync/atomic"
"unsafe"
)
type sbwriter interface {
WriteByte(byte) error
WriteString(string) (int, error)
}
func (ctx *Context) WriteTo(rawwr io.Writer) error {
w, ok := rawwr.(sbwriter)
var bwr *bufio.Writer
if !ok {
bwr = bufio.NewWriter(rawwr)
w = bwr
}
c := (*s... | package intern
import (
"bufio"
"io"
"sync/atomic"
"unsafe"
)
type sbwriter interface {
WriteByte(byte) error
WriteString(string) (int, error)
}
func (ctx *Context) WriteTo(rawwr io.Writer) error {
w, ok := rawwr.(sbwriter)
var bwr *bufio.Writer
if !ok {
bwr = bufio.NewWriter(rawwr)
w = bwr
}
c := (*s... | Fix yet another double-pointer bug | Fix yet another double-pointer bug
| Go | mit | taruti/intern |
d88dcee9fe7c3852bb240e1ac70ef62d3bb67767 | 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... | Fix return error correctly in NewSharedStateSink | Fix return error correctly in NewSharedStateSink
| Go | mit | sensorbee/sensorbee,sensorbee/sensorbee |
adfaa0fff200b4dfcab7c6c92b88359e02cdc497 | pkg/api/store/setting/store.go | pkg/api/store/setting/store.go | package setting
import (
"os"
"github.com/rancher/norman/store/transform"
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/settings"
)
func New(store types.Store) types.Store {
return &transform.Store{
Store: store,
Transformer: func(apiContext *types.APIContext, schema *types.Schema, data ... | package setting
import (
"os"
"github.com/rancher/norman/store/transform"
"github.com/rancher/norman/types"
"github.com/rancher/norman/types/convert"
"github.com/rancher/rancher/pkg/settings"
)
func New(store types.Store) types.Store {
return &transform.Store{
Store: store,
Transformer: func(apiContext *ty... | Fix setting source attribute is not set when listting settings | Fix setting source attribute is not set when listting settings
**Problem:**
The source attribute is not set when listing settings.
The root cause is that `apiContext.ID` won't be set when calling list
interface.
**Solution:**
Use the `data["id"]` as key to get value from environment variable
| Go | apache-2.0 | rancherio/rancher,rancher/rancher,rancherio/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,cjellick/rancher |
08d8c25446fcd2d3f1098519200921aa7a2db042 | arbreader/reader.go | arbreader/reader.go | package arbreader
import (
"encoding/json"
"io"
"strings"
"github.com/juju/errgo"
)
type Message struct {
Key string
Type string
Extended map[string]string
Description string
}
func Read(reader io.Reader) ([]*Message, error) {
data := map[string]interface{}{}
if err := json.NewDecoder(reader).Decode(&... | package arbreader
import (
"encoding/json"
"io"
"strings"
"github.com/juju/errgo"
)
type Message struct {
Key string
Type string
Extended map[string]string
Description string
Value string
}
func Read(reader io.Reader) ([]*Message, error) {
data := map[string]interface{}{}
if err := json.NewDecoder(r... | Save the value of the message. | Save the value of the message.
| Go | mit | altipla-consulting/arb-reader |
95b411440e30d025fbf5b69954b7ae9acef220f0 | constants.go | constants.go | package xing
// Constants
const (
// Type
Command = "command"
Event = "event"
Result = "result"
// Event
Register = "Register"
// Exchanges
RPCExchange = "xing.rpc"
EventExchange = "xing.event"
// Client Types
ProducerClient = "producer"
ServiceClient = "service"
EventHandlerClient = "... | package xing
// Constants
const (
// Type
Command = "command"
Event = "event"
Result = "result"
// Event
Register = "Register"
// Exchanges
RPCExchange = "xing.rpc"
EventExchange = "xing.event"
// Client Types
ProducerClient = "producer"
ServiceClient = "service"
EventHandlerClient = "... | Revert "increasing result queue TTL" | Revert "increasing result queue TTL"
This reverts commit 488a377b9702090275a33a335ceb90a89e6ed6f5.
| Go | apache-2.0 | wzhliang/xing |
06f2522bd7dc36280ebc4f24088036bbc4b78ac7 | examples/line/line-main.go | examples/line/line-main.go | package main
import (
"../../../drawer"
"fmt"
"image"
"image/color"
"image/png"
"os"
)
func main() {
src := image.NewRGBA(image.Rect(0, 0, 100, 100))
drawer.Fill(src, color.RGBA{0, 255, 255, 255})
start := image.Pt(100, 100)
end := image.Pt(0, 0)
ld := drawer.NewLineDrawer(src, start, end, color.RGBA{255,... | package main
import (
"../../../drawer"
"fmt"
"image"
"image/color"
"image/png"
"os"
)
func main() {
src := image.NewRGBA(image.Rect(0, 0, 100, 100))
drawer.Fill(src, color.RGBA{0, 255, 255, 255})
ld := drawer.NewLineDrawer(src, image.Pt(100, 100), image.Pt(0, 0), color.RGBA{255, 0, 0, 255}).Draw()
draw(ld... | Add another example of a line that is thicker | Add another example of a line that is thicker
| Go | bsd-3-clause | ricochet2200/drawer |
a387b0a70af7f9a02db2d28114c2082aa978774d | proto/doc.go | proto/doc.go | // Package proto contains protocol buffers that are exchanged between the client
// and server.
//
// Generating Protocol Buffer Code
//
// Anytime the Protocol Buffer definitions change, the generated Go code must be
// regenerated. This can be done with "go generate". Just run:
// go generate ./...
//
// Upstream d... | // Package proto contains protocol buffers that are exchanged between the client
// and server.
//
// Generating Protocol Buffer Code
//
// Anytime the Protocol Buffer definitions change, the generated Go code must be
// regenerated. This can be done with "go generate". Just run:
// go generate ./...
//
// Upstream d... | Add instructions for resolving proto-gen-go error | Add instructions for resolving proto-gen-go error
| Go | apache-2.0 | google/go-tpm-tools,google/go-tpm-tools,google/go-tpm-tools |
c1d22f5343ca271efa490ddbb5dbf43dee43e7e6 | pty_posix.go | pty_posix.go | // © 2012 Jay Weisskopf
package pty
// #include <stdlib.h>
// #include <fcntl.h>
import "C"
import "os"
func Open() (ptm *os.File, ptsName string, err error) {
ptmFd, err := C.posix_openpt(C.O_RDWR | C.O_NOCTTY)
if err != nil {
return nil, "", err
}
ptm = os.NewFile(uintptr(ptmFd), "")
defer func() {
if e... | // © 2012 Jay Weisskopf
package pty
// #include <stdlib.h>
// #include <fcntl.h>
import "C"
import "os"
func Open() (ptm *os.File, ptsName string, err error) {
ptmFd, err := C.posix_openpt(C.O_RDWR | C.O_NOCTTY)
if err != nil {
return nil, "", err
}
ptm = os.NewFile(uintptr(ptmFd), "")
defer func() {
if e... | Set ptm return pointer to nil if it is closed. | Set ptm return pointer to nil if it is closed.
| Go | mit | jayschwa/go-pty |
d904cf0beee88aeb9a4094ec119de958621b1856 | pkg/cmd/commands/bridge/resource.go | pkg/cmd/commands/bridge/resource.go | // Copyright 2017-2020 The Usacloud 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 o... | // Copyright 2017-2020 The Usacloud 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 o... | Update command category from Storage to Networking | Update command category from Storage to Networking
| Go | apache-2.0 | sacloud/usacloud,yamamoto-febc/usacloud,yamamoto-febc/usacloud,sacloud/usacloud |
80aadd108b73ecda5faeaba539cb6ef32722860a | risu_test.go | risu_test.go | package main
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestRootAccess(t *testing.T) {
response := httptest.NewRecorder()
n := setUpServer()
req, err := http.NewRequest("GET", "http://localhost:8080/", nil)
if err != nil {
t.Error(err)
}
n.ServeHTTP(response, req)
if response.Code != http.... | package main
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/wantedly/risu/schema"
)
func TestGitClone(t *testing.T) {
opts := schema.BuildCreateOpts{
SourceRepo: "wantedly/private-nginx-image-server",
Name: "quay.io/wantedly/private-nginx-image-server:test",
}
build := schema.NewBuild... | Add test for git clone | Add test for git clone
| Go | mit | wantedly/risu,wantedly/risu,koudaiii/risu,koudaiii/risu,koudaiii/risu,wantedly/risu,koudaiii/risu,wantedly/risu |
28a4ff944b59d34b868260a1e035aec7f18c3090 | correlation_test.go | correlation_test.go | package stats
import (
"testing"
)
func TestCorrelation(t *testing.T) {
s1 := []float64{1, 2, 3, 4, 5}
s2 := []float64{10, -51.2, 8}
s3 := []float64{1, 2, 3, 5, 6}
s4 := []float64{}
_, err := Correlation(s1, s2)
if err == nil {
t.Errorf("Mismatched slice lengths should have returned an error")
}
a, err :... | package stats
import (
"testing"
)
func TestCorrelation(t *testing.T) {
s1 := []float64{1, 2, 3, 4, 5}
s2 := []float64{10, -51.2, 8}
s3 := []float64{1, 2, 3, 5, 6}
s4 := []float64{}
s5 := []float64{0, 0, 0}
a, err := Correlation(s5, s5)
if err != nil {
t.Errorf("Should not have returned an error")
}
if a... | Add unit test for edge case that wasn't covered | Add unit test for edge case that wasn't covered
| Go | mit | montanaflynn/stats |
b38092eb8072dea71233f873e9ebdf6304dc1093 | lib/rand_id_test.go | lib/rand_id_test.go | package lib
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestRandomIds(t *testing.T) {
Convey("Given a random identifier", t, func() {
s := RandomIdentifier()
Convey("Then it is a string", func() {
So(s, ShouldHaveSameTypeAs, "asd")
})
Convey("When I generate another identifier... | package lib
import (
"fmt"
)
func ExampleRandomIdentifier_AreDifferent() {
a := RandomIdentifier()
b := RandomIdentifier()
fmt.Println(a == b)
// Output: false
}
func ExampleRandomIdentifierOfLength() {
s := RandomIdentifierOfLength(64)
fmt.Println(len(s))
// Output: 64
}
| Use examples instead of explicit tests | Use examples instead of explicit tests
| Go | apache-2.0 | involucro/involucro,thriqon/involucro |
98e8d99412bb14c8b70a45d35a92e77948910c55 | heartbeat.go | heartbeat.go | package main
import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
"time"
)
func RunPeriodically(c *cli.Context) error {
log.SetFormatter(_makeFormatter(c.String("format")))
log.WithFields(log.Fields{
"appName": c.App.Name,
}).Info("Running periodically")
var period time.Duration = 1 * time.Se... | package main
import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
"time"
)
func RunPeriodically(c *cli.Context) error {
log.SetFormatter(_makeFormatter(c.String("format")))
log.WithFields(log.Fields{
"appName": c.App.Name,
}).Info("Running periodically")
period := 1 * time.Second
for {
go... | Switch period from var to val. | Switch period from var to val.
| Go | apache-2.0 | qualimente/heartbeat |
2d199bd634527e24e86fac93a2625b7851df7785 | compare_and_swap.go | compare_and_swap.go | package main
import (
"flag"
"fmt"
)
const CompareAndSwapUsage = `usage: etcdctl [etcd flags] compareAndSwap <key> <value> [testAndSet flags]
either prevValue or prevIndex needs to be given
special flags: --ttl to set a key with ttl
--pvalue to set the previous value
--pindex to set the previous index`
... | package main
import (
"flag"
"fmt"
)
const CompareAndSwapUsage = `usage: etcdctl [etcd flags] compareAndSwap <key> <value> [testAndSet flags]
either prevValue or prevIndex needs to be given
special flags: --ttl to set a key with ttl
--prevValue to set the previous value
--prevIndex to set the previous i... | Change flag names to match API params | Change flag names to match API params
| Go | apache-2.0 | jakubigla/etcdctl,jakubigla/etcdctl |
11fa08e8ec1cf16f9533cca9df7b379934af5063 | data/project.go | data/project.go | package data
import (
"time"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type Project struct {
ID bson.ObjectId `bson:"_id"`
Name string `bson:"name"`
OwnerId bson.ObjectId `bson:"owner_id"`
MemberIds []bson.ObjectId `bson:"member_ids"`
CreatedAt time.Time `bson:"created_... | package data
import (
"time"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type Project struct {
ID bson.ObjectId `bson:"_id"`
Name string `bson:"name"`
OwnerID bson.ObjectId `bson:"owner_id"`
MemberIDs []bson.ObjectId `bson:"member_ids"`
CreatedAt time.Time `bson:"created_... | Implement Put for Project struct | Implement Put for Project struct
| Go | bsd-3-clause | FurqanSoftware/papyrus,FurqanSoftware/papyrus,FurqanSoftware/papyrus |
bd82db83810aa98ca78bbe742b1f95f3413a4073 | dsl/value.go | dsl/value.go | package dsl
import (
"goa.design/goa/v3/eval"
"goa.design/goa/v3/expr"
)
// Value sets the example value.
//
// Value must appear in Example.
//
// Value takes one argument: the example value.
//
// Example:
//
// Example("A simple bottle", func() {
// Description("This bottle has an ID set to 1")
// ... | package dsl
import (
"goa.design/goa/v3/eval"
"goa.design/goa/v3/expr"
)
// Val is an alias for expr.Val.
type Val expr.Val
// Value sets the example value.
//
// Value must appear in Example.
//
// Value takes one argument: the example value.
//
// Example:
//
// Example("A simple bottle", func() {
// D... | Make 'Val' usable directly as DSL. | Make 'Val' usable directly as DSL.
| Go | mit | goadesign/goa |
76a53b903b1cd44c867b5580f2a7dd34ca5f52e1 | tools.go | tools.go | package tools
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"strings"
"unicode"
"unicode/utf8"
)
func ComputeHmac256(message string, secret string) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return base64.StdEncoding.EncodeToString(h.Sum(nil))
}
func C... | package tools
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"strings"
"unicode"
"unicode/utf8"
)
func ComputeHmac256(message string, secret string) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return base64.StdEncoding.EncodeToString(h.Sum(nil))
}
func Co... | Add special method for HTML urls issue with / when using the default hmac method | Add special method for HTML urls issue with / when using the default hmac method
| Go | mit | scritch007/go-tools |
632b61adbffc472e3f0742ccc98aaed2a9577437 | pkg/database/migrate/20140522205400_save_drone_yml.go | pkg/database/migrate/20140522205400_save_drone_yml.go | package migrate
type rev20140522205400 struct{}
var SaveDroneYml = &rev20140522205400{}
func (r *rev20140522205400) Revision() int64 {
return 20140522205400
}
func (r *rev20140522205400) Up(mg *MigrationDriver) error {
_, err := mg.AddColumn("builds", "buildscript TEXT")
return err
}
func (r *rev20140522205400)... | package migrate
type rev20140522205400 struct{}
var SaveDroneYml = &rev20140522205400{}
func (r *rev20140522205400) Revision() int64 {
return 20140522205400
}
func (r *rev20140522205400) Up(mg *MigrationDriver) error {
_, err := mg.AddColumn("builds", "buildscript TEXT")
_, err = mg.Tx.Exec("UPDATE builds SET bu... | Update buildscript for old builds | Update buildscript for old builds
| Go | apache-2.0 | fracting/drone,nevermosby/drone,donatj/drone,mercadolibre/drone,PermissionData/drone,depay/drone,alphagov/drone,mikaelhg/drone,arobson/drone,kausdev/drone,pombredanne/drone,gregory90/drone,jgoldfar/drone,simonoff/drone,k2wanko/drone,Dataman-Cloud/drone,simonoff/drone,hkjn/drone,vaijab/drone,alphagov/drone,reinbach/dron... |
82a06684e1c9389b96ef98ad8caad5f455103e94 | iter/func.go | iter/func.go | package iter
// Callback receives a value and returns true if another value should be
// received or false to stop iteration.
type Callback func(value interface{}) (more bool)
// Func iterates by calling Callback for each of its values.
type Func func(Callback)
func All(cb Callback, fs ...Func) bool {
for _, f := r... | package iter
// Callback receives a value and returns true if another value should be
// received or false to stop iteration.
type Callback func(value interface{}) (more bool)
// Func iterates by calling Callback for each of its values.
type Func func(Callback)
func All(cb Callback, fs ...Func) bool {
for _, f := r... | Change iter.First to return the value | Change iter.First to return the value
| Go | mit | anacrolix/missinggo |
eef92a73ccb3337c2b89b21e44846bd12414ebc6 | api/linode.go | api/linode.go | package api
import (
"io/ioutil"
"net/http"
)
type LinodeClient struct {
APIKey string
}
func NewLinodeClient() *LinodeClient {
return NewLinodeClient()
}
func NewLinodeClientWithKey(apiKey string) *LinodeClient {
return &LinodeClient{
APIKey: apiKey,
}
}
func (c *LinodeClient) ListLinodes() ([]byte, error... | package api
import (
"io/ioutil"
"net/http"
"net/url"
)
type LinodeClient struct {
APIKey string
}
func NewLinodeClient() *LinodeClient {
return NewLinodeClient()
}
func NewLinodeClientWithKey(apiKey string) *LinodeClient {
return &LinodeClient{
APIKey: apiKey,
}
}
func (c *LinodeClient) APICall(query str... | Refactor HTTP call out of function | Refactor HTTP call out of function
| Go | mit | kelcecil/go-linode |
f8622a1ab5f13a195ee3c9c70a6073ae29f735bd | environment.go | environment.go | // Copyright 2014 GoIncremental Limited. 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 b... | // Copyright 2014 GoIncremental Limited. 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 b... | Support loading env file from custom file path | Support loading env file from custom file path
| Go | apache-2.0 | GoIncremental/web |
9b68793a42b82fe00b6cba6dac10676cc9f52624 | compression/compress.go | compression/compress.go | package compress
import "bytes"
import "strconv"
func compress(uncompressed string) string {
var buf bytes.Buffer
if len(uncompressed) == 0 {
return buf.String()
}
var prev byte
letter := uncompressed[0]
last := 0
for i := 1; i < len(uncompressed); i++ {
prev = uncompressed[i-1]
letter = uncompressed[i... | package compress
import "strconv"
func compress(uncompressed string) string {
var buf string
if len(uncompressed) == 0 {
return buf
}
var prev byte
letter := uncompressed[0]
last := 0
for i := 1; i < len(uncompressed); i++ {
prev = uncompressed[i-1]
letter = uncompressed[i]
if letter != prev {
buf... | Use a string instead of bytes buffer | Use a string instead of bytes buffer
| Go | apache-2.0 | armiller/puzzles,armiller/puzzles |
7693d1d2031c8e50f60ae011ac26b46d4e04af93 | main_test.go | main_test.go | package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuildRunList(t *testing.T) {
tests := []struct {
cookbookName string
recipes []string
runList []string
}{
{"cats", []string{}, []string{"cats::default"}},
{"cats", []string{"recipes/foo.rb"}, []string{"cats::foo"}... | package main
import (
"os"
"testing"
"github.com/mlafeldt/chef-runner/log"
"github.com/stretchr/testify/assert"
)
func TestLogLevel(t *testing.T) {
tests := map[string]int{
"": log.LevelInfo,
"debug": log.LevelDebug,
"info": log.LevelInfo,
"warn": log.LevelWarn,
"error": log.LevelError,
"DEBU... | Test setting of log level | Test setting of log level
| Go | apache-2.0 | rajthilakmca/chef-runner,rajthilakmca/chef-runner,mlafeldt/chef-runner,mlafeldt/chef-runner,mlafeldt/chef-runner,rajthilakmca/chef-runner |
3c3183fd7a64b22c2376ac154a1dba31d0dd472b | aws_utils.go | aws_utils.go | /*
Copyright 2014 The Kubernetes 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 law or ag... | /*
Copyright 2014 The Kubernetes 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 law or ag... | Fix long-standing bug in aws.stringSetToPointers | Fix long-standing bug in aws.stringSetToPointers
Instead of N pointers, we were returning N null pointers, followed by the real
thing. It's not clear why we didn't trip on this until now, maybe there is a
new server-side check for empty subnetID strings.
| Go | apache-2.0 | kubernetes/cloud-provider-aws,kubernetes/cloud-provider-aws,kubernetes/cloud-provider-aws |
cd559458673e93bbefa9659859f538bfdd9e9ef8 | main/main.go | main/main.go | package main
import (
"bigv.io/client/cmd"
// bigv "bigv.io/client/lib"
"flag"
"fmt"
"os"
)
var (
configDir = flag.String("config", "", "Location of go-bigv's config store - defaults to ~/.go-bigv")
help = flag.Bool("help", false, "Display usage information")
debugLevel = flag.Int("debug-level", 0, "Ho... | package main
import (
"bigv.io/client/cmd"
// bigv "bigv.io/client/lib"
"flag"
"os"
)
var (
configDir = flag.String("config", "", "Location of go-bigv's config store - defaults to ~/.go-bigv")
help = flag.Bool("help", false, "Display usage information")
debugLevel = flag.Int("debug-level", 0, "How much ... | Remove the using-config-in-dir message from startup. | Remove the using-config-in-dir message from startup.
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
391324115962dcfee0e12b114fc93abfbbaa0c39 | cli/command_blob_delete.go | cli/command_blob_delete.go | package cli
import (
"context"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/repo/blob"
)
var (
blobDeleteCommand = blobCommands.Command("delete", "Show contents of blobs").Alias("rm")
blobDeleteBlobIDs = blobDeleteCommand.Arg("blobIDs", "Blob IDs").Required().Strings()
)
func... | package cli
import (
"context"
"github.com/pkg/errors"
"github.com/kopia/kopia/repo"
"github.com/kopia/kopia/repo/blob"
)
var (
blobDeleteCommand = blobCommands.Command("delete", "Delete blobs by ID").Alias("rm")
blobDeleteBlobIDs = blobDeleteCommand.Arg("blobIDs", "Blob IDs").Required().Strings()
)
func run... | Fix command description for blob delete | [Trivial] Fix command description for blob delete
Fix probable copy paste error on "blob delete" subcommand from
the "blob show" description.
| Go | apache-2.0 | kopia/kopia,kopia/kopia,kopia/kopia,kopia/kopia |
7364b3a3fbbb0f29a2c670688e091e24ff67ce3d | dos/syscall.go | dos/syscall.go | package dos
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall.go syscall.go
//sys copyFile(src string,dst string,isFailIfExist bool)(n uint32,err error) = kernel32.CopyFileW
//sys moveFileEx(src string,dst string,flag uintptr)(n uint32,err error) = kernel32.MoveFileExW
//sys getDiskFreeSp... | package dos
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output z$GOFILE $GOFILE
//sys copyFile(src string,dst string,isFailIfExist bool)(n uint32,err error) = kernel32.CopyFileW
//sys moveFileEx(src string,dst string,flag uintptr)(n uint32,err error) = kernel32.MoveFileExW
//sys getDiskFreeSpaceEx(... | Rewrite go:generate line with macro $GOFILE | Rewrite go:generate line with macro $GOFILE
| Go | bsd-3-clause | nocd5/nyagos,tsuyoshicho/nyagos,tyochiai/nyagos,zetamatta/nyagos |
35c06d35433447c7cef3de790def2b4ad3006ab6 | slice/slice_test.go | slice/slice_test.go | package slice_test
import (
"testing"
"github.com/xgfone/go-tools/slice"
)
func TestSlice(t *testing.T) {
ss := []int{1,2,3,4,5,6}
ok := true
out := 0
ok = slice.SetValueWithDefault(&out, ss, 2, 100)
if !ok || out != 3 {
t.Fail()
}
ok = slice.SetValueWithDefault(&out, ss... | package slice_test
import (
"fmt"
"testing"
"github.com/xgfone/go-tools/slice"
)
func TestSlice(t *testing.T) {
ss := []int{1, 2, 3, 4, 5, 6}
ok := true
out := 0
ok = slice.SetValueWithDefault(&out, ss, 2, 100)
if !ok || out != 3 {
t.Fail()
}
ok = slice.SetValueWithDefault(&out, ss, 6, 100)
if !ok || ... | Add the example for slice | Add the example for slice
| Go | apache-2.0 | xgfone/go-tools |
6227aa67e6f74b9af53907d7c97d4b3f3558bd41 | statsdurl.go | statsdurl.go | package statsdurl
import (
"os"
"fmt"
"net/url"
"strings"
"github.com/quipo/statsd"
)
func Connect() (*statsd.StatsdClient, error) {
return ConnectToURL(os.Getenv("STATSD_URL"))
}
func ConnectToURL(s string) (c *statsd.StatsdClient, err error) {
statsdUrl, err := url.Parse(s)
if err != nil {
return
}
p... | package statsdurl
import (
"net/url"
"os"
"github.com/quipo/statsd"
)
func Connect(prefix string) (*statsd.StatsdClient, error) {
return ConnectToURL(os.Getenv("STATSD_URL"))
}
func ConnectToURL(s string, prefix string) (c *statsd.StatsdClient, err error) {
statsdUrl, err := url.Parse(s)
if err != nil {
re... | Allow prefix to be set by each client | Allow prefix to be set by each client
| Go | mit | seatgeek/go-statsdurl |
25da74b864efd8eed0c7a16366adf7d9c443c16b | cmd/mstdn/cmd_followers.go | cmd/mstdn/cmd_followers.go | package main
import (
"context"
"fmt"
"time"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdFollowers(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
config := c.App.Metadata["config"].(*mastodon.Config)
account, err := client.GetAccountCurrentUser(context.Bac... | package main
import (
"context"
"fmt"
"time"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdFollowers(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
config := c.App.Metadata["config"].(*mastodon.Config)
account, err := client.GetAccountCurrentUser(context.Bac... | Fix follower pagination in cmd/mstdn | Fix follower pagination in cmd/mstdn
Make sure to reset Pagination's MinID on every iteration, as
discussed in #99.
| Go | mit | 178inaba/go-mastodon,mattn/go-mastodon,mattn/go-mastodon |
e4ff0b87427e768173ebd06f1647e8b96293d60d | exponential.go | exponential.go | package backoff
import (
"math"
"time"
)
type ExponentialBackoff struct {
RandomizationFactor float64
Retries int
MaxRetries int
Delay time.Duration
Interval time.Duration
}
func Exponential() *ExponentialBackoff {
return &ExponentialBackoff{
RandomizationFacto... | package backoff
import (
"math"
"time"
)
type ExponentialBackoff struct {
Retries int
MaxRetries int
Delay time.Duration
Interval time.Duration
}
func Exponential() *ExponentialBackoff {
return &ExponentialBackoff{
Retries: 0,
MaxRetries: ... | Make algorithms use uniform distribution of backoff times. | Make algorithms use uniform distribution of backoff times.
| Go | mit | jeffchao/backoff |
3341d7d3b239c434223f0320edb92cc7f26f119c | example/decoder/main.go | example/decoder/main.go | package main
import (
"flag"
"image"
"log"
"os"
"github.com/pixiv/go-libjpeg/jpeg"
)
func main() {
flag.Parse()
file := flag.Arg(0)
io, err := os.Open(file)
if err != nil {
log.Fatalln("Can't open file: ", file)
}
img, err := jpeg.Decode(io, &jpeg.DecoderOptions{})
if img == nil {
log.Fatalln("Got ... | package main
import (
"flag"
"image"
"log"
"os"
"github.com/pixiv/go-libjpeg/jpeg"
)
func main() {
flag.Parse()
file := flag.Arg(0)
io, err := os.Open(file)
if err != nil {
log.Fatalln("Can't open file: ", file)
}
img, err := jpeg.Decode(io, &jpeg.DecoderOptions{})
if img == nil {
log.Fatalln("Got ... | Fix Travis errors on recent Go | Fix Travis errors on recent Go
| Go | bsd-3-clause | pixiv/go-libjpeg,pixiv/go-libjpeg,pixiv/go-libjpeg |
c5ee149d143abb930d829b19cb7a4e930cacbcd2 | main.go | main.go | package main
import (
"os"
"io/ioutil"
"github.com/hashicorp/hcl/json/parser"
"github.com/hashicorp/hcl/hcl/printer"
)
func main() {
input, _ := ioutil.ReadAll(os.Stdin)
ast, err := parser.Parse([]byte(input))
if err != nil {
panic(err)
}
err = printer.Fprint(os.Stdout, ast)
if err != nil {
... | package main
import (
"os"
"io/ioutil"
"github.com/Acconut/hcl/json/parser"
"github.com/Acconut/hcl/hcl/printer"
)
func main() {
input, _ := ioutil.ReadAll(os.Stdin)
ast, err := parser.Parse([]byte(input))
if err != nil {
panic(err)
}
err = printer.Fprint(os.Stdout, ast)
if err != nil {
... | Switch to @Acconut's HCL fork | Switch to @Acconut's HCL fork
Until https://github.com/hashicorp/hcl/pull/149 gets merged (maybe)
| Go | mit | kvz/json2hcl |
eb9d68e8af2e9ae3ae8dcdaac4bd12833e8b6a31 | main.go | main.go | package main
import (
"fmt"
"github.com/Financial-Times/service-status-go/buildinfo"
)
func main() {
fmt.Printf("Build info is %+v", buildinfo.GetBuildInfo)
}
| package main
import (
"fmt"
"github.com/Financial-Times/service-status-go/buildinfo"
)
func main() {
info := buildinfo.GetBuildInfo()
fmt.Printf("Build info is %v+", info)
}
| Print info as an example | Print info as an example
| Go | mit | Financial-Times/service-status-go,Financial-Times/service-status-go |
927ba54148fb8db9af8185e6b69b3397dec57713 | main.go | main.go | package main
import (
"fmt"
"os"
"os/user"
"path"
"strconv"
"strings"
"syscall"
)
func checkError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(111)
}
}
func main() {
username := os.Args[1]
program := os.Args[2]
pargv := os.Args[2:]
user, err := user.Lookup(username)
checkError(err)
uid... | package main
import (
"fmt"
"os"
"os/user"
"path"
"strconv"
"strings"
"syscall"
)
var usage string = "setuidgid: usage: setuidgid username program [arg...]"
func checkError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(111)
}
}
func main() {
if len(os.Args) <= 2 {
fmt.Print(usage)
os.Exit... | Print usage when incorrect parameters passed | Print usage when incorrect parameters passed
If the incorrect number of parameters are passed the print the usage
string.
| Go | mit | tmiller/setuidgid |
eade0f9157f5efadd7ac92c93ad528f79d1c6219 | main.go | main.go | /*
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Coporation
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 b... | /*
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Coporation
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 b... | Update import for rmq package | Update import for rmq package
| Go | apache-2.0 | intelsdi-x/snap-plugin-publisher-rabbitmq,candysmurf/snap-plugin-publisher-rabbitmq,intelsdi-x/snap-plugin-publisher-rabbitmq,candysmurf/snap-plugin-publisher-rabbitmq,intelsdi-x/snap-plugin-publisher-rabbitmq |
8daa57a0bac9b0f4f7794b36638e77efcb97a33f | http_logger.go | http_logger.go | package threedo
import (
"github.com/codegangsta/negroni"
"log"
"os"
)
func NewLogger() *negroni.Logger {
return &negroni.Logger{
log.New(os.Stdout, "[http] ", log.LstdFlags),
}
}
| package threedo
import (
"github.com/codegangsta/negroni"
"github.com/go-kit/kit/log"
"net/http"
"os"
"time"
)
type Logger struct {
log.Logger
}
func NewLogger() *Logger {
return &Logger{log.NewLogfmtLogger(os.Stderr)}
}
func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFun... | Use go-kit/log instead of the std log package | Use go-kit/log instead of the std log package
| Go | mit | 3onyc/threedo-backend,3onyc/3do,3onyc/3do,3onyc/3do,3onyc/threedo-backend,3onyc/threedo-backend |
b5ed160140acab6513c7256c4c39077656b5a664 | images_test.go | images_test.go | package imgbase64
import (
"testing"
)
func TestEncode(t *testing.T) {
const in, out = "Hello, World!", "SGVsbG8sIFdvcmxkIQ=="
if x := encode([]byte(in)); string(x) != out {
t.Errorf("Encode(%v) = %s, want %v", in, x, out)
}
}
func TestDefaultImage(t *testing.T) {
const expected = "https://www.github.com/"
... | package imgbase64
import (
"testing"
)
func TestEncode(t *testing.T) {
const in, out = "Hello, World!", "SGVsbG8sIFdvcmxkIQ=="
if x := encode([]byte(in)); string(x) != out {
t.Errorf("Encode(%v) = %s, want %v", in, x, out)
}
}
func TestDefaultImage(t *testing.T) {
const expected = "https://www.github.com/"
... | Disable DefaultFailOver Test for the moment till todo 1 is complete | Disable DefaultFailOver Test for the moment till todo 1 is complete
| Go | mit | polds/imgbase64 |
75579a58deddba94b370d37276c43b921976bad9 | common.go | common.go | package batchgcd
import (
"fmt"
"github.com/ncw/gmp"
)
type Collision struct {
Modulus *gmp.Int
P *gmp.Int
Q *gmp.Int
}
func (x Collision) HavePrivate() bool {
return x.P != nil || x.Q != nil
}
func (x Collision) String() string {
if x.HavePrivate() {
if x.P.Cmp(x.Q) < 0 {
return fmt.Sprintf... | package batchgcd
import (
"fmt"
"github.com/ncw/gmp"
)
type Collision struct {
Modulus *gmp.Int
P *gmp.Int
Q *gmp.Int
}
func (x Collision) HavePrivate() bool {
return x.P != nil || x.Q != nil
}
func (x Collision) String() string {
if x.HavePrivate() {
if x.P.Cmp(x.Q) < 0 {
return fmt.Sprintf... | Add support for CSV output | Add support for CSV output
| Go | mit | therealmik/batchgcd |
c98c938578157fc4caafd8324d5c427bb262a57d | main.go | main.go | package main
import (
"fmt"
)
const (
MaxRedirects = 10
)
func main() {
redirects := ReadCsv("301s.csv")
log := make([]redirectResult, 0)
for _, info := range redirects {
result := CheckUrl(info)
log = append(log, result)
}
for _, logItem := range log {
if logItem.FinalUrl == logItem.ExpectedUrl {
... | package main
import (
"fmt"
"flag"
)
const (
MaxRedirects = 10
)
func main() {
flag.Parse()
filename := flag.Arg(0)
if filename == "" {
filename = "301s.csv"
}
redirects := ReadCsv(filename)
log := make([]redirectResult, 0)
for _, info := range redirects {
result := CheckUrl(info)
log = append(l... | Add argument parsing to customize input file | Add argument parsing to customize input file
| Go | cc0-1.0 | emeraldimp/go-redirect-checker |
407f47eb15f5d09462e3f6499ab446bbbafd2003 | main.go | main.go | package main
import (
"flag"
"fmt"
"log"
"os/exec"
)
func init() {
flag.Parse()
}
func main() {
command := flag.Args()
bin, args := command[0], command[1:]
cmd := exec.Command(bin, args...)
output, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Print(string(output))
}
| package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
"time"
"github.com/justincampbell/cacheout/cache"
)
func init() {
flag.Parse()
}
func main() {
command := flag.Args()
key := hashCommand(command)
ttlArg, bin, args := command[0], command[1], command[2:]
ttl, err := time.ParseDu... | Use cache/file in proof of concept | Use cache/file in proof of concept
| Go | mit | justincampbell/cacheout,justincampbell/cacheout |
bc5d1fb41fb0096e4731c17a4d0de828ec613f1c | modules/agent/g/const.go | modules/agent/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机制
// 5.1.3: Fix config syntax error when deploying
// 5.1.4: Only trustable ip could access the webpage
// 5.1.5: New policy and plugi... | 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
// 5.1.4: Only trustable ip could access the webpage
// 5.1.5: New policy and plugi... | Update agent version to 5.1.7 | [OWL-693][agent] Update agent version to 5.1.7 | Go | apache-2.0 | masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open... |
94ab09f8b1930b8b2d4b7b4bf925c978fcd7df0c | pkg/build/builder/util.go | pkg/build/builder/util.go | package builder
import (
"fmt"
"strings"
"github.com/openshift/origin/pkg/build/api"
)
type Builder interface {
Build() error
}
// imageTag returns the tag to be used for the build. If a registry has been
// specified, it will prepend the registry to the name
func imageTag(build *api.Build) string {
tag := bui... | package builder
import (
"fmt"
"strings"
"github.com/openshift/origin/pkg/build/api"
)
type Builder interface {
Build() error
}
// imageTag returns the tag to be used for the build. If a registry has been
// specified, it will prepend the registry to the name
func imageTag(build *api.Build) string {
tag := bui... | Add build namespace to built image environment | Add build namespace to built image environment
| Go | apache-2.0 | spohnan/origin,tdawson/origin,bowenha2/origin,quantiply-fork/origin,jpeeler/origin,smunilla/origin,rhcarvalho/origin,y0no/origin,willmtemple/origin,smarterclayton/origin,gesrat-cisco/origin,y0no/origin,pombredanne/atomic-enterprise,pkdevbox/origin,PI-Victor/origin,quantiply-fork/origin,sosiouxme/origin,joshuawilson/ori... |
9f95cbb14b1c7e55ac610e500718b570858c6932 | proto/certmon/messages.go | proto/certmon/messages.go | package certmon
const (
CertTypeSSH = 0
CertTypeX509 = 1
)
// Format of certificate notifications (server -> client):
// certType: 32 bit uint (big-endian)
// certLength: 64 bit uint (big-endian)
// certData: sequence of bytes
// Client sends no data.
| package certmon
const (
ConnectString = "200 Connected to keymaster certmon service"
HttpPath = "/certmon"
CertTypeSSH = 0
CertTypeX509 = 1
)
// Format of certificate notifications (server -> client):
// certType: 32 bit uint (big-endian)
// certLength: 64 bit uint (big-endian)
// certData: sequence of... | Add ConnectString and HttpPath constants to proto/certmon package. | Add ConnectString and HttpPath constants to proto/certmon package.
| Go | apache-2.0 | rgooch/keymaster,rgooch/keymaster,Symantec/keymaster,Symantec/keymaster,rgooch/keymaster,Symantec/keymaster |
b455cd6d5dc8306180113c3287e9419064dedf42 | 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"))
if... | Change perPage to per_page for /contacts query params | Change perPage to per_page for /contacts query params
| Go | mit | konjoot/benches,konjoot/benches,konjoot/benches |
26f10d607f5c3c16a6eb50fcee9543b34466e00c | examples/k8s_openms/k8s_openms.go | examples/k8s_openms/k8s_openms.go | package main
import sp "github.com/scipipe/scipipe"
const (
workDir = "/scipipe-data/"
)
func main() {
prun := sp.NewPipelineRunner()
peakPicker := sp.NewFromShell("PeakPicker", "PeakPickerHiRes -in {i:sample} -out {o:out} -ini {p:ini}")
peakPicker.PathFormatters["out"] = func(t *sp.SciTask) string {
// ... | package main
import (
str "strings"
sp "github.com/scipipe/scipipe"
)
const (
workDir = "/scipipe-data/"
)
func main() {
prun := sp.NewPipelineRunner()
peakPicker := sp.NewFromShell("PeakPicker", "PeakPickerHiRes -in {i:sample} -out {o:out} -ini {p:ini}")
peakPicker.PathFormatters["out"] = func(t *sp.SciTask... | Improve path formatting in k8s openms example | Improve path formatting in k8s openms example
| Go | mit | scipipe/scipipe,samuell/scipipe,scipipe/scipipe |
016fd1dee1d652fa6589db05cb2d9aac9e50249a | test/bugs/bug113.go | test/bugs/bug113.go | // $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed)
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type I interface { };
func foo1(i int) int { return i }
func foo2(i int... | // $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed)
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type I interface { };
func foo1(i int) int { return i }
func foo2(i int... | Call the right function for int32 values. | Call the right function for int32 values.
R=rsc
DELTA=2 (0 added, 0 deleted, 2 changed)
OCL=18073
CL=18073 | Go | bsd-3-clause | abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go,abustany/go |
7539d28982bff69b600715c598da6ac8970eafeb | black_hole.go | black_hole.go | package channels
// BlackHole implements the InChannel interface and provides an analogue for the "Discard" variable in
// the ioutil package - it never blocks, and simply discards every value it reads. The number of items
// discarded in this way is counted and returned from Len.
type BlackHole struct {
input chan... | package channels
// BlackHole implements the InChannel interface and provides an analogue for the "Discard" variable in
// the ioutil package - it never blocks, and simply discards every value it reads. The number of items
// discarded in this way is counted and returned from Len.
type BlackHole struct {
input chan ... | Fix data race in BlackHole | Fix data race in BlackHole
Also fix a minor style issue and get rid of useless `stopper` channel.
| Go | mit | eapache/channels |
38fc10238b06bfc065aaa3473503dab080dce7f4 | gondom.go | gondom.go | package gondom
import (
"math/rand"
)
const (
_rawURLLetters = "abcdefghijklmnopqrstuvwxyz0123456789"
_rawLetters = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
func Make(n int, seed int64) string {
b := make([]byte, n)
rand.Seed(seed)
for i := range b {
b[i] = _rawLetters[rand.Intn(... | package gondom
import (
"math/rand"
)
const (
_rawURLLetters = "abcdefghijklmnopqrstuvwxyz0123456789"
_rawLetters = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
func Make(n int, seed int64) string {
if n < 0 {
n = n * -1
}
b := make([]byte, n)
rand.Seed(seed)
for i := range b {
b... | Fix support for minus value | Fix support for minus value
| Go | mit | Qs-F/gondom |
af04001c6542577354b9b5465ee1c94087bf0f42 | gke-deploy/doc-gen/main.go | gke-deploy/doc-gen/main.go | / doc-gen generates gke-deploy's help docs.
package main
import (
"fmt"
"log"
"os"
"github.com/GoogleCloudPlatform/cloud-builders/gke-deploy/cmd"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
var dir string
var root = &cobra.Command{
Use: "gendoc",
Short: "Generate gke-deploy's help docs",
Args:... | // doc-gen generates gke-deploy's help docs.
package main
import (
"fmt"
"log"
"os"
"github.com/GoogleCloudPlatform/cloud-builders/gke-deploy/cmd"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
var dir string
var root = &cobra.Command{
Use: "gendoc",
Short: "Generate gke-deploy's help docs",
Args... | Fix package comment in doc-gen. | Fix package comment in doc-gen.
| Go | apache-2.0 | GoogleCloudPlatform/cloud-builders,google-octo/cloud-builders,GoogleCloudPlatform/cloud-builders,google-octo/cloud-builders,GoogleCloudPlatform/cloud-builders,google-octo/cloud-builders,GoogleCloudPlatform/cloud-builders,google-octo/cloud-builders,google-octo/cloud-builders,GoogleCloudPlatform/cloud-builders,GoogleClou... |
60538ba4e19667ac73dccbe1e61ccd071383890a | interfaces.go | interfaces.go | package main
import (
"fmt"
"github.com/kidoman/embd"
"bufio"
"os"
"strconv"
"strings"
)
var blinker Blinker
func main() {
var blinker Blinker
err := embd.InitGPIO()
if err != nil {
blinker = new (MockBlinker)
} else {
blinker = new (GPIOBlinker)
}
reader := bufio.NewReader(os.Stdin)
fmt.Print("Ente... | package main
import (
"fmt"
"github.com/kidoman/embd"
"bufio"
"os"
"strconv"
"strings"
"time"
)
var blinker Blinker
func output(c chan int) {
seconds := <-c
fmt.Printf("Outputting Hi for %d s\n", seconds)
time.Sleep(time.Duration(seconds) * time.Second)
fmt.Println("Finished outputting Hi")
}
func main(... | Send & read off a channel | Send & read off a channel
| Go | apache-2.0 | eweatherley/pi-io |
641819157ba9edfcb1ac7ad016d6a0c724ccc20a | pkg/core/mail/dialer.go | pkg/core/mail/dialer.go | package mail
import (
"github.com/go-gomail/gomail"
"github.com/skygeario/skygear-server/pkg/core/config"
)
func NewDialer(c config.SMTPConfiguration) *gomail.Dialer {
if c.Host == "" {
panic("mail server is not configured")
}
return gomail.NewPlainDialer(c.Host, c.Port, c.Login, c.Password)
}
| package mail
import (
"errors"
"github.com/go-gomail/gomail"
"github.com/skygeario/skygear-server/pkg/core/config"
)
func NewDialer(c config.SMTPConfiguration) *gomail.Dialer {
if c.Host == "" {
panic(errors.New("mail server is not configured"))
}
return gomail.NewPlainDialer(c.Host, c.Port, c.Login, c.Pass... | Fix wrong error thrown for new smtp dailer | Fix wrong error thrown for new smtp dailer
| Go | apache-2.0 | SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
d1df8fe8869c388b764b23e09aadb631e6806e5c | runtime/profile/profile.go | runtime/profile/profile.go | // Package profile is for specific profiles
package profile
// Local is a profile for local environments
func Local() []string {
return []string{}
}
// Kubernetes is a profile for kubernetes
func Kubernetes() []string {
return []string{}
}
// Platform is a platform profile
func Platform() []string {
return []stri... | // Package profile is for specific profiles
package profile
// Local is a profile for local environments
func Local() []string {
return []string{}
}
// Kubernetes is a profile for kubernetes
func Kubernetes() []string {
return []string{}
}
// Platform is a platform profile
func Platform() []string {
return []stri... | Add runtime service env var | Add runtime service env var
| Go | apache-2.0 | micro/micro,micro/micro,myodc/micro,micro/micro |
eb4c0f0437eb7d8ffd678f9ce0bde2f8e2651e1f | testing/mgo.go | testing/mgo.go | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testing
import (
"testing"
gitjujutesting "github.com/juju/testing"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
"github.com/juju/juju/mongo"
)
// MgoTestPackage should... | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testing
import (
"testing"
gitjujutesting "github.com/juju/testing"
)
// MgoTestPackage should be called to register the tests for any package
// that requires a secure connection to a MongoDB server.
func M... | Drop the NewServerReplSet testing helper. | Drop the NewServerReplSet testing helper.
| Go | agpl-3.0 | gabriel-samfira/juju,fwereade/juju,mhilton/juju,howbazaar/juju,bz2/juju,tsakas/juju,tych0/juju,Altoros/juju-vmware,AdamIsrael/juju,fwereade/juju,bz2/juju,tych0/juju,bac/juju,tsakas/juju,tasdomas/juju,mikemccracken/juju,davecheney/juju,fwereade/juju,voidspace/juju,perrito666/juju,cherylj/juju,anastasiamac/juju,sinzui/ju... |
5d3ab435a130d6bc73b25dec4a317877fdd0066e | lib/string.go | lib/string.go | // Copyright 2011 Julian Phillips. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package py
// #include "utils.h"
// static inline int stringCheck(PyObject *o) { return PyString_Check(o); }
import "C"
import (
"os"
"unsafe"
)
type Str... | // Copyright 2011 Julian Phillips. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package py
// #include "utils.h"
// static inline int stringCheck(PyObject *o) { return PyString_Check(o); }
import "C"
import (
"os"
"unsafe"
)
type Str... | Add Format method to String | Add Format method to String
This is the Go version of PyString_Format, which is the C API version
of "format % args".
| Go | bsd-3-clause | qur/gopy,limetext/gopy,ericsnowcurrently/qur-gopy,ericsnowcurrently/qur-gopy,qur/gopy,qur/gopy,limetext/gopy,limetext/gopy,ericsnowcurrently/qur-gopy |
9254c094cf9006525245522e9cd209aafb9e10ae | otp/twofactor/twofactor.go | otp/twofactor/twofactor.go | package twofactor
import "github.com/volatiletech/authboss"
// Page constants
const (
PageRecovery2FA = "recovery2fa"
PageVerify2FA = "twofactor_verify"
PageVerifyEnd2FA = "twofactor_verify_end"
)
// Email constants
const (
EmailVerifyHTML = "twofactor_verify_email_html"
EmailVerifyTxt = "twofactor_verify_... | package twofactor
import "github.com/volatiletech/authboss"
// Page constants
const (
PageRecovery2FA = "recovery2fa"
PageVerify2FA = "twofactor_verify"
PageVerifyEnd2FA = "twofactor_verify_end"
)
// Email constants
const (
EmailVerifyHTML = "twofactor_verify_email_html"
EmailVerifyTxt = "twofactor_verify_... | Remove L from two factor recovery codes | Remove L from two factor recovery codes
- This is a difficult letter to tell apart from the number 1 depending
on the font. 0 and o should be okay since all letters are lowercase.
| Go | mit | go-authboss/authboss |
2209dde1fff59821af5baf4772a39c0b81e418f0 | pkg/auth/dependency/forgotpwdemail/code.go | pkg/auth/dependency/forgotpwdemail/code.go | package forgotpwdemail
import (
"crypto/sha1"
"fmt"
"io"
"time"
"github.com/skygeario/skygear-server/pkg/auth/dependency/userprofile"
"github.com/skygeario/skygear-server/pkg/core/auth/authinfo"
)
type CodeGenerator struct {
MasterKey string
}
func (c *CodeGenerator) Generate(
authInfo authinfo.AuthInfo,
... | package forgotpwdemail
import (
"crypto/sha256"
"fmt"
"io"
"time"
"github.com/skygeario/skygear-server/pkg/auth/dependency/userprofile"
"github.com/skygeario/skygear-server/pkg/core/auth/authinfo"
)
type CodeGenerator struct {
MasterKey string
}
func (c *CodeGenerator) Generate(
authInfo authinfo.AuthInfo,... | Use sha256 instead of sha1 to fix lint | Use sha256 instead of sha1 to fix lint
| Go | apache-2.0 | SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
c23d50badfcb9d30453499b6879d9d614112c948 | server/auth/middleware.go | server/auth/middleware.go | // Copyright 2017 The LUCI 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 2017 The LUCI 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... | Allow Authenticate package function to take multiple Methods. | [auth] Allow Authenticate package function to take multiple Methods.
R=ef4933a197ef7b4b3f55f1bec4942aead3637a2a@chromium.org, vadimsh@chromium.org
Bug: 782460
Change-Id: I288d88d184cd7411d5df084407a11864e1d2a18a
Reviewed-on: https://chromium-review.googlesource.com/803672
Reviewed-by: Nodir Turakulov <ef4933a197ef7b4... | Go | apache-2.0 | luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go |
1fc5a14564acf1c6d271a726860630b936da54fd | observers/wall_observer.go | observers/wall_observer.go | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/wall"
"github.com/ivan1993spb/snake-server/world"
)
const wallPerNDots = 100
type WallObserver struct{}
func (WallObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) {
go func() {... | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/wall"
"github.com/ivan1993spb/snake-server/world"
)
type WallObserver struct{}
func (WallObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) {
go func() {
if _, err := wall.NewWa... | Fix WallObserver to use wall.NewWallRuins wall generator | Fix WallObserver to use wall.NewWallRuins wall generator
| Go | bsd-2-clause | ivan1993spb/clever-snake |
e3482c68fd96a84dfc84d40484db72e61c108941 | pkg/app/acceptance_test.go | pkg/app/acceptance_test.go | // +build acceptance
package app_test
import (
"net"
"github.com/DATA-DOG/godog"
"github.com/deshboard/boilerplate-grpc-service/test"
"google.golang.org/grpc"
)
func init() {
test.RegisterFeaturePath("../features")
test.RegisterFeatureContext(FeatureContext)
}
func FeatureContext(s *godog.Suite) {
lis, err ... | // +build acceptance
package app_test
import (
"net"
"github.com/DATA-DOG/godog"
"github.com/deshboard/boilerplate-grpc-service/test"
"google.golang.org/grpc"
)
func init() {
test.RegisterFeaturePath("../features")
test.RegisterFeatureContext(FeatureContext)
}
func FeatureContext(s *godog.Suite) {
lis, err ... | Use the loopback interface for acceptance tests | Use the loopback interface for acceptance tests
| Go | mit | deshboard/boilerplate-grpc-service,deshboard/boilerplate-model-service |
255e9008cc7076652821a44191c11cb2b63175ab | device/config/constants.go | device/config/constants.go | package config
// Default Configurator constants that are describe a specific configuration option
const (
Locale = "Locale"
Keymap = "Keymap"
Wifi = "Wifi"
Interface = "Interface"
DNS = "DNS"
SSH = "SSH"
Camera = "Camera"
MountDir = "/tmp/isaax-sd/"
Language = "LANGUAGE=%s\n"
L... | package config
// Default Configurator constants that are describe a specific configuration option
const (
Locale = "Locale"
Keymap = "Keymap"
Wifi = "Wifi"
Interface = "Interface"
DNS = "DNS"
SSH = "SSH"
Camera = "Camera"
MountDir = "/tmp/isaax-sd/"
Language = "LANGUAGE=%s\n"
L... | Add default country to wpa supplicant | Add default country to wpa supplicant
| Go | apache-2.0 | xshellinc/iotit,xshellinc/iotit,xshellinc/iotit |
41fb97bd457998a26e5e64a379c4b5d0d1c90f32 | repo/blob/s3/s3_options.go | repo/blob/s3/s3_options.go | package s3
// Options defines options for S3-based storage.
type Options struct {
// BucketName is the name of the bucket where data is stored.
BucketName string `json:"bucket"`
// Prefix specifies additional string to prepend to all objects.
Prefix string `json:"prefix,omitempty"`
Endpoint string `json:"end... | package s3
// Options defines options for S3-based storage.
type Options struct {
// BucketName is the name of the bucket where data is stored.
BucketName string `json:"bucket"`
// Prefix specifies additional string to prepend to all objects.
Prefix string `json:"prefix,omitempty"`
Endpoint string `json:"end... | Fix mispelled tag, caught by staticheck linter | Fix mispelled tag, caught by staticheck linter
| Go | apache-2.0 | kopia/kopia,kopia/kopia,kopia/kopia,kopia/kopia |
08f0879c33469ebcbe2830b5c88ac1cfca610e95 | test/bugs/bug125.go | test/bugs/bug125.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.
package main
import (
OS "os" // should require semicolon here; this is no different from other decls
IO "io"
)
func main() {
}
| // 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.
package main
import (
OS "os" // should require semicolon here; this is no different from other decls
IO "io" // ERROR "missing"
)
... | Add ERROR comment for errmsg to look for. | Add ERROR comment for errmsg to look for.
R=gri
DELTA=1 (0 added, 0 deleted, 1 changed)
OCL=19460
CL=19500
| Go | bsd-3-clause | firebitsbr/golang-old,dsriram/golang,gnanderson/go,bdwalton/debian-golang,h8liu/golang,wesolows/golang-old,pombredanne/go-deleteme,bdwalton/debian-golang,nightlyone/golang,h8liu/golang,wesolows/golang-old,apparentlymart/golang,pombredanne/go-deleteme,dsriram/golang,wesolows/golang,h8liu/golang,gnanderson/go,tianon/debi... |
7c5fccd7a80a7eb164d08afb8c5e95e5be787e32 | utils/utils.go | utils/utils.go | package utils
import (
"bytes"
"os/exec"
)
func ExecCmd(name string, args ...string) (string, error) {
cmd := exec.Command(name, args...)
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
return "", err
}
return out.String(), nil
}
| package utils
import (
"bytes"
"os/exec"
"syscall"
)
const PR_SET_CHILD_SUBREAPER = 36
func ExecCmd(name string, args ...string) (string, error) {
cmd := exec.Command(name, args...)
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
return "", err
}
return out.String(), nil
}
// S... | Add utility functions to set process as subreaper. | Add utility functions to set process as subreaper.
This code is borrowed from libcontainer system package.
Signed-off-by: Mrunal Patel <d389837b018b67489df74a2c5f0aca13aaed44b6@gmail.com>
| Go | apache-2.0 | mikebrow/cri-o,jwhonce/ocid,kubernetes-incubator/cri-o,resouer/cri-o,apilloud/cri-o,jwhonce/ocid,nalind/cri-o,vbatts/cri-o,mikebrow/cri-o,sameo/cri-o,14rcole/cri-o,rhatdan/cri-o,rhatdan/cri-o,kubernetes-incubator/ocid,mikebrow/cri-o,nalind/cri-o,aweiteka/cri-o,resouer/cri-o,rhatdan/cri-o,mheon/cri-o,14rcole/cri-o,mikeb... |
ac01e7a01439743308458be07da8ee0014f9816f | staticcheck/cmd/staticcheck/staticcheck.go | staticcheck/cmd/staticcheck/staticcheck.go | // staticcheck statically checks arguments to certain functions
package main // import "honnef.co/go/staticcheck/cmd/staticcheck"
import (
"os"
"honnef.co/go/lint/lintutil"
"honnef.co/go/staticcheck"
)
func main() {
var args []string
for _, arg := range os.Args[1:] {
if arg == "-dubious" {
continue
}
a... | // staticcheck statically checks your code for bugs.
package main // import "honnef.co/go/staticcheck/cmd/staticcheck"
import (
"os"
"honnef.co/go/lint/lintutil"
"honnef.co/go/staticcheck"
)
func main() {
var args []string
for _, arg := range os.Args[1:] {
if arg == "-dubious" {
continue
}
args = appen... | Update package docs of the command | Update package docs of the command
| Go | mit | dominikh/go-tools,dominikh/go-tools,dominikh/go-tools,dominikh/go-tools |
7fe479c6ebf6fcbeead03911b06fc78eb02e37c2 | src/github.com/stellar/horizon/init_txsub.go | src/github.com/stellar/horizon/init_txsub.go | package horizon
import (
"github.com/stellar/horizon/db"
"github.com/stellar/horizon/txsub"
"net/http"
)
func initSubmissionSystem(app *App) {
app.submitter = &txsub.System{
Pending: txsub.NewDefaultSubmissionList(),
Submitter: txsub.NewDefaultSubmitter(http.DefaultClient, app.config.StellarCoreUrl),
Resu... | package horizon
import (
"github.com/stellar/horizon/db"
"github.com/stellar/horizon/txsub"
"net/http"
"time"
)
func initSubmissionSystem(app *App) {
app.submitter = &txsub.System{
Pending: txsub.NewDefaultSubmissionList(),
Submitter: txsub.NewDefaultSubmitter(http.DefaultClient, app.config.StellarCoreUrl)... | Add janky Ticker for txsub system | Add janky Ticker for txsub system
| Go | apache-2.0 | masonforest/go-horizon,masonforest/go-horizon,stellar/horizon,nullstyle/go-horizon,nullstyle/go-horizon,stellar/horizon,irisli/horizon,masonforest/horizon,irisli/horizon,masonforest/horizon,irisli/horizon,masonforest/horizon,masonforest/go-horizon,nullstyle/go-horizon,stellar/horizon |
06429c29feb01a3eb5e104c8073e8664aff2f5ff | cmd/help_test.go | cmd/help_test.go | package cmd
import (
"github.com/gsamokovarov/jump/cli"
)
func Example_helpCmd() {
_ = helpCmd(cli.Args{}, nil)
// Output:
// Usage: jump [COMMAND ...]
//
// Jump to a fuzzy-matched directory passed as an argument.
//
// Commands:
// cd Fuzzy match a directory to jump to.
// chdir Upda... | package cmd
import (
"github.com/gsamokovarov/jump/cli"
)
func Example_helpCmd() {
_ = helpCmd(cli.Args{}, nil)
// Output:
// Usage: jump [COMMAND ...]
//
// Jump to a fuzzy-matched directory passed as an argument.
//
// Commands:
// cd Fuzzy match a directory to jump to.
// chdir Upda... | Fix the settings dot tests | Fix the settings dot tests
| Go | mit | gsamokovarov/jump |
bf8ba7b1bb3b5d3a88e9c85ac9ad0cca663b5c9d | builtin/credential/github/cli.go | builtin/credential/github/cli.go | package github
import (
"fmt"
"strings"
"github.com/hashicorp/vault/api"
)
type CLIHandler struct{}
func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (string, error) {
mount, ok := m["mount"]
if !ok {
mount = "github"
}
token, ok := m["token"]
if !ok {
return "", fmt.Errorf("'token' var mus... | package github
import (
"fmt"
"strings"
"github.com/hashicorp/vault/api"
)
type CLIHandler struct{}
func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (string, error) {
mount, ok := m["mount"]
if !ok {
mount = "github"
}
token, ok := m["token"]
if !ok {
return "", fmt.Errorf("'token' var mus... | Fix output from GitHub help | Fix output from GitHub help
| Go | mpl-2.0 | mtougeron/vault,broadinstitute/vault,hashicorp/vault,joelthompson/vault,andreaturli/vault,dennisme/vault,justincampbell/vault,geckoboard/vault,pakfur/vault,krmcbride/vault,broadinstitute/vault,hobbeswalsh/vault,sofuture/vault,martin-ducar-gd/vault,joelthompson/vault,philips/vault,justincampbell/vault,broadinstitute/vau... |
7506d4f075fd7327161018e385ad20321d76a653 | subvert_test.go | subvert_test.go | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`(abc)`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
{"a\\,b", regexp.MustCompile(`(a,b)`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTe... | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`(abc)`)},
{"abcdef", regexp.MustCompile(`(abcdef)`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
{"a,bc,def", regexp.MustCompile(`(a|bc|def)`)},
{"a\\,b", regexp.Mu... | Add valid cases for later | Add valid cases for later
| Go | mit | kusabashira/msub |
2e5f4680915e9980173f0069ba4a09841597a484 | test/escape1.go | test/escape1.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.
package main
func out_escapes() (x int, p *int) {
p = &x; // ERROR "address.*out parameter"
return;
}
func out_escapes() (x int, p *i... | // 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.
package main
func out_escapes() (x int, p *int) {
p = &x; // ERROR "address of out parameter"
return;
}
func out_escapes_2() (x int, ... | Rename function to avoid function redefinition error. Remove .* from regexp since it confuses DejaGNU which runs gcc's testsuite. | Rename function to avoid function redefinition error. Remove
.* from regexp since it confuses DejaGNU which runs gcc's
testsuite.
R=rsc
DELTA=3 (0 added, 0 deleted, 3 changed)
OCL=24435
CL=24438
| Go | bsd-3-clause | npe9/noahevans-go9,webfd/go-zh,rflanagan/reginaldflanagan-project1,glycerine/jeaten-go-arrayof-structof,rdp/rogerpack2005-golang,rdp/rogerpack2005-golang,mhennings/marcohennings-go,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,rdp/rogerpack2005-golang,d0f/go-zh,sanjosh/sanjos100-tipc,npe9/noahevans-go9,rdp/... |
da266c2f4961a1815f142d1a8be7ed17dd9a5589 | validations/validations.go | validations/validations.go | package validations
import (
"fmt"
"github.com/jinzhu/gorm"
)
var settingKey = "validations:errors"
func AddError(db *gorm.DB, resource interface{}, err string) {
var errors = GetErrors(db)
var scope = db.NewScope(resource)
key := fmt.Sprintf("%v_%v", scope.GetModelStruct().ModelType.Name(), scope.PrimaryKeyV... | package validations
import (
"errors"
"fmt"
"github.com/jinzhu/gorm"
)
var settingKey = "validations:errors"
func AddError(db *gorm.DB, resource interface{}, err string) {
var validationErrors = GetErrors(db)
var scope = db.NewScope(resource)
key := fmt.Sprintf("%v_%v", scope.GetModelStruct().ModelType.Name(... | Set DB's Error if get any validation error | Set DB's Error if get any validation error
| Go | mit | amirrpp/qor,amirrpp/qor,qor/qor,trigrass2/qor,lance2088/qor,insionng/qor,codedogfish/qor,yanzay/qor,codedogfish/qor,yanzay/qor,qor/qor,trigrass2/qor,insionng/qor,strogo/qor,strogo/qor,lance2088/qor,qor/qor |
7c08e181d685404ca5eef510cf688a53a7da3c96 | ast/ast_test.go | ast/ast_test.go | package ast_test
import (
"strings"
"testing"
"github.com/DeedleFake/wdte/ast"
)
func printTree(t *testing.T, cur ast.Node, depth int) {
indent := strings.Repeat(" ", depth)
switch cur := cur.(type) {
case *ast.Term:
t.Logf("%v%v", indent, cur)
case *ast.NTerm:
t.Logf("%v(%v", indent, cur)
for _, c :=... | package ast_test
import (
"strings"
"testing"
"github.com/DeedleFake/wdte/ast"
)
func printTree(t *testing.T, cur ast.Node, depth int) {
indent := strings.Repeat(" ", depth)
switch cur := cur.(type) {
case *ast.Term:
t.Logf("%v%v", indent, cur)
case *ast.NTerm:
t.Logf("%v(%v", indent, cur)
for _, c :=... | Fix syntax error in test. | ast: Fix syntax error in test.
| Go | mit | DeedleFake/wdte,DeedleFake/wdte |
d36e70b6192613b9e5aadce71ab45f44e3e3186e | cmd/crazyradio-enum/main.go | cmd/crazyradio-enum/main.go | // Enumerates USB devices, finds and identifies CrazyRadio USB dongle.
package main
import (
"fmt"
"os"
"time"
"github.com/krasin/crazyradio"
"github.com/krasin/crazyradio/usb"
)
func fail(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...)
os.Exit(1)
}
func main() {
st, err := cra... | // Enumerates USB devices, finds and identifies CrazyRadio USB dongle.
package main
import (
"fmt"
"os"
"time"
"github.com/krasin/crazyradio"
"github.com/krasin/crazyradio/usb"
)
func fail(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...)
os.Exit(1)
}
func main() {
st, err := cra... | Fix a typo: error message showed the whole list of flies, instead of the one to which we tried to connect | Fix a typo: error message showed the whole list of flies, instead of the one to which we tried to connect
| Go | mit | samofly/cflie |
4287fcb45b297a2e2b5ec9df92d955aae9243d8a | util/normalizename_test.go | util/normalizename_test.go | package util
import (
"testing"
)
func TestNormalizeName(t *testing.T) {
packages := map[string]string{
"github.com/Masterminds/cookoo/web/io/foo": "github.com/Masterminds/cookoo",
"golang.org/x/crypto/ssh": "golang.org/x/crypto",
"incomplete/example": "incomplete/exampl... | package util
import (
"testing"
)
func TestNormalizeName(t *testing.T) {
packages := map[string]string{
"github.com/Masterminds/cookoo/web/io/foo": "github.com/Masterminds/cookoo",
`github.com\Masterminds\cookoo\web\io\foo`: "github.com/Masterminds/cookoo",
"golang.org/x/crypto/ssh": "golang.... | Add testcase that fails old code. | Add testcase that fails old code.
| Go | mit | cmars/tools,franciscocpg/glide,avvmoto/glide,franciscocpg/glide,avvmoto/glide,cmars/tools,cmars/tools,cmars/tools |
388a98c52af761a7e8884d8a1b005f76e31888d1 | randstring.go | randstring.go | package randstring
import (
"crypto/rand"
"encoding/hex"
"io"
"math/big"
)
/*
Use mixed-case alphanumeric characters, minus vowels so we don't
get naughty words. This leaves us with 10+21+21=52 possibilities
per character, or 5.7 bits (-log(1/52, 2)) of information.
Thus a random string of length 15 ... | package randstring
import (
"crypto/rand"
"encoding/hex"
"io"
"math/big"
)
/*
Use mixed-case alphanumeric characters, minus vowels so we don't
get naughty words. This leaves us with 10+21+21=52 possibilities
per character, or 5.7 bits (-log(1/52, 2)) of information.
Thus a random string of length 15 ... | Add a function for generating random numeric strings | Add a function for generating random numeric strings
| Go | mit | litl/randstring |
522822e2773f1e589f36db0bfaa9edc098b5ff30 | go/pig-latin/pig_latin.go | go/pig-latin/pig_latin.go | package piglatin
import "strings"
func Sentence(sentence string) string {
if startsWithVowel(sentence) ||
strings.HasPrefix(sentence, "xr") ||
strings.HasPrefix(sentence, "yt") {
return sentence + "ay"
}
if strings.HasPrefix(sentence, "p") {
return strings.TrimPrefix(sentence, "p") + "p" + "ay"
}
return... | package piglatin
import (
"fmt"
"strings"
)
var consonants = []string{"p", "k"}
func Sentence(sentence string) string {
if startsWithVowel(sentence) ||
strings.HasPrefix(sentence, "xr") ||
strings.HasPrefix(sentence, "yt") {
return sentence + "ay"
}
if startsWithConsonant(sentence) {
return handleConson... | Implement rule 2 for multiple consonants | Implement rule 2 for multiple consonants
| Go | mit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism |
8cc628cade1d2d4a845b43902aceed695c916789 | certstream.go | certstream.go | package certstream
import (
"time"
"github.com/gorilla/websocket"
"github.com/jmoiron/jsonq"
"github.com/pkg/errors"
)
func CertStreamEventStream(skipHeartbeats bool) (chan jsonq.JsonQuery, chan error) {
outputStream := make(chan jsonq.JsonQuery)
errStream := make(chan error)
go func() {
for {
c, _, err ... | package certstream
import (
"time"
"github.com/gorilla/websocket"
"github.com/jmoiron/jsonq"
"github.com/pkg/errors"
)
func CertStreamEventStream(skipHeartbeats bool) (chan jsonq.JsonQuery, chan error) {
outputStream := make(chan jsonq.JsonQuery)
errStream := make(chan error)
go func() {
for {
c, _, err... | Break on error in ReadJSON instead of continuing and panicing on NewQuery later on. Fixes panic on connection loss. | Break on error in ReadJSON instead of continuing and panicing on
NewQuery later on. Fixes panic on connection loss.
| Go | mit | CaliDog/certstream-go |
2bdd8f4c939241fa5224295de3eb61b5c366b8d8 | bitbucket/user_verifier.go | bitbucket/user_verifier.go | package bitbucket
import (
"code.cloudfoundry.org/lager"
api "github.com/SHyx0rmZ/go-bitbucket/bitbucket"
"github.com/concourse/atc/auth/verifier"
"net/http"
)
type UserVerifier struct {
users []string
client api.Client
}
func NewUserVerifier(client api.Client, users []string) verifier.Verifier {
return User... | package bitbucket
import (
"code.cloudfoundry.org/lager"
api "github.com/SHyx0rmZ/go-bitbucket/bitbucket"
"github.com/concourse/atc/auth/verifier"
"net/http"
)
type UserVerifier struct {
users []string
client api.Client
}
func NewUserVerifier(client api.Client, users []string) verifier.Verifier {
return User... | Set HTTP client in UserVerifier | Set HTTP client in UserVerifier
| Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
5a337e576eb0418a7607e858943436a39f5bdd3d | cruncher/cruncher.go | cruncher/cruncher.go | package cruncher
import (
"github.com/davecgh/go-spew/spew"
"pilosa/core"
"pilosa/dispatch"
"pilosa/index"
"pilosa/transport"
)
type Cruncher struct {
core.Service
close_chan chan bool
api *index.FragmentContainer
}
func (cruncher *Cruncher) Run(port int) {
spew.Dump("Cruncher.Run")
spew.Dump(port)
... | package cruncher
import (
"github.com/davecgh/go-spew/spew"
"pilosa/core"
"pilosa/dispatch"
"pilosa/index"
"pilosa/transport"
)
type Cruncher struct {
*core.Service
close_chan chan bool
api *index.FragmentContainer
}
func (cruncher *Cruncher) Run(port int) {
spew.Dump("Cruncher.Run")
spew.Dump(port)... | Use pointer to not copy service. | Use pointer to not copy service.
| Go | apache-2.0 | alanbernstein/pilosa,travisturner/pilosa,raskle/pilosa,alanbernstein/pilosa,linhvo/pilosa,alanbernstein/pilosa,linhvo/pilosa,linhvo/pilosa,raskle/pilosa,raskle/pilosa |
1f222b9156cb2abd7689f7fabdc53bc54bef369c | test/diff.go | test/diff.go | package test
import (
"github.com/davecgh/go-spew/spew"
"github.com/pmezard/go-difflib/difflib"
)
func init() {
spew.Config.SortKeys = true // :\
}
// Diff diffs two arbitrary data structures, giving human-readable output.
func Diff(want, have interface{}) string {
text, _ := difflib.GetUnifiedDiffString(difflib... | package test
import (
"github.com/davecgh/go-spew/spew"
"github.com/pmezard/go-difflib/difflib"
)
// Diff diffs two arbitrary data structures, giving human-readable output.
func Diff(want, have interface{}) string {
config := spew.NewDefaultConfig()
config.ContinueOnMethod = true
config.SortKeys = true
config.S... | Make dumper a bit more verbose | Make dumper a bit more verbose
So it displays differences behind interface that would otherwise go
unnoticed (like string vs []byte).
| Go | apache-2.0 | paulbellamy/scope,paulbellamy/scope,kinvolk/scope,paulbellamy/scope,kinvolk/scope,weaveworks/scope,kinvolk/scope,paulbellamy/scope,paulbellamy/scope,alban/scope,alban/scope,weaveworks/scope,alban/scope,weaveworks/scope,weaveworks/scope,alban/scope,kinvolk/scope,weaveworks/scope,kinvolk/scope,alban/scope,kinvolk/scope,a... |
71385b101611a2eb9d6c0bedcb01859b7ade66a0 | util/util.go | util/util.go | package util
import (
"errors"
"fmt"
"os"
log "github.com/Sirupsen/logrus"
"github.com/docker/engine-api/types"
)
const labelPrefix string = "io.conplicity"
// CheckErr checks for error, logs and optionally exits the program
func CheckErr(err error, msg string, exit int) {
if err != nil {
log.Errorf(msg, er... | package util
import (
"errors"
"fmt"
"os"
log "github.com/Sirupsen/logrus"
"github.com/docker/engine-api/types"
)
const labelPrefix string = "io.conplicity"
// CheckErr checks for error, logs and optionally exits the program
func CheckErr(err error, msg string, exit int) {
if err != nil {
if exit != -1 {
... | Use log.Fatal for fatal errors | Use log.Fatal for fatal errors
| Go | apache-2.0 | camptocamp/conplicity,camptocamp/conplicity |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.