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 |
|---|---|---|---|---|---|---|---|---|---|
b315c20035a823378729f50586fc2f27d1177b2f | src/main_test.go | src/main_test.go | package main
import (
"testing"
)
var testcases = []struct {
hands string
expected bool
}{
{"123456789m123p1s", true},
{"111222333m111p1s", true},
{"EEESSSWWWNNNW", true},
{"13579m2468p1357s", false},
{"13579m2468pESWN", false},
{"1133557799mEEN", true},
}
func TestJudgeTenpai(t *testing.T) {
for _, tes... | package main
import (
"testing"
)
var testcases = []struct {
hands string
expected bool
}{
{"123456789m123p1s", true},
{"111222333m111p1s", true},
{"EEESSSWWWNNNW", true},
{"13579m2468p1357s", false},
{"13579m2468pESWN", false},
{"1133557799mEEN", true},
}
func TestJudgeTenpai(t *testing.T) {
for _, tes... | Make the failed case text understandable a bit | Make the failed case text understandable a bit
| Go | apache-2.0 | tanaka51/tenpai-wakaru-man |
f7d8fc8f104bd954cfd22cf9a6ae5514f1c8190b | keymasterd/eventnotifier/api.go | keymasterd/eventnotifier/api.go | package eventnotifier
import (
"net/http"
"sync"
"github.com/Symantec/Dominator/lib/log"
"github.com/Symantec/keymaster/proto/eventmon"
)
type EventNotifier struct {
logger log.DebugLogger
mutex sync.Mutex
// Protected by lock.
transmitChannels map[chan<- eventmon.EventV0]chan<- eventmon.EventV0
}
func New... | package eventnotifier
import (
"net/http"
"sync"
"github.com/Symantec/Dominator/lib/log"
"github.com/Symantec/keymaster/proto/eventmon"
)
type EventNotifier struct {
logger log.DebugLogger
mutex sync.Mutex
// Protected by lock.
transmitChannels map[chan<- eventmon.EventV0]chan<- eventmon.EventV0
}
func New... | Check in PublishServiceProviderLoginEvent() stub function. | Check in PublishServiceProviderLoginEvent() stub function.
| Go | apache-2.0 | rgooch/keymaster,Symantec/keymaster,Symantec/keymaster,rgooch/keymaster,rgooch/keymaster,Symantec/keymaster |
b989262d9912c6c9df2a32d561dcc8e554704dfc | 2016/day4/day4.go | 2016/day4/day4.go | package day4
import (
"strings"
"github.com/domdavis/adventofcode/2016/day4/room"
)
func Solution() string {
return "Not yet solved"
}
func sum(input string) int {
total := 0
for _, code := range strings.Split(input, "\n") {
room := room.New(code)
if room.Real {
total += room.Sector
}
}
return tot... | package day4
import (
"strings"
"strconv"
"github.com/domdavis/adventofcode/2016/day4/room"
)
func Solution() string {
return strconv.Itoa(sum(data))
}
func sum(input string) int {
total := 0
for _, code := range strings.Split(input, "\n") {
room := room.New(code)
if room.Real {
total += room.Sector
... | Add part 1 of day 4 test | Add part 1 of day 4 test
| Go | mit | domdavis/adventofcode |
362751ba24ee4a5efc5895981d0c032d0baaa889 | commands.go | commands.go | package main
import (
"fmt"
"strings"
"github.com/bwmarrin/discordgo"
)
const commandPrefix = `$`
func messageCreateHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
user, _ := s.User("@me")
if m.Author.ID != user.ID {
s.ChannelMessageSend(botTestChannel, fmt.Sprintf("%s schrieb: %s", m.Author.Use... | package main
import (
"fmt"
"strings"
"github.com/bwmarrin/discordgo"
"github.com/spf13/viper"
)
const commandPrefix = `$`
func messageCreateHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
user, _ := s.User("@me")
if m.Author.ID != user.ID {
if !strings.HasPrefix(m.Content, commandPrefix) {
... | Add check, if rules are accepted | Add check, if rules are accepted
| Go | bsd-3-clause | kori-irrlicht/irrlicht-bot |
a70001d541e491b213865e7821ef9555e0bf331f | schedule/constant.go | schedule/constant.go | package schedule
import "time"
type ConstantSchedule struct {
Interval time.Duration
}
func Every(duration time.Duration) ConstantSchedule {
if duration < time.Second {
duration = time.Second
}
duration = duration - time.Duration(duration.Nanoseconds())%time.Second
return ConstantSchedule{
Interval: duratio... | package schedule
import "time"
type ConstantSchedule struct {
Interval time.Duration
}
func Every(duration time.Duration) ConstantSchedule {
if duration < time.Second {
duration = time.Second
}
duration = duration - time.Duration(duration.Nanoseconds())%time.Second
return ConstantSchedule{
Interval: duratio... | Remove nanoseconds from Next's time in ConstantSchedule | Remove nanoseconds from Next's time in ConstantSchedule
| Go | mit | celrenheit/spider |
0617eaf0de27bd30c0dc1a3b78e6a1c9d2aeaa25 | common/enums.go | common/enums.go | package common
// Radical represents possible radical configurations of an atom.
type Radical uint8
const (
RadicalNone Radical = 0
RadicalSinglet
RadicalDoublet
RadicalTriplet
)
// BondType defines the possible types of bonds between a pair of
// atoms.
type BondType uint8
const (
BondTypeNone BondType = 0
B... | package common
// The following `enum` definitions are in line with the corresponding
// ones in InChI 1.04 software. A notable difference is that we DO
// NOT provide for specifying bond stereo with respect to the second
// atom in the pair.
// Radical represents possible radical configurations of an atom.
type Rad... | Complete the most important common enum definitions | Complete the most important common enum definitions
| Go | mit | js-ojus/RxnWeaver,RxnWeaver/RxnWeaver |
8f6399a58f4e0fe59512c55e65349eee346fe021 | DecodeRecordProtocol.go | DecodeRecordProtocol.go | package TLSHandshakeDecoder
import (
_ "bytes"
"errors"
"fmt"
)
type TLSRecordLayer struct {
contentType uint8
version uint16
length uint16
Fragment []byte
}
func DecodeRecord(p *TLSRecordLayer, data []byte) error {
if len(data) < 5 {
return errors.New("Payload too short to be a TLS packet.")
... | package TLSHandshakeDecoder
import (
_ "bytes"
"errors"
"fmt"
)
type TLSRecordLayer struct {
ContentType uint8
Version uint16
length uint16
Fragment []byte
}
func DecodeRecord(p *TLSRecordLayer, data []byte) error {
if len(data) < 5 {
return errors.New("Payload too short to be a TLS packet.")
... | Make attributes in struct more visible | Make attributes in struct more visible
| Go | mit | rahulsom/TLSHandshakeDecoder,rahulsom/TLSHandshakeDecoder |
28afc405b0337cc38902be8d70ba3366c58608f0 | providers/systemd/get_test.go | providers/systemd/get_test.go | package systemd_test
import (
"fmt"
"github.com/mistifyio/mistify/acomm"
"github.com/mistifyio/mistify/providers/systemd"
)
func (s *sd) TestGet() {
tests := []struct {
name string
err string
}{
{"dbus.service", ""},
{"doesnotexist.service", "unit not found"},
}
for _, test := range tests {
args :... | package systemd_test
import (
"fmt"
"github.com/mistifyio/mistify/acomm"
"github.com/mistifyio/mistify/providers/systemd"
)
func (s *sd) TestGet() {
tests := []struct {
name string
err string
}{
{"", "missing arg: name"},
{"doesnotexist.service", "unit not found"},
{"dbus.service", ""},
}
for _, t... | Add missing arg test to Systemd Provider Get | Add missing arg test to Systemd Provider Get
| Go | mit | mistifyio/mistify,cerana/cerana,cerana/cerana,cerana/cerana,cerana/cerana |
c8cf4af9674e1d4eb0747ba32be38d9849b74ab1 | cmd/client/main.go | cmd/client/main.go | package main
import (
"github.com/itsankoff/gotcha/client"
"github.com/itsankoff/gotcha/common"
"log"
"time"
)
func main() {
input := make(chan *common.Message)
ws := client.NewWebSocketClient()
ws.SetReceiver(input)
c := client.New(ws)
err := c.Connect("ws://127.0.0.1:9000/websocket")
log.Println("connect... | package main
import (
"github.com/itsankoff/gotcha/client"
"log"
"time"
)
func main() {
ws := client.NewWebSocketClient()
c := client.New(ws)
err := c.Connect("ws://127.0.0.1:9000/websocket")
log.Println("connected", err)
userId, err := c.Register("pesho", "123")
log.Println("registered", err)
err = c.Auth... | Remove redundant input channel for websocket transport | Remove redundant input channel for websocket transport
| Go | mit | itsankoff/gotcha,itsankoff/gotcha |
dd3474ed0b0a3e7f1f1d7bd7e978e3709202ea13 | balancer/interceptor/iptables_test.go | balancer/interceptor/iptables_test.go | package interceptor
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestSanitizeIPTablesOutput(t *testing.T) {
require.Equal(t, "x y", sanitizeIPTablesOutput(([]byte)("x\n\ty")))
as := make([]byte, 1000)
for i := range as {
as[i] = 'a'
}
require.Equal(t, string(as[:200]), sanitizeIPTablesO... | package interceptor
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func TestSanitizeIPTablesOutput(t *testing.T) {
require.Equal(t, "x y", sanitizeIPTablesOutput(([]byte)("x\n\ty")))
as := strings.Repeat("a", 1000)
require.Equal(t, as[:200], sanitizeIPTablesOutput(([]byte)(as)))
}
| Use strings package to avoid a loop | Use strings package to avoid a loop
| Go | apache-2.0 | squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen |
71a857fa516acd9a40c16e549c007035f298f500 | options/auto_retry_options.go | options/auto_retry_options.go | package options
import "time"
const DEFAULT_MAX_RETRY_ATTEMPTS = 3
const DEFAULT_SLEEP = 5 * time.Second
// List of recurring transient errors encountered when calling terraform
// If any of these match, we'll retry the command
var RETRYABLE_ERRORS = []string{
"(?s).*Failed to load state.*tcp.*timeout.*",
"(?s).*F... | package options
import "time"
const DEFAULT_MAX_RETRY_ATTEMPTS = 3
const DEFAULT_SLEEP = 5 * time.Second
// List of recurring transient errors encountered when calling terraform
// If any of these match, we'll retry the command
var RETRYABLE_ERRORS = []string{
"(?s).*Failed to load state.*tcp.*timeout.*",
"(?s).*F... | Add NoSuchBucket to retryable errors | Add NoSuchBucket to retryable errors
| Go | mit | gruntwork-io/terragrunt,gruntwork-io/terragrunt |
aad4eda9d7e114c720abd1b5a899028374b58bfa | compiler/natives/src/syscall/fs_js.go | compiler/natives/src/syscall/fs_js.go | //go:build js
package syscall
import (
"syscall/js"
)
// fsCall emulates a file system-related syscall via a corresponding NodeJS fs
// API.
//
// This version is similar to the upstream, but it gracefully handles missing fs
// methods (allowing for smaller prelude) and removes a workaround for an
// obsolete NodeJ... | //go:build js
package syscall
import (
"syscall/js"
)
// fsCall emulates a file system-related syscall via a corresponding NodeJS fs
// API.
//
// This version is similar to the upstream, but it gracefully handles missing fs
// methods (allowing for smaller prelude) and removes a workaround for an
// obsolete NodeJ... | Add a comment to explain fsCall() safety checks | Add a comment to explain fsCall() safety checks
| Go | bsd-2-clause | gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs,gopherjs/gopherjs |
12b399a0d8d82df12ce4bf04da229c9af1dbd110 | gof1.go | gof1.go | package gof1
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
// GetRaces queries the Ergast api and returns the details of every completed race in the F1 season specified
func GetRaces(year int) []Race {
url := fmt.Sprintf("http://ergast.com/api/f1/%v/results.json?limit=1000&offset=0", year)
fmt.Println(url)
... | package gof1
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
const baseUrl = "http://ergast.com/api/f1/"
func GetRacesInSeason(year int) []Race {
url := fmt.Sprintf("%s%v/schedule.json", baseUrl, year)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Println("NewRequest:", err)
return ni... | Add call to pull schedule | Add call to pull schedule
| Go | mit | meenie216/gof1 |
ed53a4d49900d79117f1e631266d010e37eca1fc | agent/ec2_tags.go | agent/ec2_tags.go | package agent
import (
"errors"
"fmt"
"time"
"github.com/AdRoll/goamz/aws"
"github.com/AdRoll/goamz/ec2"
)
type EC2Tags struct {
}
func (e EC2Tags) Get() (map[string]string, error) {
tags := make(map[string]string)
// Passing blank values here instructs the AWS library to look at the
// current instances m... | package agent
import (
"errors"
"fmt"
"time"
"github.com/AdRoll/goamz/aws"
"github.com/AdRoll/goamz/ec2"
)
type EC2Tags struct {
}
func (e EC2Tags) Get() (map[string]string, error) {
tags := make(map[string]string)
// Passing blank values here instructs the AWS library to look at the
// current instances m... | Revert "Add the EC2 instance ID to the automatic metadata" | Revert "Add the EC2 instance ID to the automatic metadata"
This reverts commit 189f0fa7ed0bd4b656e5eb9e3c8db3ad6605e92b.
| Go | mit | Shopify/agent,Shopify/agent,buildkite/agent,buildkite/agent,Shopify/agent,buildkite/agent |
dfddf7caabcf09ae326b36088c0f1c8eb24e1f3c | go-statusbar.go | go-statusbar.go | package main
import (
"github.com/cburkert/go-statusbar/reporters/battery"
"github.com/cburkert/go-statusbar/reporters/volume"
)
func main() {
statusBar := NewStatusBar(" | ")
statusBar.AddReporter(volume.NewVolumeReporter())
statusBar.AddReporter(battery.NewPowerReporter("/sys/class/power_supply/"))
statusBar.... | package main
import (
"github.com/cburkert/go-statusbar/reporters/battery"
"github.com/cburkert/go-statusbar/reporters/volume"
)
func main() {
statusBar := NewStatusBar(" ▕▏ ")
statusBar.AddReporter(volume.NewVolumeReporter())
statusBar.AddReporter(battery.NewPowerReporter("/sys/class/power_supply/"))
statusBar... | Use more appealing separator characters | Use more appealing separator characters
| Go | bsd-3-clause | cburkert/go-statusbar,cburkert/go-statusbar |
252b3c6a8a49b2d9457ae9e2c335970aef2d6753 | component_test.go | component_test.go | package flow
import (
"testing"
)
type doubleOnce struct {
In <-chan int
Out chan<- int
}
func (c *doubleOnce) Process() {
i := <-c.In
c.Out <- 2*i
}
func TestSimpleComponent(t *testing.T) {
in := make(chan int)
out := make(chan int)
c := &doubleOnce{
in,
out,
}
wait := Run(c)
in <- 12
res := <-ou... | package flow
import (
"testing"
)
// This component interface is common for many test cases
type intInAndOut struct {
In <-chan int
Out chan<- int
}
type doubleOnce intInAndOut
func (c *doubleOnce) Process() {
i := <-c.In
c.Out <- 2*i
}
// Test a simple component that runs only once
func TestSimpleComponent(t... | Add test for long running process | Add test for long running process
| Go | mit | trustmaster/goflow,trustmaster/goflow |
fe4d603dbbe54efb625ef0134094e0f97bd6bd53 | api.go | api.go | package gitbook
import (
"github.com/GitbookIO/go-gitbook-api/api"
"github.com/GitbookIO/go-gitbook-api/client"
)
type API struct {
// Authentication API client
Account *api.Account
// Individual book API client
Book *api.Book
// Book listing API client
Books *api.Books
// User API client
User *api.User
/... | package gitbook
import (
"github.com/GitbookIO/go-gitbook-api/api"
"github.com/GitbookIO/go-gitbook-api/client"
)
type API struct {
// Authentication API client
Account *api.Account
// Individual book API client
Book *api.Book
// Book listing API client
Books *api.Books
// Builds API client
Builds *api.Buil... | Add Builds API to main API client | Add Builds API to main API client
| Go | apache-2.0 | GitbookIO/go-gitbook-api |
bef4a60c68cd3be9809f889d8d9c13cfe8f7e3d5 | fib.go | fib.go | package fibgo
var cache = make(map[int]int)
// N return fibonacci number on N position
// N should start from 0, otherwise panic will raised
func N(n int) int {
if n < 0 {
panic("n should not less than 0")
}
v, ok := cache[n]
if ok {
return v
}
if n < 2 {
cache[n] = n
return n
}
v = N(n-2) + N(n-1)... | package fibgo
var cache = make(map[int]int)
// TODO uudashr: pass in cache in order to respect the pure function concept
// N return fibonacci number on N position
// N should start from 0, otherwise panic will raised
func N(n int) int {
if n < 0 {
panic("n should not less than 0")
}
v, ok := cache[n]
if ok {... | Add notes to improve the cacheable design | Add notes to improve the cacheable design
| Go | mit | uudashr/fibgo |
6695c8a521ec0e8908b691da2d746a79c51128f1 | entities/db/commands.go | entities/db/commands.go | package db
import (
"github.com/garyburd/redigo/redis"
)
// Save takes a key (struct used as template for all data containers to ease the managing of the DB)
// and generates an unique key in order to add the record to the DB.
func Save(key string, value []byte) error {
defer mutex.Unlock()
mutex.Lock()
_, err :... | package db
import (
"github.com/garyburd/redigo/redis"
)
// Save takes a key (struct used as template for all data containers to ease the managing of the DB)
// and generates an unique key in order to add the record to the DB.
func Save(key string, value []byte) error {
conn := pool.Get()
defer conn.Close()
_, e... | Use the pool instead the database connection | Use the pool instead the database connection
| Go | mit | WarCluster/warcluster-server,WarCluster/warcluster-server |
c11c69d6c07073f4cefcab78809962e21cecb80e | api/api.go | api/api.go | package api
import "google.golang.org/grpc"
// DialOptions are the gRPC dial options for discovery calls
// TODO: disable insecure connections
var DialOptions = []grpc.DialOption{
grpc.WithInsecure(),
}
| package api
import (
"time"
"google.golang.org/grpc"
)
// DialOptions are the gRPC dial options for discovery calls
// TODO: disable insecure connections
var DialOptions = []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithTimeout(2 * time.Second),
}
| Set timeout on gRPC connect | Set timeout on gRPC connect
| Go | mit | TheThingsNetwork/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,jvanmalder/ttn,TheThingsNetwork/ttn,jvanmalder/ttn,mgranberry/ttn,mgranberry/ttn,mgranberry/ttn |
f68cf915047c362711b71917751d1d6fb8598138 | cloudwatch_test.go | cloudwatch_test.go | package cloudwatch
import (
"math/rand"
"testing"
"time"
"github.com/Pallinder/go-randomdata"
"github.com/gliderlabs/logspout/router"
)
const NumMessages = 250000
func TestCloudWatchAdapter(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode.")
}
route := &router.Route{Ad... | package cloudwatch
import (
"math/rand"
"testing"
"time"
"github.com/Pallinder/go-randomdata"
"github.com/gliderlabs/logspout/router"
)
const NumMessages = 1000000
func TestCloudWatchAdapter(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode.")
}
route := &router.Route{A... | Swap back to 1MM messages. | Swap back to 1MM messages.
| Go | mit | bradgignac/logspout-cloudwatch,bradgignac/logspout-cloudwatch |
22124d4359bfecb726ab2366245583f0b0e12f18 | cmd/server/main.go | cmd/server/main.go | package main
import (
"flag"
"net"
"github.com/hnakamur/rdirsync"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
)
func main() {
var enableTLS bool
flag.BoolVar(&enableTLS, "enable-tls", false, "enable TLS")
var certFile string
flag.StringVar(&certFile, "cer... | package main
import (
"flag"
"net"
"github.com/hnakamur/rdirsync"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
)
func main() {
var enableTLS bool
flag.BoolVar(&enableTLS, "enable-tls", false, "enable TLS")
var certFile string
flag.StringVar(&certFile, "cer... | Change server default option values | Change server default option values
| Go | mit | hnakamur/rdirsync |
306ae40d485c7e19d9fb747c9109204af140e72f | router/router.go | router/router.go | package router
import(
"github.com/ricallinson/forgery"
"github.com/spacedock-io/registry/images"
"github.com/spacedock-io/registry/repositories"
"github.com/spacedock-io/registry/auth"
)
func Routes(server *f.Server) {
/* Home page */
server.Get("/", func(req *f.Request, res *f.Response, next func()) {
... | package router
import(
"github.com/ricallinson/forgery"
"github.com/spacedock-io/registry/images"
"github.com/spacedock-io/registry/repositories"
"github.com/spacedock-io/registry/auth"
)
func Routes(server *f.Server) {
/* Home page */
server.Get("/", func(req *f.Request, res *f.Response, next func()) {
... | Fix function name for PUT .../layer | Fix function name for PUT .../layer
| Go | mit | spacedock-io/registry |
d57f1a6248cf3313dc97f69d3d5f5feb46ce59e1 | routes/routes.go | routes/routes.go | package routes
import (
"encoding/json"
"net/http"
)
type Arguments map[interface{}]interface{}
type Handler func(*http.Request, Arguments) (int, interface{})
type IntermediateHandler func(http.ResponseWriter, *http.Request, Arguments) (int, interface{})
type Decorator interface {
Decorate(IntermediateHandler) ... | package routes
import (
"encoding/json"
"net/http"
)
var registeredHandlers = make([]RegisteredHandler, 0x40)
type RegisteredHandler struct {
Pattern string
Handler http.HandlerFunc
}
type Arguments map[interface{}]interface{}
type Handler func(*http.Request, Arguments) (int, interface{})
type IntermediateHan... | Store registered route handlers in a slice. | Store registered route handlers in a slice.
They were directly registered using `http.HandleFunc` before.
| Go | apache-2.0 | trackit/trackit,trackit/trackit,trackit/trackit |
7eb6028b28527a869d6c680867303c1edf3f36f4 | reflect/reflect.go | reflect/reflect.go | // Package reflect adds some useful features to the standard reflect package.
package reflect
import "reflect"
// IsDefined checks if the value is different from nil looking further to its
// contents.
func IsDefined(value interface{}) bool {
if value == nil {
return false
}
v := reflect.ValueOf(value)
switch ... | // Package reflect adds some useful features to the standard reflect package.
package reflect
import "reflect"
// IsDefined checks if the value is different from nil looking further to its
// contents.
func IsDefined(value interface{}) bool {
if value == nil {
return false
}
return isDefined(reflect.ValueOf(val... | Allow chaining multiple interfaces or pointers | Allow chaining multiple interfaces or pointers
Now the verification isn't limited on 2 levels of reference anymore.
| Go | mit | registrobr/gostk |
43da41826b4d1ca50d8fa3a218032c380ef4423f | 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 NewHttp to the list of captured interfaces | Add NewHttp to the list of captured interfaces
This adds some nice error reporting info like IP address, cookies, headers, etc.
See https://github.com/getsentry/raven-go/blob/master/http.go#L76
| Go | mit | gin-contrib/cache,gin-contrib/cache |
65a77154929c1ab41755121e92264cdddefd7788 | model/user_info.go | model/user_info.go | package model
import (
"errors"
"time"
)
// UserInfo holds the parameters returned by the backends.
// This information will be serialized to build the JWT token contents.
type UserInfo struct {
Sub string `json:"sub"`
Picture string `json:"picture,omitempty"`
Name string `json:"name,omitempty"`
Email ... | package model
import (
"errors"
"time"
)
// UserInfo holds the parameters returned by the backends.
// This information will be serialized to build the JWT token contents.
type UserInfo struct {
Sub string `json:"sub"`
Picture string `json:"picture,omitempty"`
Name string `json:"name,omitempty"`
Em... | Add jwt refresh count to jwt payload model | Add jwt refresh count to jwt payload model
| Go | mit | tarent/loginsrv,tarent/loginsrv,tarent/loginsrv |
15d346e3c9572f3e7b72351d8553be589d068a7e | src/cli/qupload.go | src/cli/qupload.go | package cli
import (
"github.com/qiniu/log"
"qshell"
"strconv"
)
func QiniuUpload(cmd string, params ...string) {
if len(params) == 1 || len(params) == 2 {
var uploadConfigFile string
var threadCount int64
var err error
if len(params) == 2 {
threadCount, err = strconv.ParseInt(params[0], 10, 64)
if ... | package cli
import (
"github.com/qiniu/log"
"qshell"
"strconv"
)
func QiniuUpload(cmd string, params ...string) {
if len(params) == 1 || len(params) == 2 {
var uploadConfigFile string
var threadCount int64
var err error
if len(params) == 2 {
threadCount, err = strconv.ParseInt(params[0], 10, 64)
if ... | Update warn to info to make customer happy | Update warn to info to make customer happy
| Go | mit | qiniu-lab/qshell,liangchao07115/qshell,qiniu-lab/qshell,jemygraw/qshell,liangchao07115/qshell,qiniu/qshell,jemygraw/qshell |
332475f27f78b694a0ea78baa2c228f11212f704 | example/example.go | example/example.go | package main
import (
"bytes"
"fmt"
"github.com/alanctgardner/gogen-avro/example/avro"
)
// Use a go:generate directive to build the Go structs for `example.avsc`
// Source files will be in a package called `avro`
//go:generate $GOPATH/bin/gogen-avro ./avro example.avsc
func main() {
// Create a new DemoSchema ... | package main
import (
"bytes"
"fmt"
"github.com/alanctgardner/gogen-avro/example/avro"
)
// Use a go:generate directive to build the Go structs for `example.avsc`
// Source files will be in a package called `avro`
//go:generate mkdir -p ./avro
//go:generate $GOPATH/bin/gogen-avro ./avro example.avsc
func main() ... | Add mkdir to go generate | Add mkdir to go generate
| Go | mit | alanctgardner/gogen-avro,alanctgardner/gogen-avro |
76ac0c57a1a7c0b085552a48f89705cb52552b5d | examples/create.go | examples/create.go | package main
import (
"fmt"
"github.com/s3git/s3git-go"
"strings"
)
func main() {
repo, _ := s3git.InitRepository(".")
repo.Add(strings.NewReader("hello s3git"))
repo.Commit("Initial commit")
list, _ := repo.List("")
for l := range list {
fmt.Println(l)
}
commits, _ := repo.ListCommits("")
for comm... | package main
import (
"fmt"
"github.com/s3git/s3git-go"
"strings"
)
func main() {
repo, _ := s3git.InitRepository(".")
repo.Add(strings.NewReader("hello s3git"))
repo.Commit("Initial commit")
commits, _ := repo.ListCommits("")
for commit := range commits {
fmt.Println(commit)
}
}
| Move list to clone example | Move list to clone example
| Go | apache-2.0 | s3git/s3git-go |
3ae3529f751f8934d2dbca765ff8cb897882c632 | cues/cueList.go | cues/cueList.go | package cues
import (
"errors"
)
type CueList struct {
Cues []Cue
}
func (cueList CueList) ConvertCues() (string, error) {
var err error
ret := "Ident 3:0\r\nClear Cues\r\n"
if cueList.Cues != nil {
for i := range cueList.Cues {
line, _ := cueList.Cues[i].ConvertToAscii()
ret += line
} //end iterate ... | package cues
import (
"errors"
)
type CueList struct {
Cues []Cue
}
func (cueList CueList) ConvertCues() (string, error) {
var err error
ret := "Ident 3:0\r\n"
if cueList.Cues != nil {
for i := range cueList.Cues {
line, _ := cueList.Cues[i].ConvertToAscii()
ret += line
} //end iterate cueList for
... | Remove Clear Cues entry in output file | Remove Clear Cues entry in output file
It looks like most spreadsheet applications don't support exporting all
sheets into a single csv. In order to import a show from multiple
sheets, users will need to be able to import multiple files without
blowing out the file they just uploaded.
| Go | mit | woz5999/CueDescriptionsToASCII,woz5999/CueDescriptionsToASCII,woz5999/CueDescriptionsToASCII |
0a60f16853d284840a996c695ca621519ad32724 | context.go | context.go | package chuper
import (
"net/url"
"github.com/PuerkitoBio/fetchbot"
)
type Context struct {
*fetchbot.Context
Cache Cache
}
func (c *Context) SourceURL() *url.URL {
switch cmd := c.Cmd.(type) {
case Cmd:
return cmd.SourceURL()
default:
return nil
}
}
| package chuper
import (
"net/url"
"github.com/PuerkitoBio/fetchbot"
)
type Context struct {
*fetchbot.Context
C Cache
}
func (c *Context) Cache() Cache {
return c.C
}
func (c *Context) Queue() *fetchbot.Queue {
return c.Q
}
func (c *Context) URL() *url.URL {
return c.Cmd.URL()
}
func (c *Context) SourceUR... | Add Cache, Queue and URL methods to Context | Add Cache, Queue and URL methods to Context
| Go | bsd-3-clause | oli-g/chuper,sluceno/chuper |
9fbc3f72fa4f770e86ab53c0863ab55b5592d00d | services/cc.go | services/cc.go | package services
import (
"fmt"
"os/exec"
)
func ccompile(source, dialect string) (out []byte, err error) {
var standard string
switch dialect {
case "ansi":
standard = "-ansi"
case "c89":
standard = "-std=c89"
case "c90":
standard = "-std=c90"
case "c99":
standard = "-std=c99"
case "c11":
standard... | package services
import (
"fmt"
"os/exec"
)
func ccompile(source, dialect string) ([]byte, error) {
var std string
switch dialect {
case "ansi":
std = "-ansi"
case "c89":
std = "-std=c89"
case "c90":
std = "-std=c90"
case "c99":
std = "-std=c99"
case "c11":
std = "-std=c11"
}
out, err = exec.Comm... | Build with static linking for better memory readout when judging. | Build with static linking for better memory readout when judging.
| Go | agpl-3.0 | clashr/buildrpcd |
5300c55a73f678fda2830a9909c8df1c55b257b2 | cli_test.go | cli_test.go | package main
import ()
func ExampleCliNoArguments() {
repos := map[string]Repo{
"zathura": Repo{},
"test": Repo{},
"gamma": Repo{},
}
app := BuildCLI(repos, Config{})
args := make([]string, 1)
app.Run(args)
// Output: gamma
// test
// zathura
}
func ExampleCliPrintItem() {
repos := map[string]R... | package main
// func ExampleCliNoArguments() {
// repos := map[string]Repo{
// "zathura": Repo{},
// "test": Repo{},
// "gamma": Repo{},
// }
// app := BuildCLI(repos, Config{})
// args := make([]string, 1)
// app.Run(args)
// // Output: gamma
// // test
// // zathura
// }
// func ExampleCliPrint... | Disable CLI tests since CLI was rewritten | Disable CLI tests since CLI was rewritten
| Go | mit | thiderman/sagacity |
3f6c538dd1af6ac31ed8f112edbb21e76b9c973b | socket/socket.go | socket/socket.go | package netlink
//import "bytes"
//import "encoding/binary"
import "os"
import "syscall"
type Socket struct {
fd int
}
func toErr(eno int)(err os.Error){
if eno != 0 { err = os.NewError(syscall.Errstr(eno))}
return
}
func Dial(nlf NetlinkFamily)(rwc *Socket, err os.Error){
//func Dial(nlfam netlinkFamily)(r... | package netlink
import "os"
import "syscall"
type Socket struct {
fd int
}
func toErr(eno int)(err os.Error){
if eno != 0 { err = os.NewError(syscall.Errstr(eno))}
return
}
func Dial(nlf NetlinkFamily)(rwc *Socket, err os.Error){
fdno, errno := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_DGRAM, int(nlf)... | Remove bogus panics, spurious comments | Remove bogus panics, spurious comments
| Go | bsd-3-clause | abneptis/GoNetlink |
81e0b8ff7074d90473fc6a2887173c97d1394f0c | subvert_test.go | subvert_test.go | package main
import (
"reflect"
"regexp"
"testing"
)
var genMatcherTests = []struct {
src string
dst *regexp.Regexp
}{
{"abc", regexp.MustCompile(`abc`)},
{"a,b", regexp.MustCompile(`(a|b)`)},
}
func TestGenMatcher(t *testing.T) {
for _, test := range genMatcherTests {
expect := test.dst
actual, err := ... | 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 :... | Fix spec to capture by default | Fix spec to capture by default
| Go | mit | kusabashira/msub |
7ce6676f1efbcebd5d16c292947187bee7cf9df3 | piglowservice/piglow.go | piglowservice/piglow.go | package piglowservice
import (
"log"
pb "github.com/didrocks/grpc-piglow/proto"
context "golang.org/x/net/context"
)
func (s *service) SetLED(ctx context.Context, in *pb.LedRequest) (*pb.Ack, error) {
s.p.SetLED((int8)(in.Num), (uint8)(in.Brightness))
err := s.p.Apply()
if err != nil { // Apply the changes
l... | package piglowservice
import (
"log"
"fmt"
pb "github.com/didrocks/grpc-piglow/proto"
context "golang.org/x/net/context"
)
func (s *service) SetLED(ctx context.Context, in *pb.LedRequest) (*pb.Ack, error) {
var err error
n, err := ensureNumLed(in.Num)
if err != nil {
return nil, err
}
b, err := ensureBr... | Add safeguards on values sent | Add safeguards on values sent
Returns an error for any out of bounds value (as go-piglow wouldn't)
| Go | mit | didrocks/grpc-piglow |
5e90f0a57bf21393a12ffc05e022760a71098d92 | src/constants.go | src/constants.go | package fzf
import (
"time"
"github.com/junegunn/fzf/src/util"
)
const (
// Current version
Version = "0.10.1"
// Core
coordinatorDelayMax time.Duration = 100 * time.Millisecond
coordinatorDelayStep time.Duration = 10 * time.Millisecond
// Reader
defaultCommand = `find * -path '*/\.*' -prune -o -type f -... | package fzf
import (
"time"
"github.com/junegunn/fzf/src/util"
)
const (
// Current version
Version = "0.10.1"
// Core
coordinatorDelayMax time.Duration = 100 * time.Millisecond
coordinatorDelayStep time.Duration = 10 * time.Millisecond
// Reader
defaultCommand = `find . -path '*/\.*' -prune -o -type f -... | Fix default command so that it doesn't fail on dash-prefixed files | Fix default command so that it doesn't fail on dash-prefixed files
Close #310
| Go | mit | qiemem/fzf,pokey/fzf,jebaum/fzf,infokiller/fzf,janusnic/fzf,jebaum/fzf,hyiltiz/fzf,tomfitzhenry/pkg-fzf,mhartington/fzf,janlazo/fzf,stevenqzhang/fzf,wilywampa/fzf,NgaNguyenDuy/fzf,noscript/fzf,hyiltiz/fzf,mjwestcott/fzf,alerque/fzf,jebaum/fzf,janlazo/fzf,stevenqzhang/fzf,janlazo/fzf,junegunn/fzf,noscript/fzf,d4ndo/fzf,... |
dcb040897dbb65d073d0e40bee1a32fba9db1dea | server/routing.go | server/routing.go | package server
import (
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2"
)
// RegisterRoutes registers all routes needed to serve the patient merging service.
func RegisterRoutes(router *gin.Engine, session *mgo.Session, dbname string, fhirHost string) {
mc := NewMergeController(session, dbname, fhirHost)
// Mergin... | package server
import (
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2"
)
// RegisterRoutes registers all routes needed to serve the patient merging service.
func RegisterRoutes(router *gin.Engine, session *mgo.Session, dbname string, fhirHost string) {
mc := NewMergeController(session, dbname, fhirHost)
// Mergin... | Abort is now alias for DeleteMerge | Abort is now alias for DeleteMerge
Both the POST /merge/:merge_id/abort and DELETE /merge/:merge_id perform the same operation.
| Go | apache-2.0 | mitre/ptmerge |
5cf7879419d7dbb61e3aaeb7ab0002dbf908a4b8 | cmd/mdbd/loadText.go | cmd/mdbd/loadText.go | package main
import (
"bufio"
"github.com/Symantec/Dominator/lib/mdb"
"io"
"log"
"strings"
)
func loadText(reader io.Reader, logger *log.Logger) (*mdb.Mdb, error) {
scanner := bufio.NewScanner(reader)
var newMdb mdb.Mdb
for scanner.Scan() {
fields := strings.Fields(scanner.Text())
if len(fields) > 0 {
... | package main
import (
"bufio"
"github.com/Symantec/Dominator/lib/mdb"
"io"
"log"
"strings"
)
func loadText(reader io.Reader, logger *log.Logger) (*mdb.Mdb, error) {
scanner := bufio.NewScanner(reader)
var newMdb mdb.Mdb
for scanner.Scan() {
fields := strings.Fields(scanner.Text())
if len(fields) > 0 {
... | Change mdbd text driver to ignore comment lines. | Change mdbd text driver to ignore comment lines.
| Go | apache-2.0 | keep94/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator |
c04f473fd63fad6145965f143c76f25684af60f6 | meeple_mover.go | meeple_mover.go | package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "It puts the meeple in the basket")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
| package main
import (
"fmt"
"net/http"
"strings"
"github.com/rkbodenner/parallel_universe/game"
)
func handler(w http.ResponseWriter, r *http.Request) {
game := game.NewGame(nil, 2)
players := make([]string, 0)
for _,p := range game.Players {
players = append(players, (string)(p))
}
playerText :... | Connect lib to web service | Connect lib to web service
| Go | mit | rkbodenner/meeple_mover,rkbodenner/meeple_mover |
c75298e3594a0d5f0c88112fbc0543edb6212d5b | merkle/types.go | merkle/types.go | package merkle
type Tree interface {
Size() (size int)
Height() (height int8)
Has(key []byte) (has bool)
Proof(key []byte) (value []byte, proof []byte, exists bool) // TODO make it return an index
Get(key []byte) (index int, value []byte, exists bool)
GetByIndex(index int) (key []byte, value []byte)
Set(key []b... | package merkle
type Tree interface {
Size() (size int)
Height() (height int8)
Has(key []byte) (has bool)
Proof(key []byte) (value []byte, proof []byte, exists bool) // TODO make it return an index
Get(key []byte) (index int, value []byte, exists bool)
GetByIndex(index int) (key []byte, value []byte)
Set(key []b... | Update SimpleMap to hash both keys and values for benefit; Hashable is Hasher; Don't assume go-wire | Update SimpleMap to hash both keys and values for benefit; Hashable is Hasher; Don't assume go-wire
| Go | apache-2.0 | tendermint/tendermint,tendermint/tendermint,tendermint/tendermint,tendermint/tendermint |
db1bf7202e706de8d7460c1b54494ac7ab481a59 | cf_http_test.go | cf_http_test.go | package cf_http_test
import (
"net/http"
"time"
"github.com/cloudfoundry-incubator/cf_http"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CfHttp", func() {
Describe("NewClient", func() {
Context("when a default timeout has been initialized", func() {
var timeout time.Duration
... | package cf_http_test
import (
"net/http"
"time"
"github.com/cloudfoundry-incubator/cf_http"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CfHttp", func() {
Describe("NewClient", func() {
var timeout time.Duration
BeforeEach(func() {
timeout = 1 * time.Second
})
It("ret... | Change test structure to work around global | Change test structure to work around global
| Go | apache-2.0 | cloudfoundry-incubator/cf_http,cloudfoundry-incubator/cf_http |
aee2ec6a8097021180c3904c3201946294afe55c | compiler_launcher.go | compiler_launcher.go | package main
import (
"os"
"path/filepath"
)
// FindCompilerLanuncher probes compiler launcher if exists.
// Currently only probes SN-DBS launcher.
func FindCompilerLauncher() string {
dir, ok := os.LookupEnv("SCE_SDK_ROOT")
if ok {
lancherPath := filepath.Join(dir, "Common", "SN-DBS", "bin", "dbsbuild.exe")
... | package main
import (
"os"
"path/filepath"
)
// FindCompilerLanuncher probes compiler launcher if exists.
// Currently only probes SN-DBS launcher.
func FindCompilerLauncher() string {
dir, ok := os.LookupEnv("SCE_ROOT_DIR")
if ok {
lancherPath := filepath.Join(dir, "Common", "SN-DBS", "bin", "dbsbuild.exe")
... | Fix a wrong environment variable reference | fix: Fix a wrong environment variable reference
| Go | mit | zsuzuki/gobuild |
b0857eb2c02e539b1813b531247822cb0a08d089 | myaws/config.go | myaws/config.go | package myaws
import (
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/spf13/viper"
)
func NewConfig() *aws.Config {
return &aws.Config{
Credentials: newCredentials(viper.GetString("profile")),
Region: getRegion(viper.GetString("region")),
}
}
func newCred... | package myaws
import (
"net/http"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/spf13/viper"
)
func NewConfig() *... | Add support IAM Role credentials | Add support IAM Role credentials
| Go | mit | minamijoyo/myaws |
34f8fce3674f610cd4edcb5c81772486c444f018 | src/github.com/steelseries/golisp/main/repl.go | src/github.com/steelseries/golisp/main/repl.go | // Copyright 2013 SteelSeries ApS. All rights reserved.
// No license is given for the use of this source code.
// This package impliments a basic LISP interpretor for embedding in a go program for scripting.
// This file provides a repl
package main
import (
"bufio"
"fmt"
"github.com/steelseries/golisp"
... | // Copyright 2013 SteelSeries ApS. All rights reserved.
// No license is given for the use of this source code.
// This package impliments a basic LISP interpretor for embedding in a go program for scripting.
// This file provides a repl
package main
import (
"bufio"
"flag"
"fmt"
"github.com/steelseri... | Add files on the command line, cleanup | Add files on the command line, cleanup
| Go | bsd-3-clause | SteelSeries/golisp,ToadKing/golisp,SteelSeries/golisp,SteelSeries/golisp |
67414dd968fe19234658385b3ef1fca06240ef55 | io/curses/output.go | io/curses/output.go | package curses
// Handles all output.
import (
"code.google.com/p/goncurses"
"github.com/discoviking/roguemike/io"
)
var screen *goncurses.Window
var Input chan *io.UpdateBundle
func Init() error {
s, err := goncurses.Init()
screen = s
if err != nil {
return err
}
goncurses.Raw(true)
goncurses.Echo(false... | package curses
// Handles all output.
import (
"github.com/discoviking/roguemike/io"
"github.com/rthornton128/goncurses"
)
var screen *goncurses.Window
var Input chan *io.UpdateBundle
func Init() error {
s, err := goncurses.Init()
screen = s
if err != nil {
return err
}
goncurses.Raw(true)
goncurses.Echo... | Use more proper curses package.' | Use more proper curses package.'
| Go | mit | DiscoViking/roguemike |
99cfacecefa730f7f8b6317abff267bdaf190b5f | api/postits.go | api/postits.go | package main
import (
"io"
"net/http"
)
type Postit struct {
Id string
Title string
Coords [2]int
Board_id string
//FIXME : corners
}
func ListPostits(w http.ResponseWriter, req *http.Request) {
board_id := req.URL.Query().Get("Board_id")
io.WriteString(w, "Listing postits: "+board_id+"\n")
// FIXME : w... | package main
import (
"io"
"io/ioutil"
"net/http"
"time"
"fmt"
"encoding/json"
"strconv"
)
type Postit struct {
Id string
Title string
Coords [2]int
Board_id string
//FIXME : corners
}
var Postits []Postit
func ListPostits(w http.ResponseWriter, req *http.Request) {
board_id := req.URL.Query().Get("Bo... | Create postit, not linking to board_id yet | Create postit, not linking to board_id yet
| Go | mit | AF83/koalab,AF83/koalab |
393a203dd0b05f7d7ba902db994241c14de1126f | syscalls_other.go | syscalls_other.go | // +build !(linux | darwin)
package water
import "errors"
func newTAP(ifName string) (ifce *Interface, err error) {
return nil, errors.New("tap interface not implemented on this platform")
}
func newTUN(ifName string) (ifce *Interface, err error) {
return nil, errors.New("tap interface not implemented on this pla... | // +build !linux,!darwin
package water
import "errors"
func newTAP(ifName string) (ifce *Interface, err error) {
return nil, errors.New("tap interface not implemented on this platform")
}
func newTUN(ifName string) (ifce *Interface, err error) {
return nil, errors.New("tap interface not implemented on this platfo... | Build constraints adopted to documented one | Build constraints adopted to documented one
| Go | bsd-3-clause | ArroyoNetworks/water,songgao/water |
ca6d60bfdcd711f0ea913b4ea37f979890c4ccd9 | sockets.go | sockets.go | package main
import (
"fmt"
"log"
"net"
"strings"
)
func main() {
l, err := net.Listen("tcp", ":2000")
if err != nil {
log.Fatal(err)
}
defer l.Close()
for {
conn, err := l.Accept()
if err != nil {
log.Fatal(err)
}
go func(c net.Conn) {
buf := make([]byte, 4096)
for {
n, err := c.R... | package main
import (
"fmt"
"log"
"net"
"strings"
)
func main() {
l, err := net.Listen("tcp", ":2000")
if err != nil {
log.Fatal(err)
}
defer l.Close()
for {
conn, err := l.Accept()
if err != nil {
log.Fatal(err)
}
go func(c net.Conn) {
buf := make([]byte, 4096)
for {
fmt.Println(... | Add return on specific value | Add return on specific value
| Go | mit | icambridge/go-playground |
d22d0a9a24252ba277d06c53a408ea428b65056f | testutils_test.go | testutils_test.go | package testutils
import (
"fmt"
"testing"
)
func Test_exampleData(t *testing.T) {
st, err := exampleData("check01")
if err != nil {
t.Error("error reading check01")
}
expLen := 644
if len(st) == expLen {
t.Log("got example data")
} else {
t.Error(fmt.Sprintf("bad example data: expected %d, got %d - %s"... | package testutils
import (
"fmt"
"testing"
)
func Test_exampleData(t *testing.T) {
st, err := exampleData("check01")
if err != nil {
t.Error("error reading check01")
}
expLen := 644
if len(st) == expLen {
t.Log("got example data")
} else {
t.Error(fmt.Sprintf("bad example data: expected %d, got %d - %s"... | Test the error case too | Test the error case too
| Go | apache-2.0 | bobtfish/sensuplugingo |
2e860c557cd85ffe324df315829edb247c1a2259 | src/core/storage/db/setups.go | src/core/storage/db/setups.go | package db
import "github.com/jmoiron/sqlx"
// Setup setup the database connection and init the Writer
func Setup(uri string) error {
db, err := sqlx.Connect("postgres", uri)
if err != nil {
return err
}
Writer = db
return nil
}
| package db
import "github.com/jmoiron/sqlx"
// Setup setup the database connection and init the Writer
func Setup(uri string) error {
db, err := sqlx.Connect("postgres", uri)
if err != nil {
return err
}
// Unsafe returns a version of DB which will silently succeed to scan when
// columns in the SQL result ha... | Use an unsafe object not to have to handle 'useless' fields | chore(db): Use an unsafe object not to have to handle 'useless' fields
| Go | mit | ml-tv/tv-api,ml-tv/tv-api |
b0245d688b93d66794e509d977d444d6f3cc0086 | checkpoint/redis/redis_test.go | checkpoint/redis/redis_test.go | package redis
import (
"testing"
"gopkg.in/redis.v5"
)
var defaultAddr = "127.0.0.1:6379"
func Test_CheckpointLifecycle(t *testing.T) {
client := redis.NewClient(&redis.Options{Addr: defaultAddr})
c := &Checkpoint{
appName: "app",
client: client,
}
// set checkpoint
c.Set("streamName", "shardID", "tes... | package redis
import (
"testing"
)
func Test_CheckpointLifecycle(t *testing.T) {
// new
c, err := New("app")
if err != nil {
t.Fatalf("new checkpoint error: %v", err)
}
// set
c.Set("streamName", "shardID", "testSeqNum")
// get
val, err := c.Get("streamName", "shardID")
if err != nil {
t.Fatalf("get c... | Add more test coverage for Redis Checkpoint | Add more test coverage for Redis Checkpoint
| Go | mit | harlow/kinesis-connectors |
ac0188e42ab3ed804605063dbd2f6c4ecb18da5d | config/phase_slack_notifier.go | config/phase_slack_notifier.go | package config
import (
"github.com/nlopes/slack"
)
type SlackNotifierPhase struct {
Client *slack.Client
Channel string
Format func(Deployment) (string, error)
}
func (snp *SlackNotifierPhase) HasExecuted(deployment Deployment) (bool, error) {
return false, nil
}
func (snp *SlackNotifierPhase) Execute(deplo... | package config
import (
"github.com/nlopes/slack"
)
type SlackNotifierPhase struct {
Client *slack.Client
Channel string
Format func(Deployment) (string, error)
}
func (snp *SlackNotifierPhase) CanPreload() bool {
return false
}
func (snp *SlackNotifierPhase) HasExecuted(deployment Deployment) (bool, error) ... | Add missing `CanPreload` to Slack notifier phase | Add missing `CanPreload` to Slack notifier phase
| Go | mit | Everlane/evan |
74a86c1b5e13feab29a7b1c4ed10e62d33109f42 | pkg/util/timeout.go | pkg/util/timeout.go | package util
import (
"fmt"
"time"
)
// TimeoutError is error returned after timeout occured.
type TimeoutError struct {
after time.Duration
}
// Error implements the Go error interface.
func (t *TimeoutError) Error() string {
return fmt.Sprintf("calling the function timeout after %v", t.after)
}
// TimeoutAfte... | package util
import (
"fmt"
"time"
)
// TimeoutError is error returned after timeout occured.
type TimeoutError struct {
after time.Duration
}
// Error implements the Go error interface.
func (t *TimeoutError) Error() string {
return fmt.Sprintf("calling the function timeout after %v", t.after)
}
// TimeoutAfte... | Fix potential panic in TimeoutAfter | Fix potential panic in TimeoutAfter
| Go | apache-2.0 | php-coder/source-to-image,coreydaley/source-to-image,PI-Victor/source-to-image,dobbymoodge/source-to-image,csrwng/source-to-image,PI-Victor/source-to-image,csrwng/source-to-image,coreydaley/source-to-image,php-coder/source-to-image,mfojtik/source-to-image,guangxuli/source-to-image,openshift/source-to-image,rhcarvalho/s... |
3a7c41fba202bfa439278ddf54164e3759b3e2de | testing/testbase/log.go | testing/testbase/log.go | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testbase
import (
"flag"
"github.com/juju/loggo"
"github.com/juju/testing"
gc "launchpad.net/gocheck"
)
// LoggingSuite redirects the juju logger to the test logger
// when embedded in a gocheck suite type... | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testbase
import (
"flag"
"github.com/juju/loggo"
"github.com/juju/testing"
gc "launchpad.net/gocheck"
)
// LoggingSuite redirects the juju logger to the test logger
// when embedded in a gocheck suite type... | Correct name to LoggingCleanupSuite in SetUp methods | Correct name to LoggingCleanupSuite in SetUp methods | Go | agpl-3.0 | dimitern/juju,cherylj/juju,mjs/juju,mhilton/juju,bogdanteleaga/juju,gabriel-samfira/juju,marcmolla/juju,mjs/juju,cloud-green/juju,cmars/juju,voidspace/juju,mikemccracken/juju,cmars/juju,AdamIsrael/juju,bac/juju,davecheney/juju,rogpeppe/juju,bac/juju,tych0/juju,ericsnowcurrently/juju,perrito666/juju,mattyw/juju,bac/juju... |
95bdf67e863055eebcc3853a20a8036ee96902d0 | devices/device.go | devices/device.go | package devices
type Device interface {
Init()
Destroy()
Read() Measurement
}
var Devices = map[string]func(uint8, int) (Device, error){
"adxl345": NewAdxl345,
}
| package devices
type Device interface {
Init()
Destroy()
Read() Measurement
}
var Devices = map[string]func(uint8, int) (Device, error){
"adxl345": NewAdxl345,
"itg3200": NewItg3200,
}
| Add itg3200 constructor to LUT | Add itg3200 constructor to LUT
| Go | isc | dmelani/data_logger |
edc4918236028e37f77838726183e0b9ee047db1 | example_test.go | example_test.go | package sqlcond_test
import (
"database/sql"
"fmt"
"sqlcond"
"time"
_ "github.com/go-sql-driver/mysql"
)
func mustExec(db *sql.DB, query string) {
if _, err := db.Exec(query); err != nil {
panic(err)
}
}
func getDatabase() *sql.DB {
db, err := sql.Open("mysql", "root@/sqlcond")
if err != nil {
panic(er... | package sqlcond_test
import (
"database/sql"
"fmt"
"time"
"github.com/WatchBeam/sqlcond"
_ "github.com/go-sql-driver/mysql"
)
func mustExec(db *sql.DB, query string) {
if _, err := db.Exec(query); err != nil {
panic(err)
}
}
func getDatabase() *sql.DB {
db, err := sql.Open("mysql", "root@/sqlcond")
if er... | Add full path to example import path | Add full path to example import path
| Go | mit | WatchBeam/sqlcond |
876a88b63c155ed97b093821876fcd9d17e92a21 | go1/mock/imap_test.go | go1/mock/imap_test.go | //
// Written by Maxim Khitrov (June 2013)
//
package mock
import (
"testing"
"code.google.com/p/go-imap/go1/imap"
)
func TestNewClientOK(T *testing.T) {
C, t := Client(T,
`S: * OK Test server ready`,
`C: A1 CAPABILITY`,
`S: * CAPABILITY IMAP4rev1 XYZZY`,
`S: A1 OK Thats all she wrote!`,
EOF,
)
t.Che... | //
// Written by Maxim Khitrov (June 2013)
//
package mock_test
import (
"testing"
"code.google.com/p/go-imap/go1/imap"
"code.google.com/p/go-imap/go1/mock"
)
func TestNewClientOK(T *testing.T) {
C, t := mock.Client(T,
`S: * OK Test server ready`,
`C: A1 CAPABILITY`,
`S: * CAPABILITY IMAP4rev1 XYZZY`,
`... | Use a different package name in the mock unit tests. | Use a different package name in the mock unit tests.
| Go | bsd-3-clause | mxk/go-imap,tjyang/go-imap,boxer/go-imap,bluzye/go-imap,simia-tech/go-imap |
0d3e26e96f28288978329b936a5b8f75beb0df4e | cmd/septa/next.go | cmd/septa/next.go | package main
import (
"context"
"flag"
"fmt"
"github.com/dherbst/septa"
)
// NextToArrive takes a "from" station name and a "to" station name and returns the expected trains.
func NextToArrive(ctx context.Context) {
from := flag.Arg(1)
to := flag.Arg(2)
fmt.Printf("from=%v to=%v\n", from, to)
client := septa... | package main
import (
"context"
"flag"
"fmt"
"github.com/dherbst/septa"
)
// NextToArrive takes a "from" station name and a "to" station name and returns the expected trains.
func NextToArrive(ctx context.Context) {
from := flag.Arg(1)
to := flag.Arg(2)
fmt.Printf("from=%v to=%v\n", from, to)
client := sept... | Remove superfluous 'Done' from output. | Remove superfluous 'Done' from output.
| Go | mit | dherbst/go-septa |
8ba2379b83f8bd52444b9a1b9628a916bdc67ea4 | groupme/gmservice.go | groupme/gmservice.go | package groupme
import (
"bytes"
"encoding/json"
"io"
"net/http"
"time"
"github.com/nelsonleduc/calmanbot/service"
"github.com/nelsonleduc/calmanbot/utility"
)
const postDelayMilliseconds = 500
const groupmeLengthLimit = 1000
func init() {
service.AddService("groupme", gmService{})
}
type gmService struct{... | package groupme
import (
"bytes"
"encoding/json"
"io"
"net/http"
"time"
"github.com/nelsonleduc/calmanbot/service"
"github.com/nelsonleduc/calmanbot/utility"
)
const postDelayMilliseconds = 500
const groupmeLengthLimit = 1000
func init() {
service.AddService("groupme", gmService{})
}
type gmService struct{... | Fix bug with 1000 character fix | Fix bug with 1000 character fix
| Go | mit | NelsonLeDuc/CalmanBot,NelsonLeDuc/CalmanBot |
0d144d70e7a83968c6f829c89a9f89f6ed6f3abc | test/test_redis.go | test/test_redis.go | package main
import (
"path/filepath"
c "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-check"
)
type RedisSuite struct {
Helper
}
var _ = c.ConcurrentSuite(&RedisSuite{})
func (s *RedisSuite) TestDumpRestore(t *c.C) {
r := s.newGitRepo(t, "empty")
t.Assert(r.flynn("create"), Succeeds)
t.A... | package main
import (
"path/filepath"
c "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-check"
)
type RedisSuite struct {
Helper
}
var _ = c.ConcurrentSuite(&RedisSuite{})
func (s *RedisSuite) TestDumpRestore(t *c.C) {
a := s.newCliTestApp(t)
t.Assert(a.flynn("resource", "add", "redis"), Suc... | Fix race in redis test | test: Fix race in redis test
The redis appliance is not always ready when the `resource add` command
returns. Added a check that waits for the discoverd registration before
continuing.
Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com> | Go | bsd-3-clause | philiplb/flynn,lmars/flynn,benbjohnson/flynn,flynn/flynn,lmars/flynn,lmars/flynn,benbjohnson/flynn,philiplb/flynn,benbjohnson/flynn,flynn/flynn,lmars/flynn,philiplb/flynn,benbjohnson/flynn,flynn/flynn,benbjohnson/flynn,benbjohnson/flynn,flynn/flynn,philiplb/flynn,lmars/flynn,philiplb/flynn,flynn/flynn |
b47a459bb1f149e3e0dfaa051f39b59a4d01c1e2 | lib/objectclient/getObject.go | lib/objectclient/getObject.go | package objectclient
import (
"bytes"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/proto/objectserver"
"io"
)
type myReadCloser struct {
reader io.Reader
}
func (reader *myReadCloser) Read(b []byte) (int, error) {
return reader.Read(b)
}
func (reader *myReadCloser) Close() error {
... | package objectclient
import (
"bytes"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/proto/objectserver"
"io"
)
type myReadCloser struct {
io.Reader
}
func (reader *myReadCloser) Close() error {
return nil
}
func (objSrv *ObjectClient) getObjectReader(hashVal hash.Hash) (uint64,
io.R... | Fix infinite recursion bug in myReadCloser.Read() method. Simplify wrapper. | Fix infinite recursion bug in myReadCloser.Read() method. Simplify wrapper.
| Go | apache-2.0 | keep94/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator |
127d22a477f7ed4791d7b97b40adbfe5cafced81 | markdown/main_test.go | markdown/main_test.go | package markdown_test
import (
"os"
"github.com/russross/blackfriday"
"github.com/shurcooL/go/markdown"
)
func Example() {
input := []byte(`Title
=
This is a new paragraph. I wonder if I have too many spaces.
What about new paragraph.
But the next one...
Is really new.
1. Item one.
1. Item TWO.
Fin... | package markdown_test
import (
"log"
"os"
"github.com/shurcooL/go/markdown"
)
func Example() {
input := []byte(`Title
=
This is a new paragraph. I wonder if I have too many spaces.
What about new paragraph.
But the next one...
Is really new.
1. Item one.
1. Item TWO.
Final paragraph.
`)
output, e... | Test high level public API instead of internal. | Test high level public API instead of internal.
| Go | mit | shurcooL/go |
326529c3603b1e99070f8ecc5274408c6a6999c0 | fingerprint.go | fingerprint.go | package assets
import (
"bytes"
"crypto/md5"
"encoding/hex"
"io/ioutil"
"path/filepath"
"strings"
)
// Fingerprint is a filter that sets asset filenames to include a md5 hash
// of the file contents. This can help circumvent browser caching when changes
// are made.
func Fingerprint() Filter {
hasher := md5.Ne... | package assets
import (
"bytes"
"crypto/md5"
"encoding/hex"
"io/ioutil"
"strings"
)
// Fingerprint is a filter that sets asset filenames to include a md5 hash
// of the file contents. This can help circumvent browser caching when changes
// are made.
func Fingerprint() Filter {
hasher := md5.New()
return Filt... | Put hash before first period in filename | Put hash before first period in filename
| Go | mit | jbowens/assets |
69d4dd3f26cb03ef8c5171bc661725fc12304282 | prefer_test.go | prefer_test.go | package prefer
import (
"strings"
"testing"
)
func TestLoadCreatesNewConfiguration(t *testing.T) {
type Mock struct {
Name string `json:"name"`
Age int `json:"age"`
}
mock := Mock{}
configuration, err := Load("share/fixtures/example", &mock)
checkTestError(t, err)
file_path_index := strings.Index(c... | package prefer
import (
"strings"
"testing"
)
func TestLoadCreatesNewConfiguration(t *testing.T) {
type Mock struct {
Name string `json:"name"`
Age int `json:"age"`
}
mock := Mock{}
configuration, err := Load("share/fixtures/example", &mock)
checkTestError(t, err)
file_path_index := strings.Index(co... | Add test to ensure err returned for missing files | Add test to ensure err returned for missing files
| Go | mit | LimpidTech/prefer.go |
9e7c6f942e2414e9efdfb4e4cf0d25457312ffcc | lifecycle/server/shutdown.go | lifecycle/server/shutdown.go | package server
var shouldShutdown = make(chan bool, 1)
// RunForever runs for ever.
func RunForever() {
<-shouldShutdown
}
// Shutdown shutdowns the server gracefully.
func Shutdown() {
shouldShutdown <- true
}
| package server
import "github.com/xgfone/go-tools/atomics"
var (
shutdowned = atomics.NewBool()
shouldShutdown = make(chan bool, 1)
)
// RunForever runs for ever.
func RunForever() {
if shutdowned.Get() {
panic("The server has been shutdowned")
}
<-shouldShutdown
}
// Shutdown shutdowns the server gracef... | Add the new function IsShutdowned | Add the new function IsShutdowned
| Go | apache-2.0 | xgfone/go-tools |
715575001a2b5a96fa0cfc4402d29c959f1f48a0 | api/subscription.go | api/subscription.go | // Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package api // import "miniflux.app/api"
import (
"net/http"
"miniflux.app/http/response/json"
"miniflux.app/reader/subscription"
)
// GetSubscriptio... | // Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package api // import "miniflux.app/api"
import (
"net/http"
"miniflux.app/http/response/json"
"miniflux.app/reader/subscription"
)
// GetSubscriptio... | Use different variable names for localized errors | Use different variable names for localized errors
| Go | apache-2.0 | miniflux/miniflux,xqin/miniflux,xqin/miniflux,miniflux/miniflux,xqin/miniflux,miniflux/miniflux,xqin/miniflux |
c72543acbae9ab33657d5715823b2b90378c88be | govc/cli/register.go | govc/cli/register.go | /*
Copyright (c) 2014 VMware, 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 t... | /*
Copyright (c) 2014 VMware, 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 t... | Remove trailing _ from command name | Remove trailing _ from command name
| Go | apache-2.0 | runner-mei/govmomi,cgtexmex/govmomi,vmware/govmomi,dougm/govmomi,l1jiang/govmomi,daxgames/govmomi,excilsploft/govmomi,bruceadowns/govmomi,casualjim/govmomi,ilikejam/govmomi,ilikejam/govmomi,jrmycanady/govmomi,higebu/govmomi,cgtexmex/govmomi,bruceadowns/govmomi,excilsploft/govmomi,pietern/govmomi,cgtexmex/govmomi,vmware... |
d7a4edc76af7f376eb7f05b332053c684e0a3c73 | pkg/asset/machines/userdata.go | pkg/asset/machines/userdata.go | package machines
import (
"bytes"
"encoding/base64"
"text/template"
"github.com/pkg/errors"
)
var userDataListTmpl = template.Must(template.New("user-data-list").Parse(`
kind: List
apiVersion: v1
metadata:
resourceVersion: ""
selfLink: ""
items:
{{- range $name, $content := . }}
- apiVersion: v1
kind: Secr... | package machines
import (
"bytes"
"encoding/base64"
"text/template"
"github.com/pkg/errors"
)
var userDataListTmpl = template.Must(template.New("user-data-list").Parse(`
kind: List
apiVersion: v1
metadata:
resourceVersion: ""
selfLink: ""
items:
{{- range $name, $content := . }}
- apiVersion: v1
kind: Secr... | Disable template rendering for OpenStack | openstack: Disable template rendering for OpenStack
| Go | apache-2.0 | derekhiggins/installer,derekhiggins/installer |
1ec02ca07ebcb9b9fcf0016c29bba6734d7a1102 | translations/french_test.go | translations/french_test.go | package translations_test
import (
"github.com/cloudfoundry/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() {
us... | package translations_test
import (
. "github.com/cloudfoundry-incubator/cf-test-helpers/cf"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("i18n support", func() {
It("returns the french translation for cf quota", func() ... | Test translation behavior as it actually is | Test translation behavior as it actually is
[#116221251]
Signed-off-by: Nick Wei <88313de659f5f6f483e38ffe364817e8884d9f11@pivotal.io>
| Go | unknown | cloudfoundry/cli-acceptance-tests,cloudfoundry/cli-acceptance-tests,cloudfoundry/GATS,cloudfoundry/cli-acceptance-tests,cloudfoundry/GATS,cloudfoundry/GATS |
b0f1382bb1e8e0c34b2cf42a17a8e4a58a01ad56 | challenge46_test.go | challenge46_test.go | package cryptopals
import (
"encoding/base64"
"fmt"
"math/big"
"testing"
)
func TestDecryptRsaParityOracle(t *testing.T) {
priv := generateRsaPrivateKey(1024)
pub := priv.public()
encoded := "VGhhdCdzIHdoeSBJIGZvdW5kIHlvdSBkb24ndCBwbGF5IGFyb3VuZCB3aXRoIHRoZSBGdW5reSBDb2xkIE1lZGluYQ=="
message, _ := base64.Ra... | package cryptopals
import (
"encoding/base64"
"fmt"
"math/big"
"testing"
)
func TestDecryptRsaParityOracle(t *testing.T) {
priv := generateRsaPrivateKey(1024)
pub := priv.public()
encoded := "VGhhdCdzIHdoeSBJIGZvdW5kIHlvdSBkb24ndCBwbGF5IGFyb3VuZCB3aXRoIHRoZSBGdW5reSBDb2xkIE1lZGluYQ=="
message, _ := base64.Ra... | Fix division by two when decrypting (I was actually dividing by 2^e instead of just 2) | Fix division by two when decrypting (I was actually dividing by 2^e instead of just 2)
| Go | mit | Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go |
5403544d97f1af357772baa4f73e1a4202f2b6b7 | protoc/generate.go | protoc/generate.go | // This downloads and installs the protobuf compiler
//go:generate rm -rf include
//go:generate rm -rf bin
//go:generate rm -rf readme.txt
//go:generate rm -rf protoc.zip
//go:generate ./downloadProtoc.sh
//go:generate unzip protoc.zip -d .
package protoc
| // This downloads and installs the protobuf compiler
//go:generate rm -rf include
//go:generate rm -rf bin
//go:generate rm -rf readme.txt
//go:generate rm -rf protoc.zip
//go:generate bash ./downloadProtoc.sh
//go:generate unzip protoc.zip -d .
package protoc
| Deal with explicitly shelling out via bash | Deal with explicitly shelling out via bash
| Go | apache-2.0 | grafeas/grafeas,Grafeas/Grafeas,grafeas/grafeas |
1be067ae18f7bcd7be30856dd1149d58d1cea8bb | x/dclupgrade/types/proposed_upgrade.go | x/dclupgrade/types/proposed_upgrade.go | package types
import sdk "github.com/cosmos/cosmos-sdk/types"
func (upgrade ProposedUpgrade) HasApprovalFrom(address sdk.AccAddress) bool {
addrStr := address.String()
for _, approval := range upgrade.Approvals {
if approval.Address == addrStr {
return true
}
}
return false
}
| package types
import sdk "github.com/cosmos/cosmos-sdk/types"
func (upgrade ProposedUpgrade) HasApprovalFrom(address sdk.AccAddress) bool {
addrStr := address.String()
for _, approval := range upgrade.Approvals {
if approval.Address == addrStr {
return true
}
}
return false
}
func (upgrade ProposedUpgrad... | Add function for checking has reject from trustee | Add function for checking has reject from trustee
| Go | apache-2.0 | zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger,zigbee-alliance/distributed-compliance-ledger |
f6017185f73ffb7c6160c0fa2c9c3fa105bc2adf | acceptance/util.go | acceptance/util.go | // Copyright 2015 The Cockroach 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 ag... | // Copyright 2015 The Cockroach 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 ag... | Comment why this file does not have the "acceptance" build tag. | Comment why this file does not have the "acceptance" build tag.
Forgot to push this local change in the previous commit.
| Go | apache-2.0 | vaibhavarora/cockroach,arjun4084346/cockroach,slavau/cockroach,maxlang/cockroach,cockroachdb/cockroach,nieyy/cockroach,jess-edwards/cockroach,jamesgraves/cockroach,bg451/cockroach,jgautheron/cockroach,hassyma/cockroach,chrisseto/cockroach,slavau/cockroach,jamesgraves/cockroach,ngaut/cockroach,vaibhavarora/cockroach,pet... |
e32f97cbad97305145b4f3879b305eddc75f32bc | crypt/crypt_test.go | crypt/crypt_test.go | package crypt
import (
"io/ioutil"
"os"
"testing"
)
const (
passphrase = "testingpassphrase"
filecontents = "woweezowee"
filetestpath = "/tmp/encryptdecrypttest"
)
func TestEncryptDecrypt(t *testing.T) {
//Write a temp file and make sure we get back what we expect
if err := ioutil.WriteFile(filetestpath, [... | package crypt
import (
"io/ioutil"
"os"
"testing"
)
const (
passphrase = "testingpassphrase"
filecontents = "woweezowee"
filetestpath = "/tmp/encryptdecrypttest"
)
func TestEncryptDecrypt(t *testing.T) {
var isencrypted bool
var err error
//Write a temp file and make sure we get back what we expect
if e... | Add more complete crypto tests | Add more complete crypto tests
| Go | apache-2.0 | pshima/consul-snapshot,pshima/consul-snapshot |
b9068c56bd52f75b1c68a6b141a50b6da291013c | design/dsl/description_test.go | design/dsl/description_test.go | package dsl
import (
"testing"
"github.com/goadesign/goa/design"
"github.com/goadesign/goa/eval"
)
const (
description = "test description"
)
func TestDescription(t *testing.T) {
cases := map[string]struct {
Expr eval.Expression
Desc string
DescFunc func(e eval.Expression) string
}{
"api": {&... | package dsl
import (
"testing"
"github.com/goadesign/goa/design"
"github.com/goadesign/goa/eval"
)
func TestDescription(t *testing.T) {
const (
description = "test description"
)
cases := map[string]struct {
Expr eval.Expression
Desc string
DescFunc func(e eval.Expression) string
}{
"api... | Move description constant to test | Move description constant to test
Since it's specific to the Description test | Go | mit | goadesign/goa,raphael/goa |
7c9cc10e47ff4e7cba4c678f12aa079866ad61ab | bufferpool_test.go | bufferpool_test.go | // Copyright 2013 The Bufferpool Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package bufferpool_test
import (
"bytes"
"fmt"
"testing"
"github.com/pushrax/bufferpool"
)
func TestTakeFromEmpty(t *testing.T) {
bp := b... | // Copyright 2013 The Bufferpool Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
package bufferpool_test
import (
"bytes"
"fmt"
"testing"
"github.com/pushrax/bufferpool"
)
func TestTakeFromEmpty(t *testing.T) {
bp := b... | Fix capitalization typo in tests | Fix capitalization typo in tests | Go | bsd-2-clause | pushrax/bufferpool |
438e897eb9e1d9dd8e9eeffed36a9a636ce752d2 | cmd/migrate_cmd.go | cmd/migrate_cmd.go | package cmd
import (
"github.com/Sirupsen/logrus"
"github.com/netlify/netlify-auth/conf"
"github.com/netlify/netlify-auth/models"
"github.com/spf13/cobra"
)
var migrateCmd = cobra.Command{
Use: "migrate",
Long: "Migrate database strucutures. This will create new tables and add missing collumns and indexes.",
... | package cmd
import (
"github.com/Sirupsen/logrus"
"github.com/netlify/netlify-auth/conf"
"github.com/netlify/netlify-auth/models"
"github.com/spf13/cobra"
)
var migrateCmd = cobra.Command{
Use: "migrate",
Long: "Migrate database strucutures. This will create new tables and add missing collumns and indexes.",
... | Add Data model to the migrate command. | Add Data model to the migrate command.
Signed-off-by: David Calavera <b9b0c8e7f90ecf337f6797c4d2e0f1dd0dbc0324@gmail.com>
| Go | mit | netlify/gotrue,netlify/gotrue |
b0d24e0843195685b3942de931116b4f30930d2f | problem_005/main.go | problem_005/main.go | // project problem_005 main.go
// Solution for Project Euler Problem #005, Smallest multiple.
package main
import "fmt"
func main() {
var k int
for i := 1; true; i++ {
// Let the user know we are still in search of the solution
if i%1000000 == 0 {
fmt.Println(i/1000000, " million numbers processed")
}
k ... | // project problem_005 main.go
// Solution for Project Euler Problem #005, Smallest multiple.
package main
import "fmt"
func main() {
const max = 20
var k int
for i := 1; true; i++ {
// Let the user know we are still in search of the solution
if i%1000000 == 0 {
fmt.Println(i/1000000, " million numbers proc... | Comment and const for the max in range added | Comment and const for the max in range added
| Go | unlicense | petergloor/euler |
08d47cdc838240ed5517cdf98307c5d897f53599 | cmd/subd/tls.go | cmd/subd/tls.go | package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/Symantec/Dominator/lib/srpc"
"io/ioutil"
"os"
)
func setupTls() {
if *caFile == "" || *certFile == "" || *keyFile == "" {
return
}
caData, err := ioutil.ReadFile(*caFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to load CA file\t%s... | package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/Symantec/Dominator/lib/srpc"
"io/ioutil"
"os"
)
func setupTls() {
if *caFile == "" || *certFile == "" || *keyFile == "" {
return
}
caData, err := ioutil.ReadFile(*caFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to load CA file\t%s... | Change subd to require authenticated connections by default. | Change subd to require authenticated connections by default.
| Go | apache-2.0 | keep94/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,keep94/Dominator |
aa58475324e1f1579827152687b3186fa28cadc2 | command_test.go | command_test.go | package start
import (
"fmt"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestCommand(t *testing.T) {
SkipConvey("When setting up a command", t, func() {
Commands.Add(&Command{
Name: "test",
Short: "A test command",
Long: "Command test helps testing the start package. It accepts al... | package start
import (
"fmt"
"testing"
flag "github.com/ogier/pflag"
. "github.com/smartystreets/goconvey/convey"
)
func TestCommands(t *testing.T) {
var yes bool
var size int
flag.BoolVarP(&yes, "yes", "y", false, "A boolean flag")
flag.IntVarP(&size, "size", "s", 23, "An int flag")
Commands.Add(&Command... | Test setup * Command test * Command flags * Command do something * Command do nothing * Flags: yes, size | New: Test setup
* Command test
* Command flags
* Command do something
* Command do nothing
* Flags: yes, size
| Go | bsd-3-clause | christophberger/start |
36bb6f98f800cf2b42502e02afa594ab20d56feb | attack/memory/alloc_integration_test.go | attack/memory/alloc_integration_test.go | // +build integration
package memory
import (
"context"
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestMemoryAllocationAttack(t *testing.T) {
assert := assert.New(t)
var size uint64 = 200 * MiB
ma, err := NewMemAllocation(size)
assert.NoError(err, "Creation of memory allocator ... | // +build integration
package memory
import (
"context"
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestMemoryAllocationAttack(t *testing.T) {
assert := assert.New(t)
var size uint64 = 200 * MiB
ma, err := NewMemAllocation(size)
assert.NoError(err, "Creation of memory allocator ... | Allow 15% deviation of memory attack integration test | Allow 15% deviation of memory attack integration test
Signed-off-by: Xabier Larrakoetxea <30fb0ea44f2104eb1a81e793d922a064c3916c2f@gmail.com>
| Go | apache-2.0 | slok/ragnarok,slok/ragnarok |
ac435a55b8a6491a4223610ac38d0b1a83b6ff9d | dokan/dokan_test.go | dokan/dokan_test.go | // Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
// +build windows
package dokan
import (
"testing"
"time"
)
func TestTimePacking(t *testing.T) {
t0 := time.Now()
if !t0.Equal(unpackTime(packTime(t0))) {
t.Fat... | // Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
// +build windows
package dokan
import (
"testing"
"time"
)
func testTimePacking(t *testing.T, t0 time.Time) {
t1 := unpackTime(packTime(t0))
if !t0.Equal(t1) {
... | Test time type conversions more | dokan: Test time type conversions more
| Go | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/kbfs,keybase/kbfs,keybase/client,keybase/kbfs,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/kbfs |
00ab1bb968d1444d2fe1daa6defd2682c082d361 | ingester/rate.go | ingester/rate.go | package ingester
import (
"sync"
"sync/atomic"
"time"
)
type ewmaRate struct {
newEvents int64
alpha float64
interval time.Duration
lastRate float64
init bool
mutex sync.Mutex
}
func newEWMARate(alpha float64, interval time.Duration) *ewmaRate {
return &ewmaRate{
alpha: alpha,
interva... | package ingester
import (
"sync"
"sync/atomic"
"time"
)
// ewmaRate tracks an exponentially weighted moving average of a per-second rate.
type ewmaRate struct {
newEvents int64
alpha float64
interval time.Duration
lastRate float64
init bool
mutex sync.Mutex
}
func newEWMARate(alpha float64, i... | Add explanatory comments to ewmaRate type | Add explanatory comments to ewmaRate type
| Go | apache-2.0 | tomwilkie/cortex,tomwilkie/cortex,tomwilkie/cortex |
7bd6df6add30571140f6d8aafccc6e6af7099c6a | binstore/boltdb.go | binstore/boltdb.go | package binstore
import "github.com/boltdb/bolt"
// BoltDB store.
type BoltDB struct {
db bolt.DB
}
| package binstore
import (
"bytes"
"errors"
"io"
"io/ioutil"
"github.com/boltdb/bolt"
"github.com/deejross/dep-registry/models"
)
var boltBinBucket = []byte("dep-reg-binstore")
// BoltDB store.
type BoltDB struct {
db *bolt.DB
}
// NewBoltBinStore creates a new BoltDB interface.
func NewBoltBinStore(address ... | Add BoltDB binary store backend | Add BoltDB binary store backend
| Go | apache-2.0 | deejross/dep-registry |
57b6f7c1d37c5c5d0abbd4a4b74f1b3e60f9e640 | exchange/request.go | exchange/request.go | package exchange
import "github.com/qp/go/utils"
// Request defines all the fields and information
// in the standard qp request object. It is used
// as part of the RequestHandler callback.
type Request struct {
*Response
To []string `json:"to"` // array of destination addresses
}
// MakeRequest makes a new reque... | package exchange
import "github.com/qp/go/utils"
// Request defines all the fields and information
// in the standard qp request object. It is used
// as part of the RequestHandler callback.
type Request struct {
To []string `json:"to"` // array of destination addresses
From []string `json:"from"` // arra... | Put contents of Response directly in Request | Put contents of Response directly in Request
| Go | mit | qp/go,qp/go |
4bc09c06c10b11de6a395f2ccdcc0fa66e5fd9a7 | controller/controller.go | controller/controller.go | package controller
import (
"net/http"
"github.com/gilcrest/errs"
"github.com/rs/xid"
)
// RequestID is the unique Request ID for each request
type RequestID struct {
xid.ID
}
// StandardResponseFields is meant to be included in all response bodies
// and includes "standard" response fields
type StandardRespons... | package controller
import (
"net/http"
"github.com/rs/xid"
)
// RequestID is the unique Request ID for each request
type RequestID struct {
xid.ID
}
// StandardResponseFields is meant to be included in all response bodies
// and includes "standard" response fields
type StandardResponseFields struct {
Path strin... | Rename op to match function | Rename op to match function
| Go | mit | gilcrest/go-API-template,gilcrest/go-API-template |
952c2b91c9f72ecabf7194a1e0385fbbafe9bcaa | example_test.go | example_test.go | package envconfig_test
import (
"fmt"
"os"
"github.com/vrischmann/envconfig"
)
func ExampleInit() {
var conf struct {
MySQL struct {
Host string
Port int
Database struct {
User string
Password string
Name string
}
}
Log struct {
Path string
Rotate bool
}
... | package envconfig_test
import (
"fmt"
"os"
"time"
"github.com/vrischmann/envconfig"
)
func ExampleInit() {
var conf struct {
MySQL struct {
Host string
Port int
Database struct {
User string
Password string
Name string
}
}
Log struct {
Path string
Rotate boo... | Complete the example with a time.Duration field | Complete the example with a time.Duration field
| Go | mit | vrischmann/envconfig |
7fdb53f5d15d525ffc92185c881b89f80619b37c | packer/hook_test.go | packer/hook_test.go | package packer
import (
"cgl.tideland.biz/asserts"
"testing"
)
type TestHook struct {
runCalled bool
runData interface{}
runName string
runUi Ui
}
func (t *TestHook) Run(name string, data interface{}, ui Ui) {
t.runCalled = true
t.runData = data
t.runName = name
t.runUi = ui
}
func TestDispatchHook_Run_No... | package packer
import (
"cgl.tideland.biz/asserts"
"testing"
)
type TestHook struct {
runCalled bool
runData interface{}
runName string
runUi Ui
}
func (t *TestHook) Run(name string, data interface{}, ui Ui) {
t.runCalled = true
t.runData = data
t.runName = name
t.runUi = ui
}
func TestDispatchHook_Implem... | Test to make sure DispatchHook implements Hook | packer: Test to make sure DispatchHook implements Hook
| Go | mpl-2.0 | legal90/packer,zeliff/packer,mefellows/packer,israelshirk/packer,jen20/packer,jmptrader/packer,rodm/packer,grubernaut/packer,ttaylor249/packer,Cbeck527/packer,leroux/packer,lantrix/packer,dragon788/packer,rk295/packer,dieu/packer,hashicorp/packer,zhuzhih2017/packer,Akasurde/packer,jonathankarsh/packer,zhuzhih2017/packe... |
ea41efa3672fceeaa1151fa9d042b49a3bc7e5ef | prgs/prgs_test.go | prgs/prgs_test.go | package prgs
import (
"testing"
. "github.com/VonC/godbg"
. "github.com/smartystreets/goconvey/convey"
)
type testGetter struct{}
func (tg testGetter) Get() []Prg {
return []Prg{&prg{}}
}
func TestMain(t *testing.T) {
Convey("prgs can get prgs", t, func() {
SetBuffers(nil)
dg.Get()
getter = testGetter{}... | package prgs
import (
"testing"
. "github.com/VonC/godbg"
"github.com/VonC/senvgo/envs"
"github.com/VonC/senvgo/paths"
. "github.com/smartystreets/goconvey/convey"
)
type testGetter struct{}
func (tg testGetter) Get() []Prg {
return []Prg{&prg{}}
}
func TestMain(t *testing.T) {
envs.Prgsenvname = "PRGSTEST"... | Add recover in prgs test for envs.Prgsenv() | Add recover in prgs test for envs.Prgsenv()
| Go | mit | VonC/senvgo,VonC/senvgo |
87c8707f7faf1083006a7b2046cb3014ae4dc6f8 | src/nvim-go/nvim/buffer.go | src/nvim-go/nvim/buffer.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.
package nvim
import (
"encoding/binary"
"github.com/garyburd/neovim-go/vim"
)
func ByteOffset(v *vim.Vim) (int, error) {
b, err := v.CurrentBuffer()
if... | // 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.
package nvim
import (
"encoding/binary"
"github.com/garyburd/neovim-go/vim"
)
var (
b vim.Buffer
w vim.Window
)
func ByteOffset(v *vim.Vim) (int, erro... | Add v.NewPipeline and Fix if...else | Add v.NewPipeline and Fix if...else
Signed-off-by: Koichi Shiraishi <13fbd79c3d390e5d6585a21e11ff5ec1970cff0c@zchee.io>
| Go | bsd-3-clause | zchee/nvim-go,zchee/nvim-go |
61f081fd35288bb195bfaea54b8080f2b2dbdc47 | resource_group.go | resource_group.go | package cloudflare
type ResourceGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Meta map[string]string `json:"meta"`
Scope Scope `json:"scope"`
}
type Scope struct {
Key string `json:"key"`
ScopeObjects []ScopeObject `json:"objects"`
}
type ... | package cloudflare
import "fmt"
type ResourceGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Meta map[string]string `json:"meta"`
Scope Scope `json:"scope"`
}
type Scope struct {
Key string `json:"key"`
ScopeObjects []ScopeObject `json:"obje... | Add resource group utility methods | ACCT-4459: Add resource group utility methods
| Go | bsd-3-clause | cloudflare/cloudflare-go,cloudflare/cloudflare-go |
062236bb410a8c1d7bb999d5db398308f7a953e5 | cache/local_fs.go | cache/local_fs.go | package cache
import (
"os"
"path/filepath"
)
type LocalFsCache struct {
cacheDir string
}
const (
DefaultCacheDir = "/tmp/risu/cache"
)
func NewLocalFsCache() Cache {
var cacheDir string
if os.Getenv("RISU_CACHE_DIR") != "" {
cacheDir = os.Getenv("RISU_CACHE_DIR")
}
if cacheDir == "" {
cacheDir = Def... | package cache
import (
"os"
"path/filepath"
)
type LocalFsCache struct {
cacheDir string
}
const (
DefaultCacheDir = "/tmp/risu/cache"
)
func NewLocalFsCache() Cache {
var cacheDir string
if os.Getenv("RISU_CACHE_DIR") != "" {
cacheDir = os.Getenv("RISU_CACHE_DIR")
}
if cacheDir == "" {
cacheDir = Def... | Return empty string if cache does not exist | Return empty string if cache does not exist
| Go | mit | koudaiii/risu,wantedly/risu,koudaiii/risu,wantedly/risu,koudaiii/risu,wantedly/risu,koudaiii/risu,wantedly/risu |
6c698df81a208c4deb25044cde8e49d94ec1cf00 | master/http/http.go | master/http/http.go | package http
import (
"encoding/json"
"log"
"net/http"
"github.com/leancloud/satori/master/g"
"github.com/leancloud/satori/master/state"
)
func addHandlers() {
http.HandleFunc("/state", func(w http.ResponseWriter, r *http.Request) {
s, err := json.Marshal(state.State)
if err != nil {
http.Error(w, err.E... | package http
import (
"encoding/json"
"log"
"net/http"
"github.com/leancloud/satori/master/g"
"github.com/leancloud/satori/master/state"
)
func addHandlers() {
http.HandleFunc("/state", func(w http.ResponseWriter, r *http.Request) {
state.StateLock.RLock()
s, err := json.Marshal(state.State)
state.StateL... | Fix master crash when concurrent read/write state | Fix master crash when concurrent read/write state
| Go | apache-2.0 | kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori |
ef3957501951e02a9a2df304808b9cde31114de3 | cmd/godge/main.go | cmd/godge/main.go | package main
import (
"context"
"flag"
"os"
"github.com/google/subcommands"
)
var serverAddress = flag.String("address", "", "The address of the server")
func main() {
subcommands.ImportantFlag("address")
subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcommands.CommandsCommand(),... | package main
import (
"context"
"flag"
"os"
"github.com/google/subcommands"
)
var serverAddress = flag.String("address", os.Getenv("GODGE_ADDR"), "The address of the server")
func main() {
subcommands.ImportantFlag("address")
subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcomman... | Allow to define Godge server URL using the GODGE_URL env var | Allow to define Godge server URL using the GODGE_URL env var
| Go | mit | MohamedBassem/godge |
0ec39644a6e2b17a33d419fe1464a93b7a700b50 | cmd/xurls/main.go | cmd/xurls/main.go | /* Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc> */
/* See LICENSE for licensing information */
package main
import (
"bufio"
"fmt"
"os"
"github.com/mvdan/xurls"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
line := scanner.Text()
urls := xurls.All.FindAllString(line, -1)
... | /* Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc> */
/* See LICENSE for licensing information */
package main
import (
"bufio"
"fmt"
"os"
"github.com/mvdan/xurls"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
line := scanner.Text()
urls := xurls.WebUrl.FindAllString(line, -... | Make xurls only match urls | Make xurls only match urls
| Go | bsd-3-clause | digideskio/xurls,mvdan/xurls |
6d991a22994aa9fd96d62f60cba00f291c75dbc0 | procaddr/wgl/wgl.go | procaddr/wgl/wgl.go | // Copyright 2013 The GoGL2 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE.mkd file.
package wgl
// #cgo windows LDFLAGS: -lopengl32
// #define WIN32_LEAN_AND_MEAN 1
// #include <windows.h>
// static HMODULE ogl32dll = NULL;
// void* Gogl... | // Copyright 2013 The GoGL2 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE.mkd file.
package wgl
// #cgo windows LDFLAGS: -lopengl32
// #define WIN32_LEAN_AND_MEAN 1
// #include <windows.h>
// static HMODULE ogl32dll = NULL;
// void* Gogl... | Fix memory leaked by C.CString | Fix memory leaked by C.CString | Go | bsd-3-clause | chsc/gogl2 |
dc4007005dabaa1e9284e81d0bedcaba683ea269 | defdir_windows.go | defdir_windows.go | package config
import (
"os"
"path/filepath"
)
func defaultDirectory() string {
base := filepath.Base(os.Args[0])
ext := filepath.Ext(base)
drv := os.Getenv("SystemDrive")
pdDir := "ProgramData"
name := base[0 : len(base)-len(ext)]
return filepath.Join(drv, pdDir, name, name)
}
| package config
import (
"os"
"path/filepath"
)
func defaultDirectory() string {
base := filepath.Base(os.Args[0])
ext := filepath.Ext(base)
drv := os.Getenv("SystemDrive")
pdDir := `\ProgramData`
name := base[0 : len(base)-len(ext)]
return filepath.Join(drv, pdDir, name, name)
}
| Add starting backslash to programdata. | Add starting backslash to programdata.
| Go | mit | codemodus/config |
ddeacdfa2e7a1098419650d7dc9ea9bf62ddd250 | main.go | main.go | // Copyright © 2017 Jade Iqbal <jadeiqbal@fastmail.com>
//
// 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 appli... | // Copyright © 2017 Jade Iqbal <jadeiqbal@fastmail.com>
//
// 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 appli... | Change address of the cmd package | Change address of the cmd package
| Go | apache-2.0 | LGUG2Z/parsec-ec2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.