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 |
|---|---|---|---|---|---|---|---|---|---|
4e9c8d2907b38876ee935cc4d48001e8269d9fd4 | server/controllers/websocket/handler.go | server/controllers/websocket/handler.go | package websocket
import(
"net/http"
"log"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
type WebSocketHandler struct {}
func NewWebSocketHandler() *WebSocketHandler {
return &WebSocketHandler{}
}
func ... | package websocket
import(
"net/http"
"log"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
type WebSocketHandler struct {}
type Data struct {
Id int `json:"id"`
Test interface{} `json:"test"`
}
func N... | Add json reader/writer for websocket connection | Add json reader/writer for websocket connection
| Go | bsd-3-clause | ipastushenko/simple-chat |
9f63fe35253102000bb68692b423f8e594f7ae51 | pkg/authorization/registry/util/attributes.go | pkg/authorization/registry/util/attributes.go | package util
import (
"strings"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authorization/authorizer"
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
)
// ToDefaultAuthorizationAttributes coerces Action to authorizer.Attributes.
func ToDefaultAuthorizatio... | package util
import (
"strings"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authorization/authorizer"
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
)
// ToDefaultAuthorizationAttributes coerces Action to authorizer.Attributes.
func ToDefaultAuthorizatio... | Return a pointer instead of a copy. | Return a pointer instead of a copy.
This will allow later to change upstream to use a pointer receiver
for this interface so that copies will stop happening.
Signed-off-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>
| Go | apache-2.0 | liangxia/origin,tnozicka/origin,akram/origin,jeremyeder/origin,liangxia/origin,liangxia/origin,JacobTanenbaum/origin,ryanj/origin,mrogers950/origin,jim-minter/origin,openshift/origin,ryanj/origin,xiuwang/origin,spadgett/origin,markllama/origin,nhr/origin,dobbymoodge/origin,miminar/origin,luciddreamz/origin,soltysh/orig... |
539fdb752f5cd88f5b1d12f6892adf722fe24786 | slack9gag.go | slack9gag.go | package slack9gag
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
fmt.Println("listening...")
}
func handler(w http.ResponseWriter, r *http.Request) {
// Read the Request Parameter "command"
command := r.FormValue("command")
if command == "/9gag" {
fmt.Fprint(w, "Hello World")
} el... | package main
import (
"fmt"
"net/http"
"os"
)
func main() {
http.HandleFunc("/", handler)
fmt.Println("listening...")
err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
if err != nil {
panic(err)
}
}
func handler(w http.ResponseWriter, r *http.Request) {
// Read the Request Parameter "command"
comman... | Change package name to main. Add ListenAndServ. | Change package name to main. Add ListenAndServ.
| Go | mit | jayeshsolanki93/slack9gag |
6e54d481b21c3f91953456c10de9f75a1bce7926 | _example/main.go | _example/main.go | package main
import (
"fmt"
"time"
"github.com/bgv/workerpool"
)
func main() {
// Number of workers, and Size of the job queue
pool := workerpool.New(10, 50)
// Release the resources after we finish
defer pool.Stop()
// create and submit 10 jobs to the pool
for i := 0; i < 100; i++ {
count := i
pool.J... | package main
import (
"fmt"
"time"
"github.com/bgv/workerpool"
)
func main() {
// Number of workers, and Size of the job queue
pool := workerpool.New(10, 50)
// create and submit 10 jobs to the pool
for i := 0; i < 100; i++ {
count := i
pool.JobQueue <- func() {
fmt.Printf("I am job! Number %d\n", co... | Remove double Stop() in the example causing deadlock | Remove double Stop() in the example causing deadlock
| Go | mit | bgv/workerpool |
09bb70a91fca004f8266151bdfcb2f8a7abed691 | cmds/util/callbrowser_windows.go | cmds/util/callbrowser_windows.go | package util
import (
"fmt"
"os"
"os/exec"
"strings"
"syscall"
)
func CallBrowser(url string) error {
fmt.Fprintf(os.Stderr, "Running a browser to open %s...\r\n", url)
var attr os.ProcAttr
attr.Sys = &syscall.SysProcAttr{HideWindow: false}
attr.Files = []*os.File{os.Stdin, os.Stdout, os.Stderr}
path, err... | package util
import (
"fmt"
"os"
"os/exec"
"strings"
"syscall"
)
func CallBrowser(url string) error {
fmt.Fprintf(os.Stderr, "Running a browser to open %s...\r\n", url)
var attr os.ProcAttr
attr.Sys = &syscall.SysProcAttr{HideWindow: false}
attr.Files = []*os.File{os.Stdin, os.Stdout, os.Stderr}
path, err... | Refactor the Windows CallBrowser slightly. | Refactor the Windows CallBrowser slightly.
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
c221fc168f807d4b53ea37127736027b3811cf2a | egpath/src/stm32/examples/nucleo-l476rg/blinky/main.go | egpath/src/stm32/examples/nucleo-l476rg/blinky/main.go | package main
import (
"delay"
"fmt"
"stm32/hal/gpio"
"stm32/hal/system"
"stm32/hal/system/timer/systick"
)
var led gpio.Pin
func init() {
system.Setup(-48, 6, 20, 0, 0, 2)
systick.Setup()
gpio.A.EnableClock(false)
led = gpio.A.Pin(5)
cfg := gpio.Config{Mode: gpio.Out, Speed: gpio.Low}
led.Setup(&cfg)
}... | package main
import (
"delay"
"fmt"
"stm32/hal/gpio"
"stm32/hal/system"
"stm32/hal/system/timer/systick"
)
var led gpio.Pin
func init() {
system.Setup(-48, 6, 20, 0, 0, 2) // 80 MHz (fastest for voltage Range 1).
//system.Setup(-4, 1, 26, 0, 0, 4) // 26 MHz (fastest for voltage Range 2).
systick.Setup()
g... | Fix unit for bus clock. | examples/nucleo-l476rg/blinky: Fix unit for bus clock.
| Go | bsd-3-clause | ziutek/emgo,ziutek/emgo,ziutek/emgo,ziutek/emgo |
c4544aef06a17f5d368db08118c747a31f2f53c0 | interlock/handler.go | interlock/handler.go | package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/ehazlett/interlock/plugins"
"github.com/samalba/dockerclient"
)
type (
EventHandler struct {
Manager *Manager
}
)
func NewEventHandler(mgr *Manager) *EventHandler {
return &EventHandler{
Manager: mgr,
}
}
func (l *EventHandler) Ha... | package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/ehazlett/interlock/plugins"
"github.com/samalba/dockerclient"
)
type (
EventHandler struct {
Manager *Manager
}
)
func NewEventHandler(mgr *Manager) *EventHandler {
return &EventHandler{
Manager: mgr,
}
}
func (l *EventHandler) Ha... | Fix crash when event Id is less than 12 chars | Fix crash when event Id is less than 12 chars
Was sometimes getting "slice bounds out of range".
May as well print out the whole thing in debug mode. This is
sometimes names instead of IDs depending on the event.
Signed-off-by: Ben Firshman <73675debcd8a436be48ec22211dcf44fe0df0a64@firshman.co.uk>
| Go | apache-2.0 | mbentley/interlock,aerospike/interlock,wr0ngway/interlock,vixns/interlock,mbentley/interlock,krishamoud/interlock,ehazlett/interlock,krishamoud/interlock,everett-toews/interlock,everett-toews/interlock,aerospike/interlock,vixns/interlock,wr0ngway/interlock |
130f896e2e3ca78e01794a174382e547ba23adc0 | core/ledger/kvledger/pkg_test.go | core/ledger/kvledger/pkg_test.go | /*
Copyright IBM Corp. 2016 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 agreed to in wri... | /*
Copyright IBM Corp. 2016 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 agreed to in wri... | Fix ledger test race condition | [FAB-9222] Fix ledger test race condition
There seems to be contention for a base ledger
directory used throughout the tests. This change
adds a random directory to the paths for tests in
the base package.
Change-Id: I25a9f4312cf0f4b55596d69e46ab0b4b07f0912c
Signed-off-by: Gari Singh <10008a422f4be611b73174084ba2f7f... | Go | apache-2.0 | muralisrini/fabric,xixuejia/fabric,xixuejia/fabric,hyperledger/fabric,manish-sethi/fabric-sidedb,manish-sethi/fabric,manish-sethi/fabric,binhn/fabric,jimthematrix/fabric,stemlending/fabric,muralisrini/fabric,manish-sethi/fabric-sidedb,jimthematrix/fabric,stemlending/fabric,manish-sethi/fabric-sidedb,muralisrini/fabric,... |
bf9b085cdbb0f7c5b194fabb546267b3858a31c6 | kvscheduler/internal/utils/conversions.go | kvscheduler/internal/utils/conversions.go | // Copyright (c) 2018 Cisco and/or its affiliates.
//
// 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 applicabl... | // Copyright (c) 2018 Cisco and/or its affiliates.
//
// 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 applicabl... | Print Empty proto message nicely. | Print Empty proto message nicely.
Signed-off-by: Milan Lenco <fd44239370131ad5b8cae55d5f197286407fee30@pantheon.tech>
| Go | apache-2.0 | ligato/cn-infra,ligato/cn-infra |
0a8f980f31c1139e45048cf704fb57dd1b000681 | util.go | util.go | package sofa
import (
"net/url"
"strings"
)
// FutonURL attempts to correctly convert any CouchDB path into a URL to be used to
// access the same documents through the Futon web GUI.
func (con *Connection) FutonURL(path string) url.URL {
patharr := strings.Split(strings.Trim(path, "/"), "/")
furl := con.URL("/"... | package sofa
import (
"net/url"
"strings"
)
// FutonURL attempts to correctly convert any CouchDB path into a URL to be used to
// access the same documents through the Futon web GUI.
func (con *Connection) FutonURL(path string) url.URL {
patharr := strings.Split(strings.Trim(path, "/"), "/")
furl := con.URL("/"... | Add a function to convert to normal Go booleans too | Add a function to convert to normal Go booleans too
| Go | mit | joelnb/sofa,joelnb/sofa |
7d4f73c5edec959fa2bec9391a19f0154b1455f0 | configuration.go | configuration.go | package main
import (
"encoding/json"
"fmt"
"github.com/imdario/mergo"
"io/ioutil"
)
// Configuration is the configuration type
type Configuration struct {
Environment
Environments map[string]Environment `json:"environments"`
}
// Load open, read and parse the given configuration file
func Load(filename string... | package main
import (
"encoding/json"
"fmt"
"github.com/imdario/mergo"
"io/ioutil"
)
// Configuration is the configuration type
type Configuration struct {
Environment
Environments map[string]Environment `json:"environments"`
}
// Load open, read and parse the given configuration file
func Load(filename string... | Refactor the Configuration.Env function to be easier to understand | Refactor the Configuration.Env function to be easier to understand
| Go | unlicense | elwinar/rambler,rsterbin/rambler |
3b76f82d47732f6d9378ade276b32a1488c01a7f | server/links.go | server/links.go | package server
import (
"errors"
"net/url"
)
type getExternalLinksResponse struct {
StatusFeed *string `json:"statusFeed,omitempty"` // Location of the a JSON Feed for client's Status page News Feed
CustomLinks []CustomLink `json:"custom,omitempty"` // Any custom external links for client's User menu
}
... | package server
import (
"errors"
"net/url"
)
type getExternalLinksResponse struct {
StatusFeed *string `json:"statusFeed,omitempty"` // Location of the a JSON Feed for client's Status page News Feed
CustomLinks []CustomLink `json:"custom,omitempty"` // Any custom external links for client's User menu
}
... | Remove omitempty from CustomLink definition since should never b | Remove omitempty from CustomLink definition since should never b
| Go | mit | influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,nooproblem/influxdb,nooproblem/influxdb,influxdata/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,li-ang/influxdb,influxdb/influxdb,nooproblem/influxdb,influxdb/influxdb,influxdata/i... |
da43f34f3d2a5b7417f72e36d0a137674a282764 | src/bosh-softlayer-cpi/softlayer/common/agent_options.go | src/bosh-softlayer-cpi/softlayer/common/agent_options.go | package common
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type AgentOptions struct {
// e.g. "https://user:password@127.0.0.1:4321/agent"
Mbus string
// e.g. ["0.us.pool.ntp.org"]. Ok to be empty
NTP []string
Blobstore BlobstoreOptions
//vcap password
VcapPassword string
}
type Registr... | package common
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type AgentOptions struct {
// e.g. "https://user:password@127.0.0.1:4321/agent"
Mbus string
// e.g. ["0.us.pool.ntp.org"]. Ok to be empty
NTP []string
Blobstore BlobstoreOptions
//The SHA-512 encrypted vcap password
VcapPassword ... | Update the comment for VcapPassword | Update the comment for VcapPassword
| Go | apache-2.0 | mattcui/bosh-softlayer-cpi-release,maximilien/bosh-softlayer-cpi,maximilien/bosh-softlayer-cpi,mattcui/bosh-softlayer-cpi-release,mattcui/bosh-softlayer-cpi-release,mattcui/bosh-softlayer-cpi-release |
b63844bcb5922c6683451a392c732bd00f918d2b | engine/engine.go | engine/engine.go | package engine
import (
"archive/tar"
"bytes"
"io"
)
type Stream struct {
io.ReadCloser
Size int64
}
func NewStream(data io.ReadCloser, size int64) Stream {
return Stream{data, size}
}
func (s Stream) Out(dst io.Writer) error {
defer s.Close()
if _, err := io.CopyN(dst, s, s.Size); err != nil {
return err... | package engine
import (
"archive/tar"
"bytes"
"errors"
"io"
)
type Stream struct {
io.ReadCloser
Size int64
closed bool
}
func NewStream(data io.ReadCloser, size int64) Stream {
return Stream{data, size, false}
}
func (s *Stream) Out(dst io.Writer) error {
if s.closed {
return errors.New("closed")
}
... | Add close method to stream | Add close method to stream
| Go | apache-2.0 | sclevine/forge,sclevine/forge |
5771db66969f42b3e04ddc2c01f6fc9a808ef1d6 | addrs/input_variable.go | addrs/input_variable.go | package addrs
import (
"fmt"
)
// InputVariable is the address of an input variable.
type InputVariable struct {
referenceable
Name string
}
func (v InputVariable) String() string {
return "var." + v.Name
}
// AbsInputVariableInstance is the address of an input variable within a
// particular module instance.
t... | package addrs
import (
"fmt"
)
// InputVariable is the address of an input variable.
type InputVariable struct {
referenceable
Name string
}
func (v InputVariable) String() string {
return "var." + v.Name
}
// AbsInputVariableInstance is the address of an input variable within a
// particular module instance.
t... | Fix infinite recursion in AbsInputVariableInstance.String | addrs: Fix infinite recursion in AbsInputVariableInstance.String
| Go | mpl-2.0 | pryorda/terraform,VladRassokhin/terraform,pdecat/terraform,pryorda/terraform,ewbankkit/terraform,heimweh/terraform,tommynsong/terraform,VladRassokhin/terraform,VladRassokhin/terraform,apparentlymart/terraform,tommynsong/terraform,pdecat/terraform,hashicorp/terraform,heimweh/terraform,ewbankkit/terraform,hashicorp/terra... |
d542fa996f4dcd62cc81289b4a3e8f7066c84b64 | examples/seed-stream/main.go | examples/seed-stream/main.go | package main
import (
"bufio"
"fmt"
"os"
"github.com/harlow/kinesis-connectors"
"github.com/joho/godotenv"
"github.com/sendgridlabs/go-kinesis"
)
func main() {
godotenv.Load()
// Initialize Kinesis client
auth := kinesis.NewAuth()
ksis := kinesis.New(&auth, kinesis.Region{})
// Create stream
connector.... | package main
import (
"bufio"
"fmt"
"os"
"sync"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kinesis"
)
// Note: download file with test data
// curl https://s3.amazonaws.com/kinesis.test/users.txt -o /tmp/users.txt
func main() {
wg := &sync.Wait... | Use AWS SDK and concurrency | Use AWS SDK and concurrency
| Go | mit | harlow/kinesis-connectors |
8bf0cb99cb56fa9d59f13fa48875d579215c6591 | btrfs.go | btrfs.go | package main
import (
"os"
"os/exec"
)
const (
// BtrfsCommand is the name of the btrfs command-line tool binary.
BtrfsCommand = "btrfs"
)
// Snapshot creates a Btrfs snapshot of src at dst, optionally making
// it writable. If dst already exists, the snapshot is not created and
// an error is returned.
func Sna... | package main
import (
"fmt"
"os"
"os/exec"
)
const (
// BtrfsCommand is the name of the btrfs command-line tool binary.
BtrfsCommand = "btrfs"
)
// Snapshot creates a Btrfs snapshot of src at dst, optionally making
// it writable. If dst already exists, the snapshot is not created and
// an error is returned.
f... | Make Snapshot() actually check for an existing destination as documented. | Make Snapshot() actually check for an existing destination as documented.
| Go | mit | DeedleFake/yabs |
3d8727d1e374af101c3f8be8514f33865cc698ff | service/scraper/bucket.go | service/scraper/bucket.go | package scraperService
import (
"math/rand"
"net"
"github.com/ewhal/nyaa/model"
)
const InitialConnectionID = 0x41727101980
type Bucket struct {
Addr net.Addr
transactions map[uint32]*Transaction
}
func (b *Bucket) NewTransaction(swarms []model.Torrent) (t *Transaction) {
id := rand.Uint32()
// get ... | package scraperService
import (
"math/rand"
"net"
"github.com/ewhal/nyaa/model"
)
const InitialConnectionID = 0x41727101980
type Bucket struct {
Addr net.Addr
transactions map[uint32]*Transaction
}
func (b *Bucket) NewTransaction(swarms []model.Torrent) (t *Transaction) {
id := rand.Uint32()
// get ... | Revert "fix infinite loop shit" | Revert "fix infinite loop shit"
This reverts commit 1d8ba05d098e334388a9244dc7a0de4e3ffc6ae0.
| Go | mit | ElegantMonkey/nyaa,majestrate/nyaa,kipukun/nyaa,steindornatorinn/nyaa,yueou/nyaa,ElegantMonkey/nyaa,Nutjob/nyaa,Nutjob/nyaa,Nutjob/nyaa,ipatrol/nyaa,yueou/nyaa,moose65468/nyaa,steindornatorinn/nyaa,kipukun/nyaa,NyaaPantsu/nyaa,moose65468/nyaa,moose65468/nyaa,moose65468/nyaa,majestrate/nyaa,steindornatorinn/nyaa,ipatrol... |
b57a46492faa9cf590f0b41086e310a0c977537d | src/util/json.go | src/util/json.go | package util
import (
"encoding/json"
"io"
)
// DecodeJSON decodes json
func DecodeJSON(src io.Reader, dst interface{}) error {
decoder := json.NewDecoder(src)
err := decoder.Decode(dst)
return err
}
// EncodeJSON encodes json
func EncodeJSON(dst io.Writer, src interface{}) error {
encoder := json.NewEncoder(d... | package util
import (
"encoding/json"
"io"
)
// DecodeJSON decodes json
func DecodeJSON(src io.Reader, dst interface{}) error {
decoder := json.NewDecoder(src)
err := decoder.Decode(dst)
return err
}
// EncodeJSON encodes json
func EncodeJSON(dst io.Writer, src interface{}) error {
encoder := json.NewEncoder(d... | Fix message written to by util function | Fix message written to by util function
| Go | mit | NaExpire/API |
e39a4f111b95a17c5b40afe33771017a52a3f8cb | root_action_test.go | root_action_test.go | package horizon
import (
. "github.com/smartystreets/goconvey/convey"
"github.com/stellar/go-horizon/test"
"github.com/zenazn/goji/web"
"net/http"
"net/http/httptest"
"testing"
)
func TestRootAction(t *testing.T) {
Convey("GET /", t, func() {
test.LoadScenario("base")
app := NewTestApp()
r, _ := http.N... | package horizon
import (
. "github.com/smartystreets/goconvey/convey"
"github.com/stellar/go-horizon/test"
"testing"
)
func TestRootAction(t *testing.T) {
Convey("GET /", t, func() {
test.LoadScenario("base")
app := NewTestApp()
rh := NewRequestHelper(app)
w := rh.Get("/", test.RequestHelperNoop)
So(... | Use test.RequestHelper in root action test | Use test.RequestHelper in root action test
| Go | apache-2.0 | irisli/horizon,irisli/horizon,stellar/horizon,masonforest/go-horizon,nullstyle/go-horizon,masonforest/horizon,masonforest/go-horizon,FredericHeem/go-horizon,lackac/horizon,lackac/horizon,lackac/horizon,irisli/horizon,FredericHeem/go-horizon,masonforest/go-horizon,masonforest/horizon,stellar/horizon,nullstyle/go-horizon... |
d6f916303eba4957b5c5708457513266df4d917a | translations/french_test.go | translations/french_test.go | package translations_test
import (
"github.com/XenoPhex/jibber_jabber"
// . "github.com/cloudfoundry-incubator/cf-test-helpers/cf"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("i18n support and language detection", func() {
BeforeEach(func() {
userLocale, err := jibber_jabber.Detec... | package translations_test
import (
"github.com/XenoPhex/jibber_jabber"
. "github.com/cloudfoundry-incubator/cf-test-helpers/cf"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("i18n support and language detection", func() {
BeforeEach(func() {
userLo... | Add a simple assertion for the quota command in french | Add a simple assertion for the quota command in french
[#71979494]
| Go | unknown | cloudfoundry/GATS,cloudfoundry/GATS,cloudfoundry/GATS,cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests |
91d71c1963c50743d1dea5395c87561983171b97 | receiver/compose_file_test.go | receiver/compose_file_test.go | package main
import (
"os"
"path/filepath"
"testing"
)
func TestIsVersion2(t *testing.T) {
workingDir, _ := os.Getwd()
v1FilePath := filepath.Join(workingDir, "fixtures", "docker-compose-v1.yml")
v1ComposeFile, _ := NewComposeFile(v1FilePath)
if v1ComposeFile.IsVersion2() {
t.Fatalf(v1FilePath + " is actua... | package main
import (
"os"
"path/filepath"
"testing"
)
var (
V1FilePath, V2FilePath string
V1ComposeFile, V2ComposeFile *ComposeFile
)
func setup() {
workingDir, _ := os.Getwd()
V1FilePath = filepath.Join(workingDir, "fixtures", "docker-compose-v1.yml")
V2FilePath = filepath.Join(workingDir, "fixtures... | Define setup function in test | Define setup function in test
| Go | mit | dtan4/paus-gitreceive,dtan4/paus-gitreceive,dtan4/paus-gitreceive,dtan4/paus-gitreceive |
1c86598206ddb259fb9bc3e404114bc53731743f | cmd/notify/main.go | cmd/notify/main.go | package main
import (
"flag"
"fmt"
"os"
"github.com/ciarand/notify"
)
var (
text *string
title *string
subtitle *string
sound *string
)
func init() {
text = flag.String("text", "", "The required text for the notification")
title = flag.String("title", "", "The required title of the notification"... | package main
import (
"flag"
"fmt"
"os"
"github.com/ciarand/notify"
)
var (
text *string
title *string
subtitle *string
sound *string
)
func init() {
text = flag.String("text", "", "The required text for the notification")
title = flag.String("title", "", "The required title of the notification"... | Update cmd/notify with new API (Display not Show) | Update cmd/notify with new API (Display not Show)
| Go | isc | ciarand/notify |
a74865de5f131954256681125261ae21ba9673f1 | command/operator_autopilot.go | command/operator_autopilot.go | package command
import (
"strings"
"github.com/mitchellh/cli"
)
type OperatorAutopilotCommand struct {
Meta
}
func (c *OperatorAutopilotCommand) Run(args []string) int {
return cli.RunResultHelp
}
func (c *OperatorAutopilotCommand) Synopsis() string {
return "Provides tools for modifying Autopilot configurati... | package command
import (
"strings"
"github.com/mitchellh/cli"
)
type OperatorAutopilotCommand struct {
Meta
}
func (c *OperatorAutopilotCommand) Run(args []string) int {
return cli.RunResultHelp
}
func (c *OperatorAutopilotCommand) Synopsis() string {
return "Provides tools for modifying Autopilot configurati... | Add link to autopilot guide in operator autopilot CLI help text | Add link to autopilot guide in operator autopilot CLI help text
| Go | mpl-2.0 | nak3/nomad,dvusboy/nomad,hashicorp/nomad,hashicorp/nomad,burdandrei/nomad,hashicorp/nomad,nak3/nomad,burdandrei/nomad,dvusboy/nomad,burdandrei/nomad,nak3/nomad,dvusboy/nomad,burdandrei/nomad,nak3/nomad,dvusboy/nomad,dvusboy/nomad,nak3/nomad,burdandrei/nomad,dvusboy/nomad,hashicorp/nomad,burdandrei/nomad,hashicorp/nomad... |
1ae31463f5f9a24311b8a65057ffc3461abdf1bd | quotas/crud_test.go | quotas/crud_test.go | package quotas_test
import(
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
. "github.com/pivotal-cf-experimental/cf-test-helpers/cf"
)
var _ = Describe("CF Quota commands", func() {
It("can Create, Read, Update, and Delete quotas", func()... | package quotas_test
import(
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
. "github.com/pivotal-cf-experimental/cf-test-helpers/cf"
)
var _ = Describe("CF Quota commands", func() {
It("can Create, Read, Update, and Delete quotas", func()... | Add a test for the 'cf quota $QUOTA_NAME' command | Add a test for the 'cf quota $QUOTA_NAME' command
| Go | unknown | cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests,cloudfoundry/GATS,cloudfoundry/GATS,cloudfoundry/GATS |
de7434595e538eaad5408277add41eef13b4a2d0 | app/models/word.go | app/models/word.go | package models
type Word struct {
Romaji string
Common bool
Dialects []string
Fields []string
Glosses []Gloss
English []string
EnglishHL []string // highlighted english
Furigana string
FuriganaHL string // highlighted furigana
Japanese string
JapaneseHL string // highlighted japanes... | package models
import (
"github.com/gojp/nihongo/app/helpers"
"regexp"
"strings"
)
type Word struct {
Romaji string
Common bool
Dialects []string
Fields []string
Glosses []Gloss
English []string
EnglishHL []string // highlighted english
Furigana string
FuriganaHL string // highlight... | Add HighlightQuery to Word model | Add HighlightQuery to Word model
| Go | mit | shawnps/nihongo,gojp/nihongo,shawnps/nihongo,shawnps/nihongo,gojp/nihongo,shawnps/nihongo,gojp/nihongo,gojp/nihongo |
6978577fdf63f3f02ca9c3ac842abab583811f93 | symmetric.go | symmetric.go | package bletchley
import (
"crypto/aes"
"crypto/cipher"
)
const (
symmetricNonceLength = 12
symmetricKeyLength = 32
)
// We are allowed to use an empty nonce because we never re-use keys
// see Section 8.2.1 of NIST Special Publication 800-38D
// http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pd... | package bletchley
import (
"crypto/aes"
"crypto/cipher"
)
const (
symmetricNonceLength = 12
symmetricKeyLength = 32
)
// We are allowed to use an empty nonce because we never re-use keys
// see Section 8.2.1 of NIST Special Publication 800-38D
// http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pd... | Consolidate creation of AES-GCM cipher mode into a single function | Consolidate creation of AES-GCM cipher mode into a single function
| Go | mit | pivotal-cf-experimental/bletchley |
fbcadc864aec621e64895f6ba4b2f3eb9c7102d9 | shared/io_throttler/copy.go | shared/io_throttler/copy.go | package io_throttler
import (
"fmt"
"io"
"io/ioutil"
"github.com/efarrer/iothrottler"
)
//CopyThrottled does a normal io.Copy but with throttling
func CopyThrottled(bandwidth iothrottler.Bandwidth, dest io.Writer, src io.Reader) (written int64, returnErr error) {
pool := iothrottler.NewIOThrottlerPool(bandwidt... | package io_throttler
import (
"fmt"
"io"
"io/ioutil"
"github.com/efarrer/iothrottler"
)
//CopyThrottled does a normal io.Copy but with throttling
func CopyThrottled(bandwidth iothrottler.Bandwidth, dest io.Writer, src io.Reader) (written int64, returnErr error) {
pool := iothrottler.NewIOThrottlerPool(bandwidt... | Fix bug in previous commit | Fix bug in previous commit
| Go | mit | golang-devops/go-psexec |
b4571a99d363aa2239451e516b21a18d6b83603b | rtfblog.go | rtfblog.go | package main
import (
"github.com/hoisie/mustache"
"github.com/hoisie/web"
"github.com/russross/blackfriday"
"io/ioutil"
"log"
"os"
)
type Entry struct {
Title string
Body string
}
func handler(ctx *web.Context, path string) {
if path == "" {
var data = []Entry {
... | package main
import (
"github.com/hoisie/mustache"
"github.com/hoisie/web"
"github.com/russross/blackfriday"
"io/ioutil"
"log"
"os"
)
type Entry struct {
Title string
Body string
}
func handler(ctx *web.Context, path string) {
if path == "" {
var data = []Entry {
... | Split chained functions, to ease debugging | Split chained functions, to ease debugging
| Go | bsd-2-clause | rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog |
b1c39e28adb6d566b154f8c1d4cc747930d8d8fd | handlers/parser.go | handlers/parser.go | package handlers
import (
"io"
"encoding/json"
"strings"
"strconv"
"math/rand"
"time"
"github.com/nelsonleduc/calmanbot/handlers/models"
)
func ParseJSON(bytes []byte, path string) string {
var stuff interface{}
json.Unmarshal(bytes, &stuff)
elements := strings.Split(path, "... | package handlers
import (
"io"
"encoding/json"
"strings"
"strconv"
"math/rand"
"time"
"github.com/nelsonleduc/calmanbot/handlers/models"
)
func ParseJSON(bytes []byte, path string) string {
var stuff interface{}
json.Unmarshal(bytes, &stuff)
elements := strings.Split(path, "... | Fix crash with empty array | Fix crash with empty array
| Go | mit | NelsonLeDuc/CalmanBot,NelsonLeDuc/CalmanBot |
6d1edf4e732228c3f30570cf834e2239819c24f2 | commands/query.go | commands/query.go | package commands
func LocalSearch(packages []string) error {
return run("apt-cache", "pkgnames", nil)
}
| package commands
func LocalSearch(packages []string) error {
packages = append(packages, `""`) //Trick to prevent barking on empty input. Will give a quoted empty string to grep so it shows everything
return run("bash", "-c", []string{"dpkg --get-selections | grep " + packages[0]})
}
| Correct -Q to actually only show local packages. | Correct -Q to actually only show local packages.
| Go | cc0-1.0 | LaPingvino/jogurto |
7800bb6a249e4c4621e00110b8e13ebbb0743d07 | duexample.go | duexample.go | package main
import (
"fmt"
"github.com/ricochet2200/go-disk-usage/du"
)
var KB = uint64(1024)
func main() {
usage := du.NewDiskUsage("C:\\")
fmt.Println("Free:", usage.Free()/(KB*KB))
fmt.Println("Available:", usage.Available()/(KB*KB))
fmt.Println("Size:", usage.Size()/(KB*KB))
fmt.Println("Used:", usage.Us... | package main
import (
"fmt"
"github.com/ricochet2200/go-disk-usage/du"
)
var KB = uint64(1024)
func main() {
usage := du.NewDiskUsage("C:\\")
fmt.Println("Free:", usage.Free()/(KB*KB))
fmt.Println("Available:", usage.Available()/(KB*KB))
fmt.Println("Size:", usage.Size()/(KB*KB))
fmt.Println("Used:", usage.Us... | Print usage as a percentage | Print usage as a percentage
| Go | unlicense | ricochet2200/go-disk-usage,d4l3k/go-disk-usage |
4b21e735188370b9e328df073956c419af79d27d | useragent.go | useragent.go | package main
import (
"net/http"
"strings"
)
var (
// Whitelist crawlers here
crawlerPatterns = [...]string{
"Googlebot",
"bingbot",
"MSNbot",
"facebookexternalhit",
"PlurkBot",
}
)
func isCrawlerUserAgent(r *http.Request) bool {
ua := r.UserAgent()
for _, pattern := range crawlerPatterns {
if st... | package main
import (
"net/http"
"strings"
)
var (
// Whitelist crawlers here
crawlerPatterns = [...]string{
"Googlebot",
"bingbot",
"MSNbot",
"facebookexternalhit",
"PlurkBot",
"Twitterbot",
}
)
func isCrawlerUserAgent(r *http.Request) bool {
ua := r.UserAgent()
for _, pattern := range crawlerPa... | Add Twitterbot to crawler list | Add Twitterbot to crawler list
| Go | mit | ptt/pttweb |
ff0f254222e62593e9af7c92f3b80da7135cb20c | example/types.go | example/types.go | package example
//go:generate govariant -exhaust true Shape Circle Rectangle
type Cirlce struct {
Center Point
Radius float64
}
type Rectangle struct {
LowerLeft Point
Width, Height float64
}
type Point struct {
X, Y float64
}
| package example
//go:generate govariant -exhaust true Shape Circle Rectangle
type Circle struct {
Center Point
Radius float64
}
type Rectangle struct {
LowerLeft Point
Width, Height float64
}
type Point struct {
X, Y float64
}
| Fix typo in type name | Fix typo in type name
| Go | mpl-2.0 | szabba/govariant |
ea4fc2697902b77eaf2a8e62771da71dacbd2972 | simplehash.go | simplehash.go | package gash
// A simple chained hash.
type SimpleHash struct {
items [][]*KvPair
capacity int
}
func CreateSimpleHash(capacity int) SimpleHash {
table := SimpleHash{}
table.capacity = capacity
table.items = make([][]*KvPair, capacity)
for index := range table.items {
table.items[inde... | package gash
// A simple chained hash.
type SimpleHash struct {
items [][]*KvPair
capacity int
fn HashFn
}
func CreateSimpleHash(capacity int, fn HashFn) SimpleHash {
table := SimpleHash{}
table.capacity = capacity
table.items = make([][]*KvPair, capacity)
for index := range table.items {... | Add ability to set hashing function in SimpleHash | Add ability to set hashing function in SimpleHash
| Go | mit | elvinyung/gash |
5ecc1ac3effa43b8bd713070c9a81342243e6571 | buildpackrunner/dea_staging_info.go | buildpackrunner/dea_staging_info.go | package buildpackrunner
// Used to generate YAML file read by the DEA
type DeaStagingInfo struct {
DetectedBuildpack string `json:"detected_buildpack",yaml:"detected_buildpack"`
StartCommand string `json:"start_command",yaml:"start_command"`
}
| package buildpackrunner
// Used to generate YAML file read by the DEA
type DeaStagingInfo struct {
DetectedBuildpack string `json:"detected_buildpack" yaml:"detected_buildpack"`
StartCommand string `json:"start_command" yaml:"start_command"`
}
| Correct field tags so go-yaml can read the struct | Correct field tags so go-yaml can read the struct
Signed-off-by: Anna Thornton <0e9b4a17e1cf85a71a11118ecdbc866e5f8ffc65@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/buildpack_app_lifecycle,cloudfoundry-incubator/buildpack_app_lifecycle |
008987952df156f1574f15e44344f6033ce4b28a | crawl/sentiment.go | crawl/sentiment.go | package crawl
type AnalyzeSentiment interface {
GetScoreForTweet(tweet string) int
}
| /*
Package for crawling for tweets, getting their sentiment score, and writing them
to the database.
*/
package crawl
// The interface for retrieving the sentiment score of a tweet.
type SentimentAnalyzer interface {
GetScoreForTweet(tweet string) int
}
// Provide a mock Dao for unit tests of files that depend on a ... | Update the SentimentAnalyzer interface and provide a mock | Update the SentimentAnalyzer interface and provide a mock
| Go | mit | arianht/meantweets,arianht/meantweets,arianht/meantweets,arianht/meantweets,arianht/meantweets |
9ff702b9a146c02b90df58e558cafde0d398debe | cmd/containerd-shim-runc-v1/main.go | cmd/containerd-shim-runc-v1/main.go | // +build linux
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... | // +build linux
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... | Fix a typo in runc-v1 shim | Fix a typo in runc-v1 shim
Signed-off-by: Justin Terry (VM) <f0c38945ef01caad6a7c3d4b90a29703264b34a4@microsoft.com>
| Go | apache-2.0 | kunalkushwaha/containerd,dmcgowan/containerd,thaJeztah/containerd,estesp/containerd,dmcgowan/containerd,vdemeester/containerd,containerd/containerd,kunalkushwaha/containerd,crosbymichael/containerd,mikebrow/containerd,miaoyq/containerd,crosbymichael/containerd,estesp/containerd,thaJeztah/containerd,vdemeester/container... |
2d65002b593899a225f18e239ce6991c677ff69e | main.go | main.go | /*
Fresh is a command line tool that builds and (re)starts your web application everytime you save a go or template file.
If the web framework you are using supports the Fresh runner, it will show build errors on your browser.
It currently works with Traffic (https://github.com/pilu/traffic), Martini (https://github.... | /*
Fresh is a command line tool that builds and (re)starts your web application everytime you save a go or template file.
If the web framework you are using supports the Fresh runner, it will show build errors on your browser.
It currently works with Traffic (https://github.com/pilu/traffic), Martini (https://github.... | Support -a command line arguments | Support -a command line arguments
For supporting and commandline arugment to pass to the binary
there is a new '-a' option. Also my editor autoformats to
gofmt so these files are cleaned up with the standarde format.
| Go | mit | lateefj/fresh |
e557bbc61fca084ebbb4d948000e2394047244b8 | main.go | main.go | package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, world!")
}
| package main
import (
"fmt"
"github.com/jessevdk/go-flags"
"os"
)
func main() {
var opts struct {
Name string `short:"n" long:"name" description:"Name to greet" default:"world"`
}
parser := flags.NewParser(&opts, flags.Default)
parser.Usage = "[options]"
if _, err := parser.Parse(); err != nil {
fmt.Fpri... | Add command option for name | Add command option for name
| Go | mit | jackc/go-hello,jackc/go-hello |
8f19f346309b3ef383d4d9c6e7f4768fd02fbd48 | main.go | main.go | // Benchmark parallel downloading and combination of some pdf files.
package main
import (
"pdfcombiner/combiner"
"net/http"
"net/url"
"fmt"
)
// Validate that the required URL params are present and correct.
func check_params(params map[string] []string ) (docs []string, callback string, ok bool) {
callbac... | // Benchmark parallel downloading and combination of some pdf files.
package main
import (
"pdfcombiner/combiner"
"net/http"
"net/url"
"fmt"
)
// Validate that the required URL params are present and correct.
func check_params(params map[string] []string ) (docs []string, callback string, ok bool) {
callbac... | Rename some handler methods for clarity | Rename some handler methods for clarity
| Go | mit | PeopleAdmin/pdfcombiner,PeopleAdmin/pdfcombiner,PeopleAdmin/pdfcombiner |
ce8f5550040fae19ab44214004afb7508c0a650c | client_test.go | client_test.go | package cas
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
)
func TestLearnHttpTestServer(t *testing.T) {
expected := "Hello, client"
url, _ := url.Parse("https://cas.host")
client := NewClient(&Options{
URL: url,
})
ts := httptest.NewServer(client.HandleFunc(f... | package cas
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
)
func TestLearnHttpTestResponseRecorder(t *testing.T) {
expected := "Hello, client"
url, _ := url.Parse("https://cas.host")
client := NewClient(&Options{
URL: url,
})
handler := client.HandleFunc(func(... | Remove httptest.Server test example, will use ResponseRecorder. | Remove httptest.Server test example, will use ResponseRecorder.
| Go | mit | yp-engineering/cas,go-cas/cas |
dcac83ec49ec4af6f563ff585858935c8aa8d7da | nix.go | nix.go | // +build freebsd openbsd netbsd darwin linux
package gopass
/*
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
int getch() {
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(... | // +build freebsd openbsd netbsd darwin linux
package gopass
/*
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
int getch() {
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(... | Add println so user gets feedback that input accepted | Add println so user gets feedback that input accepted
| Go | isc | yp-engineering/gopass,keybase/gopass,howeyc/gopass |
ef9cd59b9d33131faaa321b406bc193520ffc6fa | hostnameutils/hostnameutils_test.go | hostnameutils/hostnameutils_test.go | package hostname
import (
"testing"
)
func TestReverse(t *testing.T) {
const hostname_in, hostname_out = "test.a.is.this", "this.is.a.test"
if x := Reverse(hostname_in); x != hostname_out {
t.Errorf("Reverse(%v) = %v, want %v", hostname_in, x, hostname_out)
}
}
func TestReverseOffset(t *testing.T) {
const ho... | package hostnameutils
import (
"testing"
)
func TestReverse(t *testing.T) {
const hostname_in, hostname_out = "test.a.is.this", "this.is.a.test"
if x := Reverse(hostname_in); x != hostname_out {
t.Errorf("Reverse(%v) = %v, want %v", hostname_in, x, hostname_out)
}
}
func TestReverseOffset(t *testing.T) {
con... | Rename hostname to hostnameutils in test | Rename hostname to hostnameutils in test
| Go | apache-2.0 | imeyer/go-utilities |
940167be14e98042bbcb89f45693424b253669cb | rt/errors.go | rt/errors.go | package sillyquill_rt
import "fmt"
type UnknownColumnError struct {
Index int
Name string
}
func (this UnknownColumnError) Error() string {
return fmt.Sprintf("unknown column %q at position %d", this.Name, this.Index)
}
type RowNotUniquelyIdentifiableError struct {
Instance interface{}
}
func (this RowNotUniq... | package sillyquill_rt
import "fmt"
type UnknownColumnError struct {
Index int
Name string
}
func (this UnknownColumnError) Error() string {
return fmt.Sprintf("unknown column %q at position %d", this.Name, this.Index)
}
type RowNotUniquelyIdentifiableError struct {
Instance interface{}
}
func (this RowNotUniq... | Add helper for checking for this error, since it is to be expected | Add helper for checking for this error, since it is to be expected
| Go | bsd-2-clause | hydrogen18/sillyquill,hydrogen18/sillyquill |
8af4e501f361c7ee297d2ac0c46ab72312fa2e84 | ctc_lib/ctc_lib.go | ctc_lib/ctc_lib.go | /*
Copyright 2018 Google Inc. 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 agreed to in w... | /*
Copyright 2018 Google Inc. 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 agreed to in w... | Refactor the getter and setter | Refactor the getter and setter
| Go | apache-2.0 | sharifelgamal/runtimes-common,sharifelgamal/runtimes-common,priyawadhwa/runtimes-common,dlorenc/runtimes-common,sharifelgamal/runtimes-common,priyawadhwa/runtimes-common,sharifelgamal/runtimes-common,priyawadhwa/runtimes-common,nkubala/runtimes-common,priyawadhwa/runtimes-common,dlorenc/runtimes-common,nkubala/runtimes... |
8b6f66ebad4e2ce4bb48c54ede2b5a46f76690b8 | destination.go | destination.go | package main
import (
"fmt"
"net/http/httputil"
"net/url"
docker "github.com/fsouza/go-dockerclient"
)
type DestinationMap map[string]*Destination
type Destination struct {
targetUrl *url.URL
proxy *httputil.ReverseProxy
}
func NewDestination(container *docker.Container) (*Destination, error) {
ip := co... | package main
import (
"fmt"
"net/http/httputil"
"net/url"
"os"
docker "github.com/fsouza/go-dockerclient"
)
type DestinationMap map[string]*Destination
type Destination struct {
targetUrl *url.URL
proxy *httputil.ReverseProxy
}
func getDefaultPort() string {
port := os.Getenv("DEFAULT_PORT")
if port =... | Add ability to customize default routing port | Add ability to customize default routing port
| Go | mit | sosedoff/docker-gateway |
366bd4d57c93af27cb1b721cb61821b4a853da7e | text/fuzz.go | text/fuzz.go | // Copyright 2014 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... | // Copyright 2014 The Prometheus 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... | Move build-constraints near the top. | Move build-constraints near the top.
| Go | apache-2.0 | jimmidyson/prometheus-client_golang,stapelberg/client_golang,m3db/prometheus_client_golang,mattkanwisher/client_golang,prometheus/client_golang,asbjornenge/client_golang |
d905929df63a61d3ceff524c0ce55dcccf538d75 | goroutines.go | goroutines.go | package main
import (
"fmt"
"time"
"sync"
)
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
fmt.Println("worker", id, "processing job", j)
time.Sleep(time.Second)
results <- j * 2
}
}
func printer(results <-chan int) {
for r := range results {
fmt.Println(r)
}
}
fu... | package main
import (
"fmt"
"time"
"sync"
)
var wg sync.WaitGroup
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
if j == -1 {
wg.Done()
return
}
fmt.Println("worker", id, "processing job", j)
time.Sleep(time.Second)
results <- j * 2
}
}
func printer(results <-c... | Remove fatal error in workers | Remove fatal error in workers
| Go | mit | icambridge/go-playground |
b560fe0c6060f3cb3905e350b003926214054baa | sel/sel.go | sel/sel.go | package sel
import (
//"encoding/json"
"fmt"
)
func SelectLink() {
fmt.Println("Selecting link from json file")
// TODO
} | package sel
import (
"encoding/json"
"os"
"flag"
"fmt"
"link-select/types"
)
func SelectLink(arg *flag.Flag) {
fmt.Fprintf(os.Stdout, "Selecting %s from json file\n", arg.Value)
readFile, err := os.Open("files/read.json")
if err != nil {
fmt.Fprintf(os.Stderr, "Error while opening read.json")
os.Exit(-1)... | Implement first (unfinished) version of SelectLink and adjust imports | Implement first (unfinished) version of SelectLink and adjust imports
| Go | mit | danielkocher/link-select |
20b747c3fbd9d547dbb232c8560630e102f11e45 | skeleton/controllers/app.go | skeleton/controllers/app.go | package controllers
import (
"github.com/anonx/sunplate/skeleton/assets/views"
"github.com/anonx/sunplate/action"
)
// App is a sample controller that is used for demonstration purposes.
type App struct {
*Controller
}
// Before is a magic method that is executed before every request.
func (c *App) Before(name s... | package controllers
import (
v "github.com/anonx/sunplate/skeleton/assets/views"
"github.com/anonx/sunplate/action"
)
// App is a sample controller that is used for demonstration purposes.
type App struct {
*Controller
}
// Before is a magic method that is executed before every request.
func (c *App) Before(name... | Use v as a selector arther than views | Use v as a selector arther than views
| Go | bsd-2-clause | runner-mei/goal,runner-mei/goal,runner-mei/goal |
2acdad7b5e64197c30856961327f8f4fede122f8 | ncm.go | ncm.go | package gosolar
import "fmt"
// RemoveNCMNodes is now even more awesome.
func (c *Client) RemoveNCMNodes(guids []string) error {
req, endpoint := getRemoveNCMNodesRequest(guids)
_, err := c.post(endpoint, req)
if err != nil {
return fmt.Errorf("failed to remove the NCM nodes %v", err)
}
return nil
}
// Remo... | package gosolar
import "fmt"
// RemoveNCMNodes is now even more awesome.
func (c *Client) RemoveNCMNodes(guids []string) error {
req, endpoint := getRemoveNCMNodesRequest(guids)
_, err := c.post(endpoint, req)
if err != nil {
return fmt.Errorf("failed to remove the NCM nodes %v", err)
}
return nil
}
// Remo... | Remove underscore from constant name | Remove underscore from constant name
| Go | apache-2.0 | mrxinu/gosolar |
8cbf5b0f35478eeb748c4593f583e4996f3da562 | cli/xslate/xslate.go | cli/xslate/xslate.go | package main
import (
"flag"
"fmt"
"os"
"github.com/lestrrat/go-xslate"
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: xslate [options...] [input-files]\n")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
flag.Usage = usage
flag.Parse()
args := flag.Args()
if len(args) < 1 {
fmt.Fprintf(o... | package main
import (
"flag"
"fmt"
"os"
"github.com/lestrrat/go-xslate"
"github.com/lestrrat/go-xslate/loader"
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: xslate [options...] [input-files]\n")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
flag.Usage = usage
flag.Parse()
args := flag.Args... | Use Render() and Loader here | Use Render() and Loader here
| Go | mit | lestrrat/go-xslate,lestrrat/go-xslate |
b4cfe22bf39a0f9ae5e61abe99be0e28f0f7f3e2 | cmd/msi/impl_stub.go | cmd/msi/impl_stub.go | // +build !windows
package msi
import (
"fmt"
"github.com/itchio/butler/butler"
)
func Info(ctx *butler.Context, msiPath string) {
return fmt.Errorf("msi-info is a windows-only command")
}
func ProductInfo(ctx *butler.Context, productCode string) error {
return fmt.Errorf("msi-product-info is a windows-only co... | // +build !windows
package msi
import (
"fmt"
"github.com/itchio/butler/butler"
)
func Info(ctx *butler.Context, msiPath string) error {
return fmt.Errorf("msi-info is a windows-only command")
}
func ProductInfo(ctx *butler.Context, productCode string) error {
return fmt.Errorf("msi-product-info is a windows-o... | Fix impl stub for msi | Fix impl stub for msi
| Go | mit | itchio/butler,itchio/butler,itchio/butler |
c391df26fbf86adf29d648d03effc22a7a9e2b13 | ghs.go | ghs.go | package main
import (
"bytes"
"fmt"
"log"
"net/http"
"strings"
)
const baseURL = "https://api.github.com/search/repositories"
type Query struct {
Q string
Lang string
Limit int
}
func escapeSearch(s string) string {
return strings.Replace(s, " ", "+", -1)
}
func searchString(q Query) string {
var buffer ... | package main
import (
"bytes"
"errors"
"fmt"
"log"
"net/http"
"strings"
)
const baseURL = "https://api.github.com/search/repositories"
type Query struct {
Q string
Lang string
Limit int
}
func escapeSearch(s string) string {
return strings.Replace(s, " ", "+", -1)
}
func searchString(q Query) (string, er... | Return error from search string | Return error from search string
| Go | mit | keith/ghs |
c497e66e9a2be4148884a5f7142c9a9946b92ca8 | cmd/containers-storage/tree_test.go | cmd/containers-storage/tree_test.go | package main
import "testing"
func TestTree(*testing.T) {
nodes := []treeNode{
{"F", "H", []string{}},
{"F", "I", []string{}},
{"F", "J", []string{}},
{"A", "B", []string{}},
{"A", "C", []string{}},
{"A", "K", []string{}},
{"C", "F", []string{}},
{"C", "G", []string{"beware", "the", "scary", "thing"}... | package main
import "testing"
func TestTree(_ *testing.T) {
nodes := []treeNode{
{"F", "H", []string{}},
{"F", "I", []string{}},
{"F", "J", []string{}},
{"A", "B", []string{}},
{"A", "C", []string{}},
{"A", "K", []string{}},
{"C", "F", []string{}},
{"C", "G", []string{"beware", "the", "scary", "thing... | Work around a paralleltest crash | Work around a paralleltest crash
> ERRO [runner] Panic: paralleltest: package "main" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [0] with length 0: goroutine 5859 [running]:
> ...
> github.com/kunwardeep/paralleltest/pkg/paralleltest.isTestFunction(0x1b7d8c0?)
> github.com/kunward... | Go | apache-2.0 | containers/storage,containers/storage,containers/storage |
ca84e2ac55b11c39668372cd0e74ec5eaa1cb34b | builder/amazon/chroot/step_check_root_device.go | builder/amazon/chroot/step_check_root_device.go | package chroot
import (
"fmt"
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// StepCheckRootDevice makes sure the root device on the AMI is EBS-backed.
type StepCheckRootDevice struct{}
func (s *StepCheckRootDevice) Run(state multistep.StateBag) multist... | package chroot
import (
"fmt"
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// StepCheckRootDevice makes sure the root device on the AMI is EBS-backed.
type StepCheckRootDevice struct{}
func (s *StepCheckRootDevice) Run(state multistep.StateBag) multist... | Fix bug with getting ec2 connection instead of source image | Fix bug with getting ec2 connection instead of source image
| Go | mpl-2.0 | sobrinho/packer,zeliff/packer,justincampbell/packer,jen20/packer,Cbeck527/packer,grubernaut/packer,mgk/packer,grange74/packer,jamesleech/packer,israelshirk/packer,rnaveiras/packer,napramirez/packer,c22/packer,mindjiver/packer,c22/packer,mohae/packer,pieter-lazzaro/packer,threatstream/packer,taliesins/packer,tb3088/pack... |
dead25b941238e970350cc0b0fb3af1e8f14f3f3 | main_suite_test.go | main_suite_test.go | package main_test
import (
"fmt"
"io/ioutil"
"os/exec"
"testing"
"github.com/onsi/gomega/gexec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestTrackercli(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "TrackerCLI Suite")
}
var pathToTrackerCLI string
var _ = BeforeSuite(func() {
... | package main_test
import (
"fmt"
"io/ioutil"
"os/exec"
"testing"
"github.com/onsi/gomega/gexec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestTrackercli(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Acceptance Suite")
}
var pathToTrackerCLI string
var _ = BeforeSuite(func() {
... | Change name of trackercli suite to acceptance suite | Change name of trackercli suite to acceptance suite
| Go | mit | kkallday/tracker-cli,kkallday/tracker-cli |
413ba4fae778384cd5501767593c764ee4db54ac | utils/count.go | utils/count.go | // Copyright © 2017 Makoto Ito
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | // Copyright © 2017 Makoto Ito
//
// 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... | Replace += 1 with ++ | Golint: Replace += 1 with ++
| Go | apache-2.0 | ynqa/word-embedding,ynqa/word-embedding |
2eaa9ae73fac4056a8b9cc0509d2608eede0812b | ast_test.go | ast_test.go | package go_sat_solver
import "testing"
func TestPrint(t *testing.T) {
cases := []struct {
expr Expr
want int
}{
{And{[]Expr{Symbol{"x1"}, Symbol{"x2"}}}, 2},
{Or{[]Expr{Symbol{"x1"}, Symbol{"x2"}, Symbol{"x3"}}}, 3},
{Not{[1]Expr{Symbol{"x1"}}}, 1},
{Symbol{"x1"}, 0},
{Literal{true}, 0},
{Literal{f... | package go_sat_solver
import "testing"
func TestChildrenCount(t *testing.T) {
cases := []struct {
expr Expr
want int
}{
{And{[]Expr{Symbol{"x1"}, Symbol{"x2"}}}, 2},
{Or{[]Expr{Symbol{"x1"}, Symbol{"x2"}, Symbol{"x3"}}}, 3},
{Not{[1]Expr{Symbol{"x1"}}}, 1},
{Symbol{"x1"}, 0},
{Literal{true}, 0},
{L... | Fix name and formatting of ast children count test | Fix name and formatting of ast children count test
| Go | mit | bvcx/go_sat_solver |
36fd44f3b088f9b9f1c75dbcb43bc51ecdcaa2c1 | cmd/printboltdb/main.go | cmd/printboltdb/main.go | package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/relab/raft/raftgorums"
)
func main() {
var path = flag.String("path", "", "path to bolt storage")
flag.Parse()
if len(*path) == 0 {
fmt.Print("-path argument is required\n\n")
flag.Usage()
os.Exit(1)
}
storage, err := raftgorums.NewFileStora... | package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/relab/raft/commonpb"
"github.com/relab/raft/raftgorums"
)
func main() {
var path = flag.String("path", "", "path to bolt storage")
flag.Parse()
if len(*path) == 0 {
fmt.Print("-path argument is required\n\n")
flag.Usage()
os.Exit(1)
}
stora... | Fix printing of missing entries | printboltdb: Fix printing of missing entries
| Go | mit | s111/rkv,s111/rkv |
ceeae3bc2b6e575a3df90b2cf7c6a7ee64dae51b | src/assets_stub.go | src/assets_stub.go | // +build go_get
// When assets.go is being excluded from the build, it's symbols are undefined
// and 'go get' gets upset. Add this stub with inversed build condition to
// compensate.
package main
type AssetBin struct {
root string // root path of physical assets in filesystem
}
func NewAssetBin(binaryDir string... | // +build go_get
// When assets.go is being excluded from the build, it's symbols are undefined
// and 'go get' gets upset. Add this stub with inversed build condition to
// compensate.
package main
import (
"github.com/rtfb/cachedir"
)
type AssetBin struct {
root string // root path of physical assets in filesys... | Fix build: add missing import | Fix build: add missing import
| Go | bsd-2-clause | rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog,rtfb/rtfblog |
5dd14c1ffe9dd8419f63977107df2c15e9905e6f | errors/users.go | errors/users.go | package errors
import "errors"
var (
// ErrUserNotFound when not found.
ErrUserNotFound = errors.New("No user found")
// ErrUserNotUpdated when not updated.
ErrUserNotUpdated = errors.New("User not updated")
// ErrUserNotDeleted when not deleted.
ErrUserNotDeleted = errors.New("User not deleted")
// ErrUserMis... | package errors
import "errors"
var (
// ErrUserNotFound when not found.
ErrUserNotFound = errors.New("No user found")
// ErrUserNotUpdated when not updated.
ErrUserNotUpdated = errors.New("User not updated")
// ErrUserNotDeleted when not deleted.
ErrUserNotDeleted = errors.New("User not deleted")
// ErrUserMis... | Fix typo in forbidden error | Fix typo in forbidden error
| Go | mit | thermokarst/bactdb,thermokarst/bactdb |
44f30fbcacc4bd32ae93b68e4e80ec8a1d27420a | aggregator/sse.go | aggregator/sse.go | package main
import (
"errors"
"encoding/json"
)
type SSEString string
func (s SSEString) ParseHystrixStream() (HystrixStream, error) {
// The eventsource string isn't big short circuit
if len(s) < 8 {
return HystrixStream{}, errors.New("Event string too short to parse")
}
// The eventsource string isn't da... | package main
import (
"errors"
"encoding/json"
)
type SSEString string
func (s SSEString) ParseHystrixStream() (HystrixStream, error) {
// The eventsource string isn't big short circuit
if len(s) < 8 {
return HystrixStream{}, errors.New("Event string too short to parse")
}
// The eventsource string isn't da... | Switch for more idiomatic go | Switch for more idiomatic go | Go | mit | hatchery/cbdb,hatchery/cbdb |
f304caf15cb6a230c94de501e85caaa43ff04189 | main.go | main.go | package main
import "fmt"
var (
// name of the application
name = currentFolderName()
// version of the application
version = gitVersion()
)
func main() {
c := defaultConfig()
readOrSaveConfig(c)
for _, target := range *c.Targets {
goos, goarch := target.Parse()
fmt.Println("Building " + buildName(name... | package main
import "fmt"
var (
// appName is the name of the
// application to be built.
appName = currentFolderName()
// appVersion is the version of
// the application to be built.
appVersion = gitVersion()
)
func main() {
c := defaultConfig()
readOrSaveConfig(c)
for _, target := range *c.Targets {
g... | Make var for app name and version more explicit | Make var for app name and version more explicit
| Go | mit | samherrmann/gowrap |
c6ed4019f34a6de425c0023b50ce6df5569e1aba | main.go | main.go | package main
import (
"log"
"net"
"github.com/paultag/go-dictd/database"
"github.com/paultag/go-dictd/dictd"
)
func main() {
server := dictd.NewServer("pault.ag")
levelDB, err := database.NewLevelDBDatabase("/home/tag/jargon.ldb", "jargon file")
if err != nil {
log.Fatal(err)
}
server.RegisterDatabase(l... | package main
import (
"log"
"net"
"github.com/paultag/go-dictd/database"
"github.com/paultag/go-dictd/dictd"
)
func main() {
server := dictd.NewServer("pault.ag")
// levelDB, err := database.NewLevelDBDatabase("/home/tag/jargon.ldb", "jargon file")
urbanDB := database.UrbanDictionaryDatabase{}
server.Regist... | Swap over to UD for now | Swap over to UD for now
| Go | mit | paultag/go-dictd |
e5553423ab4d7070ccfcd5303e529869c7c46c5e | main.go | main.go | package main
import (
"github.com/albrow/scribble/util"
"gopkg.in/alecthomas/kingpin.v1"
"os"
)
var (
app = kingpin.New("scribble", "A tiny static blog generator written in go.")
serveCmd = app.Command("serve", "Compile and serve the site.")
servePort = serveCmd.Flag("port", "The port on which to serve the si... | package main
import (
"github.com/albrow/scribble/util"
"gopkg.in/alecthomas/kingpin.v1"
"os"
)
var (
app = kingpin.New("scribble", "A tiny static blog generator written in go.")
serveCmd = app.Command("serve", "Compile and serve the site.")
servePort = serveCmd.Flag("port", "The port on which to serve the si... | Replace version with a placeholder for develop | Replace version with a placeholder for develop
| Go | mit | albrow/scribble,albrow/scribble |
409bdd79ef2b91673693f66282b66c9621a65aa1 | app/app_test.go | app/app_test.go | package app_test
import (
"github.com/julienbayle/jeparticipe/app/test"
"github.com/stretchr/testify/assert"
"testing"
)
func TestApp(t *testing.T) {
jeparticipe, handler, event := apptest.CreateATestApp()
defer apptest.DeleteTestApp(jeparticipe)
token := apptest.GetAdminTokenForEvent(t, &handler, event)
ass... | package app_test
import (
"github.com/ant0ine/go-json-rest/rest/test"
"github.com/julienbayle/jeparticipe/app/test"
"github.com/stretchr/testify/assert"
"testing"
)
func TestApp(t *testing.T) {
jeparticipe, handler, event := apptest.CreateATestApp()
defer apptest.DeleteTestApp(jeparticipe)
token := apptest.G... | Correct a typo in MakeAdminRequest call | Correct a typo in MakeAdminRequest call
| Go | mit | julienbayle/jeparticipe,julienbayle/jeparticipe |
1c2859b3c72d7bc09c6f4fa037d224c588db68ae | t/state-counter.go | t/state-counter.go | package main
import "fmt"
type Counter int
func Hook(n *Counter) {
*n++
fmt.Print(*n)
}
| package main
import "fmt"
func Hook(n *int) {
*n++
fmt.Print(*n)
}
| Remove type alias for int | Remove type alias for int
The type alias doesn't add much to the program's clarity. Some readers
might think that a type alias is required so it's better not to have
it. Clarifying details can be provided in reference.md if this proves
confusing.
| Go | unlicense | Hookscript/lang-go,Hookscript/lang-go |
3e788dd8d9ed64eabc3e88b810bc4122f0bab94a | talks/talks_test.go | talks/talks_test.go | package talks
import (
"fmt"
"testing"
assert "github.com/stretchr/testify/require"
)
func TestCompile(t *testing.T) {
talk, err := Compile("../content", "../content/talks-drafts", "paradise-lost.yaml", true)
assert.NoError(t, err)
assert.Equal(t, true, talk.Draft)
assert.NotEmpty(t, talk.Intro)
assert.NotE... | package talks
import (
"fmt"
"testing"
assert "github.com/stretchr/testify/require"
)
func TestCompile(t *testing.T) {
talk, err := Compile("../content", "../content/talks-drafts", "paradise-lost.yaml", true)
assert.NoError(t, err)
assert.Equal(t, true, talk.Draft)
assert.NotEmpty(t, talk.Intro)
assert.NotE... | Check that ImagePaths aren't empty in testing | Check that ImagePaths aren't empty in testing
| Go | mit | brandur/sorg,brandur/sorg,brandur/sorg,brandur/sorg,brandur/sorg |
0fb1b9947b3720811a66f69e8f652a7257deea41 | gamerules/gamerules_test.go | gamerules/gamerules_test.go | package gamerules
func init() {
if err := LoadGameRules("blocks.json", "items.json", "recipes.json", "furnace.json", "users.json", "groups.json"); err != nil {
panic(err)
}
}
| package gamerules
func init() {
if err := LoadGameRules("../blocks.json", "../items.json", "../recipes.json", "../furnace.json", "../users.json", "../groups.json"); err != nil {
panic(err)
}
}
| Fix gamerules unit test panic. | Fix gamerules unit test panic.
| Go | mit | huin/chunkymonkey,huin/chunkymonkey |
583a543834ae22e62215d7e09246c6cb29201d9f | viz/viz_example_test.go | viz/viz_example_test.go | package viz
import "testing"
func Test_Show(test *testing.T) {
Show("testgraph.json", "testgraph.010", "testgraph.010.dot")
}
| package viz
import "testing"
func Test_Show(test *testing.T) {
// Show("testgraph.json", "testgraph.010", "testgraph.010.dot")
}
| Update Show, for not opening | Update Show, for not opening
| Go | mit | gale320/goraph,hsavit1/goraph,gyuho/goraph,gyuho/goraph |
55b05d5461d8404a45bf646665a4d757643731b9 | context_impl.go | context_impl.go | package floc
import (
"context"
"sync"
)
type flowContext struct {
context.Context
sync.RWMutex
}
func NewContext() Context {
return &flowContext{
Context: context.TODO(),
RWMutex: sync.RWMutex{},
}
}
// Release releases resources.
func (flowCtx flowContext) Release() {
}
// Ctx returns the underlying c... | package floc
import (
"context"
"sync"
"sync/atomic"
)
type flowContext struct {
ctx atomic.Value
mu sync.Mutex
}
func NewContext() Context {
ctx := &flowContext{
ctx: atomic.Value{},
mu: sync.Mutex{},
}
ctx.ctx.Store(context.TODO())
return ctx
}
// Release releases resources.
func (flowCtx flowCon... | Store Context in atomic Value | Store Context in atomic Value
| Go | mit | workanator/go-floc |
8d93bc04ad598c95ce9901a73eb7a6840c49fd78 | obj2/atlas/atlasBuilding.go | obj2/atlas/atlasBuilding.go | package atlas
import (
"fmt"
"reflect"
)
func Build(entries ...AtlasEntry) (Atlas, error) {
atl := Atlas{
mappings: make(map[uintptr]*AtlasEntry),
}
for _, entry := range entries {
rtid := reflect.ValueOf(entry.Type).Pointer()
if _, exists := atl.mappings[rtid]; exists {
return Atlas{}, fmt.Errorf("repe... | package atlas
import (
"fmt"
"reflect"
)
func Build(entries ...AtlasEntry) (Atlas, error) {
atl := Atlas{
mappings: make(map[uintptr]*AtlasEntry),
}
for _, entry := range entries {
rtid := reflect.ValueOf(entry.Type).Pointer()
if _, exists := atl.mappings[rtid]; exists {
return Atlas{}, fmt.Errorf("repe... | Add atlas.MustBuild, for those times when you really want a single return value. | Add atlas.MustBuild, for those times when you really want a single return value.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
| Go | mit | polydawn/go-xlate,polydawn/refmt,polydawn/go-xlate,polydawn/refmt |
2b7c194297dc87af6abd14338d885970926f206a | go/lucy/lucy_test.go | go/lucy/lucy_test.go | /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not... | /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not... | Correct Go test package name. | Correct Go test package name.
| Go | apache-2.0 | nwellnhof/lucy,kidaa/lucy,kidaa/lucy,pombredanne/apache-lucy,rbevers/lucy,rbevers/lucy,apache/lucy,kidaa/lucy,rbevers/lucy,nwellnhof/lucy,apache/lucy,rectang/lucy,nwellnhof/lucy,apache/lucy,rbevers/lucy,rbevers/lucy,pombredanne/apache-lucy,apache/lucy,nwellnhof/lucy,rectang/lucy,nwellnhof/lucy,pombredanne/apache-lucy,p... |
448b9181662341e1472283370ffa2c1a78d09ff2 | gopherchan/server.go | gopherchan/server.go | package gopherchan
import (
"net"
"net/url"
"github.com/ohrite/gopher"
)
type Server struct {
Port string
Dispatcher func(net.Conn, *gopher.Request)
gopherServer *gopher.Server
}
func NewServer(port string, dispatcher func(net.Conn, *gopher.Request)) *Server {
if port == "" {
port = "70"
}
r... | package gopherchan
import (
"net"
"net/url"
"github.com/ohrite/gopher"
)
type Server struct {
Port string
Dispatcher func(net.Conn, *gopher.Request)
gopherServer *gopher.Server
}
func NewServer(port string, dispatcher func(net.Conn, *gopher.Request)) *Server {
if port == "" {
port = "70"
}
r... | Stop listening only at localhost | Stop listening only at localhost
| Go | mit | ohrite/gopherchan |
96c8ffd790b147f309ad9c74e9e7a8a8169906fd | etcd_client_test.go | etcd_client_test.go | package main
import (
"testing"
)
var pathToKeyTests = []struct {
key string
prefix string
expected string
}{
{"/nginx/port", "", "nginx_port"},
{"/prefix/nginx/port", "/prefix", "nginx_port"},
{"/prefix/nginx/port", "/prefix/", "nginx_port"},
{"/nginx/worker_processes", "", "nginx_worker_processes"},
... | package main
import (
"testing"
)
type PathToKeyTest struct {
key, prefix, expected string
}
var pathToKeyTests = []PathToKeyTest{
// Without prefix
{"/nginx/port", "", "nginx_port"},
{"/nginx/worker_processes", "", "nginx_worker_processes"},
{"/foo/bar/mat/zoo", "", "foo_bar_mat_zoo"},
// With prefix
{"/pre... | Clean up etcd client tests | Clean up etcd client tests
| Go | mit | crandles/confd,Lineberty/confd,tomdee/confd,agilemobiledev/confd,elbidigital/confd,Flipkart/confd,Flipkart/confd,chendh521/confd,say5/confd,RichardKnop/confd,crunchywelch/confd,cloudnautique/confd,zytek/confd,Lineberty/confd,cloudnautique/confd,glerchundi/confd,bacongobbler/confd,blippar/confd,okushchenko/confd,mboersm... |
f7176693b242d5f3cd2c3638286145699db243f8 | newrelic/helpers.go | newrelic/helpers.go | package newrelic
import "github.com/newrelic/go-agent"
// NullNewRelic returns a disabled New Relic appliaction.
func NullNewRelic() newrelic.Application {
config := newrelic.NewConfig("smsprocessor", "")
config.Enabled = false
app, _ := newrelic.NewApplication(config)
return app
}
| package newrelic
import "github.com/newrelic/go-agent"
// NullNewRelic returns a disabled New Relic appliaction.
func NullNewRelic() newrelic.Application {
config := newrelic.NewConfig("application", "")
config.Enabled = false
app, _ := newrelic.NewApplication(config)
return app
}
| Use a more generic application name. | Use a more generic application name.
| Go | mit | gofury/gofury |
e2818f656a7063a988bccf1a97490e5e78bfa00c | src/cf/requirements/api_endpoint.go | src/cf/requirements/api_endpoint.go | package requirements
import (
"cf"
"cf/configuration"
"cf/terminal"
"fmt"
)
type ApiEndpointRequirement struct {
ui terminal.UI
config configuration.Reader
}
func NewApiEndpointRequirement(ui terminal.UI, config configuration.Reader) ApiEndpointRequirement {
return ApiEndpointRequirement{ui, config}
}
fu... | package requirements
import (
"cf"
"cf/configuration"
"cf/terminal"
"fmt"
)
type ApiEndpointRequirement struct {
ui terminal.UI
config configuration.Reader
}
func NewApiEndpointRequirement(ui terminal.UI, config configuration.Reader) ApiEndpointRequirement {
return ApiEndpointRequirement{ui, config}
}
fu... | Fix command suggestions when an endpoint needs to be targetted | Fix command suggestions when an endpoint needs to be targetted
[Finishes #65764594]
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
7456b0ed0c1197770559d01b1aa5a8120119f649 | agent/tasks/backup_directory_task.go | agent/tasks/backup_directory_task.go | package tasks
import (
"github.com/headmade/backuper/backuper"
)
type backupDirectoryTask struct {
*backupTask
}
func newBackupDirectoryTask(config *backuper.TaskConfig) BackupTaskInterface {
return &backupDirectoryTask{newBackupTask(config)}
}
func (self *backupDirectoryTask) GenerateBackupFile(tmpFilePath stri... | package tasks
import (
"os"
"github.com/headmade/backuper/backuper"
)
type backupDirectoryTask struct {
*backupTask
}
func newBackupDirectoryTask(config *backuper.TaskConfig) BackupTaskInterface {
return &backupDirectoryTask{newBackupTask(config)}
}
func (self *backupDirectoryTask) GenerateBackupFile(tmpFilePat... | Add check of local path existance | Add check of local path existance
| Go | mit | headmade/backuper,Twizty/backuper |
b34c0d75777d42027a57bff9b172ee3ffd765e41 | mail/message.go | mail/message.go | package mail
import (
"bytes"
"text/template"
)
const emailTemplate = `{{range .Headers}}{{.}}
{{end}}From: {{.From}}{{if .ReplyTo}}
Reply-To: {{.ReplyTo}}{{end}}
To: {{.To}}
Subject: {{.Subject}}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="our-content-boundary"
{{.Body}}`
type Message ... | package mail
import (
"bytes"
"text/template"
)
const emailTemplate = `{{range .Headers}}{{.}}
{{end}}From: {{.From}}{{if .ReplyTo}}
Reply-To: {{.ReplyTo}}{{end}}
To: {{.To}}
Subject: {{.Subject}}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="our-content-boundary"
{{.Body}}`
type Message ... | Revert "Push to Travis CI" | Revert "Push to Travis CI"
This reverts commit 05547a47fa7b7c0f3ae3d7d5b14b112902b2825a.
| Go | apache-2.0 | cloudfoundry-incubator/notifications,cloudfoundry-incubator/notifications |
8a1f91c38ae3fc109add03acc68ca5c6b1b839e0 | test/acceptance/helper/assertions.go | test/acceptance/helper/assertions.go | package helper
import (
"encoding/json"
"testing"
)
// Asserts that the request did not return an error.
// Optionally perform some checks only if the request did not fail
func AssertRequestOk(t *testing.T, response interface{}, err error, check_fn func()) {
if err != nil {
response_json, _ := json.MarshalIndent... | package helper
import (
"encoding/json"
"testing"
)
// Asserts that the request did not return an error.
// Optionally perform some checks only if the request did not fail
func AssertRequestOk(t *testing.T, response interface{}, err error, check_fn func()) {
if err != nil {
response_json, _ := json.MarshalIndent... | Print better output on acceptance test assertion failure | Print better output on acceptance test assertion failure
| Go | bsd-3-clause | weaviate/weaviate,weaviate/weaviate |
3906d341c1eb707ef9684df55051682b83571147 | ratago.go | ratago.go | package main
import (
"flag"
"fmt"
"github.com/jbowtie/ratago/xslt"
"github.com/moovweb/gokogiri"
"github.com/moovweb/gokogiri/xml"
"io/ioutil"
)
func xmlReadFile(filename string) (doc *xml.XmlDocument, err error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return
}
doc, err = gokogiri.ParseX... | package main
import (
"flag"
"fmt"
"github.com/jbowtie/ratago/xslt"
"github.com/moovweb/gokogiri"
"github.com/moovweb/gokogiri/xml"
"io/ioutil"
"os"
)
func xmlReadFile(filename string) (doc *xml.XmlDocument, err error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return
}
doc, err = gokogiri.... | Print usage when invoking help or when too few arguments have been passed | Print usage when invoking help or when too few arguments have been passed
| Go | mit | jbuchbinder/ratago,jbowtie/ratago |
36f21a2c68d48e3fa3be9051d849c9031438b772 | examples/greeter.go | examples/greeter.go | package main
import (
eventsource "../."
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (... | package main
import (
"gopkg.in/antage/eventsource.v0"
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello h... | Revert "Revert "Use absolute import URL in example ( doesn't like relative URLs)."" `go get ./...` is full of surprises. | Revert "Revert "Use absolute import URL in example ( doesn't like relative URLs).""
`go get ./...` is full of surprises.
This reverts commit 323289ab27d509f732d2e9055d229de21a4d5d1c.
| Go | mit | antage/eventsource,XuYunnan/eventsource,torfuzx/eventsource,XuYunnan/eventsource |
67c3bd8530227d9808c75623ddd356a02c6faa27 | sacloud/prop_icon.go | sacloud/prop_icon.go | package sacloud
// propIcon アイコン内包型
type propIcon struct {
Icon *Icon // アイコン
}
// SetIconByID 指定のアイコンIDを設定
func (p *propIcon) SetIconByID(id int64) {
p.Icon = &Icon{Resource: NewResource(id)}
}
// SetIcon 指定のアイコンオブジェクトを設定
func (p *propIcon) SetIcon(icon *Icon) {
p.Icon = icon
}
// ClearIcon アイコンをクリア(空IDを持つアイコンオ... | package sacloud
// propIcon アイコン内包型
type propIcon struct {
Icon *Icon // アイコン
}
// GetIcon アイコンを取得
func (p *propIcon) GetIcon() *Icon {
return p.Icon
}
// GetIconID アイコンIDを取得
func (p *propIcon) GetIconID() int64 {
if p.HasIcon() {
return p.Icon.GetID()
}
return -1
}
// GetIconStrID アイコンID(文字列)を取得
func (p *pr... | Add helper funcs to icon property | Add helper funcs to icon property
| Go | apache-2.0 | yamamoto-febc/libsacloud,sacloud/libsacloud |
397499c2882b49428107fded770c420ddda96fb1 | snapshot/storage/boltdb/bolt_test.go | snapshot/storage/boltdb/bolt_test.go | package boltdb
import (
"context"
"path/filepath"
"testing"
"github.com/docker/containerd/snapshot/storage"
"github.com/docker/containerd/snapshot/storage/testsuite"
)
func BenchmarkSuite(b *testing.B) {
testsuite.Benchmarks(b, "BoltDB", func(ctx context.Context, root string) (storage.MetaStore, error) {
ret... | package boltdb
import (
"context"
"path/filepath"
"testing"
"github.com/docker/containerd/snapshot/storage"
"github.com/docker/containerd/snapshot/storage/testsuite"
// Does not require root but flag must be defined for snapshot tests
_ "github.com/docker/containerd/testutil"
)
func BenchmarkSuite(b *testing... | Add root flag to boltdb tests | Add root flag to boltdb tests
Needed for CI to run root coverage
Signed-off-by: Derek McGowan <e1c79a582b6629e6b39e9679f4bb964d25db4aa8@mcgstyle.net> (github: dmcgowan)
| Go | apache-2.0 | crosbymichael/containerd,hqhq/containerd,docker/containerd,containerd/containerd,Wolphin-project/containerd,rajasec/containerd,AkihiroSuda/containerd,thaJeztah/containerd,mikebrow/containerd,estesp/containerd,xiekeyang/containerd,kunalkushwaha/containerd,thaJeztah/containerd,kunalkushwaha/containerd,vdemeester/containe... |
3c90269cdfecf121d2771fd7e3ad9d37d42ea947 | models/issue/vector.go | models/issue/vector.go | package issue
import "net/http"
type HttpBody struct {
ContentEncoding string `json:"contentEncoding"`
Content []byte `json:"content,string"`
}
type HttpEntity struct {
Status string `json:"status"`
Header http.Header `json:"header"`
Body *HttpBody `json:"body,omitempty"`
}
type HttpTransactio... | package issue
import "net/http"
type HttpBody struct {
ContentEncoding string `json:"contentEncoding"`
Content string `json:"content"`
}
type HttpEntity struct {
Status string `json:"status"`
Header http.Header `json:"header"`
Body *HttpBody `json:"body,omitempty"`
}
type HttpTransaction struc... | Set content type to string | Set content type to string
| Go | mit | jack51706/bearded,cyberintruder/bearded,jack51706/bearded,bearded-web/bearded,bearded-web/bearded,cyberintruder/bearded,cyberintruder/bearded,bearded-web/bearded,jack51706/bearded,cyberintruder/bearded,bearded-web/bearded,jack51706/bearded |
40d339af252d2cd15fda69b076d707a3ca5eda3c | src/redlot/const.go | src/redlot/const.go | package redlot
import "errors"
const (
typeKV = 'k'
typeHASH = 'h'
typeHSIZE = 'H'
)
var (
errNosArgs = errors.New("wrong number of arguments")
)
| package redlot
import "errors"
const (
typeKV = 'k'
typeHASH = 'h'
typeHSIZE = 'H'
)
var (
errNosArgs = errors.New("wrong number of arguments")
errNotInt = errors.New("value is not an integer or out of range")
)
| Add error of not int. | Add error of not int.
| Go | mit | kofj/redlot |
d74fb5f88d9bbeabb87a501d11aac5e7c08aba3b | grafsy/main.go | grafsy/main.go | package main
import (
"flag"
"fmt"
"os"
"sync"
"github.com/leoleovich/grafsy"
)
func main() {
var configFile string
flag.StringVar(&configFile, "c", "/etc/grafsy/grafsy.toml", "Path to config file.")
flag.Parse()
var conf grafsy.Config
err := conf.LoadConfig(configFile)
if err != nil {
fmt.Println(err)... | package main
import (
"flag"
"fmt"
"os"
"sync"
"github.com/leoleovich/grafsy"
)
var version = "dev"
func main() {
var configFile string
printVersion := false
flag.StringVar(&configFile, "c", "/etc/grafsy/grafsy.toml", "Path to config file.")
flag.BoolVar(&printVersion, "v", printVersion, "Print version and... | Add flag to print version | Add flag to print version
| Go | apache-2.0 | leoleovich/grafsy,leoleovich/grafsy |
306db25769faa92d63db50b4f88fde5437f07ac9 | helpers/timeouts.go | helpers/timeouts.go | package helpers
import (
"os"
"time"
"github.com/onsi/gomega"
)
var DEFAULT_EVENTUALLY_TIMEOUT = 2 * time.Minute
var DEFAULT_CONSISTENTLY_DURATION = 5 * time.Second
func RegisterDefaultTimeouts() {
var err error
if os.Getenv("DEFAULT_EVENTUALLY_TIMEOUT") != "" {
DEFAULT_EVENTUALLY_TIMEOUT, err = time.ParseDu... | package helpers
import (
"os"
"time"
"github.com/onsi/gomega"
)
var DEFAULT_EVENTUALLY_TIMEOUT = 1 * time.Minute
var DEFAULT_CONSISTENTLY_DURATION = 5 * time.Second
func RegisterDefaultTimeouts() {
var err error
if os.Getenv("DEFAULT_EVENTUALLY_TIMEOUT") != "" {
DEFAULT_EVENTUALLY_TIMEOUT, err = time.ParseDu... | Change default eventually timeout to 1 minute | Change default eventually timeout to 1 minute
[#126989119]
Signed-off-by: Chris Piraino <f047703f03f13cc8e1b226aa8ba85c2dfc238f94@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/inigo |
6995df7f8a77cfc670b81bc97483d2352c08eaa8 | client.go | client.go | package main
import (
"fmt"
"log"
"os"
"golang.org/x/crypto/ssh"
)
func main() {
if len(os.Args) != 4 {
log.Fatalf("Usage: %s <user> <host:port> <command>", os.Args[0])
}
client, session, err := connectToHost(os.Args[1], os.Args[2])
if err != nil {
panic(err)
}
out, err := session.CombinedOutput(os.Ar... | package main
import (
"fmt"
"log"
"os"
"golang.org/x/crypto/ssh"
)
func main() {
if len(os.Args) != 4 {
log.Fatalf("Usage: %s <user> <host:port> <command>", os.Args[0])
}
client, session, err := connectToHost(os.Args[1], os.Args[2])
if err != nil {
panic(err)
}
out, err := session.CombinedOutput(os.Ar... | Add a call to ssh.InsecureIgnoreHostKey() for recent Go versions | Add a call to ssh.InsecureIgnoreHostKey() for recent Go versions
| Go | bsd-2-clause | Scalingo/go-ssh-examples,Scalingo/go-ssh-examples |
906ada3541c2d001f7bbdd1a2ad7ca1f4d9f754b | demo/controller/main.go | demo/controller/main.go | package main
import (
"github.com/voxelbrain/goptions"
"os"
"time"
)
func main() {
options := struct {
Servers []string `goptions:"-s, --server, obligatory, description='Servers to connect to'"`
Password string `goptions:"-p, --password, description='Don\\'t prompt for password'"`
Timeout time... | package main
import (
"fmt"
"os"
"time"
"github.com/voxelbrain/goptions"
)
func main() {
options := struct {
Servers []string `goptions:"-s, --server, obligatory, description='Servers to connect to'"`
Password string `goptions:"-p, --password, description='Don\\'t prompt for password'"`
Timeo... | Apply golang opts, and give an example | Apply golang opts, and give an example
| Go | mit | MarsBighead/garden,MarsBighead/garden,MarsBighead/garden,MarsBighead/garden |
597eecbc69b086002e979d9731c991ed14a0d9d3 | io2/io.go | io2/io.go | // The assistant functions of io.
package io2
import "io"
// Must read and return n bytes from r. err is not nil, if failed.
func ReadN(r io.Reader, n int) (result []byte, err error) {
result = make([]byte, n)
for m := 0; m < n; {
m, err = r.Read(result[m:])
if err != nil {
return
}
}
return
}
// Must w... | // The assistant functions of io.
package io2
import "io"
// ReadN must read and return n bytes from r. err is not nil, if failed.
func ReadN(r io.Reader, n int) (result []byte, err error) {
result = make([]byte, n)
for m := 0; m < n; {
var _m int
_m, err = r.Read(result[m:])
if err != nil {
return
}
m... | Fix a bug about ReadN and WriteN | Fix a bug about ReadN and WriteN
| Go | apache-2.0 | xgfone/go-tools |
511278b66aa7871093845a6beab23ea2a0e4cb66 | src/cmds/restic/cmd_rebuild_index.go | src/cmds/restic/cmd_rebuild_index.go | package main
import (
"restic/repository"
"github.com/spf13/cobra"
)
var cmdRebuildIndex = &cobra.Command{
Use: "rebuild-index [flags]",
Short: "build a new index file",
Long: `
The "rebuild-index" command creates a new index by combining the index files
into a new one.
`,
RunE: func(cmd *cobra.Command, args... | package main
import (
"restic/repository"
"github.com/spf13/cobra"
)
var cmdRebuildIndex = &cobra.Command{
Use: "rebuild-index [flags]",
Short: "build a new index file",
Long: `
The "rebuild-index" command creates a new index based on the pack files in the
repository.
`,
RunE: func(cmd *cobra.Command, args [... | Fix wrong description of rebuild-index command in help text | Fix wrong description of rebuild-index command in help text
| Go | bsd-2-clause | ar-jan/restic,kurin/restic,stuertz/restic,kurin/restic,middelink/restic,ar-jan/restic,stuertz/restic,restic/restic,byo/restic,middelink/restic,fawick/restic,fawick/restic,byo/restic,jayme-github/restic,jayme-github/restic,restic/restic |
e24ef002d85cbd3d0622724d37fb79835d3a5c56 | sql/create_or_update_firewall_rule.go | sql/create_or_update_firewall_rule.go | package sql
import "github.com/jen20/riviera/azure"
type CreateOrUpdateFirewallRuleResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
StartIpAddress *string `json:"startIpAddress,omitempty"`
EndIpAddress *st... | package sql
import "github.com/jen20/riviera/azure"
type CreateOrUpdateFirewallRuleResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
StartIPAddress *string `json:"startIpAddress,omitempty"`
EndIPAddress *st... | Change Ip => IP for idiomatic Go | sql: Change Ip => IP for idiomatic Go
| Go | mpl-2.0 | jen20/riviera |
5ea9c92c063fb7365eba4cb023e635057ca9d5b2 | extra/ast/ast.go | extra/ast/ast.go | package ast
import "github.com/elpinal/coco3/extra/token"
type Command struct {
Name string
Args []token.Token
}
| package ast
import "github.com/elpinal/coco3/extra/token"
type Command struct {
Name string
Args []token.Token
}
type List interface {
Length() int
}
type Empty struct{}
func (e *Empty) Length() int {
return 0
}
type Cons struct {
Head string
Tail List
}
func (c *Cons) Length() int {
return 1 + c.Tail.Len... | Add List & its implementations, Cons & Empty | Add List & its implementations, Cons & Empty
| Go | mit | elpinal/coco3 |
bbf42f40a22958456947cad238b2324b52f2a4d0 | data/data.go | data/data.go | package data
type WsError struct {
Code int `json:"code"`
Msg string `json:"msg"`
}
type WsEvent struct {
Id int `json:"id"`
Type string `json:"type"`
Channel string `json:"channel"`
Text string `json:"text"`
Ok bool `json:"ok"`
ReplyTo int `json:"reply_to"`
Ts string ... | package data
type WsError struct {
Code int `json:"code"`
Msg string `json:"msg"`
}
type WsEvent struct {
Id int `json:"id"`
Type string `json:"type"`
Channel string `json:"channel"`
Text string `json:"text"`
Ok bool `json:"ok"`
ReplyTo int `json:"reply_to"`
Ts string ... | Add the last pressure value. | Add the last pressure value.
| Go | unlicense | alinpopa/barvin |
9cd9673b39348a6cedbbf434d51d24c20ae491a1 | src/cmd/doc/main.go | src/cmd/doc/main.go | package main
import (
"github.com/pachyderm/pachyderm/src/cmd/pachctl/cmd"
"github.com/spf13/cobra/doc"
"go.pedge.io/env"
)
type appEnv struct {
OutputDir string `env:"OUTPUT_DIR,default=./doc/pachctl"`
}
func main() {
env.Main(do, &appEnv{})
}
func do(appEnvObj interface{}) error {
appEnv := appEnvObj.(*appE... | package main
import (
"github.com/pachyderm/pachyderm/src/cmd/pachctl/cmd"
"github.com/spf13/cobra/doc"
"go.pedge.io/env"
)
type appEnv struct {
OutputDir string `env:"OUTPUT_DIR,default=./doc/pachctl"`
}
func main() {
env.Main(do, &appEnv{})
}
func do(appEnvObj interface{}) error {
appEnv := appEnvObj.(*appE... | Return nil so it compiles. | Return nil so it compiles.
| Go | apache-2.0 | pachyderm/pfs,pachyderm/pfs,pachyderm/pfs |
fed53c8bad5977f7f28bfde000285d16ec83983c | src/nvim-go/main.go | src/nvim-go/main.go | // Copyright 2016 Koichi Shiraishi. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// nvim-go is a msgpack remote plugin for Neovim
package main
import (
"log"
_ "net/http/pprof"
"os"
_ "nvim-go/autocmd"
_ "nvim-go/commands"
_ "nvim-... | // Copyright 2016 Koichi Shiraishi. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// nvim-go is a msgpack remote plugin for Neovim
package main
import (
_ "net/http/pprof"
_ "nvim-go/autocmd"
_ "nvim-go/commands"
_ "nvim-go/config"
_... | Remove unnecessary log package settings | Remove unnecessary log package settings
Signed-off-by: Koichi Shiraishi <13fbd79c3d390e5d6585a21e11ff5ec1970cff0c@zchee.io>
| Go | bsd-3-clause | zchee/nvim-go,zchee/nvim-go |
68fe9c1000e3e6cf3fba586ee4f319f62feeecb3 | cmd/nimona/cmd/daemonStop.go | cmd/nimona/cmd/daemonStop.go | package cmd
import (
"syscall"
"github.com/spf13/cobra"
)
var daemonStopCmd = &cobra.Command{
Use: "stop",
Short: "Stop a daemon",
Long: "",
RunE: func(cmd *cobra.Command, args []string) error {
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
return nil
},
}
func init() {
daemon.AddCommand()
}
| package cmd
import (
"github.com/spf13/cobra"
)
var daemonStopCmd = &cobra.Command{
Use: "stop",
Short: "Stop a daemon",
Long: "",
RunE: func(cmd *cobra.Command, args []string) error {
_, err := restClient.R().Post("/api/v1/stop")
return err
},
}
func init() {
daemon.AddCommand(daemonStopCmd)
}
| Add command to stop the daemon | Add command to stop the daemon
| Go | mit | nimona/go-nimona,nimona/go-nimona,nimona/go-nimona,nimona/go-nimona |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.