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 |
|---|---|---|---|---|---|---|---|---|---|
4f26803226b227d95642f3344496770e6753a466 | pkg/eval/exception_unix_test.go | pkg/eval/exception_unix_test.go | // +build !windows,!plan9,!js
package eval
import (
"testing"
"github.com/elves/elvish/pkg/tt"
)
func TestExternalCmdExit_Error(t *testing.T) {
tt.Test(t, tt.Fn("Error", error.Error), tt.Table{
tt.Args(ExternalCmdExit{0, "ls", 100}).Rets("ls exited with 0"),
})
}
| // +build !windows,!plan9,!js
package eval
import (
"fmt"
"syscall"
"testing"
"github.com/elves/elvish/pkg/tt"
)
func TestExternalCmdExit_Error(t *testing.T) {
tt.Test(t, tt.Fn("Error", error.Error), tt.Table{
tt.Args(ExternalCmdExit{0x0, "ls", 1}).Rets("ls exited with 0"),
tt.Args(ExternalCmdExit{0x100, "... | Test all branches of ExternalCmdExit.Error. | pkg/eval: Test all branches of ExternalCmdExit.Error.
This addresses #944.
| Go | bsd-2-clause | elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish |
0c1ba6f232dc2a250f68368035b5c529c8b38774 | game.go | game.go | package main
import (
"image/color"
"engo.io/ecs"
"engo.io/engo/common"
)
type game struct{}
func (g *game) Type() string { return sceneGame }
func (g *game) Preload() {}
func (g *game) Setup(*ecs.World) {
common.SetBackground(color.White)
}
| package main
import (
"image/color"
"engo.io/ecs"
"engo.io/engo"
"engo.io/engo/common"
)
const buttonOpenMenu = "OpenMenu"
type game struct{}
func (g *game) Type() string { return sceneGame }
func (g *game) Preload() {}
func (g *game) Setup(world *ecs.World) {
engo.Input.RegisterButton(buttonOpenMenu, en... | Add scene change to mainmenu on esc | Add scene change to mainmenu on esc
| Go | bsd-3-clause | kori-irrlicht/jump-game |
dbf01a2f5682aba0beef6422a007d4016e4ee893 | internal/provider/provider_test.go | internal/provider/provider_test.go | package provider
import (
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func protoV5ProviderFactories() map[string]func() (tfprotov5.ProviderServer, error) {
return map[string]f... | package provider
import (
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func protoV5ProviderFactories() map[string]func() (tfprotov5.ProviderServer, error) {
return map[string]f... | Fix typo in retrieving external provider | Fix typo in retrieving external provider
| Go | mpl-2.0 | terraform-providers/terraform-provider-null,hashicorp/terraform-provider-null,hashicorp/terraform-provider-null,terraform-providers/terraform-provider-null |
f8341d859b10e9256e1d51e94867b21c866b79ea | main.go | main.go | package main
import (
"github.com/42wim/mm-go-irckit"
"github.com/alexcesaro/log"
"github.com/alexcesaro/log/golog"
"net"
"os"
)
var logger log.Logger = log.NullLogger
func main() {
logger = golog.New(os.Stderr, log.Debug)
irckit.SetLogger(logger)
socket, err := net.Listen("tcp", "127.0.0.1:6667")
if err !... | package main
import (
"github.com/42wim/mm-go-irckit"
"github.com/alexcesaro/log"
"github.com/alexcesaro/log/golog"
"net"
"os"
)
var logger log.Logger = log.NullLogger
func main() {
logger = golog.New(os.Stderr, log.Debug)
irckit.SetLogger(logger)
socket, err := net.Listen("tcp", "127.0.0.1:6667")
if err !... | Create different server per user/connection | Create different server per user/connection
| Go | mit | 42wim/matterircd,wikimedia/operations-software-matterircd |
beeae6854920fc197616144578e1d96f1cd97834 | main.go | main.go | package pongo2
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
p2 "github.com/flosch/pongo2"
"sync"
)
type Context map[string]interface{}
var templates = map[string]*p2.Template{}
var mutex = &sync.RWMutex{}
var devMode = beego.AppConfig.String("runmode") == "dev"
// Render takes a Beego... | package pongo2
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
p2 "github.com/flosch/pongo2"
"sync"
)
type Context map[string]interface{}
var templates = map[string]*p2.Template{}
var mutex = &sync.RWMutex{}
var devMode bool
// Render takes a Beego context, template name and a Context (m... | Disable autorender for Beego when beego-pongo2 is imported. | Disable autorender for Beego when beego-pongo2 is imported.
| Go | mit | oal/beego-pongo2,trigrass2/beego-pongo2 |
c60de6a42a270fe1e68018d8694af6bee3023026 | reset/testmode.go | reset/testmode.go | package reset
import (
"os"
"strings"
"sync"
)
var (
testModeOnce = sync.Once{}
_testMode bool
)
// TestMode returns true if run as unit test
func TestMode() bool {
testModeOnce.Do(func() {
_testMode = strings.HasSuffix(os.Args[0], ".test")
})
return _testMode
}
| package reset
import (
"io/ioutil"
"log"
"os"
"strings"
"sync"
)
var (
testModeOnce = sync.Once{}
_testMode bool
)
// TestMode returns true if run as unit test
func TestMode() bool {
testModeOnce.Do(func() {
_testMode = strings.HasSuffix(os.Args[0], ".test")
if _testMode {
log.SetOutput(ioutil.Dis... | Drop logging output in test mode | Drop logging output in test mode
| Go | apache-2.0 | redforks/testing |
24f9da58b3f721972cc5c1fab71bea67962c43f7 | model_validator/model_validator.go | model_validator/model_validator.go | package model_validator
import (
"fmt"
"github.com/asaskevich/govalidator"
"github.com/centurylinkcloud/clc-go-cli/base"
"strings"
)
func ValidateModel(model interface{}) error {
_, err := govalidator.ValidateStruct(model)
if err != nil {
var msg string
parts := strings.Split(err.Error(), ";")
errors := p... | package model_validator
import (
"fmt"
"github.com/asaskevich/govalidator"
"github.com/centurylinkcloud/clc-go-cli/base"
"strings"
)
func ValidateModel(model interface{}) error {
_, err := govalidator.ValidateStruct(model)
if err != nil {
parts := strings.Split(err.Error(), ";")
errors := parts[:len(parts)-... | Remove an extra newline from the model validation errors. | Remove an extra newline from the model validation errors.
| Go | apache-2.0 | CenturyLinkCloud/clc-go-cli,CenturyLinkCloud/clc-go-cli |
3a6634b2456fc0cd151e25cc90b3b6865bbb5332 | contrib/httpimg/httpimg_test.go | contrib/httpimg/httpimg_test.go | package httpimg_test
import (
"github.com/jung-kurt/gofpdf"
"github.com/jung-kurt/gofpdf/contrib/httpimg"
"github.com/jung-kurt/gofpdf/internal/example"
)
func ExampleRegister() {
pdf := gofpdf.New("", "", "", "")
pdf.SetFont("Helvetica", "", 12)
pdf.SetFillColor(200, 200, 220)
pdf.AddPage()
url := "https://... | package httpimg_test
import (
"github.com/jung-kurt/gofpdf"
"github.com/jung-kurt/gofpdf/contrib/httpimg"
"github.com/jung-kurt/gofpdf/internal/example"
)
func ExampleRegister() {
pdf := gofpdf.New("L", "mm", "A4", "")
pdf.SetFont("Helvetica", "", 12)
pdf.SetFillColor(200, 200, 220)
pdf.AddPage()
url := "htt... | Maintain aspect ratio of registered image | Maintain aspect ratio of registered image
| Go | mit | jung-kurt/gofpdf,ledongthuc/gofpdf,jelmersnoeck/gofpdf,jelmersnoeck/gofpdf |
ac7ac4e9945bd037d7178cbd5c8666402a57a8cd | client_interface.go | client_interface.go | package go_camunda_client
type CamundaClient interface {
StartProcess(processDefinitionKey string, request interface{}) (Process, error)
GetProcess(processId string) (Process, error)
GetProcessVariable(processId string, variableName string) (VariableResponse, error)
GetNextTask(processId string) (Task, error)
Get... | package go_camunda_client
type CamundaClient interface {
StartProcess(processDefinitionKey string, request interface{}) (Process, error)
GetProcess(processId string) (Process, error)
FindProcess(query string) (Process, error)
GetProcessVariable(processId string, variableName string) (VariableResponse, error)
GetN... | Add FindProcess to CamundaClient interface | Add FindProcess to CamundaClient interface
| Go | apache-2.0 | bigbank-as/go_camunda_client |
2cfcf087a3e27f6fca008a02088e1f43385a060b | cmd/wcloud/types.go | cmd/wcloud/types.go | package main
import (
"time"
)
// Deployment describes a deployment
type Deployment struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
ImageName string `json:"image_name"`
Version string `json:"version"`
Priority int `json:"priority"`
State string `json:"stat... | package main
import (
"time"
)
// Deployment describes a deployment
type Deployment struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
ImageName string `json:"image_name"`
Version string `json:"version"`
Priority int `json:"priority"`
State string `json:"stat... | Add blacklist to wcloud client | Add blacklist to wcloud client
| Go | apache-2.0 | kinvolk/scope,paulbellamy/scope,weaveworks/scope,alban/scope,alban/scope,weaveworks/scope,kinvolk/scope,weaveworks/scope,paulbellamy/scope,paulbellamy/scope,paulbellamy/scope,paulbellamy/scope,alban/scope,kinvolk/scope,kinvolk/scope,weaveworks/scope,alban/scope,alban/scope,kinvolk/scope,weaveworks/scope,paulbellamy/sco... |
6b308c5ecde906553352f11821b16d1160a28e90 | lib/executor/helpers_test.go | lib/executor/helpers_test.go | /*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2020 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... | /*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2020 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... | Fix a typo by simplifying the code | Fix a typo by simplifying the code
| Go | agpl-3.0 | loadimpact/k6,loadimpact/k6 |
93d28d1f9bdbca83e2c443df1a1f77d2bdec0b9d | docker_compose_handler.go | docker_compose_handler.go | package humanlog
import (
"regexp"
)
// dcLogsPrefixRe parses out a prefix like 'web_1 | ' from docker-compose
var dcLogsPrefixRe = regexp.MustCompile("^(?:\x1b\\[\\d+m)?([a-zA-Z0-9._-]+)\\s+\\|(?:\x1b\\[0m)? (.*)$")
type handler interface {
TryHandle([]byte) bool
setField(key, val []byte)
}
func tryDockerCompos... | package humanlog
import (
"regexp"
)
// dcLogsPrefixRe parses out a prefix like 'web_1 | ' from docker-compose
var dcLogsPrefixRe = regexp.MustCompile("^(?:\x1b\\[\\d+m)?(?P<service_name>[a-zA-Z0-9._-]+)\\s+\\|(?:\x1b\\[0m)? (?P<rest_of_line>.*)$")
type handler interface {
TryHandle([]byte) bool
setField(key, val... | Add names to capture groups | Add names to capture groups
| Go | apache-2.0 | aybabtme/humanlog,aybabtme/humanlog |
ae64ca92de07f522322d5420d3814653366e7eb4 | statsd/metrics_service.go | statsd/metrics_service.go | package statsd
import (
"time"
"github.com/tecnickcom/statsd"
)
type MetricsService struct {
statsdClient *statsd.Client
prefix string
}
func NewMetricsService() *MetricsService {
statsdClient, e := statsd.New() // Connect to the UDP port 8125 by default.
if e != nil {
panic(e)
}
return &MetricsServ... | package statsd
import (
"time"
"github.com/tecnickcom/statsd"
)
type MetricsService struct {
statsdClient *statsd.Client
prefix string
}
func NewMetricsService() *MetricsService {
statsdClient, e := statsd.New() // Connect to the UDP port 8125 by default.
if e != nil {
panic(e)
}
return &MetricsServ... | Add new timing metric with .sparse-avg suffix | Add new timing metric with .sparse-avg suffix
| Go | apache-2.0 | cloudfoundry-incubator/bits-service,cloudfoundry-incubator/bits-service,petergtz/bitsgo,cloudfoundry-incubator/bits-service,cloudfoundry-incubator/bits-service,petergtz/bitsgo,cloudfoundry-incubator/bits-service |
18d045ec20d9224f85bdfea0527f8959b113478e | sudoku/human_solve.go | sudoku/human_solve.go | package sudoku
import (
"fmt"
)
type SolveDirections []*SolveStep
const (
ONLY_LEGAL_NUMBER = iota
)
type SolveStep struct {
Row int
Col int
Num int
Technique SolveTechnique
}
type SolveTechnique interface {
Name() string
Description(*SolveStep) string
Apply(*Grid) *SolveStep
}
var tech... | package sudoku
import (
"fmt"
)
type SolveDirections []*SolveStep
const (
ONLY_LEGAL_NUMBER = iota
)
type SolveStep struct {
Row int
Col int
Num int
Technique SolveTechnique
}
type SolveTechnique interface {
Name() string
Description(*SolveStep) string
Apply(*Grid) *SolveStep
}
var tech... | Remove refillQueue now that cells reinsert themselves when their number changes from 0 or not. | Remove refillQueue now that cells reinsert themselves when their number changes from 0 or not.
| Go | apache-2.0 | jkomoros/sudoku,jkomoros/sudoku,jkomoros/sudoku |
7bf6cd7d566ffc3d4073c350d82eeddbdc088880 | pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go | pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go | /*
Copyright 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, softw... | /*
Copyright 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, softw... | Fix golint errors when generating informer code | Fix golint errors when generating informer code
Kubernetes-commit: acf78cd6133de6faea9221d8c53b02ca6009b0bb
| Go | apache-2.0 | kubernetes/sample-controller,kubernetes/sample-controller |
dfee04c65c347a31df04c63ffd1269964b96acfc | tests/cli/apps_test.go | tests/cli/apps_test.go | package cli_test
import (
"regexp"
"testing"
)
func TestCreate(t *testing.T) {
run(t, []Command{
{
"apps",
"",
},
{
"create acme-inc",
"Created acme-inc.",
},
})
}
func TestApps(t *testing.T) {
run(t, []Command{
{
"create acme-inc",
"Created acme-inc.",
},
{
"apps",
"acme-i... | package cli_test
import (
"regexp"
"testing"
)
func TestCreate(t *testing.T) {
run(t, []Command{
{
"apps",
"",
},
{
"create acme-inc",
"Created acme-inc.",
},
})
}
func TestApps(t *testing.T) {
run(t, []Command{
{
"create acme-inc",
"Created acme-inc.",
},
{
"apps",
"acme-i... | Use regexp.MustCompile() instead of regexp.Compile(). | Use regexp.MustCompile() instead of regexp.Compile(). | Go | bsd-2-clause | zofuthan/empire,vfulco/empire,markpeek/empire,zofuthan/empire,remind101/empire,iserko/empire,vfulco/empire,remind101/empire,mhahn/empire,mhahn/empire,remind101/empire,iserko/empire,mhahn/empire,markpeek/empire,iserko/empire |
7787b5648743176d98cc731f23b029498b87b0f7 | reader.go | reader.go | package proof
import (
"hash"
"io"
)
type Reader32 struct {
r io.Reader
h hash.Hash32
sum uint32
}
func NewReader32(r io.reader, h hash.Hash32, sum uint32) {
// WIP
}
func (r *Reader32) Read(p []byte) (int, error) {
// WIP
}
| package proof
import (
"errors"
"hash"
"io"
)
var EHASHFAIL error = errors.New("checksum mismatch")
type Reader32 struct {
r io.Reader
h hash.Hash32
sum uint32
}
func NewReader32(r io.Reader, h hash.Hash32, sum uint32) *Reader32 {
if r == nil || h == nil {
return nil
}
r32 := &Reader32{r, h, sum}
re... | Make Reader32 pass CRC32 test | Make Reader32 pass CRC32 test | Go | bsd-2-clause | arsatiki/proof |
a455258a62c81da600b2d15b7cd61493398367ed | cmd/syncthing/gui_embedded.go | cmd/syncthing/gui_embedded.go | //+build !guidev
package main
import (
"fmt"
"log"
"mime"
"net/http"
"path/filepath"
"time"
"github.com/calmh/syncthing/auto"
)
func embeddedStatic() interface{} {
var modt = time.Now().UTC().Format(http.TimeFormat)
return func(res http.ResponseWriter, req *http.Request, log *log.Logger) {
file := req.U... | //+build !guidev
package main
import (
"fmt"
"log"
"mime"
"net/http"
"path/filepath"
"time"
"github.com/calmh/syncthing/auto"
)
func embeddedStatic() interface{} {
var modt = time.Now().UTC().Format(http.TimeFormat)
return func(res http.ResponseWriter, req *http.Request, log *log.Logger) {
file := req.U... | Fix typo in header name | Fix typo in header name | Go | mpl-2.0 | makeTaller/syncthing,letiemble/syncthing,beni55/syncthing,toddleish/syncthing,trojanspike/syncthing,arkhi/syncthing,ZdenekBrichacek/syncthing,canton7/syncthing,guerrerocarlos/syncthing,syncthing/syncthing,kluppy/syncthing,buinsky/syncthing,kattunga/syncthing,jedie/syncthing,rumpelsepp/syncthing,alex2108/syncthing,jryan... |
cff7f677ac1f06c742caba8aadad6afcb5dfabd9 | ghostinspector.go | ghostinspector.go | package ghostinspector
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// APIV1Path is the protocol and base path of the Ghost Inspector API version 1
const APIV1Path = "https://api.ghostinspector.com/v1"
// GhostInspector handles sending to the API
type GhostInspector struct {
apikey string
}
// New c... | package ghostinspector
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// APIV1Path is the protocol and base path of the Ghost Inspector API version 1
const APIV1Path = "https://api.ghostinspector.com/v1"
// GhostInspector handles sending to the API
type GhostInspector struct {
apikey string
}
// New c... | Update comment about the New function | Update comment about the New function
| Go | mit | lukevers/ghostinspector |
5b1f398a18dd24ddbc61b323b609decf90dec5ef | pkg/slinga/progress.go | pkg/slinga/progress.go | package slinga
import (
"fmt"
"github.com/gosuri/uiprogress"
"github.com/gosuri/uiprogress/util/strutil"
"time"
)
func NewProgress() *uiprogress.Progress {
progress := uiprogress.New()
progress.RefreshInterval = time.Second
progress.Start()
return progress
}
func AddProgressBar(progress *uiprogress.Progress... | package slinga
import (
"fmt"
"github.com/gosuri/uiprogress"
"time"
)
func NewProgress() *uiprogress.Progress {
progress := uiprogress.New()
progress.RefreshInterval = time.Second
progress.Start()
return progress
}
func AddProgressBar(progress *uiprogress.Progress, total int) *uiprogress.Bar {
progressBar :... | Use native elapsed time printer | Use native elapsed time printer
| Go | apache-2.0 | Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi,Aptomi/aptomi |
3cb9f5269864c823ed2919945d93ceee924a0097 | common/common.go | common/common.go | /*
Copyright 2015 Nodetemple <hostmaster@nodetemple.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | /*
Copyright 2015 Nodetemple <hostmaster@nodetemple.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | Set primary list of available providers | Set primary list of available providers
| Go | apache-2.0 | nodetemple/nodetemple,nodetemple/nodetemple |
6acad02d47687ca3b388b480db5982888ab184f9 | cues/cueTemplate.go | cues/cueTemplate.go | package cues
import (
"errors"
"strings"
)
type CueTemplate struct {
Mapping map[string]int
} //end CueTemplate
func (tmpl CueTemplate) Create(headers []string) (CueTemplate, error) {
var err error
tmpl.Mapping = make(map[string]int)
//iterate headers
for i := range headers {
//check name match
header :=... | package cues
import (
"errors"
"strings"
)
type CueTemplate struct {
Mapping map[string]int
} //end CueTemplate
func (tmpl CueTemplate) Create(headers []string) (CueTemplate, error) {
var err error
tmpl.Mapping = make(map[string]int)
//iterate headers
for i := range headers {
//check name match
header :=... | Add support for Follow in its own column | Add support for Follow in its own column
| Go | mit | woz5999/CueDescriptionsToASCII,woz5999/CueDescriptionsToASCII,woz5999/CueDescriptionsToASCII |
53ac59756d5caba6b2e3cef392e462455d081d63 | bigtable/cmd/emulator/cbtemulator.go | bigtable/cmd/emulator/cbtemulator.go | // Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... | // Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... | Disable grpc tracing for emulator server | bigtable/emulator: Disable grpc tracing for emulator server
Change-Id: I4ec7670fe2b1b880c4dc7dfdae8acd09993031df
Reviewed-on: https://code-review.googlesource.com/9091
Reviewed-by: Jonathan Amsterdam <e3d3698b2ccd5955e4adf250d0785062d0f9018b@google.com>
| Go | apache-2.0 | googleapis/google-cloud-go,googleapis/google-cloud-go,googleapis/google-cloud-go,googleapis/google-cloud-go,michael-grosshans/google-cloud-go,michael-grosshans/google-cloud-go |
320ab1bc739807472101aeb4a2b096b0411b4ec5 | 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... | Revert "Make IntComparator a bit more direct" | Revert "Make IntComparator a bit more direct"
| Go | bsd-2-clause | cagnosolutions/gods |
f2d2ed1a58e630a78c7dfcc7776fee539575bdf5 | repositories_test.go | repositories_test.go | package octokat
import (
"github.com/bmizerany/assert"
"os"
"testing"
)
func TestRepositories(t *testing.T) {
c := NewClient().WithToken(os.Getenv("GITHUB_TOKEN"))
repo := Repo{"octokat", "jingweno"}
repository, err := c.Repository(repo)
assert.Equal(t, nil, err)
assert.Equal(t, "octokat", repository.Name)
... | package octokat
import (
"github.com/bmizerany/assert"
"os"
"testing"
)
func TestRepositories(t *testing.T) {
c := NewClient().WithToken(os.Getenv("GITHUB_TOKEN"))
repo := Repo{"octokat", "jingweno"}
repository, err := c.Repository(repo)
assert.Equal(t, nil, err)
assert.Equal(t, "octokat", repository.Name)
... | Add test case for repository not found | Add test case for repository not found
| Go | mit | crosbymichael/octokat,octokit/go-octokit,pcasaretto/go-octokit,pcasaretto/go-octokit,SvenDowideit/octokat,half-ogre/go-octokit,calavera/go-octokit,octokit/go-octokit,half-ogre/go-octokit,calavera/go-octokit |
328a01f9020475ef6eecc16ceda60d93e1ea64da | cmd/gomicbot/SayHiMessageConsumer.go | cmd/gomicbot/SayHiMessageConsumer.go | package main
import "github.com/ssandke/gomicbot/Godeps/_workspace/src/github.com/tucnak/telebot"
type SayHiMessageConsumer struct {
bot *telebot.Bot
store StateStore
}
func (c *SayHiMessageConsumer) Initialize(config *Configuration, store StateStore, bot *telebot.Bot) error {
c.bot = bot
c.store = store
ret... | package main
import "github.com/ssandke/gomicbot/Godeps/_workspace/src/github.com/tucnak/telebot"
type SayHiMessageConsumer struct {
bot *telebot.Bot
store StateStore
}
func (c *SayHiMessageConsumer) Initialize(config *Configuration, store StateStore, bot *telebot.Bot) error {
c.bot = bot
c.store = store
ret... | Support direct message to the bot in group chats. | Support direct message to the bot in group chats.
| Go | mit | ssandke/gomicbot |
624b5b9081477a5379751e93ae590c87d151d22a | pkg/cli/cli.go | pkg/cli/cli.go | package cli
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "polymerase",
Short: "MySQL backup management API integreted with Percona Xtrabackup",
SilenceUsage: true,
}
// Run creates, configures and runs
func Run() {
if err := rootCmd.Execute(); err != nil {... | package cli
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "polymerase",
Short: "MySQL backup management API integreted with Percona Xtrabackup",
SilenceUsage: true,
}
// Run executes rootCmd.Execute().
func Run() {
if err := rootCmd.Execute(); err != nil {
... | Remove unused codes and add comment | Remove unused codes and add comment
| Go | apache-2.0 | taku-k/polymerase,taku-k/polymerase,taku-k/polymerase,taku-k/polymerase |
a023359610a37f58f2fec069911e4a1c2f1728a2 | cmd/systemd-provider/main.go | cmd/systemd-provider/main.go | package main
import (
"os"
log "github.com/Sirupsen/logrus"
logx "github.com/cerana/cerana/pkg/logrusx"
"github.com/cerana/cerana/provider"
"github.com/cerana/cerana/providers/systemd"
flag "github.com/spf13/pflag"
)
func main() {
log.SetFormatter(&logx.JSONFormatter{})
config := systemd.NewConfig(nil, nil)... | package main
import (
"os"
log "github.com/Sirupsen/logrus"
logx "github.com/cerana/cerana/pkg/logrusx"
"github.com/cerana/cerana/provider"
"github.com/cerana/cerana/providers/systemd"
flag "github.com/spf13/pflag"
)
func main() {
log.SetFormatter(&logx.JSONFormatter{})
config := systemd.NewConfig(nil, nil)... | Fix systemd unit_file_dir flag name for consistency | Fix systemd unit_file_dir flag name for consistency
| Go | mit | cerana/cerana,cerana/cerana,cerana/cerana,cerana/cerana |
66f0d14a2cbd4677de3ce1557715bda7b9c373d8 | go/vt/vtadmin/http/schemas.go | go/vt/vtadmin/http/schemas.go | /*
Copyright 2021 The Vitess 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, soft... | /*
Copyright 2021 The Vitess 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, soft... | Implement http wrapper for vtdammin GetSchema | Implement http wrapper for vtdammin GetSchema
Signed-off-by: Andrew Mason <8a240ff75aa1467ba5eba4db0c8200b61262547e@slack-corp.com>
| Go | apache-2.0 | mahak/vitess,vitessio/vitess,mahak/vitess,mahak/vitess,tinyspeck/vitess,mahak/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,mahak/vitess,tinyspeck/vitess,vitessio/vitess,tinyspeck/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,tinyspeck/vitess,tinyspeck/vitess,tinyspeck/vitess... |
7a7ebc43af079147cce39e14d1996a963663717f | services/pihole/pihole.go | services/pihole/pihole.go | package pihole
type Service struct{}
func (s Service) UserData() string {
return `
- name: pihole-etc-host.service
command: start
content: |
[Unit]
Description=pihole /etc/hosts entry
ConditionFirstBoot=true
[Service]
User=root
Type=oneshot
Exe... | package pihole
type Service struct{}
func (s Service) UserData() string {
return `
- name: pihole-etc-host.service
command: start
content: |
[Unit]
Description=pihole /etc/hosts entry
ConditionFirstBoot=true
[Service]
User=root
Type=oneshot
Exe... | Fix Pi-hole docker tag (alpine was deprecated) | Fix Pi-hole docker tag (alpine was deprecated)
| Go | unlicense | dan-v/dosxvpn,dan-v/dosxvpn,dan-v/dosxvpn |
cd50e761184347d5f78d04df46c29d7a4267090e | logsrv/logsrvc/client_test.go | logsrv/logsrvc/client_test.go | package logsrvc
import (
"flag"
"fmt"
"testing"
)
var (
logSrv string
logger *Logger
)
func init() {
flAddr := flag.String("a", "127.0.0.1:5988", "address of log server")
flag.Parse()
logSrv = *flAddr
}
func TestConnect(t *testing.T) {
var err error
logger, err =... | package logsrvc
import (
"flag"
"fmt"
"testing"
)
var (
logSrv string
logger *Logger
)
func init() {
flAddr := flag.String("address", "127.0.0.1:5988", "address of log server")
flag.Parse()
logSrv = *flAddr
}
func TestConnect(t *testing.T) {
var err error
logger,... | Change flag for remote server address in test file. | Change flag for remote server address in test file.
| Go | isc | gokyle/kludge |
64f0b206d05985900001783a2dcd637572ef9994 | route/match.go | route/match.go | package route
import (
"fmt"
"net/http"
"regexp"
)
type matcher func(req *http.Request) ([]string, bool)
var (
uuidSlug *regexp.Regexp
anySlug *regexp.Regexp
)
func init() {
uuidSlug = regexp.MustCompile(":uuid")
anySlug = regexp.MustCompile(":[a-z]+")
}
func newMatch(pat string) matcher {
pat = uuidSlug.... | package route
import (
"fmt"
"net/http"
"regexp"
)
type matcher func(req *http.Request) ([]string, bool)
var (
uuidSlug *regexp.Regexp
anySlug *regexp.Regexp
)
func init() {
anySlug = regexp.MustCompile(":[a-z]+")
}
func newMatch(pat string) matcher {
pat = anySlug.ReplaceAllString(pat, "([^/]+)")
re := ... | Fix :uuid handling in route | Fix :uuid handling in route
| Go | mit | starkandwayne/shield,starkandwayne/shield,starkandwayne/shield,starkandwayne/shield,starkandwayne/shield |
c6f6094b3e7dfc3f4c72fcf264377f23305b2a1a | src/main.go | src/main.go | package main
import (
"flag"
// "fmt"
"io/ioutil"
"log"
"runtime"
)
func main() {
runtime.GOMAXPROCS(2)
flag.Parse()
if flag.NArg() != 1 {
flag.Usage()
log.Fatalf("FILE: the .rb file to execute")
}
file := flag.Arg(0)
buffer, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
p := &L... | package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"runtime"
)
func main() {
runtime.GOMAXPROCS(2)
// Flag initialization
var printAST, printInst bool
flag.BoolVar(&printAST, "ast", false, "Print abstract syntax tree structure")
flag.BoolVar(&printInst, "bytecode", false, "Print comprehensive bytecode in... | Add CLI arguments for printing AST and bytecode | Add CLI arguments for printing AST and bytecode
| Go | mit | brucehsu/GobiesVM,Ye-Yong-Chi/GobiesVM,brucehsu/GobiesVM,Ye-Yong-Chi/GobiesVM |
03674b95468a492d93d52e08e77c962d85ec531a | gtk/gtk_export_since_3_10.go | gtk/gtk_export_since_3_10.go | // +build !gtk_3_6,!gtk_3_8
package gtk
// #cgo pkg-config: gtk+-3.0
// #include <gtk/gtk.h>
import "C"
import (
"unsafe"
)
//export goListBoxFilterFuncs
func goListBoxFilterFuncs(row *C.GtkListBoxRow, userData C.gpointer) C.gboolean {
id := int(uintptr(userData))
listBoxFilterFuncRegistry.Lock()
r := listBoxF... | // +build !gtk_3_6,!gtk_3_8
package gtk
// #cgo pkg-config: gtk+-3.0
// #include <gtk/gtk.h>
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/glib"
)
//export goListBoxFilterFuncs
func goListBoxFilterFuncs(row *C.GtkListBoxRow, userData C.gpointer) C.gboolean {
id := int(uintptr(userData))
listBoxFilterFun... | Resolve merge conflicts for metho menumodel wrapping | Resolve merge conflicts for metho menumodel wrapping
| Go | isc | gotk3/gotk3,gotk3/gotk3 |
8bc33be84a326e08fdfd47a16a5b9179a8d58230 | utils/utils.go | utils/utils.go | package utils
func CheckError(e error) {
if e != nil {
panic(e)
}
}
| package utils
import (
"fmt"
"strconv"
"strings"
)
func CheckError(e error) {
if e != nil {
panic(e)
}
}
func ReportError(line int, column int, where string, message string) {
fmt.Printf("Error: %v\n", message)
fmt.Printf(" %v | %v\n", line, where)
fmt.Printf("%v^--\n", strings.Repeat(" ... | Add custom style to error reporting function | Add custom style to error reporting function
* Along with the line number, it shows the column also.
With a indicator pointing to the error-prone source code.
| Go | mit | pravj/glox,pravj/glox |
9bd714adb545abd5eaeb19c36a4d897fe4a9f41d | balancer/cmd/balancer/main.go | balancer/cmd/balancer/main.go | package main
import (
"fmt"
"os"
"os/exec"
"os/signal"
"syscall"
"github.com/squaremo/ambergreen/balancer"
"github.com/squaremo/ambergreen/balancer/fatal"
)
func iptables(args []string) ([]byte, error) {
return exec.Command("iptables", args...).CombinedOutput()
}
func main() {
exitCode := 0
defer os.Exit(... | package main
import (
"fmt"
"os"
"os/exec"
"os/signal"
"syscall"
"github.com/squaremo/ambergreen/balancer"
"github.com/squaremo/ambergreen/balancer/fatal"
)
func iptables(args []string) ([]byte, error) {
return exec.Command("iptables", args...).CombinedOutput()
}
func main() {
// Catch some signals for whc... | Improve signal handling in balancer | Improve signal handling in balancer
| Go | apache-2.0 | squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen,squaremo/ambergreen |
76308a796ca11b4eacc063971d25fa40b5842907 | pkg/auth/dependency/oidc/metadata.go | pkg/auth/dependency/oidc/metadata.go | package oidc
import "github.com/skygeario/skygear-server/pkg/auth/dependency/urlprefix"
type MetadataProvider struct {
URLPrefix urlprefix.Provider
JWKSEndpoint JWKSEndpointProvider
UserInfoEndpoint UserInfoEndpointProvider
}
func (p *MetadataProvider) PopulateMetadata(meta map[string]interface{}) {
m... | package oidc
import "github.com/skygeario/skygear-server/pkg/auth/dependency/urlprefix"
type MetadataProvider struct {
URLPrefix urlprefix.Provider
JWKSEndpoint JWKSEndpointProvider
UserInfoEndpoint UserInfoEndpointProvider
}
func (p *MetadataProvider) PopulateMetadata(meta map[string]interface{}) {
m... | Add custom claims to supported claims | Add custom claims to supported claims
| Go | apache-2.0 | SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server |
0dd412a962419cf7e8be62d0b3254d907f5354e3 | observers/logger_observer.go | observers/logger_observer.go | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/world"
)
type LoggerObserver struct{}
func (LoggerObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) {
go func() {
for event := range w.Events(stop, chanSnakeObserverEventsBuffer) {
s... | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/world"
)
type LoggerObserver struct{}
func (LoggerObserver) Observe(stop <-chan struct{}, w *world.World, logger logrus.FieldLogger) {
go func() {
for event := range w.Events(stop, chanSnakeObserverEventsBuffer) {
s... | Create world event type in debug event logging | Create world event type in debug event logging
| Go | bsd-2-clause | ivan1993spb/clever-snake |
bcb9ce2498d52214ca4fde9bab8a6b415c350eff | ql/test/query-tests/Security/CWE-089/tst.go | ql/test/query-tests/Security/CWE-089/tst.go | package main
import (
"encoding/json"
"fmt"
)
func marshal(version interface{}) string {
versionJSON, err := json.Marshal(version)
if err != nil {
return fmt.Sprintf("error: '%v'", err) // OK
}
return versionJSON
}
| package main
import (
"encoding/json"
"fmt"
)
func marshal(version interface{}) string {
versionJSON, err := json.Marshal(version)
if err != nil {
return fmt.Sprintf("error: '%v'", err) // OK
}
return string(versionJSON)
}
type StringWrapper struct {
s string
}
func marshalUnmarshal(w1 StringWrapper) (stri... | Add another test for StringBreak. | Add another test for StringBreak.
| Go | mit | github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql |
9807070e22c9dce4c871dc8ab5d03a7f0fd71dfd | physical/azure_test.go | physical/azure_test.go | package physical
import (
"fmt"
"os"
"testing"
"time"
"github.com/hashicorp/vault/helper/logformat"
log "github.com/mgutz/logxi/v1"
"github.com/Azure/azure-storage-go"
)
func TestAzureBackend(t *testing.T) {
if os.Getenv("AZURE_ACCOUNT_NAME") == "" ||
os.Getenv("AZURE_ACCOUNT_KEY") == "" {
t.SkipNow()
... | package physical
import (
"fmt"
"os"
"testing"
"time"
"github.com/hashicorp/vault/helper/logformat"
log "github.com/mgutz/logxi/v1"
"github.com/Azure/azure-storage-go"
)
func TestAzureBackend(t *testing.T) {
if os.Getenv("AZURE_ACCOUNT_NAME") == "" ||
os.Getenv("AZURE_ACCOUNT_KEY") == "" {
t.SkipNow()
... | Fix azure test round 2 | Fix azure test round 2
| Go | mpl-2.0 | lemondrank/vault,quixoten/vault,hashicorp/vault,MonsantoCo/vault,wjam/vault,michaelansel/vault,hartsock/vault,joelthompson/vault,rnaveiras/vault,mgk/vault,tallpauley/vault,deverton/hashicorp-vault,Caiyeon/vault,hashicorp/vault,hartsock/vault,naunga/vault,quixoten/vault,lirao/vault,kingland/vault,ryon/vault,Aloomaio/vau... |
5d6e6dd0f52a5c0c1ddd57ada2c8f7f10b1cbf92 | models/cc_upload_staging_uri_key.go | models/cc_upload_staging_uri_key.go | package models
const CcBuildArtifactsUploadUriKey = "cc-build-artifacts-upload-uri"
const CcDropletUploadUriKey = "cc-droplet-upload-uri"
| package models
const CcBuildArtifactsUploadUriKey = "cc-build-artifacts-upload-uri"
const CcDropletUploadUriKey = "cc-droplet-upload-uri"
const CcTimeoutKey = "timeout"
| Add timeout key for file-server | Add timeout key for file-server
[#82415708]
| Go | apache-2.0 | cloudfoundry-incubator/runtime-schema |
391b3d121f295646dbcf02ae46a401d68482b32e | src/storage_node/datasource/pgstore/util_test.go | src/storage_node/datasource/pgstore/util_test.go | package pgstorage
import (
"testing"
)
func TestCollectionFieldToSelector(t *testing.T) {
tests := []struct {
Input []string
Output string
}{
{
Input: []string{"data", "a", "b", "innervalue"},
Output: "data->'a'->'b'->>'innervalue'",
},
{
Input: []string{"data", "innervalue"},
Output: "dat... | package pgstorage
import (
"testing"
"github.com/jacksontj/dataman/src/datamantype"
)
func TestCollectionFieldToSelector(t *testing.T) {
tests := []struct {
Input []string
Output string
}{
{
Input: []string{"data", "a", "b", "innervalue"},
Output: "data->'a'->'b'->>'innervalue'",
},
{
Input:... | Add some Value serialziation tests | Add some Value serialziation tests
| Go | mit | jacksontj/dataman |
6b4c45929a3c4b71621b3e1c66b27a9eac52684d | ctxdownload/doc.go | ctxdownload/doc.go | /*
ctxdownload is a Golang package which provides helper functions for performing context-aware download task.
*/
package ctxdownload
| /*
Package ctxdownload is a Golang package which provides helper functions for performing context-aware download task.
*/
package ctxdownload
| Add 'Package' before description to remove golint warnings. | Add 'Package' before description to remove golint warnings.
| Go | mit | northbright/ctx |
7fed3eb489a409da0ff0fd96f2d28fad1716eec9 | handler/marshaling.go | handler/marshaling.go | package handler
import (
"github.com/mondough/phosphor/domain"
"github.com/mondough/phosphor/proto"
)
func prettyFormatTrace(t *domain.Trace) interface{} {
return map[string]interface{}{
"annotations": formatAnnotations(t.Annotation),
}
}
func formatAnnotations(ans []*domain.Annotation) interface{} {
// Conve... | package handler
import (
"sort"
"github.com/mondough/phosphor/domain"
"github.com/mondough/phosphor/proto"
)
func prettyFormatTrace(t *domain.Trace) interface{} {
return map[string]interface{}{
"annotations": formatAnnotations(t.Annotation),
}
}
func formatAnnotations(ans []*domain.Annotation) interface{} {
... | Sort annotations by wall clock time on api response | Sort annotations by wall clock time on api response
| Go | apache-2.0 | mondough/phosphor,mattheath/phosphor,mondough/phosphor,mattheath/phosphor |
512d3e5cc82c945a6b038e238a5c13ca26e0ce7e | platform-tests/src/acceptance/python_buildpack_test.go | platform-tests/src/acceptance/python_buildpack_test.go | package acceptance_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
)
var _ = Describe("PythonBuildpack", func() {
var (
appName string
)
... | package acceptance_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
)
var _ = Describe("PythonBuildpack", func() {
var (
appName string
)
... | Change timeout for test python_buildpack Procfile | Change timeout for test python_buildpack Procfile
The Python apps take longer to stage. We found out that the current
`cf start` for the python buildpack test is timing out, specially
when running the test.
That is very likely due the multiple nodes causing load on the platform.
To reduce the number of failures, we ... | Go | mit | alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf |
8caadfd07344b0327e36eace8e24c75ad588b75c | 5_4.go | 5_4.go | package h2spec
import (
"github.com/bradfitz/http2"
"io"
"time"
)
func TestErrorHandling(ctx *Context) {
PrintHeader("5.4. Error Handling", 0)
TestConnectionErrorHandling(ctx)
PrintFooter()
}
func TestConnectionErrorHandling(ctx *Context) {
PrintHeader("5.4.1. Connection Error Handling", 1)
func(ctx *Contex... | package h2spec
import (
"github.com/bradfitz/http2"
"io"
"time"
)
func TestErrorHandling(ctx *Context) {
PrintHeader("5.4. Error Handling", 0)
TestConnectionErrorHandling(ctx)
PrintFooter()
}
func TestConnectionErrorHandling(ctx *Context) {
PrintHeader("5.4.1. Connection Error Handling", 1)
func(ctx *Contex... | Fix wrong error code in 5.4 test. | Fix wrong error code in 5.4 test.
Section 5.1 of http2-16 states that an idle stream receiving a frame other than HEADERS, PUSH_PROMISE, or PRIORITY must be treated as a PROTOCOL_ERROR.
| Go | mit | shane-kearns/h2spec,summerwind/h2spec,kazuho/h2spec,rmoorman/h2spec |
b59c260d4a4c7d6d1d39c0d7347dcab090edc70f | doc.go | doc.go | /*
Package ghostinspector provides a basic API wrapper around the Ghost Inspector
API.
Usage:
import "github.com/lukevers/ghostinspector"
Construct a new `GhostInspector` client. You will need an API key, which you
can get from your dashboard.
client := ghostinspector.New("api_key")
Once you have a client, you c... | /*
Package ghostinspector provides a basic API wrapper around the Ghost Inspector
API.
Note: This package currently uses interfaces to unmarshal JSON in a lot of
places. Version 2 of this package is going to have complete defined structs in
all locations possbile (Suites, Tests, ...) to provide a better SDK to work
wi... | Add a note about the interface usage. | Add a note about the interface usage.
And also a note about v2
| Go | mit | lukevers/ghostinspector |
81fe3fd8620c328ad0bf3bba0b95dafa620c66c0 | discord.go | discord.go | package main
import (
"os"
"os/signal"
"syscall"
"github.com/underlx/disturbancesmlx/discordbot"
)
// DiscordBot starts the Discord bot if it is enabled in the settings
func DiscordBot() {
discordToken, present := secrets.Get("discordToken")
if !present {
discordLog.Println("Discord token not found, Discord ... | package main
import (
"os"
"os/signal"
"syscall"
"github.com/underlx/disturbancesmlx/discordbot"
)
// DiscordBot starts the Discord bot if it is enabled in the settings
func DiscordBot() {
discordToken, present := secrets.Get("discordToken")
if !present {
discordLog.Println("Discord token not found, Discord ... | Fix server not closing on sigterm/interrupt | Fix server not closing on sigterm/interrupt
| Go | apache-2.0 | gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx,gbl08ma/disturbancesmlx |
4e011639cff399e31306ea96ec2ece164f65f3ef | resources/ec2/route_table.go | resources/ec2/route_table.go | package ec2
import (
"github.com/jagregory/cfval/constraints"
"github.com/jagregory/cfval/resources/common"
. "github.com/jagregory/cfval/schema"
)
// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
var RouteTable = Resource{
AwsType: "AWS::EC2::RouteTable",
... | package ec2
import (
"github.com/jagregory/cfval/constraints"
"github.com/jagregory/cfval/resources/common"
. "github.com/jagregory/cfval/schema"
)
// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
var RouteTable = Resource{
AwsType: "AWS::EC2::RouteTable",
... | Update RouteTable Ref value to a RouteTableID | Update RouteTable Ref value to a RouteTableID
| Go | mit | jagregory/cfval,jagregory/cfval |
542d32aef0bbcc67401d088cfd93cb3d80e543bf | gochatbot.go | gochatbot.go | package main // import "cirello.io/gochatbot"
import (
"log"
"os"
"cirello.io/gochatbot/bot"
"cirello.io/gochatbot/brain"
"cirello.io/gochatbot/providers"
"cirello.io/gochatbot/rules/cron"
"cirello.io/gochatbot/rules/regex"
)
func main() {
provider := providers.Detect(os.Getenv)
memory := brain.Detect(os.Ge... | package main // import "cirello.io/gochatbot"
import (
"log"
"os"
"cirello.io/gochatbot/bot"
"cirello.io/gochatbot/brain"
"cirello.io/gochatbot/providers"
"cirello.io/gochatbot/rules/cron"
"cirello.io/gochatbot/rules/regex"
)
func main() {
name := os.Getenv("GOCHATBOT_NAME")
if name == "" {
name = "gochat... | Reorganize bot start sequence, including custom naming | Reorganize bot start sequence, including custom naming
| Go | mit | ccirello/gochatbot,ccirello/gochatbot,ccirello/gochatbot |
25c380d93d7546713cd5af35558217faa674835b | watch.go | watch.go | // (c) 2012 Alexander Solovyov
// under terms of ISC license
package main
import (
"github.com/howeyc/fsnotify"
"os"
"path/filepath"
)
func Watcher(config *SiteConfig) (chan string, error) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
return nil, err
}
ch := make(chan string, 10)
go func() {
... | // (c) 2012 Alexander Solovyov
// under terms of ISC license
package main
import (
"github.com/howeyc/fsnotify"
"os"
"path/filepath"
)
func Watcher(config *SiteConfig) (chan string, error) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
return nil, err
}
ch := make(chan string, 10)
go func() {
... | Watch config.Source instead of config.Output | Watch config.Source instead of config.Output
Fixes an issue which caused the watcher to not trigger re-builds, as it
was incorrectly watching the output folder.
| Go | isc | holic/gostatic,sisteamnik/gostatic,beni55/gostatic,greyhwndz/gostatic,krpors/gostatic,greyhwndz/gostatic,piranha/gostatic,piranha/gostatic,sisteamnik/gostatic,zhuharev/gostatic,beni55/gostatic,krpors/gostatic,zhuharev/gostatic,holic/gostatic |
0a49f8cea2f456f254555f2eadc85a276280d4b1 | cgo.go | cgo.go | // Copyright © 2015-2019 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
// #cgo !no_pkg_config,!yara_static pkg-config: yara
// #cgo !no_pkg_config,yara_static pkg-config: --static yara
/... | // Copyright © 2015-2019 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
// #cgo !no_pkg_config,!yara_static pkg-config: yara
// #cgo !no_pkg_config,yara_static pkg-config: --static yara
/... | Check for YARA version 3, refuse to build otherwise | Check for YARA version 3, refuse to build otherwise
| Go | bsd-2-clause | VirusTotal/go-yara,hillu/go-yara,hillu/go-yara |
db25a136ea869458dba25f36cf2c650114a5170b | geodns.go | geodns.go | package main
import (
"flag"
"log"
"os"
"os/signal"
)
var (
listen = flag.String("listen", ":8053", "set the listener address")
flaglog = flag.Bool("log", false, "be more verbose")
flagrun = flag.Bool("run", false, "run server")
)
func main() {
log.SetPrefix("geodns ")
log.SetFlags(log.Lmicroseconds | log... | package main
import (
"flag"
"log"
"os"
"os/signal"
)
var (
listen = flag.String("listen", ":8053", "set the listener address")
flaglog = flag.Bool("log", false, "be more verbose")
flagrun = flag.Bool("run", false, "run server")
)
func main() {
log.SetPrefix("geodns ")
log.SetFlags(log.Lmicroseconds | log... | Simplify 'wait until interrupt signal' code | Simplify 'wait until interrupt signal' code
(thanks to Uriel on #go-nuts)
| Go | apache-2.0 | abligh/geodns,anuaimi/geodns,gofort/geodns,abh/geodns,abligh/geodns,anuaimi/geodns,abh/geodns,anuaimi/geodns,abligh/geodns,gofort/geodns,gofort/geodns |
c9fb1a19b1428d65ecd7685871e583ec09855e98 | codeutilsShared.go | codeutilsShared.go | package codeutilsShared
import (
"crypto/sha512"
"encoding/hex"
"os"
)
var UniversalFileMode os.FileMode // Define universalFileMode as a file mode we'll wherever we can
func init() {
UniversalFileMode = 0744 // Only read/write/executable by owner, readable by group and others
}
// Sha512Sum
// This function wi... | package codeutilsShared
import (
"crypto/sha512"
"encoding/hex"
"os"
)
var GlobalFileMode os.FileMode // Define GlobalFileMode as a file mode we'll use for "global" operations such as when doing IO as root
var UniversalFileMode os.FileMode // Define universalFileMode as a file mode we'll wherever we can
func i... | Add GlobalFileMode for 0777 operations. | Add GlobalFileMode for 0777 operations.
| Go | apache-2.0 | StroblIndustries/codeutilsShared,StroblIndustries/coreutils |
6619cd089593564d3e438b02fe64e9400a7de7e7 | go/ioutil2/ioutil.go | go/ioutil2/ioutil.go | // Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package ioutil2 provides extra functionality along similar lines to io/ioutil.
package ioutil2
import (
"io"
"io/ioutil"
"os"
"path"
)
// Write file to te... | // Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package ioutil2 provides extra functionality along similar lines to io/ioutil.
package ioutil2
import (
"io"
"io/ioutil"
"os"
"path"
)
// Write file to te... | Fix atomic file write to force a Sync and not shadow an error. | Fix atomic file write to force a Sync and not shadow an error.
| Go | apache-2.0 | anusornc/vitess,HubSpot/vitess,skyportsystems/vitess,SDHM/vitess,dcadevil/vitess,HubSpot/vitess,applift/vitess,AndyDiamondstein/vitess,aaijazi/vitess,mlc0202/vitess,SDHM/vitess,atyenoria/vitess,tirsen/vitess,anusornc/vitess,HubSpot/vitess,yangzhongj/vitess,atyenoria/vitess,alainjobart/vitess,xgwubin/vitess,anusornc/vit... |
7979fcfe42377c37b156869b8d5241b7e3387415 | http/log/log_test.go | http/log/log_test.go | package log
import (
"bytes"
"log"
"net/http"
"net/http/httptest"
"regexp"
"testing"
)
func TestCommonLogHandler(t *testing.T) {
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Path", r.URL.Path)
w.Write([]byte("Testing 1 2 3"))
})
// output := ""
logw := bytes.Ne... | package log
import (
"bytes"
"log"
"net/http"
"net/http/httptest"
"regexp"
"testing"
)
func TestCommonLogHandler(t *testing.T) {
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.URL.Path = "/changed"
w.Header().Set("X-Path", r.URL.Path)
w.Write([]byte("Testing 1 2 3"))
})
// outp... | Add test that changing the request struct doesn't affect logging | Add test that changing the request struct doesn't affect logging
| Go | mit | 99designs/goodies |
d9502b072ef70f0463bd03f13a87ce24a76c5128 | filesystem/uris.go | filesystem/uris.go | package filesystem
import (
"log"
"os/user"
"path/filepath"
"sync"
)
func GetSymLinkURI(uri string) string {
userDir := GetUserDirURI()
_, fileName := filepath.Split(uri)
symLinkUri := filepath.Join(userDir, fileName)
return symLinkUri
}
var userDirOnce sync.Once
var userDirUri string
func GetUserDirURI(... | package filesystem
import (
"log"
"os/user"
"path/filepath"
)
func GetSymLinkURI(uri string) string {
userDir := GetUserDirURI()
_, fileName := filepath.Split(uri)
symLinkUri := filepath.Join(userDir, fileName)
return symLinkUri
}
func GetUserDirURI() string {
currentUser, err := user.Current()
if err !... | Remove caching of user home directory | Remove caching of user home directory
I didn't like how this code looked, the functionality of it wasn't all
that important. All it was doing was storing the string of the user's
home directory for performances sake.
| Go | mit | drpotato/dotdot |
697c3eb341b1d415b82038e0ec7a8c9d493b079f | lib/stmt/supervisor_permission.go | lib/stmt/supervisor_permission.go | /*-
* Copyright (c) 2016, 1&1 Internet SE
* All rights reserved
*/
package stmt
const LoadPermissions = `
SELECT permission_id,
permission_name
FROM soma.permissions;`
// vim: ts=4 sw=4 sts=4 noet fenc=utf-8 ffs=unix
| /*-
* Copyright (c) 2016, 1&1 Internet SE
* All rights reserved
*/
package stmt
const LoadPermissions = `
SELECT permission_id,
permission_name
FROM soma.permissions;`
const AddPermissionCategory = `
INSERT INTO soma.permission_types (
permission_type,
created_by
)
SELECT $1::varc... | Add SQL statements for PermissionCategory | Add SQL statements for PermissionCategory
| Go | bsd-2-clause | 1and1/soma |
0461b24a25b1aca05adb282cf0fed557f25a6ec6 | core/common/privdata/policies.go | core/common/privdata/policies.go | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package privdata
import "github.com/hyperledger/fabric/protos/ledger/rwset"
// SerializedPolicy defines a persisted policy
type SerializedPolicy interface {
// Channel returns the channel this SerializedPolicy corresponds to
Channe... | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package privdata
import (
"github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/ledger/rwset"
)
// SerializedPolicy defines a persisted policy
type SerializedPolicy interface {
// Channel returns the ... | Update privData policy API with SignedData | [FAB-5863] Update privData policy API with SignedData
This commit removes the SerializedIdentity from the API
and replaces it with the commonly used SignedData proto type.
Change-Id: Id841dbb81152703d1254bc180869d216f33101ac
Signed-off-by: yacovm <632344b5da9bd743456189af4db4b56472defb8c@il.ibm.com>
| Go | apache-2.0 | lukehuangch/fabric,muralisrini/fabric,manish-sethi/fabric-sidedb,muralisrini/fabric,ckeyer/fabric,lukehuangch/fabric,lukehuangch/fabric,binhn/fabric,mqshen/fabric,jimthematrix/fabric,ckeyer/fabric,manish-sethi/fabric-sidedb,binhn/fabric,manish-sethi/fabric-sidedb,xixuejia/fabric,ckeyer/fabric,lukehuangch/fabric,mqshen/... |
33f9460667d9fde7c765459e4d003f0326793bc3 | cmd/imagetool/showImage.go | cmd/imagetool/showImage.go | package main
import (
"fmt"
"os"
"github.com/Symantec/Dominator/lib/srpc"
)
func showImageSubcommand(args []string) {
imageSClient, _ := getClients()
if err := showImage(imageSClient, args[0]); err != nil {
fmt.Fprintf(os.Stderr, "Error showing image\t%s\n", err)
os.Exit(1)
}
os.Exit(0)
}
func showImage(... | package main
import (
"fmt"
"os"
)
func showImageSubcommand(args []string) {
if err := showImage(args[0]); err != nil {
fmt.Fprintf(os.Stderr, "Error showing image\t%s\n", err)
os.Exit(1)
}
os.Exit(0)
}
func showImage(image string) error {
fs, err := getTypedImage(image)
if err != nil {
return err
}
r... | Support typed image in imagetool show subcommand. | Support typed image in imagetool show subcommand.
| Go | apache-2.0 | Symantec/Dominator,keep94/Dominator,Symantec/Dominator,keep94/Dominator,rgooch/Dominator,rgooch/Dominator,rgooch/Dominator,Symantec/Dominator,keep94/Dominator |
65c37623ae654d0c362d57f6cbecd5e955ba198c | cloudwatch_test.go | cloudwatch_test.go | package cloudwatch
import (
"testing"
"time"
"github.com/Pallinder/go-randomdata"
"github.com/gliderlabs/logspout/router"
)
const NumMessages = 25000000
func TestCloudWatchAdapter(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode.")
}
route := &router.Route{Address: "log... | package cloudwatch
import (
"fmt"
"math/rand"
"testing"
"time"
"github.com/Pallinder/go-randomdata"
"github.com/gliderlabs/logspout/router"
)
const NumMessages = 25000000
func TestCloudWatchAdapter(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode.")
}
route := &router... | Add empty messages to integration test. | Add empty messages to integration test.
| Go | mit | bradgignac/logspout-cloudwatch,bradgignac/logspout-cloudwatch |
bcb33d880e0f2e35bdae3855c3964892737f2f17 | plugins/all/all.go | plugins/all/all.go | package all
import (
_ "github.com/influxdb/tivan/plugins/redis"
_ "github.com/influxdb/tivan/plugins/system"
)
| package all
import (
_ "github.com/influxdb/tivan/plugins/mysql"
_ "github.com/influxdb/tivan/plugins/postgresql"
_ "github.com/influxdb/tivan/plugins/redis"
_ "github.com/influxdb/tivan/plugins/system"
)
| Enable pg and mysql by default | Enable pg and mysql by default
| Go | mit | pugna0/telegraf,szibis/telegraf,ekini/telegraf,ndegory/telegraf,nevins-b/telegraf,netixen/telegraf,RasmusWernerLarsen/telegraf,Maksadbek/telegraf,aurrelhebert/telegraf,marianob85/telegraf,tanji/telegraf,codehate/telegraf,realgo/telegraf,james-lawrence/telegraf,nevins-b/telegraf,Brightspace/telegraf,Mic92/telegraf,subfx... |
670a45ef99fbbd3e56453892460cdef4f2df5880 | cmd/revgrep/main.go | cmd/revgrep/main.go | package main
import (
"fmt"
"os"
"github.com/bradleyfalzon/revgrep"
)
func main() {
fmt.Println("Starting...")
// Get lines changes
revgrep.Changes(nil, os.Stdin, os.Stderr)
// Open stdin and scan
// Check if line was affected
}
| package main
import (
"os"
"github.com/bradleyfalzon/revgrep"
)
func main() {
// Get lines changes
revgrep.Changes(nil, os.Stdin, os.Stderr)
}
| Remove comments from cmd/revgrep and useless print | Remove comments from cmd/revgrep and useless print
| Go | apache-2.0 | bradleyfalzon/revgrep,bradleyfalzon/revgrep |
82fa7d2a2a42bf7e32b943e578cdee406cfe8270 | rules/uuid/uuid.go | rules/uuid/uuid.go | package uuid
import (
"regexp"
"github.com/tonyhb/govalidate/helper"
"github.com/tonyhb/govalidate/rules"
)
func init() {
rules.Add("UUID", UUID)
}
// Used to check whether a string has at most N characters
// Fails if data is a string and its length is more than the specified comparator. Passes in all other ca... | package uuid
import (
"regexp"
"github.com/tonyhb/govalidate/helper"
"github.com/tonyhb/govalidate/rules"
)
func init() {
rules.Add("UUID", UUID)
}
// Used to check whether a string has at most N characters
// Fails if data is a string and its length is more than the specified comparator. Passes in all other ca... | Add IsUUID method to UUID validation for external calls | Add IsUUID method to UUID validation for external calls
Allows IsUUID to be used externally outside of validation
| Go | mit | tonyhb/govalidate |
1c83c0c38d01657f834c86b4bf231d5e62ed8c13 | routes.go | routes.go | package ambition
import (
"github.com/julienschmidt/httprouter"
)
// Add routes to http router
// TODO: Add route description parameters and useage
func AddRoutes(router *httprouter.Router) {
router.GET("/actions", CheckAuth(Actions))
router.GET("/actions/:ActionId", CheckAuth(ActionById))
router.POST("/set/:SetI... | package ambition
import (
"github.com/julienschmidt/httprouter"
)
// Add routes to http router
// TODO: Add route description parameters and useage
func AddRoutes(router *httprouter.Router) {
router.GET("/actions", CheckAuth(Actions))
router.GET("/actions/:ActionId", CheckAuth(ActionById))
//router.POST("/set/:Se... | Comment sets till actions, occurrences, and users are done | Comment sets till actions, occurrences, and users are done
| Go | unlicense | lelandbatey/ambition,lelandbatey/ambition,lelandbatey/ambition |
1a29bf40529447241639f7ec40b2a7436332afcd | worker/main.go | worker/main.go | package main
import (
"fmt"
worker "github.com/contribsys/faktory_worker_go"
)
func someFunc(ctx worker.Context, args ...interface{}) error {
fmt.Println("Working on job", ctx.Jid())
return nil
}
func main() {
mgr := worker.NewManager()
// register job types and the function to execute them
mgr.Register("Som... | package main
import (
"fmt"
worker "github.com/contribsys/faktory_worker_go"
keycloak "github.com/kindlyops/mappamundi/havenapi/keycloak"
)
// CreateUser creates a new user with keycloak
func CreateUser(ctx worker.Context, args ...interface{}) error {
fmt.Println("Working on job", ctx.Jid())
err := keycloak.Key... | Refactor to use new keycloak package. | Refactor to use new keycloak package.
Issue #HAV-133
Signed-off-by: Christopher Mundus <711c73f64afdce07b7e38039a96d2224209e9a6c@kindlyops.com>
| Go | apache-2.0 | kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi |
6dcb4a443c4e75c28b02b869f50b1f21db7e0def | project/project_containers.go | project/project_containers.go | package project
import (
"fmt"
"golang.org/x/net/context"
"github.com/docker/libcompose/project/events"
)
// Containers lists the containers for the specified services. Can be filter using
// the Filter struct.
func (p *Project) Containers(ctx context.Context, filter Filter, services ...string) ([]string, error)... | package project
import (
"fmt"
"sync"
"golang.org/x/net/context"
"github.com/docker/libcompose/project/events"
)
// Containers lists the containers for the specified services. Can be filter using
// the Filter struct.
func (p *Project) Containers(ctx context.Context, filter Filter, services ...string) ([]string... | Fix race condition on containers retrieval | Fix race condition on containers retrieval
Signed-off-by: Carlos Pérez-Aradros Herce <a9fe7a739a79c3eddb29e5b128a9f0360449da12@gmail.com>
| Go | apache-2.0 | dweomer/docker-libcompose,Azure22/libcompose,docker/libcompose,vdemeester/libcompose,dweomer/docker-libcompose,docker/libcompose,Azure22/libcompose,vdemeester/libcompose |
647f1b48893f42ab016ee7f9cfea692615145cbe | providers/metrics/hardware.go | providers/metrics/hardware.go | package metrics
import (
"encoding/json"
"net/url"
"os/exec"
"github.com/cerana/cerana/acomm"
)
// Hardware returns information about the hardware.
func (m *Metrics) Hardware(req *acomm.Request) (interface{}, *url.URL, error) {
// Note: json output from lshw is broken when specifying classes with `-C`
lshw := ... | package metrics
import (
"encoding/json"
"net/url"
"os/exec"
"github.com/cerana/cerana/acomm"
)
// Hardware returns information about the hardware.
func (m *Metrics) Hardware(req *acomm.Request) (interface{}, *url.URL, error) {
// Note: json output from lshw is broken when specifying classes with `-C`
out, err... | Remove unnecessary intermediate in Hardware handler | Remove unnecessary intermediate in Hardware handler
| Go | mit | cerana/cerana,cerana/cerana,cerana/cerana,cerana/cerana |
ce12ad94881781e489a823239a80ddbe96c94b39 | src/db.go | src/db.go | package feedloggr2
import (
"github.com/jinzhu/gorm"
rss "github.com/jteeuwen/go-pkg-rss"
_ "github.com/mattn/go-sqlite3"
)
type Datastore interface {
GetItems(feed_url string) ([]*FeedItem, error)
ProcessChannels(feed *rss.Feed, channels []*rss.Channel)
ProcessItems(feed *rss.Feed, ch *rss.Channel, items []*r... | package feedloggr2
import (
"github.com/jinzhu/gorm"
rss "github.com/jteeuwen/go-pkg-rss"
_ "github.com/mattn/go-sqlite3"
)
type Datastore interface {
GetItems(feed_url string) ([]*FeedItem, error)
ProcessChannels(feed *rss.Feed, channels []*rss.Channel)
ProcessItems(feed *rss.Feed, ch *rss.Channel, items []*r... | Sort feed items by title first, then date. | Sort feed items by title first, then date.
| Go | mit | lmas/feedloggr2 |
2687cbc798235d97f51db8e62439171e6712be59 | src/github.com/stellar/horizon/txsub/internal.go | src/github.com/stellar/horizon/txsub/internal.go | package txsub
import (
"github.com/stellar/go-stellar-base/build"
"github.com/stellar/go-stellar-base/strkey"
"github.com/stellar/go-stellar-base/xdr"
"golang.org/x/net/context"
)
type envelopeInfo struct {
Hash string
Sequence uint64
SourceAddress string
}
func extractEnvelopeInfo(ctx context.C... | package txsub
import (
"github.com/stellar/go-stellar-base/build"
"github.com/stellar/go-stellar-base/strkey"
"github.com/stellar/go-stellar-base/xdr"
"golang.org/x/net/context"
)
type envelopeInfo struct {
Hash string
Sequence uint64
SourceAddress string
}
func extractEnvelopeInfo(ctx context.C... | Fix extractEnvelopeInfo breakage due to go-stellar-base api change | Fix extractEnvelopeInfo breakage due to go-stellar-base api change
| Go | apache-2.0 | nullstyle/go-horizon,masonforest/horizon,irisli/horizon,masonforest/horizon,stellar/horizon,nullstyle/go-horizon,irisli/horizon,stellar/horizon,stellar/horizon,masonforest/horizon,masonforest/go-horizon,irisli/horizon,masonforest/go-horizon,masonforest/go-horizon,nullstyle/go-horizon |
a62d9813fa33f7156b6fa11566aa697f7b275756 | havenapi/actions/home_test.go | havenapi/actions/home_test.go | package actions
func (as *ActionSuite) Test_HomeHandler() {
res := as.JSON("/").Get()
as.Equal(200, res.Code)
as.Contains(res.Body.String(), "Welcome to HavenGRC")
}
| package actions
func (as *ActionSuite) Test_HomeHandler() {
res := as.JSON("/healthz").Get()
as.Equal(200, res.Code)
as.Contains(res.Body.String(), "I love you")
}
| Fix havenapi test to use healthz endpoint | Fix havenapi test to use healthz endpoint
Signed-off-by: Elliot Murphy <014ce8fab4ab9f8a957bfe9f974379093994de97@users.noreply.github.com>
| Go | apache-2.0 | kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi,kindlyops/mappamundi |
ce762577cbd55b7431607a3031cd4a9a1460248f | internal/common/lexer_test.go | internal/common/lexer_test.go | package common_test
import (
"testing"
"github.com/graph-gophers/graphql-go/internal/common"
)
type consumeTestCase struct {
description string
definition string
expected string // expected description
}
var consumeTests = []consumeTestCase{{
description: "initial test",
definition: `
# Comment line 1
#... | package common_test
import (
"testing"
"github.com/graph-gophers/graphql-go/internal/common"
)
type consumeTestCase struct {
description string
definition string
expected string // expected description
}
var consumeTests = []consumeTestCase{{
description: "initial test",
definition: `
# Comment line 1
#... | Add test for insignificant comma | lexer.Consume(): Add test for insignificant comma
| Go | bsd-2-clause | graph-gophers/graphql-go,graph-gophers/graphql-go,neelance/graphql-go,chris-ramon/graphql-go,graph-gophers/graphql-go,neelance/graphql-go |
0ab6c806cab3423fd8172bbe73f35b2e1c9832f6 | strflag.go | strflag.go | type strFlag struct {
*string
}
func (f *strFlag) Set(s string) error {
f.string = &s
return nil
}
func (f *strFlag) String() string {
if f.string != nil {
return *f.string
}
return ""
}
| // (C) 2016, 2017 by Ricardo Branco
//
// MIT License
package main
type strFlag struct {
*string
}
func (f *strFlag) Set(s string) error {
f.string = &s
return nil
}
func (f *strFlag) String() string {
if f.string != nil {
return *f.string
}
return ""
}
| Add copyright notice and package main | Add copyright notice and package main
| Go | mit | ricardobranco777/xhash |
941862c53fd5a49966827ed2515c75254e6d823a | id.go | id.go | package mongo
import (
"errors"
"fmt"
"golang.org/x/net/context"
"github.com/rs/rest-layer/schema"
"gopkg.in/mgo.v2/bson"
)
var (
// NewObjectID is a field hook handler that generates a new Mongo ObjectID hex if
// value is nil to be used in schema with OnInit.
NewObjectID = func(ctx context.Context, value ... | package mongo
import (
"errors"
"fmt"
"golang.org/x/net/context"
"github.com/rs/rest-layer/schema"
"gopkg.in/mgo.v2/bson"
)
var (
// NewObjectID is a field hook handler that generates a new Mongo ObjectID hex if
// value is nil to be used in schema with OnInit.
NewObjectID = func(ctx context.Context, value ... | Fix the issue as OnInit is no longer a pointer | Fix the issue as OnInit is no longer a pointer
| Go | mit | rs/rest-layer-mongo,omani/rest-layer-mongo |
0343d4f2d9bdd84376753ec759fe27663404058a | mt.go | mt.go | package main
import (
"log"
"net"
)
const PORT = "2525"
func main() {
server := createServer(PORT)
defer server.Close()
for {
conn, err := server.Accept()
if err != nil {
log.Fatalf("Error accepting: %v\n", err)
}
go handleConnection(conn)
}
}
func createServer(port string) (net.Listener) {
se... | package main
import (
"log"
"net"
)
const PORT = "2525"
func main() {
server := createServer(PORT)
defer server.Close()
for {
conn, err := server.Accept()
if err != nil {
log.Fatalf("Error accepting: %v\n", err)
}
go handleConnection(conn)
}
}
func createServer(port string) (net.Listener) {
se... | Remove fixed range from loop. | Remove fixed range from loop.
| Go | mit | frodsan/mat |
04c72a2c07cbbe2d51ed6d9f5a6478c27f2ec5f5 | stress/v2/stressql/parser_test.go | stress/v2/stressql/parser_test.go | package stressql
import (
"fmt"
"os"
"testing"
)
// Pulls the default configFile and makes sure it parses
func TestParseStatements(t *testing.T) {
gopath := os.Getenv("GOPATH")
if gopath == "" {
t.Error("$GOPATH not set")
}
stmts, err := ParseStatements(fmt.Sprintf("%v/src/github.com/influxdata/influxdb/stre... | package stressql
import "testing"
// Pulls the default configFile and makes sure it parses
func TestParseStatements(t *testing.T) {
stmts, err := ParseStatements("../file.iql")
if err != nil {
t.Error(err)
}
expected := 15
got := len(stmts)
if expected != got {
t.Errorf("expected: %v\ngot: %v\n", expected, ... | Correct stress/v2 tests to not depend on $GOPATH | Correct stress/v2 tests to not depend on $GOPATH
The test assumed that you were working within a single directory
$GOPATH. `go test` actually sets the current directory to the directory
of the package being tested, so the relative path to the test file could
be used instead.
| Go | mit | daachi/influxdb,pkittenis/influxdb,jgeiger/influxdb,mnuessler/influxdb,joaopedrotaveira/influxdb,otoolep/influxdb,arussellsaw/influxdb,mark-rushakoff/influxdb,jgeiger/influxdb,arussellsaw/influxdb,linearb/influxdb,joaopedrotaveira/influxdb,nooproblem/influxdb,apigee/influxdb,chenziliang/influxdb,daachi/influxdb,otoolep... |
f5b2b31b414b2b468a72dbffbf583d94d114e4e0 | lxd/lifecycle/storage_pool.go | lxd/lifecycle/storage_pool.go | package lifecycle
import (
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/version"
)
// StoragePoolAction represents a lifecycle event action for storage pools.
type StoragePoolAction string
// All supported lifecycle events for storage pools.
const (
StoragePoolCreated = StoragePoolAction(api.EventLi... | package lifecycle
import (
"github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/version"
)
// StoragePoolAction represents a lifecycle event action for storage pools.
type StoragePoolAction string
// All supported lifecycle events for storage pools.
const (
StoragePoolCreated = StoragePoolAction(api.EventLi... | Remove projectName arg from StoragePoolAction.Event | lxd/lifecycle/storage/pool: Remove projectName arg from StoragePoolAction.Event
Storage pools don't have projects.
Signed-off-by: Thomas Parrott <6b778ce645fb0e3dde76d79eccad490955b1ae74@canonical.com>
| Go | apache-2.0 | stgraber/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,stgraber/lxd,hallyn/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,stgraber/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,lxc/lxd,stgraber/lxd,lxc/lxd,hallyn/lxd,lxc/lxd,lxc/lxd,hallyn/lxd |
7d7fc6d217e916c0e1f469cf064c911764ff4571 | local_source.go | local_source.go | package appcast
import "io/ioutil"
// LocalSourcer is the interface that wraps the LocalSource methods.
type LocalSourcer interface {
Sourcer
Filepath() string
}
// LocalSource represents an appcast source from the local file.
type LocalSource struct {
*Source
filepath string
}
// NewLocalSource returns a new L... | package appcast
import "io/ioutil"
var localSourceReadFile = ioutil.ReadFile
// LocalSourcer is the interface that wraps the LocalSource methods.
type LocalSourcer interface {
Sourcer
Filepath() string
}
// LocalSource represents an appcast source from the local file.
type LocalSource struct {
*Source
filepath ... | Add ReadFile mocking support in the LocalSource.Load | Add ReadFile mocking support in the LocalSource.Load
| Go | mit | victorpopkov/go-appcast |
6d7d062f7ec8bc007d14d45c6ce8e9d4584c6c18 | lib/model/class.go | lib/model/class.go | package model
import (
"fmt"
"github.com/jinzhu/gorm"
)
// Class is the metadata of the node
type Class struct {
gorm.Model
Name string //The name of NodeType
Base string //Base type name
Operations []Operation //Operation of type
}
// Operation is action of type
type Operation struct {
... | package model
import (
"fmt"
"github.com/jinzhu/gorm"
)
// Class is the metadata of the node
type Class struct {
gorm.Model
Name string //The name of NodeType
Base string //Base type name
Operations []Operation //Operation of type
}
// Operation is action of type
type Operation struct {
... | Add Model in operation type | Add Model in operation type
| Go | apache-2.0 | ChaosXu/nerv,ChaosXu/nerv,ChaosXu/nerv,ChaosXu/nerv,ChaosXu/nerv |
55a3925a44d8f7d85ed43ec2bfd9aadf7a1f1aac | cmd.go | cmd.go | package main
import (
"flag"
"os"
)
// shamelessly snagged from the go tool
// each command gets its own set of args,
// defines its own entry point, and provides its own help
type Command struct {
Run func(cmd *Command, args ...string)
Flag flag.FlagSet
Name string
Usage string
Summary string
Help str... | package main
import (
"flag"
)
// shamelessly snagged from the go tool
// each command gets its own set of args,
// defines its own entry point, and provides its own help
type Command struct {
Run func(cmd *Command, args ...string)
Flag flag.FlagSet
Name string
Usage string
Summary string
Help string
}
... | Remove recover-repanic code which obliterates backtraces | Remove recover-repanic code which obliterates backtraces
| Go | mit | letsencrypt/goose,C18/goose,evenco/go-goose,CloudCom/goose,draaglom/goose,c2h5oh/goose,ox/goose,steinbacher/goose,simonz05/goose,rubenv/goose,TobiasBales/goose,gleez/goose,mizukusak/goose,motain/goose,resonancelabs/goose,jnfeinstein/goose,snikch/goose,digitallumens/goose,Vektah/goose,robert-chiniquy/goose,kevinburke/go... |
5c35287b6f8b26472249752461ab749cc6425231 | messaging/event.go | messaging/event.go | package messaging
import (
"context"
"time"
)
type Event struct {
Id string
Action string
Timestamp time.Time
Body []byte
ctx context.Context
}
// WithContext returns a shallow copy of Event with its context changed to ctx.
// The provided ctx must be non-nil.
func (e *Event) WithContext(... | package messaging
import (
"context"
"time"
)
type Event struct {
Id string
Action string
Timestamp time.Time
Body []byte
ctx context.Context
}
// WithContext returns a shallow copy of Event with its context changed to ctx.
// The provided ctx must be non-nil.
func (e Event) WithContext(c... | Remove pointer in Event Context() | Remove pointer in Event Context()
| Go | mit | skrater/goevents,eventials/goevents |
a9a54676032829724be1a414d73fa95f2cb337d6 | doc.go | doc.go | // Package spamc is a client library for SpamAssassin's spamd daemon.
//
// The protocol specification can be found here:
// http://svn.apache.org/repos/asf/spamassassin/trunk/spamd/PROTOCOL
package spamc
| // Package spamc is a client library for SpamAssassin's spamd daemon.
//
// The protocol specification can be found here:
// http://svn.apache.org/repos/asf/spamassassin/trunk/spamd/PROTOCOL
package spamc // import "github.com/teamwork/go-spamc"
| Enforce capitalisation on import path | Enforce capitalisation on import path
| Go | mit | Teamwork/go-spamc,xepa/go-spamc,xepa/go-spamc,Teamwork/go-spamc |
348b34b8072000c614740c1981c6900033321c65 | chain.go | chain.go | package turms
import (
"golang.org/x/net/context"
)
// A Chain is a chain of Handlers. It implements a Handler.
// Chains can be nested.
type Chain []Handler
// Handle calls each chain element Handle function subsequently.
func (c *Chain) Handle(ctx context.Context, conn Conn, msg Message) context.Context {
chainC... | package turms
import (
"golang.org/x/net/context"
)
// A Chain is a chain of Handlers. It implements a Handler.
// Chains can be nested.
type Chain []Handler
// Handle calls each chain element Handle function subsequently.
func (c *Chain) Handle(ctx context.Context, conn Conn, msg Message) context.Context {
chainC... | Use the previous context instead of the root context in Chain.Handle when a call to Handle returns a nil value. | Use the previous context instead of the root context in Chain.Handle when a call to Handle returns a nil value.
| Go | mit | marshauf/turms |
cb7937baed0a0057305e347315b6ba9cdf55d8d4 | controllers/game_controller.go | controllers/game_controller.go | package controllers
import (
"encoding/json"
"github.com/alex1sz/shotcharter-go/utilities"
"github.com/gorilla/mux"
"log"
"net/http"
"github.com/alex1sz/shotcharter-go/models"
)
// GET /games/:id
func GetGameByID(w http.ResponseWriter, req *http.Request) {
log.Println("GET request /games/:id")
params := mux.... | package controllers
import (
"encoding/json"
"github.com/alex1sz/shotcharter-go/utilities"
"github.com/gorilla/mux"
"log"
"net/http"
// neccessary to catch sql.ErrNoRows
"database/sql"
"github.com/alex1sz/shotcharter-go/models"
)
// GET /games/:id
func GetGameByID(w http.ResponseWriter, req *http.Request) {
... | Update game error handling to account for sql.ErrNoRows | Update game error handling to account for sql.ErrNoRows
| Go | mit | Alex1sz/shotcharter-go-api |
a1737718dc644e736fd6023d6ba465edea3654ee | util/util.go | util/util.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 (
"os"
"path/filepath"
"strconv"
"strings"
)
const (
millisecondsInSecond = 1000
secondsInMinute = 60
minutesInHour ... | // 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 (
"os"
"path/filepath"
"strconv"
"strings"
)
const (
millisecondsInSecond = 1000
secondsInMinute = 60
minutesInHour ... | Fix typo in variable name in formatNumber | Fix typo in variable name in formatNumber
| Go | mit | bogem/nehm |
592893f3f541ba144b9c79b1183b72c2f893aa57 | ba_checker.go | ba_checker.go | package main
import (
"fmt"
"os"
"github.com/mkideal/cli"
)
type argT struct {
cli.Helper
Config string `cli:"*c,config" usage:"Config file"`
}
func (argv *argT) Validate(ctx *cli.Context) error {
if _, err := os.Stat(argv.Config); os.IsNotExist(err) {
return fmt.Errorf("%s does not exist", argv.Config)
}
... | package main
import (
"encoding/json"
"fmt"
"os"
"github.com/mkideal/cli"
)
const toolVersion = "0.0.1"
type configuration struct {
Sites []string
Endpoints map[string]bool
}
type argT struct {
cli.Helper
Config string `cli:"c,config" usage:"JSON config file {\"sites:\" [\"https://www.example.com\"], ... | Add config.json parser and version number | Add config.json parser and version number
| Go | bsd-2-clause | eripa/ba_checker,eripa/ba_checker |
223e789405b8c754f6135204ea1a8f852c74bc63 | plug.go | plug.go | package main
import "math/rand"
import "time"
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
}
func ChoosePlug(plugs []Plug) Plug {
rand.Seed(time.Now().Unix())
return plugs[rand.Intn(len(plugs))]
}
| package main
import "math/rand"
import "time"
const DEFAULT_AD_CHANCE = 85
type Plug struct {
ID int
S3ID string
Owner string
ViewsRemaining int
}
func (p Plug) IsDefault() bool {
return p.ViewsRemaining >= 0
}
func ChoosePlug(plugs []Plug) Plug {
rand.Seed(time.Now().Unix())
... | Reduce chances of default ad being called | Reduce chances of default ad being called
Fixes #2
| Go | mit | liam-middlebrook/csh-plug |
0c931a09e517270a497690e756478a92ece9cb58 | client.go | client.go | package roxanne
import (
"net"
"fmt"
"bufio"
"strings"
)
type Response map[string]string
type Client struct {
c net.Conn
response Response
}
func (r *Client) Connect(HostPort string) (e error) {
r.response = make(Response)
r.c, e = net.Dial("tcp", HostPort)
return e
}
func (r *Client) callAndResp... | package roxanne
import (
"net"
"fmt"
"bufio"
"strings"
)
type Response map[string]string
type Client struct {
c net.Conn
response Response
}
func (r *Client) Connect(HostPort string) (e error) {
r.response = make(Response)
r.c, e = net.Dial("tcp", HostPort)
return e
}
func (r *Client) callAndResp... | Create lacked a value parm. | Create lacked a value parm.
Create statement didn't actually allow for supplying a value.
| Go | mit | rothrock/roxanne-client-go |
5366d0f6520765b658f89d90f161f78378bbeccb | server/config_parser.go | server/config_parser.go | package server
import (
"github.com/pterodactyl/wings/parser"
"sync"
)
// Parent function that will update all of the defined configuration files for a server
// automatically to ensure that they always use the specified values.
func (s *Server) UpdateConfigurationFiles() {
wg := new(sync.WaitGroup)
files := s.P... | package server
import (
"github.com/gammazero/workerpool"
"runtime"
)
// Parent function that will update all of the defined configuration files for a server
// automatically to ensure that they always use the specified values.
func (s *Server) UpdateConfigurationFiles() {
pool := workerpool.New(runtime.GOMAXPROCS... | Use a workerpool for configuration file updates | Use a workerpool for configuration file updates
Co-Authored-By: Jakob <0708d49e9b6eea40f2835438410a265908e17890@users.noreply.github.com>
| Go | mit | Pterodactyl/wings,Pterodactyl/wings |
507caabf49c71fd1b2a1f789d781d9ec6b99abc9 | cli/cmd/rm.go | cli/cmd/rm.go | package cmd
import (
"fmt"
"strings"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/docker/api/client"
)
type rmOpts struct {
force bool
}
// RmCommand deletes containers
func RmCommand() *cobra.Command {
var opts rmOpts
cmd := &cobra.Command{
Use: "rm",
Aliases: []string{"delete"},
... | package cmd
import (
"fmt"
"strings"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/docker/api/client"
)
type rmOpts struct {
force bool
}
// RmCommand deletes containers
func RmCommand() *cobra.Command {
var opts rmOpts
cmd := &cobra.Command{
Use: "rm",
Aliases: []string{"delete"},
... | Add id to the error output | Add id to the error output
Signed-off-by: Ulysses Souza <9b58b28cc7619bff4119b8572e41bbb4dd363aab@gmail.com>
| Go | apache-2.0 | docker/compose,docker/compose,docker/compose |
5c95bc4528b2bc0dcd9bb1609e28ee0fa0d7008c | search/new_search.go | search/new_search.go | package search
type search struct {
Keyword string
Pagenation int
Sort string
}
func New(keyword string, sort string) *search {
return &search{
Keyword: keyword,
Pagenation: 0,
Sort: sort,
}
}
| package search
import (
"net/url"
"strconv"
)
type search struct {
Keyword string
Pagenation int
Sort string
}
func New(keyword string, sort string) *search {
return &search{
Keyword: keyword,
Pagenation: 0,
Sort: sort,
}
}
func (s *search) GetURL() string {
q := url.Values{}
q.Set(... | Add search get url method | Add search get url method
| Go | apache-2.0 | wataru0225/sreq |
c88d46cf5c3340e1f02f32f218ef183acbae3eb6 | samples/booking/tests/apptest.go | samples/booking/tests/apptest.go | package tests
import "github.com/robfig/revel"
type ApplicationTest struct {
revel.TestSuite
}
func (t ApplicationTest) Before() {
println("Set up")
}
func (t ApplicationTest) TestThatIndexPageWorks() {
t.Get("/")
t.AssertOk()
t.AssertContentType("text/html")
}
func (t ApplicationTest) After() {
println("Tea... | package tests
import "github.com/robfig/revel"
type ApplicationTest struct {
revel.TestSuite
}
func (t *ApplicationTest) Before() {
println("Set up")
}
func (t *ApplicationTest) TestThatIndexPageWorks() {
t.Get("/")
t.AssertOk()
t.AssertContentType("text/html")
}
func (t *ApplicationTest) After() {
println("... | Update the example test to use pointer receivers. | Update the example test to use pointer receivers.
| Go | mit | birkirb/revel,mattbaird/revel,zacklin923/revel,jmptrader/revel,cokeboL/revel,cavaliercoder/revel,huacnlee/revel,pathirana/revel,imjerrybao/revel,salixvideo/revel,folpindo/revel,veliamsli/revel,w4ngyi/revel,jmptrader/revel,hustbill/revel,lgscofield/revel,tempbottle/revel,revel/revel,shima-park/revel,roblillack/mars,lgsc... |
45302a1da26980d53a61f3dfa71697edb1e17a65 | context.go | context.go | package context
//Setup calls all provided setup functions and return all raised errors
func Setup(setupFuncs ...SetupFunc) []error {
var errs []error
for _, v := range setupFuncs {
if err := v(); err != nil {
errs = append(errs, err)
}
}
return errs
}
| package context
import (
"farm.e-pedion.com/repo/logger"
)
//Setup calls all provided setup functions and return all raised errors
func Setup(setupFuncs ...SetupFunc) []error {
var errs []error
for i, v := range setupFuncs {
if err := v(); err != nil {
logger.Warn("contex.Setup",
logger.Int("index", i),
... | Add warning when the setup function raises error | Add warning when the setup function raises error
| Go | mit | rjansen/haki |
4755f8bf41cc3a022fded9eea3cb6b283cad3518 | json/doc.go | json/doc.go | // Package json is the JSON parser for HCL. It parses JSON files and returns
// implementations of the core HCL structural interfaces in terms of the
// JSON data inside.
//
// This is not a generic JSON parser. Instead, it deals with the mapping from
// the JSON information model to the HCL information model, using a ... | // Package json is the JSON parser for HCL. It parses JSON files and returns
// implementations of the core HCL structural interfaces in terms of the
// JSON data inside.
//
// This is not a generic JSON parser. Instead, it deals with the mapping from
// the JSON information model to the HCL information model, using a ... | Clarify that this package is not interesting to import | json: Clarify that this package is not interesting to import
| Go | mpl-2.0 | strivecast/hcl,strivecast/hcl,strivecast/hcl,hashicorp/hcl,strivecast/hcl,strivecast/hcl,hashicorp/hcl,hashicorp/hcl,hashicorp/hcl,hashicorp/hcl |
ddcd844fe8317ebd0db3279c0e15333a0a5e0ff9 | globals.go | globals.go | package trousseau
import (
"os"
"path/filepath"
)
// Global data store file path
var gStorePath string
func SetStorePath(storePath string) { gStorePath = storePath }
func GetStorePath() string { return gStorePath }
// Gnupg trousseau master gpg key id
var gMasterGpgId string = os.Getenv(ENV_MASTER_GPG_ID_... | package trousseau
import (
"os"
)
// Global data store file path
var gStorePath string
func SetStorePath(storePath string) { gStorePath = storePath }
func GetStorePath() string { return gStorePath }
// Gnupg trousseau master gpg key id
var gMasterGpgId string = os.Getenv(ENV_MASTER_GPG_ID_KEY)
// Keyring ... | Remove unused ssh private keys path global | Remove unused ssh private keys path global
| Go | mit | tomykaira/trousseau,oleiade/trousseau,oleiade/trousseau,tomykaira/trousseau,tomykaira/trousseau,mrnugget/trousseau,mrnugget/trousseau,mrnugget/trousseau |
747580ae4a2ff7e65398e815eef60b45fe87491a | storage/dump.go | storage/dump.go | // Copyright 2016 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package storage
import (
"encoding/json"
"io"
)
// Dump writes the content of the DataStore ds to the io.Writer w.
func Dump(ds *DataStore, w io.Writer) er... | // Copyright 2016 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package storage
import (
"encoding/json"
"io"
)
// Dump writes the content of the DataStore ds to the io.Writer w.
func Dump(ds *DataStore, w io.Writer) er... | Add Load utility alongside Dump | Add Load utility alongside Dump
| Go | apache-2.0 | timothyhinrichs/opa,open-policy-agent/opa,Eva-xiaohui-luo/opa,tsandall/opa,open-policy-agent/opa,tsandall/opa,timothyhinrichs/opa,tsandall/opa,timothyhinrichs/opa,tsandall/opa,Eva-xiaohui-luo/opa,open-policy-agent/opa,tsandall/opa,tsandall/opa,timothyhinrichs/opa,open-policy-agent/opa,open-policy-agent/opa,Eva-xiaohui-... |
27790cd250ad2f97a25884d678f4afcec25eb8f0 | src/wsclient.go | src/wsclient.go | package main
import (
"github.com/gorilla/websocket"
)
type Message struct {
Name string `json:"name"`
Data interface{} `json:"data"`
}
type FindHandler func(string) (Handler, bool)
type Client struct {
send chan Message
socket *websocket.Conn
findHandler FindHandler
stopChannels map[int]... | package main
import (
"github.com/gorilla/websocket"
)
type Message struct {
Name string `json:"name"`
Data interface{} `json:"data"`
}
type FindHandler func(string) (Handler, bool)
type Client struct {
send chan Message
socket *websocket.Conn
findHandler FindHandler
stopChannels map[int]... | Fix crash after inganme chat is used | Fix crash after inganme chat is used
| Go | mit | MajorMJR/factorio-server-manager,MajorMJR/factorio-server-manager,sean-callahan/factorio-server-manager,sean-callahan/factorio-server-manager,MajorMJR/factorio-server-manager,sean-callahan/factorio-server-manager,sean-callahan/factorio-server-manager,MajorMJR/factorio-server-manager |
2c5dddc7f190e9edddd2296182b88e0212fa8069 | transform.go | transform.go | package cryptanalysis
import ()
func Chunk(data []byte, size int) [][]byte {
var chunks [][]byte
for i:=0; i<len(data); i=i+size {
chunks = append(chunks, data[i:i+size])
}
return chunks
}
func Transpose(data [][]byte) [][]byte {
var transpose [][]byte
for i, _ := range data[0] {... | package cryptanalysis
import ()
func Chunk(data []byte, size int) [][]byte {
count := len(data) - size
var chunks [][]byte
for i:=0; i<count; i=i+size {
chunks = append(chunks, data[i:i+size])
}
chunks = append(chunks, data[count*size:])
return chunks
}
func Transpose(data [][]by... | Handle last chunk when less than size. | Handle last chunk when less than size.
| Go | bsd-3-clause | averagesecurityguy/cryptanalysis |
72cf3dd92020b63df59d8bbe917c5c88b93233e4 | src/lib/systemt/daemon_test.go | src/lib/systemt/daemon_test.go | package systemt
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDaemonize(t *testing.T) {
Daemonize(func() {})
assert.Equal(t, 1, len(ds))
}
func TestRunDaemons(t *testing.T) {
c := make(chan bool, 64)
go RunDaemons()
for i := 0; i < 10; i++ {
Daemonize(func() {
if i%2 == 0 {
c ... | package systemt
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestDaemonize(t *testing.T) {
Daemonize(func() {})
assert.Equal(t, 1, len(ds))
}
func TestRunDaemons(t *testing.T) {
c := make(chan bool, 64)
go RunDaemons()
for i := 0; i < 10; i++ {
Daemonize(func() {
if i%2 == 0 ... | Add duration to wait goroutines in systemt package test | Add duration to wait goroutines in systemt package test
| Go | mit | raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp,raviqqe/tisp,tisp-lang/tisp |
f2cd35ad5c7b793475c8647230683d713676b205 | controllers/shot_controller.go | controllers/shot_controller.go | package controllers
import (
"encoding/json"
"github.com/alex1sz/shotcharter-go/utilities"
// gorilla/mux used for req params
// "github.com/gorilla/mux"
// "log"
"net/http"
// neccessary to catch sql.ErrNoRows
// "database/sql"
"github.com/alex1sz/shotcharter-go/models"
)
// POST /shots
func CreateShot(w h... | package controllers
import (
"encoding/json"
"github.com/alex1sz/shotcharter-go/utilities"
// gorilla/mux used for req params
// "github.com/gorilla/mux"
// "log"
"net/http"
// neccessary to catch sql.ErrNoRows
// "database/sql"
"github.com/alex1sz/shotcharter-go/models"
)
// POST /shots
func CreateShot(w h... | Revert "Add CreateGame to Game Controller" | Revert "Add CreateGame to Game Controller"
This reverts commit 556a31b56e750b0ad9d6178492b32d143da0f87f.
| Go | mit | Alex1sz/shotcharter-go-api |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.