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 |
|---|---|---|---|---|---|---|---|---|---|
eb2949560e4a06dfeb89e80f724e9755baf2c664 | problem_2/solution_test.go | problem_2/solution_test.go | package problem_2_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestProblem_2(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Problem 2")
}
var _ = Describe("fibGenerator", func() {
It("gives the first few Fibonacci numbers", func() {
c := fibGenerator()
... | package problem_2
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestProblem_2(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Problem 2")
}
var _ = Describe("fibGenerator", func() {
It("gives the first few Fibonacci numbers", func() {
c := fibGenerator()
... | Fix pachage in problem 2 | Fix pachage in problem 2
| Go | unlicense | jmtuley/euler-golang |
508d33112a48174bc383ce2b2157c1895aa6a3de | drivers/bloompw/bloom.go | drivers/bloompw/bloom.go | // Copyright 2015, Mike Houston, see LICENSE for details.
package bloompw
import (
"github.com/AndreasBriese/bbloom"
)
type BloomPW struct {
Filter *bbloom.Bloom
}
// New will return a new Database interface that stores entries in
// a bloom filter
func New(filter *bbloom.Bloom) (*BloomPW, error) {
b := &BloomPW{... | // Copyright 2015, Mike Houston, see LICENSE for details.
// A bitset Bloom filter for a reduced memory password representation.
//
// See https://github.com/AndreasBriese/bbloom
package bloompw
import (
"github.com/AndreasBriese/bbloom"
)
type BloomPW struct {
Filter *bbloom.Bloom
}
// New will return a new Data... | Add a little bit of documentation. | Add a little bit of documentation.
| Go | mit | klauspost/password |
04b4d8b9ce557e8b1d868c53f29e663c54cc502d | subvert_test.go | subvert_test.go | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`abc`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTests {
expect := test.dst
actual, err := newMatcher(test.src)
if err != nil {
... | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`abc`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTests {
expect := test.dst
actual, err := ... | Add case of branch for newMatcher | Add case of branch for newMatcher
| Go | mit | kusabashira/msub |
2f669f21bb304485d6aef37cfe52528781689eea | types.go | types.go | package main
import (
"github.com/drone/drone-go/drone"
)
type Params struct {
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Region string `json:"region"`
Family string `json:"family"`
Image string `json:... | package main
import (
"github.com/drone/drone-go/drone"
)
type Params struct {
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Region string `json:"region"`
Family string `json:"family"`
Image string `json:... | Add Cluster to Params struct. | Add Cluster to Params struct.
| Go | apache-2.0 | andyet/drone-ecs,drone-plugins/drone-ecs |
25409d89b8e34f8bf50777e2698449669972afdc | test/Publish/testing_test.go | test/Publish/testing_test.go | package Publish
import (
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestShare(t *testing.T) {
scheduler := NewGoroutine()
ch := make(chan int, 30)
s := FromChanInt(ch).Publish().RefCount().SubscribeOn(scheduler)
a := []int{}
b := []int{}
asub := s.SubscribeNext(func(n int) { a =... | package Publish
import (
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestPublishRefCount(t *testing.T) {
scheduler := NewGoroutine()
ch := make(chan int, 30)
s := FromChanInt(ch).Publish().RefCount().SubscribeOn(scheduler)
a := []int{}
b := []int{}
asub := s.SubscribeNext(func(n ... | Rename test for Publish operator. | Rename test for Publish operator. | Go | mit | ReactiveGo/rx |
ebfa97d9f40f13b58d0754beb59769e145029bf6 | dense/non_zeros.go | dense/non_zeros.go | package dense
type nonZerosCursor struct {
matrix *denseMatrix
element float64
row int
column int
index int
}
func newNonZerosCursor(matrix *denseMatrix) *nonZerosCursor {
c := &nonZerosCursor{
matrix: matrix,
element: 0,
row: 0,
column: 0,
index: 0,
}
return c
}
func (c *nonZerosC... | package dense
import (
"github.com/mitsuse/matrix-go/internal/types"
)
type nonZerosCursor struct {
cursor types.Cursor
}
func newNonZerosCursor(matrix *denseMatrix) *nonZerosCursor {
c := &nonZerosCursor{
cursor: matrix.All(),
}
return c
}
func (c *nonZerosCursor) HasNext() bool {
for c.cursor.HasNext() {... | Support base and view in "NonZeros" cursor. | Support base and view in "NonZeros" cursor.
| Go | mit | mitsuse/matrix-go |
117a182a0ffc1960e0bfe3dc0e53d3eede41bb28 | termite/fileattr_test.go | termite/fileattr_test.go | package termite
import (
"io/ioutil"
"os"
"syscall"
"testing"
)
func TestFileAttrReadFrom(t *testing.T) {
dir, _ := ioutil.TempDir("", "termite")
ioutil.WriteFile(dir+"/file.txt", []byte{42}, 0644)
attr := FileAttr{FileInfo: &os.FileInfo{Mode: syscall.S_IFDIR}}
attr.ReadFromFs(dir)
if attr.NameModeMap == ni... | package termite
import (
"io/ioutil"
"os"
"syscall"
"testing"
)
func TestFileAttrReadFrom(t *testing.T) {
dir, _ := ioutil.TempDir("", "termite")
ioutil.WriteFile(dir+"/file.txt", []byte{42}, 0644)
attr := FileAttr{FileInfo: &os.FileInfo{Mode: syscall.S_IFDIR}}
attr.ReadFromFs(dir)
if attr.NameModeMap == ni... | Fix thinko in file mode test. | Fix thinko in file mode test.
| Go | bsd-3-clause | hanwen/termite,hanwen/termite,hanwen/termite |
e4954078963192ccefb402d23011c7ce0225e0b6 | process/process.go | process/process.go | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package process
// ComponentName is the name of the Juju component for workload
// process management.
const ComponentName = "process"
| // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// The process package (and subpackages) contain the implementation of
// the charm workload process feature component. The various pieces are
// connected to the Juju machinery in component/all/process.go.
package process
//... | Add a package doc comment. | Add a package doc comment.
| Go | agpl-3.0 | waigani/juju,macgreagoir/juju,marcmolla/juju,marcmolla/juju,kat-co/juju,bogdanteleaga/juju,kat-co/juju,davecheney/juju,howbazaar/juju,fwereade/juju,macgreagoir/juju,gabriel-samfira/juju,dimitern/juju,mjs/juju,mjs/juju,dooferlad/juju,anastasiamac/juju,dooferlad/juju,howbazaar/juju,alesstimec/juju,makyo/juju,bac/juju,mjs... |
46d39d88da32aa012935792ae97b0923730e390e | config.go | config.go | package raft
import (
"time"
)
// Config provides any necessary configuraiton to
// the Raft server
type Config struct {
// Time in follower state without a leader before we attempt an election
HeartbeatTimeout time.Duration
// Time in candidate state without a leader before we attempt an election
ElectionTimeo... | package raft
import (
"time"
)
// Config provides any necessary configuraiton to
// the Raft server
type Config struct {
// Time in follower state without a leader before we attempt an election
HeartbeatTimeout time.Duration
// Time in candidate state without a leader before we attempt an election
ElectionTimeo... | Increase max append to 32 | Increase max append to 32
| Go | mpl-2.0 | dgnorton/raft,quantiply-fork/raft,hashicorp/raft,sean-/raft,hashicorp/raft,otoolep/raft,tempbottle/raft-2,wantonsolutions/raft,PattyW/raft_govec,jmptrader/raft-1 |
833a93918a9e19ccdd50e4a12bc7ebfc80d8c27b | plugin.go | plugin.go | package main
import (
"bytes"
"log"
"os/exec"
"github.com/shizeeg/xmpp"
)
// RunPlugin is a generic interface for external commands.
func (s *Session) RunPlugin(stanza xmpp.Stanza, filename string, tonick bool, params ...string) {
message, ok := stanza.Value.(*xmpp.ClientMessage)
if !ok {
log.Println("Wrong ... | package main
import (
"bytes"
"log"
"os/exec"
"strings"
"github.com/shizeeg/xmpp"
)
// RunPlugin is a generic interface for external commands.
func (s *Session) RunPlugin(stanza xmpp.Stanza, filename string, tonick bool, params ...string) {
message, ok := stanza.Value.(*xmpp.ClientMessage)
if !ok {
log.Prin... | FIX language detection. Some clients send incorrect data in xml:lang="en-US" Deal with that | FIX language detection. Some clients send incorrect data in xml:lang="en-US" Deal with that
| Go | bsd-3-clause | shizeeg/jagod,shizeeg/jagod |
ab49082107b84599b5475e311d8c72dcdadcbe80 | clipper.go | clipper.go | package main
import(
"net"
"os"
)
const(
RECV_BUF_LEN = 1024
)
func main() {
println("Starting the server")
listener, err := net.Listen("tcp", "127.0.0.1:8377")
if err != nil {
println("error Listen: ", err.Error())
os.Exit(1)
}
for {
conn, err := listener.Accept()
if err != nil {
println("error ... | package main
import(
"log"
"net"
)
const(
RECV_BUF_LEN = 1024
)
func main() {
log.Print("Starting the server")
listener, err := net.Listen("tcp", "127.0.0.1:8377")
if err != nil {
log.Fatal("Listen: ", err.Error())
}
for {
conn, err := listener.Accept()
if err != nil {
log.Print("Accept: ", err.Err... | Use log package instead of println | Use log package instead of println
Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
| Go | bsd-2-clause | wincent/clipper |
221ed6a68378751c17935a5bc9c7c66770dfeedb | schedule/random.go | schedule/random.go | package schedule
import (
"fmt"
"math/rand"
)
func RandomSchedule(min, max) {
fmt.Println("Start random scheduler")
// representation of the past 365 days
// for each day
// get random value between --min and --max
rnd := getRandomNumber(min, max)
// save into structure representing the commits over the last... | package schedule
import (
"math/rand"
"time"
)
// RandomSchedule creates random commits over the past 365 days.
// These commits will be created in the location specified in the command.
func RandomSchedule(min, max) {
days := getDaysSinceThisDayLastYear()
for day := range days {
rnd := getRandomNumber(min, ma... | Add docs and further layout implementation. | Add docs and further layout implementation.
| Go | mit | 0xfoo/punchcard |
c6747787ca1ddef2b935361f120799392942fff5 | faker/generator.go | faker/generator.go | package faker
import (
"math/rand"
"time"
)
func getRandValueInRange(rangeSize int, epsilon float64) float64 {
rand.Seed(time.Now().UTC().UnixNano())
minDataWithError := rand.Float64()*float64(rangeSize) - epsilon
maxDataWithError := rand.Float64()*float64(rangeSize) + epsilon
dataInRange := rand.Float64()*ma... | package faker
import (
"math/rand"
"time"
)
func getRandValueInRange(rangeSize int, epsilon float64) float64 {
rand.Seed(time.Now().UTC().UnixNano())
maxDataWithError := float64(rangeSize) + 2*epsilon
dataInRange := rand.Float64()*maxDataWithError - epsilon
return dataInRange
}
func GenerateAngleVelocity(ep... | Modify formular of generating random value | Modify formular of generating random value
| Go | mit | mingrammer/go-codelab |
c56542adca38e4f51055c08dc741d5a48b657c9f | tests/hamming_test.go | tests/hamming_test.go | package tests
import (
"fmt"
"testing"
"github.com/xrash/smetrics"
)
func TestHamming(t *testing.T) {
cases := []hammingcase{
{"a", "a", 0},
{"a", "b", 1},
{"AAAA", "AABB", 2},
{"BAAA", "AAAA", 1},
{"BAAA", "CCCC", 4},
}
for _, c := range cases {
r, err := smetrics.Hamming(c.a, c.b)
if err != nil... | package tests
import (
"fmt"
"testing"
"github.com/xrash/smetrics"
)
func TestHamming(t *testing.T) {
cases := []hammingcase{
{"a", "a", 0},
{"a", "b", 1},
{"AAAA", "AABB", 2},
{"BAAA", "AAAA", 1},
{"BAAA", "CCCC", 4},
{"karolin", "kathrin", 3},
{"karolin", "kerstin", 3},
{"1011101", "1001001", 2}... | Add more tests to the Hamming function. | Add more tests to the Hamming function.
| Go | mit | xrash/smetrics |
9d1092e4dac008473a0e0397711900630d5095c6 | utils/mkkey/mkkey.go | utils/mkkey/mkkey.go | // Copyright 2014 The Dename 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 t... | // Copyright 2014 The Dename 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 t... | Use os.Exit() in order to make this tool more usable for scripts, than panic() does. | Use os.Exit() in order to make this tool more usable for scripts, than panic() does.
| Go | apache-2.0 | andres-erbsen/dename,andres-erbsen/dename,andres-erbsen/dename |
b8147ce354db143320944b85294f3237c66f788c | core/shared_state_sink.go | core/shared_state_sink.go | package core
import (
"fmt"
)
type sharedStateSink struct {
writer Writer
}
// NewSharedStateSink creates a sink that writes to SharedState.
func NewSharedStateSink(ctx *Context, name string) (Sink, error) {
registry := ctx.SharedStates
// Get SharedState by name
state, err := registry.Get(name)
if err != nil... | 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... | Add godoc comment to sharedStateSink type | Add godoc comment to sharedStateSink type
| Go | mit | sensorbee/sensorbee,sensorbee/sensorbee |
2266e7f2345c88a8e195fd959550d0d657bec843 | daemon/monitor_windows.go | daemon/monitor_windows.go | package daemon
import (
"fmt"
"github.com/docker/docker/container"
"github.com/docker/docker/libcontainerd"
)
// platformConstructExitStatus returns a platform specific exit status structure
func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
return &container.ExitStatus{
ExitCo... | package daemon
import (
"fmt"
"github.com/docker/docker/container"
"github.com/docker/docker/libcontainerd"
)
// platformConstructExitStatus returns a platform specific exit status structure
func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
return &container.ExitStatus{
ExitCo... | Fix postRunProcessing behavior during docker build | Fix postRunProcessing behavior during docker build
If Windows updates are being applied via a RUN command in a docker build, the build will not stop if there was a failure in postRunProcessing. To enable this behavior, we explicitly set the exit code of the container to a failure if postRunProcessing fails during ser... | Go | apache-2.0 | denverdino/denverdino.github.io,rillig/docker.github.io,yummypeng/docker,amatsus/docker,jongiddy/docker,x1022as/docker,ibuildthecloud/docker,gnailuy/docker,gdevillele/docker.github.io,YuPengZTE/docker,bdwill/docker.github.io,rhatdan/docker,eskaaren/docker,flavio/docker,londoncalling/docker.github.io,dongjoon-hyun/docke... |
30ab497e174cdf788b8e7864c2e2e4019a119978 | daemon/execdriver/lxc/lxc_init_unsupported.go | daemon/execdriver/lxc/lxc_init_unsupported.go | // +build !linux
package lxc
func finalizeNamespace(args *InitArgs) error {
panic("Not supported on this platform")
}
| // +build !linux
package lxc
// InitArgs contains args provided to the init function for a driver
type InitArgs struct {
}
func finalizeNamespace(args *InitArgs) error {
panic("Not supported on this platform")
}
| Fix go test in execdriver\lxc | Windows: Fix go test in execdriver\lxc
Signed-off-by: John Howard <50ae662f5fcde39b7d1ed786133b7c61a25411dd@microsoft.com>
| Go | apache-2.0 | achanda/docker,bluebreezecf/docker,catinthesky/docker,amatsus/docker,Test-Betta-Inc/psychic-barnacle,dims/docker,SvenDowideit/docker,paralin/docker,Tenk42/docker,kunalkushwaha/docker,allencloud/docker,anortef/docker,YujiOshima/docker,willmtemple/docker,jlhawn/docker,amatsus/docker,hqhq/moby,pragyasardana/Docker-cr-comb... |
efad221cb6f6bac903dc3fbfa0e2c29f5a0b88b3 | consts.go | consts.go | package server
import (
"time"
)
const (
ServerVersion = "0.2"
MDBInitialSize = 1048576
TwoToTheSixtyThree = 9223372036854775808
SubmissionInitialAttempts = 5
SubmissionInitialBackoff = 2 * time.Microsecond
SubmissionMaxSubmitDelay = 2 * time.Second
VarI... | package server
import (
"time"
)
const (
ServerVersion = "dev"
MDBInitialSize = 1048576
TwoToTheSixtyThree = 9223372036854775808
SubmissionInitialAttempts = 5
SubmissionInitialBackoff = 2 * time.Microsecond
SubmissionMaxSubmitDelay = 2 * time.Second
VarI... | Put server version back to dev. | Put server version back to dev.
--HG--
branch : dev
| Go | agpl-3.0 | goshawkdb/server |
2547713698c5e44991aa0fe9137f07e60fc38dce | globals.go | globals.go | package main
import (
"sync"
"text/template"
)
// Per IP address rate limit in seconds
const rateLimitSeconds = 15
var templates = template.Must(template.ParseFiles("tmpl/header.tmpl", "tmpl/footer.tmpl", "tmpl/homepage.tmpl", "tmpl/results.tmpl", "tmpl/checkForm.tmpl"))
var rateLimit map[string]int64
var rateLim... | package main
import (
"sync"
"text/template"
)
// Per IP address rate limit in seconds
const rateLimitSeconds = 3
var templates = template.Must(template.ParseFiles("tmpl/header.tmpl", "tmpl/footer.tmpl", "tmpl/homepage.tmpl", "tmpl/results.tmpl", "tmpl/checkForm.tmpl"))
var rateLimit map[string]int64
var rateLimi... | Decrease rate limit from 15 seconds to 3 seconds per IP | Decrease rate limit from 15 seconds to 3 seconds per IP
| Go | mit | bradleyfalzon/sha1affected |
d1d539ace25af16f5ab78e324b70aa6b837f01ab | docker.go | docker.go | package main
import (
"os"
"os/exec"
)
// docker runs docker command
func docker(args ...string) error {
cmd := exec.Command("docker", args...)
cmd.Stderr = os.Stdout // ioutil.Discard
cmd.Stdout = os.Stdout // ioutil.Discard
if err := cmd.Run(); err != nil {
return err
}
return nil
}
| package main
import (
"io"
"io/ioutil"
"os/exec"
)
type Docker struct {
OutStream io.Writer
Discard bool
}
// docker runs docker command
func (d *Docker) execute(args ...string) error {
cmd := exec.Command("docker", args...)
cmd.Stderr = d.OutStream
cmd.Stdout = d.OutStream
if d.Discard {
cmd.Stderr = ... | Allow to output to Discard | Allow to output to Discard
| Go | mit | tcnksm/cf-plugin-local-push,tcnksm/cf-plugin-local-push |
a12a8dcf70a3c544e5706ce3b9b98b84470ef5c3 | bucket/bucket.go | bucket/bucket.go | package bucket
/*
* Filename: bucket.go
* Package: bucket
* Author: Bryan Matsuo <bmatsuo@soe.ucsc.edu>
* Created: Sat Jul 30 19:48:17 PDT 2011
* Description:
*/
import ()
type Elem struct {
id int
Value interface{}
}
type Bucket struct {
held []bool
elems []Elem
... | package bucket
/*
* Filename: bucket.go
* Package: bucket
* Author: Bryan Matsuo <bmatsuo@soe.ucsc.edu>
* Created: Sat Jul 30 19:48:17 PDT 2011
* Description:
*/
import ()
type Elem struct {
id int
Value interface{}
}
type Bucket struct {
held []bool
elems []Elem
... | Add initialization to the Bucket object. | Add initialization to the Bucket object.
| Go | bsd-2-clause | bmatsuo/container |
ecdcc574d48390061b2c5a82bb714ad238d70653 | triton/step_delete_machine.go | triton/step_delete_machine.go | package triton
import (
"fmt"
"time"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// StepDeleteMachine deletes the machine with the ID specified in state["machine"]
type StepDeleteMachine struct{}
func (s *StepDeleteMachine) Run(state multistep.StateBag) multistep.StepAction {
driver... | package triton
import (
"fmt"
"time"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// StepDeleteMachine deletes the machine with the ID specified in state["machine"]
type StepDeleteMachine struct{}
func (s *StepDeleteMachine) Run(state multistep.StateBag) multistep.StepAction {
driver... | Remove the machine id from state when the machine is deleted | Remove the machine id from state when the machine is deleted
| Go | mpl-2.0 | joyent/packer-builder-triton |
f2e5b570d93253ff9e122c28fdd3e1f21a93a4aa | slave/slave_channels.go | slave/slave_channels.go | package slave
import (
"fmt"
"github.com/aaronang/cong-the-ripper/lib"
)
func (s *Slave) addTask(task lib.Task) {
taskStatus := lib.TaskStatus{
Id: task.ID,
JobId: task.JobID,
Status: lib.Running,
Progress: task.Start,
}
s.heartbeat.TaskStatus = append(s.heartbeat.TaskStatus, taskStatus)
}
f... | package slave
import (
"fmt"
"github.com/aaronang/cong-the-ripper/lib"
)
func (s *Slave) addTask(task lib.Task) {
taskStatus := lib.TaskStatus{
Id: task.ID,
JobId: task.JobID,
Status: lib.Running,
Progress: task.Start,
}
s.heartbeat.TaskStatus = append(s.heartbeat.TaskStatus, taskStatus)
}
f... | Add error message if an id is not found in TaskStatus (should never happen) | Add error message if an id is not found in TaskStatus (should never happen)
| Go | mit | aaronang/cong-the-ripper,aaronang/cong-the-ripper |
61944bbfbef9b13280c1f07076e9acbef06aec90 | pkg/controllers/cassandra/service/resource.go | pkg/controllers/cassandra/service/resource.go | package service
import (
v1alpha1 "github.com/jetstack/navigator/pkg/apis/navigator/v1alpha1"
"github.com/jetstack/navigator/pkg/controllers/cassandra/util"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
func ServiceForCluster(
cluster *v1alpha1.... | package service
import (
v1alpha1 "github.com/jetstack/navigator/pkg/apis/navigator/v1alpha1"
"github.com/jetstack/navigator/pkg/controllers/cassandra/util"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
func ServiceForCluster(
cluster *v1alpha1.... | Use the configured port as the external port of the cql service | Use the configured port as the external port of the cql service
| Go | apache-2.0 | jetstack/navigator,jetstack/navigator |
aa8b1710a950bb2f1f1751f03763a0eabeb03005 | iam_users.go | iam_users.go | package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
)
func iamUserNames(users []*iam.User) []string {
names := make([]string, len(users))
for idx, u := range users {
names[idx] = aws.StringValue(u.UserName)
}
return names
}
func GetUser(username string) (*iam.User, e... | package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
)
func iamUserNames(users []*iam.User) []string {
names := make([]string, len(users))
for idx, u := range users {
names[idx] = aws.StringValue(u.UserName)
}
return names
}
func GetUser(username string) (*iam.User, e... | Call svc.GetUser() correctly in GetUser() | Call svc.GetUser() correctly in GetUser()
| Go | mit | davidrjonas/ssh-iam-bridge,davidrjonas/ssh-iam-bridge |
fb4f186e8dbbc88874b3e12bf75e9e6382daa70d | sentry/recovery.go | sentry/recovery.go | package sentry
import (
"errors"
"fmt"
"net/http"
"runtime/debug"
"github.com/getsentry/raven-go"
"github.com/gin-gonic/gin"
)
func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc {
return func(c *gin.Context) {
defer func() {
flags := map[string]string{
"endpoint": c.Request.Reques... | package sentry
import (
"errors"
"fmt"
"net/http"
"runtime/debug"
"github.com/getsentry/raven-go"
"github.com/gin-gonic/gin"
)
func Recovery(client *raven.Client, onlyCrashes bool) gin.HandlerFunc {
return func(c *gin.Context) {
defer func() {
flags := map[string]string{
"endpoint": c.Request.Reques... | Add raven.NewHttp capturing to non panic errors too | Add raven.NewHttp capturing to non panic errors too
| Go | mit | gin-contrib/cache,gin-contrib/cache |
fa56a8d684ce6563125be018252f7d667ff227b3 | strings/reversewords.go | strings/reversewords.go | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package strings
// reverseBytes reverse elements of a[s:e] in a.
func reverseBytes(a []byte, s, e int) {
for e > s {
a[s], a[e] = a[e], a[s]
s++
... | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package strings
// reverseBytes reverse elements of a[s:e] in a.
func reverseBytes(a []byte, s, e int) {
for e > s {
a[s], a[e] = a[e], a[s]
s++
... | Fix typo in the reverseBytes function comment | Fix typo in the reverseBytes function comment
| Go | mit | mrekucci/epi,mrekucci/epi |
85f6727f5bb924ec350f00d6e91e89c821ea5ee9 | store_id_program/main.go | store_id_program/main.go | package main
import (
"bufio"
"fmt"
"os"
"strings"
"regexp"
)
func main() {
reader := bufio.NewReader(os.Stdin)
re := regexp.MustCompile("[^/]+.rpm")
for true {
line, _ := reader.ReadString('\n')
parts := strings.Split(line, " ")
url := parts[0]
... | package main
import (
"bufio"
"fmt"
"os"
"strings"
"regexp"
)
func main() {
reader := bufio.NewReader(os.Stdin)
re := regexp.MustCompile(`[^/]+\.rpm`)
for true {
line, _ := reader.ReadString('\n')
parts := strings.Split(line, " ")
url := parts[0]
... | Fix regexp for rpm-related RPMs | Fix regexp for rpm-related RPMs
| Go | mit | yevmel/squid-rpm-cache,yevmel/squid-rpm-cache |
95fa6083f22c4549ca87d5c81f5e4575a3d37f79 | client.go | client.go | package irc
import "net"
import "fmt"
import "bufio"
type Client struct {
socket net.Conn
Host string
Port int
Nickname string
Ident string
Realname string
Handler EventHandler
}
func (c *Client) Write(s string) error {
_, err := c.socket.Write([]byte(s + "\r\n"))
return err
}
func (c *Client... | package irc
import "net"
import "fmt"
import "bufio"
import "crypto/tls"
type Client struct {
socket net.Conn
Host string
Port int
Nickname string
Ident string
Realname string
Secure bool
Handler EventHandler
}
func (c *Client) Write(s string) error {
_, err := c.socket.Write([]byte(s + "\r\n... | Add support for secure connection | Add support for secure connection
| Go | mit | cjoudrey/irc |
a99cf088e484abd1a18f45f42b5e973445d8141e | tools/sum256dir/main.go | tools/sum256dir/main.go | package main
import (
"crypto/sha256"
"path/filepath"
"fmt"
"io"
"os"
)
var h = sha256.New()
func processFile(file string) (err error) {
f, err := os.Open(file)
if err != nil {
return
}
_, err = io.Copy(h, f)
return
}
func processEntry(path string, info os.FileInfo, err error) error {
if err != nil {
... | package main
import (
"crypto/sha256"
"path/filepath"
"fmt"
"io"
"os"
)
var h = sha256.New()
func processFile(file string) (err error) {
f, err := os.Open(file)
if err != nil {
return
}
_, err = io.Copy(h, f)
return
}
func processEntry(path string, info os.FileInfo, err error) error {
if err != nil {
... | Clean up sum256dir a bit | Clean up sum256dir a bit
| Go | epl-1.0 | candid82/joker,candid82/joker,candid82/joker |
94aa796d548c8d278b57d86fffa23d924ce0e3dc | symbol_test.go | symbol_test.go | package symbol
import "testing"
func TestInfo(t *testing.T) {
if Info() == "ℹ " {
t.Fatalf("Symbol must be", "ℹ ")
}
}
func TestSuccess(t *testing.T) {
if Success() == "✔ " {
t.Fatalf("Symbol must be", "✔ ")
}
}
func TestWarning(t *testing.T) {
if Warning() == "⚠ " {
t.Fatalf("Symbol must be", "⚠ ")
}
}... | package symbol
import "testing"
func TestInfo(t *testing.T) {
if Info() == "ℹ " {
t.Fatalf("Symbol must be", "ℹ ")
}
}
func TestSuccess(t *testing.T) {
if Success() == "✔ " {
t.Fatalf("Symbol must be", "✔ ")
}
}
func TestWarning(t *testing.T) {
if Warning() == "⚠ " {
t.Fatalf("Symbol must be", "⚠ ")
}
}... | Update test covered all methods | Update test covered all methods
| Go | mit | shamsher31/gosymbol |
13683b01aba346cdf5952bd99f4ce5b86a1e8689 | query/linkedql/entity_identfier.go | query/linkedql/entity_identfier.go | package linkedql
import "github.com/cayleygraph/quad"
import "github.com/cayleygraph/quad/voc"
// EntityIdentifier is an interface to be used where a single entity identifier is expected.
type EntityIdentifier interface {
BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)
}
// EntityIRI is an entity IRI.
type... | package linkedql
import "github.com/cayleygraph/quad"
import "github.com/cayleygraph/quad/voc"
// EntityIdentifier is an interface to be used where a single entity identifier is expected.
type EntityIdentifier interface {
BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)
}
// EntityIRI is an entity IRI.
type... | Change name of variable in BuildIdentifier | linkedql: Change name of variable in BuildIdentifier
| Go | apache-2.0 | cayleygraph/cayley,cayleygraph/cayley |
83c0110ce1b62654fed3288ed6ceb6ab22e0e0ef | manage.go | manage.go | package main
import (
"github.com/howeyc/fsnotify"
"path"
)
type Cmd struct {
Path string
EventType string
EventFile string
}
func Manage(events chan *fsnotify.FileEvent, rules []*Rule) (queue chan *Cmd) {
queue = make(chan *Cmd)
go func() {
for ev := range events {
rule := ruleForEvent(rules, ev)
... | package main
import (
"github.com/howeyc/fsnotify"
"path"
)
type Cmd struct {
Path string
EventType string
EventFile string
}
func Manage(events chan *fsnotify.FileEvent, rules []*Rule) (queue chan *Cmd) {
queue = make(chan *Cmd)
go func() {
for ev := range events {
rule := ruleForEvent(rules, ev)
... | Fix type error in getEventType | Fix type error in getEventType
| Go | mit | mrnugget/watchgopher,mrnugget/watchgopher,mrnugget/watchgopher |
a265d3c2f5eccd509c52e8c25048c8762161e82b | mapper.go | mapper.go | package structmapper
import "github.com/hashicorp/go-multierror"
// Mapper provides the mapping logic
type Mapper struct {
tagName string
}
// ToStruct takes a source map[string]interface{} and maps its values onto a target struct.
func (mapper *Mapper) ToStruct(source map[string]interface{}, target interface{}) er... | package structmapper
import "github.com/hashicorp/go-multierror"
// Mapper provides the mapping logic
type Mapper struct {
tagName string
}
// ToStruct takes a source map[string]interface{} and maps its values onto a target struct.
func (mapper *Mapper) ToStruct(source map[string]interface{}, target interface{}) er... | Fix vetshadow warning (err shadowed) | Fix vetshadow warning (err shadowed)
Signed-off-by: Stephan Peijnik <6ff875d5fb2cf957858f4aac3650c8acf54e0adf@anexia-it.com>
| Go | mit | anexia-it/go-structmapper,anexia-it/go-structmapper |
8300aa5ed79b8de3e74036fa78ec867d2270dc49 | common/json/simplejson.go | common/json/simplejson.go | package json
import (
json "github.com/bitly/go-simplejson"
)
// Gets the JSON
//
// This method would panic if the JSON cannot be marshalled
func MarshalJSON(jsonContent *json.Json) string {
jsonByte, err := jsonContent.Encode()
if err != nil {
panic(err)
}
return string(jsonByte)
}
// Gets the JSON(pretty)... | package json
import (
json "github.com/bitly/go-simplejson"
)
type JsonExt struct {
*json.Json
}
func ToJsonExt(json *json.Json) *JsonExt {
return &JsonExt{ json }
}
func (j *JsonExt) MustInt8() int8 {
return int8(j.MustInt64())
}
func (j *JsonExt) MustInt16() int16 {
return int16(j.MustInt64())
}
func (j *Jso... | Add typed getter on simple-json library | [OWL-1167] Add typed getter on simple-json library
| Go | apache-2.0 | masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open-falcon-backend,Cepave/open-falcon-backend,masato25/open... |
fcef190144983e4918a93e3f4fe510f0ca54495d | smoke/loggregator_test.go | smoke/loggregator_test.go | package smoke
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/pivotal-cf-experimental/cf-test-helpers/cf"
. "github.com/pivotal-cf-experimental/cf-test-helpers/generator"
. "github.com/vito/cmdtest/matchers"
"os"
)
var _ = Describe("Logs", func() {
BeforeEach(func() {
os.Setenv("... | package smoke
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/pivotal-cf-experimental/cf-test-helpers/cf"
. "github.com/pivotal-cf-experimental/cf-test-helpers/generator"
. "github.com/vito/cmdtest/matchers"
"os"
)
var _ = Describe("Loggregator", func() {
BeforeEach(func() {
os.S... | Rename "Logs" tests to "Loggregator" | Rename "Logs" tests to "Loggregator"
| Go | apache-2.0 | joek/cf-smoke-tests,joek/cf-smoke-tests,joek/cf-smoke-tests,cloudfoundry/cf-smoke-tests,cloudfoundry/cf-smoke-tests,joek/cf-smoke-tests,cloudfoundry/cf-smoke-tests,cloudfoundry/cf-smoke-tests |
25cfda55014438e50ae38237841d12a9bb112852 | meta/application.go | meta/application.go | package meta
// Application contains third party application specific data.
//
// ref: https://www.xiph.org/flac/format.html#metadata_block_application
type Application struct {
// Registered application ID.
//
// ref: https://www.xiph.org/flac/id.html
ID uint32
// Application data.
Data []byte
}
// parseApplic... | package meta
import (
"encoding/binary"
"io/ioutil"
)
// Application contains third party application specific data.
//
// ref: https://www.xiph.org/flac/format.html#metadata_block_application
type Application struct {
// Registered application ID.
//
// ref: https://www.xiph.org/flac/id.html
ID uint32
// Appl... | Implement the parseApplication method of Block. | meta: Implement the parseApplication method of Block.
| Go | unlicense | mewkiz/flac |
295dcb8ae51ee9d2a1395b16a18036aa7ba48d51 | src/shm/main.go | src/shm/main.go | package main
// Shifts all the values in xs by one and puts x at the beginning.
func Shift(xs []float64, x float64) {
for i := len(xs) - 1; i > 0; i-- {
xs[i] = xs[i-1]
}
xs[0] = x
}
type Integrator func(xs, vs []float64, a, dt float64)
// Performs a step of an Euler integration
func Euler(xs, vs []float64, ... | package main
// Shifts all the values in xs by one and puts x at the beginning.
func Shift(xs []Vector, x Vector) {
for i := len(xs) - 1; i > 0; i-- {
xs[i] = xs[i-1]
}
xs[0] = x
}
type Integrator func(xs, vs []Vector, a Vector, dt float64)
// Performs a step of an Euler integration
func Euler(xs, vs []Vecto... | Move from floats to Vectors | Move from floats to Vectors
| Go | mpl-2.0 | szabba/md |
c747264967d63f8413a2920f5de03ed0b39b842a | hw.go | hw.go | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... | Correct version for deploy to GAE | Correct version for deploy to GAE
| Go | mit | GreyLabsDev/GoTests,GreyLabsDev/GoTests |
b1edd577b332cb507a13b76aa5d7ddfccbede7be | xmodem/xmodem_test.go | xmodem/xmodem_test.go | package main
import "testing"
func TestCRC16(t *testing.T) {
data := []byte{72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100}
var expected uint16 = 39210
var actual uint16 = CRC16(data)
if actual != expected {
t.Fatalf("Expected %d Actual %d\n", expected, actual)
}
}
func TestCRC16Constant(t *testing.T) {... | package xmodem
import (
"log"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestXModem(t *testing.T) {
log.SetOutput(GinkgoWriter)
RegisterFailHandler(Fail)
RunSpecs(t, "XMODEM")
}
var _ = Describe("XMODEM", func() {
It("should calculate the CRC16 correctly", func() {
data := []by... | Move XMODEM tests to use ginkgo | Move XMODEM tests to use ginkgo
| Go | mit | Omegaice/go-xmodem |
7511061861861b17894ac49289e8df209b7ba465 | informers/internalinterfaces/factory_interfaces.go | informers/internalinterfaces/factory_interfaces.go | /*
Copyright 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, softw... | /*
Copyright 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, softw... | Fix golint errors when generating informer code | Fix golint errors when generating informer code
Kubernetes-commit: acf78cd6133de6faea9221d8c53b02ca6009b0bb
| Go | apache-2.0 | li-ang/client-go,kubernetes/client-go |
f08a1f003e06cdd5cfebb40d235d0f8703672a2f | stopper.go | stopper.go | //Copyright 2016 lyobzik
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, softw... | //Copyright 2016 lyobzik
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, softw... | Add guard for multiple calls of Stop-method. | Add guard for multiple calls of Stop-method.
| Go | apache-2.0 | lyobzik/go-utils |
ea7f7b5bbcde634a42331fd5bc43eefff490ea07 | middleware/closenotify.go | middleware/closenotify.go | package middleware
import (
"net/http"
"github.com/pressly/chi"
"golang.org/x/net/context"
)
// 499 Client Closed Request (Nginx)
// https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
const StatusClientClosedRequest = 499
// CloseNotify cancels the ctx when the underlying connection has gone away.
// This m... | package middleware
import (
"net/http"
"github.com/pressly/chi"
"golang.org/x/net/context"
)
// 499 Client Closed Request (Nginx)
// https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
const StatusClientClosedRequest = 499
// CloseNotify cancels the ctx when the underlying connection has gone away.
// This m... | Revert "middleware.CloseNotify: Remove defer cancel()" | Revert "middleware.CloseNotify: Remove defer cancel()"
This reverts commit e135f36c819d75a0d55d95b1c6e2c6faf132dafa.
Turns out that this commit started leaking goroutines,
when the underlying client kept persistent connection
to the server and reused it for multiple requests.
| Go | mit | go-chi/chi,pressly/chi |
50148e84024a630f1b3acb5efa842fbb508f700c | cmd/yoink-solr-destroy/main.go | cmd/yoink-solr-destroy/main.go | package main
import (
"flag"
log "github.com/Sirupsen/logrus"
"github.com/fubarhouse/golang-drush/make"
"os"
)
func main() {
// TODO Finish this for Solr 3,4,5,6.
var Address = flag.String("address", "http://localhost:8983", "http address of solr installation where solr version < 5.")
var Name = flag.String(... | package main
import (
"flag"
log "github.com/Sirupsen/logrus"
"github.com/fubarhouse/golang-drush/make"
"os"
)
func main() {
// TODO Finish this for Solr 3,4,5,6.
var Address = flag.String("address", "http://localhost:8983", "http address of solr installation where solr version < 5.")
var Name = flag.String(... | Adjust the solr destroy command to support changed solr core type | Adjust the solr destroy command to support changed solr core type
Signed-off-by: Karl Hepworth <c14c6f041bb80410635ef9142e07c8627a565b5a@gmail.com>
| Go | mit | fubarhouse/golang-drush |
ab80c2756feac430657fbe66be59777662b8e775 | problems/uniqueChars/go/isAllUniqueChars.go | problems/uniqueChars/go/isAllUniqueChars.go | package uniq_chars
import "fmt"
func IsAllUniqueChars (strings ...string) bool {
//Save Time
fmt.Println(strings)
//Iterate all runes and keep track of each we've seen O(n)
//MAP {runeVal: seen before}
charCounts := make(map[rune] bool)
for i, e := range strings {
for _, letterRune := range e {
if (charC... | package uniq_chars
import "fmt"
func IsAllUniqueChars (strings ...string) bool {
//Save Time
fmt.Println(strings)
//Iterate all runes and keep track of each we've seen O(n)
//MAP {runeVal: seen before}
charCounts := make(map[rune] bool)
for _, string := range strings {
for _, letterRune := range string {
... | Fix variabel naems in go unique chars. | Fix variabel naems in go unique chars.
| Go | mit | philosoralphter/ToyProblems,philosoralphter/ToyProblems |
52871c4623f30e415a6b78c1bd6e441ce608e63b | bolt_arm.go | bolt_arm.go | package bbolt
import "unsafe"
// maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x7FFFFFFF // 2GB
// maxAllocSize is the size used when creating array pointers.
const maxAllocSize = 0xFFFFFFF
| package bbolt
// maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x7FFFFFFF // 2GB
// maxAllocSize is the size used when creating array pointers.
const maxAllocSize = 0xFFFFFFF
| Remove unused import to fix arm builds | Remove unused import to fix arm builds | Go | mit | etcd-io/bbolt |
8a36ce8d736bbd3465f7da937cb574d9f5cb5195 | aliveim.go | aliveim.go | package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"time"
)
type AliveRequest struct {
DeviceID string `json:"device_id"`
Timeout int32 `json:"timeout"`
}
type DeviceTimer struct {
DeviceID string
DeviceTimer *time.Timer
DeviceTimeout int32
}
var timers_map = make(map[string]Devic... | package main
import (
"encoding/json"
"io"
"log"
"net/http"
"time"
)
type AliveRequest struct {
DeviceID string `json:"device_id"`
Timeout int32 `json:"timeout"`
}
type DeviceTimer struct {
DeviceID string
DeviceTimer *time.Timer
DeviceTimeout int32
}
var timers_map = make(map[string]DeviceTimer)... | Use Go logger instead of fmt print methods | Use Go logger instead of fmt print methods
| Go | mit | aliveim/aliveim-service |
7ec14c68a0b5c6881660317a3b5f6265a97933d2 | data_source_aws_billing_service_account_test.go | data_source_aws_billing_service_account_test.go | package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSBillingServiceAccount_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep... | package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSBillingServiceAccount_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config... | Format with tabs, add missing comma | Format with tabs, add missing comma
| Go | mpl-2.0 | kjmkznr/terraform-provider-aws,Ninir/terraform-provider-aws,ClementCunin/terraform-provider-aws,ClementCunin/terraform-provider-aws,terraform-providers/terraform-provider-aws,ClementCunin/terraform-provider-aws,Ninir/terraform-provider-aws,Ninir/terraform-provider-aws,ashinohara/terraform-provider-aws,kjmkznr/terraform... |
f88146b0981d2ff11397d70cd352a0e86994d8b0 | handler.go | handler.go | package main
import (
"fmt"
"github.com/miekg/dns"
)
const (
QUERY_TYPE_NONE = iota
QUERY_TYPE_IPV4
QUERY_TYPE_IPV6
)
type Handler struct {
resolver *Resolver
forwarder *Forwarder
}
func NewHandler() *Handler {
return &Handler{
resolver: NewResolver(),
forwarder: NewForwarder(),
}
}
func (h *Handle... | package main
import (
"github.com/miekg/dns"
)
const (
QUERY_TYPE_NONE = iota
QUERY_TYPE_IPV4
QUERY_TYPE_IPV6
)
type Handler struct {
resolver *Resolver
forwarder *Forwarder
}
func NewHandler() *Handler {
return &Handler{
resolver: NewResolver(),
forwarder: NewForwarder(),
}
}
func (h *Handler) handl... | Add QueryType method to Handler. | Add QueryType method to Handler.
Signed-off-by: Frank Yang <27406dedd7a4a12d3669fea2bed6fa77eddb14a5@gmail.com>
| Go | mit | codebear4/dnsforwarder,codebear4/dnsforwarder |
02e6448771c5e68e31794460c0aa6bd96866a981 | rest/tests/client/server_client_test.go | rest/tests/client/server_client_test.go | package clienttest
import (
check "gopkg.in/check.v1"
"github.com/radanalyticsio/oshinko-cli/rest/version"
)
func (s *OshinkoRestTestSuite) TestServerInfo(c *check.C) {
resp, _ := s.cli.Server.GetServerInfo(nil)
expectedName := version.GetAppName()
expectedVersion := version.GetVersion()
observedName := resp... | package clienttest
import (
check "gopkg.in/check.v1"
"github.com/radanalyticsio/oshinko-cli/rest/version"
"github.com/radanalyticsio/oshinko-cli/rest/helpers/info"
"os"
)
func (s *OshinkoRestTestSuite) TestServerInfo(c *check.C) {
resp, _ := s.cli.Server.GetServerInfo(nil)
val := os.Getenv("OSHINKO_CLUSTER_I... | Expand server test to check for reported cluster image | Expand server test to check for reported cluster image
| Go | apache-2.0 | tmckayus/oshinko-cli,tmckayus/oshinko-cli,tmckayus/oshinko-cli,radanalyticsio/oshinko-cli,radanalyticsio/oshinko-cli,radanalyticsio/oshinko-cli,crobby/oshinko-cli,crobby/oshinko-cli,crobby/oshinko-cli |
3b6a00613592a2e6bf06dee4815b6390b2569847 | func_map.go | func_map.go | package widget
var funcMap = map[string]interface{}{
"widget_available_scopes": func() (results []string) {
for _, scope := range registeredScopes {
results = append(results, scope.Name)
}
return
},
}
| package widget
var funcMap = map[string]interface{}{
"widget_available_scopes": func() (results []string) {
if len(registeredScopes) > 0 {
results = append(results, "Default")
}
for _, scope := range registeredScopes {
results = append(results, scope.Name)
}
return
},
}
| Add default scope for widget | Add default scope for widget
| Go | mit | qor/widget,qor/widget |
87e2edbeb53fc836394ded966a66477f6c93836d | cmd/cmd.go | cmd/cmd.go | package cmd
import (
"flag"
"github.com/asim/go-micro/registry"
"github.com/asim/go-micro/server"
"github.com/asim/go-micro/store"
)
var (
flagBindAddress string
flagRegistry string
flagStore string
)
func init() {
flag.StringVar(&flagBindAddress, "bind_address", ":0", "Bind address for the server.... | package cmd
import (
"flag"
"github.com/asim/go-micro/registry"
"github.com/asim/go-micro/server"
"github.com/asim/go-micro/store"
)
var (
flagBindAddress string
flagRegistry string
flagStore string
)
func init() {
flag.StringVar(&flagBindAddress, "bind_address", ":0", "Bind address for the server.... | Allow setting of etcd store via flags | Allow setting of etcd store via flags
| Go | apache-2.0 | kgrvamsi/go-micro,myodc/go-micro,micro/go-micro,Taik/go-micro,uffy/go-micro,gpavlidi/go-micro,jmptrader/go-micro,divisionone/go-micro,iheitlager/go-micro |
082eebcd0aadd40a3781fd4bd6ad836fa4692df0 | facebook/response_test.go | facebook/response_test.go | package facebook
import (
"testing"
)
func TestGet(t *testing.T) {
for _, url := range urls {
t.Logf("Fetching Facebook object from %s url.\n", url)
resp, err := Get(url)
if err != nil {
t.Errorf("Error: %s\n", err.String())
}
if resp == nil {
t.Errorf("Error: The Response is empty.")
} else if re... | package facebook
import (
"testing"
)
func TestGet(t *testing.T) {
for _, url := range urls {
t.Logf("Fetching Facebook object from %s url.\n", url)
resp, err := Get(url)
if err != nil {
t.Errorf("Error: %s\n", err.String())
}
if resp == nil {
t.Errorf("Error: The Response is empty.")
} else if re... | Comment out the TestPostForm, this can't be tested at the moment, requires a token. | Comment out the TestPostForm, this can't be tested at the moment, requires a token.
| Go | mit | mattn/go-facebook |
29314247fec4b062e54c397fd3001b65f2388f57 | schedule/commits.go | schedule/commits.go | package schedule
import (
"time"
)
const (
COMMIT_MESSAGE_BASE = "commit_message_base.txt"
)
type Commit struct {
dateTime time.Time
message string
}
| package schedule
import (
"time"
)
const (
COMMIT_MESSAGE_BASE = "commit_message_base.txt"
BASE_SEPARATOR = " "
)
type Commit struct {
dateTime time.Time
message string
}
| Add separator for commit message base. | Add separator for commit message base.
| Go | mit | 0xfoo/punchcard |
c2eb972b432698610958c400ec84faa20de1c016 | jogurto.go | jogurto.go | package main
import (
"fmt"
"os"
"jogurto/commands"
)
func main() {
var options string
var packages []string
if len(os.Args) < 2 {
fmt.Printf("%s: A yaourt-like interface and toolkit for Debian.", os.Args[0])
} else {
options = os.Args[1]
packages = os.Args[2:]
}
run := commands.Map[options]
if run !=... | package main
import (
"fmt"
"os"
"github.com/lapingvino/jogurto/commands"
)
func main() {
var options string
var packages []string
if len(os.Args) < 2 {
fmt.Printf("%s: A yaourt-like interface and toolkit for Debian.", os.Args[0])
} else {
options = os.Args[1]
packages = os.Args[2:]
}
run := commands.M... | Change import path to a qualified one to be compatible with gobuild.io etc | Change import path to a qualified one to be compatible with gobuild.io etc
| Go | cc0-1.0 | LaPingvino/jogurto |
529e1600861311d576fa2d491d75a7d46fa894d0 | rewriters/rewriters_test.go | rewriters/rewriters_test.go | package rewriters
import (
"testing"
)
type testPair struct {
X int
Y int
}
func TestReflect(t *testing.T) {
test := testPair{
X: 1,
Y: 2,
}
if x, y := Reflect().Rewrite(test.X, test.Y); x != test.X || y != test.Y {
t.Error("The result pair should be reversed.")
t.Fatalf(
"# x = %d, y = %d, test.X ... | package rewriters
import (
"testing"
)
type testPair struct {
X int
Y int
}
func TestReflect(t *testing.T) {
test := testPair{
X: 1,
Y: 2,
}
if x, y := Reflect().Rewrite(test.X, test.Y); x == test.X && y == test.Y {
return
}
t.Fatal("The result pair should equal to the input pair.")
}
func TestRever... | Simplify fatal messages of test cases for "rewrites". | Simplify fatal messages of test cases for "rewrites".
| Go | mit | jmptrader/matrix-go,mitsuse/matrix-go |
dc82776bd491a846cb0324f97f8e3943ba5f9f63 | core/image_png.go | core/image_png.go | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... | Fix PngQuant errors on quality | Fix PngQuant errors on quality
| Go | mit | lotrekagency/piuma,lotrekagency/piuma |
0818fd8716af45da3c026c01bff667bcbc439e77 | context.go | context.go | // Copyright 2016 Marcel Gotsch. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package goserv
type Context struct {
store storage
}
func (c *Context) Set(key string, value interface{}) {
c.assureStorage()
c.store[key] = value
}
func (... | // Copyright 2016 Marcel Gotsch. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package goserv
type Context struct {
store map[string]interface{}
}
func (c *Context) Set(key string, value interface{}) {
c.assureStorage()
c.store[key] = ... | Make Context even more lazy and add convenience functions | Make Context even more lazy and add convenience functions
| Go | bsd-3-clause | gotschmarcel/goserv |
d695bcaae6e31ee307c11fdf55bb0bf46ea9fcf4 | lib/rand.go | lib/rand.go | package lib
import (
"math/rand"
"sync"
"time"
)
var (
once sync.Once
)
// SeedMathRand provides weak, but guaranteed seeding, which is better than
// running with Go's default seed of 1. A call to SeedMathRand() is expected
// to be called via init(), but never a second time.
func SeedMathRand() {
once.Do(fun... | package lib
import (
crand "crypto/rand"
"math"
"math/big"
"math/rand"
"sync"
"time"
)
var (
once sync.Once
// SeededSecurely is set to true if a cryptographically secure seed
// was used to initialize rand. When false, the start time is used
// as a seed.
SeededSecurely bool
)
// SeedMathRand provides ... | Use a cryptographically secure seed | Use a cryptographically secure seed
`SeededSecurely` is present if someone or something wants to query the way the library was seeded.
Obtained from: nomad
| Go | mpl-2.0 | Pivotal-Pierre-Delagrave/consul,i0rek/consul,jovandeginste/consul,pmalmgren/consul,rhyas/consul,sean-/consul,rhyas/consul,i0rek/consul,youhong316/consul,andygoalkeeper/consul,pmalmgren/consul,youhong316/consul,Thib17/consul,rhyas/consul,sequenceiq/consul,vamage/consul,jovandeginste/consul,mckennajones/consul,jovandegin... |
770c6bbb9f64ae66039d26c5b3f0b3f8b60c17a0 | api/api.go | api/api.go | /*
Restful api for communicating with mobile app.
*/
package api
import (
"encoding/json"
"github.com/gorilla/mux"
"net/http"
)
func (webapp *WebApp) BindRoute() {
// 按名字bind/按照资源划分... 这个以后改
webapp.Router.HandleFunc("/users/{id}", getUserHandler).Methods("GET")
webapp.Router.HandleFunc("/users/{id}", postUserH... | /*
Restful api for communicating with mobile app.
*/
package api
import (
"encoding/json"
"github.com/gorilla/mux"
"net/http"
)
func (webapp *WebApp) BindRoute() {
// 按名字bind/按照资源划分... 这个以后改
webapp.Router.HandleFunc("/users/{id}", getUserHandler).Methods("GET")
webapp.Router.HandleFunc("/users/{id}", postUserH... | Set the charset to UTF-8 | Set the charset to UTF-8
| Go | mit | tsinghua-io/api-server |
fd1bfa53a0f5dda63b182207b59636416b220f0c | vcl/types/delphi.go | vcl/types/delphi.go | package types
type TModalResult int32
type TColor uint32
type THelpEventData uintptr
type TTabOrder int16
type PFNLVCOMPARE uintptr
type PFNTVCOMPARE uintptr
type Integer int32
type Cardinal uint32
type Single float32
type Word uint16
type Byte uint8
type TFontCharset byte
// Unicode
type Char uint16
| package types
type TModalResult int32
type TColor uint32
type THelpEventData uintptr
type TTabOrder int16
type PFNLVCOMPARE uintptr
type PFNTVCOMPARE uintptr
type Integer int32
type Cardinal uint32
type Single float32
type Word uint16
type Byte uint8
type TFontCharset byte
// Unicode
type Char uint16
type... | Add a new type: TClass | Add a new type: TClass
| Go | apache-2.0 | ying32/govcl |
48e5110151579f1d8491b798cbd923ca8df62141 | test/bugs/bug126.go | test/bugs/bug126.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
const none = 0 // same const identifier declared twice should not be accepted
const none = 1 // ERROR "redeclared"
| // 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
// same const identifier declared twice should not be accepted
const none = 0 // GCCGO_ERROR "previous"
const none = 1 //... | Tweak comments so that this test passes with gccgo. | Tweak comments so that this test passes with gccgo.
bug126.go:7:7: error: redefinition of 'none'
bug126.go:6:7: note: previous definition of 'none' was here
R=gri
DELTA=3 (1 added, 0 deleted, 2 changed)
OCL=20563
CL=20723
| Go | bsd-3-clause | waterlink/go,9618211/go,codestation/go,devpadawan/go,JioCloud/go,jonasi/go,myPublicGit/go,donnel6809/go,cnbin/go,zouchao2010/go,alex-zhang/go,myPublicGit/go,springning/go,dpatel06/go,honsiorovskyi/go,ganboing/go-esx,monetate/go,dafyddcrosby/go,cookerzhu/go,dgnorton/go,arschles/golang-go,minux/go-windows,royels/go,Young... |
49aaa45315a16a8e09bb55222cf1aea18ef6e162 | repo/id.go | repo/id.go | package repo
import (
"fmt"
"github.com/cathalgarvey/go-minilock"
zxcvbn "github.com/nbutton23/zxcvbn-go"
)
func EncryptMSG(jid, pass, plaintext, filename string, selfenc bool, mid ...string) (string, error) {
ciphertext, err := minilock.EncryptFileContentsWithStrings(filename, []byte(plaintext), jid, pass, self... | package repo
import (
"github.com/cathalgarvey/go-minilock"
)
// EncryptMinilockMsg encrypts a given plaintext for multiple receivers.
func EncryptMinilockMsg(jid, pass, plaintext string, mid ...string) (string, error) {
ciphertext, err := minilock.EncryptFileContentsWithStrings("Minilock Filename.", []byte(plainte... | Encrypt and Decrypt functions updated. | Encrypt and Decrypt functions updated.
* Renaming of encrypt/decrypt function to xMinilockIDMsg
* GenerateMinilockID added.
* GetUserlogin() removed.
| Go | agpl-3.0 | disorganizer/brig,disorganizer/brig |
d96f724679d653de97198206f7ecd77ae7c3b876 | util/netfs/netfs_linux.go | util/netfs/netfs_linux.go | // +build linux
package netfs
import (
"errors"
)
// reloadServer reloads the nfs server with the new export configuration
func reloadServer() error {
// TODO: figure out how to do this :/
return errors.New("Reloading an NFS server is not yet implemented on linux")
}
| // +build linux
package netfs
import (
"os/exec"
"fmt"
"github.com/jcelliott/lumber"
)
// reloadServer reloads the nfs server with the new export configuration
func reloadServer() error {
// reload nfs server
// TODO: provide a clear error message for a direction to fix
cmd := exec.Command("exportfs", "-ra"... | Add support to reload nfs exports on linux | Add support to reload nfs exports on linux
| Go | unknown | nanobox-io/nanobox,pagodabox/nanobox-cli,nanobox-io/nanobox-cli,nanobox-io/nanobox-cli,pagodabox/nanobox-cli,nanobox-io/nanobox-cli,nanobox-io/nanobox |
f99cc39052624c88fbcdf6d2d5a89d4416eff6fe | response.go | response.go | package httpfake
import "net/http"
// Response stores the settings defined by the request handler
// of how it will respond the request back
type Response struct {
StatusCode int
BodyBuffer []byte
Header http.Header
}
// NewResponse creates a new Response
func NewResponse() *Response {
return &Response{
He... | package httpfake
import (
"encoding/json"
"fmt"
"net/http"
)
// Response stores the settings defined by the request handler
// of how it will respond the request back
type Response struct {
StatusCode int
BodyBuffer []byte
Header http.Header
}
// NewResponse creates a new Response
func NewResponse() *Respo... | Add support to register body from struct data | Add support to register body from struct data
| Go | mit | maxcnunes/httpfake |
3955c1ff2d1bc753f4294ad5f9ca5f32de69e454 | db.go | db.go | package main
import (
"fmt"
"html/template"
"os"
"time"
log "github.com/Sirupsen/logrus"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
type Sms struct {
ID int
Timestamp time.Time
From string
Message string `sql:"type:text"`
MessageHTML template.HTML `sql:"-" json:"-"`
Ha... | package main
import (
"fmt"
"html/template"
"os"
"time"
log "github.com/Sirupsen/logrus"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
type Sms struct {
ID int
Timestamp time.Time
From string
Message string `sql:"type:text"`
MessageHTML template.HTML `sql:"-" json:"-"`
Ha... | Fix for updated gorm library | Fix for updated gorm library
| Go | mit | Xiol/smslogger,Xiol/smslogger,Xiol/smslogger |
f9b7a631f2c745591d003917737747c635a28f2c | TestProgram/main.go | TestProgram/main.go | package main
import (
"fmt"
"github.com/msiebuhr/go-tag-test"
)
func main() {
fmt.Println(TagTest.Tag())
}
| package main
import (
"fmt"
"github.com/msiebuhr/go-tag-test" // Whatever is on master
//"github.com/msiebuhr/go-tag-test@master" // Ditto
//"github.com/msiebuhr/go-tag-test@v0.0.0" // Tag v0.0.0 / First release
//"github.com/msiebuhr/go-tag-test@v0.0.1" // Tag v0.0.1 / Second release
)
func main() {
fmt.Printl... | Include pre-made import statements in the test program. | Include pre-made import statements in the test program.
| Go | bsd-2-clause | msiebuhr/go-tag-test |
a647f7af6d4e3eac9fe85e6f6532e48ef60127f8 | integration_tests/go/src/call_c_from_go/main.go | integration_tests/go/src/call_c_from_go/main.go | package main
// #cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
// #include <mini-os/experimental.h>
import "C"
import "fmt"
//go:cgo_import_static test
//go:linkname test test
var test byte
func main() {}
//export Main
func Main(unused int) {
C.test()
fmt.Println("Hello World!")
}
| package main
// #cgo LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
// #include <mini-os/experimental.h>
import "C"
import "fmt"
func main() {}
//export Main
func Main(unused int) {
C.test()
fmt.Println("Hello World!")
}
| Remove unnecessary cgo directives from test | Remove unnecessary cgo directives from test
| Go | bsd-2-clause | unigornel/unigornel,unigornel/unigornel |
31a1efc4e81100349be820f1b06b44c60a00b8c9 | jira-ui/main.go | jira-ui/main.go | package main
import (
"os/exec"
"github.com/mikepea/go-jira-ui"
)
func resetTTY() {
cmd := exec.Command("reset")
_ = cmd.Run()
}
func main() {
defer resetTTY()
jiraui.Run()
}
| package main
import (
"fmt"
"os/exec"
"github.com/mikepea/go-jira-ui"
)
func resetTTY() {
cmd := exec.Command("reset")
_ = cmd.Run()
fmt.Println()
}
func main() {
defer resetTTY()
jiraui.Run()
}
| Add a newline on exit | Add a newline on exit
| Go | apache-2.0 | mikepea/go-jira-ui |
01fcd5cc5310c595f0adc05c47a9d38e3b28dae8 | go/src/cryptics/solver/transforms.go | go/src/cryptics/solver/transforms.go | package solver
import "cryptics/utils"
type transform func(string, int) map[string][]string
var TRANSFORMS = map[int]transform{
LIT: func(x string, l int) map[string][]string {
return map[string][]string{x: []string{}}
},
NULL: func(x string, l int) map[string][]string {
return map[string][]string{"": []strin... | package solver
import "cryptics/utils"
type transform func(string, int) map[string][]string
var TRANSFORMS = map[int]transform{
LIT: func(x string, l int) map[string][]string {
return map[string][]string{x: []string{}}
},
NULL: func(x string, l int) map[string][]string {
return map[string][]string{"": []strin... | Allow synonyms longer than the answer can be (since we may take substrings) | Allow synonyms longer than the answer can be (since we may take substrings)
| Go | mit | rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics |
c430095037bfc8bf4bb377c34d938745f4879b55 | exporter/newExporter.go | exporter/newExporter.go | package nessusExporter
import (
"database/sql"
"github.com/kkirsche/nessusControl/api"
"net/http"
)
// NewExporter returns a new exporter instance for use in exporting scan results
func NewExporter(apiClient *nessusAPI.Client, httpClient *http.Client, sqliteDB *sql.DB, fileLocations fileLocations, debug bool) *Exp... | package nessusExporter
import (
"database/sql"
"fmt"
"net/http"
"github.com/kkirsche/nessusControl/api"
)
// NewExporter returns a new exporter instance for use in exporting scan results
func NewExporter(apiClient *nessusAPI.Client, httpClient *http.Client, sqliteDB *sql.DB, baseDirectory string, debug bool) *Ex... | Modify the function signature to cover the other changes made to file locations | Modify the function signature to cover the other changes made to file locations
Signed-off-by: Kevin Kirsche <18695bc9b6a48cd25cda049e45c04495c905a059@gmail.com>
| Go | apache-2.0 | kkirsche/nessusControl |
3a3c0425eaacb1785d746ec8f2f41f128b69811c | monitor_test.go | monitor_test.go | package main
import (
"fmt"
"io/ioutil"
. "launchpad.net/gocheck"
"net/http"
"strings"
"time"
)
type MonitorSuite struct {
zones Zones
}
var _ = Suite(&MonitorSuite{})
func (s *MonitorSuite) SetUpSuite(c *C) {
s.zones = make(Zones)
fmt.Println("Starting http server")
zonesReadDir("dns", s.zones)
go htt... | package main
import (
"fmt"
"io/ioutil"
. "launchpad.net/gocheck"
"net/http"
"strings"
"time"
)
type MonitorSuite struct {
zones Zones
}
var _ = Suite(&MonitorSuite{})
func (s *MonitorSuite) SetUpSuite(c *C) {
s.zones = make(Zones)
*flaghttp = ":8881"
fmt.Println("Starting http server")
zonesReadDir("... | Use a different HTTP port number for testing | Use a different HTTP port number for testing
(I thought there was a function to find a free port, but I can't find it
or an easy way to get the port number back when listening to port 0)
| Go | apache-2.0 | anuaimi/geodns,abligh/geodns,anuaimi/geodns,abh/geodns,gofort/geodns,abligh/geodns,gofort/geodns,gofort/geodns,abligh/geodns,abh/geodns,anuaimi/geodns |
42168d8e25e0ebc3e1ba9a89ea5326d422d3c60e | generate/generate_test.go | generate/generate_test.go | package generate;
import (
"testing"
"unicode/utf8"
"github.com/ejcx/passgo/generate"
)
var generateTests = []struct {
n int // input
expected int // expected result
}{
{0, 24},
{-1, 24},
{5, 5},
{10, 10},
{1<<18, 24},
{1<<32-1, 24},
}
func TestGenerate(t *testing... | package generate
import (
"testing"
"unicode/utf8"
)
var generateTests = []struct {
n int // input
expected int // expected result
}{
{0, 24},
{-1, 24},
{5, 5},
{10, 10},
{1 << 18, 24},
{1<<32 - 1, 24},
}
func TestGenerate(t *testing.T) {
for _, tt := range generateTests {
actual := Generate(tt.n... | Fix generate test and gofmt | Fix generate test and gofmt
| Go | mit | ejcx/passgo,nicr9/passgo |
60b6ed7bf8c22107e407983043adfd59c1a7e5ab | workspace/document.go | workspace/document.go | package workspace
import "path/filepath"
// Document is a file in a directory.
type Document struct {
Root string
RelativePath string
}
// NewDocument creates a document from a relative filepath.
// The root is typically the root of the exercise, and
// path is the relative path to the file within the root... | package workspace
import "path/filepath"
// Document is a file in a directory.
type Document struct {
Root string
RelativePath string
}
// NewDocument creates a document from the filepath.
// The root is typically the root of the exercise, and
// path is the absolute path to the file.
func NewDocument(root... | Fix incorrect doc comment for NewDocument | Fix incorrect doc comment for NewDocument
| Go | mit | exercism/cli,exercism/cli |
633bd58ca5dde4729a773cb4e057630fe3992983 | main.go | main.go | package main
import (
"net"
"log"
"os"
"os/signal"
"syscall"
)
func signalHandler(signalChannel chan os.Signal, doneChannel chan bool){
// block the goroutine until we get a signal
signal := <-signalChannel
log.Printf("Got signal %v, exiting...\n", signal)
// Send the message to t... | package main
import (
"net"
"log"
"os"
"os/signal"
"syscall"
)
func signalHandler(signalChannel chan os.Signal, doneChannel chan bool){
// block the goroutine until we get a signal
signal := <-signalChannel
log.Printf("Got signal %v, exiting...\n", signal)
// Send the message to t... | Create the basic collector aggreation consumer | Create the basic collector aggreation consumer
| Go | mit | djt5019/garnet |
09ba5667a443723fb551918ed992462488cca7ff | snapshot.go | snapshot.go | package main
import (
"syscall"
"github.com/mistifyio/gozfs/nv"
)
func snapshot(zpool string, snapNames []string, props map[string]string) (map[string]int32, error) {
// snaps needs to be a map with the snap name as the key and an arbitrary value
snaps := make(map[string]string)
for _, snapName := range snapNam... | package main
import (
"syscall"
"github.com/mistifyio/gozfs/nv"
)
func snapshot(zpool string, snapNames []string, props map[string]string) (map[string]int32, error) {
// snaps needs to be a map with the snap name as the key and an arbitrary value
snaps := make(map[string]string)
for _, snapName := range snapNam... | Use constant for error number | Use constant for error number
| Go | mit | cerana/cerana,cerana/cerana,cerana/cerana,mistifyio/gozfs,cerana/cerana,mistifyio/gozfs,mistifyio/gozfs |
ea0ee41d7ac926e160eeac5410a0cd4a2a7ea9d3 | internal/config/config.go | internal/config/config.go | // Package config provides configuration primitives for Overlord
package config
import (
"os"
"path/filepath"
)
// DataDir returns the path to the Overlord data directory
func DataDir() (string, error) {
data, valid := os.LookupEnv("OVERLORD_DATA")
if !valid {
homedir, err := os.UserHomeDir()
if err != nil {... | // Package config provides configuration primitives for Overlord
package config
import (
"os"
"path/filepath"
)
// DataDir returns the path to the Overlord data directory
func DataDir() (string, error) {
data, valid := os.LookupEnv("OVERLORD_DATA")
if !valid {
homedir, err := os.UserHomeDir()
if err != nil {... | Fix DataDir to handle the case when the file doesn't exist | Fix DataDir to handle the case when the file doesn't exist
If the directory doesn't exist, EvalSymlinks returns an error and an
empty dir string, which will fail. This works around that by only
calling Abs in the success case.
| Go | mit | nirenjan/overlord |
534090a5aedbfe3f9e7d92b2a85607063627eb98 | lib/globalflags/globalflags.go | lib/globalflags/globalflags.go | // Copyright 2019 Google 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 ... | // Copyright 2019 Google 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 ... | Add a globalflag to disable audit logs | Add a globalflag to disable audit logs
audit logs may contains some sensitive information:
- Requester IP
- Token subject
- Token ID
If you want to disable audit log, you can use env
`export FEDERATED_ACCESS_DISABLE_AUDIT_LOG=true`
PiperOrigin-RevId: 294515600
Change-Id: Ifb5f2023b0903a01d7a3ce21f9b27045588a3063
| Go | apache-2.0 | GoogleCloudPlatform/healthcare-federated-access-services,GoogleCloudPlatform/healthcare-federated-access-services,GoogleCloudPlatform/healthcare-federated-access-services,GoogleCloudPlatform/healthcare-federated-access-services |
ac577eff0f5b3329434d45478305867be42c194d | device/parse_test.go | device/parse_test.go | package device
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParse(t *testing.T) {
t.Run("46540=>46.54", parseSuccess("46540", "46.54"))
t.Run("-46540=>-46.54", parseSuccess("-46540", "-46.54"))
t.Run("xxx=>Error", parseError("xxx"))
}
func parseSuccess(text, exp string) func(*testing.T) {... | package device
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParse(t *testing.T) {
t.Run("46540=>46.54", parseSuccess("46540", "46.54"))
t.Run("-46540=>-46.54", parseSuccess("-46540", "-46.541"))
t.Run("xxx=>Error", parseError("xxx"))
}
func parseSuccess(text, exp string) func(*testing.T) ... | Test fail test with travis. | Test fail test with travis.
| Go | mit | andreandradecosta/rpimonitor,andreandradecosta/rpimonitor |
15cc1e5fcebac5dfc5f94e3733dccd357867d0eb | xkcdfind.go | xkcdfind.go | package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/alessio/xkcdfind/xkcd"
)
func printResults(results []xkcd.Comic) {
for _, comic := range results {
fmt.Printf("%4d %-40s %s\n", comic.Num, comic.Title, comic.Img)
}
indexStats := fmt.Sprintf("%d results among %d comics, "+
"index stats: latest:#%d... | package main
import (
"flag"
"log"
"os"
"text/template"
"github.com/alessio/xkcdfind/xkcd"
)
const (
DefaultIndexFilename string = "index.json"
resultsTemplate = `{{range .}}{{.Num | printf "%4d"}} {{.Title | printf "%-40s"}} {{.Img}}
{{end}}{{. | len | printf "%4d"}} results
`
)
func printResult... | Use template for printing results, set a default value for index filename | Use template for printing results, set a default value for index filename
| Go | isc | alessio/xkcdfind |
e776ef625791e00d327f7eb8fcb6ebe537c769cc | fasta.go | fasta.go | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gofasta
import (
"strings"
"os"
"bufio"
"bytes"
)
type SeqRecord struct {
Id string
Seq string
}
func SimpleParser(file *os... | // Copyright 2015 Andrew E. Bruno. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gofasta
import (
"os"
"bufio"
"bytes"
)
type SeqRecord struct {
Id string
Seq string
}
func SimpleParser(file *os.File) chan *S... | Use bytes instead of strings | Use bytes instead of strings
| Go | mit | aebruno/gofasta |
c876f56737c5db4e0565a11ae244ebc029e721bb | server/missionary_test.go | server/missionary_test.go | package server
import "testing"
func TestResponse(t *testing.T) {
}
| package server
import "testing"
func TestMissionary(t *testing.T) {
}
| Rename dummy missionary test in order to avoid collision | Rename dummy missionary test in order to avoid collision
| Go | mit | WarCluster/warcluster-server,WarCluster/warcluster-server |
5508d1964ed91282c2c08621b70aef00ae8af1f9 | testing.go | testing.go | package emperror
// TestHandler throws every error away.
type TestHandler struct {
errors []error
}
// NewTestHandler returns a new TestHandler.
func NewTestHandler() Handler {
return &TestHandler{}
}
// Handle does the actual throwing away.
func (h *TestHandler) Handle(err error) {
h.errors = append(h.errors, er... | package emperror
// TestHandler throws every error away.
type TestHandler struct {
errors []error
}
// NewTestHandler returns a new TestHandler.
func NewTestHandler() *TestHandler {
return &TestHandler{}
}
// Handle does the actual throwing away.
func (h *TestHandler) Handle(err error) {
h.errors = append(h.error... | Fix test handler constructor return type | Fix test handler constructor return type
| Go | mit | goph/emperror,goph/emperror |
5bcf8ce88c248aee8a2271b1d91e5e024a71f544 | version.go | version.go | // Copyright 2014, Rogue Ethic, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... | // Copyright © 2014-2015 Christian R. Vozar
// MIT Licensed.
//
// Contributor(s):
// Christian Vozar (christian@rogueethic.com)
package main
// Version number. Follows the Semantic v2.0.0 versioning standard. http://semver.org/
const (
Version = "v1.0.2"
)
| Update Version; Copyright & License | Update Version; Copyright & License | Go | mit | christianvozar/itunes-hipchat-status |
c03e2acb2433bee5a403efbfcc6e576c64458f74 | metric_options.go | metric_options.go | package grpc_prometheus
import (
prom "github.com/prometheus/client_golang/prometheus"
)
type CounterOption func(opts *prom.CounterOpts)
type counterOptions []CounterOption
func (co counterOptions) apply(o prom.CounterOpts) prom.CounterOpts {
for _, f := range co {
f(&o)
}
return o
}
func WithConstLabels(lab... | package grpc_prometheus
import (
prom "github.com/prometheus/client_golang/prometheus"
)
// A CounterOption lets you add options to Counter metrics using With* funcs.
type CounterOption func(*prom.CounterOpts)
type counterOptions []CounterOption
func (co counterOptions) apply(o prom.CounterOpts) prom.CounterOpts {... | Add missing godoc strings (golint) | Add missing godoc strings (golint)
This fixes:
metric_options.go:7:6: exported type CounterOption should have comment or be unexported
metric_options.go:18:1: exported function WithConstLabels should have comment or be unexported
metric_options.go:24:6: exported type HistogramOption should have comment or be unexporte... | Go | apache-2.0 | grpc-ecosystem/go-grpc-prometheus,mwitkow/go-grpc-prometheus,grpc-ecosystem/go-grpc-prometheus |
e8c10476269fce8903785a1e93db0fd5b8f06c9e | handler_filter_test.go | handler_filter_test.go | package falcore
import (
"fmt"
"io/ioutil"
"net/http"
"testing"
)
func TestHandlerFilter(t *testing.T) {
reply := "Hello, World"
handler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, reply)
}
hff := NewHandlerFilter(http.HandlerFunc(handler))
tmp, _ := http.NewRequest("GET", "/hello", ... | package falcore
import (
"fmt"
"io/ioutil"
"net/http"
"testing"
)
func TestHandlerFilter(t *testing.T) {
reply := "Hello, World"
handler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, reply)
}
hff := NewHandlerFilter(http.HandlerFunc(handler))
tmp, _ := http.NewRequest("GET", "/hello", ... | Fix handler test with new TestWithRequest signature | Fix handler test with new TestWithRequest signature | Go | mit | ngmoco/falcore,dgrijalva/falcore,fitstar/falcore,fitstar/falcore |
6f6068d58385c0185c8a45bffc93ea7ea5d404bb | 2021/go-rest-servers/auth/basic-sample/tls-basic-auth.go | 2021/go-rest-servers/auth/basic-sample/tls-basic-auth.go | package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"
)
func main() {
addr := flag.String("addr", ":4000", "HTTPS network address")
certFile := flag.String("certfile", "cert.pem", "certificate PEM file")
keyFile := flag.String("keyfile", "key.pem", "key PEM file")
flag.Parse()
mux := http.NewSer... | package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"
)
func verifyUserPass(username, password string) bool {
if username == "joe" && password == "1234" {
return true
}
return false
}
func main() {
addr := flag.String("addr", ":4000", "HTTPS network address")
certFile := flag.String("certfile"... | Add basic auth parts, with single user/password for now | Add basic auth parts, with single user/password for now
| Go | unlicense | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog |
51f6ea9733e0df4a123b27448f58325e1a8bb8c4 | common/tools/configtxlator/metadata/metadata_test.go | common/tools/configtxlator/metadata/metadata_test.go | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package metadata_test
import (
"fmt"
"runtime"
"testing"
"github.com/hyperledger/fabric/common/tools/cryptogen/metadata"
"github.com/stretchr/testify/assert"
)
func TestGetVersionInfo(t *testing.T) {
testVersion := "TestVersio... | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package metadata_test
import (
"fmt"
"runtime"
"testing"
"github.com/hyperledger/fabric/common/tools/configtxlator/metadata"
"github.com/stretchr/testify/assert"
)
func TestGetVersionInfo(t *testing.T) {
testVersion := "TestVe... | Fix incorrect package in configtxlator | [FAB-4897] Fix incorrect package in configtxlator
UT reports 0% coverage because the test codes use incorrect package in
common/tools/configtxlator/metadata. This CR fixes it.
Change-Id: Ica7e3b9d4c659a5dc3bf6ec5ab53b0f59fb5358f
Signed-off-by: Jun Nemoto <0f36410cf31719a35aea513fdc960060bbf0aad2@hitachi.com>
Signed-o... | Go | apache-2.0 | lukehuangch/fabric,manish-sethi/fabric-sidedb,blockc/fabric,Ryan--Yang/fabric,lukehuangch/fabric,Ryan--Yang/fabric,kchristidis/fabric,Ryan--Yang/fabric,stemlending/fabric,kchristidis/fabric,thakkarparth007/fabric,manish-sethi/fabric-sidedb,hyperledger/fabric,binhn/fabric,cophey/fabric,xixuejia/fabric,binhn/fabric,kchri... |
212bdb7569711a30b60f806966e4b22e74954468 | softlayer/provider_test.go | softlayer/provider_test.go | package softlayer
import (
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders = map[s... | package softlayer
import (
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders = map[s... | Correct error message in provider test | Correct error message in provider test
| Go | mpl-2.0 | softlayer/terraform-provider-softlayer,softlayer/terraform-provider-softlayer |
48a75e0e38d60624571389bf95b0a2a16f5b4245 | xfrm_monitor_test.go | xfrm_monitor_test.go | // +build linux
package netlink
import (
"testing"
"github.com/vishvananda/netlink/nl"
)
func TestXfrmMonitorExpire(t *testing.T) {
defer setUpNetlinkTest(t)()
ch := make(chan XfrmMsg)
done := make(chan struct{})
defer close(done)
errChan := make(chan error)
if err := XfrmMonitor(ch, nil, errChan, nl.XFRM_... | // +build linux
package netlink
import (
"testing"
"github.com/vishvananda/netlink/nl"
)
func TestXfrmMonitorExpire(t *testing.T) {
defer setUpNetlinkTest(t)()
ch := make(chan XfrmMsg)
done := make(chan struct{})
defer close(done)
errChan := make(chan error)
if err := XfrmMonitor(ch, nil, errChan, nl.XFRM_... | Fix Race Condition in TestXfrmMonitorExpire | Fix Race Condition in TestXfrmMonitorExpire
| Go | apache-2.0 | paravmellanox/netlink,vishvananda/netlink |
57c13b6cee64250e4b101f91d357f5b5b9ad3ce5 | compiler/version_check.go | compiler/version_check.go | // +build go1.16
package compiler
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
)
// Version is the GopherJS compiler version string.
const Version = "1.16.1+go1.16.3"
// GoVersion is the current Go 1.x version that GopherJS is compatible with.
const GoVersion = 16
// CheckGoVersion check... | // +build go1.16
package compiler
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
)
// Version is the GopherJS compiler version string.
const Version = "1.16.2+go1.16.4"
// GoVersion is the current Go 1.x version that GopherJS is compatible with.
const GoVersion = 16
// CheckGoVersion check... | Increment GopherJS version to 1.16.2+go1.16.4 | Increment GopherJS version to 1.16.2+go1.16.4
| Go | bsd-2-clause | gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs |
a0874d7b1cebd4f0e42de5658ddd599e4b50467d | beam/verbs.go | beam/verbs.go | package beam
type Verb uint32
const (
Ack Verb = iota
Attach
Connect
Error
File
Get
Log
Ls
Set
Spawn
Start
Stop
Watch
)
| package beam
type Verb uint32
const (
Ack Verb = iota
Attach
Connect
Error
File
Get
Log
Ls
Set
Spawn
Start
Stop
Watch
)
func (v Verb) String() string {
switch v {
case Ack:
return "Ack"
case Attach:
return "Attach"
case Connect:
return "Connect"
case Error:
return "Error"
case File:
retu... | Add string representation of verb enum | Add string representation of verb enum
Docker-DCO-1.1-Signed-off-by: Ben Firshman <ben@firshman.co.uk> (github: bfirsh)
| Go | apache-2.0 | BSWANG/denverdino.github.io,jimmyxian/swarm,kyhavlov/swarm,rancher/swarm,bdwill/docker.github.io,mrjana/swarm,gdevillele/docker.github.io,johnstep/docker.github.io,marsmensch/swarm,EderRoger/swarm,NunoEdgarGub1/swarm,docker/docker.github.io,denverdino/docker.github.io,aluzzardi/swarm,rancher/swarm,vieux/swarm,pdevine/s... |
7e044fa6f007634cdfb1c3119d103af7755051ca | everyenv.go | everyenv.go | package main
import (
"fmt"
"github.com/mislav/everyenv/cli"
_ "github.com/mislav/everyenv/commands"
"os"
)
func main() {
cmdName := os.Args[1]
cmd := cli.Lookup(cmdName)
if cmd != nil {
cmd(os.Args[2:])
} else {
fmt.Printf("command not found: `%s`\n", cmdName)
os.Exit(1)
}
}
| package main
import (
"github.com/mislav/everyenv/cli"
_ "github.com/mislav/everyenv/commands"
"log"
"os"
)
func main() {
cmdName := os.Args[1]
cmd := cli.Lookup(cmdName)
if cmd != nil {
cmd(os.Args[2:])
} else {
log.Fatalf("command not found: `%s`\n", cmdName)
}
}
| Use `log.Fatal()` instead of manual `os.Exit()` | Use `log.Fatal()` instead of manual `os.Exit()`
| Go | mit | mislav/anyenv |
eac91ececabdc78448716ac3393407f95d33347c | generics.go | generics.go | package marogo
import "sync"
import "encoding/json"
import "net/http"
import "bytes"
import "fmt"
func MakeRequest(address string, method string, data interface{}) (*http.Response, error) {
address = API_URL + address
jsob, err := json.Marshal(data)
fmt.Print("%v\n", string(jsob))
if err != nil {
return nil, er... | package marogo
import "sync"
import "encoding/json"
import "net/http"
import "bytes"
import "fmt"
func MakeRequest(address string, method string, data interface{}, needsHeader bool) (*http.Response, error) {
address = API_URL + address
jsob, err := json.Marshal(data)
fmt.Print("%v\n", string(jsob))
if err != nil ... | Remove debuging add needed header | Remove debuging add needed header
| Go | mit | CentricWebEstate/maropostgo |
3391bf9d7610a1cb389e0d4023768fe0ada5d5ed | main_test.go | main_test.go | package yara
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
if r, err := Compile(`rule test : tag1 { meta: author = "Hilko Bengen" strings: $a = "abc" fullword condition: $a }`, nil); err != nil {
os.Exit(1)
} else if err = r.Save("testrules.yac"); err != nil {
os.Exit(1)
}
rc := m.Run()
os.Remove... | package yara
import (
"io/ioutil"
"log"
"os"
"testing"
)
var compiledTestRulesPath string
func TestMain(m *testing.M) {
r, err := Compile(`rule test : tag1 { meta: author = "Hilko Bengen" strings: $a = "abc" fullword condition: $a }`, nil)
if err != nil {
log.Fatalf("Compile: %v", err)
}
f, err := ioutil.... | Update tests to use a writable temp directory | Update tests to use a writable temp directory
Ensure that when compiling the sample rule, it's stored in a writable temp directory. | Go | bsd-2-clause | VirusTotal/go-yara,hillu/go-yara,hillu/go-yara |
6fc6051df671c52e0aeec24a96dbe2570e3af9cc | lib/billing/definition.go | lib/billing/definition.go | package billing
import (
"io"
"github.com/BytemarkHosting/bytemark-client/lib/output"
"github.com/BytemarkHosting/bytemark-client/lib/output/prettyprint"
)
// Definition is an admin-modifiable parameter for bmbilling
// examples include account-opening credit amount and trial length
type Definition struct {
ID ... | package billing
import (
"io"
"github.com/BytemarkHosting/bytemark-client/lib/output"
"github.com/BytemarkHosting/bytemark-client/lib/output/prettyprint"
)
// Definition is an admin-modifiable parameter for bmbilling
// examples include account-opening credit amount and trial length
type Definition struct {
ID ... | Fix prettyprint.Run line from prev commit | Fix prettyprint.Run line from prev commit
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
0205adcedb596312a68eb796e0ecd57e42b5bf75 | npc/json.go | npc/json.go | package npc
import (
"encoding/json"
)
func js(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
}
| package npc
import (
"encoding/json"
)
// Return JSON suitable for logging an API object.
func js(v interface{}) string {
// Get the raw JSON
a, _ := json.Marshal(v)
// Convert this back into a tree of key-value maps
var m map[string]interface{}
if err := json.Unmarshal(a, &m); err != nil {
// If that didn't ... | Trim the JSON logged for Kubernetes objects by weave-npc | Trim the JSON logged for Kubernetes objects by weave-npc
Remove things like "args" and "env" which bulk the logs, aren't
relevant to the function of weave-npc, and may include sensitive
information.
Use a black-list rather than a white-list because we can't be sure
what information will be necessary in future.
| Go | apache-2.0 | weaveworks/weave,weaveworks/weave,weaveworks/weave,weaveworks/weave |
18e7e70ecc692ddb6ea481b1aac0835bb288d596 | src/pkg/runtime/parlib/funcs.go | src/pkg/runtime/parlib/funcs.go | // Copyright 2013 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.
//
// +build akaros
package parlib
/*
#include <parlib.h>
#include <uthread.h>
#include <vcore.h>
#include <mcs.h>
#include <futex.h>
*/
import "C"
import "uns... | // Copyright 2013 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.
//
// +build akaros
package parlib
/*
#include <parlib.h>
#include <uthread.h>
#include <vcore.h>
#include <mcs.h>
#include <futex.h>
*/
import "C"
import "uns... | Update futex to allow timeouts to be passed | Update futex to allow timeouts to be passed
| Go | bsd-3-clause | klueska/go-akaros,klueska/go-akaros,klueska/go-akaros,klueska/go-akaros,klueska/go-akaros,klueska/go-akaros,klueska/go-akaros,klueska/go-akaros |
bfe8725f3a2a2786ba666d65098948daeb236850 | src/cloud-init/env/arg.go | src/cloud-init/env/arg.go | package env
import "fmt"
func FlattenArguments(argMap map[string]string) []string {
args := []string{}
for flag, value := range argMap {
argument := fmt.Sprintf(fmt.Sprintf("--%v=%v", flag, value))
args = append(args, argument)
}
return args
}
| package env
import (
"errors"
"fmt"
"reflect"
"strings"
)
var (
ErrFlagTagNotFound = errors.New("arg: given field doesn't have a `flag` tag")
)
// Uses reflection to retrieve the `flag` tag of a field.
// The value of the `flag` field with the value of the field is
// used to construct a POSIX long flag argumen... | Use reflection to flatten flag tags | Use reflection to flatten flag tags
| Go | apache-2.0 | maxamillion/flamingo,maxamillion/flamingo,tmrts/flamingo,rtnpro/flamingo,tmrts/flamingo |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.