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 |
|---|---|---|---|---|---|---|---|---|
511c893dc745131eed2688b1992a7466f3a1df26 | ef30010c9350650a27eda2065ed05da3d5e435bf | ecgouvea/gloo | /projects/gloo/pkg/translator/listener.go | Go | go | 5,832 | no_license | package translator
import (
"sort"
envoyapi "github.com/envoyproxy/go-control-plane/envoy/api/v2"
envoyauth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth"
envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
envoylistener "github.com/envoyproxy/go-control-plane/envoy/api/v2/listener"
... |
6c643bcbd3998210ce7f07fc36b8a16b3aee8fb0 | 98e9a243e124d5e826096874a8df5eaca2366d46 | cryptozoic-io/go-cryptozoic | /src/go-cryptozoic/contracts/supernode/num.go | Go | go | 1,431 | no_license | package supernode
import (
"go-cryptozoic/period"
"math/big"
)
var (
superNodeAddNumStartBlock = big.NewInt(554240)
initSuperNodeNum = big.NewInt(128)
firstPeriodEndBlock = big.NewInt(1280000)
secondPeriodEndBlock = big.NewInt(3840000)
firstPeriodAddNum = big.NewInt(12)
secondPerio... |
fd3fecc6c619674a02cf1f265d70c187fcc7f11f | 16bc1339f18a867d66519641acaa15133301f970 | florianl/go-tc | /example_hfsc_test.go | Go | go | 4,111 | permissive | //go:build linux
// +build linux
package tc_test
import (
"fmt"
"net"
"os"
"github.com/florianl/go-tc"
"github.com/florianl/go-tc/core"
"github.com/jsimonetti/rtnetlink"
"golang.org/x/sys/unix"
)
func addHfscClass(class *tc.Class, devID, maj, min uint32, serviceCurve *tc.ServiceCurve) (*tc.Object, error) {
... |
a48fd69d10b92c12c1706dc75dcfb9f0dc6564c4 | c94712d869752e0ef5b81967adcbed90c7c80671 | leandrorodrigueszup/k8s-events-filter | /pod_verifier_strategy.go | Go | go | 591 | no_license | package main
import (
"context"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
type PodVerifier struct {
clientset *kubernetes.Clientset
namespace string
}
func (v *PodVerifier) exists(name string, label Label) (bool, error) {
pod, err := v.clientset... |
62e59331fb67c119bd850db79b214157d4a8b373 | 492a695cdcdb30d03cb72600ec3c54990f53b375 | rodebrahimi/nebula | /udp_generic.go | Go | go | 2,077 | permissive | // +build !linux android
// udp_generic implements the nebula UDP interface in pure Go stdlib. This
// means it can be used on platforms like Darwin and Windows.
package nebula
import (
"context"
"fmt"
"net"
)
type udpConn struct {
*net.UDPConn
}
func NewListener(ip string, port int, multi bool) (*udpConn, err... |
71ae95a9e1bca573a4a82d153d0d68440f5ae870 | 116de36a572dc66ab7b4d4fdb2a89e3bc60dfa98 | astra-zhao/tidb | /infoschema/tables_test.go | Go | go | 54,505 | 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... |
503f6089c1699da4fbc4b3cb098bd3ff43f66142 | d188ae8e69f1b8295b189fd7a2c03a78b5719b5e | tcthtuananh/echo-golang-API-CRUD | /helpers/passHelpers.go | Go | go | 416 | no_license | package helpers
import (
"golang.org/x/crypto/bcrypt"
)
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(bytes), err
}
func CheckPassword(password, hash string) (bool, error) {
err := bcrypt.CompareHashAndPasswor... |
1f4f6043394632d5f80bd091de51de57cc916cd9 | 339488e123b61966ce30d8922bd0ce7a424658e1 | jin-long/go | /the_go_programming_language/chapter1/primary.go | Go | go | 1,756 | no_license | package main
import "fmt"
func main() {
fmt.Println("hello worod !")
/* 变量申明 */
// var 变量名 类型
var intVal int
// 这时候会产生编译错误
//intVal :=1
// 此时不会产生编译错误,因为有声明新的变量,因为 := 是一个声明语句
intVal,intVal1 := 1,2
fmt.Printf(" intVal:%d, intVal1:%d", intVal, intVal1)
//多变量申明
var a1,b1,c1 int
//多变量赋值
a1,b1,c1=10,20,30
//... |
6ac7afe40a45ecd82e8417d393f12d607405b787 | eaf29bb6a23728bb073da51f95983946863e4f28 | hantempo/glu | /image/color/color_test.go | Go | go | 3,900 | permissive | package color
import (
"image/color"
"testing"
)
func TestNGrayAlpha(t *testing.T) {
var c NGrayAlpha
if r, g, b, a := c.RGBA(); r != 0 || g != 0 || b != 0 || a != 0 {
t.Errorf("r=0x%X g=0x%X b=0x%X a=0x%X", r, g, b, a)
}
c = NGrayAlpha{0x55, 0xAA}
if r, g, b, a := c.RGBA(); r != 0x38E3 || g != 0x38E3 || b ... |
123d365aa6d77161e8fe22da42c7051f3db8b5d2 | d9b2d66d5aac624eea388009184f149a7c64aad2 | Bowery/crosby | /server/handlers.go | Go | go | 2,164 | no_license | // Copyright 2013-2014 Bowery, Inc.
// Contains http handlers that implement 404's, loggers, and other useful handlers.
package main
import (
"io"
"net/http"
"strconv"
"strings"
"time"
)
// NotFoundHandler just responds with a 404 and a message.
var NotFoundHandler = http.HandlerFunc(func(rw http.ResponseWriter,... |
7673477ac8c61f810217b4b6ada343cc91c56e4f | 4a8a400f641a7a40033bc0b0f5c5d74349c87322 | brbgithub/design-pattern | /factory_method/factorymethod.go | Go | go | 1,792 | permissive | /*
Factory Method 工厂方法模式:
定义一个用于创建对象的接口,让子类决定实例化哪一个类。
工厂方法使一个类的实例化延迟到其子类
个人想法:简单工厂和工厂模式:简单工厂定义的是静态函数,
一个函数处理所有的产品创建,工厂模式将创建对象过程抽象为一个类组,
有抽象类,有对应产品的创建类,创建的过程有创建类来完成,
工厂模式主要使用的是依赖反转原则
(高层模块不依赖底层模块,统一依赖抽象层,抽象层不依赖细节层,细节层依赖抽象层),
解决简单工厂的缺少开放-封闭原则
*/
package factory_method
//"fmt"
type Ope... |
286349f0f4298c86ca3aa9548372fa61f34a95f2 | ed24ad99b35f211b7d2e3dd9233e67fbde490c90 | tliron/puccini | /tosca/grammars/hot/condition-definition.go | Go | go | 1,572 | permissive | package hot
import (
"github.com/tliron/go-ard"
"github.com/tliron/puccini/tosca/parsing"
"github.com/tliron/yamlkeys"
)
//
// ConditionDefinition
//
// [https://docs.openstack.org/heat/wallaby/template_guide/hot_spec.html#conditions-section]
//
type ConditionDefinition struct {
*Entity `name:"condition definiti... |
d67fe9588dfafda8acddf037da7069844810f9c0 | 784ed7658f5133e47f2f10050a388500baf22781 | sysradium/google-cloud-go | /spanner/session.go | Go | go | 34,908 | permissive | /*
Copyright 2017 Google LLC
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
dist... |
aa15006b1e82ac95bec8f9f5105a8f702d08a035 | 272660ff76e2c0f1c7d3e2f21de35756b8261961 | ZeyadYasser/dswg | /client_test.go | Go | go | 22,399 | permissive | package dswg
import (
"net"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vishvananda/netlink"
"github.com/vishvananda/netns"
)
// TODO: Use better error types, and update tests to assert for those types
// Tests that modify the network are preceded by creating
// a new network namespace to avoid c... |
f1620bc8c074a18c23611da487f9f3863ff2c68f | 23d9f67133150a125be70d30a45d9a7f9bbc5389 | Paspartout/gowiki | /view.go | Go | go | 1,055 | permissive | package main
import (
"html/template"
"net/http"
"github.com/Paspartout/gowiki/tmpl"
)
var templateMap map[string]*template.Template
func initTemplates(useLocal bool) error {
const (
templatePath = "/tmpl/"
templateBase = "/tmpl/layout/base.html"
templateEnding = ".html"
)
templates := []string{"vie... |
94f04ba5a8161494524fcc45675976c474a84d00 | 5176aded2d6e037ee0ca2b75a86c699473754526 | r2d2-ai/aiflow | /function/string/concat_test.go | Go | go | 276 | permissive | package string
import (
"testing"
"github.com/r2d2-ai/aiflow/data/expression/function"
"github.com/stretchr/testify/assert"
)
func TestFnConcat_Eval(t *testing.T) {
f := &fnConcat{}
v, err := function.Eval(f, "a", "b")
assert.Nil(t, err)
assert.Equal(t, "ab", v)
}
|
5898af2bfe8f42ec89208a8d6bbde06aaaf0e5ca | 22cd18c41ab79996ad33582c884dfba3ac754721 | ivansukach/modified-go-sdk | /client/rpc/basic_client.go | Go | go | 7,175 | permissive | package rpc
import (
"fmt"
"github.com/tendermint/tendermint/crypto/merkle"
"time"
ntypes "github.com/ivansukach/modified-go-sdk/common/types"
"github.com/ivansukach/modified-go-sdk/keys"
"github.com/ivansukach/modified-go-sdk/types/tx"
"github.com/pkg/errors"
"github.com/tendermint/tendermint/libs/bytes"
sr... |
e125be8d0282ebf000f0c0b0cbe5b43f2dcac676 | c4d370a928f1d64a53245137b1af2e2f8067cfac | satoru-takeuchi/cmd | /reqid.go | Go | go | 848 | permissive | package cmd
import "context"
// This file provides utilities for request ID.
// Request ID is passed as context values.
type contextKey string
const (
// RequestIDContextKey is a context key for request ID.
RequestIDContextKey contextKey = "request_id"
)
func (k contextKey) String() string {
return "cmd: contex... |
e4834f87d8173239b5cb0f8808710297fb5e6747 | cb1ecee0c7a37d7214f75462b2e7ae321398fc00 | crossplane-contrib/provider-terraform-aws | /generated/resources/sqs_queue/v1alpha1/compare.go | Go | go | 7,576 | permissive | /*
Copyright 2019 The Crossplane Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
1e4f8f911e9dba76cfc44b9c7fc3d24668131cf5 | bfc5fa975344edfa50e5eda82bff3d4eb668af86 | jpparsons/s3upload | /dockerclient/auth_config.go | Go | go | 3,384 | no_license | package dockerclient
import (
"io"
"os"
"path"
"path/filepath"
"strings"
"github.com/docker/docker/pkg/homedir"
"github.com/fsouza/go-dockerclient"
)
// DefaultDockerRegistry is the name of the index
const DefaultDockerRegistry = "docker.io"
// SplitDockerImageName breaks a reposName into an index name and r... |
c470f4478b85facd835f7c157ea74074c6e525af | 24ab7640758394a39ed48680674aa9ef7c16132f | eahydra/go-curator | /leader_selector.go | Go | go | 2,065 | permissive | package curator
import (
"errors"
"sync"
"sync/atomic"
"github.com/samuel/go-zookeeper/zk"
)
type LeaderSelectorListener interface {
TakeLeaderShip(client *ZookeeperClient, cancel <-chan struct{}) error
}
type LeaderSelector struct {
client *ZookeeperClient
mutex *Mutex
start int32
leaderShip... |
bda84e6ecf7782e1e390dc2afe966a505e73584d | 20f431144f65ac9b94bb78f2bef4b911b943eb8a | devcodewak/avonsg_openshift | /vendor/github.com/yinqiwen/gsnova/common/protector/config.go | Go | go | 785 | no_license | package protector
import (
"time"
)
const (
defaultDnsServer = "8.8.4.4"
connectTimeOut = 15 * time.Second
readDeadline = 15 * time.Second
writeDeadline = 15 * time.Second
socketError = -1
dnsPort = 53
)
type NetOptions struct {
ReusePort bool
LocalAddr string
DialTimeout time.Du... |
0aa8efa4925487f7225ba1852bb239cd685d9bbd | 88b321899bf07d43d7d9536f5553098cc0aee9da | loki5265/sysl | /sysl2/sysl/writer_test.go | Go | go | 6,211 | permissive | package main
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestWrite(t *testing.T) {
// given
w := MakeSequenceDiagramWriter(true)
// when
n, err := w.Write([]byte("test\n"))
// then
assert.Nil(t, err)
assert.Equal(t, 5, n)
assert.Equal(t, ... |
54fef977ca2fec5fa00d8a6f4d604dd4d7548db3 | 00d098f59b5cd876ab95250472b2b2fbf8b202fd | hihiso/casts | /model/image.go | Go | go | 554 | permissive | package model
import "time"
type ImageModel struct {
ID uint64 `gorm:"column:id" json:"id"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
ImageName string `gorm:"column:image_name" json:"image_name"`
ImagePath string `gorm:"column:image_path" json:"image_path"`
UpdatedAt time.T... |
385bcdc6474dd656e262fb3dccd0159b8aee6ce6 | aff398ca436815d84d164996e193be806e712096 | vizgin/origin | /vendor/github.com/getsentry/raven-go/client.go | Go | go | 31,116 | permissive | // Package raven implements a client for the Sentry error logging service.
package raven
import (
"bytes"
"compress/zlib"
"crypto/rand"
"crypto/tls"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
mrand "math/rand"
"net/http"
"net/url"
"os"
"regexp"
"runtime"
"... |
0d1bedd6ea9457dc63c78545857320a660bd72ba | d030f0bb783eaa8cb37d8c8d0cca37d28874bde0 | inturn/kit | /log/log_test.go | Go | go | 4,665 | permissive | package log_test
import (
"bytes"
"fmt"
"sync"
"testing"
"github.com/inturn/kit/log"
"github.com/go-stack/stack"
)
func TestContext(t *testing.T) {
t.Parallel()
buf := &bytes.Buffer{}
logger := log.NewLogfmtLogger(buf)
kvs := []interface{}{"a", 123}
lc := log.With(logger, kvs...)
kvs[1] = 0 // With shou... |
d90f449861ce3ef64a11c11656a8bd7271c85e2c | 2703acda21ffb65f2e6bfe8d098f1688f306ef83 | qibobo/grpcgo | /service/store/store.go | Go | go | 1,022 | no_license | package store
import (
"errors"
"log"
"sync"
"github.com/google/uuid"
"github.com/qibobo/grpcgo/models"
)
type Store interface {
Get(id string) interface{}
Save(o interface{}) (string, error)
List() []interface{}
}
type InMemoryStore struct {
store map[string]interface{}
lock sync.RWMutex
}
func NewInMe... |
9fbd3481420ffed4dba603cde432b1e430576c46 | d63715a964be33395b2a34a5aff5976a767d0f45 | bluefoxah/tao | /util.go | Go | go | 2,988 | permissive | package tao
import (
"hash/fnv"
"os"
"reflect"
"unsafe"
"runtime"
"sync"
)
type ConnectionMap struct{
sync.RWMutex
m map[int64]Connection
}
func NewConnectionMap() *ConnectionMap {
return &ConnectionMap{
m: make(map[int64]Connection),
}
}
func (cm *ConnectionMap)Clear() {
cm.Lock()
cm.m ... |
d5c1b07208a89dc04278aba04ac99ee3e7934ae3 | 1c6ad19944aa1bc54a73c27f60a06d4d8ccc815b | cookieisaac/gophr | /middleware.go | Go | go | 1,075 | no_license | package main
import "net/http"
type Middleware []http.Handler
func (m *Middleware) Add(handler http.Handler) {
*m = append(*m, handler)
}
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Wrap the supplied ResponseWriter
mw := NewMiddlewareResponseWriter(w)
// Loop through all of the r... |
facb34660580a6fc5651ab0db594ef51e16850bf | 43b81ac7fed5042f704d99baefb8cee578d1dee0 | radekg/terraform-state-ansible-module | /vendor/github.com/armon/go-metrics/datadog/dogstatsd_test.go | Go | go | 5,510 | permissive | package datadog
import (
"net"
"reflect"
"testing"
"github.com/armon/go-metrics"
)
var EmptyTags []metrics.Label
const (
DogStatsdAddr = "127.0.0.1:7254"
HostnameEnabled = true
HostnameDisabled = false
TestHostname = "test_hostname"
)
func MockGetHostname() string {
return TestHostname
}
var Pars... |
f6e446e944c3580485fa1cd585aa213634dbe908 | 26f9c8e38cae196a9e7a61ef5d686d5839c3e745 | PaloAltoNetworks/pango | /objs/profile/security/data/fw_test.go | Go | go | 688 | permissive | package data
import (
"reflect"
"testing"
"github.com/PaloAltoNetworks/pango/testdata"
)
func TestFwNormalization(t *testing.T) {
testCases := getTests()
mc := &testdata.MockClient{}
ns := FirewallNamespace(mc)
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
mc.Version = tc.version
... |
61bf429831cf834fd1342b8ffc4f07245cbfd1d0 | 8d3dbecec829aee2ec367e6ec5ab8296c63e4a22 | open-policy-agent/opa | /vendor/github.com/spf13/cobra/doc/util.go | Go | go | 1,559 | permissive | // Copyright 2015 Red Hat 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 applicable law o... |
c85c52a0cd2acca9c121b9fb8e4ac34b0538205b | 7afce2d16ec8ff2857427bae4f92c6477f13f4b7 | tgunnoe/paygate | /internal/ofac/refresh_test.go | Go | go | 4,557 | permissive | // Copyright 2020 The Moov Authors
// Use of this source code is governed by an Apache License
// license that can be found in the LICENSE file.
package ofac
import (
"errors"
"testing"
"time"
"github.com/moov-io/base"
"github.com/moov-io/paygate/internal/config"
"github.com/moov-io/paygate/internal/customers"... |
513cbdd04c1098e25f610e7a8ea55c3afb914a29 | f58afea279400a004760ebcaf87948e398727100 | ramoryan/vapor | /attribute_test.go | Go | go | 1,353 | no_license | package vapor
import (
"testing"
)
func TestNewAttribute(t *testing.T) {
var a attribute
var err *vaporError
_, err = newAttribute("id", `"my-id"`)
if err != nil {
t.Error(err.errMsg)
}
_, err = newAttribute("", "")
if err == nil {
t.Error("Empty name is not allowed!")
}
_, err = newAttribute("id", "... |
94c5204853eb8fab418bdb9f4476a3d3e79b414d | b2cdddcab50be422496b66fd7a2f0b29a401015d | m1/go-service-healthcheck | /model/service_test.go | Go | go | 695 | no_license | package model
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/m1/go-service-healthcheck/model/mock"
)
func TestService_UnmarshalJSON(t *testing.T) {
serviceData := map[string]interface{}{
"id": 1,
"name": "mock-1",
"url": "localhost/1",
"created_... |
75e44fb8bbc6f03965a305ef16840dff7440c0f0 | a4c3ccecda93d6da5242b821fc0b9ee71e5105ec | e3u3/surfstore | /src/surfstore/SurfstoreServer.go | Go | go | 2,476 | no_license | package surfstore
import (
"log"
"net"
"net/http"
"net/rpc"
"sync"
)
type Server struct {
BlockStore BlockStoreInterface
MetaStore MetaStoreInterface
Mutex *sync.RWMutex
}
func (s *Server) GetFileInfoMap(succ *bool, serverFileInfoMap *map[string]FileMetaData) error {
s.Mutex... |
95de6faa7bea7139f9174d2bace79a1593b4f30e | 212b3114e2db7abe85a2bd14d324813a21e56875 | 40a/qcollect | /handler/test.go | Go | go | 1,004 | permissive | package handler
import (
"github.com/qnib/qcollect/metric"
"time"
l "github.com/Sirupsen/logrus"
)
// Test type
type Test struct {
BaseHandler
}
// NewTest returns a new Test handler.
func NewTest(
channel chan metric.Metric,
initialInterval int,
initialBufferSize int,
initialTimeout time.Duration,
log *l... |
8af1cb2201b31c8d9cb642d28c7eadf06b3903a7 | 6e1f6b7d44722fbd95c5f9269c79c06e15fac0c0 | thefloweringash/hass_ir_adapter | /emitters/irblaster/irblaster.go | Go | go | 1,674 | no_license | package irblaster
import (
"bytes"
"encoding/binary"
"errors"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/thefloweringash/hass_ir_adapter/emitters"
)
type ToIRBlasterEncoding interface {
ToIRBlasterEncoding() []Command
}
type Command struct {
Encoding uint8
Payload []interface{}
}
type MQTTIRB... |
12da19e11233f6a2093c80a707d312dea41c879b | 7c1f8817561d3ecf293a1f73c4bd20b2989d89a6 | winkb/ddup-go-util | /utest/test/utest_test.go | Go | go | 714 | no_license | package test
import (
. "github.com/smartystreets/goconvey/convey"
"github.com/winkb/ddup-go-util/utest"
"testing"
)
func init() {
utest.Name("test1").Test(func(t *testing.T, r utest.V) utest.V {
Convey("没有依赖", func() {
So(1, ShouldEqual, 1)
})
return 111
})
utest.Name("test2").Depends("test1").Te... |
444bf7b93d0adbd714d45cca3d8b7ed1b6de3fae | 4818407c6e863db6480e2089b5c447358ff11b0b | yngwiewang/algorithm | /tree/701_insert_into_bst_tree_test.go | Go | go | 2,208 | no_license | package tree
import "testing"
// 701. Insert into a Binary Search Tree
func insertIntoBST(root *TreeNode, val int) *TreeNode {
if root == nil {
return &TreeNode{val, nil, nil}
}
head := root
insertIntoBSTHelper(head, val)
return root
}
func insertIntoBSTHelper(root *TreeNode, val int) {
if val > root.Val {
... |
64f3c4bbedcdf08eec0c499bd324bac44b748ebd | d8286f742881f9d22019d29ff1263c31f2413776 | pearl-truss/mymove | /pkg/testdatagen/make_tariff400ng_service_area.go | Go | go | 834 | permissive | package testdatagen
import (
"github.com/gobuffalo/pop"
"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/unit"
)
// MakeTariff400ngServiceArea finds or makes a single service_area record
func MakeTariff400ngServiceArea(db *pop.Connection, assertions Assertions) models.Tariff400ngServiceArea... |
8f255860e9934da52afa53c3a7c975ee8bb4175c | 568f0e3922c9be2449d020bec826de6ed282e03d | VivaLaPanda/number_classify_2.0 | /NeuralNetwork/neural_network.go | Go | go | 6,345 | no_license | // Package NeuralNetwork is a simple implementation of a three layer neural network
package NeuralNetwork
import (
"fmt"
"math"
"math/rand"
"sync"
)
// Makes neuron used to apply signmoid function
type SigmoidalNeuron struct {
inputSignal float64
outputSignal float64
}
// Contructor for sigmoid NewSigmoidalNe... |
8cd4f88219507c798c6f973a0697f84c443bf996 | 2fe44128ef005730026a583ea4c18e597fc5f7b4 | fxor/ws-tui | /server/server.go | Go | go | 895 | no_license | package wssv
import (
"fmt"
"net/http"
"github.com/gorilla/websocket"
)
type Server struct {
httpServer *http.Server
upgrader websocket.Upgrader
clientSockets map[string]*ClientConn
}
func NewServer(addr string) *Server {
sv := &Server{
upgrader: websocket.Upgrader{
ReadBufferSize: 1024,
Wri... |
9cfbf8221c2c9c08fefe20f36e6a4c1363805c36 | dd8cb61321b1c7d9d043f18af8877305a5af9676 | 2676583711/cn.zhou.go.foundation | /180.go | Go | go | 431 | no_license | package main
import (
"image/jpeg"
"image"
"io"
"os"
"crypto/rand"
"fmt"
)
func main(){
//fmt.Println(rand.Int())
if err:=toJPEG(os.Stdin,os.Stdout);err!=nil{
fmt.Fprintf(os.Stderr,"jpeg:%v\n",err)
os.Exit(1)
}
}
func toJPEG(in io.Reader,out io.Writer)error(
img,kind,err:=image.Decode(in)
if err!=nil{
re... |
989eca63e04752c252bf3c390069873991b7c9f6 | b5f8ad41a4c04d8ab674d18950f65ce738f79eda | sriyer/traefik-release | /traefik-1.3.8/server/web.go | Go | go | 12,220 | permissive | package server
import (
"encoding/json"
"expvar"
"fmt"
"io/ioutil"
"net/http"
"runtime"
"github.com/codegangsta/negroni"
"github.com/containous/mux"
"github.com/containous/traefik/autogen"
"github.com/containous/traefik/log"
"github.com/containous/traefik/middlewares"
"github.com/containous/traefik/safe"
... |
eddb0964afb0d2793a66fee73a399ec9a64f36ad | fb9152754caebe1df13bf3fccac4bb276c3928e6 | benjumanji/kubernetes | /cluster/addons/dns/kube2sky/kube2sky.go | Go | go | 10,411 | permissive | /*
Copyright 2014 The Kubernetes Authors 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 ag... |
252189f4fbeecb5154fe65cef783c56b1a0e77b4 | 00374eb23b5ddb1ac2515d58a6cad78a74792c11 | brikkho-net/minikube | /pkg/minikube/bootstrapper/bsutil/kverify/kverify.go | Go | go | 4,858 | permissive | /*
Copyright 2016 The Kubernetes Authors 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 ag... |
9cc72c6109c91b28b1dcb8a70fff73995f99431d | 7eca226baf2ce532c255266cda92b569d72a2174 | cnyygj/go-gin-blog | /routers/api/auth.go | Go | go | 1,388 | no_license | package api
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/astaxie/beego/validation"
"github.com/Songkun007/go-gin-blog/pkg/app"
"github.com/Songkun007/go-gin-blog/pkg/e"
"github.com/Songkun007/go-gin-blog/pkg/util"
"github.com/Songkun007/go-gin-blog/service/auth_service"
)
// 定义参数校验规则
type auth ... |
1de6dc796fdff4afb2673b87334a3b2a2253b0df | 7abe0625bfffefcefffb2b97bdd8f32ec43ce72a | aws/amazon-ssm-agent | /agent/startup/startup_skip_unix.go | Go | go | 1,049 | permissive | // Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" fil... |
0e2bb823576a69b7b9f4a2b0ebec3793ee836509 | 303648c227a0ed80a43e344db9052f3d66aa1a36 | ranakan19/odo | /pkg/odo/cli/plugins/plugin_handler.go | Go | go | 2,647 | permissive | package plugins
import (
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"syscall"
)
// HandleCommand receives a PluginHandler and command-line arguments and attempts to find
// a plugin executable on the PATH that satisfies the given arguments.
func HandleCommand(handler PluginHandler, args []string) error {
foundBi... |
a83af6c33cf96f4f4cf033dc10bd8bcabc0e761d | 56172ac8c358c77c5a4af198af49e291dde1c679 | bpkgoud/pulumi-azure-native | /sdk/go/azure/network/v20190201/getVirtualNetworkPeering.go | Go | go | 1,573 | permissive |
package v20190201
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupVirtualNetworkPeering(ctx *pulumi.Context, args *LookupVirtualNetworkPeeringArgs, opts ...pulumi.InvokeOption) (*LookupVirtualNetworkPeeringResult, error) {
var rv LookupVirtualNetworkPeeringResult
err := ctx.Invoke("azure-nativ... |
a9db47fa59c3b17ff42ea0afd2b3b5f74106068e | a1053746dd2b846537112a8f436664c3daa6fdc7 | alien01/onecloud | /cmd/climc/shell/natdtables.go | Go | go | 1,150 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
c70eda87cb857e8b029dd0e5aa0119d7d7a72ce5 | 138fee67267763152e393e039a99caf902add609 | xingyixun/reborn | /pkg/proxy/cachepool/cachepool.go | Go | go | 2,399 | permissive | // Copyright 2014 Wandoujia Inc. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.
package cachepool
import (
"sync"
"time"
"container/list"
"github.com/juju/errors"
"github.com/reborndb/reborn/pkg/proxy/redispool"
)
type SimpleConnectionPool struct {
createTs time.Time
sync.Mutex
fa... |
8007bed318c26dd00eeb14072f67151c8127084e | 935e0d5be1dcb4595d0f978ffe5d2033471f5a62 | johnbirdau/pulumi-azure-native | /sdk/go/azure/devices/v20200710preview/pulumiEnums.go | Go | go | 10,597 | 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 v20200710preview
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The permissions assigned to the shared access policy.
t... |
a92100fa168a525fb24f60c86d228c659f098644 | 86e7c31a61b74dfb851cde13957ef46ee6558cb0 | bububa/biz-weibo | /api/ad/info.go | Go | go | 342 | permissive | package ad
import (
"github.com/bububa/biz-weibo/core"
"github.com/bububa/biz-weibo/model/ad"
)
// Info 广告计划详情
func Info(clt *core.SDKClient, accessToken string, req *ad.InfoRequest) (*ad.Ad, error) {
var ret ad.InfoResponse
if err := clt.Do(accessToken, req, &ret); err != nil {
return nil, err
}
return &ret.... |
e5e6a06d9c0c1d456dcfac9df9575f96ab868830 | cc11551588ca4b22bd62ee28a931d4a7508be488 | bpkgoud/pulumi-azure-native | /sdk/go/azure/appconfiguration/getPrivateEndpointConnection.go | Go | go | 1,399 | permissive |
package appconfiguration
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupPrivateEndpointConnection(ctx *pulumi.Context, args *LookupPrivateEndpointConnectionArgs, opts ...pulumi.InvokeOption) (*LookupPrivateEndpointConnectionResult, error) {
var rv LookupPrivateEndpointConnectionResult
err := ... |
e9608449ef7a1373014658dcae5d03e8e7062a9d | 97a77dc5bec5255c21b2ddf1323e297d949dda9a | oshoval/kubevirt | /staging/src/kubevirt.io/api/flavor/v1alpha1/doc.go | Go | go | 754 | permissive | /*
* This file is part of the KubeVirt project
*
* 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 la... |
ce46fa9a51f6fc7594bd884c1b1ec760bde3ae54 | d1179b2dc14d4efa2ba37c6d1eea1842d9db3aca | dageita/frontend-websocket | /vendor/k8s.io/client-go/tools/cache/reflector_metrics.go | Go | go | 3,038 | 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 ... |
9817377ee5a15ee4c5134b7e8007833b901c5101 | f4b4108090fd6909091805d78b0403588292aa52 | robbyoconnor/go-ipfs | /core/coreapi/path.go | Go | go | 2,427 | permissive | package coreapi
import (
context "context"
fmt "fmt"
gopath "path"
core "github.com/ipfs/go-ipfs/core"
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
namesys "github.com/ipfs/go-ipfs/namesys"
ipfspath "gx/ipfs/QmTKaiDxQqVxmA1bRipSuP7hnTSgnMSmEa98NYeS6fcoiv/go-path"
resolver "gx/ipfs/QmTKaiDxQqVxmA... |
aabca3c1cd959240b2244e74b6d158f62405e075 | 08575742d8a3d1e88c94134a496eef0dc903b265 | Czone-League/irishub | /modules/upgrade/keeper.go | Go | go | 2,072 | permissive | package upgrade
import (
"github.com/irisnet/irishub/codec"
"github.com/irisnet/irishub/modules/stake"
sdk "github.com/irisnet/irishub/types"
)
type Keeper struct {
storeKey sdk.StoreKey
cdc *codec.Codec
// The ValidatorSet to get information about validators
protocolKeeper sdk.ProtocolKeeper
sk ... |
f3454a72cbd4e905211b49b78bd20140ebab4ab7 | 1c36b1c94964548391e747ff4cf48d5b2898c6cb | postmannen/go-learning | /bok/ch9/bank1/bank_test.go | Go | go | 583 | permissive | // Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package bank_test
import (
"fmt"
"testing"
"gopl.io/ch9/bank1"
)
func TestBank(t *testing.T) {
done := make(chan struct{})
// Alice
go func() {
bank.Deposit(200)
fmt.Println("=", ba... |
4947fca5a6f6c9e362c1b607e7c13d637841cb5e | 1f4ea3cb0ac3dadfbcf1ff8a1d0285d833e78718 | dcxcn/gf-vue-admin | /server/router/authority.go | Go | go | 809 | permissive | package router
import (
v1 "server/app/api/v1"
"server/app/middleware"
"github.com/gogf/gf/frame/g"
)
// InitAuthorityRouter 注册角色路由组
func InitAuthorityRouter() {
AuthorityRouter := g.Server().Group("authority").Middleware(middleware.JwtAuth).Middleware(middleware.CasbinMiddleware)
{
AuthorityRouter.POST("crea... |
f5ed8b107e247338c51475da3ff09017e22b6722 | cb4980f9f8a7d16d5384885ee22648176a3792fe | imclab/visor | /env_test.go | Go | go | 3,072 | permissive | // Copyright (c) 2013, SoundCloud Ltd.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Source code and contact info at http://github.com/soundcloud/visor
package visor
import (
"testing"
)
var store *Store
func envSetup(t *testing.T) *App {
if store == ni... |
185efd547833ed17b7ed66430f8cf87c76d2c1c7 | ef49e7e976aa4688890b7d0e3cfad5a034733a5e | Dmbob/goseer | /goseer-webapp/goseer-backend/cmd/backend-api/main.go | Go | go | 787 | permissive | package main
import (
"os"
"encoding/json"
"github.com/gin-gonic/gin"
)
type Config struct {
Port string `json:"serverport"`
DBUser string `"json:"dbuser"`
DBPass string `json:"dbpass"`
DBAddress string `json:"dbaddress"`
DBPort string `json:"dbport"`
DBName string `json"dbname"`
}
func main() {
var config... |
756cd32f81f29b22e60f68221c1264ed2125f93a | 06dd9869a71ed61f1493bb9b129dfa7eaea0a172 | efritz/overcurrent | /multi_collector.go | Go | go | 1,038 | permissive | package overcurrent
import "time"
// MultiCollector is a metric collector that wraps several other collector
// instances. Each event will be passed to every backend in the registered
// order.
type MultiCollector struct {
collectors []MetricCollector
}
// NewMultiCollector creates a new MultiCollector.
func NewMul... |
9b7eb095a481f48343227c3bfd8db255c8181a1d | e2062bce1cb2b8fed16fd7c0967ca5d4a11b9674 | aydink/booksearch | /scripts/stemmer/create_synonim.go | Go | go | 1,708 | no_license | package main
import (
"bufio"
"fmt"
"log"
"os"
"sort"
"strings"
"unicode"
)
type Stem struct {
stem string
count int
}
func showStemFrequency() {
dict := make(map[string]int)
file, err := os.Open("stem.txt")
if err != nil {
log.Fatalln(err)
return
}
r := strings.NewReplacer("â", "a", "î", "i", ... |
8d12b214a9cb87a91009258b3d075df482eb57ec | 7aefe34a541f3dcab7b8f128d7ea3994dc658342 | alaqelsplk/flagger | /pkg/controller/controller_test.go | Go | go | 13,091 | permissive | package controller
import (
"github.com/stefanprodan/flagger/pkg/apis/flagger/v1alpha3"
clientset "github.com/stefanprodan/flagger/pkg/client/clientset/versioned"
fakeFlagger "github.com/stefanprodan/flagger/pkg/client/clientset/versioned/fake"
informers "github.com/stefanprodan/flagger/pkg/client/informers/extern... |
29ae3e49730004730ad5c5041713e17db294ceb2 | 30a9e75233711b3c281ca6ea533afef5a92007ac | genbattle/Go2D | /go2d/element_properties.go | Go | go | 1,592 | no_license | package go2d
import "github.com/genbattle/Go2D/sdl"
type BackgroundColor struct {
backgroundColor *sdl.Color
}
func (b *BackgroundColor) BackgroundColor() *sdl.Color {
return b.backgroundColor
}
func (b *BackgroundColor) SetBackgroundColor(red, green, blue int) {
if b.backgroundColor == nil {
b.backgroundColor... |
7a96bcfa95467574ebbc6abf519e79d1e0f18377 | a9d851393e934689439d85f79e16dd9ea5e16442 | ThundR67/Velocity | /services/users-srv/users/utils.go | Go | go | 530 | permissive | package users
import (
"context"
"time"
"go.mongodb.org/mongo-driver/mongo"
"github.com/SonicRoshan/Velocity/global/config"
)
func generateUserMetaData() config.UserMeta {
return config.UserMeta{
AccountStatus: config.UserDataConfigAccountStatusUnactivated,
AccountCreationUTC: time.Now().Unix(),
}
}
... |
0df18e35029b499b0d7aeb090db4396262591e89 | 8616e645b0a870774a8df3417dde52cb3e0d2ae1 | BobbyShaftoe/go-tour-work | /maps/main.go | Go | go | 1,315 | no_license | package main
import (
"fmt"
_ "fmt"
)
type Vertex struct {
Lat, Long float64
}
var m map[string]Vertex
// Map literal - keys are required
var n = map[string]Vertex{
"Bell Labs": Vertex{
40.68433, -74.39967,
},
"Google": Vertex{
37.42202, -122.08408,
},
}
// If the top-level type is just a type name, you... |
15c6c8479a52871f7330a0e738039157f642bbfb | c6fa52f26c46a797cde880ebbbc744b807c28b06 | genexliu/gcp-res-mgr | /main/main.go | Go | go | 862 | no_license | package main
import (
"flag"
"log"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
rsMgr "google.golang.org/api/cloudresourcemanager/v2"
)
var (
folderID = flag.String("folder_id", "", "your folder ID")
)
// Copied from https://github.com/google/google-api-go-client
func main() {
flag.Parse()
// Us... |
226373ab47c3ba754383d047d773dbf4b1216878 | 22f4d14631a28661c3919eac5181536572bdd7c6 | rsteube/carapace-bin | /completers/devbox_completer/cmd/version.go | Go | go | 414 | permissive | package cmd
import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print version information",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(versionCmd).Standalone()
versionCmd.Flags().BoolP("verbose", "v",... |
8451e7474730a916c054ca84699841c7ead3b4c7 | 0471b66b85964301ba0ebe2d5d058fccf6513ae0 | apstndb/zoekt | /web/server.go | Go | go | 13,313 | permissive | // Copyright 2016 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... |
7bf415d8913501d41a9ffca9bd24bf1d4fe3711e | d4cc81d49f2922ddc7aa36f4c99ba20379a0d437 | chainhelen/sofa-mosn | /cmd/mosn/main/mosn.go | Go | go | 2,753 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
fed2d8be4e9481b90ff00d264250b92cd5425da1 | 379ba570d926bfeb7b3af5b766e73c1fb92caf89 | heroku/x | /requestid/requestid_test.go | Go | go | 1,190 | permissive | package requestid
import (
"net/http"
"testing"
)
func TestGet(t *testing.T) {
tests := []struct {
name string
headers map[string]string
want string
}{
{
name: "send Request-ID",
headers: map[string]string{"Request-ID": "request-id-value"},
want: "request-id-value",
},
{
name: ... |
c62d6a0c75c4e7b5e1a093ca2ee2bb1ac85deede | f8953c00a25511c097f1a11b91aa8ebba1af9585 | yyn1110/common | /hash.go | Go | go | 1,146 | no_license | package common
import (
"hash/fnv"
"crypto/md5"
"encoding/hex"
"crypto/sha256"
"io"
"crypto/sha1"
"fmt"
)
func GetMd5Hash(key []byte) uint64 {
if key == nil {
return 0
}
sum := md5.New().Sum(key)
if len(sum) < 16 {
return 0
}
b := sum[:8]
p1 := (uint64(b[0]) << 56) |
(uint64(b[1]) << 48) |
(ui... |
15269772a62a5fc25a9c97c6313631c2518742ca | cfc700baebc16ab5d6d133e77e44628b0cf5b92b | intel352/Neo4j-GO | /demo/demo.go | Go | go | 6,771 | no_license | package main
import (
"github.com/masiulaniec/Neo4j-GO"
"log"
)
func main() {
neo, err := neo4j.NewNeo4j("http://localhost:7474/db/data")
if err != nil {
log.Printf("%v\n", err)
return
}
node := map[string]string{
"test1": "foo",
"test2": "bar",
}
data, _ := neo.CreateNode(node)
log.Printf("\nNode I... |
c382e04558e7ee3f2acd34ac0205ec0c2717f9a8 | fb19af9aae22d7e3678374ecebc18da23039608c | rehacktive/news_aggregator | /newsfeedService/database.go | Go | go | 1,798 | no_license | package main
import (
"time"
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
)
type FeedDB interface {
getCategories() ([]Category, error)
getNews() ([]News, error)
getNewsByCategory(category string) ([]News, error)
close()
}
type Category struct {
Id int64
Name string
}
type Feed struct {
Id int... |
a253ad1ac3c0599eb51164fd9f460c4586ffaaf2 | bcec3a7ceed5ce0d5d81a39d09cffc539141c747 | vic3lord/flagr | /pkg/handler/eval_cache.go | Go | go | 2,257 | permissive | package handler
import (
"sync"
"time"
"github.com/checkr/flagr/pkg/config"
"github.com/checkr/flagr/pkg/entity"
"github.com/checkr/flagr/pkg/util"
"github.com/sirupsen/logrus"
)
var (
singletonEvalCache *EvalCache
singletonEvalCacheOnce sync.Once
)
// EvalCache is the in-memory cache just for evaluatio... |
5a011eeb31f353e827cea51bcb211c2be3ead941 | 34c47e062ece273737012caa3d3a8c0549f6b667 | MValle21/circonus-unified-agent | /plugins/inputs/socket_listener/socket_listener_test.go | Go | go | 6,839 | permissive | package socket_listener
import (
"bytes"
"crypto/tls"
"io"
"io/ioutil"
"log"
"net"
"os"
"path/filepath"
"runtime"
"testing"
"time"
"github.com/circonus-labs/circonus-unified-agent/internal"
"github.com/circonus-labs/circonus-unified-agent/testutil"
"github.com/influxdata/wlog"
"github.com/stretchr/test... |
222efaf19d7544a7e4180444d37d164c81db4391 | c81ddd411eb86e83c73195d312bc9828af50061b | yidane/algorithm | /others/longestPalindromicSubstring.go | Go | go | 1,049 | no_license | package others
//*************************************************************************
/*
https://leetcode.com/problems/longest-palindromic-substring/#/description
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
Example:
Input: "babad"
Output: "... |
bee802314ea1373f845f2725ce2293bf8d91490b | 1fd0139daaf2eb33405843bd09f12ac83476e5a9 | vadimi/amazon-ecs-cli | /ecs-cli/modules/config/config_v1.go | Go | go | 11,592 | permissive | // Copyright 2015-2017 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license... |
eb16b1ca2df437e7060ba641a94ac69efd0376e4 | cf5f10071990b3ac30f8fb66996108e67776eb65 | hummel22/smarthome | /pkg/objects/temperature_api.go | Go | go | 591 | no_license | package objects
import "time"
type ApiTemperature struct {
TemperatureC float64
Time time.Time
tags Tags
}
func NewApiTemperature(temperatureC float64,
t time.Time,
tags Tags) *ApiTemperature {
return &ApiTemperature{
TemperatureC: temperatureC,
Time: t,
tags: tags,
}
}
func (a ApiT... |
118654763347fd37d13e10a72ea0d2df51f8395d | da65e367cc012d908fa1b3ea981d12f22fd6bd6f | chanxuehong/deprecated-go-user | /model/update.go | Go | go | 3,314 | permissive | package model
import (
"github.com/chanxuehong/go-user/db"
)
// 更新绑定邮箱
// 调用该函数前, 请确认:
// 1. 该用户存在, 并且 verified
// 2. 该用户已经绑定邮箱
func UpdateEmail(userId int64, email string) (err error) {
para := struct {
UserId int64 `sqlx:"user_id"`
Email string `sqlx:"email"`
BindType BindType `sqlx:"bind_type"... |
648954b9667f60a461a8cb16fe61cf050fdb3b6f | 194cfbe3a64d877592d8fb68746986b296d4080e | thomastaylor312/concourse | /atc/worker/container_provider_test.go | Go | go | 36,361 | permissive | package worker_test
import (
"bytes"
"context"
"errors"
"fmt"
"io/ioutil"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/garden/gardenfakes"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagertest"
"github.com/cloudfoundry/bosh-cli/director/template"
"github.com/concourse/baggageclaim"
... |
0007ae3465ffdad190ecea496cfe7513fd2bc049 | 96943fdc545e127293a021e64588f2d5b9ed9bf8 | screwyprof/roshambo | /internal/pkg/cqrs/eventhandler/event_handler.go | Go | go | 2,151 | permissive | package eventhandler
import (
"fmt"
"reflect"
"strings"
"sync"
"github.com/screwyprof/roshambo/pkg/domain"
)
// EventHandler handles events.
type EventHandler struct {
handlers map[string]domain.EventHandlerFunc
handlersMu sync.RWMutex
}
// New creates new instance of New.
func New() *EventHandler {
retur... |
8bc73a40ca56ccb0cfd270746638423644c08f03 | d93dbb14e130cc5ff0f550ad1f4d7f495df11a67 | nyurik/tidb-operator | /cmd/backup-manager/app/backup/manager.go | Go | go | 8,062 | permissive | // Copyright 2019 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... |
d49182f45a6306f5facf2a5145f93ca95be425c0 | ee38b5d41d72cd5449c630ec25902a0e684230e3 | ganluo960214/StitchingSQLGo | /where.go | Go | go | 279 | permissive | package StitchingSQLGo
type Where WhereItems // `validate:"required,where_items_array_structure"`
func (w Where) where(s *SqlBuilder) error {
if s == nil {
return ErrorNilSQL
}
if w == nil {
return nil
}
s.WriteString(" where")
return WhereItems(w).WhereItems(s)
}
|
c6fe87ea271c2eb0f6a348219732e89448346cd8 | 08302c297b2b608949be27b0427059712e4733e9 | tinnkai/gin_test | /pkg/utils/tools.go | Go | go | 1,725 | no_license | package utils
import (
"fmt"
"gin_test/pkg/setting"
"os"
"strconv"
"time"
"github.com/segmentio/ksuid"
)
// 获取配置环境变量
func GetConfigorEnv() string {
// 在当前系统中设置 CONFIGOR_ENV 环境变量(dev/test/pro) 不设置默认 pro
configorEnv := os.Getenv("CONFIGOR_ENV")
if configorEnv == "" {
configorEnv = "pro"
}
return configor... |
5d258798bf8804d51f6ebeb1d505834a03b08176 | 4ffa62b3e2226d3b5b7c55c193d093508be3e753 | backwardn/hautomo | /pkg/hapitypes/temperaturehumiditypressure.go | Go | go | 571 | permissive | package hapitypes
type TemperatureHumidityPressureEvent struct {
Device string
Temperature float64
Humidity float64
Pressure float64
}
func NewTemperatureHumidityPressureEvent(deviceId string, temperature float64, humidity float64, pressure float64) *TemperatureHumidityPressureEvent {
return &Temperat... |
831d23ee6ed70238397981afc8eeb2af2a3e548b | 46c8d9986a87f4556d8c9192436698d57d5d310d | RongNK/fabric-smart-client | /platform/view/services/grpc/client_test.go | Go | go | 17,729 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package grpc_test
import (
"bytes"
"context"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net"
"path/filepath"
"sync"
"sync/atomic"
"testing"
"time"
grpc3 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services... |
3c166f9242088adc12c9f54fa44c6003faf983a2 | 790e11faf3def1b5a73257d36c33c88171ddb484 | mengjin001/azure-functions-golang-worker | /worker/worker.go | Go | go | 2,959 | permissive | package worker
import (
log "github.com/sirupsen/logrus"
"github.com/radu-matei/azure-functions-golang-worker/executor"
"github.com/radu-matei/azure-functions-golang-worker/loader"
"github.com/radu-matei/azure-functions-golang-worker/rpc"
)
func handleStreamingMessage(message *rpc.StreamingMessage, client *Clien... |
7f408636bc8c6ed407dd28f93819b9a8690531d8 | 2cabd0317c0aa874d19a611a763764e7c39619e0 | foomo/gofoomo | /proxy/proxy.go | Go | go | 4,726 | no_license | package proxy
import (
"crypto/tls"
"errors"
"log"
"net/http"
"net/http/httputil"
"github.com/foomo/gofoomo/foomo"
"github.com/foomo/tlsconfig"
"time"
)
// Handler proxy handler
type Handler interface {
HandlesRequest(incomingRequest *http.Request) bool
ServeHTTP(w http.ResponseWriter, incomingRequest *htt... |
bce092f093f5adde7a769c7dbf373e880d69eecd | cce4e2dcff37ebba48ec12a1563ae3c32fc5de2c | webclinic017/stock-alert-system | /data_service/core/mock-stream.go | Go | go | 825 | permissive | package core
import (
"errors"
"fmt"
"github.com/revulcan/stock-alert-system/data_service/grpc/data_service"
)
type MockStream struct {
Strm chan *LTP
Closed bool
}
func NewMockStream() *MockStream {
return &MockStream{
Strm: make(chan *LTP, 5),
Closed: false,
}
}
func (m *MockStream) Send(ltp *data... |
d12d36b15a25d29a9ea1b262fe8b3213edae5396 | ebaec7cc22de3de203091e677127a1cd5e3e4c78 | WenyXu/hraft-dispatcher | /http/service.go | Go | go | 14,389 | permissive | package http
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/http/pprof"
"strings"
"time"
"github.com/hashicorp/go-multierror"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"golang.org/x/net/http2"
"github.com/go-chi/chi"
"github.com/casbin/hraft-dis... |
ff27a5558b0c6f360fd72a3134c6c751488b4db4 | d7a15b9be3e2e5cdee4940bfe0ee60de24d363c2 | cherry4477/datafactory | /pkg/cmd/cli/cmd/debug.go | Go | go | 19,188 | permissive | package cmd
import (
"fmt"
"io"
"os"
"strings"
"time"
"github.com/golang/glog"
"github.com/spf13/cobra"
kapi "k8s.io/kubernetes/pkg/api"
kapierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/fields"
kcmd "k8... |
f0ea100e30414ff7bf3322a6230e69c1990ad96b | ec467cbbdf46242ceaef90aff86d8ccf7d177df9 | 0xRelter/golang-sdk | /api-sdk/kdl/client/ops.go | Go | go | 2,603 | no_license | package client
import (
"errors"
"fmt"
"strings"
"github.com/kuaidaili/golang-sdk/api-sdk/kdl/endpoint"
"github.com/kuaidaili/golang-sdk/api-sdk/kdl/signtype"
"github.com/kuaidaili/golang-sdk/api-sdk/kdl/utils"
)
// GetProxy 获取开放代理
// return: 代理slice
func (client Client) GetProxy(num int, orderLe... |
c51fb165c6403ca81f954b272b209196c8812043 | 3d9e089bb2567aadac5506057f78598b87af7806 | openebs/jiva-csi | /pkg/kubernetes/client/client.go | Go | go | 6,643 | permissive | /*
Copyright 2019 The OpenEBS 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... |
615144a45e9d273320bf43f03d54bf695b29a2c6 | 4a8aae7806fd785f7b08c8557a55da276ab6842f | melnikaite/benchmarks | /go17/server.go | Go | go | 231 | no_license | package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello World!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
|
38b981582f4f890468ddc149d0aac628faa00fc0 | 036369943d833ac72ef9a666103e16d040c08fdc | spartacus23/cobweb | /SocialGraph/generateGraph.go | Go | go | 5,675 | no_license | package main
import (
"encoding/gob"
"flag"
"fmt"
"math"
"math/rand"
"os"
"os/exec"
"strconv"
"time"
"./plotter"
)
var AnzCluster *int64 = flag.Int64("cluster", 20, "Anzahl der Cluster der Flächenverteilung")
var ClusterBreite *float64 = flag.Float64("clusterdev", 50.0, "Breite der Clusters (Standartabweic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.