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 |
|---|---|---|---|---|---|---|---|---|---|
b1f322fda10f927cc36679f4d1f9bf1f4da67cbb | cmd/bytemark/app/wait/vm_power_off.go | cmd/bytemark/app/wait/vm_power_off.go | package wait
import (
"fmt"
"time"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/lib"
"github.com/BytemarkHosting/bytemark-client/lib/brain"
)
func VMPowerOff(c *app.Context, name lib.VirtualMachineName) (err error) {
vm := brain.VirtualMachine{PowerO... | package wait
import (
"fmt"
"time"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/lib"
"github.com/BytemarkHosting/bytemark-client/lib/brain"
)
// VMPowerOff waits for the named virtual machine to power off before returning
// a nil error. This is done ... | Add documentation comment for wait.VMPowerOff | Add documentation comment for wait.VMPowerOff
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
9a590ea0b872d7ed69f72569237b311e1261e7dd | go/client/cmd_ping.go | go/client/cmd_ping.go | package client
import (
"fmt"
"github.com/keybase/cli"
"github.com/keybase/client/go/libcmdline"
"github.com/keybase/client/go/libkb"
)
type CmdPing struct{}
func (v *CmdPing) Run() error {
_, err := G.API.Post(libkb.APIArg{
Endpoint: "ping",
Args: libkb.HTTPArgs{
"alice": libkb.S{Val: "hi alice"},
... | package client
import (
"fmt"
"github.com/keybase/cli"
"github.com/keybase/client/go/libcmdline"
"github.com/keybase/client/go/libkb"
)
type CmdPing struct{}
func (v *CmdPing) Run() error {
_, err := G.API.Post(libkb.APIArg{Endpoint: "ping"})
if err != nil {
return err
}
_, err = G.API.Get(libkb.APIArg{En... | Remove unused args to ping endpoint | Remove unused args to ping endpoint
| Go | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client |
276642a2aa4fd5b3c55f929c886f1172952266aa | cmd/server/main.go | cmd/server/main.go | package main
import (
"flag"
"github.com/itsankoff/gotcha/server"
"log"
)
func main() {
config := server.NewConfig()
flag.StringVar(&config.ListenHost, "host",
"0.0.0.0:9000", "host to listen")
flag.StringVar(&config.FileServerHost, "file_host",
"http://0.0.0.0:9000", "host to server files")
flag.StringV... | package main
import (
"flag"
"github.com/itsankoff/gotcha/server"
"log"
)
func main() {
config := server.NewConfig()
flag.StringVar(&config.ListenHost, "host",
"0.0.0.0:9000", "host to listen")
flag.StringVar(&config.FileServerHost, "file_host",
"http://0.0.0.0:9000", "host to server files")
flag.StringV... | Fix cmd arguments parsing for server | Fix cmd arguments parsing for server
| Go | mit | itsankoff/gotcha,itsankoff/gotcha |
dc06ba8b658dad07bd0570ba180b7a0e5c75597d | lxd/backup/config/backup_config.go | lxd/backup/config/backup_config.go | package config
import (
"github.com/lxc/lxd/shared/api"
)
// Config represents the config of a backup that can be stored in a backup.yaml file (or embedded in index.yaml).
type Config struct {
Container *api.Instance `yaml:"container,omitempty"` // Used by VM backups too.
Snapshots []*ap... | package config
import (
"github.com/lxc/lxd/shared/api"
)
// Config represents the config of a backup that can be stored in a backup.yaml file (or embedded in index.yaml).
type Config struct {
Container *api.Instance `yaml:"container,omitempty"` // Used by VM backups too.
Snapshots []*ap... | Add Profiles field do Config struct | lxd/backup: Add Profiles field do Config struct
Signed-off-by: Piotr Resztak <9cc4cfdc746c0f0a10237a7250c53c9ec9c9811a@gmail.com>
| Go | apache-2.0 | stgraber/lxd,stgraber/lxd,lxc/lxd,lxc/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,lxc/lxd,lxc/lxd,stgraber/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,lxc/lxd |
0ebe799d77dbd23f451c48c10a449cebe0eee8b4 | errors.go | errors.go | package geocodio
import "errors"
var (
// ErrReverseGecodeMissingLatLng error when a lat/lng is not provided
ErrReverseGecodeMissingLatLng = errors.New("Latitude and longitude must not be empty")
)
| package geocodio
import "errors"
var (
// ErrReverseGecodeMissingLatLng error when a lat/lng is not provided
ErrReverseGecodeMissingLatLng = errors.New("Latitude and longitude must not be empty")
ErrMissingApiKey = errors.New("Missing or empty API key")
)
| Add error for invalid API key | Add error for invalid API key
| Go | mit | stevepartridge/geocodio |
07fcef05a50baf9189c4b35bd473b629a2ccd250 | prompt/ykman.go | prompt/ykman.go | package prompt
import (
"fmt"
"log"
"os"
"os/exec"
"strings"
)
// YkmanProvider runs ykman to generate a OATH-TOTP token from the Yubikey device
// To set up ykman, first run `ykman oath add`
func YkmanMfaProvider(mfaSerial string) (string, error) {
yubikeyOathCredName := os.Getenv("YKMAN_OATH_CREDENTIAL_NAME")... | package prompt
import (
"fmt"
"log"
"os"
"os/exec"
"strings"
)
// YkmanProvider runs ykman to generate a OATH-TOTP token from the Yubikey device
// To set up ykman, first run `ykman oath add`
func YkmanMfaProvider(mfaSerial string) (string, error) {
args := []string{}
yubikeyOathCredName := os.Getenv("YKMAN_O... | Set YKMAN_OATH_DEVICE_SERIAL to select Yubikey | Set YKMAN_OATH_DEVICE_SERIAL to select Yubikey
This change enables setting YKMAN_OATH_DEVICE_SERIAL to select a
particular Yubikey if more than one is attached to the device. It does
this by reading the serial from the env var, and adding the `--device
<serial>` to the `ykman` command.
| Go | mit | 99designs/aws-vault,99designs/aws-vault |
67687ee3dc5c55ca2cd8c14261cdf17fc6237420 | operations/list.go | operations/list.go | package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined... | package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined... | Move custom struct for marshal json to MarshalJSON method | Move custom struct for marshal json to MarshalJSON method
| Go | mit | omise/omise-go,omise/omise-go |
f4fbe5b5cc3bd4bfd24d57ed27b3238c78b303fb | vectors/forces/kinetic_friction.go | vectors/forces/kinetic_friction.go | package forces
import "github.com/hAWKdv/go-gravity/vectors/vectors"
// KineticFriction force
type KineticFriction struct {
mover *vectors.Mover
magnitude float64
}
// CreateKineticFriction creates a kinetic friction force
func CreateKineticFriction(mover *vectors.Mover) *KineticFriction {
// NOTE(Georgi): Cu... | package forces
import "github.com/hAWKdv/go-gravity/vectors/vectors"
const (
// NormalForce is the default normal force for the environment
NormalForce = 1.0
// FCoef is the friction coefficient
FCoef = 0.02
)
// KineticFriction force
type KineticFriction struct {
mover *vectors.Mover
magnitude float64
}
... | Put hardcoded values in constants | KineticFriction: Put hardcoded values in constants
| Go | mit | hAWKdv/go-gravity |
af6e3fcc9cc86f7c515a264caab860342abbfd4c | turtle.go | turtle.go | package turtle
// Emojis maps a name to an Emoji
var Emojis = make(map[string]*Emoji)
func init() {
for _, e := range emojis {
Emojis[e.Name] = e
}
}
// Search emojis by a name
func Search(s string) []*Emoji {
return search(emojis, s)
}
// Keyword filters the emojis by a keyword
func Keyword(k string) []*Emoji... | package turtle
// Version of the turtle library
const Version = "v0.1.0-dev"
// Emojis maps a name to an Emoji
var Emojis = make(map[string]*Emoji)
func init() {
for _, e := range emojis {
Emojis[e.Name] = e
}
}
// Search emojis by a name
func Search(s string) []*Emoji {
return search(emojis, s)
}
// Keyword ... | Add version info to library | Add version info to library
| Go | mit | hackebrot/turtle |
31ba0f933e0f3a382c7015277fd275206cfe1f9f | data-structures/node/node.go | data-structures/node/node.go | /**
* Node
*
* A Node data structure is the simplest data structure in CS. The idea is it's
* an object that stores a value and a reference to the next Node. We can do
* the following operations with a Node:
*
* - Create Node
* - Get Value
* - Get Next
* - Set Value
* - Set Next
*
* All operations can be performed in O... | /**
* Node
*
* A Node data structure is the simplest data structure in CS. The idea is it's
* an object that stores a value and a reference to the next Node. We can do
* the following operations with a Node:
*
* - Create Node
* - Get Value
* - Get Next
* - Set Value
* - Set Next
*
* All operations can be performed in O... | Make Node work with various data types rather than limit to just int | Make Node work with various data types rather than limit to just int
| Go | mit | dansackett/algorithms,dansackett/computer-science |
4f95548b18d2fcd73e1d6146da71eca7abab9131 | docker/builder_suite_test.go | docker/builder_suite_test.go | package docker_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var builderPath string
func TestDockerLifecycleBuilder(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
var err error
builderPath, err = gexec.Build("github.com/clo... | package docker_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var builderPath string
func TestDockerLifecycleBuilder(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
var err error
builderPath, err = gexec.Build("code.cloudfoun... | Update and rename docker_app_lifecycle -> dockerapplifecycle | Update and rename docker_app_lifecycle -> dockerapplifecycle
[#121932033]
Signed-off-by: Nima Kaviani <0ebde517669f70c2aec92dc89d4950413b825ec0@us.ibm.com>
| Go | apache-2.0 | cloudfoundry-incubator/inigo |
a7fa9e4f7b94cb9c11fc932e9a3ae7368aec5220 | tun_linux.go | tun_linux.go | package tuntap
import (
"os"
"strings"
"syscall"
"unsafe"
)
func createInterface(file *os.File, ifPattern string, kind DevKind) (string, error) {
var req ifReq
req.Flags = 0
copy(req.Name[:15], ifPattern)
switch kind {
case DevTun:
req.Flags |= iffTun
case DevTap:
req.Flags |= iffTap
default:
panic("... | package tuntap
import (
"os"
"strings"
"syscall"
"unsafe"
)
func createInterface(file *os.File, ifPattern string, kind DevKind) (string, error) {
var req ifReq
req.Flags = 0
copy(req.Name[:15], ifPattern)
switch kind {
case DevTun:
req.Flags |= iffTun
case DevTap:
req.Flags |= iffTap
default:
panic("... | Revert "force fd back to non-block mode to make go 1.13 happier" | Revert "force fd back to non-block mode to make go 1.13 happier"
This is causing trouble on the APs. We never complete a read
of the tunnel.
I'll have to figure out what go 1.13 was complaining about
when we switch to it.
This reverts commit f86332f6add367e0afc8e1d03e2413f0308791ed.
| Go | apache-2.0 | mistsys/tuntap,mistsys/tuntap |
c0e4aa0397cca1ee086c30455f33f0350738b711 | emotes.go | emotes.go | // Copyright 2014 Chadev. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"math/rand"
"github.com/danryan/hal"
)
var tableFlipHandler = hal.Hear(listenName+` tableflip`, func(res *hal.Response) error {
num := rand.... | // Copyright 2014 Chadev. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"math/rand"
"time"
"github.com/danryan/hal"
)
var tableFlipped bool
var tableFlipHandler = hal.Hear(listenName+` tableflip`, func(res *hal.... | Change how random is done for tableflipping | Change how random is done for tableflipping
Signed-off-by: Adam Jimerson <0a1ce5db568b585e24ec79212f7ab30cdb820af8@gmail.com>
| Go | bsd-3-clause | chadev/Chadev_ircbot |
52545b15771e32abc1568a8b582dc59eb55269fc | examples/no-manifest/main.go | examples/no-manifest/main.go | package main
import (
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!\n", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
| package main
import (
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!\n", r.URL.Path[1:])
}
func main() {
log.Print("http server started")
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
| Print message when server is started | Print message when server is started
Signed-off-by: David Gageot <aa743a0aaec8f7d7a1f01442503957f4d7a2d634@gageot.net> | Go | apache-2.0 | GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold,GoogleContainerTools/skaffold |
24390cd9011f6c5edc1190cf81e6974d51e64a3a | follow.go | follow.go | package twitch
import (
"fmt"
"time"
)
type Follow struct {
CreatedAt time.Time `json:"created_at"`
Id string `json:"_id"`
User User `json:"user"`
Notifications bool `json:"notifications"`
}
type FollowResponse struct {
Total int64 `json:"_total"`
Follows []Follow `j... | package twitch
import (
"fmt"
"net/url"
"time"
)
type Follow struct {
CreatedAt time.Time `json:"created_at"`
Id string `json:"_id"`
User User `json:"user"`
Notifications bool `json:"notifications"`
}
type FollowResponse struct {
Total int64 `json:"_total"`
Follows ... | Add GetFollowersForID request for Helix API | Add GetFollowersForID request for Helix API
| Go | mit | DDRBoxman/twitchgo |
21db66e8ab1bb14e7e142f8717a9ee587e27b739 | dropsonde_unmarshaller/dropsonde_unmarshaller_suite_test.go | dropsonde_unmarshaller/dropsonde_unmarshaller_suite_test.go | package dropsonde_unmarshaller_test
import (
"time"
"github.com/cloudfoundry/dropsonde/emitter/fake"
"github.com/cloudfoundry/dropsonde/metric_sender"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"... | package dropsonde_unmarshaller_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestUnmarshaller(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Dropsonde Unmarshaller Suite")
}
| Remove dead sender/batchers from unmarshaller suite | Remove dead sender/batchers from unmarshaller suite
[#119687755]
Signed-off-by: Jason Keene <6860b6804203c35846513c1877d6effca68277e9@pivotal.io>
| Go | apache-2.0 | cloudfoundry/dropsonde,cloudfoundry/dropsonde |
b26e68448477f305937ab21a62806042d933130a | pkg/api/steve/disallow/disallow.go | pkg/api/steve/disallow/disallow.go | package disallow
import (
"net/http"
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/attributes"
schema2 "github.com/rancher/steve/pkg/schema"
steve "github.com/rancher/steve/pkg/server"
)
var (
allowPut = map[string]bool{
"features": true,
"settings": true,
}
)
func Register(serve... | package disallow
import (
"net/http"
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/attributes"
schema2 "github.com/rancher/steve/pkg/schema"
steve "github.com/rancher/steve/pkg/server"
)
var (
allowPost = map[string]bool{
"settings": true,
}
allowPut = map[string]bool{
"features"... | Allow POST on settings too | Allow POST on settings too
| Go | apache-2.0 | rancher/rancher,rancher/rancher,rancher/rancher,rancher/rancher |
db4832193293a6ab1bf2e65bc3db8acd73eba5e9 | pkg/kubecross/impl.go | pkg/kubecross/impl.go | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Use http agent for kubecross version retrieval | Use http agent for kubecross version retrieval
This agent allows retries and should be more future proof.
Signed-off-by: Sascha Grunert <70ab469ddb2ac3e35f32ed7c2fd1cca514b2e879@redhat.com>
| Go | apache-2.0 | kubernetes/release,kubernetes/release |
6e8b09c3ed5d58aa3cb8fbbce0b310381055bae1 | db/sort_test.go | db/sort_test.go | package db
import (
"testing"
"time"
"github.com/octavore/ketchup/proto/ketchup/models"
)
func TestSort(t *testing.T) {
now := time.Now()
nowUnix := now.Unix()
nowPlus1 := now.Add(time.Minute).Unix()
nowPlus2 := now.Add(time.Minute * 2).Unix()
pages := []*models.Page{
{Timestamps: &models.Timestamp{Updated... | package db
import (
"testing"
"time"
"github.com/octavore/ketchup/proto/ketchup/models"
)
func TestSort(t *testing.T) {
now := time.Now()
nowUnix := now.UnixNano() / 1e6
nowPlus1 := now.Add(time.Minute).UnixNano() / 1e6
nowPlus2 := now.Add(time.Minute*2).UnixNano() / 1e6
pages := []*models.Page{
{Timestamp... | Change sort test to use time in millis. | db: Change sort test to use time in millis.
| Go | apache-2.0 | ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup |
7f558b54b95d2ee38d0e0331b6c80b93c41ffc4e | parts_test.go | parts_test.go | package main
import (
"reflect"
"testing"
)
var ParseKeysListTests = []struct {
list string
keys []string
}{
// normal
{`host`, []string{`host`}},
{`host,status`, []string{`host`, `status`}},
{`host,status,size`, []string{`host`, `status`, `size`}},
}
func TestParseKeysList(t *testing.T) {
for _, test := ra... | package main
import (
"reflect"
"testing"
)
var ParseKeysListTests = []struct {
list string
keys []string
}{
// normal
{`host`, []string{`host`}},
{`host,status`, []string{`host`, `status`}},
{`host,status,size`, []string{`host`, `status`, `size`}},
// include empty keys
{``, []string{``}},
{`,`, []string... | Add case that list includes empty keys | Add case that list includes empty keys
| Go | mit | kusabashira/ltsvp |
3b047c3778265bc35448c42bc01e729d20bd69b7 | server.go | server.go | package main
import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
"github.com/labstack/echo/middleware"
)
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}
func main() {
e := echo.New()
// Midd... | package main
import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
"github.com/labstack/echo/middleware"
)
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}
func main() {
e := echo.New()
// Midd... | Add IP address of requested client | Add IP address of requested client
| Go | mit | shamsher31/stay-motivated-server |
cea33d4afe00f40d2096e03b1206c2267f08318b | src/cmd/facette/http_asset_builtin.go | src/cmd/facette/http_asset_builtin.go | // +build builtin_assets
package main
import (
"context"
"net/http"
"path"
"strings"
)
func (w *httpWorker) httpHandleAsset(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
var (
isDefault bool
ct string
)
// Stop handling assets if frontend is disabled
if !w.service.config.Fronten... | // +build builtin_assets
package main
import (
"context"
"net/http"
"path"
"path/filepath"
"strings"
)
func (w *httpWorker) httpHandleAsset(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
var (
isDefault bool
ct string
)
// Stop handling assets if frontend is disabled
if !w.servi... | Fix missing import in 'builtin_asset' code | Fix missing import in 'builtin_asset' code
| Go | bsd-3-clause | facette/facette,facette/facette,facette/facette,facette/facette |
9608a88347f547e8ba767ad34f24b5fd61688eae | cmd/erisdbss/main.go | cmd/erisdbss/main.go | package main
import (
ess "github.com/eris-ltd/erisdb/erisdb/erisdbss"
"github.com/eris-ltd/erisdb/server"
"os"
"github.com/gin-gonic/gin"
)
func main() {
gin.SetMode(gin.ReleaseMode)
baseDir := os.Getenv("HOME") + "/.edbservers"
ss := ess.NewServerServer(baseDir)
proc := server.NewServeProcess(nil, ss)
er... | package main
import (
ess "github.com/eris-ltd/erisdb/erisdb/erisdbss"
"github.com/eris-ltd/erisdb/server"
"os"
"github.com/gin-gonic/gin"
"path"
)
func main() {
gin.SetMode(gin.ReleaseMode)
baseDir := path.Join(os.TempDir(), "/.edbservers")
ss := ess.NewServerServer(baseDir)
proc := server.NewServeProcess... | Change serverserver to use os temp dir as base | Change serverserver to use os temp dir as base
| Go | apache-2.0 | benjaminbollen/eris-db,eris-ltd/eris-db,benjaminbollen/burrow,eris-ltd/eris-db,silasdavis/burrow,benjaminbollen/burrow,benjaminbollen/eris-db,silasdavis/burrow,silasdavis/burrow |
51770fb4eb7a407cacc5e0f04624bb45261f964b | hooks/papertrail/papertrail_test.go | hooks/papertrail/papertrail_test.go | package logrus_papertrail
import (
"net"
"testing"
"github.com/Sirupsen/logrus"
)
func TestWritingToUDP(t *testing.T) {
log := logrus.New()
port := 16661
addr := net.UDPAddr{
Port: port,
IP: net.ParseIP("127.0.0.1"),
}
c, err := net.ListenUDP("udp", &addr)
if err != nil {
t.Fatalf("ListenUDP faile... | package logrus_papertrail
import (
"fmt"
"testing"
"github.com/Sirupsen/logrus"
"github.com/stvp/go-udp-testing"
)
func TestWritingToUDP(t *testing.T) {
port := 16661
udp.SetAddr(fmt.Sprintf(":%d", port))
hook, err := NewPapertrailHook("localhost", port, "test")
if err != nil {
t.Errorf("Unable to connect... | Use third-party UDP testing library to tighten up test. | Use third-party UDP testing library to tighten up test.
| Go | mit | chendrak/logrus,orvice/logrus,henrylee2cn/logrus,brandur/logrus,HideoYamauchi/logrus,sirupsen/logrus,marcosnils/logrus,Arkan/logrus,akutz/logrus,Invacio/logrus,ryanfaerman/logrus,snowsnail/logrus,dradtke/logrus,rfsbraz/logrus,lixin9311/logrus,Barberrrry/logrus,cgag/logrus,hvnsweeting/logrus,therealbill/logrus,penhauer-... |
35ad8575de80c34828b580b7eafaf0573924fca4 | instrumentation/instamux/handler.go | instrumentation/instamux/handler.go | // (c) Copyright IBM Corp. 2021
// (c) Copyright Instana Inc. 2016
// +build go1.12
package instamux
import (
"net/http"
"github.com/gorilla/mux"
instana "github.com/instana/go-sensor"
)
// AddMiddleware instruments the mux.Router instance with Instana
func AddMiddleware(sensor *instana.Sensor, router *mux.Rout... | // (c) Copyright IBM Corp. 2021
// (c) Copyright Instana Inc. 2016
// +build go1.12
package instamux
import (
"net/http"
"github.com/gorilla/mux"
instana "github.com/instana/go-sensor"
)
// AddMiddleware instruments the mux.Router instance with Instana
func AddMiddleware(sensor *instana.Sensor, router *mux.Rout... | Use consistent naming in gorilla/mux middleware | Use consistent naming in gorilla/mux middleware
| Go | mit | instana/golang-sensor,instana/golang-sensor |
8916fc42155b55de7f4501e99013ff371fd2509f | ready-set-go/code/methods-interfaces.go | ready-set-go/code/methods-interfaces.go | package main
import "fmt"
// START OMIT
type Pet interface { // HL
Name() string // HL
FavoriteToy() string // HL
}
type Dog struct { // Implicitly a Pet because it fulfills the interface
name string
favoriteToy string
}
func (d Dog) Name() string { // Value receiver
return d.name
}
func (d *Dog)... | package main
import "fmt"
// START OMIT
type Pet interface { // HL
Name() string // HL
FavoriteToy() string // HL
}
type Dog struct { // Implicitly a Pet because it fulfills the interface
name string
favoriteToy string
}
func (d Dog) Name() string { // Value receiver
return d.name
}
func (d Dog) ... | Fix bug in short presentation | Fix bug in short presentation
| Go | mit | CodyOss/presentations |
4b6c57d7472502045f2c9795b9cac0f8c8e426e7 | game/cameratarget.go | game/cameratarget.go | package game
import (
"time"
"github.com/Bredgren/geo"
)
type playerCameraTarget struct {
g *Game
p *player
offset geo.Vec
pos geo.Vec
}
func newPlayerCameraTarget(g *Game, p *player, screenHeight int) *playerCameraTarget {
return &playerCameraTarget{
g: g,
p: p,
offset: geo.VecX... | package game
import (
"math"
"time"
"github.com/Bredgren/geo"
)
type playerCameraTarget struct {
g *Game
p *player
offset geo.Vec
pos geo.Vec
}
func newPlayerCameraTarget(g *Game, p *player, screenHeight int) *playerCameraTarget {
return &playerCameraTarget{
g: g,
p: p,
offset: ... | Fix camera offset when in the play state | Fix camera offset when in the play state
| Go | mit | Bredgren/game1 |
c00a1bcc5a247f7023c63f515d2dcfe61fa1131d | resources/elasti_cache/subnet_group.go | resources/elasti_cache/subnet_group.go | package elasti_cache
import (
"github.com/jagregory/cfval/constraints"
. "github.com/jagregory/cfval/schema"
)
// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html
func SubnetGroup() Resource {
return Resource{
AwsType: "AWS::ElastiCache::SubnetGroup",... | package elasti_cache
import (
"github.com/jagregory/cfval/constraints"
. "github.com/jagregory/cfval/schema"
)
// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html
func SubnetGroup() Resource {
return Resource{
AwsType: "AWS::ElastiCache::SubnetGroup",... | Fix return value of subnet group | Fix return value of subnet group
| Go | mit | jagregory/cfval,jagregory/cfval |
fd7fb4596447d5b9671b9ab55b0e2b957373dbcc | window_predications.go | window_predications.go | package rel
type Windower interface {
Over(Visitable) *OverNode
Visitable
}
func windowPredicationOver(node Windower, visitable Visitable) *OverNode {
return &OverNode{
Left: node,
Right: visitable,
}
}
| package rel
type Windower interface {
Over(Visitable) *OverNode
Visitable
}
func windowPredicationOver(left Windower, right Visitable) *OverNode {
return &OverNode{
Left: left,
Right: right,
}
}
| Fix variable references in window predications | Fix variable references in window predications
| Go | mit | aackerman/rel |
83e1d592ce80c034cccd7c8443b642f3fbd09ed5 | utils/utils.go | utils/utils.go | package utils
import (
"os"
"os/user"
)
/*GetUserHomeDir returns the home directory of the current user.
*/
func GetUserHomeDir() string {
usr, err := user.Current()
// If the current user cannot be reached, get the HOME environment variable
if err != nil {
return os.Getenv("$HOME")
}
return usr.HomeDir
}
... | package utils
import (
"os"
"os/user"
"path/filepath"
"github.com/k0pernicus/goyave/consts"
)
/*IsGitRepository returns if the path, given as an argument, is a git repository or not.
*This function returns a boolean value: true if the pathdir pointed to a git repository, else false.
*/
func IsGitRepository(pat... | Add a new function to know if a pathdir represents the path of a git repository | Add a new function to know if a pathdir represents the path of a git repository
| Go | mit | k0pernicus/goyave |
2db381924ae57432bb6a9b29e93dfd13de2e8643 | pkg/util/util_test.go | pkg/util/util_test.go | package util
import "testing"
func TestIndent(t *testing.T) {
i := Indent(4)
if i != " " {
t.Errorf("Expected four(4) whitespaces, got %v", i)
}
}
| package util
import (
"net/http"
"testing"
)
func TestIndent(t *testing.T) {
if i := Indent(4); i != " " {
t.Errorf("Expected four(4) whitespaces, got %v", i)
}
}
func TestResponseError(t *testing.T) {
r := &http.Response{
StatusCode: 401,
}
m := make(map[string]interface{})
if re := ResponseError(r,... | Add more tests for util. | Add more tests for util.
| Go | mpl-2.0 | mobingi/mobingi-cli |
c24ef376c36eb95217fa8967f18f7d18c7639643 | fuse/mountstate_darwin.go | fuse/mountstate_darwin.go | package fuse
func (ms *MountState) systemWrite(req *request, header []byte) Status {
if req.flatDataSize() == 0 {
_, err := ms.mountFile.Write(header)
return ToStatus(err)
}
if req.fdData != nil {
sz := req.flatDataSize()
buf := ms.AllocOut(req, uint32(sz))
req.flatData, req.status = req.fdData.Bytes(buf... | package fuse
import (
"syscall"
)
func (ms *MountState) systemWrite(req *request, header []byte) Status {
if req.flatDataSize() == 0 {
_, err := syscall.Write(ms.mountFd, Write(header))
return ToStatus(err)
}
if req.fdData != nil {
sz := req.flatDataSize()
buf := ms.AllocOut(req, uint32(sz))
req.flatDa... | Use mountFd on darwin too. | Use mountFd on darwin too.
| Go | mit | cmars/tools,keybase/go-fuse,cmars/tools,cmars/tools,cmars/tools,keybase/go-fuse,keybase/go-fuse |
cd1d566d9222012675173bdef9d15a56f42b85aa | aliyunecs/auto_fdisk.go | aliyunecs/auto_fdisk.go | package aliyunecs
const autoFdiskScript = `#/bin/bash
#fdisk ,formating and create the file system on /dev/xvdb or /dev/vdb
DISK_ATTACH_POINT="/dev/xvdb"
fdisk_fun()
{
fdisk -S 56 \$DISK_ATTACH_POINT << EOF
n
p
1
wq
EOF
sleep 5
mkfs.ext4 \${DISK_ATTACH_POINT}1
}
#config /etc/fstab and mount device
main()
{
if [ ... | package aliyunecs
const autoFdiskScript = `#/bin/bash
#fdisk ,formating and create the file system on /dev/xvdb or /dev/vdb
DISK_ATTACH_POINT="/dev/xvdb"
fdisk_fun()
{
fdisk -S 56 \$DISK_ATTACH_POINT << EOF
n
p
1
wq
EOF
sleep 5
mkfs.ext4 -i 8192 \${DISK_ATTACH_POINT}1
}
#config /etc/fstab and mount device
main()
{... | Set bytes_per_inode to 8KB for data disk of unionfs | Set bytes_per_inode to 8KB for data disk of unionfs
Change-Id: I52be8f573cb85b886a1ecccd044fc004ea78103f
| Go | apache-2.0 | denverdino/docker-machine-driver-aliyunecs,denverdino/docker-machine-driver-aliyunecs |
6468fca0b7a5e37d073747fdd59552723abe5c60 | src/lib/core/positional_parameters.go | src/lib/core/positional_parameters.go | package core
type positionalParameters struct {
parameters []string
rest string
}
func (ps positionalParameters) arity() int {
n := len(ps.parameters)
if ps.rest != "" {
n++
}
return n
}
func (ps positionalParameters) bind(args *Arguments) ([]Value, Value) {
vs := make([]Value, 0, ps.arity())
for ... | package core
type positionalParameters struct {
parameters []string
rest string
}
func (ps positionalParameters) arity() int {
n := len(ps.parameters)
if ps.rest != "" {
n++
}
return n
}
func (ps positionalParameters) bind(args *Arguments) ([]Value, Value) {
vs := make([]Value, 0, ps.arity())
for ... | Fix format string passed to argumentError | Fix format string passed to argumentError
| Go | mit | raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp |
f538fcc774dd1fe1b03b293c4b5c8b313d4de98c | trash/main_darwin.go | trash/main_darwin.go | package trash
import (
"os"
"path/filepath"
)
// TODO: Use better type than string.
func MoveToTrash(name string) error {
name = filepath.Clean(name)
home := os.Getenv("HOME")
_, file := filepath.Split(name)
target := filepath.Join(home, ".Trash", file)
// TODO: If target name exists in Trash, come up with a ... | package trash
import (
"io/ioutil"
"os"
"path/filepath"
)
// TODO: Use better type than string.
func MoveToTrash(name string) error {
name = filepath.Clean(name)
home := os.Getenv("HOME")
dir, file := filepath.Split(name)
target := filepath.Join(home, ".Trash", file)
// TODO: If target name exists in Trash, ... | Make MoveToTrash() remove empty folders left behind, if any. | Make MoveToTrash() remove empty folders left behind, if any.
| Go | mit | shurcooL/go |
6b9db4dd9ef4c612a0e436faad992ad7e860c074 | cmd/searchlight/app/options/options.go | cmd/searchlight/app/options/options.go | package options
import (
"github.com/spf13/pflag"
)
type Config struct {
Master string
KubeConfig string
}
func NewConfig() *Config {
return &Config{
Master: "127.0.0.1:8080",
KubeConfig: "",
}
}
func (s *Config) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.Master, "master", "127.0.0.1:8080", "Th... | package options
import (
"github.com/spf13/pflag"
)
type Config struct {
Master string
KubeConfig string
}
func NewConfig() *Config {
return &Config{
Master: "",
KubeConfig: "",
}
}
func (s *Config) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kuber... | Remove default value for --master flag. | Remove default value for --master flag.
| Go | apache-2.0 | appscode/searchlight,appscode/searchlight,searchlight/searchlight,appscode/searchlight,searchlight/searchlight,searchlight/searchlight,searchlight/searchlight,appscode/searchlight |
14603b31771e091ac8e33418099ff3d276072aba | integration/docker/simple_test.go | integration/docker/simple_test.go | package dockerit
import (
"testing"
"github.com/vdemeester/libkermit/docker"
)
func TestCreateSimple(t *testing.T) {
setupTest(t)
container, err := docker.Create("busybox")
if err != nil {
t.Fatalf("expected no error, got %v", err)
}
if container.ID == "" {
t.Fatalf("expected a containerId, got nothing"... | package dockerit
import (
"testing"
"github.com/vdemeester/libkermit/docker"
)
func TestCreateSimple(t *testing.T) {
setupTest(t)
container, err := docker.Create("busybox")
if err != nil {
t.Fatalf("expected no error, got %v", err)
}
if container.ID == "" {
t.Fatalf("expected a containerId, got nothing"... | Update integration tests a bit | Update integration tests a bit
| Go | apache-2.0 | libkermit/docker,libkermit/docker |
dde2be46ed77e632e51dc6a6d636b373e15c5cbc | conn.go | conn.go | package mysqlproto
import (
"io"
)
type Conn struct {
*Stream
CapabilityFlags uint32
}
func Handshake(rw io.ReadWriteCloser, capabilityFlags uint32,
username, password, database string,
connectAttrs map[string]string) (Conn, error) {
stream := NewStream(rw)
handshakeV10, err := ReadHandshakeV10(stream)
if er... | package mysqlproto
import (
"io"
)
type Conn struct {
*Stream
CapabilityFlags uint32
}
func Handshake(rw io.ReadWriteCloser, capabilityFlags uint32,
username, password, database string,
connectAttrs map[string]string) (Conn, error) {
stream := NewStream(rw)
handshakeV10, err := ReadHandshakeV10(stream)
if er... | Fix reading capability flags in Conn | Fix reading capability flags in Conn
| Go | mit | pubnative/mysqlproto-go |
b4dc25dc8230f14349832bbfd92e958672f1a548 | go/grep.go | go/grep.go | package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
func grep(pattern string, infile *os.File) {
scanner := bufio.NewScanner(infile)
for scanner.Scan() {
line := scanner.Text()
matched, err := regexp.MatchString(pattern, line)
if err != nil {
panic(err)
}
if matched {
fmt.Println(line)
}
}
i... | package main
import (
"bufio"
"fmt"
"os"
"regexp"
)
func grep(pattern string, infile *os.File) {
scanner := bufio.NewScanner(infile)
for scanner.Scan() {
line := scanner.Text()
matched, err := regexp.MatchString(pattern, line)
if err != nil {
panic(err)
}
if matched {
fmt.Println(line)
}
}
i... | Use stderr to output an error | Use stderr to output an error
| Go | mit | mirakui/hello_world,mirakui/hello_world,mirakui/hello_world,mirakui/hello_world,mirakui/hello_world,mirakui/hello_world |
c74cb7335034012dbe1f103602f076d6953f6e3e | gophers.go | gophers.go | package main
import (
"flag"
"fmt"
"log"
"strings"
"github.com/PuerkitoBio/goquery"
)
type user struct {
name string
email string
url string
username string
}
func main() {
url := flag.String("github_url", "", "github url you want to scrape")
flag.Parse()
githubURL := *url
doc, err := goque... | package main
import (
"flag"
"fmt"
"log"
"strings"
"github.com/PuerkitoBio/goquery"
)
type user struct {
name string
email string
url string
username string
}
func main() {
url := flag.String("github_url", "", "github url you want to scrape")
flag.Parse()
githubURL := *url
doc, err := goque... | Add some output to let users know what is about to be scraped. | Add some output to let users know what is about to be scraped.
| Go | mit | sergiotapia/gophers,timchunght/gophers |
c55cb7cbb35199ed596ec4a3456e05e430202fea | hammock.go | hammock.go | package hammock
import (
"fmt"
"github.com/mikebell-org/go-couchdb"
)
type CouchDB struct {
couchdb.CouchDB
}
func Database(host, database, username, password string) (*CouchDB, error) {
db, err := couchdb.Database(host, database, username, password)
return &CouchDB{*db}, err
}
func Sync(db *CouchDB, path s... | package hammock
import (
"fmt"
"github.com/mikebell-org/go-couchdb"
)
type CouchDB struct {
couchdb.CouchDB
}
func Database(host, database, username, password string) (*CouchDB, error) {
db, err := couchdb.Database(host, database, username, password)
return &CouchDB{*db}, err
}
func Sync(db *CouchDB, path s... | Reset err after call to GetDocument() | Reset err after call to GetDocument()
| Go | isc | ramdayan/hammock,leeor/hammock |
5dab011ec52c8ff11468861f5f632359ecc53bb7 | gorduino.go | gorduino.go | package gorduino
import (
"github.com/kraman/go-firmata"
)
type Gorduino struct {
pins map[byte]bool
client *firmata.FirmataClient
work func()
}
func NewGorduino(port string, pins ...byte) *Gorduino {
g := new(Gorduino)
g.pins = make(map[byte]bool)
g.client, _ = firmata.NewClient(port, 57600)
for _, pin ... | package gorduino
import (
"github.com/tarm/goserial"
"github.com/yanzay/go-firmata"
)
type Gorduino struct {
pins map[byte]bool
client *firmata.FirmataClient
work func()
}
func NewGorduino(port string, pins ...byte) (*Gorduino, error) {
g := new(Gorduino)
g.pins = make(map[byte]bool)
c := &serial.Config... | Add serial adaptor and error handling. | Add serial adaptor and error handling.
| Go | mit | yanzay/gorduino |
84776c4e432013fb267fb5084740be416116e699 | cmd/serve/restic/stdio_conn.go | cmd/serve/restic/stdio_conn.go | package restic
import (
"log"
"net"
"os"
)
// Addr implements net.Addr for stdin/stdout.
type Addr struct{}
// Network returns the network type as a string.
func (a Addr) Network() string {
return "stdio"
}
func (a Addr) String() string {
return "stdio"
}
// StdioConn implements a net.Conn via stdin/stdout.
t... | package restic
import (
"net"
"os"
)
// Addr implements net.Addr for stdin/stdout.
type Addr struct{}
// Network returns the network type as a string.
func (a Addr) Network() string {
return "stdio"
}
func (a Addr) String() string {
return "stdio"
}
// StdioConn implements a net.Conn via stdin/stdout.
type Std... | Remove log message on Close | serve/restic: Remove log message on Close
| Go | mit | olihey/rclone,yonjah/rclone,seuffert/rclone,B4dM4n/rclone,B4dM4n/rclone,B4dM4n/rclone,olihey/rclone,B4dM4n/rclone,ncw/rclone,seuffert/rclone,seuffert/rclone,ncw/rclone,olihey/rclone,yonjah/rclone,olihey/rclone,yonjah/rclone,ncw/rclone,ncw/rclone,seuffert/rclone,yonjah/rclone |
4d09eb5bb09fab28752690f0074e38ec2bef8ac4 | master.go | master.go | package weedharvester
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type master struct {
url string
}
type assignment struct {
Count int `json:"count"`
Fid string `json:"fid"`
URL string `json:"url"`
PublicURL string `json:"publicUrl"`
}
func (m *master) Assign() assignment {
c... | package weedharvester
import (
"fmt"
"net/http"
)
type master struct {
url string
}
type assignment struct {
Count int `json:"count"`
Fid string `json:"fid"`
URL string `json:"url"`
PublicURL string `json:"publicUrl"`
}
func (m *master) Assign() assignment {
completeURL := m.url + "/dir/as... | Use json decoder instead of marshalling | Use json decoder instead of marshalling
| Go | mit | ChristianNorbertBraun/Weedharvester |
5052db96f57ac2f4d3fc3a021374a43cf71ca625 | harness/registry.go | harness/registry.go | package harness
import (
log "github.com/Sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
)
type MetricRegistry struct {
metrics map[string]prometheus.Collector
}
func newRegistry() *MetricRegistry {
return &MetricRegistry{
metrics: make(map[string]prometheus.Collector),
}
}
func (reg *Metri... | package harness
import (
log "github.com/Sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
)
type MetricRegistry struct {
metrics map[string]prometheus.Collector
}
func newRegistry() *MetricRegistry {
return &MetricRegistry{
metrics: make(map[string]prometheus.Collector),
}
}
func (reg *Metri... | Fix a bug that metrics wans't reset properly | Fix a bug that metrics wans't reset properly
| Go | mit | kawamuray/prometheus-exporter-harness,kawamuray/prometheus-exporter-harness |
efe9f2bce5cba90966308450131b836bb0b96e41 | src/cmd/facette/http_asset_builtin.go | src/cmd/facette/http_asset_builtin.go | // +build builtin_assets
package main
import (
"context"
"net/http"
"path"
"path/filepath"
"strings"
)
const (
httpDefaultPath = "html/index.html"
)
func (w *httpWorker) httpHandleAsset(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
var ct string
// Stop handling assets if frontend is disa... | // +build builtin_assets
package main
import (
"context"
"net/http"
"path"
"path/filepath"
"strings"
)
const (
httpDefaultPath = "html/index.html"
)
func (w *httpWorker) httpHandleAsset(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
var ct string
// Stop handling assets if frontend is disa... | Fix failing build in 'builtin_assets' mode | Fix failing build in 'builtin_assets' mode
| Go | bsd-3-clause | facette/facette,facette/facette,facette/facette,facette/facette |
aa26a18643c3fb0faa064d7d574e437c6fe72caf | vendor/app/shared/jsonconfig/jsonconfig.go | vendor/app/shared/jsonconfig/jsonconfig.go | package jsonconfig
import (
"io"
"io/ioutil"
"log"
"os"
)
// Parser must implement ParseJSON
type Parser interface {
ParseJSON([]byte) error
}
// Load the JSON config file
func Load(configFile string, p Parser) {
var err error
var input = io.ReadCloser(os.Stdin)
if input, err = os.Open(configFile); err != ni... | package jsonconfig
import (
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
)
// Parser must implement ParseJSON
type Parser interface {
ParseJSON([]byte) error
}
// Load the JSON config file
func Load(configFile string, p Parser) {
var err error
var absPath string
var input = io.ReadCloser(os.Stdin)
if absPat... | Use relative path to load config.json to fix file not found | Use relative path to load config.json to fix file not found
| Go | mit | josephspurrier/gowebapp,josephspurrier/gowebapp |
a8021bd3a2d4380c189b4d3bcc23a3cc61364ea0 | src/puma/dev/http_linux.go | src/puma/dev/http_linux.go | package dev
import (
"crypto/tls"
"net/http"
"puma/httputil"
"time"
)
func (h *HTTPServer) ServeTLS() error {
proxy := &httputil.ReverseProxy{
Director: h.director,
Transport: h.transport,
FlushInterval: 1 * time.Second,
Debug: h.Debug,
}
certCache := NewCertCache()
tlsConfig := &tl... | package dev
import (
"crypto/tls"
"net/http"
)
func (h *HTTPServer) ServeTLS() error {
certCache := NewCertCache()
tlsConfig := &tls.Config{
GetCertificate: certCache.GetCertificate,
}
serv := http.Server{
Addr: h.TLSAddress,
Handler: h,
TLSConfig: tlsConfig,
}
return serv.ListenAndServeTLS(... | Use correct handler on linux | Use correct handler on linux
| Go | bsd-3-clause | attilagyorffy/puma-dev,puma/puma-dev,attilagyorffy/puma-dev,puma/puma-dev,puma/puma-dev,attilagyorffy/puma-dev,puma/puma-dev,attilagyorffy/puma-dev |
b05270237e0b901a999fefd83202f32f19ffb6e4 | github_review_helper_suite_test.go | github_review_helper_suite_test.go | package main_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestGithubReviewHelper(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "GithubReviewHelper Suite")
}
| package main_test
import (
"io/ioutil"
"log"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestGithubReviewHelper(t *testing.T) {
RegisterFailHandler(Fail)
log.SetOutput(ioutil.Discard)
RunSpecs(t, "GithubReviewHelper Suite")
}
| Disable logging for the tests | Disable logging for the tests
| Go | mit | salemove/github-review-helper |
b34576544df533ed39e2d3cfa985ab57da5ff5fd | example/main.go | example/main.go | package main
import (
"fmt"
"log"
"net/http"
"time"
)
func loggingMiddleware(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
t1 := time.Now()
next.ServeHTTP(w, r)
t2 := time.Now()
log.Printf("[%s] %q %v\n", r.Method, r.URL.String(), t2.Sub(t1))
}
return http.Handl... | package main
import (
"fmt"
"log"
"net/http"
"net/url"
"time"
)
func loggingMiddleware(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
t1 := time.Now()
next.ServeHTTP(w, r)
t2 := time.Now()
log.Printf("[%s] %q %v\n", r.Method, r.URL.String(), t2.Sub(t1))
}
return... | Add more logging in example | Add more logging in example
| Go | mit | achiku/wbs |
4dc5c4356fdb67198a3eacc6879ffb1d8b29eb85 | examples/fortune/fortuned/main.go | examples/fortune/fortuned/main.go | // Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Command fortuned runs a daemon that implements the Fortune interface.
package main
import (
"flag"
"log"
"v.io/v23"
"v.io/v23/security"
"v.io/x/... | // Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Command fortuned runs a daemon that implements the Fortune interface.
package main
import (
"flag"
"log"
"v.io/v23"
"v.io/v23/security"
"v.io/x/... | Use the roaming and not the generic runtime factory | examples/fortune: Use the roaming and not the generic runtime factory
In this particular case, it means fortuned transparently remounts itself
as it moves across networks (if running on a laptop that moves around
for example) and it also turns on the debugging services.
In general though, I suspect we can simply do a... | Go | bsd-3-clause | vanadium/go.ref,vanadium/go.ref,vanadium/go.ref,vanadium/go.ref,vanadium/go.ref,vanadium/go.ref |
8b8058cd5ecee3492e2300c6595765f5b34affd4 | main.go | main.go | package main
import (
"fmt"
"os"
)
func main() {
env := &environment{
values: map[object]object{
scmSymbol("true"): TRUE,
scmSymbol("false"): FALSE,
},
}
for _, proc := range makePrimitives(env) {
env.values[scmSymbol(proc.name)] = proc
}
currentScanner = newScanner(os.Stdin)
for {
fmt.Print... | package main
import (
"flag"
"fmt"
"os"
)
func main() {
var (
sicp = flag.Bool("sicp", false, "enter directly to sicp evaluator")
)
flag.Parse()
env := &environment{
values: map[object]object{
scmSymbol("true"): TRUE,
scmSymbol("false"): FALSE,
},
}
for _, proc := range makePrimitives(env) {
... | Add sicp flag to jump to metacircular evaluator | Add sicp flag to jump to metacircular evaluator
| Go | mit | bernerdschaefer/sgheme |
4116ae5c57c6126be0fb95ae364707b76990b8c3 | main.go | main.go | package main
import (
_ "expvar"
"net/http"
"os"
"github.com/bmizerany/pat"
"github.com/codegangsta/negroni"
"github.com/meatballhat/negroni-logrus"
"github.com/unrolled/render"
)
func main() {
m := pat.New()
n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets")))
l := negronilogrus.... | package main
import (
_ "expvar"
"net/http"
"os"
"github.com/bmizerany/pat"
"github.com/codegangsta/negroni"
"github.com/meatballhat/negroni-logrus"
"github.com/unrolled/render"
)
func main() {
m := pat.New()
n := negroni.New(negroni.NewRecovery(), negroni.NewStatic(http.Dir("assets")))
l := negronilogrus.... | Allow listen address to be specified by env var | Allow listen address to be specified by env var
Make the entire TCP listen address, used by the HTTP server,
configurable using the `TIMEOFF_ADDR` environment variable. Previously,
it was possible to configure the port but not the host part of the
address.
| Go | mit | mattbostock/leavediary |
7fb2b903bdcbeac4c99c1c55496544e6db2fc040 | pkg/client/scout/os_metadata_darwin.go | pkg/client/scout/os_metadata_darwin.go | package scout
import (
"context"
"strings"
"github.com/datawire/dlib/dexec"
"github.com/datawire/dlib/dlog"
)
func runSwVers(ctx context.Context, versionName string) string {
cmd := dexec.CommandContext(ctx, "sw_vers", "-"+versionName)
cmd.DisableLogging = true
r, err := cmd.Output()
if err != nil {
dlog.W... | package scout
import (
"bufio"
"bytes"
"context"
"strings"
"github.com/datawire/dlib/dexec"
"github.com/datawire/dlib/dlog"
)
func getOsMetadata(ctx context.Context) map[string]interface{} {
osMeta := map[string]interface{}{
"os_version": "unknown",
"os_build_version": "unknown",
"os_name": ... | Speed up getOsMetadata() on macOS | Speed up getOsMetadata() on macOS
Shell out to `sw_vers` once instead of three times.
Signed-off-by: Thomas Hallgren <5f50a84c1fa3bcff146405017f36aec1a10a9e38@datawire.io>
| Go | apache-2.0 | datawire/telepresence,datawire/telepresence,datawire/telepresence |
c32047e462c79ebcc95381ef9e76e8b54fa55d38 | leftpad.go | leftpad.go | // leftpad.go
/*
This package implements the leftpad function, inspired by the NPM (JS)
package of the same name.
Two functions are defined:
import "leftpad"
// pad with spacex
str, err := LeftPad(s, n)
// pad with specified character
str, err := func LeftPadStr(s, n, c)
*/
package leftp... | /*
This package implements the leftpad function, inspired by the NPM (JS)
package of the same name.
Two functions are defined:
import "leftpad"
// pad with spaces
str, err := LeftPad(s, n)
// pad with specified character
str, err := func LeftPadStr(s, n, c)
*/
package leftpad
import (
"errors"
"fmt"
"s... | Fix formatting and spelling in block comment | Fix formatting and spelling in block comment
| Go | bsd-2-clause | keltia/leftpad |
a70384b03bfb37279088839213cfed11f6487bab | jiradata/TransitionsFuncs.go | jiradata/TransitionsFuncs.go | package jiradata
import (
"strings"
)
// Find will search the transitions for one that matches
// the given name. It will return a valid trantion that matches
// or nil
func (t Transitions) Find(name string) *Transition {
name = strings.ToLower(name)
matches := []Transitions{}
for _, trans := range t {
if stri... | package jiradata
import (
"strings"
)
// Find will search the transitions for one that matches
// the given name. It will return a valid trantion that matches
// or nil
func (t Transitions) Find(name string) *Transition {
name = strings.ToLower(name)
matches := []Transitions{}
for _, trans := range t {
if stri... | Address comments for direct name match | Address comments for direct name match
| Go | apache-2.0 | go-jira/jira,Netflix-Skunkworks/go-jira,Netflix-Skunkworks/go-jira,Netflix-Skunkworks/go-jira,go-jira/jira |
57e28dbc82966b03569338bce11048ad96ed59a2 | main.go | main.go | package main
import (
"github.com/codegangsta/negroni"
"github.com/hariharan-uno/cors"
"github.com/joshsoftware/curem/config"
)
func main() {
c := make(map[string]string)
c["name"] = "test"
c["url"] = "localhost"
c["leads"] = "newlead"
c["contacts"] = "newcontact"
config.Configure(c)
opts := cors.Options... | package main
import (
"github.com/codegangsta/negroni"
"github.com/hariharan-uno/cors"
"github.com/joshsoftware/curem/config"
)
func main() {
c := make(map[string]string)
c["name"] = "dev"
c["url"] = "localhost"
c["leads"] = "newlead"
c["contacts"] = "newcontact"
config.Configure(c)
opts := cors.Options{... | Change db name to dev | Change db name to dev
| Go | mit | joshsoftware/curem,joshsoftware/curem |
1345e228b60c4cde2f32d5e1c79aec7c362c5fad | main.go | main.go | package main
//go:generate $GOPATH/bin/ego -o templates/ego.go -package=template templates
import (
"log"
"net/http"
"os"
)
func main() {
handler, err := OpenHandlerFromEnv()
if err != nil {
log.Fatal(err)
}
http.HandleFunc("/", handler.Handler)
port := os.Getenv("PORT")
if port == "" {
port = "8080"
... | package main
//go:generate $GOPATH/bin/ego -o templates/ego.go -package=template templates
import (
"log"
"net/http"
"os"
)
func main() {
handler, err := OpenHandlerFromEnv()
if err != nil {
log.Fatal(err)
}
http.HandleFunc("/", handler.Handler)
listen := os.Getenv("LISTEN")
if listen == "" {
listen = ... | Change PORT to LISTEN environment variable name | Change PORT to LISTEN environment variable name
| Go | bsd-3-clause | Draal/secure-share,Draal/secure-share,Draal/secure-share |
c3b5a59ca652a7b3cf74c4c29a15d2fb7576da4c | lib/html/header.go | lib/html/header.go | package html
import (
"fmt"
"github.com/Symantec/Dominator/lib/format"
"io"
"runtime"
"syscall"
"time"
)
var startTime time.Time = time.Now()
func writeHeader(writer io.Writer) {
fmt.Fprintf(writer, "Start time: %s<br>\n", startTime)
uptime := time.Since(startTime)
fmt.Fprintf(writer, "Uptime: %s<br>\n", up... | package html
import (
"fmt"
"github.com/Symantec/Dominator/lib/format"
"io"
"runtime"
"syscall"
"time"
)
var startTime time.Time = time.Now()
func writeHeader(writer io.Writer) {
fmt.Fprintf(writer, "Start time: %s<br>\n", startTime)
uptime := time.Since(startTime)
fmt.Fprintf(writer, "Uptime: %s<br>\n", up... | Add after Garbage Collection memory statistics to status pages. | Add after Garbage Collection memory statistics to status pages.
| Go | apache-2.0 | keep94/Dominator,rgooch/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator |
67e8f95d6ac103a5de16336197624a0a1a71ff51 | pechkin.go | pechkin.go | package main
import (
"fmt"
"github.com/jzelinskie/geddit"
"github.com/nlopes/slack"
"io/ioutil"
)
func getSlackToken() string {
dat, err := ioutil.ReadFile("slack-token")
if err != nil {
fmt.Println("Cannot read slack token")
panic(err)
}
return string(dat)
}
func main() {
session, err := geddit.NewLog... | package main
import (
"fmt"
"github.com/mgadzhi/slack-pechkin/reddit"
"github.com/nlopes/slack"
"io/ioutil"
"strings"
)
func getSlackToken() string {
dat, err := ioutil.ReadFile("slack-token")
if err != nil {
fmt.Println("Cannot read slack token")
panic(err)
}
return strings.TrimSpace(string(dat))
}
fun... | Send 10 newest links from r/programming to slack | Send 10 newest links from r/programming to slack
| Go | mit | mgadzhi/slack-pechkin,mgadzhi/slack-pechkin |
9ae07df1524e4af7e1832006f6dd28f86db947cc | ptrhost.go | ptrhost.go | package main
import (
"flag"
"net"
)
func main() {
flag.Parse()
hostname := flag.Arg(0)
addr, _ := net.LookupHost(hostname)
for _, v := range addr {
ptrAddr, _ := net.LookupAddr(v)
println(v, "->", ptrAddr[0])
}
}
| package main
import (
"net"
"os"
flags "github.com/jessevdk/go-flags"
)
func main() {
parser := flags.NewParser(nil, flags.Default)
parser.Usage = "HOSTNAME [OPTIONS]"
args, _ := parser.Parse()
if len(args) == 0 {
os.Exit(1)
}
hostname := args[0]
addr, _ := net.LookupHost(hostname)
for _, v := range a... | Use go-flags and add help | Use go-flags and add help
| Go | mit | itochan/ptrhost |
6f27d1e6cb75bee7d130e0bc21ec23bcdd2f2c9d | repo_test.go | repo_test.go | package cheerio
import (
"testing"
)
func TestFetchSourceRepoURI(t *testing.T) {
tests := []struct {
pkg string
wantRepoURI string
}{
{"flask_cm", "https://github.com/futuregrid/flask_cm"},
}
for _, test := range tests {
repoURI, err := DefaultPyPI.FetchSourceRepoURI(test.pkg)
if err != nil {
... | package cheerio
import (
"testing"
)
func TestFetchSourceRepoURI(t *testing.T) {
tests := []struct {
pkg string
wantRepoURI string
}{
{"flask_cm", "https://github.com/futuregrid/flask_cm"},
{"zipaccess", "https://github.com/iki/zipaccess"},
}
for _, test := range tests {
repoURI, err := Defaul... | Add example with remote .zip file | Add example with remote .zip file
| Go | apache-2.0 | beyang/cheerio |
6f52d0ce62a34e3f5bd29aa4d7068030d700d94a | util.go | util.go | package raftmdb
import (
"bytes"
"encoding/binary"
"github.com/ugorji/go/codec"
)
// Decode reverses the encode operation on a byte slice input
func decodeMsgPack(buf []byte, out interface{}) error {
r := bytes.NewBuffer(buf)
hd := codec.MsgpackHandle{}
dec := codec.NewDecoder(r, &hd)
return dec.Decode(out)
}
... | package raftmdb
import (
"bytes"
"encoding/binary"
"github.com/hashicorp/go-msgpack/codec"
)
// Decode reverses the encode operation on a byte slice input
func decodeMsgPack(buf []byte, out interface{}) error {
r := bytes.NewBuffer(buf)
hd := codec.MsgpackHandle{}
dec := codec.NewDecoder(r, &hd)
return dec.Dec... | Switch to hashicorp version of msgpack | Switch to hashicorp version of msgpack
| Go | mpl-2.0 | sdboyer/raft-mdb,hashicorp/raft-mdb,jmptrader/raft-mdb |
74b7a4645ee242217061bb3233b90e6d126cff15 | password_darwin.go | password_darwin.go | package main
import (
"github.com/hashicorp/terraform/helper/schema"
"github.com/keybase/go-keychain"
"log"
"runtime"
)
func passwordRetrievalFunc(env_var string, dv interface{}) schema.SchemaDefaultFunc {
return func() (interface{}, error) {
if runtime.GOOS == "darwin" {
log.Println("[INFO] On macOS so try... | package main
import (
"log"
"runtime"
"github.com/hashicorp/terraform/helper/schema"
"github.com/keybase/go-keychain"
)
func passwordRetrievalFunc(envVar string, dv interface{}) schema.SchemaDefaultFunc {
return func() (interface{}, error) {
if runtime.GOOS == "darwin" {
log.Println("[INFO] On macOS so try... | Fix some things for code smell | Fix some things for code smell
| Go | mit | Cox-Automotive/terraform-provider-alks |
9ac350c1e5f6e5a8eb55a802f1ec4a13897d2eff | writer_sink.go | writer_sink.go | package lager
import (
"io"
"sync"
)
const logBufferSize = 1024
// A Sink represents a write destination for a Logger. It provides
// a thread-safe interface for writing logs
type Sink interface {
//Log to the sink. Best effort -- no need to worry about errors.
Log(level LogLevel, payload []byte)
}
type writer... | package lager
import (
"io"
"sync"
)
// A Sink represents a write destination for a Logger. It provides
// a thread-safe interface for writing logs
type Sink interface {
//Log to the sink. Best effort -- no need to worry about errors.
Log(level LogLevel, payload []byte)
}
type writerSink struct {
writer i... | Remove unused constant from sink | Remove unused constant from sink
Signed-off-by: Luan Santos <509a85c757dc22c0257f4655fb3fb682d42f965b@pivotal.io>
| Go | apache-2.0 | pivotal-golang/lager,tinygrasshopper/lager |
8b9c7962dce59ff75a58d969003105fb9cc0bcd7 | example/client/main.go | example/client/main.go | package main
import (
"fmt"
"github.com/levigross/grequests"
"github.com/ryanskidmore/GoWork"
"strings"
)
func main() {
response, err := grequests.Get("http://127.0.0.1:3000/register", nil)
if err != nil {
panic("Unable to register:" + err.Error())
}
respdata := strings.Split(response.String(), ",")
id := ... | package main
import (
"fmt"
"github.com/levigross/grequests"
"github.com/ryanskidmore/GoWork"
"strings"
)
func main() {
response, err := grequests.Get("http://127.0.0.1:3000/register", nil)
if err != nil {
panic("Unable to register:" + err.Error())
}
respdata := strings.Split(response.String(), ",")
id := ... | Add the 'get_work' part in the client example | Add the 'get_work' part in the client example
| Go | mit | ryanskidmore/GoWork |
9e92ed60d5a03ce6a9c95c0862648e4e794f6780 | funds/balance/erc20.go | funds/balance/erc20.go | package balance
import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
orCommon "github.com/notegio/openrelay/common"
tokenModule "github.com/notegio/openrelay/token"
"github.com/notegio/openrelay/types"
"math/big"
)
type rpcBalanceChecker struct {
conn bind.ContractBackend
}
func (funds *rpcBalanceCheck... | package balance
import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
orCommon "github.com/notegio/openrelay/common"
tokenModule "github.com/notegio/openrelay/token"
"github.com/notegio/openrelay/types"
"math/big"
)
type rpcERC20BalanceChecker struct {
conn bind.ContractBackend
}
func (funds *rpcERC20Ba... | Update balance checker struct name | Update balance checker struct name
| Go | agpl-3.0 | NoteGio/openrelay,NoteGio/openrelay,NoteGio/openrelay,NoteGio/openrelay |
255d2e7c71a9812127ab3bef421397d1815576ba | request.go | request.go | // Copyright 2016 Marcel Gotsch. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package goserv
import (
"net/http"
)
// A Request represents an HTTP request received by the Server.
//
// It embeds the native http.Request, thus all native ... | // Copyright 2016 Marcel Gotsch. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package goserv
import (
"encoding/json"
"net/http"
)
// A Request represents an HTTP request received by the Server.
//
// It embeds the native http.Request,... | Add JSON decoder to Request | Add JSON decoder to Request
| Go | bsd-3-clause | gotschmarcel/goserv |
48cd473c79811d04012b188978b9f007f0830d88 | api/api_test.go | api/api_test.go | package api
import (
"testing"
"github.com/chromium/hstspreload.appspot.com/database"
)
func TestCheckConnection(t *testing.T) {
ms := database.MockState{}
a := API{database.Mock{State: &ms}}
if err := a.CheckConnection(); err != nil {
t.Errorf("%s", err)
}
ms.FailCalls = true
if err := a.CheckConnection(... | package api
import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/chromium/hstspreload.appspot.com/database"
)
func TestCheckConnection(t *testing.T) {
ms := database.MockState{}
a := API{database.Mock{State: &ms}}
if err := a.CheckConnection(); err != nil {
t.Errorf("%s", ... | Implement a test for api.Status(). | Implement a test for api.Status().
| Go | bsd-3-clause | chromium/hstspreload.org,chromium/hstspreload.org,chromium/hstspreload.org,chromium/hstspreload.org |
97b1465c0e45ba551b3c9281befe531ce76fa257 | eventdata.go | eventdata.go | package gform
import (
"github.com/AllenDang/w32"
)
type MouseEventData struct {
X, Y int
Button int
Wheel int
}
type DropFilesEventData struct {
X, Y int
Files []string
}
type PaintEventData struct {
Canvas *Canvas
}
type LVEndLabelEditEventData struct {
Item *w32.LVITEM
}
type LVDBLClick... | package gform
import (
"github.com/AllenDang/w32"
)
type RawMsg struct {
Hwnd w32.HWND
Msg uint
WParam, LParam uintptr
}
type MouseEventData struct {
X, Y int
Button int
Wheel int
}
type DropFilesEventData struct {
X, Y int
Files []string
}
type PaintEventData... | Add "RawMsg" struct to wrap windows message. | Add "RawMsg" struct to wrap windows message.
| Go | bsd-3-clause | AllenDang/gform,AllenDang/gform,AllenDang/gform |
f845bcd561d3fdb9f7f7b8e6424454e93785b106 | bigsequence/bigsequentialrender_test.go | bigsequence/bigsequentialrender_test.go | package bigsequence
import (
"testing"
"github.com/johnny-morrice/godelbrot/base"
"github.com/johnny-morrice/godelbrot/bigbase"
)
func TestBigMandelbrotSequence(t *testing.T) {
const prec = 53
const iterLimit = 10
app := &bigbase.MockRenderApplication{
MockRenderApplication: base.MockRenderApplication{
Ba... | package bigsequence
import (
"testing"
"github.com/johnny-morrice/godelbrot/base"
"github.com/johnny-morrice/godelbrot/bigbase"
)
func TestBigMandelbrotSequence(t *testing.T) {
const prec = 53
const iterLimit = 10
app := &bigbase.MockRenderApplication{
MockRenderApplication: base.MockRenderApplication{
Ba... | Fix failing unit tests for bigsequence | Fix failing unit tests for bigsequence
| Go | mit | johnny-morrice/godelbrot |
7342707271db0551820b099d5a59ecdf5f006490 | cmd/edgectl/notify.go | cmd/edgectl/notify.go | package main
import (
"fmt"
"runtime"
"github.com/datawire/ambassador/pkg/supervisor"
)
var notifyRAI *RunAsInfo
// Notify displays a desktop banner notification to the user
func Notify(p *supervisor.Process, message string) {
if notifyRAI == nil {
var err error
notifyRAI, err = GuessRunAsInfo(p)
if err !... | package main
import (
"fmt"
"runtime"
"github.com/datawire/ambassador/pkg/supervisor"
)
var (
notifyRAI *RunAsInfo
notifyEnabled = false
)
// Notify displays a desktop banner notification to the user
func Notify(p *supervisor.Process, message string) {
p.Logf("---------------------------------------------... | Make it possible to disable notifications; disable them | Make it possible to disable notifications; disable them
| Go | apache-2.0 | datawire/telepresence,datawire/telepresence,datawire/telepresence |
6e1444ccb4cfa0dca30b8ad9990815d8686741ba | src/qml.go | src/qml.go | package uct
import "flag"
//This is the QML compiler for uct.
var Qml bool
var QmlAssembly = Assemblable{}
func init() {
flag.BoolVar(&Qml, "qml", false, "Target QML")
for k, v := range JavascriptAssembly {
QmlAssembly[k] = v
}
QmlAssembly["QML"] = QmlAssembly["JAVASCRIPT"]
delete(QmlAssembly, "JAVASCRIP... | package uct
import "flag"
//This is the QML compiler for uct.
var Qml bool
var QmlAssembly = Assemblable{}
func init() {
flag.BoolVar(&Qml, "qml", false, "Target QML")
for k, v := range JavascriptAssembly {
QmlAssembly[k] = v
}
QmlAssembly["QML"] = QmlAssembly["JAVASCRIPT"]
delete(QmlAssembly, "JAVASCRIP... | Fix bug with QML/JS being replaced. | Fix bug with QML/JS being replaced.
| Go | bsd-3-clause | Qlova/uct |
63d40da3dd1acbccea4d137e43a4d3a6452500c8 | utils/path_test.go | utils/path_test.go | package utils
import (
"os"
"os/user"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNormalizingHomeDirectories(t *testing.T) {
t.Parallel()
usr, err := user.Current()
assert.NoError(t, err)
fp, err := NormalizeFilePath(filepath.Join(`~`, `.ssh`))
assert.NoError(t, err)
assert... | package utils
import (
"os"
"os/user"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNormalizingHomeDirectories(t *testing.T) {
t.Parallel()
usr, err := user.Current()
assert.NoError(t, err)
fp, err := NormalizeFilePath(filepath.Join(`~`, `.ssh`))
assert.NoError(t, err)
assert... | Make path assertions windows friendly | Make path assertions windows friendly
| Go | mit | buildkite/agent,buildkite/agent,buildkite/agent |
06cb178a1778b165d092e6d59be7c18a090e6e44 | compiler_yara37_test.go | compiler_yara37_test.go | package yara
import (
"testing"
)
func setupCompiler(t *testing.T) *Compiler {
c, err := NewCompiler()
if err != nil {
t.Fatal(err)
}
c.SetIncludeCallback(func(name, rulefile, namespace string) []byte {
t.Logf(`Processing include "%s" (from ns="%s", file="%s")`, name, namespace, rulefile)
if name == "exist... | //+build !yara3.3,!yara3.4,!yara3.5,!yara3.6
package yara
import (
"testing"
)
func setupCompiler(t *testing.T) *Compiler {
c, err := NewCompiler()
if err != nil {
t.Fatal(err)
}
c.SetIncludeCallback(func(name, rulefile, namespace string) []byte {
t.Logf(`Processing include "%s" (from ns="%s", file="%s")`, ... | Add build tags to yara 3.7-specific tests | Add build tags to yara 3.7-specific tests
| Go | bsd-2-clause | hillu/go-yara,VirusTotal/go-yara,hillu/go-yara |
91a6f5cd0820f571cf60315230c3bc7a518f9fb8 | ssha/ssha_test.go | ssha/ssha_test.go | package ssha_test
import (
"testing"
"github.com/jsimonetti/pwscheme/ssha"
)
func TestValidate(t *testing.T) {
pass := "test123"
hash := "{SSHA}lJj507aRaXGguk1uTQoKmKQRV/7N1oB7pmhWdw=="
if res, err := ssha.Validate(pass, hash); res != true {
t.Error("Validate password fails", err)
}
}
func TestGenerate(t *... | package ssha_test
import (
"testing"
"github.com/jsimonetti/pwscheme/ssha"
)
func TestValidate(t *testing.T) {
pass := "test123"
hash := "{SSHA}JFZFs0oHzxbMwkSJmYVeI8MnTDy/276a"
if res, err := ssha.Validate(pass, hash); res != true {
t.Error("Validate password fails", err)
}
}
func TestGenerate(t *testing.... | Add an actually working hash | Add an actually working hash
Signed-off-by: Jeroen Simonetti <fd3fb11d20dd2b55b441515e5cc120796bf92f11@simonetti.nl>
| Go | mit | jsimonetti/pwscheme |
1fde712fbc41aa9c056dc00b943b540246e61405 | openbrowser_windows.go | openbrowser_windows.go | // Copyright 2013 Chris McGee <sirnewton_01@yahoo.ca>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package main
import(
"fmt"
"os/exec"
)
func openBrowser(url string) {
cmd := exec.Command("cmd", "/c", "start", url... | // Copyright 2013 Chris McGee <sirnewton_01@yahoo.ca>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package main
import(
"fmt"
"os/exec"
)
func openBrowser(url string) {
cmd := exec.Command("cmd", "/c", "start", url... | Fix compile error on windows browser handling module. | Fix compile error on windows browser handling module.
| Go | bsd-2-clause | sirnewton01/godbg,sirnewton01/godbg,albfan/godbg,albfan/godbg,albfan/godbg,sirnewton01/godbg |
c6527dfa5a3387affea0b9292ef8af59ddf01042 | datacenters.go | datacenters.go | package clcgo
import (
"encoding/json"
"errors"
"fmt"
)
type DataCenters struct {
DataCenters []DataCenter
}
type DataCenter struct {
ID string
Name string
}
const DataCentersURL = APIRoot + "/datacenters/%s"
func (d DataCenters) URL(a string) (string, error) {
return fmt.Sprintf(DataCentersURL, a), nil
}... | package clcgo
import (
"encoding/json"
"errors"
"fmt"
)
type DataCenters []DataCenter
type DataCenter struct {
ID string
Name string
}
const DataCentersURL = APIRoot + "/datacenters/%s"
func (d DataCenters) URL(a string) (string, error) {
return fmt.Sprintf(DataCentersURL, a), nil
}
func (d *DataCenters) ... | Change DataCenters from struct to slice | Change DataCenters from struct to slice
| Go | apache-2.0 | rupakg/clcgo,CenturyLinkLabs/clcgo |
274e8fe341a0b9490956372edb42cf2bcad09560 | waitfor.go | waitfor.go | package waitfor
import (
"errors"
"time"
"golang.org/x/net/context"
)
var ErrTimeoutExceeded = errors.New("timeout exceeded")
type Check func() bool
func ConditionWithTimeout(condition Check, interval, timeout time.Duration) error {
errChan := make(chan error)
ctx, _ := context.WithTimeout(context.Background(... | package waitfor
import (
"errors"
"time"
"golang.org/x/net/context"
)
var ErrTimeoutExceeded = errors.New("timeout exceeded")
type Check func() bool
func ConditionWithTimeout(condition Check, interval, timeout time.Duration) error {
errChan := make(chan error)
ctx, _ := context.WithTimeout(context.Background(... | Return if single check exceeds timeout | Return if single check exceeds timeout
| Go | apache-2.0 | st3v/waitfor |
06c0856961c3def11f2af425f41717e1bf7388cc | pkg/testdb/rsession.go | pkg/testdb/rsession.go | package testdb
import (
r "github.com/dancannon/gorethink"
"github.com/materials-commons/mcstore/pkg/db"
)
var session *r.Session
func RSession() *r.Session {
if session == nil {
session = db.RSessionUsingMust("localhost:30815", "mctestdb")
}
return session
}
| package testdb
import (
r "github.com/dancannon/gorethink"
"github.com/materials-commons/mcstore/pkg/db"
)
var session *r.Session
func RSession() *r.Session {
if session == nil {
session = db.RSessionUsingMust("localhost:30815", "mctestdb")
}
return session
}
// RSessionErr always returns a nil err. It will ... | Add RSessionErr for unit testing with databaseSessionFilter | Add RSessionErr for unit testing with databaseSessionFilter
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
28bb2868658c4649caac3b303a4a8a97c590d809 | internal/integration/conflicts_test.go | internal/integration/conflicts_test.go | package integration_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti"
. "github.com/sclevine/agouti/dsl"
. "github.com/sclevine/agouti/matchers"
)
var _ = Feature("Conflicts", func() {
It("should allow dot-importing matchers, dsl, ginkgo, and gomega", func() {
Ex... | package integration_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sclevine/agouti"
. "github.com/sclevine/agouti/matchers"
)
var _ = Describe("Conflicts", func() {
It("should allow importing agouti while dot-importing matchers, ginkgo, and gomega", func() {
Expect(agouti.Capab... | Remove dsl package from conflicts test to fix build errors | Remove dsl package from conflicts test to fix build errors
| Go | mit | Etienne42/agouti,abourget/agouti,abourget/agouti,sclevine/agouti,sclevine/agouti,Etienne42/agouti |
9c4d302a3db5e12e283447431d72c8d46d671f52 | internal/messagebirdtest/test_server.go | internal/messagebirdtest/test_server.go | package messagebirdtest
import (
"net/http"
"net/http/httptest"
"os"
"testing"
)
var server *httptest.Server
var responseBody []byte
var status int
// EnableServer starts a fake server, runs the test and closes the server.
func EnableServer(m *testing.M) {
initAndStartServer()
exitCode := m.Run()
closeServer... | package messagebirdtest
import (
"net/http"
"net/http/httptest"
"os"
"testing"
)
var server *httptest.Server
var responseBody []byte
var status int
// EnableServer starts a fake server, runs the test and closes the server.
func EnableServer(m *testing.M) {
initAndStartServer()
exitCode := m.Run()
closeServer... | Fix incorrect status code for requests with incorrect access keys | Fix incorrect status code for requests with incorrect access keys
| Go | bsd-2-clause | messagebird/go-rest-api |
8b354e8af807303532112946d5a7913fe73801d4 | db/dbfactory.go | db/dbfactory.go | package db
import (
"firempq/db/cldb"
"firempq/log"
"os"
"sync"
. "firempq/api"
)
var database DataStorage = nil
var lock sync.Mutex
// GetDatabase returns DataStorage singleton.
func GetDatabase() DataStorage {
lock.Lock()
defer lock.Unlock()
return getDatabase()
}
func SetDatabase(ds DataStorage) {
data... | package db
import (
"firempq/db/cldb"
"firempq/db/ldb"
"firempq/log"
"os"
"sync"
. "firempq/api"
)
var database DataStorage = nil
var lock sync.Mutex
var useGoLevelDB = false
// GetDatabase returns DataStorage singleton.
func GetDatabase() DataStorage {
lock.Lock()
defer lock.Unlock()
return getDatabase()
... | Add flag to switch between goleveldb and levigo. | Add flag to switch between goleveldb and levigo.
| Go | apache-2.0 | vburenin/firempq |
11f71f3a09086902ccda83f0d354133585789c6f | stationStatus_test.go | stationStatus_test.go | package twweather
import "testing"
func TestGetTemperture(t *testing.T) {
weather.UpdateStationStatusWithData(sampleXML)
station := weather.GetStation("橫山")
temperture, err := station.GetTemperture(true)
if err != nil {
t.Log(err)
t.Fail()
return
}
if temperture != 26.6 {
t.Logf("Should got 26.6, got... | package twweather
import "testing"
func TestGetTemperture(t *testing.T) {
weather.UpdateStationStatusWithData(sampleXML)
station := weather.GetStation("橫山")
temperture, err := station.GetTemperture(true)
if err != nil {
t.Log(err)
t.Fail()
return
}
if temperture != 26.6 {
t.Logf("Should got 26.6, got... | Add test for some private method. | Add test for some private method.
| Go | mit | MinecraftXwinP/twweather |
8a0765e9faa143e435dd2c54ea7eb870276fb966 | statsd/statsd_test.go | statsd/statsd_test.go | package statsd
import (
"io"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
type statsdWriterWrapper struct {
io.WriteCloser
}
func (statsdWriterWrapper) SetWriteTimeout(time.Duration) error {
return nil
}
func TestCustomWriterBufferConfiguration(t *testing.T) {
client, err := NewWithWriter(statsdW... | package statsd
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
type statsdWriterWrapper struct{}
func (statsdWriterWrapper) SetWriteTimeout(time.Duration) error {
return nil
}
func (statsdWriterWrapper) Close() error {
return nil
}
func (statsdWriterWrapper) Write(p []byte) (n int, err error... | Fix race condition in the test | Fix race condition in the test
The race only happen when also runnin the benchmark which leave enough time to the un-closed client to flush
| Go | mit | DataDog/datadog-go |
433745d068bf6bceb9c438e4bd0a8d713de5ed77 | src/lib/ast/anonymous_function.go | src/lib/ast/anonymous_function.go | package ast
// AnonymousFunction represents a anonymous function as an expression.
type AnonymousFunction struct {
signature Signature
body interface{}
}
// NewAnonymousFunction creates a anonymous function.
func NewAnonymousFunction(s Signature, b interface{}) AnonymousFunction {
return AnonymousFunction{s, ... | package ast
import "fmt"
// AnonymousFunction represents a anonymous function as an expression.
type AnonymousFunction struct {
signature Signature
body interface{}
}
// NewAnonymousFunction creates a anonymous function.
func NewAnonymousFunction(s Signature, b interface{}) AnonymousFunction {
return Anonymo... | Implement Stringer for anonymous function | Implement Stringer for anonymous function
| Go | mit | raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp,tisp-lang/tisp |
bc8fc4ea9c764a79ea4e6817653100eb09b22677 | webserver/main.go | webserver/main.go | package main
import (
"github.com/gorilla/mux"
"log"
"net/http"
"fmt"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/", homeHandler)
r.HandleFunc("/products", productsHandler)
r.HandleFunc("/product/{productId}", productHandler)
log.Fatal(http.ListenAndServe(":3000", r))
}
func homeHandler(w http.Resp... | //Simple Product controller
package main
import (
"github.com/gorilla/mux"
"log"
"net/http"
"fmt"
)
type Product struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
var products = make([]Product, 10)
//populate test users
func init() {
createTestUsers()
}
func main() ... | Create test users and return simple array | Create test users and return simple array
| Go | mit | daniel-bryant-uk/go-book-exp |
461713884a06cd16c9a7cf494663d21dbda4e559 | pkg/types/namespacedname.go | pkg/types/namespacedname.go | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Optimize string building for NamespacedName | Optimize string building for NamespacedName
Kubernetes-commit: 668d5606189d93f2c396b3881ff71f14d9c2c322
| Go | apache-2.0 | kubernetes/apimachinery |
ea03b4335528cf741b29df1403680f11e56722b1 | git-checkout-store/main.go | git-checkout-store/main.go | package main
import (
"bytes"
"fmt"
"github.com/teddywing/git-checkout-history/utils"
"os"
"os/exec"
)
func main() {
args := os.Args[1:]
if len(args) > 0 {
utils.Store(args[0])
cmd := exec.Command("git", "checkout", args[0])
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil... | package main
import (
"bytes"
"fmt"
"github.com/teddywing/git-checkout-history/utils"
"os"
"os/exec"
)
func main() {
args := os.Args[1:]
if len(args) > 0 {
utils.Store(args[0])
cmd := exec.Command("git", "checkout", args[0])
var out bytes.Buffer
cmd.Stderr = &out
err := cmd.Run()
if err != nil... | Print `git checkout` stderr output | git-checkout-store: Print `git checkout` stderr output
Turns out `git checkout` prints to STDERR instead of STDOUT. Grab the
STDERR output and print that to the screen so we can see the "Switched
to branch 'x'" text when using `git checkout-store`.
| Go | mit | teddywing/git-checkout-history |
b7bd1b9fd48c3a9acdd8bb5d83027dbcb557020c | src/facette/common/types.go | src/facette/common/types.go | package common
import (
"encoding/json"
"math"
)
// PlotValue represents a graph plot value.
type PlotValue float64
// MarshalJSON handles JSON marshaling of the PlotValue type.
func (value PlotValue) MarshalJSON() ([]byte, error) {
if math.IsNaN(float64(value)) || math.Floor(float64(value)) == 0 {
return json.... | package common
import (
"encoding/json"
"math"
)
// PlotValue represents a graph plot value.
type PlotValue float64
// MarshalJSON handles JSON marshaling of the PlotValue type.
func (value PlotValue) MarshalJSON() ([]byte, error) {
// Make NaN and very small values null
if math.IsNaN(float64(value)) || math.Exp... | Fix near-zero plot values handling. | Fix near-zero plot values handling.
| Go | bsd-3-clause | facette/facette,hirocaster/facette,githubert/facette,Skrupellos/facette,iaean/facette,Skrupellos/facette,facette/facette,vovkasm/facette,psytra/facette,vovkasm/facette,yonglehou/facette,vovkasm/facette,githubert/facette,Skrupellos/facette,yonglehou/facette,psytra/facette,githubert/facette,yonglehou/facette,hirocaster/f... |
7dd5b0e0403672673ab5844cd1f07b1e17358679 | lib/log/api.go | lib/log/api.go | package log
type Logger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Fatalln(v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Panicln(v ...interface{})
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
}
t... | package log
type Logger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Fatalln(v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Panicln(v ...interface{})
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
}
t... | Add SetLevel() to lib/log.DebugLogger interface. | Add SetLevel() to lib/log.DebugLogger interface.
| Go | apache-2.0 | Symantec/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator |
4d9393ae0de684f654ea0eb61e9712317b0dde3a | schedule/commit_schedule.go | schedule/commit_schedule.go | package schedule
type ScheduleEntries int
type CommitSchedule [][]int
const (
NOT_A_FIELD ScheduleEntries = -1
EMPTY ScheduleEntries = 0
ONE ScheduleEntries = 1
TWO ScheduleEntries = 2
THREE ScheduleEntries = 3
FOUR ScheduleEntries = 4
)
func BuildCommitSchedule(days []time.... | package schedule
import (
"time"
)
type ScheduleEntries int
type CommitSchedule [][]int
const (
NOT_A_FIELD ScheduleEntries = -1
EMPTY ScheduleEntries = 0
ONE ScheduleEntries = 1
TWO ScheduleEntries = 2
THREE ScheduleEntries = 3
FOUR ScheduleEntries = 4
NUM_WEEK_DAYS = 7
... | Add impl to pass compiliation, not yet tests. | Add impl to pass compiliation, not yet tests.
| Go | mit | 0xfoo/punchcard |
6b96f28e0bae088468b759e5508bc6d1fce16564 | bql/version/version.go | bql/version/version.go | // Copyright 2016 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... | // Copyright 2016 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... | Cut stable release for 0.1.0 | Cut stable release for 0.1.0
| Go | apache-2.0 | google/badwolf |
5f65c84b1cf8d35f3f23bbc0a7e5a8dcc056cd38 | recursion/powerset.go | recursion/powerset.go | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package recursion
// PowerSet returns a power set of s.
// The length of s must be less then size of int.
// If the size is equal or bigger, then nil in... | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package recursion
// PowerSet returns a power set of s.
// The length of s must be less then size of int.
// If the size is equal or bigger, then nil in... | Make PowerSet method more compact | Make PowerSet method more compact
| Go | mit | mrekucci/epi,mrekucci/epi |
67f9a654b4fc460c345ccfc3d120b850aee56fee | src/cf/errors/http_error.go | src/cf/errors/http_error.go | package errors
import "fmt"
type HttpError interface {
Error
StatusCode() int
Headers() string
Body() string
}
type httpError struct {
statusCode int
headers string
body string
code string
description string
}
type HttpNotFoundError struct {
*httpError
}
func NewHttpError(statusCode in... | package errors
import "fmt"
type HttpError interface {
error
StatusCode() int // actual HTTP status code
ErrorCode() string // error code returned in response body from CC or UAA
Headers() string // see: known_error_codes.go
Body() string
}
type httpError struct {
statusCode int
headers string
body ... | Add comments to HTTPError interface | Add comments to HTTPError interface
This can be very confusing potentially
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
69ec64793b7a9e321ce46ba83aed1403eee9c415 | gtf_test.go | gtf_test.go | package gtf
import (
"testing"
"bytes"
"html/template"
)
func AssertEqual(t *testing.T, buffer *bytes.Buffer, testString string) {
if buffer.String() != testString {
t.Error()
}
buffer.Reset()
}
func ParseTest(buffer *bytes.Buffer, body string) {
tpl := template.New("test").Funcs(GtfFuncMap)
tpl.Parse(body... | package gtf
import (
"testing"
"bytes"
"html/template"
)
func AssertEqual(t *testing.T, buffer *bytes.Buffer, testString string) {
if buffer.String() != testString {
t.Error()
}
buffer.Reset()
}
func ParseTest(buffer *bytes.Buffer, body string) {
tpl := template.New("test").Funcs(GtfFuncMap)
tpl.Parse(body... | Add a test for stringLength. | Add a test for stringLength.
| Go | mit | RichardKnop/gtf,leekchan/gtf,Parkayun/gtf |
c82440258f54d5a1a8eb661765a06e7aa95a717a | signer/api/find_key.go | signer/api/find_key.go | package api
import (
"github.com/docker/notary/signer"
"github.com/docker/notary/signer/keys"
pb "github.com/docker/notary/proto"
)
func FindKeyByID(sigServices signer.SigningServiceIndex, keyID *pb.KeyID) (*pb.PublicKey, signer.SigningService, error) {
for _, service := range sigServices {
key, err := service... | package api
import (
"github.com/docker/notary/signer"
"github.com/docker/notary/signer/keys"
pb "github.com/docker/notary/proto"
)
// FindKeyByID looks for the key with the given ID in each of the
// signing services in sigServices. It returns the first matching key it finds,
// or ErrInvalidKeyID if the key is ... | Add documentation for FindKeyByID function | Add documentation for FindKeyByID function
Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a4c351b604@docker.com>
| Go | apache-2.0 | bdwill/docker.github.io,docker/docker.github.io,docker/notary,johnstep/docker.github.io,docker/docker.github.io,jfrazelle/notary,anweiss/docker.github.io,joeuo/docker.github.io,johnstep/docker.github.io,vdemeester/notary,alexisbellido/docker.github.io,jfrazelle/notary,dqminh/notary,bsmr-docker/notary,bgrissin/notary,cy... |
ddddd409aebd2d50c1ce6fe76531fe83b8c949f4 | src/fizzbuzz.go | src/fizzbuzz.go | package main
import (
"fmt"
"strconv"
)
func main() {
for i := 1; i <= 100; i++ {
var output string
switch {
case i%15 == 0:
output = "fizzbuzz"
case i%3 == 0:
output = "fizz"
case i%5 == 0:
output = "buzz"
default:
output = strconv.Itoa(i)
}
fmt.Println(output)
}
}
| package main
import (
"fmt"
"strconv"
)
func main() {
var output string
for i := 1; i <= 100; i++ {
switch {
case i%15 == 0:
output = "fizzbuzz"
case i%3 == 0:
output = "fizz"
case i%5 == 0:
output = "buzz"
default:
output = strconv.Itoa(i)
}
fmt.Println(output)
}
}
| Move var initialization out of loop | Move var initialization out of loop
| Go | mit | qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin,qjcg/CO2Aldrin |
c7774a27cb496f8b31fcfd58f582d15f56897e3e | crawler/prospector_windows.go | crawler/prospector_windows.go | package crawler
// TODO: Implement
func (p *Prospector) isFileRenamed(file string, info os.FileInfo, missingfiles map[string]os.FileInfo) string {
// Can we detect if a file was renamed on Windows?
// NOTE(driskell): What about using golang's func os.SameFile(fi1, fi2 FileInfo) bool?
return ""
}
func (p *Prospecto... | package crawler
import (
"os"
"github.com/elastic/filebeat/input"
)
// TODO: Implement
func (p *Prospector) isFileRenamed(file string, info os.FileInfo, missingfiles map[string]os.FileInfo) string {
// Can we detect if a file was renamed on Windows?
// NOTE(driskell): What about using golang's func os.SameFile(f... | Fix compile error on Windows. | Fix compile error on Windows.
| Go | mit | yapdns/yapdnsbeat,yapdns/yapdnsbeat |
06d334e45a4e03f73ebf83bb285b3a4f1283d5f7 | error_logger_impl.go | error_logger_impl.go | package assert
import (
"fmt"
"io"
"os"
)
type location struct {
Test string
FileName string
Line int
}
type errorLogger interface {
Log(location *location, message string)
}
var theLogger errorLogger = &errorLoggerImpl{writer: os.Stdout}
type errorLoggerImpl struct {
writer io.Writer
prevTe... | package assert
import (
"fmt"
"io"
"os"
)
type location struct {
Test string
FileName string
Line int
}
type errorLogger interface {
Log(location *location, message string)
}
var theLogger errorLogger = &errorLoggerImpl{writer: os.Stdout}
type errorLoggerImpl struct {
writer io.Writer
prevTe... | Refactor the error logger A BIT. | Refactor the error logger A BIT.
| Go | mit | assertgo/assert,assertgo/assert,OrdonTeam/assert,OrdonTeam/assert |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.