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 |
|---|---|---|---|---|---|---|---|---|---|
27baf41ee3e31b4a3a118d14197667b0df5d0419 | strings.go | strings.go | package k
import (
"encoding/json"
"math/rand"
)
// StringArray is an alias for an array of strings
// which has common operations defined as methods.
type StringArray []string
// Contains returns true if the receiver array contains
// an element equivalent to needle.
func (s StringArray) Contains(needle string) b... | package k
import (
"encoding/json"
"math/rand"
"time"
)
// StringArray is an alias for an array of strings
// which has common operations defined as methods.
type StringArray []string
// Contains returns true if the receiver array contains
// an element equivalent to needle.
func (s StringArray) Contains(needle s... | Use own seeded random generator for string generation | Use own seeded random generator for string generation
| Go | bsd-3-clause | voxelbrain/k |
4b874e554a23d0b67f962bd08854d2085d9e1098 | onedrive.go | onedrive.go | package onedrive
import (
"net/http"
"time"
)
const (
version = "0.1"
baseURL = "https://api.onedrive.com/v1.0"
userAgent = "github.com/ggordan/go-onedrive; version " + version
)
// OneDrive is the entry point for the client. It manages the communication with
// Microsoft OneDrive API
type OneDrive struct {... | package onedrive
import (
"net/http"
"time"
)
const (
version = "0.1"
baseURL = "https://api.onedrive.com/v1.0"
userAgent = "github.com/ggordan/go-onedrive; version " + version
)
// OneDrive is the entry point for the client. It manages the communication with
// Microsoft OneDrive API
type OneDrive struct {... | Move private variable to bottom of struct | Move private variable to bottom of struct
| Go | mit | ggordan/go-onedrive |
5fdedbcce2be1450ca0d254973e61ad74d372cac | cfgfile/cfgfile.go | cfgfile/cfgfile.go | package cfgfile
import (
"flag"
"fmt"
"io/ioutil"
"gopkg.in/yaml.v2"
)
// Command line flags
var configfile *string
var testConfig *bool
func CmdLineFlags(flags *flag.FlagSet, name string) {
configfile = flags.String("c", fmt.Sprintf("/etc/%s/%s.yml", name, name), "Configuration file")
testConfig = flags.Bool... | package cfgfile
import (
"flag"
"fmt"
"io/ioutil"
"gopkg.in/yaml.v2"
)
// Command line flags
var configfile *string
var testConfig *bool
func CmdLineFlags(flags *flag.FlagSet, name string) {
configfile = flags.String("c", fmt.Sprintf("/etc/%s/%s.yml", name, name), "Configuration file")
testConfig = flags.Bool... | Fix documentation and log message issue | Fix documentation and log message issue
| Go | mit | yapdns/yapdnsbeat,yapdns/yapdnsbeat |
cd9d03f6839cfb5583ebf3bad725372347a43537 | resources/deployments/generator/mocks/APICLient.go | resources/deployments/generator/mocks/APICLient.go | package mocks
import (
"github.com/mendersoftware/deployments/integration"
"github.com/stretchr/testify/mock"
)
// APIClient is an autogenerated mock type for the APIClient type
type APIClient struct {
mock.Mock
}
// GetDeviceInventory provides a mock function with given fields: device
func (_m *APIClient) GetDev... | // Copyright 2016 Mender Software AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... | Add missing license statement in mock file. | Add missing license statement in mock file.
Signed-off-by: Maciej Mrowiec <0c5b7bd73e5de492f16f5039ef275802502d5ce2@gmail.com>
| Go | apache-2.0 | pasinskim/deployments,pasinskim/deployments,pasinskim/deployments,pasinskim/deployments |
b52e9a021eac4d7b2cee62c3eacf794ec39239ae | http_client.go | http_client.go | package s3gof3r
import (
"net"
"net/http"
"time"
)
type deadlineConn struct {
Timeout time.Duration
net.Conn
}
func (c *deadlineConn) Read(b []byte) (n int, err error) {
if err = c.Conn.SetDeadline(time.Now().Add(c.Timeout)); err != nil {
return
}
return c.Conn.Read(b)
}
func (c *deadlineConn) Write(b []b... | package s3gof3r
import (
"net"
"net/http"
"time"
)
type deadlineConn struct {
Timeout time.Duration
net.Conn
}
func (c *deadlineConn) Read(b []byte) (n int, err error) {
if err = c.Conn.SetDeadline(time.Now().Add(c.Timeout)); err != nil {
return
}
return c.Conn.Read(b)
}
func (c *deadlineConn) Write(b []b... | Enable KeepAlives and set timeout in http transport. | Enable KeepAlives and set timeout in http transport.
| Go | mit | eyethereal/s3gof3r,rlmcpherson/s3gof3r,cce/s3gof3r,reem/s3gof3r,hasnickl/s3gof3r,suzuken/s3gof3r,TuneDB/s3gof3r,mhoglan/s3gof3r,haszhixuan/s3gof3r,JamesClonk/s3gof3r,tempbottle/s3gof3r |
77b95e8c8ba57baefd7c492b43d72c3412d87408 | syntax/tree.go | syntax/tree.go | package syntax
import "github.com/ksco/slua/scanner"
type SyntaxTree interface{}
type (
Chunk struct {
Block SyntaxTree
}
Block struct {
Stmts []SyntaxTree
}
DoStatement struct {
Block SyntaxTree
}
WhileStatement struct {
Exp SyntaxTree
Block SyntaxTree
}
IfStatement struct {
Exp S... | package syntax
import "github.com/ksco/slua/scanner"
type SyntaxTree interface{}
type (
Chunk struct {
Block SyntaxTree
}
Block struct {
Stmts []SyntaxTree
}
DoStatement struct {
Block SyntaxTree
}
WhileStatement struct {
Exp SyntaxTree
Block SyntaxTree
}
IfStatement struct {
Exp S... | Change Tok to Token for readability. | Change Tok to Token for readability.
| Go | mit | ksco/SLua |
c031a75a5033c732635f0d66032a2bb0d7f709ed | pkg/slinga/db2/base_test.go | pkg/slinga/db2/base_test.go | package db2
import (
"github.com/Aptomi/aptomi/pkg/slinga/util"
"github.com/stretchr/testify/assert"
"testing"
)
func TestKey(t *testing.T) {
correctKey := Key("72b062c1-7fcf-11e7-ab09-acde48001122$42")
assert.Equal(t, util.UID("72b062c1-7fcf-11e7-ab09-acde48001122"), correctKey.GetUID(), "Correct UID expected"... | package db2
import (
"github.com/Aptomi/aptomi/pkg/slinga/util"
"github.com/stretchr/testify/assert"
"testing"
)
func TestKey(t *testing.T) {
correctKey := Key("72b062c1-7fcf-11e7-ab09-acde48001122$42")
assert.Equal(t, util.UID("72b062c1-7fcf-11e7-ab09-acde48001122"), correctKey.GetUID(), "Correct UID expected"... | Add test for incorrect generation | Add test for incorrect generation
| Go | apache-2.0 | Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi |
53c9e890a2ae8790c801a7435758b1dedd2304d0 | target/file.go | target/file.go | package target
import (
"io"
"path/filepath"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/hugofs"
)
type Publisher interface {
Publish(string, io.Reader) error
}
type Translator interface {
Translate(string) (string, error)
}
// TODO(bep) consider other ways to solve this.
type OptionalTranslator i... | package target
import (
"io"
"path/filepath"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/hugofs"
)
type Publisher interface {
Publish(string, io.Reader) error
}
type Translator interface {
Translate(string) (string, error)
}
// TODO(bep) consider other ways to solve this.
type OptionalTranslator i... | Make sure target destination has the right path separator. | Make sure target destination has the right path separator.
Signed-off-by: David Calavera <b9b0c8e7f90ecf337f6797c4d2e0f1dd0dbc0324@gmail.com>
| Go | apache-2.0 | bogem/hugo,fedelibre/hugo,mayah/hugo,anthonyfok/hugo,mdhender/hugo,ffrizzo/hugo,sprig/hugo,derekperkins/hugo,bogem/hugo,vbatoufflet/hugo,MarkDBlackwell/hugo,vbatoufflet/hugo,tjyang/hugo,tatsushid/hugo,mitchchn/hugo,gohugoio/hugo,tubo028/hugo,ryanclarke/hugo,fedelibre/hugo,abourget/hugo,fedelibre/hugo,abourget/hugo,bram... |
f0e7b4ade2cf9a2304e5b92258b68c9f3e15fc3d | command/git-install.go | command/git-install.go | package command
import (
"github.com/akaspin/bar/client/git"
"github.com/akaspin/bar/client/model"
"github.com/akaspin/bar/client/transport"
"github.com/spf13/cobra"
"github.com/tamtam-im/logx"
)
type GitInstallCmd struct {
*Environment
*CommonOptions
// Installable logging level
Log string
}
func (c *GitI... | package command
import (
"github.com/akaspin/bar/client/git"
"github.com/akaspin/bar/client/model"
"github.com/akaspin/bar/client/transport"
"github.com/spf13/cobra"
"github.com/tamtam-im/logx"
)
type GitInstallCmd struct {
*Environment
*CommonOptions
// Installable logging level
Log string
}
func (c *GitI... | Use INFO logging level in `bar git install` | Use INFO logging level in `bar git install`
| Go | mit | akaspin/bar |
a524c3fd67315266d6c8e14a6605e8dc98a00b1d | debug.go | debug.go | // Copyright 2015 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 2015 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... | Remove prefix to save some characters. | Remove prefix to save some characters.
| Go | apache-2.0 | clekstro/fuse,jacobsa/fuse |
9f3bdaaa02dee3bf928f20a7ba723845de865244 | agent/config.go | agent/config.go | /*
Copyright (c) 2014, Percona LLC and/or its affiliates. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | /*
Copyright (c) 2014, Percona LLC and/or its affiliates. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | Set real default API hostname. | Set real default API hostname.
| Go | agpl-3.0 | vadimtk/metrics-agent,vadimtk/metrics-agent |
7c37910bc765e705301b159683480bdd44555c91 | runtime/fds.go | runtime/fds.go | // +build !windows
package runtime
import (
"io/ioutil"
"syscall"
"github.com/codahale/metrics"
)
func getFDLimit() (uint64, error) {
var rlimit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
return 0, err
}
return uint64(rlimit.Cur), nil
}
func getFDUsage() (uint... | // +build !windows
package runtime
import (
"io/ioutil"
"syscall"
"github.com/codahale/metrics"
)
func getFDLimit() (uint64, error) {
var rlimit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
return 0, err
}
// rlimit.Cur's type is platform-dependent, so here we wi... | Document the fix for FreeBSD. | Document the fix for FreeBSD.
| Go | mit | codahale/metrics |
58ff12f3f8fedb1227f38e0c21557ef2fb1fc7a4 | internal/logging/helper.go | internal/logging/helper.go | package logging
import (
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
// ConfigureLogging sets up open match logrus instance using the logging section of the matchmaker_config.json
// - log line format (text[default] or json)
// - min log level to include (debug, info [default], warn, error, fatal, pan... | package logging
import (
stackdriver "github.com/TV4/logrus-stackdriver-formatter"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
// ConfigureLogging sets up open match logrus instance using the logging section of the matchmaker_config.json
// - log line format (text[default] or json)
// - min log level... | Add stackdriver format support via TV4/logrus-stackdriver-formatter. Simply set format in config to stackdriver | Add stackdriver format support via TV4/logrus-stackdriver-formatter. Simply set format in config to stackdriver
| Go | apache-2.0 | googleforgames/open-match |
655617ed6a0d5c88c0c31ae1766fcfa8330b8bdd | builtin/providers/postgresql/provider_test.go | builtin/providers/postgresql/provider_test.go | package postgresql
import (
"os"
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders ... | package postgresql
import (
"os"
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders ... | Remove the PGPASSWORD requirement for tests. | Remove the PGPASSWORD requirement for tests.
If they're required and the value is missing, the test will fail. There's
no need to enforce that in the test itself.
| Go | mpl-2.0 | Boran/terraform,vrenjith/terraform,hpcloud/terraform,whiskeyjay/terraform,asedge/terraform,Sixgill/terraform,hrach/hashicorp-terraform,jamtur01/terraform,Zordrak/terraform,evalphobia/saas-ci-performance-compare-terraform,HotelsDotCom/terraform,yanndegat/terraform,StephenWeatherford/terraform,kyhavlov/terraform,heimweh/... |
8fd905cf2715ad2ee55b10e969daee168f7d8340 | main.go | main.go | package main
import (
"fmt"
"io/ioutil"
"./lexer"
"./parser"
"./print"
)
func main() {
dat, err := ioutil.ReadFile("sample.dtodo")
if err != nil {
panic(err)
}
todo(string(dat))
}
func todo(src string) {
tokenChan := make(chan lexer.Token)
nodeChan := make(chan parser.Todo)
go parser.Run(nodeChan, to... | package main
import (
"fmt"
"io/ioutil"
"./lexer"
"./parser"
"./print"
)
func main() {
dat, err := ioutil.ReadFile("sample.dtodo")
if err != nil {
panic(err)
}
todo(string(dat))
}
func todo(src string) {
tokenChan := make(chan lexer.Token)
nodeChan := make(chan parser.Todo)
go lexer.Run(tokenChan, &s... | Change calling sequence of go routines. | Refactoring: Change calling sequence of go routines.
A sequence "lexer -> parser" is correct and more pretty than "parser ->
lexer" but due to my lack of understanding on go routine, It was
reversed.
| Go | mit | alldne/deps-todo |
4b630b2c25d000f3e11b4528b4512eb340f1209f | main.go | main.go | package main
import (
"fmt"
"log"
"net/http"
"github.com/julienschmidt/httprouter"
)
var data map[string]string = map[string]string{}
func Get(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
key := params.ByName("key")
fmt.Fprint(w, data[key])
}
func Put(w http.ResponseWriter, r *http.Req... | package main
import (
"fmt"
"log"
"net/http"
"github.com/julienschmidt/httprouter"
)
var data map[string]string = map[string]string{}
func Get(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
key := params.ByName("key")
value, ok := data[key]
if !ok {
w.Header().Set("Status", "404")
f... | Handle 404 in get requests | Handle 404 in get requests
| Go | mit | rlayte/toystore |
80162e28da232f3daf957964d38ee5f2f8153097 | hostsfile/host_test.go | hostsfile/host_test.go | package hostsfile
| package hostsfile
import (
"testing"
)
func TestNewHost(t *testing.T) {
host := NewHost("IP", "hostname")
id := createHostId("hostname")
stub := Host{"IP", "hostname", id}
if *host != stub {
t.Error("Ordering of Host fields do not match.")
}
}
| Add a test for NewHost. | Add a test for NewHost.
| Go | mit | damonkelley/hostsup,damonkelley/hostsup |
2599f007703a3411a05671470b63be6307a4910d | js2/initcontext.go | js2/initcontext.go | /*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2016 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... | /*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2016 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... | Hide stuff user code shouldn't access | Hide stuff user code shouldn't access
| Go | agpl-3.0 | gbts/k6,loadimpact/k6,gbts/k6,gbts/k6,gbts/k6,StephenRadachy/k6,loadimpact/k6,StephenRadachy/k6 |
d63b52c0bea7604e7bfa0d2756833397767a113b | time.go | time.go | package main
import (
"time"
)
type (
InstanceTime int64
InstanceDuration int64
)
const (
RealGameTick = time.Second / 20
RealPeriodicalTick = time.Second / 2
RealRegenerationTick = time.Second * 5
GameTick = InstanceDuration(RealGameTick / RealGameTick)
PeriodicalTick = InstanceDura... | package main
import (
"time"
)
type (
InstanceTime int64
InstanceDuration int64
)
const (
RealGameTick = time.Second / 20
RealPeriodicalTick = time.Second / 2
RealRegenerationTick = time.Second * 5
GameTick = InstanceDuration(RealGameTick / RealGameTick)
PeriodicalTick = InstanceDura... | Add implementation of the InstanceClock interface | Add implementation of the InstanceClock interface
| Go | mit | etheriqa/crescent |
f5b46e9919c680aa76aabfc810624dda97b9b2b3 | discard_go14.go | discard_go14.go | // +build !go1.5
package bom
import "bufio"
func discardBytes(buf *bufio.Reader, n int) {
// cannot use the buf.Discard method as it was introduced in Go 1.5
if n <= 0 {
return
}
b := make([]byte, n)
buf.Read(b)
}
| // +build !go1.5
package bom
import "bufio"
func discardBytes(buf *bufio.Reader, n int) {
// cannot use the buf.Discard method as it was introduced in Go 1.5
for i := 0; i < n; i++ {
_, err := buf.ReadByte()
if err != nil {
return
}
}
}
| Remove allocation in discard 1.4 | Remove allocation in discard 1.4
| Go | mit | spkg/bom |
26d1e6a761548f76d1f54a2337800e03397d6bd1 | component.go | component.go | package main
import (
"strings"
"github.com/sheenobu/go-xco"
)
func main() {
opts := xco.Options{
Name: "sms.example.com",
SharedSecret: "secret shared with the XMPP server",
Address: "127.0.0.1:5347",
}
c, err := xco.NewComponent(opts)
if err != nil {
panic(err)
}
// Uppercase Echo Com... | package main
import (
"fmt"
"os"
"strings"
"github.com/BurntSushi/toml"
"github.com/sheenobu/go-xco"
)
type StaticConfig struct {
Xmpp StaticConfigXmpp `toml:"xmpp"`
}
type StaticConfigXmpp struct {
Host string `toml:"host"`
Name string `toml:"name"`
Port int `toml:"port"`
Secret string `toml:"se... | Move configuration to a file | Move configuration to a file
Instead of hard coding details about the XMPP server and the SMS
component, load them from a config file. The name of the config file
must be given as the first argument on the command line. The config
file format is TOML. It should look something like this:
[xmpp]
host = "127.0.0.... | Go | unlicense | mndrix/sms-over-xmpp |
fc52fbf40e4a93a95b61d9f9a3310277c88ba469 | src/garden-external-networker/bindmount/mounter_linux.go | src/garden-external-networker/bindmount/mounter_linux.go | package bindmount
import (
"fmt"
"os"
"path/filepath"
"syscall"
"golang.org/x/sys/unix"
)
type Mounter struct{}
func (m *Mounter) IdempotentlyMount(source, target string) error {
err := os.MkdirAll(filepath.Dir(target), 0600)
if err != nil {
return fmt.Errorf("os.MkdirAll failed: %s", err)
}
fd, err := ... | package bindmount
import (
"fmt"
"os"
"path/filepath"
"syscall"
"golang.org/x/sys/unix"
)
type Mounter struct{}
func (m *Mounter) IdempotentlyMount(source, target string) error {
err := os.MkdirAll(filepath.Dir(target), 0700)
if err != nil {
return fmt.Errorf("os.MkdirAll failed: %s", err)
}
fd, err := ... | Make owner of directory be able to access its content | Make owner of directory be able to access its content
See https://github.com/cloudfoundry/cf-networking-release/issues/65 for the context.
| Go | apache-2.0 | cloudfoundry-incubator/cf-networking-release,cloudfoundry-incubator/cf-networking-release,cloudfoundry-incubator/cf-networking-release,cloudfoundry-incubator/cf-networking-release |
6c5dbf1a30afa633531d574b3226e86fbba9fc96 | deploy/rsync.go | deploy/rsync.go | package deploy
import (
"fmt"
"strings"
"github.com/yuuki/droot/mounter"
"github.com/yuuki/droot/osutil"
)
var RsyncDefaultOpts = []string{"-av", "--delete", "--exclude=/proc/", "--exclude=/sys/"}
func Rsync(from, to string, arg ...string) error {
from = from + "/"
// append "/" when not terminated by "/"
if... | package deploy
import (
"fmt"
"strings"
"github.com/yuuki/droot/mounter"
"github.com/yuuki/droot/osutil"
)
var RsyncDefaultOpts = []string{"-av", "--delete"}
func Rsync(from, to string, arg ...string) error {
from = from + "/"
// append "/" when not terminated by "/"
if strings.LastIndex(to, "/") != len(to)-... | Fix loss of /proc and /sys when symlink deploy | Fix loss of /proc and /sys when symlink deploy
| Go | mit | yuuki1/droot,yuuki/droot,yuuki1/droot,yuuki/droot |
bbc500b68397b1c747afd4bdcf476010244cbbe9 | lib/logbuf/impl.go | lib/logbuf/impl.go | package logbuf
import (
"fmt"
"io"
)
func (lb *LogBuffer) write(p []byte) (n int, err error) {
lb.rwMutex.Lock()
defer lb.rwMutex.Unlock()
val := make([]byte, len(p))
copy(val, p)
lb.buffer.Value = val
lb.buffer = lb.buffer.Next()
return len(p), nil
}
func (lb *LogBuffer) dump(writer io.Writer, prefix, post... | package logbuf
import (
"flag"
"fmt"
"io"
"os"
)
var (
alsoLogToStderr = flag.Bool("alsoLogToStderr", false,
"If true, also write logs to stderr")
)
func (lb *LogBuffer) write(p []byte) (n int, err error) {
if *alsoLogToStderr {
os.Stderr.Write(p)
}
lb.rwMutex.Lock()
defer lb.rwMutex.Unlock()
val := ma... | Add -alsoLogToStderr flag to logbug package. | Add -alsoLogToStderr flag to logbug package.
| Go | apache-2.0 | Symantec/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator |
e1170c0a865127a33daf807c92e47c6e07cc10eb | cmd/agentctl2/cmd/cli_cmd.go | cmd/agentctl2/cmd/cli_cmd.go | package cmd
import (
"fmt"
"os"
"github.com/ligato/vpp-agent/cmd/agentctl2/restapi"
"github.com/spf13/cobra"
)
// RootCmd represents the base command when called without any subcommands.
var cliConfig = &cobra.Command{
Use: "cli",
Aliases: []string{"c"},
Short: "CLI command for VPP",
Long: `
Run CLI c... | package cmd
import (
"fmt"
"os"
"github.com/ligato/vpp-agent/cmd/agentctl2/restapi"
"github.com/spf13/cobra"
)
// RootCmd represents the base command when called without any subcommands.
var cliConfig = &cobra.Command{
Use: "vppcli",
Short: "CLI command for VPP",
Long: `
Run CLI command for VPP
`,
Args: c... | Rename CLI command to vppcli | Agentctl2: Rename CLI command to vppcli
Signed-off-by: Andrej Kozemcak <806670a1cb1f0508258ef96648425f1247742d81@pantheon.tech>
| Go | apache-2.0 | ondrej-fabry/vpp-agent,ondrej-fabry/vpp-agent,VladoLavor/vpp-agent,VladoLavor/vpp-agent,VladoLavor/vpp-agent,ondrej-fabry/vpp-agent |
7c9f3a0c66ca6ba0c3ea10296de73dc1053bd124 | mutable/dense/dense.go | mutable/dense/dense.go | /*
Package "dense" provides an implementation of "Matrix" which stores elements in a slide.
*/
package dense
import (
"errors"
"fmt"
"github.com/mitsuse/matrix-go"
)
type matrixImpl struct {
rows int
columns int
elements []float64
}
func New(rows, columns int) func(elements ...float64) (matrix.Matrix, er... | /*
Package "dense" provides an implementation of "Matrix" which stores elements in a slide.
*/
package dense
import (
"errors"
"fmt"
"github.com/mitsuse/matrix-go"
)
type matrixImpl struct {
rows int
columns int
elements []float64
}
func New(rows, columns int) func(elements ...float64) (matrix.Matrix, er... | Implement "(*matrixImpl).Shape()" with "(*matrixImple).Rows()" and "(*matrixImple).Columns()". | Implement "(*matrixImpl).Shape()" with "(*matrixImple).Rows()" and "(*matrixImple).Columns()".
| Go | mit | jmptrader/matrix-go,mitsuse/matrix-go |
10f32b9d14d3431ca6ee9fa7564dd04c724711e1 | librarian/librarian.go | librarian/librarian.go | package librarian
import (
"github.com/mlafeldt/chef-runner/exec"
"github.com/mlafeldt/chef-runner/util"
)
func Command(path string) []string {
var cmd []string
if util.FileExist("Gemfile") {
cmd = []string{"bundle", "exec"}
}
cmd = append(cmd, "librarian-chef", "install", "--path", path)
return cmd
}
func ... | package librarian
import (
"os"
"path"
"path/filepath"
"github.com/mlafeldt/chef-runner/exec"
"github.com/mlafeldt/chef-runner/util"
)
func Command(dst string) []string {
var cmd []string
if util.FileExist("Gemfile") {
cmd = []string{"bundle", "exec"}
}
cmd = append(cmd, "librarian-chef", "install", "--pa... | Remove temporary Librarian-Chef files from destination | Remove temporary Librarian-Chef files from destination
| Go | apache-2.0 | mlafeldt/chef-runner,rajthilakmca/chef-runner,mlafeldt/chef-runner,mlafeldt/chef-runner,rajthilakmca/chef-runner,rajthilakmca/chef-runner |
681abb201b6cccdd740804f5a7926fd630c711bb | regressiontests/structcheck_test.go | regressiontests/structcheck_test.go | package regressiontests
import (
"reflect"
"testing"
)
type Empty struct{}
func TestStructcheck(t *testing.T) {
t.Parallel()
source := `package test
type test struct {
unused int
}
`
pkgName := reflect.TypeOf(Empty{}).PkgPath()
expected := Issues{
{Linter: "structcheck", Severity: "warning", Path: "test.go... | package regressiontests
import "testing"
func TestStructcheck(t *testing.T) {
t.Parallel()
source := `package test
type test struct {
unused int
}
`
expected := Issues{
{Linter: "structcheck", Severity: "warning", Path: "test.go", Line: 4, Col: 2, Message: "unused struct field github.com/alecthomas/gometalinte... | Revert "make tests compatible with forks" | Revert "make tests compatible with forks"
This reverts commit 27d000f852fa9c6c0c4a8e3c050710b1c83db186.
| Go | mit | alecthomas/gometalinter,alecthomas/gometalinter,dnephin/gometalinter,alecthomas/gometalinter,dnephin/gometalinter,dnephin/gometalinter |
3e08824703812ee6ef1aa0c1c82e068ee68e2fbe | route/no_route.go | route/no_route.go | package route
import (
"log"
"sync/atomic"
)
// HTML Wrapper struct so we can store the html string in an atomic.Value
type HTML struct {
value string
}
// html stores the no route html string
var store atomic.Value
func init() {
store.Store(HTML{""})
}
// GetHTML returns the HTML for not found rou... | package route
import (
"log"
"sync/atomic"
)
var store atomic.Value // string
func init() {
store.Store("")
}
// GetHTML returns the HTML for not found routes.
func GetHTML() string {
return store.Load().(string)
}
// SetHTML sets the current noroute html.
func SetHTML(h string) {
// html := HT... | Remove superfluous constructs of store | Remove superfluous constructs of store
| Go | mit | fabiolb/fabio,fabiolb/fabio |
ad2e46ada49e9ea6abd51da5373ea7a1703b9a3b | build-constants.go | build-constants.go | package main
var (
Version = "0.0.0"
CommitSHA = "none"
)
| package main
var (
Version = "0.0.0"
CommitSHA = "unknown"
)
| Use 'unknown' for unknown commit revisions. We need to find a nicer way to handle this on Windows, where we don't have 'make' | Use 'unknown' for unknown commit revisions. We need to find a nicer way to handle this on Windows, where we don't have 'make'
| Go | agpl-3.0 | muesli/beehive,muesli/beehive |
90270b430b61b7d46aee0b6c9f2579d56c9baf70 | pkg/dnsprovider/providers/google/clouddns/zones.go | pkg/dnsprovider/providers/google/clouddns/zones.go | /*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... | /*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... | Return error not empty list when dnsprovider returns an error. | Return error not empty list when dnsprovider returns an error.
| Go | apache-2.0 | kubernetes-retired/cluster-registry,kubernetes-retired/cluster-registry |
77a5ec8b0991bafce8f0b3e1c001a69e938ed4a7 | errors/errors.go | errors/errors.go | // Package errors contains middlewares for converting HTTP response codes to GoLang errors.
package errors // import "go.delic.rs/cliware-middlewares/errors"
import (
"fmt"
"net/http"
"io/ioutil"
c "go.delic.rs/cliware"
)
type HTTPError struct {
Name string
StatusCode int
Body string
}
func (e *... | // Package errors contains middlewares for converting HTTP response codes to GoLang errors.
package errors // import "go.delic.rs/cliware-middlewares/errors"
import (
"fmt"
"net/http"
"io/ioutil"
c "go.delic.rs/cliware"
)
type HTTPError struct {
Name string
StatusCode int
Body []byte
}
func (e *... | Return []byte from http error instead of string. | Return []byte from http error instead of string.
| Go | mit | delicb/cliware-middlewares |
05d04643546f5d9361ca4202d3961a1689b23573 | azure/client.go | azure/client.go | package azure
import (
"io/ioutil"
"log"
"github.com/hashicorp/go-retryablehttp"
)
type Client struct {
logger *log.Logger
BaseURL string
subscriptionID string
tokenRequester *tokenRequester
httpClient *retryablehttp.Client
}
func NewClient(creds *AzureResourceManagerCredentials) (*Client, erro... | package azure
import (
"io/ioutil"
"log"
"github.com/hashicorp/go-retryablehttp"
"net/http"
)
type Client struct {
logger *log.Logger
BaseURL string
subscriptionID string
tokenRequester *tokenRequester
httpClient *retryablehttp.Client
}
func NewClient(creds *AzureResourceManagerCredentials) (*... | Add support for hooking retryablehttp request logs | Add support for hooking retryablehttp request logs
| Go | mpl-2.0 | jen20/riviera |
29a46de2a2c386cde54826874d5fc082bbd80f5b | command_cleanup.go | command_cleanup.go | package main
import "fmt"
func commandCleanupChecks(done chan bool, printOnly bool) {
if !printOnly {
dbOpen()
}
stmts := []string{
`DELETE FROM check_instance_configurations;`,
`DELETE FROM check_instance_configuration_dependencies;`,
`DELETE FROM check_instances;`,
`DELETE FROM checks;`,
`DELETE FRO... | package main
import "fmt"
func commandCleanupChecks(done chan bool, printOnly bool) {
if !printOnly {
dbOpen()
}
stmts := []string{
`DELETE FROM check_instance_configurations;`,
`DELETE FROM check_instance_configuration_dependencies;`,
`DELETE FROM check_instances;`,
`DELETE FROM checks;`,
`DELETE FRO... | Make cleanup checks command terminate | Make cleanup checks command terminate
| Go | bsd-2-clause | 1and1/soma |
9427fbcd5b4753d55c2991b9be06ae5ec041442a | gitio.go | gitio.go | /*
Package gitio shortens github urls using the git.io service.
*/
package gitio
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
// Shorten a long github url.
func Shorten(longurl string) (string, error) {
resp, err := http.PostForm(`https://git.io/create`, url.Values{`url`: {longurl}})
if err != nil {
retu... | /*
Package gitio shortens github urls using the git.io service.
*/
package gitio
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"time"
)
// Shorten a long github url.
func Shorten(longurl string) (string, error) {
client := new(http.Client)
client.Timeout = 5 * time.Second
resp, err := client.PostForm(`http... | Add 5s timeout to http call | Add 5s timeout to http call
| Go | mit | aarondl/gitio |
b5b9899f87181ceca7d7b3cb6663c33bc22ed8b6 | smart_shutdown.go | smart_shutdown.go | package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
)
var listenerChan = make(chan net.Listener)
var activeConnections sync.WaitGroup
func init() {
go watchForSIGTERM()
}
func watchForSIGTERM() {
var listeners []net.Listener
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscal... | package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
)
var listenerChan = make(chan net.Listener)
var activeConnections sync.WaitGroup
func init() {
go watchForSIGTERM()
}
func watchForSIGTERM() {
var listeners []net.Listener
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan... | Put a time limit on smart shutdown. | Put a time limit on smart shutdown.
| Go | bsd-2-clause | vishnuvaradaraj/redwood,unixabg/redwood,andybalholm/redwood,unixabg/redwood,vishnuvaradaraj/redwood,yinheli/redwood-filter,yinheli/redwood-filter,andybalholm/redwood,yinheli/redwood-filter,vishnuvaradaraj/redwood |
86bb90498ca29ed3c67e66585cd3cedc80ed0262 | aws/ec2/availability_zone_retriever.go | aws/ec2/availability_zone_retriever.go | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... | Revert "Fix bbl up for AWS" | Revert "Fix bbl up for AWS"
This reverts commit 94599faddf4921e2ad53ffe47755b4b89ebd3a41.
[#139857703]
Signed-off-by: Christian Ang <15ae83feccf4d84083a62aba1cdf46bd8ce2e33b@pivotal.io>
| Go | apache-2.0 | niroyb/bosh-bootloader,niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader |
faa1dcc57f2ddf970dcedf5b67ccf6ca19c17b92 | chap-1/7-1.go | chap-1/7-1.go | package main
import (
"fmt"
"unicode/utf8"
)
func main() {
text := "abcdefg"
fmt.Println(reverseString1(text))
fmt.Println(reverseString2(text))
}
func reverseString1(s string) string {
reversed := make([]rune, utf8.RuneCountInString(s))
i := len(reversed) - 1
for _, c := range s {
reversed[i] = c
i--
... | package main
import (
"fmt"
"strings"
"unicode/utf8"
)
func main() {
text := "abcdefg 456789"
fmt.Println(text)
fmt.Println(reverseString1(text))
fmt.Println(reverseString2(text))
fmt.Println(reverseWord(text))
}
func reverseString1(s string) string {
reversed := make([]rune, utf8.RuneCountInString(s))
i :... | Add a solution of Chapter 1.7 to reverse words in a string | Add a solution of Chapter 1.7 to reverse words in a string
| Go | mit | oshothebig/golang-cookbook |
33e90105f4391f9546d300a182bd155adf1bb00a | v1/tv/profile_example_test.go | v1/tv/profile_example_test.go | // Copyright (C) 2016 AppNeta, Inc. All rights reserved.
package tv_test
import (
"time"
"github.com/appneta/go-appneta/v1/tv"
"golang.org/x/net/context"
)
func slowFunc(ctx context.Context) {
defer tv.BeginProfile(ctx, "slowFunc").End()
// ... do something else ...
time.Sleep(1 * time.Second)
}
func Example... | // Copyright (C) 2016 AppNeta, Inc. All rights reserved.
package tv_test
import (
"database/sql"
"fmt"
"time"
"github.com/appneta/go-appneta/v1/tv"
"golang.org/x/net/context"
)
// measure a DB query
func dbQuery(ctx context.Context, host, query string, args ...interface{}) *sql.Rows {
// Begin a TraceView lay... | Add DB query to whole-file example | Add DB query to whole-file example
| Go | apache-2.0 | appneta/go-appneta,appneta/go-appneta |
f8a2538dae30a30e4f992611ddbf4631bbd9d008 | commands/out.go | commands/out.go | package commands
import (
"github.com/spf13/cobra"
)
var outCmd = &cobra.Command{
Use: "out",
Short: "Write a file based on key data.",
Long: `out is for writing a file based on a Consul key.`,
Run: outRun,
}
func outRun(cmd *cobra.Command, args []string) {
// Stuff goes here.
}
var KeyLocation string
va... | package commands
import (
"github.com/spf13/cobra"
"fmt"
)
var outCmd = &cobra.Command{
Use: "out",
Short: "Write a file based on key data.",
Long: `out is for writing a file based on a Consul key.`,
Run: outRun,
}
func outRun(cmd *cobra.Command, args []string) {
checkFlags()
}
func checkFlags() {
i... | Fix variable name and check that required flags are set. | Fix variable name and check that required flags are set.
| Go | apache-2.0 | DataDog/kvexpress,DataDog/kvexpress,DataDog/kvexpress |
5d1d8f7b1f24f01f84747fd50437fece3da9b528 | measurements.go | measurements.go | package atlas
import (
"errors"
)
var (
allTypes = []string{
"dns",
"ntp",
"ping",
"sslcert",
"traceroute",
"wifi",
}
)
var ErrInvalidMeasurementType = errors.New("invalid measurement type")
// checkType verify that the type is valid
func checkType(d Definition) (valid bool) {
valid = false
for _, ... | package atlas
import (
"errors"
)
var (
allTypes = []string{
"dns",
"ntp",
"ping",
"sslcert",
"traceroute",
"wifi",
}
)
var ErrInvalidMeasurementType = errors.New("invalid measurement type")
// checkType verify that the type is valid
func checkType(d Definition) (valid bool) {
valid = false
for _, ... | Add checkTypeAs() to simplify the code/tests. | Add checkTypeAs() to simplify the code/tests.
| Go | mit | keltia/ripe-atlas |
69591395ac9086fdcd2ee756fd24e49ca897c90c | index/manager.go | index/manager.go | package index
import (
"context"
)
// Exister allows to check for existence of the index.
type Exister interface {
Exists(ctx context.Context) (bool, error)
}
// Creator allows to create the index.
type Creator interface {
Create(ctx context.Context) error
}
// ConfigUpdater represents an index with configuratio... | package index
import (
"context"
)
// Exister allows to check for existence of the index.
type Exister interface {
Exists(ctx context.Context) (bool, error)
}
// Creator allows to create the index.
type Creator interface {
Create(ctx context.Context) error
}
// ConfigUpdater represents an index with configuratio... | Add TODO for future refactor. | Add TODO for future refactor. | Go | agpl-3.0 | ipfs-search/ipfs-search,dokterbob/ipfs-search,ipfs-search/ipfs-search,dokterbob/ipfs-search,dokterbob/ipfs-search |
a1dda6f30fd68ef79c2307187b16e1ec6133bbaa | main_test.go | main_test.go | package reception
import (
"testing"
"github.com/aphistic/sweet"
"github.com/aphistic/sweet-junit"
. "github.com/onsi/gomega"
)
func TestMain(m *testing.M) {
RegisterFailHandler(sweet.GomegaFail)
sweet.Run(m, func(s *sweet.S) {
s.RegisterPlugin(junit.NewPlugin())
s.AddSuite(&ZkSuite{})
})
}
| package reception
import (
"testing"
"github.com/aphistic/sweet"
"github.com/aphistic/sweet-junit"
. "github.com/onsi/gomega"
)
func TestMain(m *testing.M) {
RegisterFailHandler(sweet.GomegaFail)
sweet.Run(m, func(s *sweet.S) {
s.RegisterPlugin(junit.NewPlugin())
s.AddSuite(&ElectionSuite{})
s.AddSuite... | Add election suite to test runner. | Add election suite to test runner.
| Go | mit | efritz/reception |
e3c7cc28a2a7789a088c7d1521718f6beeb6c1ee | pkg/view/ref.go | pkg/view/ref.go | package view
import (
"bytes"
"crypto/sha1"
"fmt"
"log"
"sort"
)
type ViewRef struct {
Digest [sha1.Size]byte
}
func ViewToViewRef(v *View) ViewRef {
var updates byUpdate
updates = v.GetUpdates()
// sort it to make it a canonical view
sort.Sort(updates)
buf := new(bytes.Buffer)
for _, loopUpdate := ran... | package view
import (
"bytes"
"crypto/sha1"
"fmt"
"sort"
)
type ViewRef struct {
Digest [sha1.Size]byte
}
func ViewToViewRef(v *View) ViewRef {
var updates byUpdate
updates = v.GetUpdates()
// sort it to make it a canonical view
sort.Sort(updates)
buf := new(bytes.Buffer)
for _, loopUpdate := range upda... | Fix last commit, remove unused package | Fix last commit, remove unused package
| Go | mit | mateusbraga/freestore,mateusbraga/freestore,mateusbraga/freestore,mateusbraga/freestore |
1c51d2dbcc1e7bf72b554e4eaf5e5d54e5183fb1 | orm/operation.go | orm/operation.go | package orm
import (
"gnd.la/orm/operation"
"gnd.la/orm/query"
)
func (o *Orm) Operate(q query.Q, table *Table, op *operation.Operation) (Result, error) {
return o.conn.Operate(table.model, q, op)
}
func (o *Orm) MustOperate(q query.Q, table *Table, op *operation.Operation) Result {
res, err := o.Operate(q, tabl... | package orm
import (
"gnd.la/orm/operation"
"gnd.la/orm/query"
)
func (o *Orm) Operate(table *Table, q query.Q, op *operation.Operation) (Result, error) {
return o.conn.Operate(table.model, q, op)
}
func (o *Orm) MustOperate(table *Table, q query.Q, op *operation.Operation) Result {
res, err := o.Operate(table, ... | Make the *Table the 1st argument to Operate() | Make the *Table the 1st argument to Operate()
This way it looks closer to an UPDATE table...
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
7ad45c1a8d507d204c9af6217ad2088ba48df010 | src/github.com/stellar/go-horizon/db/record_effect.go | src/github.com/stellar/go-horizon/db/record_effect.go | package db
import (
"database/sql"
"encoding/json"
"fmt"
sq "github.com/lann/squirrel"
)
var EffectRecordSelect sq.SelectBuilder = sq.
Select("heff.*").
From("history_effects heff")
type EffectRecord struct {
HistoryRecord
HistoryAccountID int64 `db:"history_account_id"`
HistoryOperationID int64 ... | package db
import (
"database/sql"
"encoding/json"
"fmt"
sq "github.com/lann/squirrel"
)
var EffectRecordSelect sq.SelectBuilder = sq.
Select("heff.*").
From("history_effects heff")
type EffectRecord struct {
HistoryAccountID int64 `db:"history_account_id"`
HistoryOperationID int64 `db:"h... | Add paging token to EffectRecord | Add paging token to EffectRecord
| Go | apache-2.0 | lackac/horizon,masonforest/horizon,masonforest/horizon,masonforest/go-horizon,stellar/horizon,nullstyle/go-horizon,lackac/horizon,masonforest/go-horizon,masonforest/go-horizon,irisli/horizon,masonforest/horizon,stellar/horizon,lackac/horizon,nullstyle/go-horizon,irisli/horizon,stellar/horizon,irisli/horizon,nullstyle/g... |
ea8f7ea8b760f9a7e7c8f2f0212e234d77da3a64 | internal/ingress/controller/template/buffer_pool.go | internal/ingress/controller/template/buffer_pool.go | /*
Copyright 2017 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 2017 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, ... | Simplify initialization function of bytes.Buffer | Simplify initialization function of bytes.Buffer
| Go | apache-2.0 | canhnt/ingress,aledbf/ingress-nginx,aledbf/ingress-nginx,kubernetes/ingress-nginx,caicloud/ingress,kubernetes/ingress-nginx,caicloud/ingress,kubernetes/ingress-nginx,kubernetes/ingress-nginx,canhnt/ingress,aledbf/ingress-nginx,aledbf/ingress-nginx,canhnt/ingress,caicloud/ingress,canhnt/ingress,kubernetes/ingress-nginx,... |
7def621e65be42b0269547de2c62c7b2ebcb84e4 | spec/spec.go | spec/spec.go | package spec
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"github.com/rightlag/go-swagger-object-model"
)
func LoadSchema(u *url.URL) (*models.Schema, error) {
var schema models.Schema
response, err := http.Get(u.String())
if err != nil {
return nil, err
}
defer response.Body.Close()
specif... | package spec
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"github.com/rightlag/go-swagger-object-model"
)
func LoadSchema(u *url.URL) (*models.Schema, error) {
response, err := http.Get(u.String())
if err != nil {
return nil, err
}
defer response.Body.Close()
specification, err := ioutil.Rea... | Move nil schema declaration to L22 | Move nil schema declaration to L22
No sense in creating nil declaration of Schema object prior to reading
the response body of the HTTP request.
| Go | mit | slate-io/slate |
829082aa06ebd5a84f183b0205fd4b7cf1c6c3f7 | srv_linux.go | srv_linux.go | // mad - mock ad server
// (C) copyright 2015 - J.W. Janssen
package main
import (
"net"
"fmt"
"github.com/coreos/go-systemd/activation"
"github.com/coreos/go-systemd/journal"
)
type JournaldLogger struct {
}
func (l *JournaldLogger) Log(msg string, args ...interface{}) {
if journal.Enabled() {
journal.... | // mad - mock ad server
// (C) copyright 2015 - J.W. Janssen
package main
import (
"fmt"
"net"
"github.com/coreos/go-systemd/activation"
"github.com/coreos/go-systemd/journal"
)
type JournaldLogger struct {
}
func (l *JournaldLogger) Log(msg string, args ...interface{}) {
if journal.Enabled() {
journal.Pri... | Improve error message a bit. | Improve error message a bit.
| Go | apache-2.0 | jawi/mad |
1d1fd2d9ce6cca62f9904035ab7cfa56b76c08ef | writer.go | writer.go | package logrus
import (
"bufio"
"io"
"runtime"
)
func (logger *Logger) Writer() *io.PipeWriter {
reader, writer := io.Pipe()
go logger.writerScanner(reader)
runtime.SetFinalizer(writer, writerFinalizer)
return writer
}
func (logger *Logger) writerScanner(reader *io.PipeReader) {
scanner := bufio.NewScanner... | package logrus
import (
"bufio"
"io"
"runtime"
)
func (logger *Logger) Writer() *io.PipeWriter {
return logger.WriterLevel(255)
}
func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
reader, writer := io.Pipe()
var printFunc func(args ...interface{})
switch level {
case DebugLevel:
printFunc = ... | Add WriterLevel() function to the logger | Add WriterLevel() function to the logger
This commit adds a variant of the logger's Writer() function that
accepts a log level. When the variant is used, any messages written to
the returned pipe will be written with the provided level. The original
Writer() function uses the logger's Print() method as it always has.
| Go | mit | penhauer-xiao/logrus,devopstaku/logrus,Sirupsen/logrus,sirupsen/logrus,penhauer-xiao/logrus,sirupsen/logrus,yxd-hde/logrus,akutz/logrus,axiomzen/logrus,freeformz/logrus |
52f4743aba95c0939ccc134534e4a968b05610f9 | network/netns.go | network/netns.go | // +build linux
package network
import (
"fmt"
"os"
"syscall"
"github.com/docker/libcontainer/system"
)
// crosbymichael: could make a network strategy that instead of returning veth pair names it returns a pid to an existing network namespace
type NetNS struct {
}
func (v *NetNS) Create(n *Network, nspid int... | // +build linux
package network
import (
"fmt"
"os"
"syscall"
"github.com/docker/libcontainer/system"
)
// crosbymichael: could make a network strategy that instead of returning veth pair names it returns a pid to an existing network namespace
type NetNS struct {
}
func (v *NetNS) Create(n *Network, nspid int... | Fix leaking file descriptor in NetNs strategy | Fix leaking file descriptor in NetNs strategy
Docker-DCO-1.1-Signed-off-by: Hugo Duncan <hugo@hugoduncan.org> (github: hugoduncan)
| Go | apache-2.0 | dqminh/libcontainer,keloyang/runc,fabiokung/runc,avagin/libcontainer,dieface/runc,shakamunyi/libcontainer,estesp/libcontainer,ddnbgroup/runc,estesp/libcontainer,thaJeztah/libcontainer,YujiOshima/runc,xiaochenshen/runc,calavera/runc,SaiedKazemi/libcontainer-criu,stefanberger/runc,mrunalp/runc,cxxly/runc,meihuabo/runc,w4... |
45b4ab6baeaf74bb0004d99090955841135e4ff4 | cmd/ami-publisher/launchInstances.go | cmd/ami-publisher/launchInstances.go | package main
import (
"fmt"
"github.com/Symantec/Dominator/imagepublishers/amipublisher"
"github.com/Symantec/Dominator/lib/awsutil"
"github.com/Symantec/Dominator/lib/log"
"os"
"path"
)
func launchInstancesSubcommand(args []string, logger log.Logger) {
domImage := ""
if len(args) > 1 {
domImage = args[1]
... | package main
import (
"fmt"
"github.com/Symantec/Dominator/imagepublishers/amipublisher"
"github.com/Symantec/Dominator/lib/awsutil"
"github.com/Symantec/Dominator/lib/log"
"os"
"path"
)
func launchInstancesSubcommand(args []string, logger log.Logger) {
domImage := ""
if len(args) > 1 {
domImage = args[1]
... | Fix bug in launch-instances subcommand of ami-publisher. | Fix bug in launch-instances subcommand of ami-publisher.
| Go | apache-2.0 | rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,Symantec/Dominator,rgooch/Dominator,keep94/Dominator,Symantec/Dominator |
b99f21ab009fcc03f072921a11daf77e38a20be8 | dbr.go | dbr.go | package main
import (
"fmt"
"dbr"
) | package dbr
import (
"fmt"
)
type EventReceiver interface {
Event(eventName string)
EventKv(eventName string, kvs map[string]string)
}
type TimingReceiver interface {
Timing(eventName string, nanoseconds int64)
TimingKv(eventName string, nanoseconds int64, kvs map[string]string)
}
func DoSomething(s EventRecei... | Fix k/v cascade. Make interfaces so that other libraries can loosely depend on health without an explicit dependency. | Fix k/v cascade. Make interfaces so that other libraries can loosely depend on health without an explicit dependency.
| Go | mit | orian/dbr,demdxx/dbr,playerbase/dbr,iyee/dbr,mailru/dbr,joe-roth/dbr,mibk/ql,postfix/dbr,kevpie/dbr,antony360/dbr,gocraft/dbr |
cd654378f3a8d1960872bc6a05a32111c65703c5 | notification.go | notification.go | package apns2
import "time"
const (
PriorityLow = 5
PriorityHigh = 10
)
type Notification struct {
ApnsID string
DeviceToken string
Topic string
Expiration time.Time
Priority int
Payload []byte
}
| package apns2
import "time"
const (
// PriorityLow will tell APNs to send the push message at a time that takes
// into account power considerations for the device. Notifications with this
// priority might be grouped and delivered in bursts. They are throttled, and
// in some cases are not delivered.
PriorityLo... | Add documentation for a Notification | Add documentation for a Notification
| Go | mit | sideshow/apns2 |
d993961621605886d0bf8f79e5a31a7221171c16 | vips/util.go | vips/util.go | package vips
/*
#cgo pkg-config: vips
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/vips7compat.h>
*/
import "C"
import (
"errors"
)
// btoi converts from Go boolean to int with value 0 or 1.
func btoi(b bool) int {
if b {
return 1
}
return 0
}
// vipsError converts from vips to Go errors.
func v... | package vips
/*
#cgo pkg-config: vips
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/vips7compat.h>
*/
import "C"
import (
"errors"
)
var (
ErrImageOp = errors.New("Image operation error")
)
// btoi converts from Go boolean to int with value 0 or 1.
func btoi(b bool) int {
if b {
return 1
}
retur... | Document limitations of vips error reporting. | Document limitations of vips error reporting.
| Go | apache-2.0 | die-net/fotomat,kitwalker12/fotomat,kitwalker12/fotomat,kitwalker12/fotomat,die-net/fotomat,kitwalker12/fotomat,die-net/fotomat |
75f140ca8122baddb45049f79a9b79887b103be8 | run.go | run.go | package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
type Commands map[string]string
func getCommands() (Commands, error) {
var commands Commands
jsonStream, err := ioutil.ReadFile("./commands.json")
if err != nil {
return command... | package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
type Commands map[string]string
func getCommands() (Commands, error) {
var commands Commands
jsonStream, err := ioutil.ReadFile("./commands.json")
if err != nil {
return command... | Use more go-like error messages | Use more go-like error messages
| Go | mit | nicolasmccurdy/run |
b30751191d32097552e73d56402dd0506b5e61be | bigbase/bigmandelbrot_test.go | bigbase/bigmandelbrot_test.go | package bigbase
import (
"testing"
)
func TestBigMandelbrotSanity(t *testing.T) {
origin := BigComplex{MakeBigFloat(0.0, testPrec), MakeBigFloat(0.0, testPrec)}
non := BigComplex{MakeBigFloat(2.0, testPrec), MakeBigFloat(4, testPrec)}
sqrtDL := MakeBigFloat(2.0, testPrec)
const iterateLimit uint8 = 255
originM... | package bigbase
import (
"testing"
)
func TestBigMandelbrotSanity(t *testing.T) {
origin := BigComplex{MakeBigFloat(0.0, testPrec), MakeBigFloat(0.0, testPrec)}
non := BigComplex{MakeBigFloat(2.0, testPrec), MakeBigFloat(4, testPrec)}
sqrtDL := MakeBigFloat(2.0, testPrec)
const iterateLimit uint8 = 255
originM... | Fix failing unit tests for bigbase | Fix failing unit tests for bigbase
| Go | mit | johnny-morrice/godelbrot |
f51cf9e706c2e834d9fd032655732a4102958a3c | src/euler/go_euler/go_euler.go | src/euler/go_euler/go_euler.go | package go_euler
func Factor(n int) chan int {
c := make(chan int)
go factor(n, c)
return c
}
func factor(n int, c chan int) {
for i := 2; i <= n; i++ {
if n%i == 0 {
n /= i
c <- i
i = 1 // Repeat loop from beginning.
}
}
close(c)
}
func Fibonacci() chan int {
c := make(chan int)
go fibonacci(c)... | package go_euler
import (
"fmt"
"github.com/onsi/ginkgo"
)
func Debug(f string, args ...interface{}) {
fmt.Fprintf(ginkgo.GinkgoWriter, f+"\n", args...)
}
func Factor(n int) chan int {
c := make(chan int)
go factor(n, c)
return c
}
func factor(n int, c chan int) {
for i := 2; i <= n; i++ {
if n%i == 0 {
... | Add Debug() method for printing to GinkgoWriter. | Add Debug() method for printing to GinkgoWriter.
| Go | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge |
5f480bd2f22ef537d6c218038fd380b36db5446f | buildfs/buildfs.go | buildfs/buildfs.go | // Package buildfs allows plugging a VFS into a go/build.Context.
package buildfs
import (
"go/build"
"io"
"path"
"path/filepath"
"strings"
"vfs"
)
const (
separator = "/"
)
// Setup configures a *build.Context to use the given VFS
// as its filesystem.
func Setup(ctx *build.Context, fs vfs.VFS) {
ctx.JoinPa... | // Package buildfs allows plugging a VFS into a go/build.Context.
package buildfs
import (
"go/build"
"io"
"path"
"path/filepath"
"strings"
"github.com/rainycape/vfs"
)
const (
separator = "/"
)
// Setup configures a *build.Context to use the given VFS
// as its filesystem.
func Setup(ctx *build.Context, fs ... | Update import path for vfs package | Update import path for vfs package
It's now hosted at GitHub
| Go | mpl-2.0 | rainycape/vfs,rainycape/vfs |
06c1eb1e90e7a790543d9b4f4e026135c4695617 | pkg/api/customization/nodetemplate/formatter.go | pkg/api/customization/nodetemplate/formatter.go | package nodetemplate
import (
"github.com/rancher/norman/types"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/labels"
)
type Formatter struct {
NodePoolLister v3.NodePoolLister
}
func (ntf *Formatter) Formatter(request *types.APIContext, resource *... | package nodetemplate
import (
"strings"
"github.com/rancher/norman/httperror"
"github.com/rancher/norman/types"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/labels"
)
type Formatter struct {
NodePoolLister v3.NodePoolLister
}
func (ntf *Formatt... | Clear nodetemplate for user if their ID doesn't match the namespace | Clear nodetemplate for user if their ID doesn't match the namespace
Because Watch doesn't use the queryOpts to filter as expected, and because we cheat on nodetemplates by just giving everyone list access, any watcher will receive ALL new nodetemplates, instead of just those for that user. This hack uses the formatter... | Go | apache-2.0 | rancher/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher |
44de547317ecb78e4176631c7726f14082db7c48 | service/init.go | service/init.go | package service
import (
"github.com/coreos/go-etcd/etcd"
"log"
"os"
)
var (
logger *log.Logger
client *etcd.Client
hostname string
)
func init() {
host := "http://localhost:4001"
if len(os.Getenv("ETCD_HOST")) != 0 {
host = os.Getenv("ETCD_HOST")
}
client = etcd.NewClient([]string{host})
if len(os... | package service
import (
"io/ioutils"
"log"
"os"
"github.com/coreos/go-etcd/etcd"
)
var (
logger *log.Logger
client *etcd.Client
hostname string
cacert = os.Getenv("ETCD_CACERT")
tlskey = os.Getenv("ETCD_TLS_KEY")
tlscert = os.Getenv("ETCD_TLS_CERT")
)
func init() {
host := "http://localhost:4001"... | Create TLS authentication if variables from environment are set | Create TLS authentication if variables from environment are set
| Go | apache-2.0 | Scalingo/etcd-discovery |
f9cc36e6fa38e862a408fb7b595bfbdd148e5279 | util/log_util.go | util/log_util.go | // Copyright 2017 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a... | // Copyright 2017 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a... | Fix the bug in model log printing. | Fix the bug in model log printing.
| Go | apache-2.0 | faceless-saint/casbin,hsluoyz/casbin,casbin/casbin |
f2495c45cd095ec69836bd6a4ca2841588050b75 | core/components/handler/handler_test.go | core/components/handler/handler_test.go | // Copyright © 2015 The Things Network
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
package handler
import (
"testing"
// . "github.com/TheThingsNetwork/ttn/utils/testing"
)
func TestRegister(t *testing.T) {
}
func TestHandleDown(t *testing.T) {
}
func TestHan... | // Copyright © 2015 The Things Network
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
package handler
| Remove unecessary lines to make travis build | [test-handler] Remove unecessary lines to make travis build
| Go | mit | jvanmalder/ttn,LoRaWanSoFa/ttn,TheThingsNetwork/ttn,mgranberry/ttn,jvanmalder/ttn,TheThingsNetwork/ttn,mgranberry/ttn,TheThingsNetwork/ttn,mgranberry/ttn,jvanmalder/ttn,LoRaWanSoFa/ttn |
67eacb8ddaca0e9b04f5d11d83fcdfeed08825c7 | webhook/client_handler_test.go | webhook/client_handler_test.go | package webhook_test
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/stripe/stripe-go/webhook"
)
func Example() {
http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}... | package webhook_test
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/stripe/stripe-go/webhook"
)
func Example() {
http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
// Protects against a malicious client streaming us an endless requst
// body
const MaxBodyBytes = int64(6... | Update webhook handler example to use `http.MaxBytesReader` | Update webhook handler example to use `http.MaxBytesReader`
Updates the webhook handler example to use `http.MaxBytesReader` to
protect against a malicious client streaming an endless request body.
We're making a similar change in our server side documentation examples,
so I'm updating this spot as well for consisten... | Go | mit | stripe/stripe-go,ChannelMeter/stripe-go,ChannelMeter/stripe-go,stripe/stripe-go |
82573bb49c3a80fa55616f0d3b0fee563b0cef17 | src/iotrules/engine/notifcb.go | src/iotrules/engine/notifcb.go | package engine
import (
"encoding/json"
"iotrules/mylog"
)
type NotifyContextRequest struct {
SubscriptionId string
Originator string
ContextResponses []struct{ ContextElement ContextElement }
}
type ContextElement struct {
Id string
IsPattern string
Type string
Attributes []Attribute
... | package engine
import (
"encoding/json"
"time"
"code.google.com/p/go-uuid/uuid"
"iotrules/mylog"
)
type NotifyContextRequest struct {
SubscriptionId string
Originator string
ContextResponses []struct{ ContextElement ContextElement }
}
type ContextElement struct {
Id string
IsPattern string... | Add ID and timestamp for notifs from CB | Add ID and timestamp for notifs from CB
| Go | agpl-3.0 | crbrox/iotrules,crbrox/iotrules |
48983e46f721c439e2106eeb78578e7f2b4c4f6a | golang-jsonstructure/errors.go | golang-jsonstructure/errors.go | package jsonstructure
import (
"fmt"
"strings"
)
type SchemaError struct {
Scope []string
Err error
}
type EnumError struct {
SchemaError
}
func (e *SchemaError) Error() string {
return fmt.Sprintf("At /%s: %s", strings.Join(e.Scope, "/"), e.Err.Error())
}
func (e *EnumError) Error() string {
return fmt.S... | package jsonstructure
import (
"fmt"
"strings"
)
type SchemaError struct {
Scope string
Err error
}
type EnumError struct {
SchemaError
}
func (e *SchemaError) Error() string {
return fmt.Sprintf("At %s: %s", e.Scope, e.Err.Error())
}
func (e *EnumError) Error() string {
return fmt.Sprintf("At %s: %s", e.... | Convert scope from []string to formatting string when error is generated. | Convert scope from []string to formatting string when error is generated.
| Go | apache-2.0 | json-structure/json-structure,json-structure/json-structure |
6b1ea0dabd50c9f183059688e90911baf53f54f1 | dbLock.go | dbLock.go | package mig
import (
"errors"
"sync"
"time"
)
var mutex = sync.Mutex{}
var ErrDatabaseLockTimout = errors.New("mig.WithDatabaseLock timed out")
func WithDatabaseLock(db DB, timeout time.Duration, callback func() error) error {
start := time.Now()
_, _ = db.Exec(`
CREATE TABLE MIG_DATABASE_LOCK (
lock_row ... | package mig
import (
"errors"
"log"
"sync"
"time"
)
var mutex = sync.Mutex{}
var ErrDatabaseLockTimout = errors.New("mig.WithDatabaseLock timed out")
func WithDatabaseLock(db DB, timeout time.Duration, callback func() error) error {
start := time.Now()
_, _ = db.Exec(`
CREATE TABLE MIG_DATABASE_LOCK (
lo... | Add some verbosity when there are lock errors | Add some verbosity when there are lock errors
| Go | mit | jargv/mig |
c2dfa2c19663904fd331b4b61b79f3d66048c44b | examples/cluster.go | examples/cluster.go | package main
import (
"log"
"github.com/citadel/citadel"
"github.com/citadel/citadel/cluster"
"github.com/citadel/citadel/scheduler"
)
func main() {
engines := []*citadel.Engine{}
c, err := cluster.New(scheduler.NewResourceManager(), engines...)
if err != nil {
log.Fatal(err)
}
defer c.Close()
image :=... | package main
import (
"log"
"github.com/citadel/citadel"
"github.com/citadel/citadel/cluster"
"github.com/citadel/citadel/scheduler"
)
func main() {
boot2docker := &citadel.Engine{
ID: "boot2docker",
Addr: "http://192.168.56.101:2375",
Memory: 2048,
Cpus: 4,
Labels: []string{"local"},
}
if ... | Use a local b2d instance in example | Use a local b2d instance in example
| Go | mit | liebo/citadel |
0a45d48bf2e3ec9041f3f4b7050b3e79eff9df8b | integration_tests/pkg/cassandra/connector_test.go | integration_tests/pkg/cassandra/connector_test.go | package cassandra
import (
"github.com/Sirupsen/logrus"
"github.com/intelsdi-x/swan/pkg/cassandra"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestCassandraConnection(t *testing.T) {
logrus.SetLevel(logrus.ErrorLevel)
Convey("While creating Cassandra config with proper parameters", t, func() {... | package cassandra
import (
"github.com/Sirupsen/logrus"
"github.com/intelsdi-x/swan/pkg/cassandra"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestCassandraConnection(t *testing.T) {
logrus.SetLevel(logrus.ErrorLevel)
Convey("While creating Cassandra config with proper parameters", t, func() {... | Test error before config in connector test. | Test error before config in connector test.
| Go | apache-2.0 | intelsdi-x/swan,intelsdi-x/swan,intelsdi-x/swan |
631d4fd22f39d6ff2d2c4f1e98949999c45766fe | gnotifier_darwin.go | gnotifier_darwin.go | package gnotifier
import (
"github.com/deckarep/gosx-notifier"
)
func (n *notifier) Push() error {
err := n.IsValid()
if err != nil {
return err
}
notification := gosxnotifier.NewNotification(n.Config.Message)
notification.Title = n.Config.Title
err = notification.Push()
return err
}
| package gnotifier
import (
"github.com/deckarep/gosx-notifier"
)
func (n *notifier) Push() error {
err := n.IsValid()
if err != nil {
return err
}
notification := gosxnotifier.NewNotification(n.Config.Message)
notification.Title = n.Config.Title
notification.Sound = gosxnotifier.Default
err = notification... | Set a sound on MacOS X notification | Set a sound on MacOS X notification
| Go | mit | haklop/gnotifier |
a32d6416e5b58f22d245d630c47fe6fdd420b297 | common/buf/readv_constraint_windows.go | common/buf/readv_constraint_windows.go | // +build windows
package buf
import (
"syscall"
)
func checkReadVConstraint(conn syscall.RawConn) (bool, error) {
var isSocketReady = false
var reason error
/*
In Windows, WSARecv system call only support socket connection.
It it required to check if the given fd is of a socket type
Fix https://github... | // +build windows
package buf
import (
"syscall"
)
func checkReadVConstraint(conn syscall.RawConn) (bool, error) {
var isSocketReady = false
var reason error
/*
In Windows, WSARecv system call only support socket connection.
It it required to check if the given fd is of a socket type
Fix https://github.co... | Fix test break for windows: better error handling | Fix test break for windows: better error handling
| Go | mit | v2ray/v2ray-core,panzer13/v2ray-core,v2ray/v2ray-core,panzer13/v2ray-core |
b9bd3c2e3a7c5f8c31b6c75e52764823bf2cae8e | config/config.go | config/config.go | package config
import (
"bytes"
"github.com/eyecuelab/kit/assets"
"github.com/spf13/viper"
)
func Load(envPrefix string, configPath string) error {
viper.SetConfigType("yaml")
if len(configPath) > 0 {
viper.SetConfigFile(configPath)
if err := viper.ReadInConfig(); err != nil {
return err
}
} else {
... | package config
import (
"bytes"
"errors"
"fmt"
"github.com/eyecuelab/kit/assets"
"github.com/spf13/viper"
)
func Load(envPrefix string, configPath string) error {
viper.SetConfigType("yaml")
if len(configPath) > 0 {
viper.SetConfigFile(configPath)
if err := viper.ReadInConfig(); err != nil {
return er... | Validate required env vars existence | Validate required env vars existence | Go | apache-2.0 | eyecuelab/kit |
eb965e33fc2b14778611fb047d64411b0ea7bb7a | aws/s3/events.go | aws/s3/events.go | package spartaS3
// EventOwnerIdentity event data
type EventOwnerIdentity struct {
PrincpalID string `json:"principalId"`
}
// Bucket event data
type Bucket struct {
Name string `json:"name"`
Arn string `json:"arn"`
OwnerIdentity EventOwnerIdentity `json:"ownerIdentity"`... | // Sparta package to support AWS S3
package s3
// EventOwnerIdentity event data
type EventOwnerIdentity struct {
PrincpalID string `json:"principalId"`
}
// Bucket event data
type Bucket struct {
Name string `json:"name"`
Arn string `json:"arn"`
OwnerIdentity EventOwnerI... | Update to use s3 package namespace | Update to use s3 package namespace
| Go | mit | mweagle/Sparta,mweagle/Sparta,mweagle/Sparta,mweagle/Sparta |
55960d6e0bda20d4452a1b73c48d542f84661e2f | client/container_export_test.go | client/container_export_test.go | package client
import (
"net/http"
"testing"
"golang.org/x/net/context"
)
func TestContainerExportError(t *testing.T) {
client := &Client{
transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ContainerExport(context.Background(), "nothing")
if err == n... | package client
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"golang.org/x/net/context"
)
func TestContainerExportError(t *testing.T) {
client := &Client{
transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ContainerExport(conte... | Add a happy path test on ContainerExport | Add a happy path test on ContainerExport
Signed-off-by: Vincent Demeester <87e1f221a672a14a323e57bb65eaea19d3ed3804@sbr.pm>
| Go | apache-2.0 | jwhonce/engine-api,vdemeester/engine-api,thaJeztah/engine-api,docker/engine-api |
184253db5b698e2f8cb9439262fd5b8262deb0af | main.go | main.go | // go build -o gogrep
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
if len(os.Args) < 3 {
fatal(2, "Usage: %s <pattern> <file>\n", os.Args[0])
}
pat := os.Args[1]
file := os.Args[2]
err := printMatchingLines(pat, file)
if err != nil {
fatal(2, err.Error())
}
}
func fatal(exitVal... | // go build -o gogrep
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
if len(os.Args) < 3 {
fatal(2, "Usage: %s <pattern> <file>\n", os.Args[0])
}
pat := os.Args[1]
file := os.Args[2]
cnt, err := printMatchingLines(pat, file)
if err != nil {
fatal(2, err.Error())
}
if cnt > 0 {
... | Handle exit code properly based on match count | Handle exit code properly based on match count
Now exits with value of 0 if one or more lines match pattern
Otherwise exits with value of 1
| Go | mit | imattman/grep-using-go |
7f42be12da8429ad5cef835a043b35da7f548747 | main.go | main.go | package main // import "github.com/CenturyLinkLabs/imagelayers"
import (
"flag"
"fmt"
"log"
"net/http"
"github.com/CenturyLinkLabs/imagelayers/api"
"github.com/CenturyLinkLabs/imagelayers/server"
"github.com/gorilla/mux"
)
type layerServer struct {
}
func NewServer() *layerServer {
return new(layerServer)
}... | package main // import "github.com/CenturyLinkLabs/imagelayers"
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"github.com/CenturyLinkLabs/imagelayers/api"
"github.com/CenturyLinkLabs/imagelayers/server"
"github.com/gorilla/mux"
)
type layerServer struct {
}
func NewServer() *layerServer {
return new(layerSer... | Halt appropriately on server error start. | Halt appropriately on server error start.
Show the error and return a correct non-successful exit code.
| Go | apache-2.0 | BWITS/imagelayers,argvader/imagelayers,Acidburn0zzz/imagelayers,patocox/imagelayers,Acidburn0zzz/imagelayers,CenturyLinkLabs/imagelayers,BWITS/imagelayers,CenturyLinkLabs/imagelayers,patocox/imagelayers,rupakg/imagelayers,argvader/imagelayers,rupakg/imagelayers |
dcdd6089f648719bb0d52e051c9b2b41938a06d9 | client/publish.go | client/publish.go | package main
import (
"log"
"github.com/streadway/amqp"
)
func rabbitStart() (ch *amqp.Channel, close func(), err error) {
conn, err := amqp.Dial("amqp://guest:guest@amqp.stardew.rocks:5672/")
log.Fatalf("Failed to connect to AMQP server: %v", err)
if ch, err = conn.Channel(); err != nil {
return nil, nil, e... | package main
import (
"log"
"github.com/streadway/amqp"
)
func rabbitStart() (ch *amqp.Channel, close func(), err error) {
conn, err := amqp.Dial("amqp://guest:guest@amqp.stardew.rocks:5672/")
if err != nil {
log.Fatalf("Failed to connect to AMQP server: %v", err)
}
if ch, err = conn.Channel(); err != nil {... | Fix bug added added because of cleanup of rabbitMQ examples | Fix bug added added because of cleanup of rabbitMQ examples
| Go | apache-2.0 | nictuku/stardew-rocks,nictuku/stardew-rocks,nictuku/stardew-rocks,nictuku/stardew-rocks |
18dc805104d86b0e78eb6317c1cef6167501e662 | 2022/go-static-http-server/server-static-and-dynamic.go | 2022/go-static-http-server/server-static-and-dynamic.go | package main
import (
"fmt"
"net/http"
"time"
)
func timeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, time.Now().Format("02 Jan 2006 15:04:05 MST"))
}
func main() {
port := ":9999"
fileHandler := http.StripPrefix("/static/", http.FileServer(http.Dir("files")))
http.Handle("/static/", fileH... | package main
import (
"fmt"
"net/http"
"time"
)
func timeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, time.Now().Format("02 Jan 2006 15:04:05 MST")+"\n")
}
func main() {
port := ":9999"
fileHandler := http.StripPrefix("/static/", http.FileServer(http.Dir("files")))
http.Handle("/static/", ... | Add newline at the end of serving time | Add newline at the end of serving time
| Go | unlicense | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog |
70e03fc997049a38107efdb9ab51e8e38fc80323 | lib/net/util/getMyIP.go | lib/net/util/getMyIP.go | package util
import (
"errors"
"net"
)
func getMyIP() (net.IP, error) {
var myIP net.IP
mostOnesInMask := 0
interfaces, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, iface := range interfaces {
if iface.Flags&net.FlagUp == 0 {
continue
}
if iface.Flags&net.FlagBroadcast == 0 {
... | package util
import (
"errors"
"net"
"os"
"path/filepath"
)
const procNetVlan = "/proc/net/vlan"
func getMyIP() (net.IP, error) {
var myIP net.IP
mostOnesInMask := 0
interfaces, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, iface := range interfaces {
if iface.Flags&net.FlagUp == 0 {... | Exclude interfaces bound to a VLAN in lib/net/GetMyIP(). | Exclude interfaces bound to a VLAN in lib/net/GetMyIP().
| Go | apache-2.0 | rgooch/Dominator,Symantec/Dominator,Symantec/Dominator,Symantec/Dominator,rgooch/Dominator,rgooch/Dominator |
bf8e9b3bb14647482313a3dab5f8a56e8e99dc1e | cync/sema_test.go | cync/sema_test.go | package cync
import (
"sync"
"testing"
"github.com/thatguystone/cog/check"
)
func TestSemaphore(t *testing.T) {
c := check.New(t)
s := NewSemaphore(2)
for i := 0; i < s.count; i++ {
s.Lock()
}
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
s.Lock()
wg.Done()
}()
go func() {
for i := 0; i < s.cou... | package cync
import (
"sync"
"testing"
"github.com/thatguystone/cog/check"
)
func TestSemaphore(t *testing.T) {
c := check.New(t)
s := NewSemaphore(2)
for i := 0; i < s.count; i++ {
s.Lock()
}
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
s.Lock()
wg.Done()
}()
go func() {
for i := 0; i < s.cou... | Fix race condition in cync.Sema test | Fix race condition in cync.Sema test
| Go | mit | thatguystone/assert,thatguystone/assert,thatguystone/assert,thatguystone/cog |
24ddd3d6c1481d4b6d82dade0a19b37d29b1474e | client/internal/common/types.go | client/internal/common/types.go | // Copyright 2015 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package common
import (
"github.com/kr/pretty"
)
// Strings accumulates string values from repeated flags.
//
// Use with flag.Var to accumu... | // Copyright 2015 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package common
import (
"fmt"
)
// Strings accumulates string values from repeated flags.
//
// Use with flag.Var to accumulate values from ... | Remove some dependency on pretty package. | Remove some dependency on pretty package.
The pretty package (https://godoc.org/github.com/kr/pretty) provides
pretty-printing capability. In this instance, however, the package was
not actually doing anything above and beyond the base fmt package, so it
can be removed. Since this is common code in client, it simplifi... | Go | apache-2.0 | luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go |
0135b94473fe6ed4722829ef5d5842f56bf3ea7f | id3v2.go | id3v2.go | package id3v2
import (
"bytes"
"github.com/bogem/id3v2/frame"
"os"
"sync"
)
var bytesBufPool = sync.Pool{
New: func() interface{} { return new(bytes.Buffer) },
}
func Open(name string) (*Tag, error) {
file, err := os.OpenFile(name, os.O_RDWR, 0666)
if err != nil {
return nil, err
}
return ParseTag(file)
... | package id3v2
import (
"bytes"
"github.com/bogem/id3v2/frame"
"os"
"sync"
)
var bytesBufPool = sync.Pool{
New: func() interface{} { return new(bytes.Buffer) },
}
func Open(name string) (*Tag, error) {
file, err := os.Open(name)
if err != nil {
return nil, err
}
return ParseTag(file)
}
func NewAttachedPi... | Use os.Open func instead of os.OpenFile | Use os.Open func instead of os.OpenFile
| Go | mit | bogem/id3v2 |
2f6d4398d06f45c7da4ba9b0e7f7cd798b9a3125 | service/service_suite_test.go | service/service_suite_test.go | package service_test
import (
"encoding/json"
"os"
"testing"
"github.com/cloudfoundry-incubator/cf-test-helpers/services/context_setup"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
type redisTestConfig struct {
context_setup.IntegrationConfig
ServiceName string `json:"service_name"`
PlanNames... | package service_test
import (
"encoding/json"
"os"
"testing"
"github.com/cloudfoundry-incubator/cf-test-helpers/services/context_setup"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
type redisTestConfig struct {
context_setup.IntegrationConfig
ServiceName string `json:"service_name"`
PlanNames... | Increase timeout scale for context setup | Increase timeout scale for context setup
Signed-off-by: Stev Witzel <cecd026af8549620363e324a20eb355bb1518e8c@pivotal.io>
| Go | apache-2.0 | pivotal-cf/cf-redis-smoke-tests,pivotal-cf/cf-redis-smoke-tests |
e0c2c779adf652c65f796e16f33bc41c4c204c18 | src/binary/integration/deploy_a_binary_app_test.go | src/binary/integration/deploy_a_binary_app_test.go | package integration_test
import (
"path/filepath"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CF Binary Buildpack", func() {
var app *cutlass.App
AfterEach(func() {
if app != nil {
app.Destroy()
}
app = nil
})
Describe("d... | package integration_test
import (
"path/filepath"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
)
var _ = Describe("CF Binary Buildpack", func() {
var app *cutlass.App
AfterEach(func() {
if app != nil {
app.Destroy()
}
app = nil
})
Descr... | Set stack when deploying for integration tests | Set stack when deploying for integration tests
| Go | apache-2.0 | rakutentech/binary-buildpack,cloudfoundry/binary-buildpack,cloudfoundry/binary-buildpack,cloudfoundry/binary-buildpack,rakutentech/binary-buildpack,rakutentech/binary-buildpack |
68d16c936752d5c43f330b981bbd4b215654d13b | version/version.go | version/version.go | // package to return the program version
package version
const (
version = "0.2.0"
)
// return the current application version
func Version() string {
return version
}
| // package to return the program version
package version
const (
version = "0.2.1"
)
// return the current application version
func Version() string {
return version
}
| Configure setup_instruments (for the mutex page) if possible on startup, and restore when stopping | Configure setup_instruments (for the mutex page) if possible on startup, and restore when stopping
| Go | bsd-2-clause | sjmudd/ps-top,sjmudd/ps-top |
a944de4ab7acfdd114d11a2ca0d267110ba9c152 | modules/metrics/metrics_test.go | modules/metrics/metrics_test.go | package metrics
import (
"testing"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
)
func TestMetricsUnmarshalCaddyfile(t *testing.T) {
m := &Metrics{}
d := caddyfile.NewTestDispenser(`metrics bogus`)
err := m.UnmarshalCaddyfile(d)
if err == nil {
t.Errorf("expected error")
}
m = &Metrics{}
d = c... | package metrics
import (
"testing"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
)
func TestMetricsUnmarshalCaddyfile(t *testing.T) {
m := &Metrics{}
d := caddyfile.NewTestDispenser(`metrics bogus`)
err := m.UnmarshalCaddyfile(d)
if err == nil {
t.Errorf("expected error")
}
m = &Metrics{}
d = c... | Clean up metrics test code | Clean up metrics test code
No need to use != for booleans
| Go | apache-2.0 | l3dlp/caddy,l3dlp/caddy,l3dlp/caddy |
a13ef780694f22260e1b0bb5ef80b7aff4eb0b24 | test/bugs/bug113.go | test/bugs/bug113.go | // $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed)
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type I interface { };
func foo1(i int) int { return i }
func foo2(i int... | // $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed)
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type I interface { };
func foo1(i int) int { return i }
func foo2(i int... | Call the right function for int32 values. | Call the right function for int32 values.
R=rsc
DELTA=2 (0 added, 0 deleted, 2 changed)
OCL=18073
CL=18073
| Go | bsd-3-clause | scirelli/scirelli-go,sanjosh/sanjos100-tipc,Triskite/willstone-goclone,scirelli/scirelli-go,npe9/noahevans-go9,d0f/go-zh,npe9/noahevans-go9,glycerine/jeaten-go-arrayof-structof,d0f/go-zh,scirelli/scirelli-go,glycerine/jeaten-go-arrayof-structof,mhennings/marcohennings-go,mhennings/marcohennings-go,bryanxu/go-zh,webfd/g... |
241876eccb0a5dfe73e7c1ac6f7946f26d1266c0 | transform/yang/entry.go | transform/yang/entry.go | package yang
import "github.com/openconfig/goyang/pkg/yang"
type entry struct {
*yang.Entry
}
func (e entry) rpcs() []entry {
rpcs := []entry{}
for _, child := range e.Dir {
if child.RPC != nil {
rpcs = append(rpcs, entry{child})
}
}
return rpcs
}
func (e entry) notifications() []entry {
ns := []entry... | package yang
import (
"sort"
"github.com/openconfig/goyang/pkg/yang"
)
type entry struct {
*yang.Entry
}
func (e entry) rpcs() []entry {
var names []string
for name, child := range e.Dir {
if child.RPC != nil {
names = append(names, name)
}
}
sort.Strings(names)
rpcs := []entry{}
for _, name := ran... | Sort child entries by its name | Sort child entries by its name
| Go | apache-2.0 | oshothebig/pbast |
a7af3c13a520bc3a717bf54915701fcd42ef71eb | services/server/server_solaris.go | services/server/server_solaris.go | /*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | /*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Correct import path in services/server package | Correct import path in services/server package
Signed-off-by: Jared Cordasco <2fbbd21a27e096ec8755d7a88240d059ba06e6e6@coglib.com>
| Go | apache-2.0 | mikebrow/containerd,crosbymichael/containerd,vdemeester/containerd,vdemeester/containerd,dmcgowan/containerd,estesp/containerd,containerd/containerd,mikebrow/containerd,thaJeztah/containerd,containerd/containerd,crosbymichael/containerd,dmcgowan/containerd,estesp/containerd,thaJeztah/containerd |
efba26e793ff95a68c819be6e274f4b0c8632b89 | action/operator_keyring_list.go | action/operator_keyring_list.go | package action
import (
"flag"
)
type operatorKeyringList struct {
*config
}
func OperatorKeyringListAction() Action {
return &operatorKeyringList{
config: &gConfig,
}
}
func (o *operatorKeyringList) CommandFlags() *flag.FlagSet {
return newFlagSet()
}
func (o *operatorKeyringList) Run(args []string) error ... | package action
import (
"flag"
)
type operatorKeyringList struct {
*config
}
func OperatorKeyringListAction() Action {
return &operatorKeyringList{
config: &gConfig,
}
}
func (o *operatorKeyringList) CommandFlags() *flag.FlagSet {
f := newFlagSet()
o.addOutputFlags(f, false)
return f
}
func (o *operator... | Add template option to 'operator keyring list' | Add template option to 'operator keyring list'
| Go | apache-2.0 | mantl/consul-cli,mantl/consul-cli,CiscoCloud/consul-cli |
9149cf53879adbe6b8fe098e0efdecfd63cdd679 | api/scripts.go | api/scripts.go | package api
import "time"
type ScriptsRequest struct {
Args []string `json:"args,omitempty"`
Files map[string]string `json:"files,omitempty"`
CallbackURL string `json:"callback_url,omitempty"`
}
type ScriptsResponse struct {
ID string `json:"id"`
Script string ... | package api
import "time"
type ScriptsRequest struct {
Args []string `json:"args,omitempty"`
Files map[string]string `json:"files,omitempty"`
CallbackURL string `json:"callback_url,omitempty"`
}
type ScriptsResponse struct {
ID string `json:"id"`
Script ... | Add files to the ScriptResponse | Add files to the ScriptResponse
| Go | mit | pressly/qmd |
c7d330e20a1959579f5292cf14b0a8ce03184515 | sgload/gateload_spec.go | sgload/gateload_spec.go | package sgload
import "log"
type GateLoadSpec struct {
LoadSpec
WriteLoadSpec
ReadLoadSpec
UpdateLoadSpec
}
func (gls GateLoadSpec) Validate() error {
if err := gls.LoadSpec.Validate(); err != nil {
return err
}
if err := gls.ReadLoadSpec.Validate(); err != nil {
return err
}
if err := gls.WriteLoadS... | package sgload
import (
"fmt"
"log"
)
type GateLoadSpec struct {
LoadSpec
WriteLoadSpec
ReadLoadSpec
UpdateLoadSpec
}
func (gls GateLoadSpec) Validate() error {
if err := gls.LoadSpec.Validate(); err != nil {
return err
}
if err := gls.ReadLoadSpec.Validate(); err != nil {
return err
}
if err := gl... | Add spec validation to ensure as least as many writers as updaters | Add spec validation to ensure as least as many writers as updaters
| Go | apache-2.0 | couchbaselabs/sgload |
26b27fe12595b0a1ad14e2b5ce5a78f11bcbd44d | types.go | types.go | package main
type trigger struct {
Schedule string `json:"schedule"`
Type string `json:"type"`
}
type notify struct {
Payload string `json:"payload"`
}
type step struct {
Name string `json:"name"`
Payload string `json:"payload"`
}
type Plan struct {
Name string `json:"name"`
Trigger trigger `json:"trigger"`
... | package main
import (
"time"
)
type Run struct {
Id uint `json:"id"`
Status string `json:"status"`
Trigger string `json:"trigger"`
Start time.Time `json:"start"`
Duration time.Duration `json:"duration"`
}
type trigger struct {
Schedule string `json:"schedule"`
Type string `json:"type"`
}
type notify struct ... | Add initial struct for Run | Add initial struct for Run
| Go | bsd-2-clause | clee/channon,sboyettedh/channon |
9970ae85fb0cc5374233b223f04b025ecdd7f0be | apis/federation/annotations.go | apis/federation/annotations.go | /*
Copyright 2016 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 2017 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, ... | Fix the comments on FederationNameAnnotation | [Federation] Fix the comments on FederationNameAnnotation
| Go | apache-2.0 | kubernetes-retired/cluster-registry,kubernetes-retired/cluster-registry |
d83645b14ebff9caee145159fae77a1f277ca4cd | server_test.go | server_test.go | package imageserver
import (
"errors"
"testing"
)
type size struct {
width int
height int
}
type providerSize struct{}
func (provider *providerSize) Get(source interface{}, parameters Parameters) (*Image, error) {
size, ok := source.(size)
if !ok {
return nil, errors.New("Source is not a size")
}
return ... | package imageserver
import (
"errors"
"testing"
)
type size struct {
width int
height int
}
type providerSize struct{}
func (provider *providerSize) Get(source interface{}, parameters Parameters) (*Image, error) {
size, ok := source.(size)
if !ok {
return nil, errors.New("Source is not a size")
}
return ... | Add processor (copy) implementation for tests | Add processor (copy) implementation for tests
| Go | mit | pierrre/imageserver |
da3fe87949edfd9eac8e9fd24195188d5969206a | cmd/es-slowlog-parse/main.go | cmd/es-slowlog-parse/main.go | package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"github.com/coxx/es-slowlog/internal/parser"
)
func main() {
const defaultFormat = "{{.Source}}"
stderr := log.New(os.Stderr, "", 0)
flagUsage := flag.Bool("h", false, "Print usage")
flagFormat := flag.String("f", defaultFormat, "Format template")
flagA... | package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"github.com/coxx/es-slowlog/internal/parser"
)
func main() {
const defaultFormat = "{{.Source}}"
stderr := log.New(os.Stderr, "", 0)
flagUsage := flag.Bool("h", false, "Print usage")
flagFormat := flag.String("f", defaultFormat, "Format template")
flagA... | Address flag validation for tank format | Address flag validation for tank format
| Go | mit | coxx/es-slowlog |
4f27b0ec2e1d4a9dbf73dfba7fea4f45473652a2 | cmd/natsdumper/natsdumper.go | cmd/natsdumper/natsdumper.go | package main
import (
"encoding/json"
"flag"
"fmt"
nats "github.com/nats-io/go-nats"
"github.com/regner/albiondata-client/lib"
)
var natsURL string
func init() {
flag.StringVar(
&natsURL,
"i",
"nats://localhost:2222",
"NATS URL to subscribe to.",
)
}
func dumpMarketOrders(m *nats.Msg) {
morders := ... | package main
import (
"encoding/json"
"flag"
"fmt"
nats "github.com/nats-io/go-nats"
"github.com/regner/albiondata-client/lib"
)
var natsURL string
func init() {
flag.StringVar(
&natsURL,
"i",
"nats://ingest.albion-data.com:4222",
"NATS URL to subscribe to.",
)
}
func dumpMarketOrders(m *nats.Msg) {... | Update the default server for the nats dumper and subscribe to the ingest | Update the default server for the nats dumper and subscribe to the ingest
| Go | mit | oxisto/albiondata-client,Ultraporing/albiondata-client,oxisto/albiondata-client,Ultraporing/albiondata-client |
e2a82380cd99592cd1713230a94c4a143f50ffae | go/compound_statements_test.go | go/compound_statements_test.go | package main
import "fmt"
func Example() {
capitals := map[string]string{
"NSW": "Sydney",
"VIC":
"Melbourne",
"TAS": "Hobart",
"WA": "Perth",
"QLD": "Brisbane",
"SA": "Adelaide",
}
for _, state := range [2]string{"NSW", "AL"} {
if capital, known := capitals[state]; known {
fmt.Printf("The cap... | package main
import "fmt"
func Example() {
capitals := map[string]string{
"NSW": "Sydney",
"VIC": "Melbourne",
"TAS": "Hobart",
"WA": "Perth",
"QLD": "Brisbane",
"SA": "Adelaide",
}
for _, state := range [2]string{"NSW", "AL"} {
if capital, known := capitals[state]; known {
fmt.Printf("The capit... | Fix an odd formatting issue | Fix an odd formatting issue
| Go | mit | rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,... |
ed161fe9d683ad4dbda50514cc609f9a8189c288 | rules/url/url.go | rules/url/url.go | package url
import (
"fmt"
"net/url"
"strings"
"github.com/tonyhb/govalidate/helper"
"github.com/tonyhb/govalidate/rules"
)
func init() {
rules.Add("URL", URL)
}
// Validates a URL using url.Parse() in the net/url library.
// For a valid URL, the following need to be present in a parsed URL:
// * Scheme (eith... | package url
import (
"fmt"
"net/url"
"strings"
"github.com/tonyhb/govalidate/helper"
"github.com/tonyhb/govalidate/rules"
)
func init() {
rules.Add("URL", URL)
}
// Validates a URL using url.Parse() in the net/url library.
// For a valid URL, the following need to be present in a parsed URL:
// * Scheme (eith... | Fix error string in URL | Fix error string in URL
| Go | mit | tonyhb/govalidate |
b526ff68d4cb462dab0c335a8a2b968299a64e5a | integration/nfsshare.go | integration/nfsshare.go | package integration
import . "github.com/onsi/ginkgo"
func testNFSShare(aws infrastructureProvisioner, distro linuxDistro) {
nfsServers, err := aws.CreateNFSServers()
FailIfError(err, "Couldn't set up NFS shares")
WithMiniInfrastructure(distro, aws, func(node NodeDeets, sshKey string) {
By("Setting up a plan fi... | package integration
import . "github.com/onsi/ginkgo"
func testNFSShare(aws infrastructureProvisioner, distro linuxDistro) {
nfsServers, err := aws.CreateNFSServers()
FailIfError(err, "Couldn't set up NFS shares")
WithMiniInfrastructure(distro, aws, func(node NodeDeets, sshKey string) {
By("Setting up a plan fi... | Use the public IP for lb_fqdn in NFS test | Use the public IP for lb_fqdn in NFS test
The helm installation fails because the lb_fqdn is pointing to the
machine's hostname, which ends up in the kubeconfig that is used by helm
to initialize tiller. Given that this hostname is not resolvable from
the testing machine, the test fails.
| Go | apache-2.0 | apprenda/kismatic,apprenda/kismatic,apprenda/kismatic |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.