blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
27c6757ba0c6aaca4dd47e8ab50080adba482026 | 303f8046c9a1de2c961a3caa3fee1ba82f107131 | kolesa-team/es-river-mongodb | /src/river/logger/logger.go | Go | go | 703 | permissive | package logger
import (
"log"
"sync"
"github.com/Sirupsen/logrus"
"github.com/endeveit/go-snippets/config"
"github.com/gemnasium/logrus-graylog-hook"
)
var (
once sync.Once
logger *logrus.Logger
)
type nullFormatter struct {
}
func initLogger() {
once.Do(func() {
// Logging setup
logger = logrus.New(... |
7602401706c96c133c0e4ca20c3197f239aa9679 | 04fb71fcb9c512158be19603b6c1a1fcc90d22cf | restingbull/buildbuddy | /server/build_event_protocol/build_event_proxy/build_event_proxy.go | Go | go | 3,007 | permissive | package build_event_proxy
import (
"context"
"log"
"sync"
"github.com/buildbuddy-io/buildbuddy/server/util/grpc_client"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
pepb "github.com/buildbuddy-io/buildbuddy/proto/publish_build_event"
)
const eventBufferSize = 100
type BuildEventProxyCl... |
f052d990e98badd0f15203b064e6d6ab0975b553 | e28165ecb4b9835e5ea98398baae97e234dc265d | samuelkadolph/spf-buddy | /app/controllers/app.go | Go | go | 750 | no_license | package controllers
import (
"github.com/robfig/revel"
"github.com/samuelkadolph/spf-buddy/lib"
)
type App struct {
*revel.Controller
}
func (c App) Index(domain string) revel.Result {
var includesSpecifiedDomain bool
var err error
var spf *lib.SPF
var suggested *lib.SPF
specifiedDomain, found := revel.Conf... |
9b985ba018e41dd6fd907e1777a73e054544ba0b | 11a54ce023235196a94844134962c7c9d7202559 | icafa/thornode | /x/thorchain/types/msg_tss_sign_fail.go | Go | go | 2,847 | permissive | package types
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"sort"
"strings"
sdk "github.com/cosmos/cosmos-sdk/types"
"gitlab.com/thorchain/thornode/common"
"gitlab.com/thorchain/tss/go-tss/blame"
)
// MsgTssKeysignFail means TSS keysign failed
type MsgTssKeysignFail struct {
ID string `json:"i... |
a6a41fa07e7095e5e0492ddf388a70cd642c73c4 | 68de1b6c18c0a8c0be63b4c56c234fa2933c2439 | census-instrumentation/opencensus-service | /exporter/awsexporter/aws_xray.go | Go | go | 5,968 | permissive | // Copyright 2019, OpenCensus 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 agree... |
9cf691fdab934c8650011d6a601e47c0c8a7655c | 6df14c43b58c2a1ffb591b5b80f5fd28c8b1b475 | zlowred/alcobot | /gui/rootscreen.go | Go | go | 1,211 | no_license | package gui
import (
"errors"
"github.com/zlowred/goqt/ui"
"github.com/zlowred/alcobot/hub"
)
type RootScreen struct {
*ui.QWidget
hub *hub.Hub
rootController *RootController
brewingController *BrewingController
settingsController *SettingsController
preparationController *PreparationControl... |
0ebbe62a72cea654d221bc5396f708c71d133d02 | 9e2b3a26ef0e9c1cc2613fa7f6b3335f2b546d2b | solher/snakepit-seed | /cmd/database.go | Go | go | 1,323 | permissive | package cmd
import (
"strings"
"github.com/solher/snakepit"
"github.com/solher/snakepit-seed/constants"
"github.com/solher/snakepit-seed/database"
dbCmd "github.com/solher/snakepit/database"
"github.com/solher/snakepit/root"
"github.com/spf13/viper"
)
func init() {
root.Cmd.AddCommand(dbCmd.Cmd)
dbCmd.Crea... |
074829502fa2e377ec5627f502e46a77ed4f8f87 | c21a109ceef4718ce5df336b5ed04c9a7ed1a37b | alphagov/paas-s3-resource | /out/out_suite_test.go | Go | go | 784 | permissive | package out_test
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var outPath string
var _ = BeforeSuite(func() {
var err error
if _, err = os.Stat("/opt/resource/out"); err == nil {
outPath = "/opt/resource/out"
... |
952bf88e669345253250d34828a276295289c470 | 2a86d312828f08977759aef4970b2c2b1da43a05 | go-oauth2/mongo | /config_test.go | Go | go | 293 | permissive | package mongo
const (
url = "mongodb://127.0.0.1:27017"
// url = "mongodb://localhost:27017,localhost:28017,localhost:29017/?replicaSet=myReplicaSet"
dbName = "mydb_test"
username = "admin"
password = "password"
isReplicaSet = false
service = "myService"
)
|
2e1883130d3e6ea4af39c260f2fd0aa94861cb93 | 9787667e6d51aac50c1bcccfa64772eb8463e1c7 | collinglass/stripe-go | /bankaccount/client.go | Go | go | 4,648 | permissive | // Package bankaccount provides the /bank_accounts APIs
package bankaccount
import (
"errors"
"fmt"
"net/url"
"strconv"
stripe "github.com/collinglass/stripe-go"
)
// Client is used to invoke /bank_accounts APIs.
type Client struct {
B stripe.Backend
Key string
}
const (
NewAccount stripe.BankAccoun... |
95dd44031dc209f79007cd3062e3e6c282ef58e0 | 8fc2ff2a7cc81c5c4bef843d77bbd3c9672f8749 | Ann-Geo/Golang-examples | /programs_from_books/7.defer/defer_usage.go | Go | go | 381 | no_license | package main
import (
"fmt"
)
func a1(){
for i := 0; i < 3; i++ {
defer fmt.Println(i)
}
}
func a2(){
for i := 0; i < 3; i++ {
defer func() {fmt.Println(i, " ")}()
}
}
func a3(){
for i := 0; i < 3; i++ {
defer func(n int) { fmt.Println(n, " ")}(i)
}
}
func main() {
a1()
... |
1941e8a3aaf3ca541fa6206bdac26d87bbdaaeba | 50e65727dd5efc7be105a2587d4c4df388d27db7 | toretto460/pcall | /batch/error.go | Go | go | 658 | no_license | package batch
import (
"encoding/json"
)
// Error is a json serializable http error
type Error struct {
Err string `json:"err"`
HTTPCode int `json:"code"`
IsError bool `json:"-"`
}
// NewError creates a new batch.Error
func NewError(err string, code int) *Error {
return &Error{
Err: err,
HTT... |
dd12bbba8e5ba35b256062bf6d332e7ce675a994 | 2cbc9ab9c8e3a75a0cc004a64704027363ff0f13 | open-policy-agent/gatekeeper | /third_party/sigs.k8s.io/controller-runtime/pkg/envtest/webhook_test.go | Go | go | 3,795 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
39e1348cbf9e3127bef7c207cde435adfd80b5a2 | ae139c81ca8e11ccd0214203ba8f9d4280e5afd9 | akawashiro/cropass | /main.go | Go | go | 9,703 | permissive | package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"fmt"
"io/ioutil"
"log"
"math/big"
"os"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
"golang.org/x/crypto/ssh/terminal"
)
// BlockCipher represents block cipher.
type BlockCipher interface {
Encrypt(plain []byt... |
5cd73511c16aa25453df76d0c466f1783c4c0071 | 1587ff9a5ab900fb1b045f94c630c86183f0aa93 | mewbak/gocontracts | /parsebody/success_only_preamble_test.go | Go | go | 960 | permissive | package parsebody_test
import (
"testing"
"github.com/Parquery/gocontracts/parsebody"
)
func TestToContract_OnlyPreamble_NoNext(t *testing.T) {
text := `package dummy
func SomeFunc(a []string) {
// Preamble starts.
old_first := a[0]
// Preamble ends.
}`
expected := parsebody.Contract{Start: 45, End: 85}
ch... |
d3a83f21aa159baf75c5ae575a48195e83b8439b | 6c7f535abbd2b1a39ba92241e204329ecaf6120a | Azure-Samples/azure-sdk-for-go-samples | /sdk/resourcemanager/monitor/log_profile/main.go | Go | go | 4,817 | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
package main
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-... |
5f0df7b127a859be1e33bddde7f1642916876d0d | f0d5b4c1d0835cc1bb115a74de4bfa039de3eee3 | waltfy/draupnir | /pkg/server/api/routes/access_tokens.go | Go | go | 5,004 | permissive | package routes
import (
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/gocardless/draupnir/pkg/server/api"
"github.com/gocardless/draupnir/pkg/server/api/chain"
"github.com/gocardless/draupnir/pkg/server/api/middleware"
"github.com/google/jsonapi"
"github.com/pkg/errors"
"golang.org/x/net/context"
"go... |
207943e381954c18b0dffa008c88de810c95acd5 | 933392a9940c4fb60f49c508900849deec9608f2 | vctt94/vspd | /webapi/helpers_test.go | Go | go | 1,482 | permissive | package webapi
import (
"testing"
"github.com/decred/dcrd/chaincfg/v3"
)
func TestIsValidVoteChoices(t *testing.T) {
// Mainnet vote version 4 contains 2 agendas - sdiffalgorithm and lnsupport.
// Both agendas have vote choices yes/no/abstain.
voteVersion := uint32(4)
params := chaincfg.MainNetParams()
var ... |
7f8b1fc7d06bf39ac7bdf229760372f4c6e4397d | 8e3fb6838676467b20be5a7c8c02a78de5de5115 | adrianob/catarse-martini | /config/db.go | Go | go | 945 | no_license | package config
import (
"catarse/app/models"
"database/sql"
"fmt"
_ "github.com/lib/pq"
"gopkg.in/gorp.v1"
)
func Db() *gorp.DbMap {
// connect to db using standard Go database/sql API
// use whatever database/sql driver you wish
db, err := sql.Open("postgres", "user=postgres password=postgres dbname=goDB ssl... |
9fc50d35c36b5c8773b4877a7708da353667d971 | 54ba2f4f63b2f263a0011f6754ea255d97bfe566 | yongjhih/inventory | /store/mocks/DataStore.go | Go | go | 5,709 | permissive | // Copyright 2017 Northern.tech AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... |
a2d4b69eb69a62b21cc23279a6992a30e6596684 | 153d64c846985aae5547ca0a30fb5b188f2a875b | ademkoc/rtsp-stream | /core/logging.go | Go | go | 366 | permissive | package core
import (
"os"
"github.com/admkc/rtsp-stream/core/config"
"github.com/sirupsen/logrus"
)
// SetupLogger sets the logger for the proper settings based on the environment
func SetupLogger(spec *config.Specification) {
logrus.SetOutput(os.Stdout)
if spec.Debug {
logrus.SetLevel(logrus.DebugLevel)
r... |
975b3a29161077abd2e7c1eee262f0768b125c1e | e1feb6cc42daa82ddbefe6038b454153eb2ef688 | james-grant-sbsa/go-octopusdeploy | /integration/deployment_process_test.go | Go | go | 6,040 | permissive | package integration
import (
"testing"
"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func GetTestDeploymentProcess(t *testing.T, client *octopusdeploy.Client, project *octopusdeploy.Project) *octopusdeploy.DeploymentProcess ... |
4c3a7ec411b9832be65e73155c6b2f0f1d4e1b2d | c520fa4be8502862e62407dbeddf476262e607fe | corvuscrypto/ravenchat | /network/client_map_test.go | Go | go | 2,552 | permissive | package network
import "testing"
func TestNetworkSetup(T *testing.T) {
// make a root region
region1 := newClientRegion(40, 38)
// Make a new network with root as region1
network := NewClientNetwork(region1)
client1 := NewClient(40, 38)
network.AddClient(client1)
// our region1 should now have only one client... |
e7e3c4ee70c322c967f7e5eb1941f185b35b6276 | 681010d8a170933d1d4dbc9e70a117f1460bc59d | MaxBreida/mongo-go-driver | /examples/documentation_examples/examples_test.go | Go | go | 3,795 | permissive | // Copyright (C) MongoDB, Inc. 2017-present.
//
// 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
// NOTE: Any time this file is modified, a WEBSITE... |
d503b006bb94220a89fb6513da74a39cfe3626e0 | 43eae014f67a8840bd478ab6ed93d3b25d4d1e22 | Brumawen/gopi-finder | /src/serviceinfo.go | Go | go | 1,946 | permissive | package gopifinder
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"net/http"
)
// ServiceInfo holds the information about a service provided by
// a device.
// The information holds the ServiceName, the Port No on the device and
// the API url stub of the service controller.
type ServiceInfo struct {
Service... |
a1872ee61f5396ed02dbf854a9c622e135669e6b | beb24b3d9bea69df3b604d48d332c33e78195b31 | ippsav/dish.io | /cmd/api/main.go | Go | go | 1,735 | no_license | package main
import (
"context"
"database/sql"
"fmt"
"github.com/dish.io/cmd/api/handlers/user"
"github.com/dish.io/internal/database/postgres"
"github.com/dish.io/internal/services/user"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
_ "github.com/lib/pq"
"github.com/rs/zerolog"
"net/http... |
4286527f2729f07cc554cb641b32b8c418aee7a3 | 41b45e649a868406b840391c5e6642111e5c9a98 | alokkulkarni/serving | /pkg/apis/serving/v1beta1/configuration_defaults_test.go | Go | go | 3,310 | permissive | /*
Copyright 2019 The Knative 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... |
37f4029b5b095b4ba2ee7d9592f5a7f05b6c38df | 92f71250a44efebab2a5885c59b92f9589b3a109 | Sai628/golang-example | /022_goroutines.go | Go | go | 472 | no_license | package main
import "fmt"
func f(from string) {
for i := 0; i < 3; i++ {
fmt.Println(from, ":", i)
}
}
func main() {
f("direct")
// direct : 0
// direct : 1
// direct : 2
go f("goroutine")
go func(msg string) {
fmt.Println(msg)
}("going")
// goroutine : 0
... |
7f25dd8ae1a4094c1cd9e200a772eb73572b48ef | 51d1618d8ec23008c97ee9df379a1a5e30e20b97 | nzhoucsu/CIS620_project3 | /servicemap.go | Go | go | 1,450 | no_license |
package main
import (
"fmt"
"net"
"os"
"strings"
)
func main() {
// Set map table
reg_map := make(map[string] string)
// Set UDP socket
ServerAddr,err := net.ResolveUDPAddr("udp",":23997")
CheckError(err)
ServerCLNS, err := net.ListenUDP("udp", ServerAddr)
CheckError(er... |
43f91975a18997979e3b1cc26f2ca52428797b71 | 4356c48f0af3b94303ab7238dc64ca3f4aa26430 | shivdeepnv/rancher | /vendor/github.com/rancher/types/client/management/v3/zz_generated_cluster_scan_status.go | Go | go | 259 | permissive | package client
const (
ClusterScanStatusType = "clusterScanStatus"
ClusterScanStatusFieldConditions = "conditions"
)
type ClusterScanStatus struct {
Conditions []ClusterScanCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}
|
d5cf7e9f2063a8c4ca18975487e9d03f51f75a74 | 94bb50465471405c2987d095ac8e4bd8ddc2b52f | th3cyb3rc0p/pulumi-terraform | /sdk/go/state/s3_args.go | Go | go | 3,333 | permissive | package state
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
"github.com/pulumi/pulumi-terraform/sdk/v3/go/state/internal"
)
// S3Args specifies the configuration options for a Terraform Remote State
// stored in the S3 backend
type S3Args struct {
// Bucket is the name of the S3 Bu... |
0b6084660a4fb221163b0a301f18e5c73514ecb5 | 21707249391ea07a93f04458f5475073ba820040 | rsteube/carapace-bin | /completers/circleci_completer/cmd/orb_removeFromCategory.go | Go | go | 572 | permissive | package cmd
import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/completers/circleci_completer/cmd/action"
"github.com/spf13/cobra"
)
var orb_removeFromCategoryCmd = &cobra.Command{
Use: "remove-from-category",
Short: "Remove an orb from a category",
Run: func(cmd *cobra.Command, args []s... |
7d0368365456724a43d14dc263c27cb32f632bb5 | 049f59e1911f811a640e67c3a46d4831053fff83 | openyard/ebics | /3.0/h005/PostCode.go | Go | go | 265 | permissive | // Generated with goxc v0.1.13 - rev f5cc87998c35abe9b532e49b5672e8667bcbd00c
package h005
import w3c "github.com/openyard/ebics/3.0/w3c"
// SimpleType
type PostCode w3c.Token
func NewPostCode(value *w3c.Token) *PostCode {
me := (*PostCode)(value)
return me
}
|
389e1d49914648d7e63ea7cb5dee5892ec2668cc | b7c0de2b86a30d94ad1451b0e4b13b5a782ee4da | eddogola/unsplash-go | /unsplash/client/stats.go | Go | go | 2,788 | permissive | package client
import "context"
// StatsTotal defines fields for an Unsplash Total Stats Resource
type StatsTotal struct {
Photos int `json:"photos"`
Downloads int `json:"downloads"`
Views int `json:"views"`
Likes int `json:"likes"`
Photographers int `json:"pho... |
5c253cc6bccd6d2767cb77c7cc6a7c2dd324b2c5 | 31eceeb757ac58dbaa24cb2cb027b9dc0553db07 | elliots/go-cloud | /blob/drivertest/drivertest.go | Go | go | 48,627 | permissive | // Copyright 2018 The Go Cloud 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
f98fce8aa59b4c4f24b066bab96524c27962249e | 28aa7745d6906386d585836a8e888802f419cda4 | islinwb/kubeedge | /beehive/pkg/core/module.go | Go | go | 3,836 | permissive | package core
import (
"time"
"kubeedge/beehive/pkg/common/config"
"kubeedge/beehive/pkg/common/log"
"kubeedge/beehive/pkg/core/context"
)
const (
// BusGroup group
BusGroup = "bus"
// HubGroup group
HubGroup = "hub"
// TwinGroup group
TwinGroup = "twin"
// MetaGroup group
MetaGroup = "meta"
//EdgedGroup... |
5dd02be2c8b9664ba8067438236bad838df2d032 | 4aa037de84a48d1a0967b4d6a9e3f3ad23039691 | tahmid-tanzim/golang | /greetings/greetings_test.go | Go | go | 465 | no_license | package greetings
import (
"testing"
"regexp"
)
func TestHelloName(t *testing.T) {
name := "Tahmid"
want := regexp.MustCompile(`\b` + name + `\b`)
msg, err := Hello("Tahmid")
if !want.MatchString(msg) || err != nil {
t.Fatalf(`Hello("Tahmid") = %q, %v, want match for %#q, nil`, msg, err, want)
}
}
func Tes... |
27cb7ec2e3110e6761862979f5e7b422a8352b2d | 35728168c0cb3f779d5472bb0484e74a47799514 | apaldiwal/stellar-quest | /bounty-program/horizon-api/go/resources/accounts/retrieve-account-operations.go | Go | go | 447 | permissive | package main
import (
"fmt"
"log"
"github.com/stellar/go/clients/horizonclient"
)
func main() {
client := horizonclient.DefaultPublicNetClient
operationRequest := horizonclient.OperationRequest {
ForAccount: "GAYOLLLUIZE4DZMBB2ZBKGBUBZLIOYU6XFLW37GBP2VZD3ABNXCW4BVA",
}
resp, err ... |
4dabf4a861359fce092020a18984f84b069c1202 | 636c0fdc7c98ce5541760e8ad1c787bbddeb3255 | yetone/ccat | /Godeps/_workspace/src/sourcegraph.com/sourcegraph/go-sourcegraph/sourcegraph/units_test.go | Go | go | 1,906 | permissive | package sourcegraph
import (
"net/http"
"reflect"
"testing"
"github.com/jingweno/ccat/Godeps/_workspace/src/sourcegraph.com/sourcegraph/go-sourcegraph/router"
"github.com/jingweno/ccat/Godeps/_workspace/src/sourcegraph.com/sourcegraph/srclib/unit"
)
func TestUnitsService_Get(t *testing.T) {
setup()
defer tear... |
71e123685b421e185732b2a0bd163295434b4717 | aefc83345657cba83cface7091290d3d83cc9999 | hashicorp/azure-sdk-for-go | /profiles/preview/preview/monitor/mgmt/insights/models.go | Go | go | 44,104 | permissive | // +build go1.9
// Copyright 2021 Microsoft Corporation
//
// 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 appl... |
346bab340fd83d81bd845e0303e06157f13e8a2a | 03f229d7d18e548d0eda79a87c8230031ef52514 | Feng2012/evergreen | /service/ui.go | Go | go | 23,816 | permissive | package service
import (
htmlTemplate "html/template"
"net/http"
"path/filepath"
"runtime/debug"
"strings"
"time"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/PuerkitoBio/rehttp"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/graphql"
"github.com/evergreen-ci/evergre... |
28f09c09e2f29a2de791723764b652790aba29c4 | 4119a6161916ca4a23d84c33e5abcf76d61f3848 | fossabot/nproto | /nproto/stanmsg/options.go | Go | go | 3,104 | permissive | package stanmsg
import (
"context"
"time"
"github.com/nats-io/stan.go"
"github.com/rs/zerolog"
"github.com/huangjunwen/nproto/helpers/taskrunner"
)
// OptLogger sets structured logger.
func OptLogger(logger *zerolog.Logger) Option {
return func(dc *DurConn) error {
if logger == nil {
nop := zerolog.Nop()... |
b8004b40299458572885b4a39033d13176482509 | 978c4cde76982c119bab908e8b2f5087b79da5a1 | bartoszmajsak/istio | /tools/bug-report/pkg/bugreport/flags.go | Go | go | 7,073 | permissive | // Copyright Istio 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 wri... |
5178813e951e3944ddafbb7be278aed0b340c9df | bb2f73fc3d28a5be5eb288f03a66dd1536c8fcf6 | uluyol/tools | /timeleft/main.go | Go | go | 1,646 | permissive | /*
Timeleft prints the amount of time left until some date.
It can be used as a countdown timer for deadlines.
Usage:
timeleft datestamp
where datestamp is of the time.UnixDate form
as seen below:
Mon Jan 2 15:04:05 MST 2006
*/
package main
import (
"bytes"
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
"ti... |
ceb04b980717d2bf1a30767f48874d750c2b89f1 | 55329bf798e434a122e4dfe10ad4a19891872925 | Technology-HFocus/saml | /samlsp/session.go | Go | go | 2,836 | permissive | package samlsp
import (
"context"
"errors"
"net/http"
"github.com/Technology-HFocus/saml"
)
// Session is an interface implemented to contain a session.
type Session interface{}
// SessionWithAttributes is a session that can expose the
// attributes provided by the SAML identity provider.
type SessionWithAttrib... |
fe703b36195efcd44950aa9ce9b1905b61e3841b | e66f640d211a4c38cb26e263851391a3625df564 | superconsensus-chain/xupercore | /bcs/ledger/xledger/tx/tx.go | Go | go | 9,315 | permissive | // package txn deals with tx data
package tx
import (
"encoding/json"
"errors"
"fmt"
"math/big"
"sync"
"time"
"github.com/golang/protobuf/proto"
"github.com/superconsensus-chain/xupercore/bcs/ledger/xledger/def"
"github.com/superconsensus-chain/xupercore/bcs/ledger/xledger/ledger"
"github.com/superconsensu... |
14c5ea1b8a7c08ff597a4fefff71fbcabc5c8c52 | 7b23b1f38ce7b3663ebd2b1551f6ec80758a6f39 | jsrzx/goduck | /cmd/goduck/pier.go | Go | go | 6,057 | permissive | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"github.com/meshplus/bitxhub-kit/fileutil"
"github.com/meshplus/goduck/cmd/goduck/pier"
"github.com/meshplus/goduck/internal/download"
"github.com/meshplus/goduck/internal/repo"
"github.com/meshplus/goduck/internal/types... |
a86bfcc8fd02b73fd924d2c83883d04c48eb3ee6 | bc0b3b653556a1d7dfc8ad319242fe2d0aab1266 | xserve98/go-xserver | /services/login/user.go | Go | go | 2,546 | permissive | package main
import (
"github.com/fananchong/go-xserver/common"
"github.com/fananchong/go-xserver/services/internal/protocol"
"github.com/fananchong/gotcp"
)
// User : 登录玩家类
type User struct {
gotcp.Session
account string
}
// OnRecv : 接收到网络数据包,被触发
func (user *User) OnRecv(data []byte, flag byte) {
cmd := gotc... |
7b8d2f449c340810fa2473b6c092a3a9787750e2 | 2cddcf09dfaeea410fa0ce617eb47dec4d9cc4ea | skn200/sdk | /go/clients/image_client.go | Go | go | 4,536 | permissive | /***************************************************************************
*
* AVI CONFIDENTIAL
* __________________
*
* [2013] - [2018] Avi Networks Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property
* of Avi Networks Incorporated and its suppliers,... |
2f7c4b1f4ce86588dc212d130eb6427d1b9aebfc | 326c6f87afcdef672d400a161e734639182abd60 | voicihojun/gostudy | /gostudy/src/unit49/exe04/main.go | Go | go | 345 | no_license | package main
import (
"fmt"
"io/ioutil"
"os"
)
func main() {
s := "Hello, world!!!!!"
err := ioutil.WriteFile("../exe01/hello.txt", []byte(s), os.FileMode(644))
if err != nil {
fmt.Println(err)
return
}
data, err := ioutil.ReadFile("../exe01/hello.txt")
if err != nil {
fmt.Println(err)
return
}
fm... |
3489912818a7c91b70ae04c685b2b4e05935a2bf | 998e2b0f170000fb86b404aeb6660d55d38fc9db | masaun/ixo-cosmos | /vendor/github.com/cosmos/cosmos-sdk/client/tx/broadcast.go | Go | go | 603 | permissive | package tx
import (
"encoding/json"
"net/http"
"github.com/cosmos/cosmos-sdk/client/context"
)
type BroadcastTxBody struct {
TxBytes string `json="tx"`
}
func BroadcastTxRequestHandler(w http.ResponseWriter, r *http.Request) {
var m BroadcastTxBody
decoder := json.NewDecoder(r.Body)
err := decoder.Decode(&m... |
c1b1da2d6fe963338d462122883fc6b84c175acb | 78e1330710b2d86412cbd67b8c0d145be97aa991 | andrianj/cockroach | /sql/pgwire/pgerror/codes.go | Go | go | 15,411 | permissive | // Copyright 2016 The Cockroach 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 ag... |
ac1ac41d5d519e7486e17f594790fef7210cba48 | 523bd0ff3bfbff51235ecba98f7d9e2039a88a0a | yunionio/sdnagent | /vendor/yunion.io/x/pkg/util/compare/compare.go | Go | go | 5,443 | permissive | // Copyright 2019 Yunion
//
// 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 writi... |
99f0242a8ca8c9b38c4923516d23f0923d2fc298 | d8c24c0b9c3dd18892392f9890dccc50c134f0f6 | bububa/opentaobao | /model/simba/TaobaoSimbaRptTargetingtageffectGetAPIRequest.go | Go | go | 3,912 | permissive | package simba
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// TaobaoSimbaRptTargetingtageffectGetAPIRequest 获取定向效果报表数据 API请求
// taobao.simba.rpt.targetingtageffect.get
//
// 获取定向效果报表数据
type TaobaoSimbaRptTargetingtageffectGetAPIRequest struct {
model.Params
// 被操作者昵称
_nick string
// 起始时间
_startTi... |
074dbfe56d8493609f58c0ea169a3bebd3d91ca9 | 07881543f2157794f59dd2a20e078a702b5ef526 | charberg/thesrc | /api/server_for_test.go | Go | go | 1,128 | permissive | package api
import (
"bytes"
"io/ioutil"
"net/http"
"net/http/httptest"
"github.com/sourcegraph/thesrc"
"github.com/sourcegraph/thesrc/datastore"
)
func init() {
serveMux.Handle("/", http.StripPrefix("/api", Handler()))
}
var (
serveMux = http.NewServeMux()
httpClient = http.Client{Transport: (*muxTransp... |
be3d3142c26e9a348909dc07d966089fcc207d7e | 68f2546c75ff96c6c735697f8d74ac03cfa183d5 | itsintern/runc | /libcontainer/cgroups/fs2/memory.go | Go | go | 3,518 | permissive | // +build linux
package fs2
import (
"bufio"
"os"
"path/filepath"
"strconv"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/pkg/errors"
)
// numToStr converts an int64 value... |
9369ff890efab25ad2b1d2e767210732bd419aac | c506cac710808af9a193be6766b1920112915ce0 | kinvolk/cilium | /pkg/checker/checker.go | Go | go | 9,567 | permissive | // Copyright 2018-2019 Authors of Cilium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
cb2d421e59376733786a8a43efba9e76b97c4ed0 | f5916d0560604b833597e12d1987eb436854c293 | jiangz222/goplus | /lib/default.go | Go | go | 723 | permissive | package lib
import (
_ "github.com/goplus/gop/lib/builtin" // builtin
_ "github.com/goplus/gop/lib/bytes"
_ "github.com/goplus/gop/lib/errors"
_ "github.com/goplus/gop/lib/flag"
_ "github.com/goplus/gop/lib/fmt"
_ "github.com/goplus/gop/lib/github.com/goplus/gop/ast/gopq"
_ "github.com/goplus/gop/lib/github.com... |
72f0f97b8ef7b8cdb24674bd2b4c33e1108ee122 | 2dae76d4678103a1778256ef711b3d8370498b3b | torusresearch/tendermint | /benchmarks/codec_test.go | Go | go | 2,798 | permissive | package benchmarks
import (
"testing"
"time"
amino "github.com/tendermint/go-amino"
proto "github.com/torusresearch/tendermint/benchmarks/proto"
"github.com/torusresearch/tendermint/crypto/ed25519"
"github.com/torusresearch/tendermint/p2p"
ctypes "github.com/torusresearch/tendermint/rpc/core/types"
)
func te... |
ab793cf761f432bec3faaa2cf08f0f9d453de57a | cb5728465ba8cc71f63ad21c4a8ee827e81a0f7e | spiffxp/cri-containerd | /pkg/server/container_status.go | Go | go | 2,603 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
784b2209f342d247642c50ffca0890b286d6e222 | df0970ed7994a109696214e185642f26d27687e6 | fmechant/goformation | /cloudformation/codebuild/aws-codebuild-project_sourceauth.go | Go | go | 1,822 | permissive | package codebuild
import (
"github.com/fmechant/goformation/v4/cloudformation/policies"
)
// Project_SourceAuth AWS CloudFormation Resource (AWS::CodeBuild::Project.SourceAuth)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-sourceauth.html
type Project_SourceAu... |
3befbd719f1e79958d288b14b0569a998d5a4ccb | 612a0023a491de9c4a2d300bfa77004326202b23 | pangkunyi/skvdb | /counter_test.go | Go | go | 937 | no_license | package skvdb
import "testing"
func Benchmark(b *testing.B) {
db := New(".", 10)
for i := 0; i < b.N; i++ {
_, err := db.getCounter(func(counter uint64) error {
return nil
})
if err != nil {
b.Fatal("failed to get counter", err)
}
}
}
func TestResetCounter(t *testing.T) {
db := New(".", 10)
if err ... |
ed036de5584155f41e1c2936f544324ad5a61158 | e84537c22eef9651f47ba4d252d62f933e6431b3 | viniciussousazup/ritchie-cli | /functional/single/scaffold/scaffold_integration_test.go | Go | go | 728 | permissive |
package scaffold
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/ZupIT/ritchie-cli/functional"
)
func TestRitSingleScaffold(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Rit Suite Scaffold")
}
var _ = Describe("RitSca... |
136b9b3999d393953dfb3e91618a077fc44b5166 | 4e4da9ff287dbe5a1311b403f72d2dad123888cc | yext/vitess | /go/vt/servenv/grpc_auth.go | Go | go | 2,745 | permissive | /*
Copyright 2019 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... |
40075297e51c7e9545cced60b9fc9421b5828dac | 12edd0ebc3abfcd5d46118d4568de61ceb11b470 | subfuzion/coding-problems-in-go | /chapter01/109_string_rotation/string_rotation_test.go | Go | go | 1,767 | permissive | package string_rotation
import (
"testing"
"github.com/subfuzion/coding-problems-in-go/test"
)
// F is the type of function that implements the solution
type F func(string, string) bool
// Test defines a test case
type Test struct {
A string
B string
Expected bool
}
// Tests is a test suite
var ... |
d80a4ddae3a3aece61e85a33220f71b99b0e0a5b | a63726bc40f55cb3096eab778e871fc80aebe0e5 | shintaro-iwasaki/daos-copy | /src/control/server/mgmt_system.go | Go | go | 25,308 | permissive | //
// (C) Copyright 2020-2021 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
package server
import (
"context"
"fmt"
"net"
"os"
"strings"
"time"
uuid "github.com/google/uuid"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
"google.golang.org/grpc/peer"
"google.golang.org/protobuf... |
72bf3942e7815c1894f5a844d63b71bb0e17dea1 | 1ad389391b69d6e52d29bd483125defb254be721 | PsymonLi/sw | /venice/cmd/services/tokenauth/tokenauth_test.go | Go | go | 3,271 | no_license | package tokenauth
import (
"crypto/x509"
"testing"
"time"
"github.com/gogo/protobuf/types"
"github.com/pensando/sw/api"
"github.com/pensando/sw/venice/utils/certmgr"
"github.com/pensando/sw/venice/utils/certs"
"github.com/pensando/sw/venice/utils/keymgr"
. "github.com/pensando/sw/venice/utils/testutils"
"g... |
94368e8991ace8d3898f0f454321644ac4ffe199 | 55f3cb30de65bb1c5bf06dc0326b60e4346a945c | lukedirtwalker/scion | /private/ca/renewal/ca_signer_gen.go | Go | go | 10,232 | permissive | // Copyright 2020 Anapaya Systems
//
// 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 i... |
ed67e13b3e51175da076eacf436d7070178bd624 | 36c4702a2d10518c7b77fe90de11b155986e9c89 | mehulrathod/ChatApp | /models/base.go | Go | go | 1,623 | no_license | package models
import (
"database/sql"
"fmt"
"github.com/jinzhu/gorm"
"os"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/joho/godotenv"
)
var db *sql.DB
var gormDB *gorm.DB
type Model struct {
ID uint64 `gorm:"primary_key;auto_increment:false" json:"id_msb" sql:"index"`
CreatedAt time.Ti... |
e3a88299684ff6e4efcfe0d3ae93bd424a3ac7d2 | 7171b64f471a61c32bc55191cf8b432eab5bfa9f | nikhilsbhat/neuron | /vendor/github.com/bndr/gojenkins/request.go | Go | go | 4,836 | permissive | // Copyright 2014 Vadim Kravcenko
//
// 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... |
f347046c68965e66dd115b31bac087dc2c40b5bb | ad7c674adec2552bb49f1d92a55b7579c4a48676 | MinDekwad/WebreportBackend | /ent/schema/bankdetail.go | Go | go | 1,043 | no_license | package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Bankdetail holds the schema definition for the Bankdetail entity.
type Bankdetail struct {
ent.Schema
}
// Fields of the Bankdetail.
func (Bankdetail) Annotatio... |
8579569e61ab916c163b2f10b7dc219cc7d010ff | ff8a44bfeeb4670ff459953b4f7069a47bfaf292 | ebardes/v2sdl | /src/static/static_test.go | Go | go | 206 | no_license | package static
import "testing"
func TestLink(t *testing.T) {
item, err := GetItem("index.html")
if err != nil {
}
t.Log(item, err)
item, err = GetItem("doesn't exist at all")
t.Log(item, err)
}
|
352b7249dd80e523ff2b0e291713dddee604ba1e | 9b387c8496c0688d6925dec0be8733e74aee1875 | hatena/ipdrawer | /pkg/utils/envutil/env.go | Go | go | 297 | no_license | package envutil
import "os"
// EnvOrDefaultString returns the value set by the specified
// environment variable, if any, otherwise the specified default value.
func EnvOrDefaultString(name string, value string) string {
if v, found := os.LookupEnv(name); found {
return v
}
return value
}
|
106b2de046d3df08007298b8bb134064010bcbc2 | b9c750e99f3cc33939cee8ccafe4719150163ab3 | lirm/aeron-go | /archive/codecs/RecordingSubscriptionDescriptor.go | Go | go | 8,985 | permissive | // Generated SBE (Simple Binary Encoding) message codec
package codecs
import (
"fmt"
"io"
"io/ioutil"
"math"
)
type RecordingSubscriptionDescriptor struct {
ControlSessionId int64
CorrelationId int64
SubscriptionId int64
StreamId int32
StrippedChannel []uint8
}
func (r *RecordingSubscription... |
21dcf2b63ba34f7629f3c2034c443f3b0234aa0e | 5e333ce9e61d979db89b1a8dced99e32b24ff356 | aclissold/CodeEval | /problem097/solution.go | Go | go | 1,494 | no_license | /*
Problem 97: Find a Writer
CHALLENGE DESCRIPTION:
You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts
by pipe char (|). The first part has a writer's name. The second part is a "key" to generate a name.
Your goal is to go through each number in the key (numbers are ... |
91d2c55c3b588b4489ee530fbe77df09aeac7746 | 3a5bbad6a0b88e7613a387627bc6578f75ff0f11 | rubik-ai/benthos | /lib/processor/process_dag.go | Go | go | 10,298 | permissive | package processor
import (
"encoding/json"
"fmt"
"regexp"
"strings"
"sync"
"time"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/message/tracing"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/opentracing/opentracing-go"
"githu... |
99195118c494e413e46b19531ce6c37a48f6946e | 5c1f1fb4950e51b171805787ace996a897578dd9 | kubernetes-sigs/cloud-provider-baiducloud | /pkg/cloud-provider/load_balancer_blb_listener_test.go | Go | go | 6,034 | permissive | package cloud_provider
import (
"context"
"testing"
"icode.baidu.com/baidu/jpaas-caas/bce-sdk-go/bce"
"icode.baidu.com/baidu/jpaas-caas/bce-sdk-go/blb"
api "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func beforeTestListener() (*Baiducloud, *blb.CreateLoadBalancerResponse, error) {
cl... |
055e792c747b2f4b77c18137191b4a9b95f0894e | a198e26ee3616e4807df0d72d07c858931207e66 | geseq/dbr | /interpolate_test.go | Go | go | 5,309 | permissive | package dbr
import (
"strings"
"testing"
"time"
"github.com/gocraft/dbr/dialect"
"github.com/stretchr/testify/assert"
)
func TestInterpolateIgnoreBinary(t *testing.T) {
for _, test := range []struct {
query string
value []interface{}
wantQuery string
wantValue []interface{}
}{
{
query: ... |
92cde3d3a1a2717a06613e6e697038241d0d2633 | 4046fca4e5609eaf909a552dc30b9b4b3fdac96e | hostdio/webhookd | /main.go | Go | go | 296 | no_license | package main
import (
"log"
"os"
"github.com/hostdio/webhookd/httpapi"
)
var (
postgresConnString = os.Getenv("POSTGRES_CONNECTION_STRING")
)
func main() {
if postgresConnString == "" {
panic("POSTGRES_CONNECTION_STRING is missing")
}
log.Fatal(httpapi.Cmd(postgresConnString))
}
|
511852404b860bbc6424fda2382a69aa2cceebc9 | d5229258449d74d15e3c5f8988c85e30c8c6b839 | ORASTARK/jenkins-library | /cmd/piper.go | Go | go | 17,878 | permissive | package cmd
import (
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"github.com/SAP/jenkins-library/pkg/config"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
// GeneralConfigOptio... |
62b35f8568d91c4f5f62ccca2e8ae88fad0b2876 | 2c1eae1d877438801b024878e83ec6f166d705b3 | m3db/prometheus_client_golang | /prometheus/testutil/testutil.go | Go | go | 10,477 | permissive | // Copyright 2018 The Prometheus 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... |
f3f3bab633196fbd88454af395b7e5e816906abc | 9287ccd83300326be6ff34473bed4aea01f0590c | ahrtr/cluster-api | /controllers/machine_controller.go | Go | go | 29,030 | permissive | /*
Copyright 2019 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, ... |
9297e0473c0f0d2349233c81e445806b3135c4d0 | fb93e16ccc94c7988cfafb59987df66d9029ab32 | zamj/evergreen | /vendor/github.com/mongodb/jasper/integration_test.go | Go | go | 4,579 | permissive | package jasper
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"syscall"
"testing"
"time"
"github.com/mongodb/grip"
"github.com/mongodb/jasper/options"
"github.com/mongodb/jasper/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tychois... |
40c157cf5158f7f1928a977f0d879732bb1e818a | e35a467c38145797f6967b5f35796adf79b0701c | reirep/MyLittleTerminalIsMagic | /command.go | Go | go | 915 | permissive | package main
import (
"os"
"os/exec"
)
type command struct {
sync bool
exec string
args []string
context *Context
run *exec.Cmd
}
func new_command(sync bool, exe string, args []string, ctx *Context) command {
command := command{
sync: sync,
exec: exe,
args: args,
context: ctx,
... |
ef9bfe74de9a4ad979d2b9fe8407eed409fe1215 | c8966bf9527108ec58d3881e39ac459f976fb22f | aqtrans/go-neb | /api/handlers/auth.go | Go | go | 8,892 | permissive | package handlers
import (
"database/sql"
"encoding/base64"
"encoding/json"
"net/http"
"strings"
log "github.com/sirupsen/logrus"
"git.jba.io/go/go-neb/api"
"git.jba.io/go/go-neb/database"
"git.jba.io/go/go-neb/metrics"
"git.jba.io/go/go-neb/types"
"github.com/matrix-org/util"
)
// RequestAuthSession repre... |
e5a50e53a04f0ffbf9e490582edc53f7850d619a | 8c11210f03ddbbf3d65c046f2b81217bba415415 | crypto-zone/sifchain-sifnode | /x/tokenregistry/keeper/keeper.go | Go | go | 3,286 | permissive | package keeper
import (
"bytes"
"strings"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
gogotypes "github.com/gogo/protobuf/types"
"github.com/Sifchain/sifnode/x/tokenregistry/types"
)
type keeper struct {
cdc codec.BinaryMarshaler
storeKey sdk.StoreKey
}
func NewKeeper(cdc... |
ea634f4718cdbe4f479722a5cee07b40d46890a8 | 235e0fc49bc334adbf5641fd06efb24ede0f3645 | beati/exchart | /exchart-server/usecases/persistence_interface.go | Go | go | 386 | no_license | package usecases
import (
"context"
"github.com/beati/exchart/exchart-server/domain"
)
// A Repository interface is used to create transaction with a persistance solution.
type Repository interface {
NewTx(ctx context.Context) (Tx, error)
}
// A Tx interface is used to atomically interact with a persistence solu... |
fcf194689aab9a6aba94d8ece04ce6c3b203a641 | 5ca3aed4d996aaa2f2325d26407b7ba836ff07c0 | kernelPanic0x/fyne-x | /widget/gif_slow_test.go | Go | go | 871 | permissive | // +build slowtests
package widget
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"fyne.io/fyne/v2/storage"
)
func TestNewAnimatedGif_Once(t *testing.T) {
gif, err := NewAnimatedGif(storage.NewFileURI("./testdata/gif/earth-once.gif"))
assert.Nil(t, err)
gif.Start()
time.Sleep(time.Millisec... |
381d2bf6395847655cd77a75da8c40f09ac5b8f0 | 232cbf0f2337a56cd87872ce2d44ae436169706e | antihax/mock-esi | /v3/go/routers.go | Go | go | 5,460 | permissive | package esiv3
import (
"net/http"
"reflect"
"strconv"
"github.com/antihax/mock-esi/mockesi"
)
func init() {
mockesi.NewRoute(
"GetAlliancesAllianceId",
"Get",
"/v3/alliances/{alliance_id}/",
GetAlliancesAllianceId,
)
mockesi.NewRoute(
"GetCharactersCharacterIdCalendarEventId",
"Get",
"/v3/char... |
2819eb841b763832812d47fbdcb3ab9f9a90aff8 | 264c41b4f75a485bf0dedc1ed1de69b099da49fb | jangocheng/go-elasticsearch | /typedapi/types/roletemplateinlinequery.go | Go | go | 1,275 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
6787f61ccd54815d5ca912da75c64c1ff38fff23 | 046b99a68b3dd51042c74f071153f952aaa9c4b5 | ashish-amarnath/velero | /pkg/persistence/object_store_layout.go | Go | go | 3,784 | permissive | /*
Copyright 2018 the Velero contributors.
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,... |
8f03b7f51e2c1bc172dd6786ee114b3040adda04 | bdc41cb716c70f3e5a991dc5bc0711bffe271e62 | ghe-saml-test-2/golang-scripts | /hook.go | Go | go | 2,018 | permissive | package handler
// https://developer.github.com/webhooks/
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"strings"
)
// Replace with your hook's secret
const secret = "shhhhh!!"
func signBody(secret, body []byte) []byte {
computed := hmac.New(sha1.New, secret... |
d6efd6f22bbbd8e1e7978be771d4224c79b21f82 | e8f7a092b8001a24da24c999e4d48a07a580494f | naren1219/kubernetes-1 | /federation/cmd/federation-apiserver/app/server.go | Go | go | 26,806 | permissive | /*
Copyright 2014 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, ... |
2322000c4a889835efece49b21a753d1d5aeaae8 | 55086697b8a1389570ca19c87d7d9c996dcb5a5c | jozn/sun2 | /stress/mysql/home_select.go | Go | go | 371 | no_license | package main
import (
"math/rand"
"ms/sun/shared/base"
"ms/sun/shared/x"
"time"
)
var i5 = 0
func main() {
base.DefultConnectToMysql()
for i := 0; i < 6; i++ {
go f5()
}
time.Sleep(time.Hour)
}
func f5() {
for {
x,_:=x.NewHomeFanout_Selector().ForUserId_Eq(rand.Intn(10000)).GetRows(base.DB)
i5++
... |
853d80ceed1cda1cfe4ab2b5a34e933b9c95afea | a6faae1d2abc983c27e70e53ef30a03a19752f5f | berlinguyinca/marketstore | /frontend/stream/stream_test.go | Go | go | 3,084 | permissive | package stream
import (
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
"github.com/alpacahq/marketstore/executor"
"github.com/alpacahq/marketstore/utils/io"
"github.com/golang/glog"
"github.com/gorilla/websocket"
"github.com/vmihailenco/msgpack"
. "gopkg.in/check.v1"
)
func Test(t *t... |
4aa32bf0b0a1d1630dda3de9523477b41f647cdc | cbf824e05d013915e9bcb78672d7c9f9b0b7ebc2 | cycloidio/terracognita | /interpolator/interpolator_test.go | Go | go | 1,087 | permissive | package interpolator_test
import (
"testing"
"github.com/cycloidio/terracognita/interpolator"
"github.com/stretchr/testify/assert"
)
func TestInterpolate(t *testing.T) {
i := interpolator.New("azurerm")
i.AddResourceAttributes("azurerm_virtual_machine.front", map[string]string{
"id": "secretid",
"other":... |
eb3eeaa47431f1b60281181729fda642f47fecc9 | ad746699576b361c198bebd06351b554da717a87 | lasdolphin/kf | /third_party/knative-serving/pkg/apis/networking/generic_types.go | Go | go | 1,409 | permissive | /*
Copyright 2019 The Knative 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... |
86f01d24ee4214b0d1e21c9a43d8fbb0c5a4f6b5 | 80fb046bb286348db5ab36fb8c029de61e959592 | bcolucci/gokeapi | /models/Machine.go | Go | go | 330 | permissive | package models
type Machine struct {
ID int `json:"id"`
ItemProxy NamedAPIResource `json:"item"`
MoveProxy NamedAPIResource `json:"move"`
VersionGroupProxy NamedAPIResource `json:"version_group"`
Item *Item
Move *Move
VersionGroup *Versi... |
9dad53034581b3704e2b38846a18f2361dc845bd | 5c6942ff1e1b2c5be0c578d78059ece0f9b31f19 | astarte-platform/astartectl | /cmd/cluster/instance_migrate.go | Go | go | 22,341 | permissive | // Copyright © 2022 SECO Mind Srl
//
// 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... |
a424f10371999427f76d36e5c254b795844b8b7b | ed080efbf49550893367648259acd462962d893f | willmadison/codefights | /hourglasssum_test.go | Go | go | 980 | permissive | package codefights
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestHourGlassSum(t *testing.T) {
cases := []struct {
given [][]int
expected int
}{
{
[][]int{
{1, 1, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{1, 1, 1, 0, 0, 0},
{0, 0, 2, 4, 4, 0},
{0, 0, 0, 2, 0, 0}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.