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 |
|---|---|---|---|---|---|---|---|---|
dae632e5c96ce46cba25bc9027e922a3ebbb4d94 | 113f17578214e11f23e968f9600f6a80def8f6df | rikewang/yig-iam | /vendor/gopkg.in/iris-contrib/websocket.v4/server.go | Go | go | 11,564 | permissive | package websocket
import (
"net"
"strings"
"time"
"github.com/valyala/fasthttp"
"gopkg.in/kataras/go-websocket.v0"
)
//taken from net/http
const (
StatusContinue = 100
StatusSwitchingProtocols = 101
StatusOK = 200
StatusCreated = 201
StatusAccepted = 20... |
131d4c3840507e63212d5477e8bfb964f5ad4d68 | 16f3b0662591cf2291ec7bf5fb41648b971f4138 | brancz/thanos | /cmd/thanos/sidecar.go | Go | go | 10,829 | permissive | package main
import (
"context"
"encoding/json"
"math"
"net"
"net/http"
"net/url"
"path"
"sync"
"time"
"cloud.google.com/go/storage"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/improbable-eng/thanos/pkg/cluster"
"github.com/improbable-eng/thanos/pkg/objstore"
"github.com/i... |
0b4b40acf03b85e1d937406c521d7856cfffbaf3 | 0de5c55506f12e621703dcbadaeeff9997d29f91 | Auenc/simple-rest | /repositories/JobRepository.go | Go | go | 270 | no_license | package repositories
import (
"github.com/auenc/simple-rest/models"
)
type JobRepository interface {
Get(id string) (models.Job, error)
GetAll() ([]models.Job, error)
Create(job models.Job) error
Update(id string, job models.Job) error
Delete(id string) error
}
|
0a49438816418f98ce8b5d9cad9a749dc929c211 | 0e210d363dc6ba7e80325200bd1d1de631f47b4a | aravindhp/ovn-kubernetes | /go-controller/pkg/types/const.go | Go | go | 4,890 | permissive | package types
import "time"
const (
K8sPrefix = "k8s-"
HybridOverlayPrefix = "int-"
// K8sMgmtIntfName name to be used as an OVS internal port on the node
K8sMgmtIntfName = "ovn-k8s-mp0"
// PhysicalNetworkName is the name that maps to an OVS bridge that provides
// access to physical/external network... |
415eabbed74bd88ab095f6663199d57ef3c26db9 | dd03a54554d7a5ff0ff8e5c77c1af4366273781c | dmpingfan/go-agenda | /cli/cmd/logout.go | Go | go | 1,965 | permissive | // Copyright © 2017 NAME HERE <EMAIL ADDRESS>
//
// 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 ... |
f7e5631ae880b84791bdd1ac918f763d1f41639c | 3b2f9730962057ea54211719720b0973a89cb552 | 201341/matrixcube | /components/prophet/member/member.go | Go | go | 5,140 | permissive | // Copyright 2020 PingCAP, Inc.
// Modifications copyright (C) 2021 MatrixOrigin.
//
// 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
//
/... |
ab9678f468c2993578168b3dd5363a7e15db8e93 | 14b5d5b53f4d4b4340830a55915c08b6b98d0497 | Subhash-AWS/meshery | /mesheryctl/internal/cli/root/system/config.go | Go | go | 8,093 | permissive | // Copyright 2020 Layer5, 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... |
369c2c99cccb5c0d1e9d9df3b4b5e162d4be8241 | aaa5097c9901b14bec07772ef864a04dd2d4fbe6 | ymotongpoo/restroom | /golang/src/d2p/main.go | Go | go | 2,549 | permissive | package main
import (
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
"gopkg.in/xmlpath.v2"
)
var (
atag = xmlpath.MustCompile("//dt/a")
href = xmlpath.MustCompile("./@href")
tags = xmlpath.MustCompile("./@tags")
added = xmlpath.MustCompile("./@add_date")
)
// Diigo is a struct to hold each entries informat... |
cf961b7f6ec4b7c579750142803ad9e551b92d93 | d71b76ec0ec824484860465c0b5c6ae47d9d2b02 | pzhin/kdbgo | /decode_test.go | Go | go | 13,829 | permissive | package kdb
import (
"bufio"
"bytes"
"fmt"
"testing"
"time"
"github.com/nu7hatch/gouuid"
)
// 0b
var BoolBytes = []byte{0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xff, 0x00}
func TestBool(t *testing.T) {
b := BoolBytes
r := bufio.NewReader(bytes.NewReader(b))
d, _, err := Decode(r)
if err != nil {
... |
5f06eb06360f03b5efa20e8079e2d489faf4d7bb | e61c593740871de87a9559182cb54a50d93eee9e | tuifer/tuifei | /extractors/haokan/haokan_test.go | Go | go | 617 | no_license | package haokan
import (
"testing"
"github.com/tuifer/tuifei/extractors/types"
"github.com/tuifer/tuifei/test"
)
func TestDownload(t *testing.T) {
tests := []struct {
name string
args test.Args
}{
{
name: "normal test",
args: test.Args{
URL: "https://haokan.baidu.com/v?vid=10057409468467026969"... |
ff59f5ee5fe48993f6fe44ffd47c34108a9bf7e5 | f4babf8ef93eb4367dab248c0bae2c1f3f232932 | zaKuDER/lotus | /chain/vm/mkactor.go | Go | go | 4,292 | permissive | package vm
import (
"context"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build"
//Ability to leave multiple groups.
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/lotus/chain/acto... |
c1fc0f516e3f7b51b1fa01d454a916d3f01cbc31 | d10f08b83c47e5a7f30e837e461d84e87f1f5754 | tfriedel6/goovr | /util_windows.go | Go | go | 8,997 | no_license | package goovr
// #include "OVR_CAPI_Util.h"
import "C"
/// Enumerates modifications to the projection matrix based on the application's needs.
///
/// \see ovrMatrix4f_Projection
type ProjectionModifier int32
const (
/// Use for generating a default projection matrix that is:
/// * Right-handed.
/// * Near depth ... |
7288ec9eabb2307af0687b4a5e5780f699a84e8b | d0f49e17f59091c9e1fb144b153ccffe16d6764d | mdnix/roundrobin | /roundrobin_test.go | Go | go | 1,508 | permissive | package roundrobin_test
import (
"reflect"
"testing"
"github.com/mdnix/roundrobin"
)
func TestNewService(t *testing.T) {
var tests = []struct {
addresses []string
expected []string
err bool
}{
{
addresses: []string{
"192.168.1.1:4444",
"192.168.1.2:4444",
"192.168.1.3:4444",
},... |
dac54f5c54c35ee05553c87f0bfe0d5bc5749d38 | fdee8a1769e72b095f751e43374bd55e65e0b026 | deyuhua/delve | /pkg/proc/gdbserial/gdbserver.go | Go | go | 54,554 | permissive | // This file and its companion gdbserver_conn implement a target.Interface
// backed by a connection to a debugger speaking the "Gdb Remote Serial
// Protocol".
//
// The "Gdb Remote Serial Protocol" is a low level debugging protocol
// originally designed so that gdb could be used to debug programs running
// in embed... |
0ebf4d687846a7409cb2fd5446632435d07c6e4a | 834d3cec4bccc99f6ef098ed706ca17c6b8663d5 | 161090123WFL/iotex-core | /cli/ioctl/cmd/action/action.go | Go | go | 5,312 | permissive | // Copyright (c) 2019 IoTeX
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the cod... |
fbd01fd161556dbf9d38285a4b7e39ff1ac822f3 | 82f250aecf835f77e63186ec7a07b33749dab3ea | Azure/azure-service-operator | /v2/tools/generator/internal/astmodel/type_walker.go | Go | go | 6,939 | permissive | /*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT license.
*/
package astmodel
import (
"fmt"
"github.com/pkg/errors"
)
// TODO: This is conceptually kinda close to ReferenceGraph except more powerful. We may be able to refactor ReferenceGraph to use this
// typeWalkerRemoveType is a special ... |
c84190510918a670463617685c39385a57c7a148 | f322036f40d7d6548249a1b77b782468d2ec28e4 | huaweicloud/huaweicloud-sdk-go-v3 | /services/as/v1/model/model_list_scaling_activity_v2_logs_response.go | Go | go | 848 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ListScalingActivityV2LogsResponse Response Object
type ListScalingActivityV2LogsResponse struct {
// 总记录数。
TotalNumber *int32 `json:"total_number,omitempty"`
// 查询的其实行号。
StartNumber *int32 `json:"start_number,omit... |
84343b8b240b176e52ab65bfa5d54af90178c841 | 35ea4e761244a308c0e0d39a867c2622e7d62f4b | aandryashin/util | /sse/sse.go | Go | go | 2,465 | permissive | package sse
import (
"fmt"
"log"
"net/http"
"sync"
"time"
)
// the amount of time to wait when pushing a message to
// a slow client or a client that closed after `range clients` started.
const patience = 1 * time.Second
type Broker interface {
http.Handler
Notify(data []byte)
HasClients() bool
}
type SseBr... |
8774adb4c7c026ba73750c6f6164f51b437a2e21 | 85b7578eb92bc1ce5d04fba8bd84dd35d112fac4 | evankanderson/serving | /pkg/apis/autoscaling/annotation_validation_test.go | Go | go | 16,002 | 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... |
844ca66c85820a3e3275736e8c8cb58a98117498 | d6e89f0e17ed41d06d8d15b89e4ee7f9cd0096d7 | eliasbosco/altran-golang-ClientAPI | /ports/types/ports.go | Go | go | 549 | no_license | package types
//Ports main object key
type Ports map[string]PortsBody
//PortsBody all the properties related to port
type PortsBody struct {
Name string `json:"name"`
City string `json:"city"`
Country string `json:"country"`
Alias []string `json:"alias"`
Regions []string `j... |
a5f9ebb2276ee281faaaf80277514f021b3d16c2 | 2550225f8b7a70f02c074fbc6a38d7a434643d24 | ninoude/bookstore_users-api | /domain/users/user_dao.go | Go | go | 4,074 | no_license | package users
import (
"fmt"
"github.com/ninoude/bookstore_users-api/datasources/mysql/users_db"
"github.com/ninoude/bookstore_users-api/logger"
"github.com/ninoude/bookstore_users-api/utils/errors"
)
var (
usersDB = make(map[int64]*User)
)
const (
queryInsertUser = "INSERT INTO users(first_name, last_n... |
dcdfd6094494f19a13bd72cc9e1433c2cdb68d85 | df67f188940abb56283f8b71214352099c1db218 | gnomix/linkerd2 | /cli/cmd/profile_test.go | Go | go | 5,989 | permissive | package cmd
import (
"bytes"
"errors"
"fmt"
"testing"
"github.com/ghodss/yaml"
"github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha1"
"github.com/linkerd/linkerd2/pkg/profiles"
)
func TestParseProfile(t *testing.T) {
var buf bytes.Buffer
err := profiles.RenderProfileTemplate("myns", "mys... |
c20e65e690e7a9f7683039e387ee2eb8eebcc707 | 97fd55653c7158eca454a5139c1da351258accef | sougou/vitess | /go/vt/throttler/max_replication_lag_module.go | Go | go | 30,439 | permissive | /*
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... |
1c9996e241a8aeea15a563c29fe6f8b2f9d411bf | 3ab7bdbd744944ea47143c25a1013fa27ab3c4e4 | satish77/kv | /kv.go | Go | go | 21,213 | permissive | // Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package kv
import (
"encoding/binary"
"fmt"
"io"
"os"
"os/signal"
"sync"
"time"
"github.com/cznic/bufs"
"github.com/cznic/exp/lldb"
"github.com/czni... |
6ad264dbafa4985526345d97bdd900808554dd41 | e0d41ace537da2adec1b01bf41b4326d4371a6ca | imgload/simple-torrent | /engine/config.go | Go | go | 5,981 | permissive | package engine
import (
"errors"
"fmt"
"log"
"os"
"path/filepath"
"reflect"
"strings"
"github.com/c2h5oh/datasize"
"github.com/spf13/viper"
"golang.org/x/time/rate"
)
const (
ForbidRuntimeChange uint8 = 1 << iota
NeedEngineReConfig
NeedRestartWatch
NeedUpdateTracker
)
const (
defaultTrackerListURL = ... |
b11e7c73570309e4551828f3cdc4ca468ce87466 | f31acfb02569c51a3d67b09eb60eb08e9f99f209 | miaversa/backend | /cart/cart_test.go | Go | go | 1,334 | permissive | package cart_test
import (
"testing"
"github.com/miaversa/backend/cart"
"github.com/miaversa/backend/product"
"github.com/miaversa/backend/uuid"
)
func TestCart(t *testing.T) {
cid := uuid.New()
c := cart.New(cid)
if c.Products == nil {
t.Fatal("lista de produtos não inicializada")
}
if 0 != c.Total() {
... |
6a1a75e057560495e7b90a6d54bad729e0d528c1 | b319026d9cfe3b02d395e55a3955c4b6bd4f32ca | OlegGibadulin/2020_2_Slash | /internal/season/delivery/season_handler_test.go | Go | go | 6,838 | no_license | package delivery
import (
"github.com/go-park-mail-ru/2020_2_Slash/internal/models"
"github.com/go-park-mail-ru/2020_2_Slash/internal/season"
"github.com/go-park-mail-ru/2020_2_Slash/internal/season/mocks"
"github.com/go-park-mail-ru/2020_2_Slash/pkg/converter"
"github.com/go-park-mail-ru/2020_2_Slash/tools/logge... |
78ac67d18b458ac163a1e365457e8b8e1abb4996 | 8673b77063bbc16ec847142361cfe946d7b3b6e9 | mfaiqrofifi/FinalProject | /main.go | Go | go | 2,861 | no_license | package main
import (
"log"
"social_media/app/routes"
_middleware "social_media/app/routes/middleware"
_userdeteilstatus "social_media/business/users/statusdesc"
_userUsecaseRegister "social_media/business/users/userRegister"
_userUsecaseStatus "social_media/business/users/userStatus"
_usercontrollerdeteil "soc... |
f79a8bf801016a11b6e09e15c0482f2220e330b4 | 4d7afad0ad3fbc7f5bcd4dbfbde65d1dc190f96a | erenming/leetcode-go | /divideAndConquer/maxSubArray/maxSubArray_test.go | Go | go | 516 | no_license | package maxSubArray
import (
"math"
"testing"
)
func Test_maxSubArray(t *testing.T) {
type args struct {
nums []int
}
tests := []struct {
name string
args args
want int
}{
{"t-1", args{[]int{-2,1,-3,4,-1,2,1,-5,4}}, 6},
{"t-2", args{[]int{-1}}, -1},
{"t-3", args{[]int{}}, int(math.MinInt64)},
}
... |
600f990ac6212e6404f2d2e3359e109c31a048b1 | 3fb13a562339060394a57e50b069ce38c8959a92 | afif0808/fifentory | /skuout/repository/sql/skuoutsqlrepo.go | Go | go | 4,424 | no_license | package skuoutsqlrepo
import (
"context"
"database/sql"
"errors"
"fifentory/options"
"fifentory/skuout"
skuoutrepo "fifentory/skuout/repository"
"log"
)
const (
skutOutTable = "sku_out"
skuOutFields = "id,quantity,date,sku_id,sku_out_group_id"
createSKUOutQuery = "INSERT... |
f136b311c9634e355115e1b63840bc90027d8bfb | c9a21e81b201112480400cf6fbd43c65f9bf42e2 | vikashvverma/greeter | /job/job.go | Go | go | 2,393 | permissive | package job
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"html/template"
"io/ioutil"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"github.com/vikashvverma/greeter/config"
"github.com/vikashvverma/greeter/person"
)
type Greeter interface {
Greet() []error
}
type gre... |
2a835bdb8b9bbbabacacfa025ee3833aa6b80dfa | c0d6b00b90003f561c4d7465bf1e4c9dc1b945db | zale144/goinsta | /examples/activity/following.go | Go | go | 365 | permissive | // +build ignore
package activity
import (
"fmt"
e "gopkg.in/ahmdrz/goinsta.v1/examples"
)
func main() {
inst, err := e.InitGoinsta("")
e.CheckErr(err)
act := inst.Activity.Following()
e.CheckErr(err)
for act.Next() {
fmt.Printf("Stories: %d %d\n", len(act.Stories), act.NextID)
}
if !e.UsingSession {
... |
5e5c86882e92472c998d16bc9f7762f68f6438e4 | 00d04b323cef25c5be72d43882443e991c8e6667 | markbest/grace-example | /grace-config/config/conf.go | Go | go | 577 | no_license | package g
import (
"fmt"
"path/filepath"
"sync"
"github.com/BurntSushi/toml"
)
var (
cfg *config
once sync.Once
cfgLock = new(sync.RWMutex)
)
func Config() *config {
once.Do(ReloadConfig)
cfgLock.RLock()
defer cfgLock.RUnlock()
return cfg
}
func ReloadConfig() {
filePath, err := filepath.Abs("conf.tom... |
dde0335cb3a98d5f4e8b65409dd98323ede5e521 | a60680f5cd4e414889214c0bedf20724f3079e39 | andrianj/cockroach | /internal/client/batch.go | Go | go | 17,451 | permissive | // Copyright 2015 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... |
530a73a850c4996b28654a35d52fee155ffa44d3 | 2f1aeb5738d145287f76def9006f01c05a201708 | AugustMader/D2D_Protocol | /model/metadataFactory.go | Go | go | 1,383 | permissive | package model
import (
"encoding/json"
"io/ioutil"
"log"
"math/rand"
"strconv"
"time"
agentlogic "github.com/skovsen/D2D_AgentLogic"
)
func loadMetadata(path string, isRand bool, randId int) agentlogic.Agent {
log.Println("loading metadata from: " + path)
agent := agentlogic.Agent{}
data, err := ioutil.Re... |
f2d7aa390473b23f84377a733a43452c07707615 | 742f582dfcf594c2b615625019c58792eee8cf29 | KashyakSupport/SimplystDream | /simplyst/config.go | Go | go | 307 | no_license | package simplyst
import (
"log"
"gopkg.in/mgo.v2"
)
// DB UserDatabase
var DB UserDatabase
func int() {
var err error
var cred *mgo.Credential
DB, err = newMongoDB("mongodb://kashyaksupport:kashyaksupport123@ds151973.mlab.com:51973/simplystdatabase", cred)
if err != nil {
log.Fatal(err)
}
}
|
bdee9eb996364b70dcb28326a1ea2327c24c775a | 190486717c617dd945d6a2b707f083e25c719fe2 | QO-Development/golangTraining | /chat/auth.go | Go | go | 2,786 | no_license | package main
import (
"errors"
"fmt"
"net/http"
"strings"
"github.com/stretchr/objx"
"github.com/stretchr/gomniauth"
)
type authHandler struct {
next http.Handler
}
func (h *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if cookie, err := r.Cookie("auth"); err == http.ErrNoCookie || cook... |
af4e2397de463c4fcd7528bf9608776c4349f3d1 | b2320941eda44842bfd175cc3d18e634c7574146 | vritxii/govirus | /server_test.go | Go | go | 1,908 | permissive | package ipfsapp
import (
"flag"
"fmt"
_ "github.com/coreos/etcd/client"
"github.com/rcrowley/go-metrics"
"github.com/smallnest/rpcx"
_ "github.com/smallnest/rpcx/log"
"github.com/smallnest/rpcx/plugin"
"testing"
"time"
)
type Args struct {
A int `msg:"a"`
B int `msg:"b"`
}
type Reply struct {
C int `msg:"... |
557ab0060340cc685ffe59871bc1970f6d11c97d | d96c882cb34026ae5c42859f8bcd6bb5b1fc0e2b | gjbae1212/go-limiter | /cache.go | Go | go | 884 | permissive | package limiter
import (
"context"
"time"
"github.com/go-redis/redis/v7"
"github.com/patrickmn/go-cache"
)
// Cache is an interface which supports fundamental functionality for storage.
// This is used by RateLimiter.
type Cache interface {
Get(key string) (interface{}, bool, error)
MGet(keys ...string) ([]int... |
e1ee81a6bd8318e3d56102cf11a909c4243edb44 | 2d493ee08d6cfe0bd7a66ef2817a705c004f32e0 | ornew/pipeline | /vendor/github.com/sigstore/sigstore/pkg/signature/kms/fake/signer.go | Go | go | 5,001 | permissive | // Copyright 2022 The Sigstore 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 agr... |
4c1ce9637fce573aae299f1385dc412bd383572f | 80df8ee081dcdc8b08069572b8903a6784770c7b | Global19-atlassian-net/gloo-plugins | /rest/transformation_test.go | Go | go | 16,040 | permissive | package rest_test
import (
envoyroute "github.com/envoyproxy/go-control-plane/envoy/api/v2/route"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/gogo/protobuf/types"
"github.com/solo-io/gloo-api/pkg/api/types/v1"
. "github.com/solo-io/gloo-plugins/rest"
"github.com/solo-io/gloo/pkg/plugin"
)... |
5dcb053cfe8e6aa333c160f807ae9ad95fba8bbf | fd2d0499836fce424ec5a369b5bfcc6fae9f6a48 | yuhang252525/eth-test | /openwtester/transaction_manager_test.go | Go | go | 5,396 | no_license | /*
* Copyright 2018 The openwallet Authors
* This file is part of the openwallet library.
*
* The openwallet library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License... |
da7ca389774c489c97487511730e70d6d7ef94f3 | 64d66cc132c5124f344131e0166e65455a3bac32 | devopstoday11/azure-application-insights | /helper/properties.go | Go | go | 1,464 | permissive | /*
* Copyright 2018-2020 the original author or 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 a... |
bc9eff4de9ef14f525853e46a87220ab427d29c4 | b650a957e1c3283d58d9ea1129ab527cbe68022f | OpenSentry/meui | /controllers/clients/clientdelete.go | Go | go | 6,028 | permissive | package clients
import (
"strings"
"net/http"
"github.com/sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/gorilla/csrf"
"github.com/gin-contrib/sessions"
idp "github.com/opensentry/idp/client"
"github.com/opensentry/meui/app"
"github.com/opensentry/meui/config"
"github.com/opensentry/meui/... |
27ea5cd84f03989b75566442187e9d7e61cc971b | 7e1aa6d108d7391b71321794bb1e8e1bd046fe94 | rikewang/yig | /vendor/github.com/journeymidnight/radoshttpd/rados/conn.go | Go | go | 7,929 | permissive | package rados
// #cgo LDFLAGS: -lrados
// #include <stdlib.h>
// #include <rados/librados.h>
import "C"
import "unsafe"
import "bytes"
// ClusterStat represents Ceph cluster statistics.
type ClusterStat struct {
Kb uint64
Kb_used uint64
Kb_avail uint64
Num_objects uint64
}
// Conn is a connection ha... |
ca93945de8a21de6acd198865dcd6117373d9a94 | fab5da8614b10a3122e1b3eba4e9db8279698228 | MH4GF/ecr-lifecycle | /ecr/client.go | Go | go | 899 | no_license | package ecr
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
)
// Client ... Store ECR client with a session
type Client struct {
ecr *ecr.ECR
}
// NewClient ... Create a ECR client with profile and region
func NewClient(awsProfile string, a... |
6177e46cb5e0d0797bca2038b057691eb6b2f31e | 5a5af8a2d880646acbe48f14e4941cf933711800 | jhutchings1/ld-find-code-refs | /build/package/github-actions/github-actions_test.go | Go | go | 1,188 | permissive | package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseBranch(t *testing.T) {
specs := []struct {
name string
in string
expectedOut string
expectError bool
}{
{
name: "succeeds for well formed input",
in: "refs/heads/a",
expectedOut... |
81824c6e116e25588fb8bcb0359d816b18f81c3d | 3744fa151a29bd845a0a1f37b48de665b6d91d25 | PinkDiamond1/tmcrawl | /db/db_test.go | Go | go | 2,067 | permissive | package db_test
import (
"fmt"
"testing"
"github.com/fissionlabsio/tmcrawl/db"
"github.com/stretchr/testify/require"
)
func TestGetSet(t *testing.T) {
bdb, err := db.NewBadgerMemDB()
require.NoError(t, err)
key, value := []byte("key"), []byte("value")
bz, err := bdb.Get(key)
require.Error(t, err)
require.... |
379575ba96e45eebdd83487f1bd292d2302aa454 | 541bab41bf4f23e206ce1ee24ea846b9f349aa4b | linearregression/photon-controller-cli | /photon/command/clusters_test.go | Go | go | 17,256 | permissive | // Copyright (c) 2016 VMware, Inc. All Rights Reserved.
//
// This product is licensed to you under the Apache License, Version 2.0 (the "License").
// You may not use this product except in compliance with the License.
//
// This product may include a number of subcomponents with separate copyright notices and
// lice... |
f0a98e57f245f1446ad725a57ddc3c64320d5301 | aae1e12cc6fd4deee584f8aff4d7411a68fb1c32 | lzwisbadbad/tendermint | /p2p/pex/known_address.go | Go | go | 3,594 | permissive | package pex
import (
"time"
"github.com/bcbchain/tendermint/p2p"
)
// knownAddress tracks information about a known network address
// that is used to determine how viable an address is.
type knownAddress struct {
Addr *p2p.NetAddress `json:"addr"`
Src *p2p.NetAddress `json:"src"`
Attempts int... |
174a3a66445f14724b55a6f6aae20c89f412799e | ddcb2966807fedd6aae2a9558aaf377fb44fcc62 | mandarjog/core | /pilot/platform/kube/inject/initializer_test.go | Go | go | 8,342 | permissive | // Copyright 2017 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 i... |
ae477af331cf86d21758437b684de6426af34f2c | 935400c7206d781955ce11663128e3673ae2d95c | rubik-ai/benthos | /lib/ratelimit/local.go | Go | go | 3,267 | permissive | package ratelimit
import (
"errors"
"fmt"
"sync"
"time"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)
//------------------------------------------------------------------------------
... |
4e05726153f7332dad98732ad469d38c3676c842 | 5c9e67247e3a9379b28db3a5e70bce706d6a1a10 | amoghj8/Network-Traffic-Sniffing | /mydump.go | Go | go | 6,501 | permissive | package main
import (
"encoding/hex"
"flag"
"fmt"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
"log"
"regexp"
"strconv"
"strings"
"time"
)
var (
snapshotLen int32 = 65535
err error
timeout time.Duration = -1 * time.Second
handle ... |
ca4c3de1b818cceeeb4fd8c72d014afc3e0e2640 | 57c002ac6f7663ce982c2eb5073ac15c2e129b09 | damnever/lindb | /internal/linmetric/counter_test.go | Go | go | 1,260 | permissive | // Licensed to LinDB under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. LinDB licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compli... |
6b372e4d870af873fd2dd835d2a694befe0602bc | d91e8a3c0820f8a879e9f2af8cd9662ac5a90ad6 | andie5/datastructures-algorithms | /magic-squares.go | Go | go | 2,725 | no_license | package main
import "log"
// https://www.hackerrank.com/challenges/magic-square-forming/problem
// Magic squares
// Sum of any row, column, or diagonal of length is
// always equal to same number
// Distinct integers 1-9
// Input 3x3 array
// Print cost (each swap made) & add up
// Goal: smallest cost for given inp... |
80a327afb66c87315f50425b59ee0800c2eca8b1 | a0443be3deaf095d24bfb84d293f571fe467cf88 | demophoon/shrls | /pkg/service/redirect.go | Go | go | 1,579 | permissive | package service
import (
"context"
"fmt"
"net/http"
"strings"
log "github.com/sirupsen/logrus"
pb "gitlab.cascadia.demophoon.com/demophoon/go-shrls/server/gen"
)
func (s *ShrlsService) Redirect(w http.ResponseWriter, r *http.Request) {
shrl := r.URL.Path
shrl = strings.TrimPrefix(shrl, "/")
parts := string... |
5b63d543ced82b20cbb0fdfc8edcc3f1f54aa81d | da509d926114bbfaeac020c0c6cf91d5ae5b1b70 | jkandasa/jaeger-operator | /pkg/inject/oauth_proxy_test.go | Go | go | 10,341 | permissive | package inject
import (
"fmt"
"sort"
"testing"
v1 "github.com/jaegertracing/jaeger-operator/apis/v1"
"github.com/jaegertracing/jaeger-operator/pkg/config/ca"
"github.com/jaegertracing/jaeger-operator/pkg/util"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io... |
7323a27bf1680ed2463025cb820e2399d68bd2e3 | 420b42643f7314aae15a3a5bf04d45c0251af392 | addozhang/osm | /pkg/service/types.go | Go | go | 1,470 | permissive | // Package service models an instance of a service managed by OSM controller and utility routines associated with it.
package service
import "fmt"
const (
// namespaceNameSeparator used upon marshalling/unmarshalling MeshService to a string
// or viceversa
namespaceNameSeparator = "/"
)
// MeshService is the stru... |
eb843f2e58e9564efbef2486388acabe9ec3c732 | 8f8ba3a9ff7fc3149d8a0f9e72b119cc278cb608 | kanbujianha/fabric | /core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/collection_val_test.go | Go | go | 2,797 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lockbasedtxmgr
import (
"testing"
"github.com/hyperledger/fabric/bccsp/sw"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/version"
"github.com/stretchr/testify/asser... |
eed5bafed0afaa722f1cdb8c44386028b3876b18 | 3aedfd0ca72e2d7a2b7d38316af688d8da409de7 | sorintlab/sircles | /vendor/github.com/neelance/graphql-go/internal/schema/schema.go | Go | go | 10,502 | permissive | package schema
import (
"fmt"
"strings"
"text/scanner"
"github.com/neelance/graphql-go/errors"
"github.com/neelance/graphql-go/internal/common"
"github.com/neelance/graphql-go/internal/lexer"
)
type Schema struct {
EntryPoints map[string]NamedType
Types map[string]NamedType
Directives map[string]*Dir... |
1e9f967ec0fca00456ef7dbbea01b73f9786df22 | 610031cfd3fe6989265436982b11bb50989b7871 | A1Gard/gitea | /vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/serve.go | Go | go | 2,907 | permissive | package commands
import (
"encoding/json"
"errors"
"fmt"
"log"
"net"
"net/http"
"net/url"
"path"
"strconv"
"github.com/go-openapi/loads"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/swag"
"github.com/gorilla/handlers"
"github.com/toqueteos/webbrowser"
)
// ServeCmd to serve a swagg... |
d074d9eb35532337a7e3044b3808e73b40a86a83 | bcada16e445a3623dc9419d67e6c86f27c17b3d5 | kezmorris/gomessage | /client/main.go | Go | go | 480 | no_license | package main
import "net"
import "fmt"
import "bufio"
import "os"
func main() {
// connect to this socket
conn, _ := net.Dial("tcp", "127.0.0.1:8081")
for {
// read in input from stdin
reader := bufio.NewReader(os.Stdin)
fmt.Print("Text to send: ")
text, _ := reader.ReadString('\n')
// send to socket
... |
978a7fe7377bc680a15d295deebf9f4f6828eac3 | c7097903f7ffc62ee8fb9169fccf182474c93304 | shynome/v2ldap-vendor | /github.com/golang/protobuf/proto/equal.go | Go | go | 7,590 | permissive | // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Protocol buffer comparison.
package proto
import (
"bytes"
"log"
"reflect"
"strings"
"github.com/golang/protobuf/protoapi"
"github.com/golang/protob... |
777f6aa6a2cd8ae6dd32ea7e5cd0c5c64ea27206 | c2dfee90666f642f2cef0e7eac76cb3c2eccaac6 | nano871022/go | /errors/errores.go | Go | go | 445 | no_license | package errors
import (
"fmt"
"errors"
)
var (
Error1 = errors.New("Mensaje 1")
Error2 = errors.New("Mensaje 2")
)
func TestErrors2(){
test := Testing {Nombre:"Alejandro"}
test2 := Testing {Errores: Error1}
if(test2.Errores != nil){
fmt.Println(test2.Errores)
}
fmt.Println(test.Nombre)
}
func... |
9fc5a3fe13f8d2adbfca509751d779db8ae22d5c | 4e11ca52e15d2f10d30d64c362a7e6fd23114301 | ckamm/client | /go/systests/passphrase_test.go | Go | go | 9,759 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package systests
import (
"fmt"
"io"
"testing"
"golang.org/x/net/context"
"github.com/keybase/client/go/client"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/... |
be427b435b35d3917718a3400bff192232231827 | 7e37435dcfa7df5bb38faa1a51ab45d28f4c101a | pingjing0628/algo-practice | /1725.Number-of-rectangles-that-can-form-the-largest-square/Number-of-rectangles-that-can-form-the-largest-square_test.go | Go | go | 715 | no_license | package problem1725
import (
"github.com/stretchr/testify/assert"
"testing"
)
type example struct {
input input
output output
}
type input struct {
value [][]int
}
type output struct {
value int
}
func TestSingle(t *testing.T) {
examples := []example {
{
input: input{
value: [][]int{
{5, 8},
... |
e17ac50c05a87f146a59bd2e6e50dbd79498de1e | 0b4a5701359109f93395e84e82cea8d33ef22bcd | alphagov-mirror/paas-semver-resource | /driver/git.go | Go | go | 7,019 | permissive | package driver
import (
"errors"
"fmt"
"io/ioutil"
"net/mail"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/blang/semver"
"github.com/concourse/semver-resource/version"
)
var gitRepoDir string
var privateKeyPath string
var netRcPath string
var ErrEncryptedKey = errors.New("private keys with passphr... |
740adda6ead543e54686d2ce2e9f9e34ab73addd | c687b8b4dfb5e10cc73a4738f3a2eb5935a07812 | fmstephe/go-disruptor | /example/main.go | Go | go | 1,947 | no_license | package main
import (
"runtime"
"github.com/smartystreets/go-disruptor"
)
const (
MaxConsumersPerGroup = 1
MaxConsumerGroups = 1
MaxProducers = 2
ItemsToPublish = 1
ReportingFrequency = 1000000 * 10 // 1 million * N
RingSize = 1024 * 16
RingMask = RingSize - 1
)
v... |
ec84cea07da8c9be6481ad0fbb7e2cfde398325d | b5891409094d813580e940702038a8c95d8bc9d6 | Sugar-pack/golang-training-2021 | /03_map_interface_method/homework/main.go | Go | go | 4,621 | no_license | package main
import (
"fmt"
"strconv"
"strings"
)
type MyFloat float64
func SimpleCalc(lhs, rhs float64, op string) (float64, error) {
switch op {
case "*":
return lhs * rhs, nil
case "/":
if rhs == 0 {
return 0, fmt.Errorf("division by zero %v %v %v", lhs, op, rhs)
}
return lhs / rhs, nil
case "+"... |
5d4fc183fa636afcb206907445f60052d567baf3 | 40dfe275b7fa7d9e3639c4cbb79515f3606a7e34 | Airtap-dev/api | /cmd/api/auth.go | Go | go | 2,093 | no_license | package main
import (
"database/sql"
"log"
"net/http"
"strconv"
"time"
"server/lib/geobalance"
pTurn "github.com/pion/turn/v2"
)
func auth(f internalHandler) internalHandler {
return func(acc account, w http.ResponseWriter, r *http.Request) (response, error) {
id, token, ok := r.BasicAuth()
if !ok {
... |
a7dcd782fb673495aed1aad3fda0b9989876c3ef | f4807181dee8a9122a278a785da9343314cf1186 | wonghoifung/tips | /goworkspace/src/jvmgo/instructions/stores/lstore.go | Go | go | 838 | no_license | package stores
import "jvmgo/instructions/base"
import "jvmgo/rtda"
type LSTORE struct {
base.Index8Instruction
}
type LSTORE_0 struct {
base.NoOperandsInstruction
}
type LSTORE_1 struct {
base.NoOperandsInstruction
}
type LSTORE_2 struct {
base.NoOperandsInstruction
}
type LSTORE_3 struct {
base.NoOperandsI... |
fe534a7d22e17f7b762b3236ca6eebec8850c2bc | 5e7aafbbee1f0a20c80931b94ddcc69a3efa150b | GenuineRex/wire | /examples/customerCorporateDrawDownRequest-write/main.go | Go | go | 7,911 | permissive | // Copyright 2019 The Moov Authors
// Use of this source code is governed by an Apache License
// license that can be found in the LICENSE file.
package main
import (
"github.com/moov-io/wire"
"log"
"os"
"time"
)
func main() {
file := wire.NewFile()
fwm := wire.NewFEDWireMessage()
// Mandatory Fields
ss :=... |
d49cc12b32ba06db0985cce639f5b0e04f3adfcd | 954e14a18105874ad097d6e7497d68c231f6b131 | pgoodwin/on-demand-service-broker | /upgrader/upgrade_state_test.go | Go | go | 6,667 | permissive | // Copyright (C) 2015-Present Pivotal Software, Inc. All rights reserved.
// This program and the accompanying materials are made available under
// the terms of the 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... |
5da14900c2e400614100237332a73a61050b08b2 | e9e9df0a372d739ad148c8b091a7311e3210ba27 | DanielFallon/buildkit | /frontend/dockerfile/shell/lex.go | Go | go | 9,934 | permissive | package shell
import (
"bytes"
"strings"
"text/scanner"
"unicode"
"github.com/pkg/errors"
)
// Lex performs shell word splitting and variable expansion.
//
// Lex takes a string and an array of env variables and
// process all quotes (" and ') as well as $xxx and ${xxx} env variable
// tokens. Tries to mimic b... |
071397ccfed3772347b3aa52f684d4ce5058cdcc | f1ed4ae3eccb1041f37cac233e1e840ad13e4eed | apascualco/api-rest-with-golang | /src/sqlite3/repository/user_repo.go | Go | go | 1,210 | no_license | package repository
import (
"errors"
"time"
sqlitle3db "apascualco.com/api-rest/src/sqlite3"
_ "github.com/mattn/go-sqlite3"
)
type UserEntity struct {
Email string `json:"user"`
Password string `json:"password"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_... |
d36acb244d4ee906c272ac792184a78d6187dff0 | d58a1388698aa7df80950ac3141f14f085c02381 | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/pkg/kubelet/cm/deviceplugin/manager_stub.go | Go | go | 2,536 | permissive | /**
* Copyright (C) 2015 Red Hat, 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... |
6540d2ee24429b0cc54c250997ac9267fb8ce855 | 4a516ef04c33b7bc0203465302731d0c9e65c6ee | linker0512/fabric | /core/container/dockercontroller/dockercontroller_test.go | Go | go | 17,042 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package dockercontroller
import (
"archive/tar"
"bytes"
"compress/gzip"
"context"
"encoding/hex"
"errors"
"fmt"
"io"
"testing"
"time"
docker "github.com/fsouza/go-dockerclient"
"github.com/hyperledger/fabric/common/floggi... |
a0632b49c1c952e889cfc89dc5ce916763cdc819 | f018ccb15837fa13e5686bd918785d75e0957be1 | Mattlk13/oci-go-sdk | /bds/list_work_requests_request_response.go | Go | go | 5,686 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
cec906a33ab9c76fc8012a26da2256c477f68201 | 00fba608771014fc8cbc259054d1ca24b342ba9a | yanggeorge/dht | /peerwire_test.go | Go | go | 2,653 | permissive | package dht
import (
"bytes"
"encoding/hex"
"fmt"
"io/ioutil"
"net"
"testing"
"time"
)
func TestFetchMetaData(t *testing.T) {
var (
length int
msgType byte
piecesNum int
pieces [][]byte
utMetadata int
metadataSize int
)
infoHash, err := hex.DecodeString("e84213a794f3ccd8903... |
4dec30b4cd39413a2a90bcd1f255c5ecefac018f | 5b3e855be12d54db5dff598c42bcf843bc295744 | kubesphere/s2irun | /vendor/github.com/spf13/cobra/bash_completions.go | Go | go | 17,424 | permissive | package cobra
import (
"fmt"
"io"
"os"
"sort"
"strings"
"github.com/spf13/pflag"
)
const (
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extentions"
BashCompCustom = "cobra_annotation_bash_completion_custom"
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_requ... |
0500237805090eb1809856c3a49d4c0205234936 | a81cbf29506fb39f08d6fbbbac8be00b676c1216 | kubernetes-sigs/ip-masq-agent | /cmd/ip-masq-agent/ip-masq-agent_test.go | Go | go | 18,407 | 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, ... |
f19741a5106364ac90840f35b28683fef9cc98ad | 63e9ad8d225c5a858f316894564de303d68c8034 | GeorgeGuo2018/qingcloud-cloud-controller-manager | /vendor/k8s.io/kubernetes/staging/src/k8s.io/sample-apiserver/pkg/client/informers/externalversions/factory.go | Go | go | 3,782 | 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, ... |
a67482ceafc6c58562b29cee8275aa882e9df0a4 | 0324db306235d1d3d9027b7c18281f6a870e1d61 | ztaoing/infra | /base/iris_server.go | Go | go | 1,941 | no_license | package base
import (
"github.com/kataras/iris"
"github.com/kataras/iris/middleware/logger"
irisrecover "github.com/kataras/iris/middleware/recover"
log "github.com/sirupsen/logrus"
"github.com/ztaoing/infra"
"time"
)
var irisApplication *iris.Application
//创建iris实例
func Iris() *iris.Application {
Check(irisA... |
48be4410ba4af2fe0bbcdad2f059fdef80333ea4 | 7c5c74bbd3ebe48dea533c9331648995eb60c096 | go-games/golang | /msg/msg.go | Go | go | 293 | permissive | package msg
import (
"github.com/name5566/leaf/network/json"
)
var Processor = json.NewProcessor()
func init() {
Processor.Register(&UserLogin{})
}
// 一个结构体定义了一个 JSON 消息的格式
// 消息名为 Hello
type UserLogin struct {
LoginName string
LoginPW string
} |
dfcb1fe28fcd565747f5dcd05d43820213436f96 | ffcba5dee2f9ed785b14ba5b36a34a798a0548c1 | weaming/photobox | /storage/s3_fs.go | Go | go | 3,990 | no_license | package storage
import (
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/gin-gonic/gin"
)
type LocalS3FS struct {
fs http.FileSystem
localRoot string
bucket string
keyPrefix str... |
b22f56934b1d5aad83cd7f35b6bd0fee9bf1ab7b | 8ed8994f14913f9b93d43190831a9322a9c2b056 | knuesel/goroslib | /msgs/std_msgs/float32_multi_array.go | Go | go | 231 | permissive | // Autogenerated with msg-import, do not edit.
package std_msgs
import (
"github.com/aler9/goroslib/msgs"
)
type Float32MultiArray struct {
msgs.Package `ros:"std_msgs"`
Layout MultiArrayLayout
Data []float32
}
|
489ce3af8a4509b62e45be7f81248ca8922102ff | 7b4aa7c5c07ebb5fb9f6d77e77cd5864f48eeb7e | lifa1225/aspose-words-cloud-go | /v2105/tests/document_protection_test.go | Go | go | 5,054 | permissive | /*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="document_protection_test.go">
* Copyright (c) 2021 Aspose.Words for Cloud
* </copyright>
* <summary>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of t... |
cb81e5115130fe4e7b95e346b4994b140bb1da78 | 6a457366fbc1e0e1b33d042c142a6432e881847a | zyguan/tidb | /br/pkg/lightning/importer/dup_detect.go | Go | go | 10,995 | permissive | // Copyright 2023 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... |
a5f0e91fc4a93e64df79a3a80c760ef2f70e6bed | 908b58dfa0ebbe6d39aa8b986485c6f415e7c033 | cheung-chifung/KeeReadingBot | /comment.go | Go | go | 1,212 | permissive | package main
import (
"net/url"
"sync"
)
type CommentState int
const (
CommentStateWaiting CommentState = iota + 1
CommentStateURLEntered
CommentStateCommentEntered
CommentStateCommentConfirm
)
type CommentManager struct {
url *url.URL
comment string
state CommentState
*sync.Mutex
}
func NewComment... |
1a8ff6c96f8072014c9e168406b9b525fade61e9 | be45cd8a9ba7834392e9f24f977a1924f11c84f4 | EndlessCheng/codeforces-go | /main/1600-1699/1644C_test.go | Go | go | 453 | permissive | package main
import (
"github.com/EndlessCheng/codeforces-go/main/testutil"
"testing"
)
// https://codeforces.com/contest/1644/problem/C
// https://codeforces.com/problemset/status/1644/problem/C
func TestCF1644C(t *testing.T) {
// just copy from website
rawText := `
inputCopy
3
4 2
4 1 3 2
3 5
-2 -7 -1
10 2
-6 -... |
87fad12bccf3795c054aff17893c0c7c5b9622ec | eecf45fbf2196a60dcf6820d68926fad8b83d3d5 | yu2003w/kubevirt | /pkg/virtctl/imageupload/imageupload_test.go | Go | go | 10,742 | permissive | package imageupload_test
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"strings"
"time"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1... |
0a4bbb8238147365595a9dcbe98d54bde542d7f9 | 6dee827d590818ce895bcbf9cd24ebc16ed33c4e | jjsaunier/traefik | /provider/docker_test.go | Go | go | 16,391 | permissive | package provider
import (
"reflect"
"strings"
"testing"
"github.com/containous/traefik/types"
"github.com/fsouza/go-dockerclient"
)
func TestDockerGetFrontendName(t *testing.T) {
provider := &Docker{
Domain: "docker.localhost",
}
containers := []struct {
container docker.Container
expected string
}{... |
256fdc4b5d6cc2592e0e8192eca92377e5c2df0e | 816de4f5d181a4810b5845ff693a531c5112cf1e | sratcliffe/nvidia_exporter | /nvml.go | Go | go | 5,306 | permissive | package main
/*
#cgo CFLAGS: -I/usr/local/cuda/include
#cgo LDFLAGS: -lnvidia-ml
#include "bridge.h"
*/
import "C"
import (
"errors"
"fmt"
"unsafe"
)
var (
errNoErrorString = errors.New("nvml: expected an error from driver but got nothing")
errNoError = errors.New("nvml: getGoError called on a successful ... |
68a341b5ce0a2c61ec8425f51469bad5e6dbd449 | 2a49478e572a5b4c64b169c434bd4469c8efccf4 | wjjackson7/semver-resource | /driver/driver.go | Go | go | 2,998 | permissive | package driver
import (
"crypto/tls"
"fmt"
"net/http"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/blang/semver"
"github.com/concourse/semver-resource/models"
"github.com/concourse/semve... |
6bb7dbca11e72b9dd969fd7411a9a024c076c7cc | ac79f07fbe0f6c023e895d1c74179db8210ce61c | chaos007/easycome | /session/rpc_client/rpc_client.go | Go | go | 6,306 | no_license | package streamclient
import (
"context"
"errors"
"fmt"
"math/rand"
"path/filepath"
"sync"
"gitlab.dianchu.cc/2020008/libs/pb"
"io"
"gitlab.dianchu.cc/2020008/libs/services"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/metadata"
)
// RPCStreamMap rpcstream列表
type RPCStreamMap struct {
list ... |
fa5c16cc39e36f761f8a19af4a0a01432a29c42b | 94a5f147a26325d510299481d1b3667090f72511 | go-akka/akka | /event/error.go | Go | go | 675 | no_license | package event
import (
"fmt"
"github.com/go-akka/akka"
)
type Error struct {
*LogEventBase
cause error
}
func NewErrorEvent(cause error, logSource string, logClass interface{}, message interface{}) akka.LogEvent {
eventBase := newLogEventBase(logSource, logClass, message)
event := &Error{
LogEventBase: event... |
dd35c4e0f693363f28f06abd0de2bbaaefe7a81c | 7492240c985dea9e556d5b6eb8ecd7e6a4424164 | zerolugithub/pike | /config/compress_test.go | Go | go | 1,561 | no_license | // Copyright 2019 tree xie
//
// 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... |
023334aacb270edb49d1ecc90da4b2b8df53a456 | aab227d402b79f3fee0f9953020b3e7514c67dbf | mdhender/pogodb | /internal/parser/scanner.go | Go | go | 4,238 | permissive | /*
* pogodb - a sql database engine
*
* Copyright (c) 2021 Michael D Henderson
*
* 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 r... |
b3a98dd5947eae6120ab47caa173b45c88e8ca3b | 2fd1125dfe1ecd68af05de61b809ce663234c9b8 | cilium/delayed-httpd | /main.go | Go | go | 592 | no_license | package main
import (
"net/http"
"os"
"strconv"
"strings"
"time"
)
var delaySeconds int
func sayHello(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Duration(delaySeconds) * time.Second)
message := r.URL.Path
message = strings.TrimPrefix(message, "/")
message = "Hello " + message
w.Write([]byte(... |
9ce30461c29be345ea839df1b2f61bb8dce9244c | 8cd9c3198a12510e75ca5aadb1db511a265c69a6 | tmptmptmp53451/protobuf | /protoc-gen-go/generator/internal/remap/remap_test.go | Go | go | 2,803 | permissive | // Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2017 The Go Authors. All rights reserved.
// https://github.com/tmptmptmp53451/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.