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 |
|---|---|---|---|---|---|---|---|---|---|
3d928d2370725d7439874ddbbd98f39ca2613d9a | model/Site.go | model/Site.go | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *float64 `json:"lo... | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *... | Add support for storing site preferences within the model. | Add support for storing site preferences within the model.
| Go | mit | ninjasphere/go-ninja,ninjasphere/go-ninja |
84c3d45c2a81ad181d67fba20a52fed5416d6125 | multierror.go | multierror.go | package venom
import (
"reflect"
"github.com/hashicorp/go-multierror"
)
func isNil(e error) bool {
return e == nil || reflect.ValueOf(e).IsNil()
}
func allNil(errs []error) bool {
for _, e := range errs {
if isNil(e) {
continue
}
return false
}
return true
}
//
// Same as multierror.Append but take... | package venom
import (
"reflect"
"github.com/hashicorp/go-multierror"
)
func isNil(e error) bool {
return e == nil || reflect.ValueOf(e).IsNil()
}
func anyNonNil(errs []error) bool {
for _, e := range errs {
if !isNil(e) {
return true
}
}
return false
}
//
// Same as multierror.Append but takes extra ... | Rename function so it makes sense for empty seq | Rename function so it makes sense for empty seq
| Go | mit | themalkolm/venom |
615e6602371f712f5c0377e2786acbec38efb3bd | email-server/server_test.go | email-server/server_test.go | package emailserver
import (
"bytes"
"fmt"
"log"
"net"
"net/mail"
"testing"
"time"
"github.com/TNG/gpg-validation-server/email-client"
)
var received string
func init() {
server := Create("127.0.0.1:2525", mailHandler)
go server.Run()
time.Sleep(1 * time.Millisecond)
}
func mailHandler(origin net.Addr, ... | package emailserver
import (
"bytes"
"fmt"
"log"
"net"
"net/mail"
"testing"
"time"
"github.com/TNG/gpg-validation-server/email-client"
)
var receive_chan = make(chan string)
func init() {
server := Create("127.0.0.1:2525", mailHandler)
go server.Run()
time.Sleep(1 * time.Millisecond)
}
func mailHandler(... | Fix race condition in server-test | Fix race condition in server-test
| Go | apache-2.0 | TNG/gpg-validation-server,TNG/gpg-validation-server,TNG/openpgp-validation-server,TNG/openpgp-validation-server |
4622960835d758f3d87637fe2affd214afec46ba | builtin/bins/provider-localfile/main.go | builtin/bins/provider-localfile/main.go | package main
import (
"github.com/hashicorp/terraform/builtin/providers/localfile"
"github.com/hashicorp/terraform/plugin"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: localfile.Provider,
})
}
| package main
import (
"github.com/hashicorp/terraform/builtin/providers/local"
"github.com/hashicorp/terraform/plugin"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: local.Provider,
})
}
| Fix import path on provider-localfile | Fix import path on provider-localfile
| Go | mpl-2.0 | bashtoni/terraform,kl4w/terraform,hartzell/terraform,ctavan/terraform,tombuildsstuff/terraform,appbricks/ab-terraform-build,hashicorp/terraform,paybyphone/terraform,pgray/terraform,gechr/terraform,vancluever/terraform,travertischio/terraform,cnicolov/terraform,richardc/terraform,hrach/hashicorp-terraform,ewbankkit/terr... |
858978d563eba540f0b0b6c6323b3dad0c4bd603 | csvp_test.go | csvp_test.go | package main
import (
"reflect"
"testing"
)
var parseIndexesListTests = []struct {
list string
indexes []int
}{
// Only one index
{
list: "10",
indexes: []int{10},
},
{
list: "120",
indexes: []int{120},
},
}
func TestParseIndexesList(t *testing.T) {
for _, test := range parseIndexesListTes... | package main
import (
"reflect"
"testing"
)
var parseIndexesListTests = []struct {
list string
indexes []int
}{
// Only one index
{
list: "10",
indexes: []int{10},
},
{
list: "120",
indexes: []int{120},
},
// Multiple indexes
{
list: "10,120",
indexes: []int{10, 120},
},
{
list... | Add case of multiple indexes | Add case of multiple indexes
| Go | mit | kusabashira/csvp |
84564da2b4aabad6c322177a2c4fcd7538e93823 | utils/comparator.go | utils/comparator.go | // Copyright (c) 2015, Emir Pasic. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package utils
// Comparator will make type assertion (see IntComparator for example),
// which will panic if a or b are not of the asserted type.
//
// Should... | // Copyright (c) 2015, Emir Pasic. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package utils
// Comparator will make type assertion (see IntComparator for example),
// which will panic if a or b are not of the asserted type.
//
// Should... | Make IntComparator a bit more direct | Make IntComparator a bit more direct | Go | bsd-2-clause | cagnosolutions/gods |
56933e241087bbb6b97f1787a5ab94dc36b2e262 | newedit/core/signal_source_test.go | newedit/core/signal_source_test.go | // +build !windows,!plan9
package core
import (
"os"
"reflect"
"testing"
"golang.org/x/sys/unix"
)
func TestSignalSource(t *testing.T) {
sigs := NewSignalSource(unix.SIGUSR1)
sigch := sigs.NotifySignals()
collectedCh := make(chan []os.Signal, 1)
go func() {
var collected []os.Signal
for sig := range si... | // +build !windows,!plan9
package core
import (
"testing"
"golang.org/x/sys/unix"
)
func TestSignalSource(t *testing.T) {
sigs := NewSignalSource(unix.SIGUSR1)
sigch := sigs.NotifySignals()
err := unix.Kill(unix.Getpid(), unix.SIGUSR1)
if err != nil {
t.Skip("cannot send SIGUSR1 to myself:", err)
}
if s... | Fix race condition in TestSignalSource. | newedit/core: Fix race condition in TestSignalSource.
| Go | bsd-2-clause | elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish |
4b13bfde1d9d1e5e49aeecb78f6455dfea2250ce | helper/mlock/mlock_linux.go | helper/mlock/mlock_linux.go | // +build linux
package mlock
import "syscall"
func init() {
supported = true
}
func lockMemory() error {
// Mlockall prevents all current and future pages from being swapped out.
return syscall.Mlockall(syscall.MCL_CURRENT | syscall.MCL_FUTURE)
}
| // +build linux
package mlock
import (
"syscall"
"golang.org/x/sys/unix"
)
func init() {
supported = true
}
func lockMemory() error {
// Mlockall prevents all current and future pages from being swapped out.
return unix.Mlockall(syscall.MCL_CURRENT | syscall.MCL_FUTURE)
}
| Switch Linux over to using the `x/sys/unix` package | Switch Linux over to using the `x/sys/unix` package
Same syscall interface, but the `x/sys/unix` package is not frozen. No functional change from this commit.
| Go | mpl-2.0 | danielsomerfield/vault,geckoboard/vault,kingland/vault,andrewstuart/vault,jmhardison/vault,annanay25/vault,joelthompson/vault,joelthompson/vault,lirao/vault,kenbreeman/vault,danielsomerfield/vault,rnaveiras/vault,jam-pot/vault,chrishoffman/vault,hashicorp/vault,doubledutch/vault,wjam/vault,mymercurialsky/vault,quixoten... |
ce7c60d033f289b76f5a46470aff2fe988461b6e | monitor/monitor.go | monitor/monitor.go | package monitor
import "fmt"
// Target is a URL, which has to be polled for availability.
type Target struct {
// Unique identifier of this target. Targets' IDs cannot intercept. Target's
// ID must be constant between GetTargets() calls.
ID uint
// User-supplied target title, used purely for display.
Title stri... | package monitor
import "fmt"
// Target is a URL, which has to be polled for availability.
type Target struct {
// Unique identifier of this target. Targets' IDs cannot intercept. Target's
// ID must be constant between GetTargets() calls.
ID uint
// User-supplied target title, used purely for display.
Title stri... | Add a type of tuple of a Target and a Status | :hammer: Add a type of tuple of a Target and a Status
| Go | mit | yamnikov-oleg/avamon-bot,yamnikov-oleg/avamon-bot |
728aa22336d8d4c8d67bdd2e49b0c150d02c9cdf | mockup.go | mockup.go | package main
import (
"fmt"
"io/ioutil"
"net/http"
)
var mockupResponse string
func init() {
fileContent, _ := ioutil.ReadFile("mockup-response.json")
mockupResponse = string(fileContent)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
fmt.Fprintf(w... | package main
import (
"fmt"
"io/ioutil"
"net/http"
)
var mockupResponse string
func init() {
fileContent, _ := ioutil.ReadFile("mockup-response.json")
mockupResponse = string(fileContent)
}
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
fmt.Fprintf(w... | Make the link directly clickable from terminal | Make the link directly clickable from terminal
| Go | apache-2.0 | Greennav/service-routing |
37b210689082a98536f36f0781e18f732259a13a | templates/content.go | templates/content.go | package templates
func ScopeTemplateContent() string {
return `#cloud-config
{{ .Name}}:
{{ range .Services }}{{ .GetName }}:
{{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
`
}
| package templates
func ScopeTemplateContent() string {
return `#cloud-config
{{ .Name}}:
{{ range .Services }}{{ .GetName }}:
{{ range $key, $value := .GetParameters }}{{ $key }}: {{ $value }}
{{ end }}
{{ end }}units:
{{ range .Units }}- name: {{ .GetName }}
command: {{ .GetCommand }}
{{ end... | Add units to template file | Add units to template file
| Go | apache-2.0 | bernardolins/clustereasy,bernardolins/clustereasy |
e5443e64953484cc1c1231ff426a48b624bf61bb | consumer_test.go | consumer_test.go | package consumer
import (
"testing"
"code.google.com/p/goconf/conf"
)
const configFile = `
[connection]
vhost = /my-domain
user = mark
password = sekret
`
// Test generating URL with defaults.
func TestMakeAmqpUrlWithDefaults(t *testing.T) {
config, _ := conf.ReadConfigBytes([]byte(""))
url := makeAmqpUrl(config... | package consumer
import (
"testing"
"code.google.com/p/goconf/conf"
)
const configFile = `
[connection]
vhost = /my-domain
user = mark
password = sekret
`
// Test generating URL with defaults.
func TestMakeAmqpUrlWithDefaults(t *testing.T) {
config, _ := conf.ReadConfigBytes([]byte(""))
url := makeAmqpUrl(config... | Add test for missing file. | Add test for missing file.
| Go | mit | markstory/go-consumer |
2e560e797e22c44ac628581486d847c2d5bdbd59 | staging/src/k8s.io/apiserver/pkg/server/signal.go | staging/src/k8s.io/apiserver/pkg/server/signal.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, ... | Remove useless named return value | Remove useless named return value
This cleans up the useless named return value stopCh at
SetupSignalHandler().
| Go | apache-2.0 | MikeSpreitzer/kubernetes,sethpollack/kubernetes,BenTheElder/kubernetes,zhangxiaoyu-zidif/kubernetes,BenTheElder/kubernetes,jingxu97/kubernetes,ncdc/kubernetes,kow3ns/kubernetes,fgimenez/kubernetes,goblain/kubernetes,mbohlool/kubernetes,ingvagabund/kubernetes,kow3ns/kubernetes,bizhao/kubernetes,madhanrm/kubernetes,resou... |
f748077496e28404e921b4f9fb699bc8808fd534 | dance.go | dance.go | package goDLX
// Matrix is the fundamental unit in the Algorithm X implementation
// as described in [Knuth, Donald (2000). "Dancing Links". _Millenial Perspectives in Computer Science_. P159 *187*.
// Name and size only apply to columns
type Matrix struct {
L, R, U, D, C *Matrix
Name string
size ... | package goDLX
// Matrix is the fundamental unit in the Algorithm X implementation
// as described in [Knuth, Donald (2000). "Dancing Links". _Millenial Perspectives in Computer Science_. P159 *187*.
// Name and size only apply to columns
type Matrix struct {
L, R, U, D, C *Matrix
Name string
size ... | Add `New()` function for Matrix | Add `New()` function for Matrix
Adds the `New()` function to return an empty `Matrix`. The function
returns a pointer to the root or head element in the matrix.
| Go | bsd-2-clause | jessecarl/goDLX |
7f08592da6b612bf33dda64a404e7f44c5c3cfb8 | request.go | request.go | package ergo
import (
"net/http"
)
type Request struct {
*http.Request
Input map[string]validation.Valuer
pathParams map[string]string
route *Route // route object that matched request
}
func NewRequest(httpRequest *http.Request) *Request {
return &Request{
Request: httpRequest,
Input: map[stri... | package ergo
import (
"net/http"
"github.com/wlMalk/ergo/validation"
)
type Request struct {
*http.Request
Input map[string]validation.Valuer
pathParams map[string]string
route *Route // route object that matched request
}
func NewRequest(httpRequest *http.Request) *Request {
return &Request{
Req... | Implement validation.Requester interface for Request | Implement validation.Requester interface for Request
| Go | mit | wlMalk/ergo |
caea26d17f1165b59b74a039abe49023bcb227d7 | pkg/core/logging/logging.go | pkg/core/logging/logging.go | // Copyright 2015-present Oursky Ltd.
//
// 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 agree... | // Copyright 2015-present Oursky Ltd.
//
// 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 agree... | Use new loggers for every requests | Use new loggers for every requests
refs #1115
| Go | apache-2.0 | SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
15c651b73216daaef24d0b09641511d04cde7970 | common/names.go | common/names.go | package common
import (
"regexp"
)
// RepositoryNameComponentRegexp restricts registtry path components names to
// start with at least two letters or numbers, with following parts able to
// separated by one period, dash or underscore.
var RepositoryNameComponentRegexp = regexp.MustCompile(`[a-z0-9](?:[a-z0-9]+[._-... | package common
import (
"regexp"
)
// RepositoryNameComponentRegexp restricts registtry path components names to
// start with at least two letters or numbers, with following parts able to
// separated by one period, dash or underscore.
var RepositoryNameComponentRegexp = regexp.MustCompile(`[a-z0-9]{2,}(?:[._-][a-z... | Simplify repository name component regexp | Simplify repository name component regexp
| Go | apache-2.0 | anweiss/docker.github.io,tianon/docker-distribution,docker/distribution,xiekeyang/distribution,whyrusleeping/distribution,maquanyi/distribution,shubheksha/docker.github.io,ChenLingPeng/distribution,amitshukla/distribution,LuisBosquez/docker.github.io,orivej/distribution,aduermael/docker.github.io,sallyom/distribution,p... |
a218e85835ec4c5d86366dc153cdcf901c452fc1 | skfe/vm.go | skfe/vm.go | package main
import (
"fmt"
"go.skia.org/infra/go/gce"
"go.skia.org/infra/go/gce/server"
)
func SKFEBase(name, ipAddress string) *gce.Instance {
vm := server.Server20170613(name)
vm.DataDisk = nil
vm.ExternalIpAddress = ipAddress
vm.MachineType = gce.MACHINE_TYPE_STANDARD_4
vm.Metadata["owner_primary"] = "st... | package main
import (
"fmt"
"go.skia.org/infra/go/gce"
"go.skia.org/infra/go/gce/server"
)
func SKFEBase(name string) *gce.Instance {
vm := server.Server20170613(name)
vm.DataDisk = nil
vm.MachineType = gce.MACHINE_TYPE_STANDARD_4
vm.Metadata["owner_primary"] = "stephana"
vm.Metadata["owner_secondary"] = "jc... | Use ephemeral IPs for skfe-{1,2} | Use ephemeral IPs for skfe-{1,2}
Bug: skia:6745
Change-Id: Iabd18d033845da02650f97653d2cb8b95330a2d8
Reviewed-on: https://skia-review.googlesource.com/39503
Commit-Queue: Ravi Mistry <9fa2e7438b8cb730f96b74865492597170561628@google.com>
Reviewed-by: Stephan Altmueller <43343ec95731c0e8daa7359daf7f2f3935582b24@google.c... | 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 |
a160f48f6a4d31796836b3741ba3c48903e68fde | examples/example.go | examples/example.go | package main
import (
"github.com/wjessop/go-piglow"
)
func main() {
var p *piglow.Piglow
var err error
// Create a new Piglow
p, err = piglow.NewPiglow()
if err != nil {
log.Fatal("Couldn't create a Piglow: ", err)
}
// Set LED to brightness 10
p.SetLED(0, 10)
// Set LED to max brightness
p.SetLED(2,... | package main
import (
"github.com/wjessop/go-piglow"
)
func main() {
var p *piglow.Piglow
var err error
// Create a new Piglow
p, err = piglow.NewPiglow()
if err != nil {
panic(err)
}
// Set LED to brightness 10
p.SetLED(0, 10)
// Set LED to max brightness
p.SetLED(2, 255)
// Set all LEDs to brightn... | Fix missing log lib by just panicing | Fix missing log lib by just panicing
| Go | mit | wjessop/go-piglow,Anthony3423/go-piglow |
015644b008dceeb4fc10aaeba280f368910ae44c | handler/api.go | handler/api.go | package handler
import (
"fmt"
"net/http"
"github.com/rafaelsq/roar/async"
"github.com/rafaelsq/roar/cmd"
"github.com/rafaelsq/roar/hub"
)
func API(w http.ResponseWriter, r *http.Request) {
channel := "all"
cmds, ok := r.URL.Query()["cmd"]
if ok {
var fs []async.TypeFunc
output := make(chan string)
do... | package handler
import (
"fmt"
"net/http"
"github.com/rafaelsq/roar/async"
"github.com/rafaelsq/roar/cmd"
"github.com/rafaelsq/roar/hub"
)
func API(w http.ResponseWriter, r *http.Request) {
channel := "all"
cmds, ok := r.URL.Query()["cmd"]
if ok {
var fs []async.TypeFunc
output := make(chan string)
do... | Fix same command running twice | Fix same command running twice
| Go | mit | rafaelsq/roar |
23f371e65aca0ddd0861bce60b0ee83d3de757f8 | goat/doc.go | goat/doc.go | /*
Package goat provides the back-end implementation of a BitTorrent tracker.
*/
package goat
| /*
Package goat provides the back-end implementation of the goat BitTorrent tracker.
*/
package goat
| Fix description for package goat | Fix description for package goat
| Go | mit | mdlayher/goat |
7fed81fcdceffb00d0d2d7cfbf186a236b8f1d5d | model/event_test.go | model/event_test.go | package deje
import "testing"
func TestEventSet_GetRoot_NoElements(t *testing.T) {
set := make(EventSet)
ev := NewEvent("handler_name")
ev.ParentHash = "blah blah blah" // Not already root
_, ok := set.GetRoot(ev)
if ok {
t.Fatal("GetRoot should have failed, but returned ok == true")
}
}
func TestEventSet_G... | package deje
import "testing"
func TestEventSet_GetRoot_NoElements(t *testing.T) {
set := make(EventSet)
ev := NewEvent("handler_name")
ev.ParentHash = "blah blah blah" // Not already root
_, ok := set.GetRoot(ev)
if ok {
t.Fatal("GetRoot should have failed, but returned ok == true")
}
}
func TestEventSet_G... | Improve test coverage - will update for OM later | Improve test coverage - will update for OM later
| Go | lgpl-2.1 | DJDNS/go-deje,DJDNS/go-deje,DJDNS/go-deje,DJDNS/go-deje |
260937103d166300b264f593e0f81e59bcb2a1ae | models/view/user.go | models/view/user.go | package view
import "github.com/pufferpanel/pufferpanel/models"
type UserViewModel struct {
Username string `json:"username"`
Email string `json:"email"`
}
func FromModel(model *models.User) *UserViewModel {
return &UserViewModel{
Username: model.Username,
Email: model.Email,
}
}
func (model *UserView... | package view
import "github.com/pufferpanel/pufferpanel/models"
type UserViewModel struct {
Username string `json:"username"`
Email string `json:"email"`
//ONLY SHOW WHEN COPYING
Password string `json:"password,omitempty"`
}
func FromUser(model *models.User) *UserViewModel {
return &UserViewModel{
Username... | Add ability to set password via view model | Add ability to set password via view model
| Go | apache-2.0 | PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel,PufferPanel/PufferPanel |
6807d9bd4cb18bdbbc60b9feb27a03d3f22a13a7 | cmd/syncthing/upgrade_windows.go | cmd/syncthing/upgrade_windows.go | // +build windows
package main
func upgrade() {
fatalln("Upgrade currently unsupported on Windows")
}
| // +build windows
package main
import "errors"
func upgrade() error {
return errors.New("Upgrade currently unsupported on Windows")
}
| Fix upgrade non-support on Windows | Fix upgrade non-support on Windows
| Go | mpl-2.0 | lkwg82/syncthing,kattunga/syncthing,itscaro/syncthing,jgke/syncthing,roth1002/syncthing,mcanthony/syncthing,rumpelsepp/syncthing,arkhi/syncthing,xduugu/syncthing,flyzjhz/syncthing,michalliu/whale,gillisig/syncthing,canton7/syncthing,printedheart/syncthing,jbfavre/syncthing,kamadak/syncthing,kluppy/syncthing,brgmnn/sync... |
63a7393dd635393cb508c50f2bbe4fe316c2d407 | util/error.go | util/error.go | package util
import "bytes"
type AppError struct {
errors []error
}
func NewError() *AppError {
return &AppError{}
}
func (e *AppError) Append(err error) {
e.errors = append(e.errors, err)
}
func (e *AppError) Error() string {
b := bytes.Buffer{}
for _, err := range e.errors {
b.WriteString(err.Error())
}... | package util
import "bytes"
// AppError represents an error
type AppError struct {
errors []error
}
// NewError returns a pointer of error
func NewError() *AppError {
return &AppError{}
}
// Append appends a new error to the list of errors
func (e *AppError) Append(err error) {
e.errors = append(e.errors, err)
}... | Add comments on exported items of pkg util | Add comments on exported items of pkg util
| Go | mit | mathsalmi/goarch |
f61587872e5fb790befcedcc2a8af2522619bf20 | dataplane/windows/win_dataplane_test.go | dataplane/windows/win_dataplane_test.go | // Copyright (c) 2017 Tigera, 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 appli... | //+build windows
// Copyright (c) 2017-2018 Tigera, 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
//
// U... | Exclude Windows tests from linter. | Exclude Windows tests from linter.
| Go | apache-2.0 | neiljerram/felix,neiljerram/felix,Metaswitch/calico,Metaswitch/calico,neiljerram/felix,neiljerram/felix |
6f24c2f9b2eb585b30f1cb3fa5e147875bbd0358 | config/run_config.go | config/run_config.go | package config
import (
"github.com/hatofmonkeys/cloudfocker/utils"
)
type RunConfig struct {
ContainerName string
ImageTag string
PublishedPorts map[int]int
Mounts map[string]string
Command []string
Daemon bool
}
func NewStageRunConfig(cloudfoundryAppDir string) (runConfig *RunConf... | package config
import (
"github.com/hatofmonkeys/cloudfocker/utils"
)
type RunConfig struct {
ContainerName string
ImageTag string
PublishedPorts map[int]int
Mounts map[string]string
Command []string
Daemon bool
}
func NewStageRunConfig(cloudfoundryAppDir string) (runConfig *RunConf... | Make executable directory name consistent | Make executable directory name consistent
| Go | apache-2.0 | CloudCredo/cloudrocker,agilemobiledev/cloudfocker,agilemobiledev/cloudfocker,agilemobiledev/cloudfocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,agilemobiledev/cloudfocker,CloudCredo/cloudrocker,CloudCredo/cloudrocker,CloudCredo/cloudrock... |
7e0a2d1baf29cc5ffc996d27937feabceb3dcff1 | snappy.go | snappy.go | package sarama
import (
"bytes"
"code.google.com/p/snappy-go/snappy"
"encoding/binary"
)
var snappyMagic = []byte{130, 83, 78, 65, 80, 80, 89, 0}
// SnappyEncode encodes binary data
func snappyEncode(src []byte) ([]byte, error) {
return snappy.Encode(nil, src)
}
// SnappyDecode decodes snappy data
func snappyDe... | package sarama
import (
"bytes"
"github.com/golang/snappy/snappy"
"encoding/binary"
)
var snappyMagic = []byte{130, 83, 78, 65, 80, 80, 89, 0}
// SnappyEncode encodes binary data
func snappyEncode(src []byte) ([]byte, error) {
return snappy.Encode(nil, src)
}
// SnappyDecode decodes snappy data
func snappyDecod... | Change dependency URL for Snappy | Change dependency URL for Snappy
[Snappy has been migrated from Google Code to GitHub](https://github.com/golang/snappy/commit/eaa750b9bf4dcb7cb20454be850613b66cda3273). If you try to `go get` with the code.google.com URL in place, `go get` chokes because of the 302 redirect.
Upstream, Shopify did the same thing [h... | Go | mit | gyroscope-innovations/legacy_sarama,gyroscope-innovations/legacy_sarama |
f756a0b3116e3d0be27ca61fb8960bfa4647360f | log/tty.go | log/tty.go | // +build !appengine
package log
import (
"io"
"os"
"syscall"
"unsafe"
)
func isatty(w io.Writer) bool {
if ioctlReadTermios != 0 {
if f, ok := w.(*os.File); ok {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(f.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termi... | // +build !appengine
package log
import (
"io"
"os"
"syscall"
"unsafe"
)
func isatty(w io.Writer) bool {
if os.Getenv("GONDOLA_FORCE_TTY") != "" {
return true
}
if ioctlReadTermios != 0 {
if f, ok := w.(*os.File); ok {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uint... | Allow forcing colored logging via env variable | Allow forcing colored logging via env variable
Will soon be used by the dev server
| Go | mpl-2.0 | rainycape/gondola,rainycape/gondola,rainycape/gondola,rainycape/gondola |
0f14a621cd0e46c39f7ba7b1caf55b0ad76ecd3f | thirdparty/gomocktestreporter/gomock_test_reporter.go | thirdparty/gomocktestreporter/gomock_test_reporter.go | /*
The gomocktestreporter package provides a Ginkgo friendly implementation of [Gomock's](https://code.google.com/p/gomock/) `TestReporter` interface.
More details and a code example are [here](http://onsi.github.io/ginkgo/#integrating_with_gomock).
*/
package gomocktestreporter
import (
"fmt"
"github.com/onsi/gink... | /*
The gomocktestreporter package provides a Ginkgo friendly implementation of [Gomock's](https://code.google.com/p/gomock/) `TestReporter` interface.
More details and a code example are [here](http://onsi.github.io/ginkgo/#integrating_with_gomock).
*/
package gomocktestreporter
import (
"fmt"
"github.com/onsi/gink... | Fix bug in the GomockTestReporter | Fix bug in the GomockTestReporter
The variadic function arguments where passed as array instead of a
regular list of arguments. See http://golang.org/doc/effective_go.html#Printing
for more details.
| Go | mit | fschl/ginkgo,justintung/ginkgo,yaoshipu/ginkgo,onsi/ginkgo,ixdy/ginkgo,alvinvarghese/ginkgo,onsi/ginkgo |
c620733bd20e3b523cb8ee48fa13d14ba3e1f6e7 | examples/tictactoe/components.go | examples/tictactoe/components.go | package tictactoe
import (
"github.com/jkomoros/boardgame"
)
const (
X = "X"
O = "O"
)
type playerToken struct {
Value string
}
func (p *playerToken) Props() []string {
return boardgame.PropertyReaderPropsImpl(p)
}
func (p *playerToken) Prop(name string) interface{} {
return boardgame.PropertyReaderPropImpl(... | package tictactoe
import (
"github.com/jkomoros/boardgame"
)
const (
X = "X"
O = "O"
)
type playerToken struct {
Value string
}
func (p *playerToken) Props() []string {
return boardgame.PropertyReaderPropsImpl(p)
}
func (p *playerToken) Prop(name string) interface{} {
return boardgame.PropertyReaderPropImpl(... | Define playerTokenValues(), designed to be used with stack.ComponentValues() | Define playerTokenValues(), designed to be used with stack.ComponentValues()
| Go | apache-2.0 | jkomoros/boardgame,jkomoros/boardgame,jkomoros/boardgame |
40809336d676a25237a2619bb7fb94849213a529 | agents/go-agents/core/rest/errors.go | agents/go-agents/core/rest/errors.go | //
// Copyright (c) 2012-2018 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API a... | //
// Copyright (c) 2012-2018 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
// Contributors:
// Red Hat, Inc. - initial API a... | Add 500 error to the rest framework for go agents | Add 500 error to the rest framework for go agents
Signed-off-by: Oleksandr Garagatyi <4052944973da826587020fa2673f873866877623@redhat.com>
| Go | epl-1.0 | akervern/che,akervern/che,davidfestal/che,davidfestal/che,davidfestal/che,akervern/che,davidfestal/che,akervern/che,davidfestal/che,codenvy/che,codenvy/che,davidfestal/che,akervern/che,akervern/che,akervern/che,davidfestal/che,davidfestal/che,davidfestal/che,codenvy/che,akervern/che,codenvy/che,davidfestal/che,akervern... |
a1b0731a176c14ba625e2e8da1374af190703a17 | network/compression_test.go | network/compression_test.go | package network
import (
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCompressDecompress(t *testing.T) {
data := []byte(randomString(1000))
compressor := NewCompressor()
compressedBytes, err := compressor.Compress(data)
assert.NoError(t, err)
decompressedBytes, err := compressor.De... | package network
import (
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCompressDecompress(t *testing.T) {
data := []byte(randomString(1000))
compressor := NewCompressor()
compressedBytes, err := compressor.Compress(data)
assert.NoError(t, err)
decompressedBytes, err := compressor.De... | Add tests for IsCompressable and IsCompressed | Add tests for IsCompressable and IsCompressed
| Go | bsd-3-clause | ava-labs/avalanchego,ava-labs/avalanchego |
9797048599da5d705d69e420c9217e2d5346d051 | observers/snake_observer.go | observers/snake_observer.go | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/corpse"
"github.com/ivan1993spb/snake-server/objects/snake"
"github.com/ivan1993spb/snake-server/world"
)
const chanSnakeObserverEventsBuffer = 32
type SnakeObserver struct{}
func (SnakeObserver) Observe(stop <... | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/corpse"
"github.com/ivan1993spb/snake-server/objects/snake"
"github.com/ivan1993spb/snake-server/world"
)
const chanSnakeObserverEventsBuffer = 64
type SnakeObserver struct{}
func (SnakeObserver) Observe(stop <... | Increase chan buffer size in snake observer | Increase chan buffer size in snake observer
| Go | bsd-2-clause | ivan1993spb/clever-snake |
0d6d4b71518c0ad0827307dbdca903ebe87d592f | util/util.go | util/util.go | // Package util contains utility functions
package util
import "errors"
func StoreImage(image []byte) (sha string, overridden bool, err error) {
return "", false, errors.New("Not implemented")
}
| // Package util contains utility functions
package util
import "errors"
func StoreImage(image []byte) (sha string, overridden bool, err error) {
return "", false, errors.New("Not implemented")
}
func RetrieveImage(sha string) (image []byte, err error) {
return []byte{0}, errors.New("Not implemented")
}
| Add function declaration of RetrieveImage | Add function declaration of RetrieveImage
| Go | bsd-2-clause | raumzeitlabor/pingied |
233817850f542568cdd7ba799d7b17cf61ac7655 | runner/runner.go | runner/runner.go | package runner
import (
"net/http"
"fmt"
"sync"
"bytes"
"github.com/dudang/golt/parser"
)
var wg sync.WaitGroup
type httpRequest func(string) (*http.Response, error)
func ExecuteGoltTest(goltTest parser.Golt) {
for _, element := range goltTest.Golt {
executeElement(element)
}
}
func executeElement(element ... | package runner
import (
"net/http"
"fmt"
"sync"
"bytes"
"github.com/dudang/golt/parser"
)
var wg sync.WaitGroup
var httpClient = &http.Client{}
func ExecuteGoltTest(goltTest parser.Golt) {
for _, element := range goltTest.Golt {
executeElement(element)
}
}
func executeElement(element parser.GoltJson) {
wg... | Make a static HTTP Client to re-use TCP connections | Make a static HTTP Client to re-use TCP connections
| Go | mit | dudang/golt |
c8a502f5c1a9fae75095b776e04265bf8cc470a7 | handler.go | handler.go | package atcclient
import "github.com/concourse/atc"
//go:generate counterfeiter . Handler
type Handler interface {
// AbortBuild()
// BuildEvents()
// CreateBuild()
// CreatePipe()
// DeletePipeline()
// DownloadCLI()
// GetConfig()
// HijackContainer()
// ListContainer()
// ListJobInputs()
// R... | package atcclient
import "github.com/concourse/atc"
//go:generate counterfeiter . Handler
type Handler interface {
// AbortBuild()
// BuildEvents()
// CreateBuild()
// CreatePipe()
// DeletePipeline()
// DownloadCLI()
// HijackContainer()
// ListContainer()
// ListJobInputs()
// ReadPipe()
// Sa... | Use atcHandler.PipelineConfig instead of GetConfig | Use atcHandler.PipelineConfig instead of GetConfig
[#105155444]
Signed-off-by: Evan Short <5b1db704470d35a058f1f4a9e1a5a172a6ea69d3@pivotal.io>
| Go | apache-2.0 | concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse,concourse/concourse |
6adc582934d32dc97710ed04cefa61ac25d4823e | example_read_test.go | example_read_test.go | package xlsx
import "fmt"
func ExampleRow_ReadStruct() {
//example type
type structTest struct {
IntVal int `xlsx:"0"`
StringVal string `xlsx:"1"`
FloatVal float64 `xlsx:"2"`
IgnoredVal int `xlsx:"-"`
BoolVal bool `xlsx:"4"`
}
structVal := structTest{
IntVal: 16,
StringVal:... | package xlsx
import "fmt"
func ExampleRow_ReadStruct() {
//example type
type structTest struct {
IntVal int `xlsx:"0"`
StringVal string `xlsx:"1"`
FloatVal float64 `xlsx:"2"`
IgnoredVal int `xlsx:"-"`
BoolVal bool `xlsx:"4"`
}
structVal := structTest{
IntVal: 16,
StringVal:... | Fix documentation example showing use of ReadStruct | Fix documentation example showing use of ReadStruct
Logic flow was inverted. Example was printing the result when an
error was occurring and using panic when no error.
| Go | bsd-3-clause | ryho/xlsx |
0806ec3e8971f6e54f2363a2a3255b9e741ae3cc | decoder.go | decoder.go | package drum
// DecodeFile decodes the drum machine file found at the provided path
// and returns a pointer to a parsed pattern which is the entry point to the
// rest of the data.
// TODO: implement
func DecodeFile(path string) (*Pattern, error) {
p := &Pattern{}
return p, nil
}
// Pattern is the high level repre... | package drum
import (
"encoding/binary"
"encoding/hex"
"fmt"
"os"
)
// DecodeFile decodes the drum machine file found at the provided path
// and returns a pointer to a parsed pattern which is the entry point to the
// rest of the data.
// TODO: implement
func DecodeFile(path string) (*Pattern, error) {
fmt.Pri... | Read binary data from file | Read binary data from file
| Go | unlicense | kurtis99/chalange1 |
fb8e2d8392fde635513db46c9848c59a733cdb79 | gorepost.go | gorepost.go | package main
import (
"fmt"
"log"
"os"
"github.com/arachnist/gorepost/bot"
"github.com/arachnist/gorepost/config"
"github.com/arachnist/gorepost/irc"
)
func main() {
var exit chan struct{}
config, err := config.ReadConfig(os.Args[1])
if err != nil {
fmt.Println("Error reading configuration from", os.Args... | package main
import (
"log"
"os"
"github.com/arachnist/gorepost/bot"
"github.com/arachnist/gorepost/config"
"github.com/arachnist/gorepost/irc"
)
func main() {
var exit chan struct{}
if len(os.Args) < 2 {
log.Fatalln("Usage:", os.Args[0], "<config-file.json>")
}
config, err := config.ReadConfig(os.Args[1... | Print a nicer error messages on startup | Print a nicer error messages on startup
| Go | mit | arachnist/gorepost |
ae61bf9b3d624291895a480d820079d88e0d6acb | common.go | common.go | package rabbithole
// Extra arguments as a map (on queues, bindings, etc)
type Properties map[string]interface{}
// Port used by RabbitMQ or clients
type Port int
// Rate of change of a numerical value
type RateDetails struct {
Rate float32 `json:"rate"`
}
// RabbitMQ context (Erlang app) running on
// a node
type... | package rabbithole
import "strconv"
// Extra arguments as a map (on queues, bindings, etc)
type Properties map[string]interface{}
// Port used by RabbitMQ or clients
type Port int
func (p *Port) UnmarshalJSON(b []byte) error {
stringValue := string(b)
var parsed int64
var err error
if stringValue[0] == '"' && s... | Handle when rabbitmq sends a port value in a string | Handle when rabbitmq sends a port value in a string
| Go | bsd-2-clause | michaelklishin/rabbit-hole,loafoe/rabbit-hole,loafoe/rabbit-hole,signalvine/rabbit-hole,signalvine/rabbit-hole,michaelklishin/rabbit-hole |
c71659b79f86235d9630d7805ef55f9f957df4a7 | subvert.go | subvert.go | package main
import (
"regexp"
"strings"
)
var (
branches = regexp.MustCompile(`(?:[^,\\]|\\.)*`)
)
func newMatcher(pat string) (*regexp.Regexp, error) {
sp := branches.FindAllString(pat, -1)
for i := 0; i < len(sp); i++ {
sp[i] = strings.Replace(sp[i], `\,`, `,`, -1)
sp[i] = regexp.QuoteMeta(sp[i])
}
pat... | package main
import (
"regexp"
"strconv"
"strings"
)
var (
branches = regexp.MustCompile(`(?:[^,\\]|\\.)*`)
)
func newMatcher(pat string) (m *regexp.Regexp, err error) {
pat = strings.Replace(pat, `\,`, `\\,`, -1)
pat = `"` + pat + `"`
pat, err = strconv.Unquote(pat)
if err != nil {
return nil, err
}
sp ... | Implement unquote special values in newMatcher | Implement unquote special values in newMatcher
| Go | mit | kusabashira/msub |
346a898ba89a7450ef30c08910db8756111a9fcc | version.go | version.go | package specs
import "fmt"
const (
// VersionMajor is for an API incompatible changes
VersionMajor = 0
// VersionMinor is for functionality in a backwards-compatible manner
VersionMinor = 2
// VersionPatch is for backwards-compatible bug fixes
VersionPatch = 0
)
// Version is the specification version that th... | package specs
import "fmt"
const (
// VersionMajor is for an API incompatible changes
VersionMajor = 0
// VersionMinor is for functionality in a backwards-compatible manner
VersionMinor = 2
// VersionPatch is for backwards-compatible bug fixes
VersionPatch = 0
)
// Version is the specification version that the... | Fix an extra space in VersionMinor | Fix an extra space in VersionMinor
Signed-off-by: Mrunal Patel <d389837b018b67489df74a2c5f0aca13aaed44b6@gmail.com>
| Go | apache-2.0 | wking/opencontainer-runtime-spec,hqhq/runtime-spec,hqhq/specs,ujuc/specs,jonboulle/specs,gao-feng/specs,opencontainers/runtime-spec,runcom/specs,laijs/specs,wangkirin/specs,wking/opencontainer-specs,vbatts/specs,marcosnils/specs,opencontainers/specs,cloudfoundry-incubator/specs,ChengTiesheng/specs |
179fab7f015a5446d66a4608d09a5a156c0aea8e | models/dump_token_test.go | models/dump_token_test.go | package models_test
import (
"encoding/json"
"github.com/herald-it/goncord/models"
"testing"
)
func TestNewDumpTokenModel(t *testing.T) {
dump_token := &models.DumpToken{}
if dump_token == nil {
t.Fatal("Nil pointer after create new dump token")
}
}
func TestJsonDumpTokenModel(t *testing.T) {
dump_token :=... | package models_test
import (
"encoding/json"
"github.com/herald-it/goncord/models"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNewDumpTokenModel(t *testing.T) {
dump_token := &models.DumpToken{}
Convey("Create new dump token", t, func() {
So(dump_token, ShouldNotBeNil)
})
}
func TestJ... | Change test fraemwork on Convey. | Change test fraemwork on Convey.
| Go | mit | herald-it/goncord |
086a8ea8eb2069966e2b9d6fbb19c3cd39e5ea48 | agent/consul/state/operations_oss.go | agent/consul/state/operations_oss.go | // +build !consulent
package state
import (
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/go-memdb"
)
func firstWithTxn(tx *txn,
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (interface{}, error) {
return tx.First(table, index, idxVal)
}
func firstWatchWithTxn(tx *txn,
tabl... | // +build !consulent
package state
import (
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/go-memdb"
)
func firstWithTxn(tx ReadTxn,
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (interface{}, error) {
return tx.First(table, index, idxVal)
}
func firstWatchWithTxn(tx ReadTxn,... | Use ReadTxn interface in state store helper functions | Use ReadTxn interface in state store helper functions
| Go | mpl-2.0 | hashicorp/consul,hashicorp/consul,hashicorp/consul,hashicorp/consul |
5f096880765e74e26b2ed21033fe975d87ef904a | h2spec.go | h2spec.go | package h2spec
import (
"fmt"
"time"
"github.com/summerwind/h2spec/config"
"github.com/summerwind/h2spec/http2"
"github.com/summerwind/h2spec/log"
"github.com/summerwind/h2spec/reporter"
"github.com/summerwind/h2spec/spec"
)
func Run(c *config.Config) error {
failed := false
specs := []*spec.TestGroup{
h... | package h2spec
import (
"fmt"
"time"
"github.com/summerwind/h2spec/config"
"github.com/summerwind/h2spec/http2"
"github.com/summerwind/h2spec/log"
"github.com/summerwind/h2spec/reporter"
"github.com/summerwind/h2spec/spec"
)
func Run(c *config.Config) error {
total := 0
failed := false
specs := []*spec.Te... | Print messagen if there is no matched test | Print messagen if there is no matched test
| Go | mit | summerwind/h2spec |
61a412ea773bbda0e073689739363defe58cdd15 | plugins/ipam/static/static_suite_test.go | plugins/ipam/static/static_suite_test.go | // Copyright 2018 CNI 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 ... | // Copyright 2018 CNI 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 ... | Align test suite name with others | Align test suite name with others
| Go | apache-2.0 | containernetworking/plugins,containernetworking/plugins |
04b72b4a7ddd37d4615f4fcc125211ee93518780 | terraform/vsphere/template_generator.go | terraform/vsphere/template_generator.go | package vsphere
import (
"fmt"
"github.com/cloudfoundry/bosh-bootloader/storage"
)
type TemplateGenerator struct{}
func NewTemplateGenerator() TemplateGenerator {
return TemplateGenerator{}
}
func (t TemplateGenerator) Generate(state storage.State) string {
return fmt.Sprintf(`
variable "vsphere_subnet" {}
var... | package vsphere
import (
"fmt"
"github.com/cloudfoundry/bosh-bootloader/storage"
)
type TemplateGenerator struct{}
func NewTemplateGenerator() TemplateGenerator {
return TemplateGenerator{}
}
func (t TemplateGenerator) Generate(state storage.State) string {
return fmt.Sprintf(`
variable "vsphere_subnet" {}
var... | Remove default for director & jb ip in vsphere terraform template | Remove default for director & jb ip in vsphere terraform template
- The defaults are now provided via the input generator.
[#152908821]
Signed-off-by: Genevieve LEsperance <1b6a7b865633211adcfeed81fa254bd2ba36f0db@pivotal.io>
| Go | apache-2.0 | pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader,pivotal-cf-experimental/bosh-bootloader,niroyb/bosh-bootloader |
3e1377d6c5f151b9c4ed74b618fa17ac2f28f73f | cmd/shield/utils.go | cmd/shield/utils.go | package main
import (
"fmt"
"os"
"strings"
)
func BoolString(tf bool) string {
if tf {
return "Y"
}
return "F"
}
func CurrentUser() string {
return fmt.Sprintf("%s@%s", os.Getenv("USER"), os.Getenv("HOSTNAME"))
}
func DEBUG(format string, args ...interface{}) {
if debug {
content := fmt.Sprintf(format, ... | package main
import (
"fmt"
"os"
"strings"
)
func BoolString(tf bool) string {
if tf {
return "Y"
}
return "N"
}
func CurrentUser() string {
return fmt.Sprintf("%s@%s", os.Getenv("USER"), os.Getenv("HOSTNAME"))
}
func DEBUG(format string, args ...interface{}) {
if debug {
content := fmt.Sprintf(format, ... | Fix stupid bug with true/false = Y/N | Fix stupid bug with true/false = Y/N
not Y/F. duh.
| Go | mit | starkandwayne/shield,karampok/shield,karampok/shield,starkandwayne/shield,starkandwayne/shield,starkandwayne/shield,karampok/shield,karampok/shield,starkandwayne/shield |
7b0246d6001a77456311381e3d9fc8ca3ef8dc6b | app/socket/handler.go | app/socket/handler.go | package socket
import (
"time"
"net/http"
"github.com/gorilla/websocket"
"app/hub"
"app/message"
)
var upgrader = websocket.Upgrader{}
func writeSocket(socket *websocket.Conn, c hub.Connection) {
defer socket.Close()
for {
m := <- c.Out
socket.WriteJSON(&m)
}
}
// Ha... | package socket
import (
"time"
"net/http"
"github.com/gorilla/websocket"
"app/hub"
"app/message"
)
var upgrader = websocket.Upgrader{}
func writeSocket(socket *websocket.Conn, c hub.Connection) {
defer socket.Close()
for {
m := <- c.Out
socket.WriteJSON(&m)
}
}
// Ha... | Clean up all subscriptions when socket closes | Clean up all subscriptions when socket closes
| Go | mit | exitcodezero/picloud,exitcodezero/pi-cloud-sockets |
7868d5a2cbfe2b6c4d72dffa0852693b21f56f75 | transport/transport.go | transport/transport.go | package transport
import (
"time"
)
type Message struct {
Header map[string]string
Body []byte
}
type Socket interface {
Recv(*Message) error
Send(*Message) error
Close() error
}
type Client interface {
Recv(*Message) error
Send(*Message) error
Close() error
}
type Listener interface {
Addr() string
C... | package transport
import (
"time"
)
type Message struct {
Header map[string]string
Body []byte
}
type Socket interface {
Recv(*Message) error
Send(*Message) error
Close() error
}
type Client interface {
Socket
}
type Listener interface {
Addr() string
Close() error
Accept(func(Socket)) error
}
// Tran... | Use Socket in the Client interface | Use Socket in the Client interface
| Go | apache-2.0 | myodc/go-micro,uffy/go-micro,Taik/go-micro,divisionone/go-micro,micro/go-micro |
62003f275bbb631f05b88dfb1c8f44093d7b886d | cli/add_test.go | cli/add_test.go | package cli
import (
"os"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
func ExampleAddCommand() {
os.Setenv("AWS_ACCESS_KEY_ID", "llamas")
os.Setenv("AWS_SECRET_ACCESS_KEY", "rock")
os.Setenv("AWS_VAULT_BACKEND", "file")
os.Setenv("AWS_VAULT_FILE_PASSPHRASE", "password")
defer os.Unsetenv("AWS_ACCESS_KEY_ID")
... | package cli
import (
"io/ioutil"
"log"
"os"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
func ExampleAddCommand() {
f, err := ioutil.TempFile("", "aws-config")
if err != nil {
log.Fatal(err)
}
defer os.Remove(f.Name())
os.Setenv("AWS_CONFIG_FILE", f.Name())
os.Setenv("AWS_ACCESS_KEY_ID", "llamas")
os.Set... | Use temp config for add test | Use temp config for add test
| Go | mit | 99designs/aws-vault,99designs/aws-vault |
de01d92eb27daed54246a7c106d55df10764ffbb | scripts.go | scripts.go | package gen
func entryScript() string {
return `
var system=sys();
`
}
| package gen
func entryScript() string {
return `
var system=sys();
var Tpl={};
Tpl.funcs={};
Tpl.funcs.world=function(name){
return name+",world"
}
Tpl.getTplFuncs=function(){
var rst=[]
for (var prop in Tpl.funcs){
if (Tpl.funcs.hasOwnProperty(prop)){
rst.push(prop)
}
}
return rst
}
`
}
| Add Tpl to the entry script | Add Tpl to the entry script
| Go | mit | gernest/wuxia,gernest/wuxia,gernest/wuxia,gernest/wuxia |
17d372677d08cf2a9a4c0f83807f20fcfb182de7 | zcl/json/didyoumean.go | zcl/json/didyoumean.go | package json
import (
"github.com/agext/levenshtein"
)
var keywords = []string{"false", "true", "null"}
// keywordSuggestion tries to find a valid JSON keyword that is close to the
// given string and returns it if found. If no keyword is close enough, returns
// the empty string.
func keywordSuggestion(given strin... | package json
import (
"github.com/agext/levenshtein"
)
var keywords = []string{"false", "true", "null"}
// keywordSuggestion tries to find a valid JSON keyword that is close to the
// given string and returns it if found. If no keyword is close enough, returns
// the empty string.
func keywordSuggestion(given strin... | Generalize "keywordSuggestion" for general name suggestions | json: Generalize "keywordSuggestion" for general name suggestions
keywordSuggestion is now a wrapper around nameSuggestion with a predefined
list of names.
| Go | mpl-2.0 | zclconf/go-zcl,strivecast/hcl,strivecast/hcl,hashicorp/hcl,hashicorp/hcl,zclconf/go-zcl,strivecast/hcl,hashicorp/hcl,hashicorp/hcl,hashicorp/hcl,strivecast/hcl,zclconf/go-zcl,strivecast/hcl |
d510b15dbd2fae76f34f77cd28e909714d0138d5 | matrix.go | matrix.go | /*
Package "matrix" provides types and operations for matrix manipulation.
*/
package matrix
type Matrix interface {
// Return the shape of matrix, which consists of the "rows" and the "columns".
Shape() (rows, columns int)
// Return the "rows" of matrix.
Rows() (rows int)
// Return the "columns" of matrix.
Co... | /*
Package "matrix" provides types and operations for matrix manipulation.
*/
package matrix
type Matrix interface {
// Return the shape of matrix, which consists of the "rows" and the "columns".
Shape() (rows, columns int)
// Return the "rows" of matrix.
Rows() (rows int)
// Return the "columns" of matrix.
Co... | Create "Row" interface and "Column" interface. | Create "Row" interface and "Column" interface.
| Go | mit | mitsuse/matrix-go,jmptrader/matrix-go |
f24763d3ccb248ab488e8c54b3ed9f7cea800c41 | cgo/cgo_main_noop.go | cgo/cgo_main_noop.go | // +build lambdabinary,noop
package cgo
import (
"net/http"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
sparta "github.com/mweagle/Sparta"
)
////////////////////////////////////////////////////////////////////////////////
// cgoMain is the primary entrypoint for the libra... | // +build lambdabinary,noop
package cgo
import (
"net/http"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
sparta "github.com/mweagle/Sparta"
)
////////////////////////////////////////////////////////////////////////////////
// cgoMain is the primary entrypoint for the libra... | Update signature for NOP codepath | Update signature for NOP codepath
| Go | mit | mweagle/Sparta,mweagle/Sparta,mweagle/Sparta,mweagle/Sparta |
deb88ae0d23bbe747a6a1859fb106131c333d14c | app/tlsh.go | app/tlsh.go | package main
import (
"flag"
"fmt"
"os"
"github.com/glaslos/tlsh"
)
var (
// VERSION is set by the makefile
VERSION = "v0.0.0"
// BUILDDATE is set by the makefile
BUILDDATE = ""
)
func main() {
var file = flag.String("f", "", "path to the file to be hashed")
var raw = flag.Bool("r", false, "set to get onl... | package main
import (
"flag"
"fmt"
"os"
"github.com/glaslos/tlsh"
)
var (
// VERSION is set by the makefile
VERSION = "v0.0.0"
// BUILDDATE is set by the makefile
BUILDDATE = ""
)
func main() {
var file = flag.String("f", "", "path to the `file` to be hashed")
var raw = flag.Bool("r", false, "set to get o... | Set parameter name for flag | Set parameter name for flag
| Go | apache-2.0 | glaslos/tlsh |
24bc903ce757644948a2a8d805bb960c16486fef | master/cluster_allocator_pq.go | master/cluster_allocator_pq.go | package master
type pqSlice struct {
Slice []interface{}
LessComparator func(i, j interface{}) bool
}
func (s pqSlice) Len() int {
return len(s.Slice)
}
func (s pqSlice) Less(left, right int) bool {
return s.LessComparator(s.Slice[left], s.Slice[right])
}
func (s *pqSlice) Swap(i, j int) {
s.Slice[i],... | package master
type pqSlice struct {
Slice []interface{}
LessComparator func(i, j interface{}) bool
}
func (s pqSlice) Len() int {
return len(s.Slice)
}
func (s pqSlice) Less(left, right int) bool {
return s.LessComparator(s.Slice[left], s.Slice[right])
}
func (s *pqSlice) Swap(i, j int) {
s.Slice[i],... | Use call-by-reference methods for Push and Pop | Use call-by-reference methods for Push and Pop
| Go | mit | KIT-MAMID/mamid,KIT-MAMID/mamid,KIT-MAMID/mamid,KIT-MAMID/mamid,KIT-MAMID/mamid |
ce73256b8ecfdd14428bee5977c453906fc4148a | python/util.go | python/util.go | package python
import (
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"sourcegraph.com/sourcegraph/toolchain"
)
func runCmdLogError(cmd *exec.Cmd) {
err := runCmdStderr(cmd)
if err != nil {
log.Printf("Error running `%s`: %s", strings.Join(cmd.Args, " "), err)
}
}
func runCmdStderr(cmd *exec.Cmd) error ... | package python
import (
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"sourcegraph.com/sourcegraph/srclib/toolchain"
)
func runCmdLogError(cmd *exec.Cmd) {
err := runCmdStderr(cmd)
if err != nil {
log.Printf("Error running `%s`: %s", strings.Join(cmd.Args, " "), err)
}
}
func runCmdStderr(cmd *exec.Cmd)... | Fix `goimports` fail, no idea how it compiles on local machine. | Fix `goimports` fail, no idea how it compiles on local machine.
| Go | mit | techdragon/srclib-python,techdragon/srclib-python,techdragon/srclib-python |
ac3aaddcedb51e0f1c25c218ea98bfee9939404b | cmd/puka-web/main.go | cmd/puka-web/main.go | package main
import (
"log"
"net/http"
"os"
"github.com/gin-gonic/gin"
)
func main() {
p := os.Getenv("PORT")
if p == "" {
log.Fatal("$PORT must be set")
}
r := gin.Default()
// PING test
r.GET("/ping", func(c *gin.Context) {
c.String(http.StatusOK, "PONG")
})
r.Run(":" + p)
}
| package main
import (
"log"
"net/http"
"os"
"gopkg.in/mgo.v2"
"github.com/gin-gonic/gin"
)
func main() {
session, err := mgo.Dial("localhost")
if err != nil {
log.Fatalln("FATAL", err)
}
defer session.Close()
p := os.Getenv("PORT")
if p == "" {
log.Fatal("$PORT must be set")
}
r := gin.Default()
... | Add mgo dependency for testing. | Add mgo dependency for testing.
| Go | mit | jhh/puka-react,jhh/puka-react,jhh/puka-react |
6ccc812331b6f899d2b1d1344b5fd332ad3452d2 | log/sentry.go | log/sentry.go | package log
import (
"github.com/getsentry/raven-go"
"log"
"os"
)
var activeSentry bool = true
func InitializeSentry() {
sentry := os.Getenv("SENTRY_DSN")
if sentry == "" {
activeSentry = false
log.Println("===> Error: Sentry DSN environment not provisoned")
}
raven.SetDSN(sentry)
}
func LogError2Sentry(... | package log
import (
"github.com/getsentry/raven-go"
"log"
"os"
)
var isSentryActive bool = false
func InitializeSentry() {
sentry := os.Getenv("SENTRY_DSN")
if sentry == "" {
isSentryActive = false
log.Println("===> Error: Sentry DSN environment not provisoned")
}
raven.SetDSN(sentry)
}
func LogError2Se... | Rename variable and initial value | [REFACTOR] Rename variable and initial value
| Go | mit | aleasoluciones/goaleasoluciones |
a2f3c88e6c93db375f881d18bbc8ae45e1c36883 | chapter6/runlengthcompression.go | chapter6/runlengthcompression.go | // Problem 6.18
package chapter6
import (
"fmt"
"strings"
"unicode"
)
func Encoding(s string) string {
runes := []rune(s)
var out string
cnt := 1
for i := 1; i < len(runes); i++ {
if runes[i] != runes[i-1] {
out += fmt.Sprintf("%d%c", cnt, runes[i-1])
cnt = 1
} else {
cnt++
}
}
out += fmt... | // Problem 6.18
package chapter6
import (
"fmt"
"strings"
"unicode"
)
func Encoding(s string) string {
runes := []rune(s)
var out string
cnt := 1
for i := 1; i < len(runes); i++ {
if runes[i] != runes[i-1] {
out += fmt.Sprintf("%d%c", cnt, runes[i-1])
cnt = 1
} else {
cnt++
}
}
out += fmt... | Fix 6.18 - do not need []rune | Fix 6.18 - do not need []rune
| Go | mit | akshaykumar90/sparkling-water |
d04023572e47e5c18fa549fe7f7de301e8470c63 | core/core.go | core/core.go | package core
import (
"github.com/akutz/gofig"
)
func init() {
initDrivers()
gofig.Register(globalRegistration())
gofig.Register(driverRegistration())
}
func globalRegistration() *gofig.Registration {
r := gofig.NewRegistration("Global")
r.Yaml(`
rexray:
host: tcp://:7979
logLevel: warn
`)
r.Key(gofig... | package core
import (
"fmt"
"github.com/akutz/gofig"
"github.com/emccode/rexray/util"
)
func init() {
initDrivers()
gofig.SetGlobalConfigPath(util.EtcDirPath())
gofig.SetUserConfigPath(fmt.Sprintf("%s/.rexray", util.HomeDir()))
gofig.Register(globalRegistration())
gofig.Register(driverRegistration())
}
f... | Fix for not setting Gofig global/user dirs | Fix for not setting Gofig global/user dirs
This patch fixes the issue where the Gofig's global (/etc) and user
($HOME) directories were not set, resulting in the default config files
not being loaded.
| Go | apache-2.0 | thecodeteam/rexray,codedellemc/rexray,oppodeldoc/rexray,cduchesne/rexray,akutz/rexray,codedellemc/rexray,cduchesne/rexray,clintonskitson/rexray,cduchesne/rexray,cduchesne/rexray,clintonskitson/rexray,oppodeldoc/rexray,akutz/rexray,emccode/rexray,thecodeteam/rexray,clintonskitson/rexray,codedellemc/rexray,emccode/rexray... |
728646c70e94fef270ef90aeee31c813239089e6 | acme/dvsni_challenge.go | acme/dvsni_challenge.go | package acme
type dvsniChallenge struct{}
func (s *dvsniChallenge) CanSolve() bool {
return false
}
func (s *dvsniChallenge) Solve(challenge challenge, domain string) {
}
| package acme
type dvsniChallenge struct{}
func (s *dvsniChallenge) CanSolve() bool {
return false
}
func (s *dvsniChallenge) Solve(challenge challenge, domain string) error {
return nil
}
| Implement new interface with DVSNI | Implement new interface with DVSNI
| Go | mit | xenolf/lego,fxposter/lego,xenolf/lego,tommie/lego |
de7f3824d378904828e3eb74e6ff109d6a519296 | esapi/esapi_internal_test.go | esapi/esapi_internal_test.go | // +build !integration
package esapi
import (
"testing"
)
func TestAPIHelpers(t *testing.T) {
t.Run("BoolPtr", func(t *testing.T) {
var v *bool
v = BoolPtr(false)
if v == nil || *v != false {
t.Errorf("Expected false, got: %v", v)
}
v = BoolPtr(true)
if v == nil || *v != true {
t.Errorf("Expect... | // +build !integration
package esapi
import (
"testing"
)
func TestAPIHelpers(t *testing.T) {
t.Run("BoolPtr", func(t *testing.T) {
v := BoolPtr(false)
if v == nil || *v != false {
t.Errorf("Expected false, got: %v", v)
}
v = BoolPtr(true)
if v == nil || *v != true {
t.Errorf("Expected true, got: ... | Simplify tests for API helpers | Simplify tests for API helpers
| Go | apache-2.0 | elastic/go-elasticsearch,elastic/go-elasticsearch,elastic/go-elasticsearch,elastic/go-elasticsearch |
8e011d250ef58cec6432025a823a86f722c8542a | attack/memory/alloc_integration_test.go | attack/memory/alloc_integration_test.go | // +build integration
package memory
import (
"context"
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestMemoryAllocationAttack(t *testing.T) {
assert := assert.New(t)
var size uint64 = 200 * MiB
ma, err := NewMemAllocation(size)
assert.NoError(err, "Creation of memory allocator ... | // +build integration
package memory
import (
"context"
"runtime"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
// TODO: Research how to integrate this test correctly so if doesn't fail the 50% of the times.
func _TestMemoryAllocationAttack(t *testing.T) {
assert := assert.New(t)
var size uint64 = ... | Remove integration tests that throws lots of false positives. | Remove integration tests that throws lots of false positives.
Signed-off-by: Xabier Larrakoetxea <30fb0ea44f2104eb1a81e793d922a064c3916c2f@gmail.com>
| Go | apache-2.0 | slok/ragnarok,slok/ragnarok |
883f9be315ef02f77810ec2aef6c1e36f6a1d465 | cmd/genpod/app/options/options.go | cmd/genpod/app/options/options.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, ... | Fix genpod to have "default" namespace by default. | Fix genpod to have "default" namespace by default.
| Go | apache-2.0 | aveshagarwal/cluster-capacity,aveshagarwal/cluster-capacity,aveshagarwal/cluster-capacity |
c3c49108dfabe730376c33d65d7c01f56820786b | helpers/copy_file.go | helpers/copy_file.go | package helpers
import (
"io"
"os"
)
// Copyfile takes a source and destination file path and copies the file. Destination needs to be complete path of file, not a directory
func CopyFile(srcPath, destPath string) (err error) {
// open files r and w
r, err := os.Open(srcPath)
if err != nil {
return err
}
def... | package helpers
import (
"io"
"os"
)
// Copyfile takes a source and destination file path and copies the file. Destination needs to be complete path of file, not a directory
func CopyFile(srcPath, destPath string) (err error) {
// open files r and w
r, err := os.Open(srcPath)
if err != nil {
return err
}
def... | Remove update line in copy file | Remove update line in copy file
Signed-off-by: Matt Stratton <39982728c5a806c113d54b69a3f65ecf65602e8a@gmail.com>
| Go | mit | devopsdays/devopsdays-cli,mattstratton/probablyfine,devopsdays/devopsdays-cli |
2b6b8215dfcf8beefd332b401922f7e36f901ae6 | internal/boring/boring.go | internal/boring/boring.go | //go:build boringcrypto
// +build boringcrypto
package boring
import (
"crypto/boring"
"gitlab.com/gitlab-org/labkit/log"
)
// CheckBoring checks whether FIPS crypto has been enabled. For the FIPS Go
// compiler in https://github.com/golang-fips/go, this requires that:
//
// 1. The kernel has FIPS enabled (e.g. `... | //go:build boringcrypto
// +build boringcrypto
package boring
import (
"crypto/boring"
"gitlab.com/gitlab-org/labkit/log"
)
// CheckBoring checks whether FIPS crypto has been enabled. For the FIPS Go
// compiler in https://github.com/golang-fips/go, this requires that:
//
// 1. The kernel has FIPS enabled (e.g. `... | Fix typo in FIPS mode message | Fix typo in FIPS mode message
Rename Gitaly -> gitlab-shell
| Go | mit | gitlabhq/gitlab-shell,gitlabhq/gitlab-shell,gitlabhq/gitlab-shell |
439f8f25fd6b256ca099ffb419bfb449f5fe38ed | octokit/statuses.go | octokit/statuses.go | package octokit
import (
"fmt"
"time"
)
type Status struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
State string `json:"state"`
TargetUrl string `json:"target_url"`
Description string `json:"description"`
Id int `json:"id"`
Url ... | package octokit
import (
"fmt"
"time"
)
type Status struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
State string `json:"state"`
TargetUrl string `json:"target_url"`
Description string `json:"description"`
Id int ... | Add Creator to Status API | Add Creator to Status API
| Go | mit | dev4mobile/hub,rlugojr/hub,nmfzone/hub,terry2000/hub,codydaig/hub,jingweno/hub,codydaig/hub,naru0504/hub,isundaylee/hub,aspiers/hub,dongjoon-hyun/hub,dongjoon-hyun/hub,ASidlinskiy/hub,cpick/hub,sbp/hub,github/hub,xantage/hub,boris-rea/hub,hopil/hub,ASidlinskiy/hub,pankona/hub,AndBicScadMedia/hub,isundaylee/hub,rlugojr/... |
a31738e13391634abd5704035cc83733f6a776d6 | myaws/ssm_parameter_ls.go | myaws/ssm_parameter_ls.go | package myaws
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/pkg/errors"
)
// SSMParameterLsOptions customize the behavior of the ParameterGet command.
type SSMParameterLsOptions struct {
Name string
}
// SSMParameterLs get values from SSM parameter store wit... | package myaws
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/pkg/errors"
)
// SSMParameterLsOptions customize the behavior of the ParameterGet command.
type SSMParameterLsOptions struct {
Name string
}
// SSMParameterLs get values from SSM parameter store wit... | Fix bug of ssm parameter ls when name is empty | Fix bug of ssm parameter ls when name is empty
| Go | mit | minamijoyo/myaws |
09286f3defa2f9368b645a4905a19cb0f521dafd | bot/pick.go | bot/pick.go | // Copyright 2015 Robert S. Gerus. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package bot
import (
"math/rand"
"strings"
"time"
"github.com/arachnist/gorepost/irc"
)
func pick(output func(irc.Message), msg irc.Message) {
var args... | // Copyright 2015 Robert S. Gerus. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package bot
import (
"math/rand"
"strings"
"time"
"github.com/arachnist/gorepost/irc"
)
func pick(output func(irc.Message), msg irc.Message) {
var args... | Make splitting with commas more sensible. | Make splitting with commas more sensible.
| Go | mit | arachnist/gorepost |
f2d3d803865df6712a60f2c62109750e77ebc6b0 | render/loader_test.go | render/loader_test.go | package render
import (
"path/filepath"
"testing"
"github.com/oakmound/oak/fileutil"
"github.com/stretchr/testify/assert"
)
func TestBatchLoad(t *testing.T) {
fileutil.BindataDir = AssetDir
fileutil.BindataFn = Asset
assert.Nil(t, BatchLoad(filepath.Join("assets", "images")))
sh, err := GetSheet(filepath.Joi... | package render
import (
"path/filepath"
"testing"
"github.com/oakmound/oak/fileutil"
"github.com/stretchr/testify/assert"
)
func TestBatchLoad(t *testing.T) {
fileutil.BindataDir = AssetDir
fileutil.BindataFn = Asset
assert.Nil(t, BatchLoad(filepath.Join("assets", "images")))
sh, err := GetSheet(filepath.Joi... | Test for render loader checking custimizability. | Test for render loader checking custimizability.
| Go | apache-2.0 | oakmound/oak,oakmound/oak,oakmound/oak |
5853a141a52429783a7fc031b2c33fef4d8c58d5 | pages/staticpage.go | pages/staticpage.go | package pages
import (
"io"
"io/ioutil"
)
// StaticPage is a static page.
type StaticPage struct {
pageFields
}
// Static returns a bool indicating that the page is a static page.
func (p *StaticPage) Static() bool { return true }
func (p *StaticPage) Write(_ Context, w io.Writer) error {
b, err := ioutil.ReadF... | package pages
import (
"io"
"os"
)
// StaticPage is a static page.
type StaticPage struct {
pageFields
}
// Static returns a bool indicating that the page is a static page.
func (p *StaticPage) Static() bool { return true }
func (p *StaticPage) Write(_ Context, w io.Writer) error {
in, err := os.Open(p.filename... | Use io.Copy to write static files | Use io.Copy to write static files
| Go | mit | osteele/gojekyll,osteele/gojekyll,osteele/gojekyll,osteele/gojekyll |
e641d2fd65a6772cda7e003d2a446789804352bc | caddytls/httphandler.go | caddytls/httphandler.go | package caddytls
import (
"crypto/tls"
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
)
const challengeBasePath = "/.well-known/acme-challenge"
// HTTPChallengeHandler proxies challenge requests to ACME client if the
// request path starts with challengeBasePath. It returns true if it
// handl... | package caddytls
import (
"crypto/tls"
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
)
const challengeBasePath = "/.well-known/acme-challenge"
// HTTPChallengeHandler proxies challenge requests to ACME client if the
// request path starts with challengeBasePath. It returns true if it
// handl... | Set listenHost to localhost if empty; fixes test on Windows | Set listenHost to localhost if empty; fixes test on Windows
| Go | apache-2.0 | tobya/caddy,cez81/caddy,devangels/caddy,elcore/caddy,yukimochi/caddy,yukimochi/caddy,captncraig/caddy,joshix/caddy,devangels/caddy,pyed/caddy,elcore/caddy,pyed/caddy,joshix/caddy,joshix/caddy,devangels/caddy,pyed/caddy,cez81/caddy,tobya/caddy,tobya/caddy,dusty/caddy,dusty/caddy,captncraig/caddy,tobya/caddy,pyed/caddy,y... |
6c0ec2e1d08e054f13fb4e2988082b026b230ec1 | edn/lexer_test.go | edn/lexer_test.go | package edn
import . "testing"
func TestEmptyGivesOnlyEOF(t *T) {
lexer := Lex("")
token, _ := lexer.Next()
if token.kind != tEOF {
t.Error("expecting EOF")
}
}
// I suspect there's a potential race condition here first since
// the lexer is in a different thread. If `Next()` is called while the lexer
// is s... | package edn
import . "testing"
func TestEmptyGivesOnlyEOF(t *T) {
lexer := Lex("")
token, _ := lexer.Next()
if token.kind != tEOF {
t.Error("expecting EOF")
}
}
// I suspect there's a potential race condition here first since
// the lexer is in a different thread. If `Next()` is called while the lexer
// is s... | Add a failing test for next step in lexer implementation | Add a failing test for next step in lexer implementation
| Go | mit | bjeanes/gojure,bjeanes/gojure |
b4652d4a6a4587a55fbad1d5da1a5d3015614b19 | upgrades/steps118_test.go | upgrades/steps118_test.go | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades_test
import (
gc "launchpad.net/gocheck"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/upgrades"
)
type steps118Suite struct {
testbase.LoggingSuite
}
var _ = gc.Suite(&steps118Su... | // Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades_test
import (
gc "launchpad.net/gocheck"
"launchpad.net/juju-core/testing/testbase"
"launchpad.net/juju-core/upgrades"
)
type steps118Suite struct {
testbase.LoggingSuite
}
var _ = gc.Suite(&steps118Su... | Add the extra step to the 1.18 test. | Add the extra step to the 1.18 test. | Go | agpl-3.0 | reedobrien/store |
39cfbfe67a38039a90f6e0d14a14afedf16e5253 | main.go | main.go | package main
import (
"flag"
"fmt"
"os"
)
var output string
func init() {
flag.Usage = func() {
fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0])
flag.PrintDefaults()
}
flag.StringVar(&output, "out", "out.go", "Specify a path to the output file")
flag.Parse()
}
func main() {
checkRequire... | package main
import (
"flag"
"fmt"
"os"
"os/exec"
)
var output string
func init() {
flag.Usage = func() {
fmt.Printf("Usage: %s [-out=out.path] in.path\n\n", os.Args[0])
flag.PrintDefaults()
}
flag.StringVar(&output, "out", "out.go", "Specify a path to the output file")
flag.Parse()
}
func main() {
c... | Add go binary existence check | Add go binary existence check
| Go | mit | konjoot/go-inspect |
7922c3be5fea76c32cc50a00f7d0f32817c19852 | main.go | main.go | package main
import (
"log"
"os"
"github.com/FiloSottile/CVE-2016-2107/LuckyMinus20"
)
func main() {
res, err := LuckyMinus20.Test(os.Args[1])
if err != nil {
log.Fatal(err)
}
log.Println("Vulnerable:", res)
if res {
os.Exit(1)
}
}
| package main
import (
"log"
"os"
"github.com/FiloSottile/CVE-2016-2107/LuckyMinus20"
)
func main() {
res, err := LuckyMinus20.Test(os.Args[1])
if err != nil {
log.Fatal(err)
}
log.Println("Vulnerable:", res)
if res {
os.Exit(2)
}
}
| Exit with error code 2 for vulnerable to make scripting easier | Exit with error code 2 for vulnerable to make scripting easier
As it happens, the log.fatal() above it will also exit(1)
meaning that from a scripts perspective, you cannot tell the
differance between a failure to connect or whatever, or an actual
postive on the test. Exiting with 2 because ???, I don't know what
else... | Go | mit | FiloSottile/CVE-2016-2107 |
3d59cd3d80ac5fe0d9ab2af8519fb396687e6381 | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/jingweno/nut/vendor/_nuts/github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = "nut"
app.Usage = "Vendor Go dependencies"
app.Version = "0.0.1"
app.Author = ""
app.Email = ""
app.Commands = []cli.Command{
installCmd,
listCmd,
newCmd,... | package main
import (
"fmt"
"os"
"github.com/jingweno/nut/vendor/_nuts/github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = "nut"
app.Usage = "Vendor Go dependencies"
app.Version = "0.0.1"
app.Author = ""
app.Email = ""
app.Commands = []cli.Command{
installCmd,
newCmd,
}
app.R... | Remove list command for now | Remove list command for now
| Go | mit | jingweno/nut |
97fbf4e4f685f6a7ed8acb3b09dd384da49eaad4 | main.go | main.go | package main
import (
"os"
"github.com/github/hub/commands"
"github.com/github/hub/github"
"github.com/github/hub/ui"
)
func main() {
defer github.CaptureCrash()
err := commands.CmdRunner.Execute()
if !err.Ran {
ui.Errorln(err.Error())
}
os.Exit(err.ExitCode)
}
| // +build go1.8
package main
import (
"os"
"github.com/github/hub/commands"
"github.com/github/hub/github"
"github.com/github/hub/ui"
)
func main() {
defer github.CaptureCrash()
err := commands.CmdRunner.Execute()
if !err.Ran {
ui.Errorln(err.Error())
}
os.Exit(err.ExitCode)
}
| Enforce go1.8+ via build flags too | Enforce go1.8+ via build flags too
| Go | mit | github/hub,cpick/hub,github/hub,github/hub,cpick/hub,cpick/hub,github/hub |
9fae8b28922bca7469dba400b6d945c259a78f70 | main.go | main.go | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)
const aURL = "http://artii.herokuapp.com"
func main() {
args := os.Args[1:]
if len(args) == 0 {
fmt.Printf("Usage:\n")
return
}
switch args[0] {
case "fonts":
fmt.Printf("%v", fontList())
}
fmt.Println(draw(args[0]))
}
func fontLis... | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)
const aURL = "http://artii.herokuapp.com"
func main() {
args := os.Args[1:]
if len(args) == 0 {
fmt.Printf("Usage:\n")
return
}
switch args[0] {
case "fonts":
fmt.Printf("%v", fontList())
return
}
fmt.Println(draw(args)... | Address when args passed to cli are in quotes | Address when args passed to cli are in quotes
puts entire string as first element in []string, so must grab this
element and split it on spaces
| Go | mit | neslom/aart |
51bc8619546d5deb61e73f428f42e4dfdb09ec60 | challenge32.go | challenge32.go | // Challenge 32 - Break HMAC-SHA1 with a slightly less artificial timing leak
// http://cryptopals.com/sets/4/challenges/32
package cryptopals
import (
"crypto/sha1"
"net/http"
"time"
)
type challenge32 struct {
}
func (challenge32) ForgeHmacSHA1SignaturePrecise(addr, file string) []byte {
sig := make([]byte, s... | // Challenge 32 - Break HMAC-SHA1 with a slightly less artificial timing leak
// http://cryptopals.com/sets/4/challenges/32
package cryptopals
import (
"crypto/sha1"
"net/http"
"time"
)
type challenge32 struct {
}
func (challenge32) ForgeHmacSHA1SignaturePrecise(addr, file string) []byte {
sig := make([]byte, s... | Fix solution for challenge 32 | Fix solution for challenge 32
| Go | mit | Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go |
a0a835a901c83f9e781e73c34faab5d9337d9450 | challenge37.go | challenge37.go | // Challenge 37 - Break SRP with a zero key
// http://cryptopals.com/sets/5/challenges/37
package cryptopals
import "math/big"
type challenge37 struct {
}
func (challenge37) Client(net Network) bool {
A := big.NewInt(0)
net.Write(A)
net.Read()
net.Read()
S := A
K := sha256Digest(S.Bytes())
mac := hmacSHA2... | // Challenge 37 - Break SRP with a zero key
// http://cryptopals.com/sets/5/challenges/37
package cryptopals
import "math/big"
type challenge37 struct {
}
func (challenge37) Client(net Network) bool {
A := big.NewInt(0)
net.Write(A)
s := readBytes(net)
net.Read()
S := A
K := sha256Digest(S.Bytes())
mac :=... | Fix client to hmac salt instead of secret | Fix client to hmac salt instead of secret
| Go | mit | Metalnem/cryptopals-go,Metalnem/cryptopals-go,Metalnem/cryptopals-go |
7200e71bd598642c6570babb1c8637a56fc1c9b8 | cmd/root.go | cmd/root.go | package cmd
import (
"log"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "mocli",
Short: "",
Long: `Mobingi API command line interface.`,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
log.Println(err)
os.Exit(-1)
}
}
func init() {
rootCmd.PersistentFlags().String... | package cmd
import (
"log"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "mocli",
Short: "Mobingi API command line interface.",
Long: `Mobingi API command line interface.`,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
log.Println(err)
os.Exit(-1)
}
}
func init() ... | Add short description for help. | Add short description for help.
| Go | mpl-2.0 | mobingi/mobingi-cli |
7e3d5535dde7ce18b28d3ee1b12ded170dcac792 | execution_plan.go | execution_plan.go | package toscalib
type Playbook struct {
AdjacencyMatrix Matrix
Index map[int]Play
Inputs map[string]PropertyDefinition
Outputs map[string]Output
}
type Play struct {
NodeTemplate NodeTemplate
OperationName string
}
func GeneratePlaybook(s ServiceTemplateDefinition) Playbook {
var e... | package toscalib
type Playbook struct {
AdjacencyMatrix Matrix
Index map[int]Play
Inputs map[string]PropertyDefinition
Outputs map[string]Output
}
type Play struct {
NodeTemplate NodeTemplate
InterfaceName string
OperationName string
}
func GeneratePlaybook(s ServiceTemplateDefinit... | Add the interface name for comodity | [Enhancement] Add the interface name for comodity
| Go | apache-2.0 | owulveryck/toscalib,owulveryck/toscalib |
bf027fc600d3eba18358a1f7c0037448624db1f4 | k8s/embedded_none.go | k8s/embedded_none.go | // +build !k8s
package k8s
import (
"context"
"fmt"
"k8s.io/client-go/rest"
)
func getEmbedded(ctx context.Context) (context.Context, *rest.Config, error) {
return ctx, nil, fmt.Errorf("embedded support is not compiled in, rebuild with -tags k8s")
}
| // +build !k8s
package k8s
import (
"context"
"fmt"
"k8s.io/client-go/rest"
)
func getEmbedded(ctx context.Context) (bool, context.Context, *rest.Config, error) {
return false, ctx, nil, fmt.Errorf("embedded support is not compiled in, rebuild with -tags k8s")
}
| Fix method signature for the non-embedded verison | Fix method signature for the non-embedded verison
| Go | apache-2.0 | rancherio/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,cjellick/rancher,rancher/rancher,rancherio/rancher |
e1c622c4cfd1bf2e27448a0f0940407d35022343 | internal_test.go | internal_test.go | // Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/*
This test file is part of the btcchain package rather than than the
btcchain_test package so it can bridge access to the internals to properly test
cases which are eit... | // Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/*
This test file is part of the btcchain package rather than than the
btcchain_test package so it can bridge access to the internals to properly test
cases which are eit... | Modify the time sorter tests to make golint happy. | Modify the time sorter tests to make golint happy.
This commit changes the internal testing mechanism from returning the
unexported timeSorter type directly to insted returning sort.Interface.
This has been done because the latest version of golint complains about
return unexported types.
| Go | isc | ltcsuite/ltcd,cqswxj2013/btcd,jrick/btcd,jrick/btcd,jcmincke/dcrd,dajohi/btcd,toddfries/btcd,jimmysong/btcd,btcsuite/btcd,decred/dcrd,stevenroose/btcd,wallclockbuilder/btcd,davecgh/btcd,Stash-Crypto/btcd,danoctavian/btcd,adiabat/btcd,btcsuite/btcd,jrick/btcd,hectorj/btcd,stevenroose/btcd,pkothbauer/btcd,danoctavian/btc... |
0006835284e424a5b0261b88a115db31ed6ff180 | main.go | main.go | package main
import (
"log"
"os"
"sync"
"github.com/joho/godotenv"
)
func init() {
log.Println("Starting RFC-Bot")
if err := godotenv.Load(); err != nil {
log.Fatal("Error loading .env file")
}
}
func main() {
log.Println("Initialising Writers")
writer := NewWriter()
log.Println("Initialising Twitter")... | package main
import (
"log"
"os"
"runtime"
"github.com/joho/godotenv"
)
func init() {
log.Println("Starting RFC-Bot")
if err := godotenv.Load(); err != nil {
log.Fatal("Error loading .env file")
}
}
func main() {
log.Println("Initialising Writers")
writer := NewWriter()
log.Println("Initialising Twitte... | Switch to runtime.Goexit instead of sync.WaitGroup as goroutines run forever | Switch to runtime.Goexit instead of sync.WaitGroup as goroutines run forever
| Go | agpl-3.0 | bradleyfalzon/rfc-bot |
3d74d277aa0446264240308e52df6f223cc2a8ed | src/constants_unix.go | src/constants_unix.go | // +build !windows
package fzf
const (
// Reader
defaultCommand = `find -L . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//`
)
| // +build !windows
package fzf
const (
// Reader
defaultCommand = `find -L . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-`
)
| Use cut instead of sed in the default command | Use cut instead of sed in the default command
| Go | mit | junegunn/fzf,tomfitzhenry/pkg-fzf,tomfitzhenry/pkg-fzf,janlazo/fzf,junegunn/fzf,stuha/wbr-zsh,junegunn/fzf,infokiller/fzf,infokiller/fzf,wilywampa/fzf,janlazo/fzf,tomfitzhenry/pkg-fzf,janlazo/fzf,wilywampa/fzf,wilywampa/fzf,infokiller/fzf |
64faa63b2905e0bc84ea9d446490bcf126d5a756 | cribbage.go | cribbage.go | package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) == 1 {
fmt.Println("bad args")
return
}
}
| package main
import (
"fmt"
"os"
"strconv"
)
func main() {
if len(os.Args) == 1 {
fmt.Println("bad args")
return
}
handRaw := make([]string, len(os.Args)-1)
copy(handRaw, os.Args[1:])
startCard := Card{
suit: ToSuit(pop(&handRaw)),
rank: ToRank(pop(&handRaw)),
}
var hand Hand
for len(handRaw) > 0... | Read hand and start card from command line | Read hand and start card from command line
| Go | mit | millere/cribbage,millere/cribbage,millere/cribbage |
865976fc72004dd9c082b19dcf76408aef8512aa | make.go | make.go | package mrepo
import (
"os/exec"
"strings"
)
//Make invoke make on the prj with the target as argument.
func Make(prj, target string) (result string, err error) {
cmd := exec.Command("make", target)
cmd.Dir = prj
out, err := cmd.CombinedOutput()
if err != nil {
return
}
result = strings.Trim(string(out), "\... | package mrepo
import (
"io"
"os/exec"
)
//Make invoke make on the prj with the target as argument.
func Make(prj, target string, buf io.Writer) (err error) {
cmd := exec.Command("make", target)
cmd.Dir = prj
cmd.Stdout = buf
cmd.Stderr = buf
return cmd.Run()
}
| Make cmd now suport buffer passing | Make cmd now suport buffer passing
| Go | apache-2.0 | ericaro/sbr |
40d8111aab890a0de2a8674b0246ce1a8a76a560 | pkg/beam/core/runtime/api/gen.go | pkg/beam/core/runtime/api/gen.go | package api
// NOTE: install protoc as described on grpc.io before running go generate.
//go:generate protoc -I. -I../../../vendor/ beam_fn_api.proto --go_out=Mbeam_runner_api.proto=github.com/apache/beam/sdks/go/pkg/beam/core/api/org_apache_beam_runner_v1,plugins=grpc:org_apache_beam_fn_v1
//go:generate protoc -I. -... | package api
// NOTE: install protoc as described on grpc.io before running go generate.
//go:generate protoc -I. -I../../../vendor/ beam_fn_api.proto --go_out=Mbeam_runner_api.proto=github.com/apache/beam/sdks/go/pkg/beam/core/runtime/api/org_apache_beam_runner_v1,plugins=grpc:org_apache_beam_fn_v1
//go:generate prot... | Fix import reference path for runner API proto. | Fix import reference path for runner API proto.
Our go generate step doesn't attempt to build the generated artifacts,
which caused this bug to go unnoticed.
Change-Id: I9a5d6d9b984029e535fc24a05e498e8d60ad9705
Reviewed-on: https://team-review.git.corp.google.com/80456
Verified-Style: kokoro <2ac7b1f3fa578934c95181d4... | Go | apache-2.0 | robertwb/incubator-beam,charlesccychen/beam,charlesccychen/incubator-beam,charlesccychen/beam,markflyhigh/incubator-beam,RyanSkraba/beam,chamikaramj/beam,charlesccychen/incubator-beam,lukecwik/incubator-beam,tgroh/beam,robertwb/incubator-beam,charlesccychen/beam,lukecwik/incubator-beam,apache/beam,robertwb/incubator-be... |
5002cb8535a0fbfd09ab79b7b850ea374842f967 | main.go | main.go | package main
import (
"fmt"
"os"
"github.com/spf13/viper"
"github.com/minamijoyo/myaws/cmd"
)
func main() {
if err := cmd.RootCmd.Execute(); err != nil {
if viper.GetBool("debug") {
fmt.Printf("%+v\n", err)
} else {
fmt.Printf("%v\n", err)
}
os.Exit(1)
}
}
| package main
import (
"fmt"
"os"
"github.com/spf13/viper"
"github.com/minamijoyo/myaws/cmd"
)
func main() {
if err := cmd.RootCmd.Execute(); err != nil {
if viper.GetBool("debug") {
fmt.Fprintf(os.Stderr, "%+v\n", err)
} else {
fmt.Fprintf(os.Stderr, "%v\n", err)
}
os.Exit(1)
}
}
| Write error messages to stderr instead of stdout | Write error messages to stderr instead of stdout
| Go | mit | minamijoyo/myaws |
0adb8e284e81f6af3c9f42b44bef046485db25e1 | main.go | main.go | package main
import "fmt"
import "github.com/stianeikeland/go-rpio"
func main() {
fmt.Println("foo")
err := rpio.Open()
defer rpio.Close()
}
| package main
import "io"
import "log"
import "net/http"
import "time"
import "github.com/stianeikeland/go-rpio"
type gpioHandler struct {
pin rpio.Pin
}
func GpioHandler(pin rpio.Pin) http.Handler {
return &gpioHandler{pin}
}
func (f *gpioHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
io.WriteS... | Set pin 18 high on request to open door | Set pin 18 high on request to open door
| Go | apache-2.0 | hatstand/hodoor,hatstand/hodoor,hatstand/hodoor |
814a93a9f30b70213b5ae81b9f6276dbd9d265c3 | frame/v4.go | frame/v4.go | package frame
var (
V24CommonIDs = map[string]string{
"Title": "TIT2",
"Artist": "TPE1",
"Album": "TALB",
"Year": "TYER",
"Genre": "TCON",
"Attached Picture": "APIC",
"Unsynchronised Lyrics... | package frame
var (
V24CommonIDs = map[string]string{
"Title": "TIT2",
"Artist": "TPE1",
"Album": "TALB",
"Year": "TYER",
"Genre": "TCON",
"Attached Picture": "APIC",
"Unsynchronised Lyrics... | Add comment ID to V24CommonIDs | Add comment ID to V24CommonIDs
| Go | mit | bogem/id3v2 |
707ead8b4f9dbecb7d98ac63d62125d2e91be340 | cmd/commands.go | cmd/commands.go | package cmd
import "github.com/codegangsta/cli"
var Commands = []cli.Command{
{
Name: "install",
ShortName: "i",
Usage: "Install specific Note.js version",
Action: Install,
},
{
Name: "use",
Usage: "Create symlink for specific Note.js version",
Action: Use,
},
{
Name: "remove"... | package cmd
import "github.com/codegangsta/cli"
var Commands = []cli.Command{
{
Name: "install",
ShortName: "i",
Usage: "Install specific Note.js version",
Action: Install,
},
{
Name: "use",
Usage: "Set specified Note.js version as current",
Action: Use,
},
{
Name: "remove",
... | Use command help message edited | Use command help message edited
| Go | mit | armed/nver |
75eda8f5bc6edb8fbfa6a033d2b63f4a9e8e7503 | node.go | node.go | package trog
type rawNode struct {
Id NodeId
ParentIds []NodeId // Every ancestor id, all the way up to the root
ChildIds []NodeId // Every direct child id of this node
Pairs []Pair // Key/value pairs
Flags []Flag // Value-only flags
}
type Node struct {
rawNode
Parents []*Node // Every an... | package trog
type rawNode struct {
Id NodeId
ParentIds []NodeId // Every ancestor id, all the way up to the root
ChildIds []NodeId // Every direct child id of this node
Parents []*Node // Every ancestor, all the way up to the root
Children []*Node // Every direct child of this node
}
type Node struc... | Add some basic tree functions | Add some basic tree functions
| Go | mit | PieterD/crap,PieterD/crap |
63f2b4c5ac8cc3cfdbe3ded9d34105b237519baa | cmd/mccli/show_cmd.go | cmd/mccli/show_cmd.go | package mccli
import (
"fmt"
"github.com/codegangsta/cli"
"github.com/materials-commons/config"
"github.com/materials-commons/mcstore/server/mcstore"
)
var ShowCommand = cli.Command{
Name: "show",
Aliases: []string{"sh"},
Usage: "Show commands",
Subcommands: []cli.Command{
showConfigCommand,
},
}
va... | package mccli
import (
"fmt"
"github.com/codegangsta/cli"
"github.com/materials-commons/config"
"github.com/materials-commons/mcstore/server/mcstore"
)
var ShowCommand = cli.Command{
Name: "show",
Aliases: []string{"sh"},
Usage: "Show commands",
Subcommands: []cli.Command{
showConfigCommand,
},
}
va... | Remove creating variables and just show function call results. | Remove creating variables and just show function call results.
| Go | mit | materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore |
a8f977f5a09e3981f918dabc78b84028a03051a3 | config/config_test.go | config/config_test.go | package config
import (
"log"
"reflect"
"testing"
)
func TestParseConfig(t *testing.T) {
input := `
queue "test" {
type = "test_type"
host = "localhost"
port = 1234
}
`
expect := config{
Queues: []*Queue{
&Queue{
Driver: "test_type",
Host: "localhost",
Port: 1234,
Time... | package config
import (
"log"
"reflect"
"testing"
"time"
)
func TestParseConfig(t *testing.T) {
input := `
queue "test" {
type = "test_type"
host = "localhost"
port = 1234
}
`
expect := config{
Queues: []*Queue{
&Queue{
Driver: "test_type",
Host: "localhost",
Port: 1234,
... | Fix Timeout test struct value | Fix Timeout test struct value
| Go | apache-2.0 | smo921/kubeq |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.