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 |
|---|---|---|---|---|---|---|---|---|
badfe97e5f4d69bcef8aebd4197ad688d41241c1 | 633ef559cca16e174ada6029e77339222016470c | qlik-oss/kustomize | /api/types/patch_test.go | Go | go | 2,272 | permissive | package types_test
import (
"testing"
. "sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/resid"
)
func TestPatchEquals(t *testing.T) {
selector := Selector{
ResId: resid.ResId{
Gvk: resid.Gvk{
Group: "group",
Version: "version",
Kind: "kind",
},
Name: "name",
Nam... |
41a47ef76333c65d4f83e0a0beb75d010518ebb7 | 7b9c9a8c1cf6ff47d3e1c366ab2fe31acfcbee85 | sgtest/monorepo-test-3 | /kubernetes-15/cmd/kubeadm/app/cmd/phases/kubeconfig.go | Go | go | 4,096 | 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, ... |
e5b575d4aa8b2aa14d76b3ba6d2fa665fe50b29f | 8258587f9bcb74c942faeb40a655b48dd1a502f4 | junishitsuka/nlp-100knock | /chapter_one/three.go | Go | go | 528 | no_license | package main
import "fmt"
import "strings"
import "strconv"
func main() {
statement := "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
words := strings.Split(statement, " ")
result := make([]int, len(words))
// resultを空のスライスで宣言してappendすることもできるが
// performanceが良くな... |
0ddd9548f5e6fd8ad041478059ced2d00b1f6d15 | 3d667d45cd3b01bdfd6cedc9dd25cf4cd63f58bc | snakeqx/piTemperature | /main.go | Go | go | 265 | no_license | package main
import (
_ "piTemperature/routers"
_ "piTemperature/tasks"
"github.com/astaxie/beego"
"github.com/astaxie/beego/toolbox"
)
func main() {
// start task regitstered in /tasks/task.go
toolbox.StartTask()
defer toolbox.StopTask()
beego.Run()
}
|
6c767b253504d06f07071c47feb80a87071c84ac | 81fa149ccf2025bee15e4387c35b114d5dadc4b1 | gaofubao/agent-go | /internal/system/disk/disk.go | Go | go | 3,124 | permissive | package disk
import (
"context"
"encoding/json"
"agent-go/internal/system/common"
)
var invoke common.Invoker = common.Invoke{}
type UsageStat struct {
Path string `json:"path"`
Fstype string `json:"fstype"`
Total uint64 `json:"total"`
Free uint64 `json:"f... |
f33751862bad7488237d4bf6d1201b99dc16f094 | 4b1bf152377731a9e414b52c0e08cf8595a68f05 | thorstenpfister/gonyt | /internal/nytapi/book_review.go | Go | go | 557 | permissive | package nytapi
// BookReview as delivered by the New York Times API.
type BookReview struct {
URL string `json:"url,omitempty"`
PublicationDt string `json:"publication_dt,omitempty"`
Byline string `json:"byline,omitempty"`
BookTitle string `json:"book_title,omitempty"`
BookAuthor s... |
0ccf4b40afbdd8979094de69a5a12e39bbc12744 | 8a9fb8c7773257319b9aa680895776cdd2685409 | Alinaufalova/Snippets | /Snippets/cmd/web/helpers.go | Go | go | 1,135 | no_license | package main
import (
"fmt"
"net/http"
"runtime/debug"
)
// The serverError helper writes an error message and stack trace to the errorLog,
// then sends a generic 500 Internal Server Error response to the user.
func (app *application) serverError(w http.ResponseWriter, err error) {
trace := fmt.Sprintf("%... |
81b224352863e2d4b568bc65ee335a960b7b6b90 | 8c202194a27ff95407bd1dca22406da96d655d18 | scale-it/go-web | /handlers/chain_test.go | Go | go | 897 | permissive | package handlers
import (
"bytes"
"net/http"
"testing"
)
func TestChain(t *testing.T) {
var buf bytes.Buffer
a := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
buf.WriteRune('a')
})
b := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
buf.WriteRune('b')
})
c := http.Han... |
de5bfdd60cc12f7a28b127353b1ca444d7b51380 | d4e82346d4a7de43e151b72d050d261bbb75fa02 | gowins/go-micro | /transport/grpc/grpc_test.go | Go | go | 1,995 | permissive | package grpc
import (
"strings"
"testing"
"github.com/micro/go-micro/transport"
)
func expectedPort(t *testing.T, expected string, lsn transport.Listener) {
parts := strings.Split(lsn.Addr(), ":")
port := parts[len(parts)-1]
if port != expected {
lsn.Close()
t.Errorf("Expected address to be `%s`, got `%s`... |
be7f0e23f14faedebc9d354f51db2993651faf33 | c00036624c130e4e56ce784c3de7652cb079338d | nomoremehere/del7 | /pkg/test_util/svc_util.go | Go | go | 668 | permissive | package test_util
import (
"context"
"os"
"os/exec"
)
func Check(err error) {
if err != nil {
panic(err)
}
}
// Build and run a service in a target directory
func RunService(ctx context.Context, targetDir string, service string) {
// Save and restore later current working dir
wd, err := os.Getwd()
Check(er... |
d8027ec808ab34d0f0d58db3bc8a0d80c560a047 | 0e6612c5bea2668df241aad19e09f5e6ec6ce6d4 | sickhye/geode-go-client | /client.go | Go | go | 4,147 | permissive | package geode_go_client
import "github.com/gemfire/geode-go-client/connector"
// A Client provides the high-level API required to interact with a Geode cluster. The API
// supports the following key and value types:
//
// int
// int16
// int32
// int64
// byte
// bool
// float32
// flo... |
9f4f8bb5c1a846a9143a6e927b8eba2501415a24 | b26dfcb1052b23d2ee8962103cc8d5bff91bfb57 | mycodesmells/go-workshops | /tasks/task4/main.go | Go | go | 562 | no_license | package main
import (
"fmt"
"github.com/slomek/go-workshops/tasks/task4/fb"
)
// SuperHero is kind of hero, but is super at the same time.
type SuperHero struct {
fb.Person
HeroName string
}
// TellSecret provides you with some information you did not know earlier.
func (b SuperHero) TellSecret() string {
retu... |
9d3f41991dae3af9208b5271a0535d37cffdfed9 | 21f921758c5a5f60494ba72b135ce6238a62cdc3 | sirpedrotavares/CVE-2021-26855 | /CVE-2021-26855.go | Go | go | 12,318 | no_license | package main
import (
"crypto/tls"
"flag"
"fmt"
"time"
"io"
"io/ioutil"
"net/http"
//"net/url"
"os"
"strings"
"regexp"
"encoding/base64"
"bufio"
"strconv"
)
func Verify(targetUrl string) bool {
tr := &http.Transport{
TLSClientC... |
7aca998dd49cd9894e1c5bcf530a9c4ab95e19d8 | 93b25d492627281b2028648281cc95ea71245191 | wehkamp/docker-prometheus-node-exporter | /collector/systemd_linux.go | Go | go | 4,830 | permissive | // Copyright 2015 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... |
4228246fbde26f576b48037dfc9abe91991e6d30 | 1fbad569fc4b31b5580541e428c6c0555422d179 | mtso/classics | /moby/docker/docker.go | Go | go | 718 | no_license | package main
import (
"io"
"log"
"os"
"flag"
"net/http"
"net/url"
)
// Use this key to encode an RPC call into an URL,
// eg. domain.tld/path/to/method?q=get_user&q=gordon
const ARG_URL_KEY = "q"
func CallToURL(host string, cmd string, args []string) *url.URL {
qValues := make(url.Values)
for _, v := ... |
6f999939ee757758ffe73427c835f9317f68522a | 03d1a68dedbdc663093d288ce5d6f3567349f492 | openshift/cluster-api-provider-aws | /vendor/github.com/awslabs/goformation/v4/cloudformation/sagemaker/aws-sagemaker-modelexplainabilityjobdefinition_modelexplainabilityjobinput.go | Go | go | 1,965 | permissive | package sagemaker
import (
"github.com/awslabs/goformation/v4/cloudformation/policies"
)
// ModelExplainabilityJobDefinition_ModelExplainabilityJobInput AWS CloudFormation Resource (AWS::SageMaker::ModelExplainabilityJobDefinition.ModelExplainabilityJobInput)
// See: http://docs.aws.amazon.com/AWSCloudFormation/late... |
0129a33487cd2a3f4221e04fffdd6a8be8c32566 | 5f86d3540475469b338d851f99a1cefe4aa56f5b | yadisnel/go-ms-plugins | /registry/nats/environment_test.go | Go | go | 1,538 | permissive | package nats_test
import (
"os"
"testing"
log "github.com/yadisnel/go-ms/v2/logger"
"github.com/yadisnel/go-ms/v2/registry"
"github.com/yadisnel/go-ms/v2plugins/registry/nats/v2"
)
type environment struct {
registryOne registry.Registry
registryTwo registry.Registry
registryThree registry.Registry
serv... |
e5b6a5034e8ecfc78cb02d6f8ed1b9c2fca5e140 | 3b31ebe8fa4347746fd479c6a872fe25cb5a4cc3 | omarshawkyelsabagh/dailycodingproblem-go | /day67/problem.go | Go | go | 3,754 | permissive | package day67
import (
"container/list"
)
type freqNode struct {
accessCount int
siblings *list.List // is a list of keyValueNodes
}
type keyValueNode struct {
key interface{}
value interface{}
parent *list.List
freqElem *list.Element
}
// LFUCache is a least-frequently-used cache.
// Every oper... |
554d24ddbef9e477df6e976d7422af02e2e7e5fd | 7d30d3c2ab5805ca6d26a9eb25a168e0b0903eae | xumamba/paxos | /paxos_test.go | Go | go | 1,984 | no_license | package paxos
/**
* @DateTime : 2020/11/12
* @Author : xumamba
* @Description:
**/
import (
"fmt"
"sync"
"testing"
)
func initializeCluster(size int) ([]*Learner, []*Acceptor, []*Proposer) {
learnerPort, acceptorPort := 8000, 9000
learners := make([]*Learner, 0, size)
learnersAddr := make([]string, 0... |
b2eb11e5245f4e14be7b8fc78008dd91da49236b | 0503797f8b1a4651084c5eac68607e8cf8fc9012 | juicedata/juicefs-csi-driver | /pkg/driver/node_test.go | Go | go | 23,275 | permissive | /*
Copyright 2021 Juicedata Inc
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, software
d... |
654991d1ec5fb41d7f31f7be548f6d34cc4507c4 | aa68791d7256de233037294391beb64df2b1c674 | jonathanstallings/layer0 | /api/logic/logic.go | Go | go | 1,709 | no_license | package logic
import (
"github.com/quintilesims/layer0/api/backend"
"github.com/quintilesims/layer0/api/data"
"github.com/quintilesims/layer0/common/models"
)
type Logic struct {
Backend backend.Backend
AdminData data.SQLAdmin
TagData data.TagData
JobData data.JobData
ebStackName *string
}
func... |
8c996a2e557a63a28d024735ab6384c6b515632f | 93844d0ed649610e7b91a336444d9fb9e2373604 | AmandaHassoun/adventofcode | /2020/day-1/day1.go | Go | go | 1,293 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func Check(e error) {
if e != nil {
panic(e)
}
}
var entries []int
func main() {
dir, err := os.Getwd()
Check(err)
file, err := os.Open(dir + "/day-1/input.txt")
Check(err)
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Split(bufio.... |
9a6650239dcb20f94aec0afed11a23680ed625c4 | 1098b7cb9580eeeb319f26756948b4cd6c1eaa45 | FabLabBerlin/localmachines | /models/metrics/machine_earnings/machine_earnings.go | Go | go | 4,210 | no_license | package machine_earnings
import (
"fmt"
"github.com/FabLabBerlin/localmachines/lib/month"
"github.com/FabLabBerlin/localmachines/lib/redis"
"github.com/FabLabBerlin/localmachines/models/invoices/invutil"
"github.com/FabLabBerlin/localmachines/models/machine"
"github.com/FabLabBerlin/localmachines/models/membersh... |
368e9b777570f6850dba79023c216d0c92216b79 | 11422d3d1c9e5d268b36ea35891603d2380c1dd9 | janosgyerik/dupfinder | /pathreader/pathreader.go | Go | go | 1,094 | permissive | package pathreader
import (
"bytes"
"io"
"bufio"
)
func scanNullDelimited(data []byte, atEOF bool) (advance int, token []byte, err error) {
if atEOF && len(data) == 0 {
return 0, nil, nil
}
if i := bytes.IndexByte(data, 0); i >= 0 {
// We have a full null-terminated line.
return i + 1, data[0:i], nil
}
... |
5b13cbfa9a75fcce23f8f3b3919f156f205b0cde | b0a2805c8efc6413577c715c75ee683f61e338b8 | tm-ad/g-base | /log/log.go | Go | go | 1,243 | permissive | package log
import (
"github.com/tm-ad/g-base/exceptions"
"github.com/tm-ad/g-base/util"
"time"
)
var _loggerInDevelopment *Logger
// A Log represents a log line.
type Log struct {
// Logger is the original printer of this Log.
Logger *Logger
// Time is the current time
Time time.Time
// Level is the log lev... |
41086148ff3c657db710600ba5d9d6e388e7b130 | f9c3c59d287a6fce427296f2525f6f5f50a06adb | mrandmrsbenben/LeetCodeByGo | /680_valid palindrome ii/validpalindrome.go | Go | go | 710 | no_license | package main
import "fmt"
func main() {
s := "abcda"
// s := "deeee"
// s := "aguokepatgbnvfqmgmlcupuufxoohdfpgjdmysgvhmvffcnqxjjxqncffvmhvgsymdjgpfdhooxfuupuculmgmqfvnbgtapekouga"
fmt.Println("Output:", validPalindrome(s))
}
//执行用时 :56 ms, 在所有 Go 提交中击败了47.54%的用户
//内存消耗 :7.5 MB, 在所有 Go 提交中击败了10.34%的用户
func valid... |
fb26d0e5ad6dac6e15ecac5455305fe4187b701f | 3c4322af20709a5fa773a19262879dc331a1fdb2 | nicolaslee2775/authgear-server | /pkg/lib/config/identity.go | Go | go | 11,484 | permissive | package config
import (
"fmt"
)
var _ = Schema.Add("IdentityConfig", `
{
"type": "object",
"additionalProperties": false,
"properties": {
"login_id": { "$ref": "#/$defs/LoginIDConfig" },
"oauth": { "$ref": "#/$defs/OAuthSSOConfig" },
"on_conflict": { "$ref": "#/$defs/IdentityConflictConfig" }
}
}
`)
type ... |
0f867b023ca0f35b03239a95a9e73d593350157c | 2eeb5622d1a6e8db282f7f243a277fc57487d370 | yongliangcode/kuma | /pkg/xds/envoy/routes/v2/common_route_configuration_configurer.go | Go | go | 439 | permissive | package v2
import (
envoy_api "github.com/envoyproxy/go-control-plane/envoy/api/v2"
"github.com/golang/protobuf/ptypes/wrappers"
)
type CommonRouteConfigurationConfigurer struct {
Name string
}
func (c CommonRouteConfigurationConfigurer) Configure(routeConfiguration *envoy_api.RouteConfiguration) error {
routeCo... |
703237fc169203009947e0ee95390dd297d4af84 | bbd362483698184a84b0006f7714bdedefe44e32 | leverwwz/go-substrate-rpc-client | /types/bool_test.go | Go | go | 2,262 | permissive | // Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls
//
// Copyright 2019 Centrifuge GmbH
//
// 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 th... |
454e3a9fcf6206abf9a42a58555ed72902a84430 | 227528dff09fd69a6e0a912cb2cf0d9d497dba81 | zhaohaijun/kbfs | /test/cr_simple_test.go | Go | go | 29,452 | permissive | // Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
// These tests all do one conflict-free operation while a user is unstaged.
package test
import (
"testing"
"time"
)
// bob writes a non-conflicting file while unst... |
f6d039d5d2b998e3baa78b06bdd8d3b8ff31a038 | 409b48661b24a68900c3e962b98ac477d7a32c3a | ajesse11x/ship | /pkg/lifecycle/daemon/daemontypes/types.go | Go | go | 4,912 | permissive | package daemontypes
import (
"context"
"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/filetree"
)
type StatusReceiver interface {
SetProgress(Progress)
ClearProgress()
PushStreamStep(context.Context, <-chan Message)
SetStepName(context.Context, string)
PushMessageStep(context.Contex... |
934e059d2e64adf3ee5e09331ed7108f8c06615d | b846440182ed8381567af7cdd0926fafe48418b6 | RickAtCodeMojo/Go-Training | /06-arrays/2-arrays/arrays.go | Go | go | 818 | no_license | package main
import (
"fmt"
)
func main() {
//define an array with unknown number of elements
var movies = [...]string{
"Avatar",
"Titanic",
"Star Wars: The Force Awakens",
"Jurassic World",
"Marvel's The Avengers",
"Furious 7",
"Avengers: Age of Ultron",
"Harry Potter and the Deathly Hallows Part ... |
ae7ae1c58dc6d1ea814bd65e678697b502c65eea | 1642433bd869967c0b72c2c329bd956b2de6f2f1 | mincoft/gomclauncher | /auth/authlib_test.go | Go | go | 858 | permissive | package auth
import "testing"
func TestGetauthlibapi(t *testing.T) {
type args struct {
api string
}
tests := []struct {
name string
args args
wantApiaddress string
wantErr bool
}{
{name: "1", args: args{api: "littleskin.cn"}, wantApiaddress: "https://littleskin.cn/api/yggdr... |
1a16dc5926e6e0355c1052848c5ab1e0ec742fb0 | fd0e42ed2c6033bbaab9be5861daff34adae17cc | swarmfund/swarm-psim | /psim/kyc/idmind/check_kyc.go | Go | go | 3,809 | no_license | package idmind
import (
"context"
"fmt"
"gitlab.com/distributed_lab/logan/v3"
"gitlab.com/distributed_lab/logan/v3/errors"
"gitlab.com/swarmfund/psim/psim/kyc"
"gitlab.com/tokend/regources"
)
// TODO Try to refactor - make method shorter.
func (s *Service) processNotChecked(ctx context.Context, request regour... |
c9d01d45cddd42d47698c6245d2ff8dc2510b549 | 8b2118b1294f8c031bac8cf2804dfd0d6754e668 | VonRosenchild/amboy | /vendor/gonum.org/v1/gonum/lapack/gonum/dlaqp2.go | Go | go | 3,190 | permissive | // Copyright ©2017 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gonum
import (
"math"
"gonum.org/v1/gonum/blas"
"gonum.org/v1/gonum/blas/blas64"
)
// Dlaqp2 computes a QR factorization with column pivoting ... |
9c9861d4e20b63bb57315392d7af7bec4af1d3ac | f7a5502ef03fbe5b885d14ade8f6e7c88ff32136 | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/identitygovernance/entitlement_management_connected_organizations_item_internal_sponsors_get_available_extension_properties_response.go | Go | go | 5,559 | permissive | package identitygovernance
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
)
// EntitlementManagementConnect... |
54cf0c49e54001493e69b37240e40497fb4f21d2 | 392fe810e2eb0341bc1790cf7a78d293a6ca7369 | bgbombas/archive-server | /archive_test.go | Go | go | 6,792 | permissive | // Copyright 2015 Globo.com. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"io/ioutil"
"os"
"path/filepath"
"time"
"github.com/tsuru/commandmocker"
"gopkg.in/check.v1"
"gopkg.in/mgo.v2/bson"
)
func (... |
aad0948626ab769ab5d9f6536c1af50dc8c75353 | 190a0aa125be42545bfb1194633e31c77991e702 | farwydi/tg-example | /internal/endpoint/tg/register.go | Go | go | 1,615 | permissive | package tg
import (
"context"
"net"
"net/http"
"sync"
"tgex/domain"
"time"
"go.uber.org/fx"
"go.uber.org/zap"
)
func Register(cnf *domain.Config, lifecycle fx.Lifecycle, down fx.Shutdowner, logger *zap.Logger, p Params) error {
_app = &App{
Params: p,
logger: logger,
start: time.Now(),
done: ... |
c823314e77055f36e4713fa8725ed1bd45b933c4 | 99eb67986d505decd5342169350578695a7e844d | ibmmark/fabric-docs | /msp/peermsp.go | Go | go | 5,082 | permissive | /*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
1757711955725d9f7b4f565ace33e852e66a6b14 | 08f3633c10ecb89e40fda3c7721ccf55ba9f17f5 | itsabgr/go-q | /q_test.go | Go | go | 1,393 | permissive | package q
import (
"github.com/itsabgr/atomic2"
"github.com/itsabgr/go-handy"
"runtime"
"sync"
"testing"
)
func TestQ_ThreadSafety(t *testing.T) {
if runtime.NumCPU() <= 1 {
t.Fatal("can not test thread-safety on this environments")
}
total := atomic2.Uintptr(0)
q := Q{}
wg := sync.WaitGroup{}
count := u... |
315335951e2502e0fb5972f48aa3062534e30774 | 5192d4bd2be697735f342d833e0d38c0f0078015 | black-adder/m3 | /src/dbnode/x/xio/segment_reader_test.go | Go | go | 3,465 | permissive | // Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
14c185707929282f8aa4952f2eb50b0669924cf4 | e89a84c6e61e0b7556fce3ab9ddc476c82f02a30 | chadnetzer/hardlinkable | /dolink_test.go | Go | go | 6,208 | permissive | // Copyright © 2018 Chad Netzer <chad.netzer@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, mod... |
9da4c1e06c715b0e369288160519cc1770c43a9c | fdd0be63eff72e91412d57b72242793c897f857e | projectcalico/calico-upgrade | /pkg/commands/version.go | Go | go | 1,471 | permissive | // Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
f3d702be55bc852a8bacf2eb963e932aa068b910 | 4925c9bd794d1273413bd79d864187021b52fe16 | TheJaySmith-Google/pulumi-google-native | /sdk/go/google/dialogflow/v2beta1/document.go | Go | go | 16,742 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v2beta1
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new document. Note: The `proj... |
2808b760f20c2ab23c2f749b50bf542954cc0df1 | e95996450da9cfcf516a0e3833f3e9ca3eb32e48 | zazab/cluster-api | /cmd/clusterctl/cmd/rollout/pause.go | Go | go | 2,851 | permissive | /*
Copyright 2020 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, ... |
4697f49ed8e9b20387536e6f1ce3945206cb4be9 | 08d189c8d7751518e0c76369d35bda7656a46c28 | hxzqlh/leetcode | /list/add-2-nums.go | Go | go | 957 | no_license | package list
// 反向排序
// 输入:(7 -> 1 -> 6) + (5 -> 9 -> 2),即617 + 295
// 输出:2 -> 1 -> 9,即912
func AddTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
ret := new(ListNode) // 引入头节点
var carry int // 进位
var val int // 相加之和,>=10则对10取模
pre := ret
p := l1
q := l2
for p != nil || q != nil || carry > 0 {
val = ca... |
c23dadd1ea6c1b5e01ab89f61e9ef1ffa24a3860 | 7bc642b228a92a9f26a3b46da4beb5dcc60c99d5 | openshift/installer | /terraform/providers/vsphereprivate/vendor/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_vnic.go | Go | go | 14,704 | permissive | package vsphere
import (
"context"
"fmt"
"log"
"strconv"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem"
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25... |
12d61980347bda9c3cd32b83ca3417c9a703a8f4 | 6c47e29c4e63b735387d3de8ce4e027fecf08d6a | alinz/baker | /service/services_test.go | Go | go | 1,337 | no_license | package service_test
import (
"sync"
"testing"
"time"
"github.com/alinz/baker"
"github.com/alinz/baker/pkg/endpoint"
"github.com/alinz/baker/service"
)
type ConfigLoaderFn func(addr endpoint.HTTPAddr) (*baker.Config, error)
var _ service.ConfigLoader = (*ConfigLoaderFn)(nil)
func (cl ConfigLoaderFn) Config(a... |
25a652ae542787e382375b5b84e4d649ba6de36a | 305af7ecf0256c9213878519af9d38890498f7de | Shylock-Hg/tidb | /sessionctx/binloginfo/binloginfo_test.go | Go | go | 26,460 | permissive | // Copyright 2016 PingCAP, Inc.
//
// 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... |
c9cd7b25c7f6620d0e605719a36ec9621356ee7f | febda29699e355f930098f88bfc2a80d5a1f7adc | AzureCloudMonk/vitess | /go/vt/wrangler/traffic_switcher.go | Go | go | 60,036 | 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... |
c1a90083b9becb640f0b24a5952c5b4acfb92ec8 | 53411637a1a1ebeef02962ff8ebc5912944fbba8 | zscboy/sloth-servers | /gosrc/lobbyserver/lobby/club/club_test.go | Go | go | 26,003 | no_license | package club
import (
"bytes"
"fmt"
"io/ioutil"
"lobbyserver/lobby"
"log"
"net/http"
"testing"
"time"
"github.com/golang/protobuf/proto"
)
// TestSomething 测试用例
func TestSomething(t *testing.T) {
log.Println("TestSomething")
log.Println("now time:", int64(time.Millisecond))
// testCrea... |
b688b21ea3c5fdfeb8816fa73b46f1d67cf2ce48 | 672c279ac83e4a280d6ad7295c8f6aeaaef8a2ed | gaochao1/agent | /vendor/github.com/xtaci/kcp-go/sess.go | Go | go | 18,614 | permissive | package kcp
import (
crand "crypto/rand"
"encoding/binary"
"errors"
"io"
"log"
"math/rand"
"net"
"sync"
"sync/atomic"
"time"
"github.com/klauspost/crc32"
"golang.org/x/net/ipv4"
)
var (
errTimeout = errors.New("i/o timeout")
errBrokenPipe = errors.New("broken pipe")
rng = rand.New(rand.N... |
1e2edb8a58f626e4633ac0a2b219234f84b8aede | 78debf3c1c1022d78cf4b6e9d903511ed7cee4d7 | tyfanderw/janus | /pkg/middleware/stats.go | Go | go | 1,487 | permissive | package middleware
import (
"net/http"
"net/url"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/hellofresh/janus/pkg/response"
"github.com/hellofresh/stats-go"
)
// Stats represents the stats middleware
type Stats struct {
statsClient stats.Client
}
// NewStats creates a new instance of Stats
func NewSt... |
cf46b735b0a77f9e2a8a40d2a6b9cbda4fc7f0ec | dcf013b855e00c723bba412b119ff12e53ed11bf | alpe/go-bip39 | /bip39_test.go | Go | go | 12,397 | permissive | package bip39
import (
"encoding/hex"
"testing"
"github.com/stretchr/testify/assert"
)
type Vector struct {
entropy string
mnemonic string
seed string
}
func TestBip39(t *testing.T) {
for _, vector := range testVectors() {
entropy, err := hex.DecodeString(vector.entropy)
assert.NoError(t, err)
mn... |
8762a2983d6fa74ef28325ff50dfc8cf32b37dff | 60ea1926e6da1b6bbab507b63e3a5d050c461dd2 | surma-dump/alexdipl | /logisches_modell.go | Go | go | 5,747 | no_license | package main
import (
"./logic"
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)
var (
input = flag.String("i", "", "Input to read from.")
sat = flag.Bool("s", false, "Produce SAT compatible output")
)
func main() {
flag.Parse()
matrixstring, irreversiblestring := ReadInputStrings()
stoichio ... |
fd869a1ff816bc7bdd8928b4ffb8c86e5d56ac09 | ff58a6de6c592749872c5a9114c39704f0b3d86a | Universal-Health-Chain/aries-framework-go | /pkg/didcomm/packer/api.go | Go | go | 1,745 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package packer
import (
cryptoapi "github.com/Universal-Health-Chain/aries-framework-go/pkg/crypto"
"github.com/Universal-Health-Chain/aries-framework-go/pkg/didcomm/common/transport"
"github.com/Universal-Health-... |
7218e51dffcde4ba68f069601c2e3dd4a48a70c9 | c9633a4e30698c6a36a91deaf978e72474fed312 | evansopilo/yomo | /pkg/quic/quic-go.go | Go | go | 4,554 | permissive | package quic
import (
"bytes"
"context"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"errors"
"math/big"
"net"
"time"
quicGo "github.com/lucas-clemente/quic-go"
"github.com/yomorun/yomo/pkg/logger"
)
type quicGoServer struct {
handler Ser... |
ab9d9cbfbc0f85718d9221ebf9a8e738532456ff | a45b77cace6948157ac9dc228c6b2ae36f1ca841 | nesyuk/mit-6006 | /greedy_ascent_2d.go | Go | go | 1,457 | no_license | package main
import (
"fmt"
)
// finds a peak in a row
func findRowGlobalMax(arr []int, idx int) (int, error) {
if len(arr) == 0 {
return 0, fmt.Errorf("row is empty")
}
if idx > 0 && arr[idx] < arr[idx-1] {
newLeft := idx / 2
return findRowGlobalMax(arr, newLeft)
} else if idx < len(arr)-1 && arr[idx] ... |
60ebfad0c2f60282f008d7975ec7efc7968d27c0 | bf1e60f3210d39aedba36b79158eb79031bdc014 | AlcEccentric/golang-web-dev | /018_understanding-net-http-ServeMux/03_DefaultServeMux/main.go | Go | go | 661 | no_license | package main
import (
"io"
"net/http"
)
type hotdog int
func (d hotdog) ServeHTTP(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, "dog dog dog")
}
type hotcat int
func (c hotcat) ServeHTTP(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, "cat cat cat")
}
func main() {
var d... |
39fe3377f3dbc93ff93cd6c1ebe7e4f235779c88 | 7a12f20443aae92f3ba7e5b147e4ec809f4258d7 | cafra/protoc-gen-cuckoo | /vendor/github.com/carolove/cuckoo/examples/raft/client/rpcclient_test.go | Go | go | 442 | permissive | package main
import (
"testing"
"github.com/carolove/cuckoo"
"github.com/carolove/cuckoo/model"
"github.com/cuigh/auxo/test/assert"
)
func TestGetAllClient(t *testing.T) {
client, _ := cuckoo.GetRPCClient("127.0.0.1:9090")
assert.NotEmpty(t, client)
req := &model.RequestVoteRequest{}
req.Vote = "hello"
resp... |
83eb58e48ec8c4d4b0a3102fc151779c9749fc57 | 0df718ac23ce716f17ee318556fdb6fa5943d04d | kimmking/vitess | /go/vt/wrangler/vexec.go | Go | go | 12,939 | permissive | /*
Copyright 2020 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... |
c74726cafa993556b6060043b1ad70ac380d5c3d | da93335ac8a75a5464f38242ef89084c83f9a8d8 | zendea/zendea | /api/util/errors.go | Go | go | 952 | permissive | package util
import (
"strconv"
)
var (
ErrorNotLogin = NewError(1, "请先登录")
ErrorTopicNotFound = NewError(-1, "话题不存在")
ErrorArticleNotFound = NewError(-2, "文章不存在")
ErrorTagNotFound = NewError(-3, "标签不存在")
ErrorCaptchaWrong = NewError(1000, "验证码错误")
ErrorPermissionDenied = NewError(-100, "P... |
b46e469b971347903becad0a57b0a9c76361d6d6 | 4deb3b42a692499348ea783e4b297bb274422a03 | sgtest/monorepo-test-3 | /kubernetes-2/federation/pkg/dnsprovider/providers/google/clouddns/internal/rrsets_service.go | Go | go | 1,546 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
2dda0fe61d1d43c0ae3cc16a87dde28523e48d81 | ca8f66f1885897f50b956cf28596507281cb1065 | hwedwin/makross | /route_test.go | Go | go | 7,091 | permissive | // Package makross is a high productive and modular web framework in Golang.
package makross
import (
"bytes"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
type mockStore struct {
*store
data map[string]interface{}
}
func newMockStore() *mockStore {
return &mockStore{newStore(), make(map[string]int... |
5911312fe510eaa22ce5a26974ac6b7dea416ad7 | d2243d753411ce599f36d3d624b885b72d53eeab | lamnhh/qoj | /server/src/queue/queue.go | Go | go | 699 | permissive | package queue
import (
"os"
"strconv"
)
type Task struct {
Run func(chan interface{}, interface{})
ResultChannel chan interface{}
Params interface{}
}
var queue chan Task
func worker() {
for task := range queue {
task.Run(task.ResultChannel, task.Params)
}
}
func Push(task Task) {
queue ... |
695ffc9f41b4ab4755e383b1fe4f81fba6380cab | ba0066edf17bd115667b207128adb1a3026dc421 | isabella232/go-configtypes | /errors.go | Go | go | 1,304 | permissive | package configtypes
import (
"errors"
)
// Error is a type tag for all errors returned by this package.
type Error error
func errBoolFormat() Error {
return errors.New("not a valid boolean value (must be true/false, yes/no, or 0/1)")
}
func errDurationFormat() Error {
return errors.New(
`not a valid duration (... |
8c48e75e5c7453368d34b3376a82861eb5cdb53d | 4a53551e57baf64112f2d0882b3ed344b8efad73 | wocai/osinstall | /osinstall-server/src/server/osinstallserver/route/manufacturer.go | Go | go | 26,265 | permissive | package route
import (
"encoding/json"
"fmt"
"github.com/AlexanderChen1989/go-json-rest/rest"
"github.com/qiniu/iconv"
"golang.org/x/net/context"
"middleware"
"regexp"
"strconv"
"strings"
"utils"
)
func GetScanDeviceList(ctx context.Context, w rest.ResponseWriter, r *rest.Request) {
repo, ok := middleware.... |
b11b50c515632bf14637135f6321e30738d559a4 | 5fce102ccb0421ffde2c3d0a8d93ae39b1357aee | mlhoyt/clair | /config/notifier.go | Go | go | 3,366 | permissive | package config
import (
"fmt"
"time"
"github.com/quay/clair/v4/notifier/amqp"
"github.com/quay/clair/v4/notifier/stomp"
"github.com/quay/clair/v4/notifier/webhook"
)
// Notifier provides Clair Notifier node configuration
type Notifier struct {
// A Postgres connection string.
//
// Formats:
// url: "postgre... |
6c2aeb39e636e8ec6f8e6e443d5daa1f13a1f920 | 9fc9f2f29ac1de4f6ba94fef573f36e7a315b1eb | stevesloka/cluster-api-provider-aws | /pkg/apis/awsprovider/v1alpha1/awsclusterproviderconfig_types.go | Go | go | 1,579 | permissive | /*
Copyright 2018 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, ... |
10bb70acc3070f94032521441635c69725f169a8 | 93dffab769e31e685d17fa1994bba1699b278d6f | tomonari-t/golang-bootcamp | /ch02/ex01/conv.go | Go | go | 372 | no_license | package tempconv
// 摂氏の温度を華氏へ変換します
func CToF(c Celsius) Fahrenherit {
return Fahrenherit(c*9/5 + 32)
}
// 華氏の温度を摂氏へ変換します
func FToC(f Fahrenherit) Celsius {
return Celsius((f - 32) * 5 / 9)
}
func CToK(c Celsius) Kelvin {
return Kelvin(c + 273.15)
}
func KToC(k Kelvin) Celsius {
return Celsius(k - 273.15)
}
|
e1fcf20b21cd0a4ab231b5ddb916586965abfdd8 | ef7159e83c77e2f60ccdc86c717b88914edbd3ce | zetaab/fluent-bit-go-cloudwatch-logs | /out_cloudwatch_logs_test.go | Go | go | 6,234 | permissive | package main
import (
"encoding/json"
"testing"
"time"
"unsafe"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"github.com/fluent/fluent-bit-go/output"
"github.com/stretchr/testify/assert"
)
func TestCreateJSON(t *testing.T) {
record := make(map[interface{}]in... |
4c1e259a35b6045e636daf694c088899a42ffa7b | 6dc13b2617ff428ec95881dbc8761116efc8ac7b | frankieky888/free5gc | /lib/openapi/Namf_Communication/api_n1_n2_subscriptions_collection_for_individual_ue_contexts_document.go | Go | go | 5,973 | permissive | /*
* Namf_Communication
*
* AMF Communication Service
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package Namf_Communication
import (
"context"
"fmt"
"free5gc/lib/openapi"
"free5gc/lib/openapi/models"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
// Ling... |
f25514e291a57b951eab29478a5b5880bd8f631c | 95e3e57165f78fa55f03ec2b4717dc89517f64e1 | ruiaylin/sqlparsers | /pkg/mysql/sqltypes/bind_variables.go | Go | go | 8,005 | no_license | /*
Copyright 2017 Google Inc.
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, software
dis... |
428fae61fd0234fb02add85a3266fb8541a68d6e | f2cf52aa5f6157f2679e9a14b4caf642362c008d | isgasho/rpgsnack-runtime | /internal/game/requester_file.go | Go | go | 5,732 | permissive | // Copyright 2016 Hajime Hoshi
//
// 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... |
09e01c45d8011c46a0f0d3d510db51da66c71713 | 3d9fb67b3355ae6103700cd44548e6638931367f | cli/cli | /pkg/search/result_test.go | Go | go | 5,807 | permissive | package search
import (
"bytes"
"encoding/json"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCodeExportData(t *testing.T) {
tests := []struct {
name string
fields []string
code Code
output string
}{
{
name: "exports reque... |
087c8487b90040aac3d14bf642f6568ef36f5ab2 | c579e62cbb89e2382b608b51271281257bcd65ad | echobygo/wq-fotune-backend | /service/grid-strategy-srv/util/huobi/pkg/response/market/subscribemarketbypriceresponse.go | Go | go | 478 | no_license | package market
import (
"github.com/shopspring/decimal"
"wq-fotune-backend/service/grid-strategy-srv/util/huobi/pkg/response/base"
)
type SubscribeMarketByPriceResponse struct {
base.WebSocketResponseBase
Tick *MarketByPrice
Data *MarketByPrice
}
type MarketByPrice struct {
SeqNum int64 `jso... |
b4dd054db0b933d7ffd51261072e6b3b3fcb0a4e | 202cd81fd5da5e836ab5d97b6534edaeb531bc51 | brunohgv/go-patterns | /behavioral/chain_of_responsibility/main.go | Go | go | 1,748 | permissive | package main
import "fmt"
type task interface {
execute()
setNext(task)
}
type turnOnLights struct {
next task
}
func (turnOnLights *turnOnLights) execute() {
fmt.Println("Turning the lights on...")
if turnOnLights.next != nil {
turnOnLights.next.execute()
}
}
func (turnOnLights *turnOn... |
db0487a8b8792c62b415c2af1010dfa000683a02 | e15f5c07ef9a24b597ca75fbfde3b73dce98dba8 | Gasorey/FullCycle | /domain/credit_card.go | Go | go | 477 | no_license | package domain
import (
"time"
uuid "github.com/satori/go.uuid"
)
type CreditCard struct {
ID string
Name string
Number string
ExpirationMonth int64
ExpirationYear int64
CVV int64
Balance float64
Limit float64
CreatedAt time.Time
}
fun... |
6601748e3bfbf323b53037b7df75a6702707ba4e | ee959d6008b50dfb059fe8fb8e51b6c7e38787a0 | ananduee/raker | /data/song.go | Go | go | 229 | no_license | package data
// Song represents a real world song.
type Song struct {
ID string
Title string
Album string
}
// Playlist is ranked list of songs.
type Playlist struct {
Provider string
Type string
Songs []Song
}
|
783dac8bc9a52860ddbd524037c104d0d1f4f534 | 901a95c088538e1b7813d15cfe765c364ee2cdaa | skycoin/skycoin-exchange | /_vendor-20171101171736/github.com/corpusc/viscript/msg/const_mouse.go | Go | go | 1,385 | no_license | package msg
type Action uint32 // "int" in go-gl docs
const (
Release Action = 0
Press Action = 1
Repeat Action = 2 // fired at regular intervals while key is held down
)
/*
original versions
*/
const (
GLFW_MOUSE_BUTTON_1 = 0
GLFW_MOUSE_BUTTON_2 = 1
GLFW_MOUSE_BUTTON_3 = 2
GLFW_MOUSE_BU... |
cfb6fef3ad1d006bffa17786c8ad580127f5973f | 3ce500cf93a6a3dba2956915b2247ac8268f15ba | Shambuwu/google-api-go-client | /abusiveexperiencereport/v1/abusiveexperiencereport-gen.go | Go | go | 17,387 | permissive | // Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package abusiveexperiencereport provides access to the Abusive Experience Report API.
//
// For product documentation, see: https://developers.g... |
28c1f8c07ea17c7b6fe7f24ac7ebe797b745b6e9 | 32603f4500a7e609e476ee3836983bc22db48980 | jasonrpowers/engi | /desktop.go | Go | go | 13,125 | permissive | // Copyright 2014 Joseph Hager. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !netgo,!android
package engi
import (
"github.com/errcw/glow/gl/2.1/gl"
glfw "github.com/go-gl/glfw3"
"image"
"image/draw"
_ "image/png"
"io"
"... |
7451333ed1eb55ccfb08d9c591004cdf20c14ae9 | d8ab817d46419a646c46908757f04fd7fbdb6c07 | suhyunjeon/esdiff | /elastic/v5/client.go | Go | go | 3,517 | permissive | package v5
import (
"context"
"encoding/json"
"io"
"log"
"os"
"github.com/pkg/errors"
elasticv5 "gopkg.in/olivere/elastic.v5"
"github.com/olivere/esdiff/diff"
"github.com/olivere/esdiff/elastic"
"github.com/olivere/esdiff/elastic/config"
)
// Client implements an Elasticsearch 5.x client.
type Client stru... |
41cf5894833b3bd3aef12a0c2cfe7b4cb1dacea5 | e76cf66477037e327bbde2e635bfa9af6e82809d | mswdwk/tidb | /executor/analyzetest/analyze_test.go | Go | go | 148,198 | permissive | // Copyright 2018 PingCAP, Inc.
//
// 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... |
51adea05e71879e443bad3ab746f3433abbf7e22 | 204adb56b0afad97d6139e44c3daedafabcfabeb | nfv-aws/wcafe-api-controller | /entity/users.go | Go | go | 2,012 | no_license | package entity
import (
"time"
"github.com/jinzhu/gorm"
"github.com/rs/zerolog/log"
"gopkg.in/go-playground/validator.v9"
)
type User struct {
// ユーザの識別子
Id string `gorm:"type:varchar(255)" json:"id"`
// 会員番号
Number int32 `gorm:"type:int(32) AUTO_INCREMENT;NOT NULL;unique" json:"number" binding:"required"... |
44582034d04ac3cfad4837eddbec64bdea85daa6 | 80186f7a96f24e98d128d3602485da07b02013e2 | EndlessCheng/codeforces-go | /main/1-99/75C_test.go | Go | go | 265 | permissive | package main
import (
"github.com/EndlessCheng/codeforces-go/main/testutil"
"testing"
)
func TestCF75C(t *testing.T) {
// just copy from website
rawText := `
inputCopy
9 27
3
1 5
10 11
9 11
outputCopy
3
-1
9`
testutil.AssertEqualCase(t, rawText, 0, CF75C)
}
|
a6ebbdf6dac7f23f90f2818eeb3f5fbf4515c9cf | c78dfc5c4947a301fee3e61b847478124b73823b | MatousJobanek/fabric8-notification | /collector/workitem_test.go | Go | go | 3,500 | permissive | package collector_test
import (
"context"
"strings"
"testing"
"github.com/fabric8-services/fabric8-notification/auth"
authApi "github.com/fabric8-services/fabric8-notification/auth/api"
"github.com/fabric8-services/fabric8-notification/collector"
"github.com/fabric8-services/fabric8-notification/testsupport"
... |
159c2824da2e5611cdc93308ee040be4e939bdde | f26d6ea8fd3262b953e29609e6542774235d43e7 | ahlfors/kiosk | /pkg/manager/webhooks/register.go | Go | go | 1,746 | permissive | /*
Copyright 2020 DevSpace Technologies Inc.
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 writin... |
c3f58d95f888fa39eb4274e0d5bca650fc8645c9 | 57b94b82d63dd22a30178ccaf0fca10b2e862f5b | Tyonar/haul | /cmd/assembly_add.go | Go | go | 1,817 | permissive | /*
Copyright © 2021 The Haul Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, ... |
12bf000b1fddbb42481e320b0910e383cecd5aac | 2797b83f7f51e323ec09d979ed104d0a54fc8715 | miseyu/rclone | /cmd/sync/sync.go | Go | go | 1,390 | permissive | package sync
import (
"github.com/miseyu/rclone/cmd"
"github.com/miseyu/rclone/fs"
"github.com/spf13/cobra"
)
func init() {
cmd.Root.AddCommand(commandDefintion)
}
var commandDefintion = &cobra.Command{
Use: "sync source:path dest:path",
Short: `Make source and dest identical, modifying destination only.`,
... |
6fd78a31d7f90bcaba8bae6c81350404be9fe37d | 4e4fcf5c50648652d5de833762a81a3c2425b33c | akramchelong/CypressReport | /internal/util/rsa_test.go | Go | go | 1,000 | no_license | package util_test
import (
"io/ioutil"
"os"
"testing"
"gitlab.se.axis.com/e2e/iam/onprem/oidc-win/internal/util"
)
func TestGetPrivateKeysNotExist(t *testing.T) {
dir, _ := ioutil.TempDir("", "")
defer os.RemoveAll(dir)
priv, err := util.GetPrivateKeys(dir)
if err != nil {
t.Errorf("Expect... |
a9a88cbddcca734af981d13109f8d70f7448e398 | 8ae156b5d7841a32e6fc940e2fd55145d4edcd74 | yixiuqi/xqdfs | /src/xqdfs/master/configure/defines/storage_dal.go | Go | go | 364 | no_license | package defines
import (
"encoding/json"
)
type StorageDal struct {
Id int32 `json:"id"`
Addr string `json:"addr"`
Desc string `json:"desc,omitempty"`
}
func NewStorageDal() *StorageDal {
s:=new(StorageDal)
return s
}
func (this *StorageDal) String() string {
data,err:=json.Marshal(this)
if err!=nil {
... |
7cd741c78aa1e9e6c537338c70f9851378f73409 | 2bf76d1f681682025f2c386a82596068e1426bd4 | Destinia/imageserver | /source/http/http_benchmark_test.go | Go | go | 863 | permissive | package http
import (
"testing"
"github.com/Destinia/imageserver"
imageserver_source "github.com/Destinia/imageserver/source"
"github.com/Destinia/imageserver/testdata"
)
func BenchmarkServerGet(b *testing.B) {
httpSrv := createTestHTTPServer()
defer httpSrv.Close()
srv := &Server{}
for _, tc := range []stru... |
118f6245f191362e16c26f830d609d5a4a5797d9 | cc7a7e823468d3411353f9ec135d139779245861 | cheneylew/beego_api | /tests/default_test.go | Go | go | 973 | no_license | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "github.com/cheneylew/beego_api/routers"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(1)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Joi... |
f779293e73e6fc3d577b46c43ba979350972ccee | 78d563673b6fc779e82cd5b3276ceca1934969e3 | hpuscg/temp | /GoModelTest/haomuF/getPicture/getPicture.go | Go | go | 1,446 | no_license | /*
#Time : 2020/9/23 11:09 上午
#Author : chuangangshen@deepglint.com
#File : getPicture.go
#Software : GoLand
*/
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"reflect"
"time"
)
func main() {
GetFrame()
}
const (
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2... |
3cf924bc9b3d6d78a4c80ebafe96837af5e5762c | 6e55a1f40a8c844684bf5af302a78400610b1cac | vishal380/hacktoberfest | /internal/config/config.go | Go | go | 1,312 | permissive | package config
import (
"io/ioutil"
"regexp"
"github.com/depscloud/api/v1alpha/schema"
"github.com/ghodss/yaml"
)
// Config represents the structure of a config file
type Config struct {
CompanyPatterns []string `json:"company_patterns"`
CompanyPatternsRegex []*regexp.Regexp
}
// IsCompanyModule determi... |
202078bd596797d06995b3e11d7624f48320d901 | a16f3a0336428a619f9e4333394a8742fb7a4a69 | IstrateM/go-kubernetes | /pkg/apis/nsmd_k8s/v1/types.go | Go | go | 2,633 | no_license | package v1
import metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
type State string
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type NetworkService struct {
metaV1.TypeMeta `json:",inline"`
metaV1.ObjectMeta `json:"metadata,omitempty"`
Spec Netwo... |
c508b12b42dd1aa7b76328eb06fb25303b5650b4 | c3870fdbef3511efdc331d3b8bc2b98291568a84 | sudeepgoyal75/terraform-provider-nuagenetworks | /4.0.10/nuagenetworks/data_source_nuagenetworks_licensestatus.go | Go | go | 6,379 | no_license | package nuagenetworks
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/4.0.10"
"github.com/nuagenetworks/go-bambou/bambou"
)
func dataSourceLicenseStatus() *schema.Resource {
return &schema.Resource{
Read: dataSourceLicenseStatusRead,
... |
1de5dfe7e5c2b1498a4ece258c1a1ab0c262a544 | d176d5f5c52fa18de0642967fc471eee4a035ba7 | tokend/janus | /vendor/github.com/globalsign/mgo/example_test.go | Go | go | 4,715 | permissive | package mgo
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net"
"sync"
)
func ExampleCredential_x509Authentication() {
// MongoDB follows RFC2253 for the ordering of the DN - if the order is
// incorrect when creating the user in Mongo, the client will not be able to
// connect.
//
// The best way to gene... |
2a273d9fba41e0a7f7888a8999e79ecb78837671 | fb106f6ef544ca96a25f47b3722978c9eb88e4a9 | jupierce/cluster-api-provider-aws | /pkg/termination/handler_test.go | Go | go | 9,834 | permissive | /*
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, software... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.