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 |
|---|---|---|---|---|---|---|---|---|---|
66b61effd6d3a06e38cdcd5f6f399cbd84d15076 | request.go | request.go | package Golf
import (
"net/http"
"strings"
)
// A wrapper of http.Request
type Request struct {
*http.Request
Params map[string]string
IP string
}
func NewRequest(req *http.Request) *Request {
request := new(Request)
request.Request = req
request.IP = strings.Split(req.RemoteAddr, ":")[0]
return request... | package Golf
import (
"errors"
"net/http"
"strings"
)
// A wrapper of http.Request
type Request struct {
*http.Request
Params map[string]string
IP string
}
func NewRequest(req *http.Request) *Request {
request := new(Request)
request.Request = req
request.IP = strings.Split(req.RemoteAddr, ":")[0]
retu... | Add Query and Protocol support | Add Query and Protocol support
| Go | mit | dinever/golf |
0c60437d74180b80064a5c20fcb011e8ce0ed900 | examples/05-many-obj/ploterror.go | examples/05-many-obj/ploterror.go | // Copyright 2012 Dorival de Moraes Pedroso. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "github.com/cpmech/gosl/plt"
func main() {
Nf := []float64{5, 7, 10, 13, 15, 20}
Eave := []float64{3.5998e-... | // Copyright 2012 Dorival de Moraes Pedroso. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "github.com/cpmech/gosl/plt"
func main() {
Nf := []float64{5, 7, 10, 13, 15, 20}
Eave := []float64{2.33e-12... | Fix code to plot multi-obj errors | Fix code to plot multi-obj errors
| Go | bsd-3-clause | cpmech/goga,cpmech/goga,cpmech/goga |
b1f78a296047401f7794bef4ac229c5f6174517f | cliedit/histwalk.go | cliedit/histwalk.go | package cliedit
import (
"github.com/elves/elvish/cli"
"github.com/elves/elvish/cli/addons/histwalk"
"github.com/elves/elvish/cli/histutil"
"github.com/elves/elvish/eval"
)
func initHistWalk(app *cli.App, ev *eval.Evaler, ns eval.Ns, fuser *histutil.Fuser) {
bindingVar := newBindingVar(emptyBindingMap)
binding ... | package cliedit
import (
"github.com/elves/elvish/cli"
"github.com/elves/elvish/cli/addons/histwalk"
"github.com/elves/elvish/cli/el"
"github.com/elves/elvish/cli/histutil"
"github.com/elves/elvish/eval"
)
func initHistWalk(app *cli.App, ev *eval.Evaler, ns eval.Ns, fuser *histutil.Fuser) {
bindingVar := newBin... | Rename the functions in history: to be backward compatible. | cliedit: Rename the functions in history: to be backward compatible.
| Go | bsd-2-clause | elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish |
b80a0bf8df618d352f966bc0898eb329eec18ff7 | example/large/main.go | example/large/main.go | package main
import (
"github.com/psmithuk/xlsx"
)
func main() {
c := []xlsx.Column{
xlsx.Column{Name: "Col1", Width: 10},
xlsx.Column{Name: "Col2", Width: 10},
}
sh := xlsx.NewSheetWithColumns(c)
for i := 0; i < 100000; i++ {
r := sh.NewRow()
r.Cells[0] = xlsx.Cell{
Type: xlsx.CellTypeNumber,
... | package main
import (
"github.com/sean-duffy/xlsx"
)
func main() {
c := []xlsx.Column{
xlsx.Column{Name: "Col1", Width: 10},
xlsx.Column{Name: "Col2", Width: 10},
}
sh := xlsx.NewSheetWithColumns(c)
for i := 0; i < 10; i++ {
r := sh.NewRow()
r.Cells[0] = xlsx.Cell{
Type: xlsx.CellTypeNumber,
... | Use fork of xlsx in large test | Use fork of xlsx in large test
| Go | mit | psmithuk/xlsx,scraperwiki/xlsx |
e18512e5485a0315a19ffa6d85ced07d0d0a782c | nsproxy/api_cluster_spec.go | nsproxy/api_cluster_spec.go | package main
import (
"fmt"
"net/http"
"strings"
"gopkg.in/redis.v3"
)
func apiClusterSpecHandler(w http.ResponseWriter, r *http.Request, redisClient *redis.Client) {
queryCluster := strings.TrimSpace(r.FormValue("cluster"))
hosts, err := redisClient.SInter("index:live").Result()
if err != nil {
w.WriteHead... | package main
import (
"fmt"
"net/http"
"strings"
"gopkg.in/redis.v3"
)
func apiClusterSpecHandler(w http.ResponseWriter, r *http.Request, redisClient *redis.Client) {
queryCluster := strings.TrimSpace(r.FormValue("cluster"))
hosts, err := redisClient.SInter("index:live").Result()
if err != nil {
w.WriteHead... | Add logic to return 400 when cluster is empty | Add logic to return 400 when cluster is empty
| Go | mit | unixvoid/nsproxy |
2bd23f3a5852bde496bf8bf19acf95eacab27000 | pkg/dbg/profile_dump.go | pkg/dbg/profile_dump.go | package dbg
import (
"fmt"
"io/ioutil"
"os"
"runtime"
"runtime/pprof"
"time"
"github.com/sirupsen/logrus"
)
const (
path = "/var/cores/"
)
// DumpGoMemoryTrace output memory profile to logs.
func DumpGoMemoryTrace() {
m := &runtime.MemStats{}
runtime.ReadMemStats(m)
res := fmt.Sprintf("%#v", m)
logrus.I... | package dbg
import (
"fmt"
"io/ioutil"
"os"
"runtime"
"runtime/pprof"
"time"
"github.com/sirupsen/logrus"
)
const (
path = "/var/cores/"
)
// DumpGoMemoryTrace output memory profile to logs.
func DumpGoMemoryTrace() {
m := &runtime.MemStats{}
runtime.ReadMemStats(m)
res := fmt.Sprintf("%#v", m)
logrus.I... | Remove whitespace from .stack & .heap filenames. | PWX-5813: Remove whitespace from .stack & .heap filenames.
Signed-off-by: Jose Rivera <4a3487e57d90e2084654b6d23937e75af5c8ee55@portworx.com>
| Go | apache-2.0 | libopenstorage/openstorage,libopenstorage/openstorage,pault84/openstorage,pault84/openstorage,pault84/openstorage,libopenstorage/openstorage |
ac9befc76f166290c447d9d20d92c12f8ca0982b | commands/utils.go | commands/utils.go | package commands
import (
"fmt"
"time"
"github.com/spf13/cobra"
)
func GetStringFlag(ctx *cobra.Command, name string) string {
return ctx.Flag(name).Value.String()
}
func GetBoolFlag(ctx *cobra.Command, name string) bool {
return ctx.Flag(name).Value.String() == "true"
}
func FormatDateTime(t time.Time) strin... | package commands
import (
"fmt"
"time"
"github.com/spf13/cobra"
)
func GetStringFlag(ctx *cobra.Command, name string) string {
flag := ctx.Flag(name)
if flag == nil {
return ""
}
return flag.Value.String()
}
func GetBoolFlag(ctx *cobra.Command, name string) bool {
flag := ctx.Flag(name)
if flag == nil {
... | Fix a bug if the flag doesn't exist | Fix a bug if the flag doesn't exist | Go | mit | ailispaw/talk2docker |
013d88e511e5e5958b264af3c2814bef4d415f2d | ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/tst.go | ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/tst.go | package main
import "testing"
func TestSomethingExciting(t *testing.T) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // OK
}
doStuffTo(transport)
}
func doStuffTo(t *http.Transport) {}
| package main
import (
"crypto/tls"
"net/http"
"testing"
)
func TestSomethingExciting(t *testing.T) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // OK
}
doStuffTo(transport)
}
func doStuffTo(t *http.Transport) {}
| Fix frontend errors in `DisabledCertificateCheck` tests. | Fix frontend errors in `DisabledCertificateCheck` tests.
| Go | mit | github/codeql-go,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go |
e49b7a2ffffc47bba6edca782fe266c18182a1bc | scraper/scraper_test.go | scraper/scraper_test.go | package scraper
import "testing"
func TestScrape(t *testing.T) {
getItem = func(url string) {
defer wg.Done()
ch <- Item{
"FooTitle",
"FooSize",
"10.00",
"FooDescription",
}
}
urls := []string{
"http://foo.com/",
"http://bar.com/",
"http://baz.com/",
}
result := Scrape(urls)
response ... | package scraper
import "testing"
func TestScrapeResultsTotal(t *testing.T) {
getItem = func(url string) {
defer wg.Done()
ch <- Item{
"FooTitle",
"FooSize",
"10.00",
"FooDescription",
}
}
urls := []string{
"http://foo.com/",
"http://bar.com/",
"http://baz.com/",
}
result := Scrape(urls... | Rename Test to be more descriptive | Rename Test to be more descriptive
| Go | mit | Integralist/Sainsbury-Scraper |
94a623fa08b669a41452fa441ad8da2d93baa58b | http.go | http.go | package errors
import "fmt"
type HTTP struct {
*primitive
code int
}
func (h HTTP) Code() int {
return h.code
}
func NewHTTP(cause error, code int, message string) error {
return &HTTP{
primitive: newPrimitive(cause, message),
code: code,
}
}
func HTTPf(cause error, code int, format string, args ...i... | package errors
import "fmt"
type HTTP interface {
error
Code() int
}
type http struct {
*primitive
code int
}
func (h http) Code() int {
return h.code
}
func NewHTTP(cause error, code int, message string) error {
return &http{
primitive: newPrimitive(cause, message),
code: code,
}
}
func HTTPf(cau... | Make HTTP error type an interface | Make HTTP error type an interface
| Go | mit | adrg/errors |
d77204399a3c26f306c214f0c48768f5c4ae713e | main.go | main.go | package main
import (
"fmt"
"github.com/leocassarani/pew/command"
"os"
)
func main() {
args := os.Args
if len(args) < 2 {
printUsage(args)
os.Exit(1)
}
cmd := args[1]
cmdArgs := args[2:]
switch cmd {
case "run":
err := command.Run(cmdArgs)
exit(err)
case "help":
fallthrough
case "--help":
pr... | package main
import (
"fmt"
"github.com/leocassarani/pew/command"
"os"
)
func main() {
args := os.Args
if len(args) < 2 {
printUsage(args)
os.Exit(1)
}
cmd := args[1]
cmdArgs := args[2:]
switch cmd {
case "run":
err := command.Run(cmdArgs)
exit(err)
case "help":
fallthrough
case "--help":
pr... | Handle unrecognised CLI commands in a git-like fashion | Handle unrecognised CLI commands in a git-like fashion
| Go | mit | leocassarani/pew |
471baf3bf6276f77dc4b425961dfd63b8d294e5a | main.go | main.go | package main
import (
"fmt"
"net"
"net/http"
"net/http/fcgi"
"os"
)
type FastCGIServer struct{}
func (s FastCGIServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
resp.Write([]byte("{}"))
}
func main() {
listener, err := net.Listen("tcp", "127.0.0.1:9000")
if err != nil {
fmt.Fprint... | package main
import (
"fmt"
"net"
"net/http"
"net/http/fcgi"
"os"
"time"
)
type FastCGIServer struct{}
func (s FastCGIServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
resp.Write([]byte("{}"))
}
func main() {
fmt.Fprintln(os.Stderr, "Server started at ", time.Now().String())
listen... | Exit on failure and log server start/stop | Exit on failure and log server start/stop
| Go | apache-2.0 | kerrickstaley/central-academy-alumni-site,kerrickstaley/central-academy-alumni-site,kerrickstaley/central-academy-alumni-site |
fe6599cc98f3bf57e9f186e825d80f703fde2627 | main.go | main.go | // Copyright © 2015-2018 Hilko Bengen <bengen@hilluzination.de>
// All rights reserved.
//
// Use of this source code is governed by the license that can be
// found in the LICENSE file.
package yara
/*
#include <yara.h>
*/
import "C"
func init() {
_ = C.yr_initialize()
}
// Finalize releases all the resources all... | // Copyright © 2015-2018 Hilko Bengen <bengen@hilluzination.de>
// All rights reserved.
//
// Use of this source code is governed by the license that can be
// found in the LICENSE file.
package yara
/*
#include <yara.h>
*/
import "C"
func init() {
if err := initialize(); err != nil {
panic(err)
}
}
// Prepares... | Make Finalize() to return an error. Panic if YARA failed while being initialized. | Make Finalize() to return an error. Panic if YARA failed while being initialized.
| Go | bsd-2-clause | VirusTotal/go-yara |
6aae5a89aae5a2de94251b367c6062d733d36db9 | model/request_test.go | model/request_test.go | package model_test
import (
"encoding/json"
"github.com/crezam/actions-on-google-golang/internal/test"
"github.com/crezam/actions-on-google-golang/model"
"os"
"testing"
"time"
)
func TestRequestParsing(t *testing.T) {
var req model.ApiAiRequest
file, _ := os.Open("./data/sample_request1.json")
dec := json.... | package model_test
import (
"encoding/json"
"github.com/crezam/actions-on-google-golang/internal/test"
"github.com/crezam/actions-on-google-golang/model"
"os"
"testing"
"time"
)
func TestRequestParsing(t *testing.T) {
var req model.ApiAiRequest
file, _ := os.Open("./data/sample_request1.json")
dec := json.... | Add tests for parameters (verified broken), fix next commit | Add tests for parameters (verified broken), fix next commit
| Go | mit | crezam/actions-on-google-golang |
6d14a085c97a181bab72760a5c6886714a9de07a | example/example.go | example/example.go | // Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin linux
package main
import (
"log"
"time"
"github.com/rakyll/sensors"
"golang.org/x/mobile/app"
)
func main() {
app.Main(func(a app.App... | // Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin linux
package main
import (
"log"
"time"
"github.com/rakyll/sensors"
"golang.org/x/mobile/app"
)
func main() {
app.Main(func(a app.App... | Disable gyroscope events after a sec. | Disable gyroscope events after a sec.
| Go | bsd-3-clause | rakyll/sensors,rakyll/sensors |
a27b615d93aa4abb06cd46ef3abbc0043e48a7c8 | pkg/sdsai/resourcepool/resourcepool_test.go | pkg/sdsai/resourcepool/resourcepool_test.go | package resourcepool
import (
"sync"
"testing"
)
type IntMaker struct{}
var wg sync.WaitGroup = sync.WaitGroup{}
func (*IntMaker) Create() (interface{}, error) {
i := 1
return &i, nil
}
func (*IntMaker) Check(interface{}) error {
return nil
}
func (*IntMaker) Destroy(interface{}) error {
wg.Done()
return n... | package resourcepool
import (
"sync"
"testing"
)
type IntMaker struct{}
var wg sync.WaitGroup = sync.WaitGroup{}
func (*IntMaker) Create() (interface{}, error) {
i := 1
return &i, nil
}
func (*IntMaker) Check(interface{}) error {
return nil
}
func (*IntMaker) Destroy(interface{}) error {
wg.Done()
return n... | Check Close() function on pool resources. | Check Close() function on pool resources.
| Go | mit | basking2/sdsai-go |
ab97520f51adc9904c0545d38af9275ee29dcc6c | parrot-api/logger/request.go | parrot-api/logger/request.go | package logger
import (
"net/http"
"time"
"github.com/Sirupsen/logrus"
)
// responseWriter implements the http.ResponseWriter interface and
// keeps track of the header status
type responseWriter struct {
Status int
Writer http.ResponseWriter
}
func (rw *responseWriter) Header() http.Header {
return rw.Writer... | // Package logger implements middleware loggeing.
package logger
import (
"net/http"
"time"
"github.com/Sirupsen/logrus"
)
// responseWriter implements the http.ResponseWriter interface and
// keeps track of the header status
type responseWriter struct {
Status int
Writer http.ResponseWriter
}
func (rw *respon... | Add doc to package logger | Add doc to package logger
| Go | mit | anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot,todes1/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot |
4df207efd1935ac459200524ce6c262dcbabb763 | random/random_test.go | random/random_test.go | package random
import (
"fmt"
"math/rand"
"sort"
"testing"
)
func TestIntn(t *testing.T) {
for i := 0; i < 100; i++ {
rn := Intn(10)
if 0 <= rn && rn < 10 {
continue
}
t.Errorf("Intn should return in the range of [0, n)")
}
}
func ExampleShuffle() {
figures := sort.StringSlice{"rectangle", "hexagon... | package random
import (
"fmt"
"math/rand"
"sort"
"testing"
)
func TestIntn(t *testing.T) {
for i := 0; i < 100; i++ {
rn := Intn(10)
if 0 <= rn && rn < 10 {
continue
}
t.Errorf("Intn should return in the range of [0, n)")
}
}
func ExampleShuffle() {
figures := sort.StringSlice{"rectangle", "hexagon... | Add comments on the example. | Add comments on the example.
| Go | mit | jaeyeom/math |
aad020ddc36bb54df4f241a82fd4603ed8a41d2c | src/lib/vm/closure.go | src/lib/vm/closure.go | package vm
type Closure struct {
function *Thunk
freeVariables []*Thunk
}
func (c Closure) Call(ts ...*Thunk) *Thunk {
o := c.function.Eval()
f, ok := o.(Callable)
if !ok {
return NotCallableError(o)
}
return f.Call(append(c.freeVariables, ts...)...)
}
func Partial(ts ...*Thunk) *Thunk {
if len(ts) ... | package vm
type Closure struct {
function *Thunk
freeVariables []*Thunk
}
func (c Closure) Call(ts ...*Thunk) *Thunk {
o := c.function.Eval()
f, ok := o.(Callable)
if !ok {
return NotCallableError(o)
}
return f.Call(append(c.freeVariables, ts...)...)
}
func Partial(ts ...*Thunk) *Thunk {
switch len(... | Fix out of range error | Fix out of range error
| Go | mit | raviqqe/tisp,tisp-lang/tisp,tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp |
bf9afc53bd061aa9ecf2805a313305eb5d01228d | testhelpers/io/io_test.go | testhelpers/io/io_test.go | package io_test
import (
"os"
. "github.com/cloudfoundry/cli/testhelpers/io"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("io helpers", func() {
It("will never overflow the pipe", func() {
str := ""
for i := 0; i < 75000; i++ {
str += "abc"
}
output := CaptureOutput(func(... | package io_test
import (
"os"
"strings"
. "github.com/cloudfoundry/cli/testhelpers/io"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("io helpers", func() {
It("will never overflow the pipe", func() {
characters := make([]string, 0, 75000)
for i := 0; i < 75000; i++ {
character... | Speed up this test by a factor of a lot | Speed up this test by a factor of a lot
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
ac23b7e90b207a9c0edbcce11782b86e57ebcfcf | namecheap_test.go | namecheap_test.go | package namecheap
| package namecheap
import (
"net/url"
"testing"
)
func TestNewClient(t *testing.T) {
c := NewClient("anApiUser", "anToken", "anUser")
if c.BaseURL != defaultBaseURL {
t.Errorf("NewClient BaseURL = %v, want %v", c.BaseURL, defaultBaseURL)
}
}
// Verify that the MakeRequest function assembles the correct API UR... | Add some very simple tests for NewClient and MakeRequest. | Add some very simple tests for NewClient and MakeRequest.
| Go | mit | billputer/go-namecheap |
a4cb446a21961a7f43fec7b80deece371f42883f | server/auth/handler.go | server/auth/handler.go | package auth
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"net/http"
)
const (
tokenCookieName = "access_token"
)
func AddRoutes(r *mux.Router, service Service) {
// Explicitly only serve login over https.
r.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
decoder := json.NewD... | package auth
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"net/http"
)
const (
tokenCookieName = "access_token"
)
func AddRoutes(r *mux.Router, service Service) {
// Explicitly only serve login over https.
r.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
decoder := json.NewD... | Set auth cookie to be returned on all api calls | Set auth cookie to be returned on all api calls
| Go | mit | DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website |
7007278a16fb5c0d7e5264eadc96ac23404d0b69 | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/lluchs/mima"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Usage: mimarun <filename>")
return
}
filename := os.Args[1]
file, err := os.Open(filename)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Parsing...\n")
program, err := mima.Parse... | package main
import (
"fmt"
"os"
"github.com/lluchs/mima"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Usage: mimarun <filename>")
return
}
filename := os.Args[1]
file, err := os.Open(filename)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Parsing...\n")
program, err := mima.Pars... | Implement assembling and running code | Implement assembling and running code
| Go | mit | lluchs/mimarun |
232d08769385512c1e15c10f176456d46991d766 | main.go | main.go | package main
import (
"net/http"
"fmt"
"encoding/json"
)
func handlePing(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "OK")
}
func handleRequest(w http.ResponseWriter, r *http.Request) {
type Input struct {
FeedId string `json:"feed_id"`
FeedUrl string `json:"feed_url"`... | package main
import (
"net/http"
"fmt"
)
func handlePing(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "OK")
}
type Input struct {
FeedId string
FeedUrl string
}
func handleRequest(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "Not... | Handle input with a http form, rather than JSON | Handle input with a http form, rather than JSON
| Go | mit | mhaligowski/paperboy-crawler |
19483c59c12b2208dd919209b6e481c205713e0c | librariesio/cmd/librariesio/main.go | librariesio/cmd/librariesio/main.go | package main
import (
"fmt"
"os"
"strings"
"github.com/hackebrot/go-librariesio/librariesio"
)
func loadFromEnv(keys ...string) (map[string]string, error) {
env := make(map[string]string)
for _, key := range keys {
v := os.Getenv(key)
if v == "" {
return nil, fmt.Errorf("environment variable %q is req... | package main
import (
"context"
"fmt"
"os"
"time"
"strings"
"github.com/hackebrot/go-librariesio/librariesio"
)
func loadFromEnv(keys ...string) (map[string]string, error) {
env := make(map[string]string)
for _, key := range keys {
v := os.Getenv(key)
if v == "" {
return nil, fmt.Errorf("environment... | Update cmd to pass context to request | Update cmd to pass context to request
| Go | mit | hackebrot/go-librariesio |
ad46c711d3853acf3904f74e7831b6cacc878e7f | blockchain/bench_test.go | blockchain/bench_test.go | // Copyright (c) 2015 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
// TODO Make benchmarking tests for various functions, such as sidechain
// evaluation.
| // Copyright (c) 2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
import (
"testing"
)
// BenchmarkAncestor benchmarks ancestor traversal for various numbers of nodes.
func BenchmarkAncestor(b *testing.B) {
// Construct... | Add benchmark for ancestor traversal. | blockchain: Add benchmark for ancestor traversal.
| Go | isc | decred/dcrd,jrick/dcrd,decred/dcrd,jrick/dcrd |
793044456495a61839478ac93175ad0d7aa3bf6e | repository/validate.go | repository/validate.go | package repository
import (
"fmt"
"gopkg.in/asaskevich/govalidator.v6"
)
func ValidateCreate(r *Repository) error {
if err := validateName(r.Name); err != nil {
return err
}
if err := validateDescription(r.Description); err != nil {
return err
}
if err := validateWebsite(r.Website); err != nil {
retur... | package repository
import (
"fmt"
"gopkg.in/asaskevich/govalidator.v6"
)
func ValidateCreate(r *Repository) error {
if err := validateName(r.Name); err != nil {
return err
}
if err := validateDescription(r.Description); err != nil {
return err
}
if err := validateWebsite(r.Website); err != nil {
retur... | Fix typo in repository name validator errors | Fix typo in repository name validator errors
| Go | apache-2.0 | gitpods/gitpods,gitpods/gitpods,gitpods/gitpods,gitpods/gitpods |
e974a7448e6e08216fb567363422217e752d7de5 | cmd/svnwatch/svnwatch.go | cmd/svnwatch/svnwatch.go | package main
import (
"flag"
"fmt"
"os"
"time"
_ "github.com/jackwilsdon/svnwatch/types"
)
func fatalf(format interface{}, a ...interface{}) {
fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], fmt.Sprintf(fmt.Sprint(format), a...))
os.Exit(1)
}
func main() {
configDir := flag.String("config", "/etc/svnwatch", ... | package main
import (
"flag"
"fmt"
"os"
"time"
_ "github.com/jackwilsdon/svnwatch/types"
)
func fatalf(format interface{}, a ...interface{}) {
fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], fmt.Sprintf(fmt.Sprint(format), a...))
os.Exit(1)
}
func main() {
configDir := flag.String("config", "/etc/svnwatch", ... | Fix typo (exists -> exits) | Fix typo (exists -> exits)
| Go | agpl-3.0 | jackwilsdon/svnwatch |
97434c46672074609bbb9899bef8581b23d9650d | go/src/socialapi/workers/migrator/main.go | go/src/socialapi/workers/migrator/main.go | package main
import (
"fmt"
"koding/db/mongodb/modelhelper"
"socialapi/workers/common/runner"
"socialapi/workers/migrator/controller"
)
var (
Name = "Migrator"
)
func main() {
r := runner.New(Name)
if err := r.Init(); err != nil {
fmt.Println(err)
return
}
defer r.Close()
modelhelper.Initialize(r.Conf... | package main
import (
"flag"
"fmt"
"koding/db/mongodb/modelhelper"
"socialapi/workers/common/runner"
"socialapi/workers/migrator/controller"
)
var (
Name = "Migrator"
flagSchedule = flag.Bool("s", false, "Schedule worker")
)
func main() {
r := runner.New(Name)
if err := r.Init(); err != nil {
fmt.... | Add scheduler support to migrator by adding -s flag | Migration: Add scheduler support to migrator by adding -s flag
| Go | agpl-3.0 | jack89129/koding,szkl/koding,kwagdy/koding-1,kwagdy/koding-1,rjeczalik/koding,jack89129/koding,usirin/koding,kwagdy/koding-1,sinan/koding,andrewjcasal/koding,sinan/koding,rjeczalik/koding,usirin/koding,acbodine/koding,gokmen/koding,koding/koding,sinan/koding,rjeczalik/koding,szkl/koding,koding/koding,cihangir/koding,dr... |
fcc8e8d013605ce836753b03e1f2afeb0cc1bff6 | main.go | main.go | package main
import (
"github.com/hashicorp/terraform/plugin"
"github.com/terraform-providers/terraform-provider-kubernetes/kubernetes"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: kubernetes.Provider})
}
| package main
import (
"github.com/hashicorp/terraform/plugin"
"github.com/sl1pm4t/terraform-provider-kubernetes/kubernetes"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: kubernetes.Provider})
}
| Update import path to fix build. | Update import path to fix build.
| Go | mpl-2.0 | sl1pm4t/terraform-provider-kubernetes,sl1pm4t/terraform-provider-kubernetes,sl1pm4t/terraform-provider-kubernetes |
546d59127dadd12c11cc9d7079c8403fd80392be | traffic_monitor/experimental/traffic_monitor/peer/peer_test.go | traffic_monitor/experimental/traffic_monitor/peer/peer_test.go | package peer
import (
"fmt"
"io/ioutil"
"testing"
)
func TestCrStates(t *testing.T) {
t.Log("Running Peer Tests")
text, err := ioutil.ReadFile("crstates.json")
if err != nil {
t.Log(err)
}
crStates, err := CrStatesUnMarshall(text)
if err != nil {
t.Log(err)
}
fmt.Println(len(crStates.Caches), "caches ... | package peer
import (
"fmt"
"io/ioutil"
"testing"
)
func TestCrStates(t *testing.T) {
t.Log("Running Peer Tests")
text, err := ioutil.ReadFile("crstates.json")
if err != nil {
t.Log(err)
}
crStates, err := CrstatesUnMarshall(text)
if err != nil {
t.Log(err)
}
fmt.Println(len(crStates.Caches), "caches ... | Fix TM2 test to match renamed symbol | Fix TM2 test to match renamed symbol
| Go | apache-2.0 | orifinkelman/incubator-trafficcontrol,mdb/incubator-trafficcontrol,amiryesh/incubator-trafficcontrol,weifensh/incubator-trafficcontrol,serDrem/incubator-trafficcontrol,naamashoresh/incubator-trafficcontrol,zhilhuan/incubator-trafficcontrol,rscrimojr/incubator-trafficcontrol,jeffmart/incubator-trafficcontrol,orifinkelma... |
ddd7479e80175d2535d9400a0d711b10d8598b90 | util/stringify.go | util/stringify.go | package util
import (
"encoding/json"
)
func String(v interface{}) string {
e, _ := json.Marshal(v)
return string(e[:])
}
| package util
import (
"encoding/json"
)
func String(v interface{}) string {
e, _ := json.Marshal(v)
return string(e[:])
}
func StringPrettify(v interface{}) string {
e, _ := json.MarshalIndent(v, "", " ")
return string(e[:])
}
| Add a string prettify method which formats the json nicely | Add a string prettify method which formats the json nicely
| Go | apache-2.0 | dominics/redishappy,dominics/redishappy |
85c92a53c5ec8c58fb6d2afee66a7109398fa07d | database_test.go | database_test.go | package golog
import "testing"
func TestAsserta(t *testing.T) {
db0 := NewDatabase()
db1 := db0.Asserta(NewTerm("alpha"))
db2 := db1.Asserta(NewTerm("beta"))
db3 := db2.Asserta(NewTerm("gamma", NewTerm("greek to me")))
// do we have the right number of clauses?
if db0.ClauseCount() != 0 {
... | package golog
import "testing"
func TestAsserta(t *testing.T) {
db0 := NewDatabase()
db1 := db0.Asserta(NewTerm("alpha"))
db2 := db1.Asserta(NewTerm("beta"))
foo := NewTerm("foo", NewTerm("one"), NewTerm("two"))
body := NewTerm("alpha")
db3 := db2.Asserta(NewTerm(":-", foo, body))
t.Logf(... | Test against a clause head and body | Test against a clause head and body
| Go | mit | mndrix/golog,vzaramel/golog,samuell/golog,vzaramel/golog,bransorem/golog,bransorem/golog,samuell/golog,mndrix/golog |
699e786a9c16f21cc6ba1c27c6d8346045dd5515 | model/light_bulb.go | model/light_bulb.go | package model
// A LightBulb is a Switch and additionally has a brightness, saturation and hue value.
//
// TODO(brutella): The HAP protocol defines brightness, saturation and hue as optional. This
// is currently no reflected in the LightBulb interface yet.
type LightBulb interface {
Switch
// OnBrightnessChanged ... | package model
// A LightBulb is a Switch and additionally has a brightness, saturation and hue value.
//
// TODO(brutella): The HAP protocol defines brightness, saturation and hue as optional. This
// is currently no reflected in the LightBulb interface yet.
type LightBulb interface {
Switch
// OnBrightnessChanged ... | Update min and max value documentation of brightness, saturation and hue characteristic | Update min and max value documentation of brightness, saturation and hue characteristic
| Go | apache-2.0 | bahlo/hc,sjfloat/hc,mxlje/hc,ninjasphere/hc,brutella/hc,savaki/hc |
977e33a5df684367c50f1443fd861bef4db83ba8 | solutions/image.go | solutions/image.go | // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"image"
"image/color"
"code.google.com/p/go-tour-french/pic"
)
type Image struct {
Height, Width int
}
func (m ... | // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"image"
"image/color"
"github.com/dupoxy/go-tour-fr/pic"
)
type Image struct {
Height, Width int
}
func (m Imag... | Update imports from googlecode to github | Update imports from googlecode to github | Go | bsd-3-clause | dolmen/go-tour-fr,dolmen/go-tour-fr,dupoxy/go-tour-fr,dolmen/go-tour-fr,dupoxy/go-tour-fr,dupoxy/go-tour-fr |
f12337ee1915a606b6acc65f0aebf9f643fda471 | gogdb_test.go | gogdb_test.go | package godbg
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestProject(t *testing.T) {
Convey("Test buffers", t, func() {
Convey("By Default, equals to std", func() {
So(Out(), ShouldEqual, os.Stdout)
So(Err(), ShouldEqual, os.Stderr)
})
Convey("When set to buffer, no l... | package godbg
import (
"fmt"
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestProject(t *testing.T) {
Convey("Test buffers", t, func() {
Convey("By Default, equals to std", func() {
So(Out(), ShouldEqual, os.Stdout)
So(Err(), ShouldEqual, os.Stderr)
})
Convey("When set to buffe... | Test String() on Out() and Err() global pdgb | Test String() on Out() and Err() global pdgb
| Go | mit | VonC/godbg |
b7e87d53732778bc2a2723b9d1005555affde304 | provider/vsphere/export_test.go | provider/vsphere/export_test.go | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// +build !gccgo
package vsphere
import (
"github.com/juju/juju/environs"
)
var (
Provider environs.EnvironProvider = providerInstance
)
func init() {
environs.RegisterProvider(providerType, providerInstance)
}
func Ex... | // Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// +build !gccgo
package vsphere
import (
"github.com/juju/juju/environs"
)
var (
Provider environs.EnvironProvider = providerInstance
)
func ExposeEnvFakeClient(env *environ) *fakeClient {
return env.client.connection.... | Drop registering the provider during tests. | Drop registering the provider during tests.
| Go | agpl-3.0 | axw/juju,tych0/juju,frankban/juju-tmp,bac/juju,mhilton/juju,davecheney/juju,ericsnowcurrently/juju,wwitzel3/juju,gabriel-samfira/juju,howbazaar/juju,tsakas/juju,dimitern/juju,frankban/juju,makyo/juju,davecheney/juju,frankban/juju,tych0/juju,tasdomas/juju,reedobrien/juju,dooferlad/juju,mjs/juju,cloud-green/juju,macgreag... |
c4653d14447a8bd6aa46b16d74081e1c4c38f496 | commands/command_init.go | commands/command_init.go | package gitmedia
import (
"../gitconfig"
"fmt"
"regexp"
)
type InitCommand struct {
*Command
}
var valueRegexp = regexp.MustCompile("\\Agit[\\-\\s]media")
func (c *InitCommand) Run() {
setFilter("clean")
setFilter("smudge")
fmt.Println("git media initialized")
}
func setFilter(filterName string) {
key := ... | package gitmedia
import (
"../gitconfig"
"fmt"
"regexp"
)
type InitCommand struct {
*Command
}
var valueRegexp = regexp.MustCompile("\\Agit[\\-\\s]media")
func (c *InitCommand) Run() {
setFilter("clean")
setFilter("smudge")
requireFilters()
fmt.Println("git media initialized")
}
func setFilter(filterName ... | Set the required flag for media filters | Set the required flag for media filters
| Go | mit | bozaro/git-lfs,ModernTechnologyPlayers01/git-lfs,Aorjoa/git-lfs,sanoursa/git-lfs,clareliguori/git-lfs,ModernTechnologyPlayers01/git-lfs,jsroads/git-lfs,iSC-Labs/git-lfs,michael-k/git-lfs,engsoonhock1967/git-lfs,andyneff/git-lfs,jsroads/git-lfs,beni55/git-lfs,larsxschneider/git-lfs,phungmy/git-lfs,modulexcite/git-lfs,Ch... |
1992690eede6e11f7d9a5da9951409b3e8715d27 | uat/uat_runner_test.go | uat/uat_runner_test.go | package uat
import (
"os"
"testing"
"github.com/DATA-DOG/godog"
)
var runDir = "."
var raceBinPath = "."
const GodogSuiteName = "uat"
func TestMain(m *testing.M) {
// Run the features tests from the compiled-in location.
if err := os.Chdir(runDir); err != nil {
panic(err)
}
// Prefix the path so that we ... | package uat
import (
"os"
"testing"
"github.com/DATA-DOG/godog"
)
var runDir = "."
var raceBinPath = "."
func TestMain(m *testing.M) {
// Run the features tests from the compiled-in location.
if err := os.Chdir(runDir); err != nil {
panic(err)
}
// Prefix the path so that we can find our race-compiled bin... | Remove GodogSuiteName const from test runner | Remove GodogSuiteName const from test runner
This const conflicts with the generated test runner
when using regular godog invocation. It's not required
for building/running the UAT suite via RPM.
| Go | mit | intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur,intel-hpdd/lemur |
40b1ceaa1aec33c93e2351a4f15422c5d5b98355 | metrics.go | metrics.go | package main
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var collections = prometheus.NewSummary(prometheus.SummaryOpts{
Name: "kube-saml-collector_collection_seconds",
Help: "A summary of the metadata aggregation performed by ... | package main
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var collections = prometheus.NewSummary(prometheus.SummaryOpts{
Name: "kube_saml_collector_collection_seconds",
Help: "A summary of the metadata aggregation performed by ... | Update to valid metric name | Update to valid metric name
| Go | apache-2.0 | UniconLabs/kube-saml-collector |
06ec50bfdb1c560c0d03cd78f9e0ef2482204989 | redditdaily_cron.go | redditdaily_cron.go | package main
import (
"github.com/robfig/cron"
"github.com/spf13/viper"
"github.com/markbao/redditdaily/redditdaily"
"fmt"
"time"
)
func main() {
viper.SetConfigType("yaml")
viper.SetConfigName("config")
viper.AddConfigPath("../")
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
panic... | package main
import (
"github.com/robfig/cron"
"github.com/spf13/viper"
"github.com/markbao/redditdaily/redditdaily"
"fmt"
)
func main() {
viper.SetConfigType("yaml")
viper.SetConfigName("config")
viper.AddConfigPath("../")
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
panic(fmt.Err... | Fix issue with time import | Fix issue with time import
| Go | mit | markbao/redditdaily,markbao/redditdaily |
e8db31c34b70c0733d4e1c20ce06fe8a5dbc8e58 | cmd/seomoz/main.go | cmd/seomoz/main.go | package main
import (
"fmt"
"log"
"os"
"github.com/jawher/mow.cli"
"github.com/vially/seomoz"
)
func main() {
app := cli.App("seomoz", "Analyze URLs using SEOmoz")
app.Spec = "[--cols=<SEOmoz COLS>] URL..."
var (
cols = app.IntOpt("c cols", seomoz.DefaultCols, "SEOmoz COLS")
urls = app.StringsArg("URL"... | package main
import (
"fmt"
"log"
"os"
"github.com/jawher/mow.cli"
"github.com/vially/seomoz"
)
func main() {
app := cli.App("seomoz", "Analyze URLs using SEOmoz")
app.Spec = "[--cols=<SEOmoz COLS>] URL..."
var (
cols = app.IntOpt("c cols", seomoz.DefaultCols, "SEOmoz COLS")
urls = app.StringsArg("URL"... | Validate API credentials are set before run | Validate API credentials are set before run
| Go | mit | vially/seomoz |
abb10e9cbfe5b28b693e3a138e54be495538ed31 | _examples/routing/fallback-handlers/main.go | _examples/routing/fallback-handlers/main.go | package main
import (
"github.com/kataras/iris"
)
func main() {
app := iris.New()
// this works as expected now,
// will handle *all* expect DELETE requests, even if there is no routes
app.Get("/action/{p}", h)
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
}
func h(ctx iris.Conte... | package main
import (
"github.com/kataras/iris"
)
func main() {
app := iris.New()
// add a fallback handler to process requests that would not be declared in the router.
app.Fallback(fallbackHandler)
// this works as expected now,
// will handle *all* expect DELETE requests, even if there is no routes
app.Ge... | Add a missing call for `fallbackHandler` | Add a missing call for `fallbackHandler`
Former-commit-id: a1ce94b39d326657cdbce34276477c34752f0000 | Go | bsd-3-clause | kataras/iris,kataras/iris,kataras/gapi,kataras/iris,kataras/gapi,kataras/iris |
28610a9a426fac3ae88b812897b1c1a540112071 | debug.go | debug.go | // Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file).
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any l... | // Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file).
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any l... | Break out logger as a reusable component | Break out logger as a reusable component
| Go | mpl-2.0 | wweich/syncthing,MaPePeR/syncthing-protocol-deviceid,nrm21/syncthing,alex2108/syncthing,kluppy/syncthing,nrm21/syncthing,pembo210/syncthing,Kudalufi/syncthing,nrm21/syncthing,kc1212/syncthing,ProactiveServices/syncthing,kozec/syncthing,mateon1/syncthing,kluppy/syncthing,imsodin/syncthing,wweich/syncthing,imsodin/syncth... |
0a1f496a7153b0dceaf99f9633edeb8171cc17f2 | internal/skeleton/routes/routes.go | internal/skeleton/routes/routes.go | package routes
import (
"net/http"
h "github.com/anonx/sunplate/internal/skeleton/assets/handlers"
r "github.com/anonx/sunplate/routing"
)
// List is a slice of routes of the following form:
// Route:
// Pattern
// Handlers:
// Method: Handler
// If using a standard router just call Context.Build() to get ht... | package routes
import (
"net/http"
h "github.com/anonx/sunplate/internal/skeleton/assets/handlers"
r "github.com/anonx/sunplate/routing"
)
// List is a slice of routes of the following form:
// Route:
// Pattern
// Handlers:
// Method: Handler
// If using a standard router just call Context.Build() to get ht... | Fix for correct serve of static files | Fix for correct serve of static files
| Go | bsd-2-clause | runner-mei/goal,runner-mei/goal,runner-mei/goal |
49153e142eacb556d7564033b270bd47b3aa0d18 | mbinfo/mbinfo.go | mbinfo/mbinfo.go | /* Read from /sys/devices/virtual/dmi/id/board_{name,serial,vendor} */
package mbinfo
import (
"fmt"
"os/exec"
)
const MB_NAME_FILE = "/sys/devices/virtual/dmi/id/board_name"
const MB_SERIAL_FILE = "/sys/devices/virtual/dmi/id/board_serial"
const MB_VENDOR_FILE = "/sys/devices/virtual/dmi/id/board_vendor"
type MBs... | /* Read from /sys/devices/virtual/dmi/id/board_{name,serial,vendor} */
package mbinfo
import (
"fmt"
"os/exec"
"strings"
)
const MB_NAME_FILE = "/sys/devices/virtual/dmi/id/board_name"
const MB_SERIAL_FILE = "/sys/devices/virtual/dmi/id/board_serial"
const MB_VENDOR_FILE = "/sys/devices/virtual/dmi/id/board_vendor... | Remove '\n' character in Motherboard's Model/Serial | Remove '\n' character in Motherboard's Model/Serial
| Go | mit | PiScale/hwinfo-lib |
ae1b011e8616a6d3e77a520d47afb3d979335723 | integration/helpers/matchers.go | integration/helpers/matchers.go | package helpers
import (
"fmt"
"path/filepath"
"regexp"
"runtime"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/types"
)
// SayPath is used to assert that a path is printed within streaming output.
// On Windows, it uses a case-insensitive match and escapes the path.
// On... | package helpers
import (
"fmt"
"path/filepath"
"regexp"
"runtime"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/types"
)
// SayPath is used to assert that a path is printed within streaming output.
// On Windows, it uses a case-insensitive match and escapes the path.
// On... | Remove the EqualPath matcher because its unused | Remove the EqualPath matcher because its unused
Co-authored-by: Eli Wrenn <0a41924cabfa000cd7baec4cd10fadeb2f8e7ed3@pivotal.io>
Co-authored-by: Reid Mitchell <15b84f3bcf1e0a1a99817cc9360cedc980d7c5b6@pivotal.io>
| Go | apache-2.0 | cloudfoundry/cli,cloudfoundry/cli,cloudfoundry/cli |
fc02c9475cd681f3ef7699e49ed9b2e3492d8555 | routers/router.go | routers/router.go | package routers
import (
"github.com/gorilla/mux"
"github.com/unrolled/secure"
)
var secureMiddleware = secure.New(secure.Options{
// SSLRedirect: true,
FrameDeny: true,
ContentTypeNosniff: true,
BrowserXssFilter: true,
IsDevelopment: false,
})
func InitRoutes() *mux.Router {
router :=... | package routers
import (
"github.com/gorilla/mux"
"github.com/unrolled/secure"
)
var secureMiddleware = secure.New(secure.Options{
// SSLRedirect: true,
FrameDeny: true,
ContentTypeNosniff: true,
BrowserXssFilter: true,
IsDevelopment: true,
})
func InitRoutes() *mux.Router {
router := ... | Set development true temporarily to allow cors | Set development true temporarily to allow cors
| Go | mit | Alex1sz/shotcharter-go-api |
a97b09ce55a0be3ad5a34c2b4a92cd324924809b | parse.go | parse.go | package pg_query
// Note(LukasFittl): This needs Go 1.5 for $SRCDIR support, see
// https://github.com/golang/go/commit/131758183f7dc2610af489da3a7fcc4d30c6bc48
/*
#cgo CFLAGS: -I${SRCDIR}/tmp/libpg_query-master
#cgo LDFLAGS: -L${SRCDIR}/tmp/libpg_query-master -lpg_query -fstack-protector
#include <pg_query.h>
#inclu... | package pg_query
// Note(LukasFittl): This needs Go 1.5 for $SRCDIR support, see
// https://github.com/golang/go/commit/131758183f7dc2610af489da3a7fcc4d30c6bc48
/*
#cgo CFLAGS: -I${SRCDIR}/tmp/libpg_query-master
#cgo LDFLAGS: -L${SRCDIR}/tmp/libpg_query-master -lpg_query -fstack-protector
#include <pg_query.h>
#inclu... | Move pg_query_init call to init(). | Move pg_query_init call to init().
Thank you PostgreSQL assertions :)
| Go | bsd-3-clause | lfittl/pg_query.go,lfittl/pg_query.go |
d92455ffc0d69cc04539da68643ca0a5314631a8 | cmd/bytemark/generate_help.go | cmd/bytemark/generate_help.go | package main
import (
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/commands/admin"
"github.com/urfave/cli"
)
func generateHelp([]cli.Command) {
for idx, cmd := range commands {
switch cmd.Name {
case "admin":
commands[idx].Descriptio... | package main
import (
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/commands/admin"
"github.com/urfave/cli"
)
func generateHelp(commands []cli.Command) {
for idx, cmd := range commands {
switch cmd.Name {
case "admin":
commands[idx].D... | Fix admin and commands commands - sneaky bug introduced by !213 | Fix admin and commands commands - sneaky bug introduced by !213
| Go | mit | BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client,BytemarkHosting/bytemark-client |
f71c0a6006fd8282480b875577bf386db019b8ed | drone/handle.go | drone/handle.go | package main
import (
"crypto/tls"
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/drone/drone-go/drone"
"github.com/jackspirou/syscerts"
)
type handlerFunc func(*cli.Context, drone.Client) error
// handle wraps the command function handlers and
// sets up the environment.
func handle(c *cli.Context, fn h... | package main
import (
"crypto/tls"
"fmt"
"os"
"strings"
"github.com/codegangsta/cli"
"github.com/drone/drone-go/drone"
"github.com/jackspirou/syscerts"
)
type handlerFunc func(*cli.Context, drone.Client) error
// handle wraps the command function handlers and
// sets up the environment.
func handle(c *cli.Co... | Trim slash suffix from the server URL | Trim slash suffix from the server URL
| Go | apache-2.0 | drone/drone-cli,drone/drone-cli,drone/drone-cli |
46383ae27d51da084fe7aa34637fc094d09d4149 | util/util_test.go | util/util_test.go | // Copyright 2016 Albert Nigmatzianov. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package util
import (
"bytes"
"testing"
)
var (
sizeInt int64 = 15351
sizeBytes = []byte{0, 0, 0x77, 0x77}
)
func TestParseSize(t *testing.T... | // Copyright 2016 Albert Nigmatzianov. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package util
import (
"bytes"
"testing"
)
var (
sizeInt int = 15351
sizeBytes = []byte{0, 0, 0x77, 0x77}
)
func TestParseSize(t *testing.T) {
... | Fix types in util tests | Fix types in util tests
| Go | mit | bogem/id3v2 |
8556b6963bd04687a6a81368b743c16a4fd0677c | helloWorld.go | helloWorld.go | package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
h, _ := os.Hostname()
fmt.Fprintf(w, "Hi there, I'm served from %s!", h)
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8484", nil)
}
| package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
h, _ := os.Hostname()
if len(r.URL.Query().Get("name")) <= 0 {
fmt.Fprintf(w, "Hi there, I'm served from %s!", h)
} else {
fmt.Fprintf(w, "Hi there %s, I'... | Change hellow world to use name argument if added | Change hellow world to use name argument if added
| Go | mit | fredead/VagrantAnsible |
c41b31da262ee79bdfd833935c136a1c8e30cab5 | proberk/go/proberk/main_test.go | proberk/go/proberk/main_test.go | package main
import (
"testing"
assert "github.com/stretchr/testify/require"
"go.skia.org/infra/go/testutils"
"go.skia.org/infra/proberk/go/types"
)
func TestProbeSSL(t *testing.T) {
testutils.LargeTest(t)
probes := &types.Probe{
URLs: []string{
"https://skia.org",
"https://skia.org:443",
"https://3... | package main
import (
"testing"
assert "github.com/stretchr/testify/require"
"go.skia.org/infra/go/testutils"
"go.skia.org/infra/proberk/go/types"
)
func TestProbeSSL(t *testing.T) {
t.Skip()
testutils.LargeTest(t)
probes := &types.Probe{
URLs: []string{
"https://skia.org",
"https://skia.org:443",
... | Disable test which is covered by an alert | [proberk] Disable test which is covered by an alert
TBR=borenet
Bug: skia:
Change-Id: I26d62f1c108f471a92b298c8bd37a2c845d80542
Reviewed-on: https://skia-review.googlesource.com/c/177910
Reviewed-by: Stephan Altmueller <43343ec95731c0e8daa7359daf7f2f3935582b24@google.com>
Commit-Queue: Stephan Altmueller <43343ec95731... | Go | bsd-3-clause | google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot |
10da1eaf3e2994e2d9b16cdf85b7e7e237761e3c | decoder_example_test.go | decoder_example_test.go | package jsonptrerror_test
import (
"fmt"
"strings"
"github.com/dolmen-go/jsonptrerror"
)
func ExampleDecoder() {
decoder := jsonptrerror.NewDecoder(strings.NewReader(
`{"key": "x", "value": 5}`,
))
var out struct {
Key string `json:"key"`
Value bool `json:"value"`
}
err := decoder.Decode(&out)
fmt... | // The original error message returned by stdlib changed with go1.8.
// We only test the latest release.
//
//+build go1.8 forcego1.8
package jsonptrerror_test
import (
"fmt"
"strings"
"github.com/dolmen-go/jsonptrerror"
)
func ExampleDecoder() {
decoder := jsonptrerror.NewDecoder(strings.NewReader(
`{"key": ... | Disable ExampleDecoder testing on go < 1.8 | Disable ExampleDecoder testing on go < 1.8
... because it fails as the error message returned by stdlib changed
with go1.8.
| Go | apache-2.0 | dolmen-go/jsonptrerror |
7c576a60ccff5a5d28c874a32886852325e4b1c7 | decompressors/gbrotli/gbrotli.go | decompressors/gbrotli/gbrotli.go | package gbrotli
import (
"io"
"github.com/dsnet/compress/brotli"
"github.com/itchio/wharf/pwr"
)
type brotliDecompressor struct{}
func (bc *brotliDecompressor) Apply(reader io.Reader) (io.Reader, error) {
br := brotli.NewReader(reader, nil)
return br, nil
}
func init() {
pwr.RegisterDecompressor(pwr.Compress... | package gbrotli
import (
"io"
"github.com/dsnet/compress/brotli"
"github.com/go-errors/errors"
"github.com/itchio/wharf/pwr"
)
type brotliDecompressor struct{}
func (bc *brotliDecompressor) Apply(reader io.Reader) (io.Reader, error) {
br, err := brotli.NewReader(reader, nil)
if err != nil {
return nil, erro... | Adjust to new dsnet/compress API, pt. 2 | Adjust to new dsnet/compress API, pt. 2
| Go | mit | itchio/wharf,itchio/wharf.proto,itchio/wharf.proto,itchio/wharf |
e3b1a0f5dc313071ea41110e53cff8a4bda50429 | metrics/counter.go | metrics/counter.go | package metrics
import (
"strconv"
"sync/atomic"
)
type Counter interface {
Inc(delta int64)
Dec(delta int64)
Set(delta int64)
Count() int64
}
type atomicCounter int64
func NewCounter() Counter {
c := atomicCounter(int64(0))
return &c
}
func (c *atomicCounter) Inc(delta int64) {
atomic.AddInt64((*int64)(c... | package metrics
import (
"strconv"
"sync/atomic"
)
type Counter interface {
Inc(delta int64)
Dec(delta int64)
Set(delta int64)
Count() int64
String() string
}
type atomicCounter int64
func NewCounter() Counter {
c := atomicCounter(int64(0))
return &c
}
func (c *atomicCounter) Inc(delta int64) {
atomic.Ad... | Make sure Counter implementation expvar.Var | Make sure Counter implementation expvar.Var
| Go | bsd-3-clause | samuel/go-metrics |
91638cc14d1e5d192683ccda9cb2fa5d2cfdee66 | path_flag.go | path_flag.go | package atc
import (
"fmt"
"path/filepath"
"strings"
)
type PathFlag string
func (path *PathFlag) UnmarshalFlag(value string) error {
if value == "" {
return nil
}
matches, err := filepath.Glob(value)
if err != nil {
return fmt.Errorf("failed to expand path '%s': %s", value, err)
}
if len(matches) == ... | package atc
import (
"fmt"
"path/filepath"
"strings"
"github.com/jessevdk/go-flags"
)
type PathFlag string
func (path *PathFlag) UnmarshalFlag(value string) error {
if value == "" {
return nil
}
matches, err := filepath.Glob(value)
if err != nil {
return fmt.Errorf("failed to expand path '%s': %s", val... | Add tab completion for fly paths. | Add tab completion for fly paths.
| Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
92eca900b086200b4f270cf438a8a5ff9c8c2a3b | testutil/registry/ops.go | testutil/registry/ops.go | package registry
// Schema1 sets the registry to serve v1 api
func Schema1(c *Config) {
c.schema1 = true
}
// Htpasswd sets the auth method with htpasswd
func Htpasswd(c *Config) {
c.auth = "htpasswd"
}
// Token sets the auth method to token, with the specified token url
func Token(tokenURL string) func(*Config) {... | package registry
import "io"
// Schema1 sets the registry to serve v1 api
func Schema1(c *Config) {
c.schema1 = true
}
// Htpasswd sets the auth method with htpasswd
func Htpasswd(c *Config) {
c.auth = "htpasswd"
}
// Token sets the auth method to token, with the specified token url
func Token(tokenURL string) fu... | Revert "testutil/registry: remove unused WithStdout(), WithStErr() opts" | Revert "testutil/registry: remove unused WithStdout(), WithStErr() opts"
This reverts commit 1f21c4dd0512e899ecf4077a927d99debac28f6d.
Signed-off-by: Sebastiaan van Stijn <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@gone.nl>
| Go | apache-2.0 | trebonian/docker,moby/moby,thaJeztah/docker,Mokolea/docker,konstruktoid/docker-upstream,thaJeztah/docker,jimjag/docker,konstruktoid/docker-upstream,konstruktoid/docker-upstream,Ramzec/docker,jimjag/docker,moby/moby,jimjag/docker,thaJeztah/docker,Ramzec/docker,moby/moby,mahak/docker,Mokolea/docker,Ramzec/docker,Mokolea/... |
d9a58543a197e9e5dc65c2b472334b617871129d | jsonclassify.go | jsonclassify.go | package main
import (
"encoding/json"
"io/ioutil"
"log"
"os"
)
type Attributes map[string][]int
type Weights map[string]int
type Classifier struct {
Name string
Categories map[string]Attributes
Weights Weights
}
type Category struct {
Name string
Attributes map[string][]int
}
func NewClassi... | package main
import (
"encoding/json"
"io"
"io/ioutil"
"log"
"os"
)
type Attributes map[string][]int
type Weights map[string]int
type Classifier struct {
Name string
Categories map[string]Attributes
Weights Weights
}
type Category struct {
Name string
Attributes map[string][]int
}
func New... | Add JSON IO streams for classification. | Add JSON IO streams for classification.
| Go | isc | whee/jsonclassify |
3e05c1038589258b40efd4bfef4d5c387bcc73c9 | patch_test.go | patch_test.go | package git
import (
"strings"
"testing"
)
func TestPatch(t *testing.T) {
repo := createTestRepo(t)
defer repo.Free()
//defer os.RemoveAll(repo.Workdir())
_, originalTreeId := seedTestRepo(t, repo)
originalTree, err := repo.LookupTree(originalTreeId)
checkFatal(t, err)
_, newTreeId := updateReadme(t, repo... | package git
import (
"strings"
"testing"
)
func TestPatch(t *testing.T) {
repo := createTestRepo(t)
defer repo.Free()
//defer os.RemoveAll(repo.Workdir())
_, originalTreeId := seedTestRepo(t, repo)
originalTree, err := repo.LookupTree(originalTreeId)
checkFatal(t, err)
_, newTreeId := updateReadme(t, repo... | Fix test to force diff prefixes. | Fix test to force diff prefixes.
| Go | mit | TheDahv/git2go,joseferminj/git2go,joseferminj/git2go,libgit2/git2go,treejames/git2go,Acidburn0zzz/git2go,hwjeong/git2go,treejames/git2go,Acidburn0zzz/git2go,treejames/git2go,ezwiebel/git2go,orivej/git2go,kissthink/git2go,clns/git2go,AaronO/git2go,orivej/git2go,TheDahv/git2go,TheDahv/git2go,clns/git2go,libgit2/git2go,hw... |
0b4afe553632204ad44e202f234c24311f0ad10a | events.go | events.go | package libvirt
/*
#cgo LDFLAGS: -lvirt
#include <libvirt/libvirt.h>
*/
import "C"
func EventRegisterDefaultImpl() error {
if i := int(C.virEventRegisterDefaultImpl()); i != 0 {
return GetLastError()
}
return nil
}
func EventRunDefaultImpl() error {
if i := int(C.virEventRunDefaultImpl()); i != 0 {
return G... | package libvirt
/*
#cgo LDFLAGS: -lvirt
#include <libvirt/libvirt.h>
*/
import "C"
type VirEventHandleType int
const (
VIR_EVENT_HANDLE_READABLE = VirEventHandleType(C.VIR_EVENT_HANDLE_READABLE)
VIR_EVENT_HANDLE_WRITABLE = VirEventHandleType(C.VIR_EVENT_HANDLE_WRITABLE)
VIR_EVENT_HANDLE_ERROR = VirEventHandle... | Add remaining enum constants for event APIs | Add remaining enum constants for event APIs
Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>
| Go | mit | libvirt/libvirt-go,libvirt/libvirt-go,libvirt/libvirt-go,libvirt/libvirt-go |
55bbaafada72e0bc2af6121f8d1faa6e8e1eb752 | service_client.go | service_client.go | package gophercloud
import "strings"
// ServiceClient stores details required to interact with a specific service API implemented by a provider.
// Generally, you'll acquire these by calling the appropriate `New` method on a ProviderClient.
type ServiceClient struct {
// Provider is a reference to the provider that ... | package gophercloud
import "strings"
// ServiceClient stores details required to interact with a specific service API implemented by a provider.
// Generally, you'll acquire these by calling the appropriate `New` method on a ProviderClient.
type ServiceClient struct {
// ProviderClient is a reference to the provider... | Embed the ProviderClient struct in ServiceClient. | Embed the ProviderClient struct in ServiceClient.
This lets us inherit the AuthenticatedHeaders method, rather than
having to walk the references all the time.
| Go | apache-2.0 | pratikmallya/gophercloud,rackspace/gophercloud,dudymas/gophercloud,larsbutler/gophercloud,feiskyer/gophercloud,jarosser06/gophercloud,timbyr/gophercloud,carolynvs/gophercloud,jamiehannaford/gophercloud,feiskyer/gophercloud,rgbkrk/gophercloud,trumant/gophercloud,rackspace/gophercloud,DSpeichert/gophercloud,trumant/gophe... |
4ee0ca83a7cf177ec70aec5d777eae3a765a1796 | imports/local/imports_local_gofig.go | imports/local/imports_local_gofig.go | // +build gofig
package local
import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/storage/vfs/client"
)
| // +build gofig,libstorage_storage_driver_vfs
package local
import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/storage/vfs/client"
)
| Fix for Import VFS Client w Bad Build Tags | Fix for Import VFS Client w Bad Build Tags
This patch updates an import so that the package is no longer imported
when it should not be.
| Go | apache-2.0 | codedellemc/libstorage,cduchesne/rexray,akutz/rexray,oppodeldoc/rexray,oppodeldoc/rexray,akutz/libstorage,codedellemc/rexray,codedellemc/rexray,thecodeteam/rexray,MatMaul/libstorage,emccode/libstorage,cduchesne/rexray,akutz/libstorage,emccode/libstorage,codedellemc/libstorage,codedellemc/rexray,codedellemc/rexray,akutz... |
151b3c82b548994c9061da2b05acbd8eab78cead | internal/gps/strip_vendor_windows.go | internal/gps/strip_vendor_windows.go | // Copyright 2017 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 gps
import (
"os"
"path/filepath"
)
func stripVendor(path string, info os.FileInfo, err error) error {
if err != nil && err != filepath.SkipDir {
... | // Copyright 2017 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 gps
import (
"os"
"path/filepath"
)
func stripVendor(path string, info os.FileInfo, err error) error {
if err != nil && err != filepath.SkipDir {
... | Fix remove-before-visit for Windows, too | Fix remove-before-visit for Windows, too
| Go | bsd-3-clause | golang/dep,ibrasho-forks/dep,ibrasho-forks/dep,golang/dep,golang/dep |
5fee4b4aa750182d42626abf5ee69166b497a3c2 | heff/http.go | heff/http.go | package heff
import (
"io"
"log"
"net/http"
"sync"
)
// DefaultHoneypot is an http.HandlerFunc that serves random HTML from the
// DefaultMarkovMap, 100KB at a time.
var DefaultHoneypot = NewHoneypot(DefaultMarkovMap, 100*1<<10)
// NewHoneypot creates an http.HandlerFunc from a MarkovMap
func NewHoneypot(mm Mark... | package heff
import (
"io"
"log"
"net/http"
"sync"
)
// DefaultHoneypot is an http.HandlerFunc that serves random HTML from the
// DefaultMarkovMap, 100KB at a time.
var DefaultHoneypot = NewHoneypot(DefaultMarkovMap, 100*1<<10)
// NewHoneypot creates an http.HandlerFunc from a MarkovMap
func NewHoneypot(mm Mark... | Fix bug of using DefaultMarkovMap | Handler: Fix bug of using DefaultMarkovMap | Go | mit | carlmjohnson/heffalump |
8870ff9562eb1f98042ffa49a97048d3cdf4b13c | test_utils.go | test_utils.go | package bitmath4go
import "testing"
func testShortAndLongFuncNamesShouldBeSame(t *testing.T, shortName BitmathBase, longName BitmathBase) {
if shortName != longName {
t.Errorf("%s short and long func names do not produce the same thing.", shortName.Prefix)
}
}
func testInitializationValues(t *testing.T, testObje... | package bitmath4go
import "testing"
func testInitializationValues(t *testing.T, testObject BitmathBase, expectedValue float64) {
if testObject.ByteValue != expectedValue {
reportIncorrectValue(t, testObject.Prefix, testObject.ByteValue, expectedValue)
}
}
func reportIncorrectValue(t *testing.T, size string, actu... | Remove short and long test name | Remove short and long test name
| Go | mit | kelcecil/bitmath4go |
2ca9cb9712c074821471aca3936c9499f6bf54b6 | meeple_mover.go | meeple_mover.go | package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/rkbodenner/parallel_universe/collection"
)
type Player struct {
Id int
Name string
}
var players = []Player{
{1, "Player One"},
{2, "Player Two"},
}
func corsHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w htt... | package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/rkbodenner/parallel_universe/collection"
)
type Player struct {
Id int
Name string
}
var players = []Player{
{1, "Player One"},
{2, "Player Two"},
}
func corsHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w htt... | Return collection with faked IDs | Return collection with faked IDs
| Go | mit | rkbodenner/meeple_mover,rkbodenner/meeple_mover |
69561491f9025548a4a1673b1f70e1dadaf77df3 | cmd/hologram-ping/main.go | cmd/hologram-ping/main.go | package main
import (
"flag"
"fmt"
"net"
"github.com/AdRoll/hologram/protocol"
)
var host = flag.String("host", "localhost", "IP or hostname to ping")
var port = flag.Int("port", 3100, "Port to connect to for ping")
func main() {
flag.Parse()
connString := fmt.Sprintf("%s:%d", *host, *port)
conn, err := net... | package main
import (
"flag"
"fmt"
"crypto/tls"
"crypto/x509"
"github.com/AdRoll/hologram/protocol"
)
var host = flag.String("host", "localhost", "IP or hostname to ping")
var port = flag.Int("port", 3100, "Port to connect to for ping")
func main() {
flag.Parse()
connString := fmt.Sprintf("%s:%d", *host, *por... | Fix hologram-ping to connect using TLS | Fix hologram-ping to connect using TLS
Fixes https://github.com/AdRoll/hologram/issues/70
| Go | apache-2.0 | snwight/hologram,snwight/hologram,AdRoll/hologram,AdRoll/hologram |
10366d507e20f8ac3dc68461b88ee2cd404062ee | blobstore/consts.go | blobstore/consts.go | package blobstore
const (
blobTypeSimpleStaticFile = 0x01
blobTypeSimpleStaticDir = 0x11
maxSimpleFileDataSize = 16 * 1024 * 1024
maxSimpleDirEntries = 1024
validationMethodHash = 0x01
)
| package blobstore
const (
blobTypeSimpleStaticFile = 0x01
blobTypeSplitStaticFile = 0x02
blobTypeSimpleStaticDir = 0x11
blobTypeSplitStaticDir = 0x12
maxSimpleFileDataSize = 16 * 1024 * 1024
maxSimpleDirEntries = 1024
validationMethodHash = 0x01
)
| Add type bytes for split file and split dir | Add type bytes for split file and split dir
| Go | bsd-3-clause | cinode/golib |
1aba4c628adaca49e706917001338fc21bfe77e8 | src/golang/finalize/cli/main.go | src/golang/finalize/cli/main.go | package main
import (
"golang/finalize"
_ "golang/hooks"
"os"
"github.com/cloudfoundry/libbuildpack"
)
type config struct {
Config struct {
GoVersion string `yaml:"GoVersion"`
VendorTool string `yaml:"VendorTool"`
Godep string `yaml:"Godep"`
} `yaml:"config"`
}
func main() {
stager, err :... | package main
import (
"golang/finalize"
_ "golang/hooks"
"os"
"github.com/cloudfoundry/libbuildpack"
)
type config struct {
Config struct {
GoVersion string `yaml:"GoVersion"`
VendorTool string `yaml:"VendorTool"`
Godep string `yaml:"Godep"`
} `yaml:"config"`
}
func main() {
stager, err := libbui... | Make .profile.d scripts and hooks compatible | Make .profile.d scripts and hooks compatible
- hooks should come before writing to .profile.d directory
[#145118801]
Signed-off-by: Dave Goddard <bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@goddard.id.au>
| Go | apache-2.0 | cloudfoundry/go-buildpack,cloudfoundry/go-buildpack,cloudfoundry/go-buildpack |
e0ec43757f559d041d9bab426d5fa27348f8e964 | river/database/bucket.go | river/database/bucket.go | package database
import (
"github.com/boltdb/bolt"
rss "github.com/hawx/go-pkg-rss"
)
type Bucket interface {
rss.Database
}
type bucket struct {
name string
db *bolt.DB
}
var in []byte = []byte("in")
func (d *bucket) Get(key string) bool {
ok := false
d.db.View(func(tx *bolt.Tx) error {
b := tx.Bucket... | package database
import (
"github.com/boltdb/bolt"
rss "github.com/hawx/go-pkg-rss"
)
type Bucket interface {
rss.Database
}
type bucket struct {
name string
db *bolt.DB
}
var in []byte = []byte("in")
func (d *bucket) Contains(key string) bool {
ok := false
d.db.View(func(tx *bolt.Tx) error {
b := tx.B... | Modify to use simpler database interface | Modify to use simpler database interface
| Go | mit | hawx/riviera |
0e85cffe47bf79b03e6e941c93effa39c1005710 | moebot_bot/bot/commands/timer.go | moebot_bot/bot/commands/timer.go | package commands
import (
"fmt"
"github.com/camd67/moebot/moebot_bot/bot/permissions"
"github.com/camd67/moebot/moebot_bot/util/db"
)
type TimerCommand struct {
ComPrefix string
Checker permissions.PermissionChecker
}
func (tc *TimerCommand) GetPermLevel() db.Permission {
return db.PermAll
}
func (tc *Tim... | package commands
import (
"fmt"
"github.com/camd67/moebot/moebot_bot/util/db"
)
type TimerCommand struct {
}
func (tc *TimerCommand) Execute(pack *CommPackage) {
}
func (tc *TimerCommand) GetPermLevel() db.Permission {
return db.PermAll
}
func (tc *TimerCommand) GetCommandKeys() []string {
return []string{"TI... | Add Execute func and remove unused struct fields (for now) | Add Execute func and remove unused struct fields (for now)
| Go | mit | camd67/moebot,camd67/moebot |
0e8083c6e2d9335d5f90958a0ebcf673965db5ef | db/sqldb.go | db/sqldb.go | package db
import (
"code.cloudfoundry.org/bbs/db/sqldb/helpers"
"code.cloudfoundry.org/bbs/guidprovider"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/locket/models"
)
//go:generate counterfeiter . LockDB
type LockDB interface {
Lock(logger lager.Logger, resource *models.Resource, ttl int64) (*Lock, erro... | package db
import (
"code.cloudfoundry.org/bbs/db/sqldb/helpers"
"code.cloudfoundry.org/bbs/guidprovider"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/locket/models"
)
//go:generate counterfeiter . LockDB
type LockDB interface {
Lock(logger lager.Logger, resource *models.Resource, ttl int64) (*Lock, erro... | Update to QueryableDB to match bbs change | Update to QueryableDB to match bbs change
[#153484100]
Signed-off-by: Brandon Shroyer <d370be3f39cb88690ed16d1a7b77debc20949e86@pivotal.io>
| Go | apache-2.0 | cloudfoundry-incubator/locket |
76812edd35f5cc40af94822b148cff192cffa382 | main_test.go | main_test.go | package main
| package main
import (
"os"
"testing"
)
const ManifestFilename = "test-manifest.yml"
const Manifest string = `---
name: The Project
meta:
team: Project Devs
email: devs@project.com
slack: devs
vars:
- version
- assets_version
- owner
tasks:
- name: Deploy Postgres
manifests:
- postgres-rc
... | Add sample manifest, test ValidateManifests | Add sample manifest, test ValidateManifests
| Go | bsd-3-clause | cored/broadway,macat/broadway,namely/broadway,poopoothegorilla/broadway,namely/broadway,poopoothegorilla/broadway,macat/broadway,cored/broadway,therealplato/broadway,therealplato/broadway |
20401860635e0ab0f225f60d3bd54f1b6f945e29 | probers/memory/probe.go | probers/memory/probe.go | package memory
import (
"bufio"
"errors"
"fmt"
"os"
"strings"
)
var filename string = "/proc/meminfo"
func (p *prober) probe() error {
file, err := os.Open(filename)
if err != nil {
return err
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
if err := p.processMeminfoLine(sc... | package memory
import (
"github.com/Symantec/Dominator/lib/meminfo"
)
func (p *prober) probe() error {
if info, err := meminfo.GetMemInfo(); err != nil {
return err
} else {
p.available = info.Available
p.free = info.Free
p.total = info.Total
}
return nil
}
| Make use of github.com/Symantec/Dominator/lib/meminfo package. | Make use of github.com/Symantec/Dominator/lib/meminfo package.
| Go | apache-2.0 | Symantec/health-agent,Symantec/health-agent,rgooch/health-agent,rgooch/health-agent |
b1c64b7458fff743e194812e8bec6ba90cf30512 | server.go | server.go | package core
import (
"flag"
"net/http"
)
var (
// Production allows handlers know whether the server is running in a production environment.
Production bool
// Address is the TCP network address on which the server is listening and serving. Default is ":8080".
Address = ":8080"
// beforeRun stores a set of ... | package core
import (
"flag"
"net/http"
)
var (
// Production allows handlers know whether the server is running in a production environment.
Production bool
// Address is the TCP network address on which the server is listening and serving. Default is ":8080".
Address = ":8080"
// beforeRun stores a set of ... | Use Production value as flag default | Use Production value as flag default
| Go | mit | volatile/core |
2ff019010fc527968c57c1843dbd4c7455619251 | attributes.go | attributes.go | package saml
// AttributesMap is a type that provides methods for working with SAML
// attributes.
type AttributesMap map[string][]string
// NewAttributesMap creates an attribute map given a third party assertion.
func NewAttributesMap(assertion *Assertion) *AttributesMap {
props := make(AttributesMap)
if assertion... | package saml
// AttributesMap is a type that provides methods for working with SAML
// attributes.
type AttributesMap map[string][]string
// NewAttributesMap creates an attribute map given a third party assertion.
func NewAttributesMap(assertion *Assertion) *AttributesMap {
props := make(AttributesMap)
if assertion... | Fix panic on missing assertion attribute | Fix panic on missing assertion attribute
| Go | mit | goware/saml |
25c8f7dc86a60a06b03f35c23997f10060361823 | persistence/database.go | persistence/database.go | package persistence
var Expressions = map[string]string{
"CreditCard": "(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})+",
"NorthAmericanPhon... | package persistence
var Expressions = map[string]string{
"CreditCard": `\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})+\b`,
"NorthAmerican... | Add extra validation for regular expressions | refactor: Add extra validation for regular expressions
Limit expression applicability based on a word boundary.
This prevents the Phone/SSN expresssions from matching the
credit card numbers.
Signed-off-by: Adrian Oprea <a1b909ec1cc11cce40c28d3640eab600e582f833@codesi.nz>
| Go | agpl-3.0 | opreaadrian/message-masking-service |
7a02e7c1ea77f314d99120807d9fa1c30a75f8b9 | dns/get_dns_zone.go | dns/get_dns_zone.go | package dns
import "github.com/jen20/riviera/azure"
type GetDNSZoneResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]*... | package dns
import "github.com/jen20/riviera/azure"
type GetDNSZoneResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]*... | Add the newly created NameServers to the DNS Get Response | Add the newly created NameServers to the DNS Get Response
| Go | mpl-2.0 | jen20/riviera |
2475b027f23a517871d9222f8eabf27d40381a61 | crawler/config.go | crawler/config.go | package crawler
import (
"time"
)
// Config contains configuration for a Crawler.
type Config struct {
DirEntryBufferSize uint // Size of buffer for processing directory entry channels.
MinUpdateAge time.Duration // The minimum age for items to be updated.
StatTimeout time.Duration // Timeou... | package crawler
import (
"time"
)
// Config contains configuration for a Crawler.
type Config struct {
DirEntryBufferSize uint // Size of buffer for processing directory entry channels.
MinUpdateAge time.Duration // The minimum age for items to be updated.
StatTimeout time.Duration // Timeou... | Increase directory listing buffer size. | Increase directory listing buffer size. | Go | agpl-3.0 | dokterbob/ipfs-search,ipfs-search/ipfs-search,ipfs-search/ipfs-search,dokterbob/ipfs-search,dokterbob/ipfs-search |
8a48f78a1f3d8490871e458b8f7e99ec2ec36927 | server/response/main.go | server/response/main.go | package response
import (
"encoding/json"
"time"
)
type Response interface {
MakeATimestamp()
}
type baseResponse struct {
Command string
Timestamp int64
}
func (r *baseResponse) MakeATimestamp() {
r.Timestamp = time.Now().UnixNano() / 1e6
}
func Send(r Response, sender func([]byte)) error {
r.MakeATimest... | package response
import (
"encoding/json"
"time"
)
type Timestamp int64
type baseResponse struct {
Command string
Timestamp Timestamp
}
func (t *Timestamp) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Now().UnixNano() / 1e6)
}
func Send(r interface{}, sender func([]byte)) error {
serialized, er... | Fix the marshaling of timestamp in response | Fix the marshaling of timestamp in response
| Go | mit | WarCluster/warcluster-server,WarCluster/warcluster-server |
baa50700bfec555fa4c912b4db533b15076be8ce | sqsadaptor/sqsadaptor_test.go | sqsadaptor/sqsadaptor_test.go | package sqsadaptor
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func init() {
}
func TestAdaptorConstruction(t *testing.T) {
testsqs := NewSQSAdaptor("testqueue")
assert.Equal(t, testsqs.QueueURL, "testqueue")
}
func TestJSON(t *testing.T) {
result := Result{
"2016-01-01 10:00:00",
"ex... | package sqsadaptor
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func init() {
}
func TestAdaptorConstruction(t *testing.T) {
testsqs := NewSQSAdaptor("testqueue")
assert.Equal(t, testsqs.QueueURL, "testqueue")
}
func TestJSON(t *testing.T) {
result := Result{
"2016-01-01 10:00:00",
"ex... | Update sqsadaptor test to match implementation | Update sqsadaptor test to match implementation
| Go | mit | zeph/goad,goadapp/goad,goadapp/goad,goadapp/goad,cwaltken-edrans/goad,betabrand/goad,cwaltken-edrans/goad,cwaltken-edrans/goad,zeph/goad,zeph/goad,betabrand/goad |
2c1a2293b76c1edaa42a28fa4aaf8a4ff6fcbc24 | controllers/image.go | controllers/image.go | package controllers
package controllers
import (
"github.com/astaxie/beego"
)
type ImageController struct {
beego.Controller
}
func (this *ImageController) Prepare() {
this.Ctx.Output.Context.ResponseWriter.Header().Set("X-Docker-Registry-Version", beego.AppConfig.String("Version"))
this.Ctx.Output.Context.Resp... | package controllers
import (
"github.com/astaxie/beego"
)
type ImageController struct {
beego.Controller
}
func (this *ImageController) Prepare() {
this.Ctx.Output.Context.ResponseWriter.Header().Set("X-Docker-Registry-Version", beego.AppConfig.String("Version"))
this.Ctx.Output.Context.ResponseWriter.Header... | Fix the package repetition bug | Fix the package repetition bug
| Go | mit | yonh/wharf,yonh/wharf,maquanyi/wharf,maquanyi/wharf,astaxie/docker-registry |
78816ad434b8c60184cf2a46a8c7f17e40f56e99 | compression.go | compression.go | package main
import (
_ "github.com/itchio/wharf/compressors/cbrotli"
_ "github.com/itchio/wharf/decompressors/cbrotli"
)
| package main
import (
_ "github.com/itchio/wharf/compressors/cbrotli"
_ "github.com/itchio/wharf/decompressors/cbrotli"
_ "github.com/itchio/wharf/compressors/gzip"
_ "github.com/itchio/wharf/decompressors/gzip"
)
| Add gzip compressor/decompressor, doesn't seem to make binary any bigger (probably already included somewhere) | Add gzip compressor/decompressor, doesn't seem to make binary any bigger (probably already included somewhere)
| Go | mit | itchio/butler,itchio/butler,itchio/butler |
fa81847c7a3c12eb74bfa73be4e2ed4a96cfb3f5 | src/server/pkg/ppsconsts/ppsconsts.go | src/server/pkg/ppsconsts/ppsconsts.go | // Package ppsconsts constains constants relevant to PPS that are used across
// Pachyderm. In particular, the pipeline spec repo is handled specially by PFS
// and Auth, and those implementations need to refer to its name without
// depending on any other part of PPS. This package contains that and related
// constant... | // Package ppsconsts constains constants relevant to PPS that are used across
// Pachyderm. In particular, the pipeline spec repo is handled specially by PFS
// and Auth, and those implementations need to refer to its name without
// depending on any other part of PPS. This package contains that and related
// constant... | Rename the spec repo to "__spec__" | Rename the spec repo to "__spec__"
This fixes https://github.com/pachyderm/pachyderm/issues/2786
| Go | apache-2.0 | pachyderm/pfs,pachyderm/pfs,pachyderm/pfs |
5b9e03b89e1c77c3130b9e6fce1f40bc889a51ba | webserver/webserver.go | webserver/webserver.go | package webserver
import (
"log"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
cors "github.com/tommy351/gin-cors"
)
func Run(listen string) {
gin.SetMode(gin.DebugMode)
r := gin.New()
r.Use(gin.Recovery())
r.Use(cors.Middleware(cors.Options{
AllowOrigins: []string{"*"},
AllowHeaders:... | package webserver
import (
"log"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
cors "github.com/tommy351/gin-cors"
)
func Run(listen string) {
gin.SetMode(gin.DebugMode)
r := gin.New()
r.Use(gin.Recovery())
r.Use(cors.Middleware(cors.Options{
AllowOrigins: []string{"*"},
AllowHeaders:... | Fix path for static files | Fix path for static files
| Go | mit | RollingBalls/rollingballs-server |
9db810bb337191c53e3c548149c3343c63dbb4cc | net/base.go | net/base.go | package net
func errorLabelValue(err error) string {
if err == nil {
return "0"
}
return "1"
}
| package net
import (
"io"
)
// errorLabelValue returns value for Prometheus metric label "error":
// "ok" for no error, "EOF" for io.EOF, "error" otherwise.
func errorLabelValue(err error) string {
if err == nil {
return "ok"
}
if err == io.EOF {
return "EOF"
}
return "error"
}
| Change values of «error» label. | Change values of «error» label. | Go | mit | gophergala2016/gophers,go-gophers/gophers |
b4109ebcdf58102c456076bf921a45ad396f005c | pkg/auth/dependency/webapp/csrf_middleware.go | pkg/auth/dependency/webapp/csrf_middleware.go | package webapp
import (
"net/http"
"github.com/gorilla/csrf"
)
type CSRFMiddleware struct {
Key string
UseInsecureCookie bool
}
func (m *CSRFMiddleware) Handle(next http.Handler) http.Handler {
gorillaCSRF := csrf.Protect(
[]byte(m.Key),
csrf.Path("/"),
csrf.Secure(!m.UseInsecureCookie),
... | package webapp
import (
"net/http"
"github.com/gorilla/csrf"
"github.com/skygeario/skygear-server/pkg/core/samesite"
)
type CSRFMiddleware struct {
Key string
UseInsecureCookie bool
}
func (m *CSRFMiddleware) Handle(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseW... | Update csrf middleware to detect should send samesite none by checking useragent | Update csrf middleware to detect should send samesite none by checking
useragent
| Go | apache-2.0 | SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
f5bf74361f81fab20c8a59e25f4e7038a05380f1 | lib/mdb/mdbd/api.go | lib/mdb/mdbd/api.go | package mdbd
import (
"github.com/Symantec/Dominator/lib/mdb"
"log"
)
func StartMdbDaemon(mdbFileName string, logger *log.Logger) <-chan *mdb.Mdb {
return startMdbDaemon(mdbFileName, logger)
}
| /*
Package mdbd implements a simple MDB watcher.
Package mdbd may be used to read MDB data from a file and watch for updates.
*/
package mdbd
import (
"github.com/Symantec/Dominator/lib/mdb"
"log"
)
// StartMdbDaemon starts an in-process "daemon" goroutine which watches the
// file named by mdbFileName for MDB u... | Add documentation to lib/mdb/mdbd package. | Add documentation to lib/mdb/mdbd package.
| Go | apache-2.0 | rgooch/Dominator,Symantec/Dominator,keep94/Dominator,Symantec/Dominator,Symantec/Dominator,keep94/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator |
24242869ad8e33abca601771cc9cdc2afa0ab308 | src/storage_node/metadata/field_type_internal.go | src/storage_node/metadata/field_type_internal.go | package metadata
func listInternalFieldTypes() []*FieldType {
return []*FieldType{
&FieldType{
Name: "_bool",
DatamanType: Bool,
},
&FieldType{
Name: "_datetime",
DatamanType: DateTime,
},
&FieldType{
Name: "_document",
DatamanType: Document,
},
&FieldType{
Name... | package metadata
func listInternalFieldTypes() []*FieldType {
return []*FieldType{
&FieldType{
Name: "_bool",
DatamanType: Bool,
},
&FieldType{
Name: "_datetime",
DatamanType: DateTime,
},
&FieldType{
Name: "_document",
DatamanType: Document,
},
&FieldType{
Name... | Remove unused examples (pulled from DB now) | Remove unused examples (pulled from DB now)
| Go | mit | jacksontj/dataman |
772f4b7d84024ec20e8ea646aad468bbf41b2433 | go/libkb/env_test.go | go/libkb/env_test.go | package libkb
import (
"path/filepath"
"testing"
)
func TestEnvDarwin(t *testing.T) {
env := newEnv(nil, nil, "darwin")
runtimeDir := env.GetRuntimeDir()
sockFile, err := env.GetSocketFile()
if err != nil {
t.Fatal(err)
}
t.Logf("%s\n", sockFile)
expectedSockFile := filepath.Join(runtimeDir, "keybased.so... | package libkb
import (
"path/filepath"
"testing"
)
func TestEnvDarwin(t *testing.T) {
env := newEnv(nil, nil, "darwin")
runtimeDir := env.GetRuntimeDir()
sockFile, err := env.GetSocketFile()
if err != nil {
t.Fatal(err)
}
expectedSockFile := filepath.Join(runtimeDir, "keybased.sock")
if sockFile != expec... | Fix vet for env test | Fix vet for env test
| Go | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client |
0d5cd9262469dfe20d5e2845b8001afec7b265b2 | type.go | type.go | package skiplist
import (
"math/rand"
"sync"
)
type elementNode struct {
next []*Element
}
type Element struct {
elementNode
key float64
value interface{}
}
type SkipList struct {
elementNode
maxLevel int
length int
randSource rand.Source
probability float64
probTable []float... | package skiplist
import (
"math/rand"
"sync"
)
type elementNode struct {
next []*Element
}
type Element struct {
elementNode
key float64
value interface{}
}
// Key allows retrieval of the key for a given Element
func (e *Element) Key() float64 {
return e.key
}
// Value allows retrieval of the value for a ... | Allow access to the key and value in Element | Allow access to the key and value in Element
In order for this to be in any way useful, you need to be able to access the value of the element you retrieve.
This change makes the value accessible by exposing Element.Value() and the same for Key() as well. | Go | mit | sean-public/fast-skiplist |
a33f5581aaec1448b58d516ac622991499e4eae6 | petfind/petfind.go | petfind/petfind.go | package petfind
import (
"errors"
"time"
)
var ErrNotFound = errors.New("item not found")
// Pet holds information about each pet of the application.
type Pet struct {
ID int64
Name string
Age int
Added time.Time
}
// Store describes the operations the application needs for persisting and
// retrieving ... | package petfind
import (
"errors"
"time"
)
// ErrNotFound is returned whenever an item does not exist in the Store.
var ErrNotFound = errors.New("item not found")
// Pet holds information about each pet of the application.
type Pet struct {
ID int64
Name string
Age int
Added time.Time
}
// Store describ... | Add doc comment on ErrNotFound and User | Add doc comment on ErrNotFound and User
| Go | mit | psimika/secure-web-app |
ba65a9e5f8f8f152bbf2ab255b2a91a6e540a86e | median_test.go | median_test.go | package statistics
import "testing"
func TestMedian(t *testing.T) {
median, _ := Median([]float64{1,2,3})
if median != 2 {
t.Error("Median must be 2")
}
median, _ = Median([]float64{1,2})
if median != 1.5 {
t.Error("Median must be 1 / 2")
}
median, _ = Median([]float64{1,2,3,4})
if median != 2.5 {
t.E... | package statistics
import "testing"
func TestMedian(t *testing.T) {
median, _ := Median([]float64{1,2,3})
if median != 2 {
t.Error("Median must be 2")
}
median, _ = Median([]float64{1,2})
if median != 1.5 {
t.Error("Median must be 1 / 2")
}
median, _ = Median([]float64{1,2,3,4})
if median != 2.5 {
t.E... | Test for error cases in median | Test for error cases in median
| Go | mit | SiroDiaz/go-statistics |
b3239e49cb77f8dac7bd968d73aab42cfcd51082 | rmsd/doc.go | rmsd/doc.go | /*
Package rmsd implements a version of the Kabsch algorithm that is described
in detail here: http://cnx.org/content/m11608/latest/
A convenience function for computing the RMSD of residue ranges from two PDB
files is also provided.
*/
package rmsd
| /*
Package rmsd implements a version of the Kabsch algorithm to compute the
minimal RMSD between two equal length sets of atoms. The exact algorithm
implement is described in detail here: http://cnx.org/content/m11608/latest/.
A convenience function for computing the RMSD of residue ranges from two PDB
files is also p... | Make first sentence a bit more descriptive. And don't put a link in the first sentence. | Make first sentence a bit more descriptive. And don't put a link in the first sentence.
| Go | mit | TuftsBCB/fragbag |
24458a41f6cf2c042fbe619259bbdae17a9b671e | template/assets/assets.go | template/assets/assets.go | package assets
import (
"fmt"
)
const (
analyticsScript = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,... | package assets
import (
"fmt"
)
const (
analyticsScript = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,... | Add support for including the domain the the analytics asset | Add support for including the domain the the analytics asset
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
fcf2e07e569963afcf198464186b423217f0294b | testhelpers/io/io_test.go | testhelpers/io/io_test.go | package io_test
import (
"os"
. "github.com/cloudfoundry/cli/testhelpers/io"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("io helpers", func() {
It("will never overflow the pipe", func() {
str := ""
for i := 0; i < 75000; i++ {
str += "abc"
}
output := CaptureOutput(func(... | package io_test
import (
"os"
"strings"
. "github.com/cloudfoundry/cli/testhelpers/io"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("io helpers", func() {
It("will never overflow the pipe", func() {
characters := make([]string, 0, 75000)
for i := 0; i < 75000; i++ {
character... | Speed up this test by a factor of a lot | Speed up this test by a factor of a lot
| Go | apache-2.0 | zhang-hua/cli,ofer43211/cli,srikanth88infy/cli,EngineerBetter/cli,diatmpravin/cli,Zouuup/cli,carnell69/cli,HuaweiTech/cli,zhang-hua/cli,AmitRoushan/cli,nttlabs/cli,hyenaspots/cli,ofer43211/cli,mcowger/cli,EngineerBetter/cli,pishro-cc/cli,saravana76/cli,ReachingOut/cli,zhang-hua/cli,zhang-hua/cli,saurabhguptasg/cli,Zouu... |
f2ba04ffa424c283b5dccd12c8dd347cfbfa640c | cmd/containerd/config_linux.go | cmd/containerd/config_linux.go | package main
import (
"github.com/containerd/containerd/server"
)
func defaultConfig() *server.Config {
return &server.Config{
Root: server.DefaultRootDir,
State: server.DefaultStateDir,
GRPC: server.GRPCConfig{
Address: server.DefaultAddress,
},
Debug: server.Debug{
Level: "info",
Address: se... | package main
import (
"github.com/containerd/containerd/server"
)
func defaultConfig() *server.Config {
return &server.Config{
Root: server.DefaultRootDir,
State: server.DefaultStateDir,
GRPC: server.GRPCConfig{
Address: server.DefaultAddress,
},
Subreaper: true,
Debug: server.Debug{
Level: "in... | Set subreaper true in default linux config | Set subreaper true in default linux config
This sets the subreaper to true in the default linux config as the
common usecase is to not run containerd as pid 1.
Signed-off-by: Michael Crosby <951f4c7b5d47e32d0112c78d14a98eaa23e6b5ef@gmail.com>
| Go | apache-2.0 | miaoyq/containerd,vdemeester/containerd,containerd/containerd,mikebrow/containerd,crosbymichael/containerd,dmcgowan/containerd,kunalkushwaha/containerd,thaJeztah/containerd,mikebrow/containerd,vdemeester/containerd,dmcgowan/containerd,thaJeztah/containerd,crosbymichael/containerd,rajasec/containerd,containerd/container... |
0631e1f5e0d86b724410a7dd292551c95d8ccdf7 | ginerus.go | ginerus.go | package ginerus
import (
"fmt"
"time"
"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
)
func Ginerus() gin.HandlerFunc {
return GinerusWithLogger(logrus.StandardLogger())
}
func GinerusWithLogger(logger *logrus.Logger) gin.HandlerFunc {
return func(c *gin.Context) {
start := time.Now()
path := c.R... | package ginerus
import (
"fmt"
"time"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)
func Ginerus() gin.HandlerFunc {
return GinerusWithLogger(logrus.StandardLogger())
}
func GinerusWithLogger(logger *logrus.Logger) gin.HandlerFunc {
return func(c *gin.Context) {
start := time.Now()
path := c.R... | Use lower case import path for logrus | Use lower case import path for logrus
Due to some import problems the author of logrus encourages users to
use all lower case paths. Cf. a [comment on the respective issue on the
logrus
repository](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276)
| Go | mit | stephenmuss/ginerus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.