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 |
|---|---|---|---|---|---|---|---|---|
8b0b09bd5fc77311d80580270d9bd7b8789709f8 | fc2d8ac7e442b823eaa094a07d75cfa92784b9ef | segmentio/ctlstore | /pkg/unsafe/unsafe_test.go | Go | go | 796 | permissive | // +build !race
package unsafe
import (
"reflect"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestInterfaceFactoryPtrToStructField(t *testing.T) {
myStruct := struct{ X, Y string }{"hello", "world"}
myStructX := reflect.TypeOf(myStruct).Field(0)
myStructY := reflect.TypeOf(myStruct).Field(1)
xif := NewIn... |
f0c5932940ac950466e81c9f761d44e37e101251 | 5e73db9b2f798b9ffe851bd7ab377c0aefda5655 | nir-sopher/incubator-trafficcontrol | /traffic_ops/client/cdn_domains.go | Go | go | 851 | permissive | package client
import (
"github.com/apache/trafficcontrol/lib/go-tc"
)
/*
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 requir... |
170ffe8b21294ee7350c440914700d6c4aafb1bc | fa4ab286d0ac4db60339e8cf5e733875027c37d5 | gerrywastaken/distribution-spec | /conformance/01_pull_test.go | Go | go | 9,555 | permissive | package conformance
import (
"fmt"
"net/http"
"os"
"github.com/bloodorangeio/reggie"
g "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var test01Pull = func() {
g.Context(titlePull, func() {
var tag string
g.Context("Setup", func() {
g.Specify("Populate registry with test blob", func() {
Sk... |
595e72883e49796bcba9835feefc53a18a68d94b | bacddadd05e850aa1d6fe34d9c0c6a0e7eda85d8 | eveybcd/aBitcoinDiamond | /vendor/github.com/NebulousLabs/Sia/persist/persist.go | Go | go | 3,648 | permissive | package persist
import (
"encoding/base32"
"errors"
"os"
"path/filepath"
"sync"
"github.com/NebulousLabs/fastrand"
)
const (
// persistDir defines the folder that is used for testing the persist
// package.
persistDir = "persist"
// tempSuffix is the suffix that is applied to the temporary/backup versions... |
0fa3aa2fd42fd2e986a0a6ac39ad33f922f18505 | 8eb4f76cbd59caf356c9365074f763e02fd0600f | koven2049/space-cloud | /gateway/modules/filestore/store.go | Go | go | 2,646 | permissive | package filestore
import (
"io"
"sync"
"github.com/spaceuptech/space-cloud/gateway/config"
"github.com/spaceuptech/space-cloud/gateway/model"
"github.com/spaceuptech/space-cloud/gateway/utils"
"github.com/spaceuptech/space-cloud/gateway/modules/auth"
"github.com/spaceuptech/space-cloud/gateway/modules/filesto... |
18e7522f96dfd461b2c777eba964fc27e715ed8b | b5994475f7b8979a857b9cc081164d936e6b6390 | Nivl/go-sqldb | /sqldb.go | Go | go | 1,570 | permissive | // Package sqldb contains interfaces and strutures to deal with SQL database
package sqldb
import "database/sql"
// Connection is an interface representing a database connection
type Connection interface {
Queryable
// SQL returns the sql.DB object
SQL() *sql.DB
// DSN returns the DNS used to connect to the dat... |
2e363bbf19d5bd9a642125fbfcfce6bd23bb3b91 | e0b27e4e5d7e4f32c56ea52e538fcb72fd019cba | icewater2020/stack-rpc | /pkg/config/reader/options.go | Go | go | 1,002 | permissive | package reader
import (
"github.com/stack-labs/stack-rpc/pkg/config/encoder"
"github.com/stack-labs/stack-rpc/pkg/config/encoder/hcl"
"github.com/stack-labs/stack-rpc/pkg/config/encoder/json"
"github.com/stack-labs/stack-rpc/pkg/config/encoder/toml"
"github.com/stack-labs/stack-rpc/pkg/config/encoder/xml"
"githu... |
05f3cacda9365b03cd30ad9e595780bf95b7dae2 | dda84efecae0afed84e13af95f40e69372dfd9e9 | alash3al/smtpd | /smtpd.go | Go | go | 15,908 | permissive | // Package smtpd implements a basic SMTP server.
package smtpd
import (
"bufio"
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
"net"
"os"
"regexp"
"strconv"
"strings"
"time"
)
var (
// Debug `true` enables verbose logging:
Debug = false
rcptToRE = regexp.MustCompile(... |
b13a289c1f5fdeaaeb7e7b922db5629a21b8ae4c | 85f2ec301f164f62ac52250af7d59572271fb7a9 | lostfind/AOJ | /v0070.go | Go | go | 786 | no_license | package main
import "fmt"
func main() {
numbers := make([]int, 10, 10)
// sum : 0 ~ 330
// var counts [10][331]int
for {
var n, s int
scanCount, _ := fmt.Scanf("%d %d", &n, &s)
if scanCount == 2 {
count := combination(numbers, s, n, 1, 0)
fmt.Println(count)
} else {
break
}
}
}
func combina... |
5328898d14569e1d6159cb7a2f0b3e5955015c00 | b607dfd3ec54fe3148c1617d2f8239b8e186ce5a | dkumor/revhttpfs | /revHttpFs.go | Go | go | 4,527 | permissive | package revhttpfs
import (
"io"
"net/http"
"os"
"syscall"
"time"
"github.com/spf13/afero"
)
// ReverseHttpFile takes an http.File and matches it to File
type ReverseHttpFile struct {
http.File
}
// Name returns the file's name
func (a ReverseHttpFile) Name() string {
s, err := a.File.Stat()
if err != nil {... |
f2e39089d579f74000e23843f8413a7974300e56 | eddbf6d0ee9664c7894a30663adbc7cfde3c30e8 | bluestatedigital/centralbooking | /instance/instance_test.go | Go | go | 7,334 | permissive | package instance_test
import (
"github.com/bluestatedigital/centralbooking/instance"
"github.com/bluestatedigital/centralbooking/interfaces"
vaultapi "github.com/hashicorp/vault/api"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/mock"
)
var _ = D... |
dcaa4b877cd3beefa5757ada06936fc428a2e4ab | 4aa1569386f302c3ef5a2f8fdae1a7ea722eb5fa | golanglib/kitex | /client/doc.go | Go | go | 863 | permissive | /*
* Copyright 2021 CloudWeGo 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 agre... |
a534cccbbc76e8c20b856d7fbeb1e560e8a43447 | 101070a19c25628c2d6a10e1b1bbd744a4d92ae5 | dennisgranath/gocd-plumber | /transform.go | Go | go | 686 | permissive | package main
import (
"fmt"
"strconv"
)
func transformData(pIn *interface{}) (err error) {
switch in := (*pIn).(type) {
case map[interface{}]interface{}:
m := make(map[string]interface{}, len(in))
for k, v := range in {
if err = transformData(&v); err != nil {
return err
}
var sk string
switch... |
3f67effdfc415d26effa4ec0412e34bc944df80c | 6d1467c342f12089a6d0ba84c94568f76f1df188 | kkallday/inspector | /commands/deadweight.go | Go | go | 2,753 | permissive | package commands
import (
"fmt"
"io"
"sort"
"github.com/ryanmoran/inspector/tiles"
)
type productParser interface {
Parse() (tiles.Product, error)
}
type Deadweight struct {
productParser productParser
stdout io.Writer
}
func NewDeadweight(productParser productParser, stdout io.Writer) Deadweight {
... |
06e28e6181f0c829d5f5a2882eaedea5db1de05a | 34b3325f3b10b36ac0ca3542e19bb7b690efa46e | idoshveki/magma | /orc8r/cloud/go/services/directoryd/indexers/session_id_to_imsi.go | Go | go | 3,283 | permissive | /*
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
*/
package indexers
import (
"fmt"
"magma/orc8r/cloud/go/orc8r"
"magma/orc8r/cloud/go/services/directoryd"
"m... |
032e9e84f0938c37dcfe961ae1a409e14e295355 | 58330356862a0b05f043e01da00e4b29ebcf007c | ghongli/cache | /filesys/file.go | Go | go | 4,618 | permissive | package filesys
import (
"io/ioutil"
"os"
"time"
"crypto/md5"
"encoding/hex"
"fmt"
"path/filepath"
"github.com/ghongli/cache"
)
const (
defaultFilePerm os.FileMode = os.ModePerm
defaultDirectoryFilePerm = 0755
)
var (
FileCachePath = "cache" // cache directory
FileCacheExpire... |
dbb52f9b1df646ea5db6b2bdcd25e4e00346560c | 8ffcfd3a523da7e36ea2506006d30a0b3af65865 | emqx/MQTT-Client-Examples | /mqtt-client-Go/pubsub/protocols/use_ws.go | Go | go | 332 | permissive | package protocols
import "log"
func WSConnection(config Config) {
client := connectByWS(config)
action := config.Action
switch action {
case "pub":
Pub(client, config.Topic)
case "sub":
Sub(client, config.Topic)
case "pubsub":
PubSub(client, config.Topic)
default:
log.Fatalf("Unsupported action: %s", a... |
91a427ecbc3dfa4f75b64653bb7571ee16471fcc | c7a8a833cec266170a17acbc4ff37324135010b0 | SwordHarry/gopetstore | /src/persistence/lineItemDAO.go | Go | go | 1,467 | no_license | package persistence
import (
"database/sql"
"gopetstore/src/domain"
"gopetstore/src/util"
"log"
)
const (
getLineItemsByOrderIdSQL = `SELECT ORDERID, LINENUM AS lineNumber, ITEMID, QUANTITY, UNITPRICE FROM LINEITEM WHERE ORDERID = ?`
insertLineItemSQL = `INSERT INTO LINEITEM (ORDERID, LINENUM, ITEMID, QU... |
b1692b49995cee27e7efa33aa10fe1d3405121ec | 50f8095f2f6a96bd6a49e396949082f0150a1f9e | kaneshin/go-fibonacci | /fibonacci/fibonacci.go | Go | go | 202 | no_license | package fibonacci
const (
n0 = 0
n1 = 1
)
func Fibonacci(n int) int {
if n < 1 {
return n0
}
return f(n, n1, n0)
}
func f(n, a, b int) int {
if n > 1 {
return f(n-1, a+b, a)
}
return a
}
|
50b1134616ea172178308e4d0283d017e0e245fb | 4fa99875dcbc9ec4dc3a8b154b2973466ded2e47 | BigG1947/ruby_garage | /controllers/index.go | Go | go | 363 | no_license | package controllers
import (
"html/template"
"log"
"net/http"
)
func Index(w http.ResponseWriter, r *http.Request) {
temp, err := template.ParseFiles("templates/index.html")
if err != nil {
log.Printf("%s\n", err)
w.WriteHeader(500)
return
}
if err := temp.Execute(w, nil); err != nil {
log.Printf("%s\n... |
edb3193c0f791deafa692653a037ed1b105c73e7 | c8fb55e4f48ae143caae6e7cfadc3945f2469b56 | 13days/gfly | /pool/connpool/conn.go | Go | go | 1,017 | no_license | package connpool
import (
"net"
"sync"
"time"
)
type Conn struct {
net.Conn
c *channelPool
unusable bool // if unusable is true, the conn should be closed
mu sync.RWMutex
t time.Time // connection idle time
dialTimeout time.Duration // connection timeout duration
}
func (p *Conn) MarkUnusable() {
p.mu.Lo... |
4765923c3ecd90be8fd4eb986cd0a46c20da9b53 | 507f283bcaa1751b293d76fafa0153bb3ba60a27 | nickkeers/housemate | /datalayer/postgres_data_adapter.go | Go | go | 1,141 | no_license | package datalayer
import (
"database/sql"
sq "github.com/Masterminds/squirrel"
_ "github.com/lib/pq"
"time"
)
type PostgresDataAdapter struct {
db *sql.DB
}
func NewPostgresDataAdapter(dsn string) (*PostgresDataAdapter, error) {
db, err := sql.Open("postgres", dsn)
if err != nil {
return nil, e... |
30243ccc727e13c345fa562e066340e77f462e0b | 2db95c9231acda862aca41cfba51297980e9fea3 | timchunght/go-workers-examples-1 | /client.go | Go | go | 231 | no_license | package main
import "github.com/Scalingo/go-workers"
func main() {
workers.Configure(map[string]string{
"process": "client1",
"server": "localhost:6379",
})
workers.Enqueue("myqueue", "MyRubyWorker", []string{"hello"})
}
|
f871929cfde6f51315b2499bde916a7833c60ae7 | aa8850e5dc1d1850d0fa4bebd3cfab1eb23a7b0a | mjudeikis/tailscale | /wgengine/wgcfg/config.go | Go | go | 2,010 | permissive | // Copyright (c) 2021 Tailscale Inc & 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 wgcfg has types and a parser for representing WireGuard config.
package wgcfg
import (
"inet.af/netaddr"
"tailscale.com/types/wgkey"
)... |
7d633b8f1eda7bfc6922b4bc359b47653af6c10d | eafbe13c2d7b3031fb62df592f8de2423c024b43 | dags-/stayawake | /main.go | Go | go | 214 | no_license | package main
import (
"bufio"
"os"
"github.com/dags-/stayawake/wake"
)
func main() {
wake.Start()
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
in := s.Text()
if in == "stop" {
os.Exit(0)
}
}
}
|
355d6931ebbbb6a90bf2b971ecc66abad8e8eb0f | c5b147ecf26ccbd88de87465c87591a38faf4cf9 | allanhung/istio-fleetman | /k8s-manifests/istio-1.5.0/tests/integration/mixer/main_test.go | Go | go | 1,273 | permissive | // Copyright 2018 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 agree... |
973de8793f1d8a753ef6c0e44538fd06afa7814e | 29a59c7261476f57a83c4f5ad218245377c5aa64 | tonyhhyip/seau | /api/plugin.go | Go | go | 324 | no_license | package api
import (
"context"
"net/http"
)
const PluginSymbol = "Plugin"
type Plugin interface {
// Get unique ID of plugin
ID() string
// Get display name of plugin
Name() string
// Get handler for request
Handler() http.Handler
// Initial Setup
Init(context.Context) error
// SetConfig
SetConfig(Config... |
c0094550dcfd7ea1aaea3d334d44bc6a7d1adc23 | c6be8f46280c97437ec976471155e9801ccf2b48 | myself659/golang-basic | /time/time.go | Go | go | 589 | no_license | package main
import "fmt"
import "time"
func main() {
p := fmt.Println
now := time.Now()
p(now)
then := time.Date(2016, 5, 4, 16, 15, 00, 4, time.UTC)
p(then)
p(then.Year())
p(then.Month())
p(then.Day())
p(then.Hour())
p(then.Minute())
p(then.Second())
p(then.Nanosecond())
p(t... |
41aba2af89f6c6426a9fce5ae9b9f3e85f315877 | 952827100d8e54d3fc8377bc87a963a28ee9d7d6 | purushothamb11/pipeline | /api/supported.go | Go | go | 3,763 | permissive | package api
import (
"github.com/banzaicloud/banzai-types/components"
"github.com/banzaicloud/banzai-types/constants"
"github.com/banzaicloud/pipeline/auth"
"github.com/banzaicloud/pipeline/cluster/supported"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"net/http"
)
// GetSupportedClusterList sends ... |
bdae34dc277f5bb789a8cd52c1451d4df373142e | c53e8ae1fba74e15dad469223b4c07cd53775259 | divinerapier/learn-kubernetes | /pkg/apis/batch/v1/doc.go | Go | go | 889 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
fb9d37a63e68f506158b03662c7f6d9e3538541f | 0124fb0129881d95ee10f84a9a2214d4cbaede92 | AJirenius/FlappyClone | /game/pipes.go | Go | go | 2,110 | no_license | components {
id: "script"
component: "/game/pipes.script"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
embedded_components {
id: "collisionobject"
type: "collisionobject"
data: "collision_shape: \"\"\n"
"type: COLLISION_OBJECT_TYPE_TRIGGER\... |
29607b171e3ee0dce47fbbc93ff6d52d8e4acdbc | aa6f1de675a813b274204dd0affc59491b736638 | infotexture/vale | /core/config.go | Go | go | 7,126 | permissive | package core
import (
"os"
"path"
"path/filepath"
"strings"
"github.com/gobwas/glob"
"github.com/mitchellh/go-homedir"
ini "gopkg.in/ini.v1"
)
// Glob represents a glob pattern passed via `--glob`.
type Glob struct {
Negated bool
Pattern glob.Glob
}
// Match returns whether or not the Glob g matches the st... |
6ca100e684b97d9501254bb727439a35da75029f | f23ae51d4fe3da20b0f3cfa41c246e79037055b1 | dulek/cluster-image-registry-operator | /pkg/resource/nodecadaemon.go | Go | go | 4,923 | permissive | package resource
import (
"os"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
appsclientv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
appslisters "k8s.io/client-go/listers/apps/v1"
kcorelisters "k8s.io/client-go/listers/core/v1"
"github.com/opensh... |
1f864f42936a6918735b3bd1518be1f0a09d1fc8 | fdd3d4a1be5080fad807c5471ef37b943df768c0 | dtext/go-aws-meetup-example | /logger/logger.go | Go | go | 2,595 | no_license | package logger
import (
"context"
"net/http"
"time"
"github.com/apex/gateway"
"github.com/google/uuid"
"go.uber.org/zap"
)
var _logger *zap.SugaredLogger
const ContextKey = iota
// init will be executed when the package is loaded
func init() {
loggerConfig := zap.NewProductionConfig()
logger, _ := loggerCo... |
d26ce06b78d84a5b67727bc99d8201145e99413b | a3a2af691be757257aa12b3327d5693f4c05cc63 | sleagon/wechat | /mp/poi/list.go | Go | go | 2,353 | permissive | // @description wechat 是腾讯微信公众平台 api 的 golang 语言封装
// @link https://github.com/chanxuehong/wechat for the canonical source repository
// @license https://github.com/chanxuehong/wechat/blob/master/LICENSE
// @authors chanxuehong(chanxuehong@gmail.com)
package poi
import (
"fmt"
"github.com/sleagon/we... |
f54a1572568f555381bef64c892ce72c080aa715 | f7b5a07b29639dbe368782ddf16ad25de3d4612a | ZeaLoVe/dnsadmin | /controllers/dnsweb.go | Go | go | 2,744 | no_license | package controllers
import (
"dnsadmin/models"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (c *MainController) Get() {
sess := c.StartSession()
username := sess.Get("user_name")
if username == "" {
c.Ctx.Redirect(302, "/"... |
949092d0ffb6f4d1a4492a9d33ee49a0d0ded90f | 6d6313f3953ce1362dd593ee5942be11da5828f5 | adamstruck/grip | /graphserver/webserver.go | Go | go | 3,875 | no_license | package graphserver
import (
"fmt"
"github.com/bmeg/arachne/aql"
"github.com/bmeg/arachne/falcor"
"github.com/bmeg/arachne/graphql"
"github.com/golang/protobuf/proto"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"golang.org/x/net/context"
"google.golang.org/grpc"
"io"
"log"
"ne... |
13e0ef74120f8c875dbe035fd20382e90dd6b845 | 14521eaba353d96dde3156cd7cf233ad9a40add0 | lzjian119/GetAnything-Server | /extractors/bilibili.go | Go | go | 3,039 | permissive | package extractors
import (
"encoding/json"
"errors"
"fmt"
"github.com/PerrorOne/GetAnything-Server/download"
"io/ioutil"
url2 "net/url"
"regexp"
"strings"
)
var (
bilibiliCid = regexp.MustCompile(`","cid":(\d+),`)
bilibiliUrl = regexp.MustCompile(`__playinfo__=(?s:(.*?))<`)
bilibiliTitle = regexp.Must... |
a606486fcb020b48e66dc035ea8b4f54df6b565e | b62718b849a6d45df1b661e17b0d71445ac38a73 | lcl101/gssh | /core/app.go | Go | go | 9,418 | permissive | package core
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"time"
)
//IndexType index类型
type IndexType int
//IndexType 枚举类型
const (
IndexTypeServer IndexType = iota
IndexTypeGroup
)
const (
//SP 显示名称的空格
SP = " "
)
//Group ... |
74e5c7604006a0896e35c21391d5e842eb1ad3f0 | 7c888a560d1cd0c8432ddc05e60d8444356db610 | davidwalter0/go-cfg | /cmd/eval/jpath.go | Go | go | 8,637 | permissive | package main
import (
"encoding/json"
"errors"
"fmt"
"reflect"
"strconv"
"time"
yaml "gopkg.in/yaml.v3"
)
var Debug bool = true
type RWStrBuff string
func (to RWStrBuff) Write(byte []byte) (n int, err error) {
to = RWStrBuff(byte)
return len(to), err
}
func (from RWStrBuff) Read(out []byte) (n int, err e... |
8cad5d65775692f67ff1c967de8b0dc678a9cbd6 | 28e7e26b0cd883bb11b590b05a747da9717455f9 | ironxc/golangStudy | /pointer/test1.go | Go | go | 359 | no_license | package main
import "fmt"
// func aa(a int) {
// fmt.Println(a)
// }
func main() {
// var a = aa(10) //函数未返回值,就不能赋值给变量
// fmt.Println(a)
a := []int{1 ,3}
var b [2]int
fmt.Println(a)
fmt.Println(a , len(a), cap(a))
fmt.Println(b)
var z []int
fmt.Println(z, len(z), cap(z))
if z == nil {
fmt.Println("ni... |
a4328024deb0d4abb374ef8056cf3c0beaf7f9a4 | 11b0645d6ae23b3b4831d6e5f207c0e349654408 | rmistry/skia-buildbot | /fuzzer/go/common/common.go | Go | go | 13,618 | permissive | package common
import (
"sort"
"strings"
"go.skia.org/infra/go/sklog"
)
const (
TEST_HARNESS_NAME = "fuzz"
UNKNOWN_FUNCTION = "UNKNOWN"
UNKNOWN_FILE = "UNKNOWN"
ASSEMBLY_CODE_FILE = "[assembly code]"
UNSYMBOLIZED_RESULT = "UNSYMBOLIZED"
UNKNOWN_LINE = -1
ASAN_OPTIONS = "ASAN_OPTI... |
2918362178055552ca77a6699fff0bf578ec2a52 | e4bb8ebadb3a65aec6411bee265aca63c7c943dd | johnbirdau/pulumi-azure-native | /sdk/go/azure/network/v20200601/privateDnsZoneGroup.go | Go | go | 7,915 | 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 v20200601
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Private dns zone group resource.
type... |
1d8606e63f86acd30a742b1abb586d91362c9133 | afbcf036b1d28c6337b61e6c7f547d8b6e66c550 | FranklinHarry/devspace-cloud-plugin | /pkg/cloud/resume/resume.go | Go | go | 2,958 | no_license | package resume
import (
"context"
"time"
"github.com/devspace-cloud/devspace-cloud-plugin/pkg/cloud"
"github.com/devspace-cloud/devspace/pkg/devspace/kubectl"
"github.com/devspace-cloud/devspace/pkg/util/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/pkg/errors"
)
//SpaceResumer can resume a ... |
b62889e2078bad93dd9606472a42236adcbdae9b | fd186115decdfb8d6b0aa627e5d79893a55e2c74 | ledgerfoundation/gosync | /pkg/s3_uploader.go | Go | go | 1,277 | permissive | package pkg
import (
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
type S3BucketUploader struct {
Bucket string
session *session.Session
s3client *s3.S3
}
func NewS3BucketUploader(bucket, awsProfile string) *S3BucketUploader {
... |
ecdb9a16a2b44bfe63d25627949247b02a9951c0 | 21bc6c67fd2202847c807b791498f890ed3f3a1c | iainaff/tinygo | /compiler/llvmutil/llvm.go | Go | go | 6,345 | permissive | // Package llvmutil contains utility functions used across multiple compiler
// packages. For example, they may be used by both the compiler pacakge and
// transformation packages.
//
// Normally, utility packages are avoided. However, in this case, the utility
// functions are non-trivial and hard to get right. Copyin... |
3c028997a74edbb5e47eb20b389b02831d396671 | c74da4df5d2549d44cebfcd56bf1f6df66d96a44 | mattcui/bosh-softlayer-cpi-release | /src/bosh-softlayer-cpi/softlayer/vps_service/models/vm_state.go | Go | go | 880 | permissive | package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
)
// VMState Vm state
// swagger:model VmState
type VMStat... |
6839b4ff1053a789cf821e8df8ea64d2727657e0 | b7e49dcd146e3d7b6c485ba0a887d8cd4b997e18 | wayne8668/dpm | /routers/options_router.go | Go | go | 202 | no_license | package routers
var (
optionsRouter = ControllerRouter{
Route{
Name: "options_action",
Methods: []string{"OPTIONS"},
Pattern: "/*action",
HandlerFunc: CorsMW(),
},
}
) |
d76a1293fdeb378ba980c0aac7aa4b65e0828f2d | 05e634b7ba8d31bc03969c807ffcbfe90cb0cf8f | xinxiaogang/kubernetes | /pkg/api/register.go | Go | go | 4,503 | 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... |
fa9b94092bcee7df51d1fd050a8a68945f191803 | 8439d4acb42c6b17e6ceb42a56b53c959bcb54bc | megaoctaviaputri/tugas-zero-to-go | /13-Middleware-Structuring/go-restful-training/main.go | Go | go | 452 | no_license | package main
import (
"go-restful-training/config"
"go-restful-training/models"
"go-restful-training/routes"
m "go-restful-training/middlewares"
)
func main() {
e := routes.New()
// implement middleware
m.LogMiddlewares(e)
// migration database
// InitialMigration()
e.Start(":8000")
}
func InitialMigrat... |
e147df3d2d7c5826a1c45f95209909354372ea74 | cf48fd7a2c0f892669d31c876ae0500c9489e2dd | tumelohq/grpc-middleware | /ctxextractor/extractor.go | Go | go | 897 | permissive | package grpcctxextractor
import (
"context"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"google.golang.org/grpc"
)
// Extractor is a function to extract a string out of context
type Extractor func(context.Context) (string, error)
// UnaryServerInterceptor implements the UnaryServerIntercepto... |
5d6c3ef08b00501278d3681ccb5fb285cb230af8 | c50a9a57de8e3469d1c30329e6ce0d4dad2d8dc2 | 0ni0nrings/ccloud-sdk-go | /types.go | Go | go | 4,080 | permissive | package ccloudapi
// User type
type User struct {
ID int `json:"id"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
OrganizationID int `json:"organization_id"`
}
// Session type
type Session struct {
AuthToken string
Use... |
3902ef9d00c55a9772e0e1f9213a8107eeeb8504 | ebbe61a9b00a6ad1ea818b62783a8dd2586adcb0 | andrewhamon/signist | /Godeps/_workspace/src/github.com/alecthomas/template/template.go | Go | go | 6,792 | no_license | // 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.
package template
import (
"fmt"
"github.com/andrewhamon/signist/Godeps/_workspace/src/github.com/alecthomas/template/parse"
"reflect"
)
// common holds the... |
258395b016a9e03cf34ef4b52bc955acc5ce530a | 1f800246fcee9c00c241eaae27b5943b8c45ff7a | OnkelPony/master_go_programming | /Section 8/arrays_and_ops/main.go | Go | go | 1,026 | no_license | package main
import (
"fmt"
"strings"
)
func main() {
var numbers [4]int
fmt.Printf("%v\n", numbers)
fmt.Printf("%#v\n", numbers)
var a1 = [4]int{}
var a2 = [3]int{108, 666, 9}
var a3 = [4]string{"Martin", "Dave", "Andy", "Alan"}
var a4 = [4]string{"x", "y"}
var a5 = [...]int{1, 4, 5}
fmt.Printf("The len... |
d80066093751dc5de9ba2ac80594675b604c9f6c | f482dacba512d68d3b10c5cc19a2ff02af378638 | hashwing/sxiot | /sxiot-uapi/api/app/user.go | Go | go | 2,925 | permissive | package app
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"time"
"github.com/astaxie/beego/logs"
"github.com/dgrijalva/jwt-go"
"github.com/gorilla/context"
"github.com/hashwing/sxiot/sxiot-core/config"
"github.com/hashwing/sxiot/sxiot-core/db"
)
type loginReply struct {
Token string `json:"token"`
}
... |
97adec5768a2850a6dde0fbf35df726fe7d632b0 | e17a9f27f717943335477621cbb8e9718cc9785c | merkeld/gocryptotrader | /exchanges/binance/binance_wrapper.go | Go | go | 19,872 | permissive | package binance
import (
"errors"
"strconv"
"strings"
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocr... |
7410f0de731fcffc1ff3798838f410108fb9cdda | 664177edbd6fd27ac02c868d96c6cde072d62585 | liudanyejiantai/textql | /storage/sqlite_test.go | Go | go | 7,208 | permissive | package storage
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"testing"
"github.com/dinedal/textql/inputs"
"github.com/dinedal/textql/test_util"
)
var (
storageOpts = &SQLite3Options{}
simpleCSV = `a,b,c
1,2,3
4,5,6`
whitespaceValuesCSV = `a,b,c
, ,
1,2,3
4,5,6`
)
func NewTestCSVInput() (input inputs.Inpu... |
549e3df7191b4032f57dc01edda11bbccebeee23 | 6996802b7fe82b99e7cf751bfa8346f57810e7d6 | jamesbloomer/lowest-common-manager-golang | /common_manager_test.go | Go | go | 2,256 | no_license | package main
import (
"fmt"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestIsRunning(t *testing.T) {
fmt.Println("Tests are running")
}
func TestIsFirstSelected(t *testing.T) {
assert.True(t, isFirstSelected(1))
assert.False(t, isFirstSelected(0))
assert.False(t, isFirstSelected(2))
}
... |
9e9742328d3410892bd21d7905c0ba61c803ab87 | db9c18ec9ec6e837e479c02476c82126bc21cf6b | u2lentaru/Patterns | /event_channel/main.go | Go | go | 489 | no_license | package main
import "log"
func main() {
user1 := NewUser("jkulvich")
user2 := NewUser("vasya")
ch1 := NewChannel()
ch1.Subscribe(user1)
ch1.Subscribe(user2)
ch2 := NewChannel()
ch2.Subscribe(user2)
pub := NewPublisher()
pub.AddChannel("test", ch1)
pub.AddChannel("test2", ch2)
if err := pub.Send("HELLO... |
4425521efbf64c19a2a14b33088fc846362c6ba4 | c2dba6b2c7dea53a6d82dd5a1c19f649f46380df | tklikifi/gpgcloud-go | /encrypt/encrypt_test.go | Go | go | 2,519 | no_license | /* Test encrypt and decrypt functions */
package encrypt_test
import (
"bufio"
"fmt"
"github.com/tklikifi/gpgcloud-go/encrypt"
"log"
"os"
"testing"
)
func TestEncryptDecryptF(t *testing.T) {
// Hash is calculated using sha256sum binary
testdata_hash := "962fbfb18614c6f131ab916e4b3acef63b27a4b83d542de5cc6b52b... |
bc3c970913cfb15c26eb7b47871d03232d76effc | 2753584b5916c6d21827daaeda7f3b1c1579f7d8 | piotrb/aws-vault-exec | /env-utils.go | Go | go | 659 | no_license | package main
import (
"os"
"os/exec"
"strings"
)
func hasDirenv() bool {
_, err := exec.LookPath("direnv")
return err == nil
}
func getEnv() []string {
if hasDirenv() {
command := []string{"direnv", "exec", ".", "env"}
cmd := exec.Command(command[0], command[1:]...)
cmd.Env = os.Environ()
output, err :... |
739cd6f216a6a9043a768e974d7e8a202ac16b1e | 8b9266b6d402d2cdb372a1e1d627ab75feed06d6 | portworx/torpedo | /vendor/github.com/oracle/oci-go-sdk/v65/core/detach_service_id_request_response.go | Go | go | 3,971 | permissive | // Copyright (c) 2016, 2018, 2022, 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... |
6b1d954343fbf26f10c48149f0006d87f7632f9a | f078dcb7c2ba3894a8ce9cf13385a2309123a7ea | amit-dhole/LeetCode-in-Go | /Algorithms/0025.reverse-nodes-in-k-group/reverse-nodes-in-k-group.go | Go | go | 880 | permissive | package problem0025
import (
"github.com/SmartsYoung/LeetCode-in-Go/kit"
)
// ListNode defines for singly-linked list.
type ListNode = kit.ListNode
func reverseKGroup(head *ListNode, k int) *ListNode {
if k < 2 || head == nil || head.Next == nil {
return head
}
tail, needReverse := getTail(head, k)
if needR... |
feb1768ab826be325760a0b7afb6e8680489db09 | f14c6ebb603faa66e8c20710ff5e8788a333c330 | harshita-sharma011/cstorpoolauto | /types/cstorclusterconfig.go | Go | go | 4,957 | permissive | /*
Copyright 2019 The MayaData Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... |
2b8fe8157d3d23e7ceb810bde824d63828a1cfee | d53c24e05ed19c17fc920152f3a512659391f07e | zanjs/go-baisc-react-project | /server/main/repo/repo.go | Go | go | 927 | no_license | package repo
import (
"fmt"
"../model"
)
var currentID int
var todos model.Todos
// Give us some seed data
func init() {
RepoCreateTodo(model.Todo{Name: "Write presentation"})
RepoCreateTodo(model.Todo{Name: "Host meetup"})
}
func GetTodo() model.Todos {
return todos
}
//RepoFindTodo will find a Todo item b... |
729091c8dd6bc37e3398bf46d90c804aad9610bf | e652262b4fa61b760d65e62c070593787e876822 | kekeee-shine/Go-Learning-Project | /gee-rpc/day1-codec/codec/gob.go | Go | go | 1,007 | no_license | package codec
import (
"bufio"
"encoding/gob"
"io"
"log"
)
type GobCodec struct {
conn io.ReadWriteCloser
buf *bufio.Writer
dec *gob.Decoder
enc *gob.Encoder
}
var _ Codec = (*GobCodec)(nil)
func NewGobCodec(conn io.ReadWriteCloser) Codec {
buf := bufio.NewWriter(conn)
return &GobCodec{
conn: conn,
... |
e41006d2765da6190c9c3037fb659317200251b1 | 78e4b1e8ee9a000bd316aed45d95ecc8af9a537c | magma/magma | /feg/gateway/services/s8_proxy/test_init/test_service_init.go | Go | go | 1,512 | permissive | package test_init
import (
"context"
"fmt"
"testing"
"magma/feg/cloud/go/protos"
"magma/feg/gateway/registry"
"magma/feg/gateway/services/s8_proxy/servicers"
"magma/feg/gateway/services/s8_proxy/servicers/mock_pgw"
"magma/gateway/mconfig"
"magma/orc8r/cloud/go/test_utils"
)
// StartS8AndPGWService start bot... |
82470509d9b3f39f466dbb67f0766897b5653639 | 711e118b0c8c2b422b7a61363d8fc4ad8e67338c | po-he/FinDataCatcher | /base/dowloader.go | Go | go | 1,434 | no_license | package base
import(
"errors"
"encoding/gob"
"bytes"
"time"
"net/http"
"io/ioutil"
)
//// TODO :
// 1. multi-goroutine 同時寫日志會不會交錯
//
var (
DEFAULT_TIMEOUT_SECOND = 15
)
type DailyDownloadeInfo struct {
//Date
CodeStr string
LastTickDataIndex int32
}
func EncodeDailyDownloa... |
b367538dc201a7270ac0da4425b748de6f58df2b | 0fc8ae5dc9cc0a306f505a455d293d307def4ada | 1Blackdiamondsc/sifnode | /cmd/ebrelayer/txs/registry.go | Go | go | 2,261 | no_license | package txs
// DONTCOVER
import (
"context"
"log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
bridgeregistry "github.com/Sifchain/sifnode/cmd/ebrelayer/contract/generated/bindings/bridgeregistry"
)
// TODO: Update Br... |
2f85483dc4a3841934a4577e2d099a14b2794ebe | 5becb0a2b0f52b0aa249978de81e3fa1379954ad | jjoergensen/dns | /dns.go | Go | go | 6,478 | permissive | // Copyright 2009 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.
// Extensions of the original work are copyright (c) 2011 Miek Gieben
// Package dns implements a full featured interface to the Domain Name System.
// Server- ... |
13e4ecb24c6391b4657bf4f3c59c591f927a4ed8 | 06c4475dad9476a4050be854d017a9c143a3142a | zhang555/parser | /ast/misc.go | Go | go | 56,056 | permissive | // Copyright 2015 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... |
92de62eb578d3899f86a7aae28dd1426428866f7 | 11fc1d8878bd699fea995f12cf17457b300905c1 | coverprice/opentsp | /cmd/tsp-aggregator/config.go | Go | go | 1,420 | permissive | package main
import (
"encoding/json"
"fmt"
"io"
"log"
"os"
"opentsp.org/internal/config"
"opentsp.org/internal/flag"
"opentsp.org/internal/relay"
"opentsp.org/internal/restart"
"opentsp.org/internal/tsdb/filter"
"opentsp.org/internal/validate"
)
type Config struct {
Filter []filter.Rule `... |
a40a99f5a80da0a1015fedca6912c0980bcc5d14 | 3adf0b654807842ccadbf930c5c444584433b82a | virtadpt/letsgo_labs | /jsondic/dictionary.go | Go | go | 258 | permissive | package jsondic
// Entry from a dictionary load
// YOUR_CODE...
// Encode an entry into JSON
func Encode(e Entry) (string, error) {
// YOUR_CODE...
}
// Decode hydrates an entry from JSON
func Decode(raw string) (e Entry, err error) {
// YOUR_CODE...
}
|
1ff9507745b54e4a2eab701635bc0c550a005e12 | 79bf9779274a23cb0ab12096931f452145a00e4e | wangzhen0101/btcutil | /psbt/utils.go | Go | go | 8,471 | permissive | // Copyright (c) 2018 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package psbt
import (
"bytes"
"encoding/binary"
"errors"
"io"
"sort"
"github.com/wangzhen0101/wzbtc/txscript"
"github.com/wangzhen0101/wzbtc/wire"
)
// writeTxWitne... |
df0a31d05b96fc05279fe7624c0fefa2ec855dbb | 83a0e735219750ed86dab0ca9a1e190ea6b2c938 | simpajj/go-parallel-benchmarks | /src/micro-ping/micro-ping.go | Go | go | 384 | no_license | package main
import (
_ "fmt"
"os"
"runtime"
"strconv"
)
func main() {
N, err := strconv.Atoi(os.Args[1]) // Iterations
iCPU := runtime.NumCPU()
runtime.GOMAXPROCS(iCPU)
messages := make(chan string)
for i := 0; i <= N; i++ {
if err == nil {
go func() { messages <- "ping" }()
go func() {
msg :=... |
f2ea441ce573042780e4082ff4d3fd603f574981 | 8587047061a7e90f6a0fd158b02e4afc93bc1989 | madjin/cheat | /internal/cheatpath/filter_test.go | Go | go | 1,126 | permissive | package cheatpath
import (
"testing"
)
// TestFilterSuccess asserts that the proper cheatpath is returned when the
// requested cheatpath exists
func TestFilterSuccess(t *testing.T) {
// init cheatpaths
paths := []Cheatpath{
Cheatpath{Name: "foo"},
Cheatpath{Name: "bar"},
Cheatpath{Name: "baz"},
}
// fil... |
783fce121c01662f0b2615d475fbc6e7f2d1cf58 | 7cc6317c8d6bc4e1746b5d5d04cfbdb5d9eb3f06 | alveraboquet/FirstMiner | /goex/bitstamp/Bitstamp.go | Go | go | 12,713 | permissive | package bitstamp
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"time"
. "zmyjobs/goex"
)
var (
BASE_URL = "https://www.bitstamp.net/api/"
)
var _INTERNAL_KLINE_PERIOD_CONVERTER = map[KlinePeriod]string{
KLINE_PERIOD_1MIN: "60",
KLINE_PERIOD_3MIN: "180",
KLIN... |
5d18fcd4f486db2c9d3a316c1282d660a3e3b99e | c57ddc9746610187be79c7783931e411484bcf56 | xuxiaoyuspallow/toyblockchain | /block.go | Go | go | 1,184 | permissive | package main
import (
"time"
"bytes"
"encoding/gob"
"log"
)
type Block struct {
Timestamp int64
Transactions []*Transaction
PreBlockHash []byte
Hash []byte
Nonce int
}
func NewGenesisBlock(coinbase *Transaction) *Block{
return NewBlock([]*Transaction{coinbase}, []byte{}) //you can write anything on gen... |
597e25ee03b4cd623652a994288bb7d87ffb982c | afd2dd52370dac5848a0997a15e19c72a1fd09c1 | qiaohao9/grpc | /binarylog/binarylog_end2end_test.go | Go | go | 29,572 | permissive | /*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... |
445ef3a7cea555c4aeaa382ba68786f751b29861 | 191c4ccc53e60adcbcc75375d80fb4e1a0fa0fc7 | nekomeowww/exchange-smtp-client | /email/auth.go | Go | go | 461 | no_license | package email
import "net/smtp"
// SMTPAuth SMTPAuth
type SMTPAuth struct {
accessToken string
}
// Auth auth
func Auth(token string) smtp.Auth {
return &SMTPAuth{token}
}
// Start start
func (a *SMTPAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
return "xoauth2", []byte(""), nil
}
// Next next
... |
5b6eb797a09687fdb7fb1e9793c0934b2c85e7a8 | 1227122fa34f4aa0eeec8405ec744a9d28dd6dd8 | hugmatj/weaviate-1 | /usecases/auth/authorization/adminlist/config.go | Go | go | 1,337 | permissive | // _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2021 SeMI Technologies B.V. All rights reserved.
//
// CONTACT: hello@s... |
a1978f919131eb603f74d8d0b221b4e0acc9c1ba | 35e73cc4b99f84bd4b2db2d7444a0d27380d0fe4 | amitsaha/yawsi | /cmd/asgList.go | Go | go | 1,261 | permissive | // Copyright © 2018 Amit Saha <amitsaha.in@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
8f8027b331d70c19e4bd37bbeaf08973eb3be93f | f5e4e1af720cc5e7f4a9b838b5d20ce16c0ea3bd | ionchain/ionchain-core | /core/state/state_object.go | Go | go | 15,323 | no_license | // Copyright 2014 The go-ionchain Authors
// This file is part of the go-ionchain library.
//
// The go-ionchain 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... |
c33e82c5b97e31aee0b6fc880ab9fcb9b1d47a7f | aca4b2b31acdb81ff8dd13d9186d12857aa8df92 | kubernetes/kubernetes | /vendor/golang.org/x/net/http2/go118.go | Go | go | 315 | permissive | // Copyright 2021 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.
//go:build go1.18
// +build go1.18
package http2
import (
"crypto/tls"
"net"
)
func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
return tc.NetConn()
}
|
41d62a70af7d024637a2ae743acbe1ec1d925e81 | 3768f3d221c785fa93906266ee37213cac5ede04 | leapar/engine | /gui/dropdown.go | Go | go | 7,531 | permissive | // Copyright 2016 The G3N 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 gui
import (
"github.com/leapar/engine/gui/assets/icon"
"github.com/leapar/engine/window"
)
// DropDown represents a dropdown GUI element.
type Dro... |
cd44002a18aa8821816ee86e3c3c61ca0169aeec | 0c05001a98fd81ba8710fa8747dc978574c97b2c | tehsphinx/concurrent | /bool_with_status_test.go | Go | go | 1,247 | no_license | package concurrent
import (
"sync"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBoolWithStatus(t *testing.T) {
s := NewBoolWithStatus()
s.Set(false)
assert.Equal(t, false, s.Get())
s.Set(true)
assert.Equal(t, true, s.Get())
s.Set(false)
assert.Equal(t, false, s.Get())
s.Set(false)
assert.Eq... |
827b6ae86ff1c7b1a334faa45ebf57400140c6e9 | f40472a7c39612af0649e4c3a9759a39fbb11807 | ktock/libpod | /test/e2e/create_test.go | Go | go | 16,672 | permissive | package integration
import (
"fmt"
"os"
"path/filepath"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman create", func() {
var (
tempdir string
err error
podmanTest *PodmanTestIntegration
)
BeforeEach(func() {
tem... |
2ef507197bcc463a9aacebead0578dae5d7e769b | db0c14bf3a1448cd0d8b712ee7a52432fc238f7f | YaoZengzeng/Growth | /hyper/daemon/build.go | Go | go | 554 | permissive | package daemon
import (
"strconv"
"github.com/golang/glog"
"github.com/hyperhq/hyper/engine"
)
func (daemon *Daemon) CmdBuild(job *engine.Job) error {
imgName := job.Args[0]
size, _ := strconv.Atoi(job.Args[1])
content := job.Stdin
cli := daemon.DockerCli
_, _, err := cli.SendImageBuild(imgName, size, conte... |
fe5dd2abe154cb9683bc3ed71922de00fbffbe7e | 24f9402ed2dd3676b17b61e0276828478ab5a450 | genius52/leetcode | /src/golang/array/1968. Array With Elements Not Equal to Average of Neighbors.go | Go | go | 378 | no_license | package array
import "sort"
func rearrangeArray1968(nums []int) []int {
var length int = len(nums)
if length <= 2{
return nums
}
sort.Ints(nums)
var res []int = make([]int,length)
var left int = 0
var right int = length - 1
for i := 0;i < length;i += 2{
res[i] = nums[left]
if (i + 1) < length{
res[i ... |
cd80fd437ae170593287013d4dfdf9baf182d640 | dccfd2b06a34f01d8b24d3f98e2ec83c078d6ed0 | leonjza/nutstat | /simpleflux/client.go | Go | go | 1,543 | permissive | package simpleflux
import (
"log"
"net/http"
"strings"
"github.com/spf13/viper"
)
// SimpleInfluxDB is a really primitive influxdb client
type SimpleInfluxDB struct {
c *http.Client
db string
base string
username string
password string
}
// NewSimpleInfluxDB gets a new simple influxdb clie... |
56a7aa49b8f6ec190f79b561a1987659feb9627d | d371713860ba0ca64fb388294d8634c9bf49d4fb | PSNAppz/ChainReaction | /datastore/ds.go | Go | go | 708 | permissive | package datastore
import "github.com/chainreaction/game"
var (
allGameInstances map[string]*game.Instance
activeGameInstances map[string]*game.Instance
)
func init() {
allGameInstances = make(map[string]*game.Instance)
activeGameInstances = make(map[string]*game.Instance)
}
// GetGameInstance returns game in... |
3188a9ed3cad7a4c7ba6c60b27083e5df282e5d6 | 8220577f0d3bbcc3370e4257387189e29bb8ccba | ti/fission | /pkg/executor/executortype/newdeploy/newdeploy.go | Go | go | 16,346 | permissive | /*
Copyright 2016 The Fission 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, sof... |
54487bcaae31ec45efc5da411b1b6d4b46a57d7d | 4e999d852ad4c1bf9ab73dc79df8e297df2cc627 | DataDog/datadog-agent | /pkg/network/dns/snooper.go | Go | go | 7,761 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build (windows && npm) || linux_bpf
package dns
import (
"sync"
... |
af1ef275b98387ffc058e457887c8b44bd5a53c2 | 5e7248348a13eea75a1f1eacb794bae92bb2c8f5 | owulveryck/onnx-go | /backend/testbackend/onnx/onnx_test_mod_int64_fmod.go | Go | go | 1,779 | permissive | package onnxtest
// this file is auto-generated... DO NOT EDIT
import (
"github.com/owulveryck/onnx-go/backend/testbackend"
"gorgonia.org/tensor"
)
func init() {
testbackend.Register("Mod", "TestModInt64Fmod", NewTestModInt64Fmod)
}
// NewTestModInt64Fmod version: 5.
func NewTestModInt64Fmod() *testbackend.TestC... |
daf498f0e33637c6d4697b43d376e93bc094b927 | 25cfe5328b2c49d685191f1e3fae1c75e79ec468 | empire/url-shortener | /internal/shortener/db.go | Go | go | 636 | no_license | package shortener
import (
"github.com/empire/url-shortener/api/models"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
)
func connect() (*pg.DB, error) {
db := pg.Connect(&pg.Options{
User: "postgres",
})
err := createSchema(db)
if err != nil {
return nil, err
}
return db, nil
}
// createSchem... |
ddef1eb6206577a66b5634be44563c5424db219a | dfcf4d1ff803779d91c8ae480a34c625e6f21765 | fossabot/watermill | /internal/tests/asserts.go | Go | go | 1,639 | permissive | package tests
import (
"sort"
"testing"
"github.com/ThreeDotsLabs/watermill/message"
"github.com/stretchr/testify/assert"
)
func difference(a, b []string) []string {
mb := map[string]bool{}
for _, x := range b {
mb[x] = true
}
ab := []string{}
for _, x := range a {
if _, ok := mb[x]; !ok {
ab = appen... |
b11ae04ca94ab1ad654574439676af78df467135 | 91bc6cb66df989f87689ff13382420ed64f6fa00 | FraDiBen/Choose-Your-Own-Adventure | /main_test.go | Go | go | 1,531 | no_license | package main
import (
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"testing"
)
func TestHandler(t *testing.T) {
t.Run("happy path -- game is finished", func(t *testing.T) {
stories := Story(map[string]Arc{
"intro": {
Title: "intro page",
Story: []string{"a", "b", "c"},
... |
b1783db84a79aa31dc2ef3505f424057dff60f6f | dcbb587e2f83feb84ac67bdf790a31f8409b4928 | little-cui/go-chassis | /third_party/forked/afex/hystrix-go/hystrix/hystrix.go | Go | go | 6,450 | permissive | package hystrix
// Forked from github.com/afex/hystrix-go/hystrix
// Some parts of this file have been modified to make it functional in this package
import (
"fmt"
"log"
"sync"
"time"
)
type runFunc func() error
type fallbackFunc func(error) error
// A CircuitError is an error which models various failure state... |
486a7bcab14cf845052c1221c5014ca979f7e173 | a219db7bf5ca0911c1c0b1726f2a8e130b935367 | Moriska32/server | /main.go | Go | go | 781 | no_license | package main
import (
"flag"
"log"
"net/http"
"github.com/Moriska32/server/daemon"
)
var assetsPath string
func processFlags() *daemon.Config {
cfg := &daemon.Config{}
flag.StringVar(&cfg.ListenSpec, "listen", "localhost:3000", "HTTP listen spec")
flag.StringVar(&cfg.Db.ConnectString, "db-connect", "host=/v... |
244cb78926a4513645b92e649a51fc596b95024c | 64880518eaacb01f5904d31176bc850cb23139e8 | lxq2537664558/kcp-go | /sess.go | Go | go | 25,400 | permissive | package kcp
import (
"crypto/rand"
"encoding/binary"
"hash/crc32"
"net"
"sync"
"sync/atomic"
"time"
"github.com/pkg/errors"
"golang.org/x/net/ipv4"
)
type errTimeout struct {
error
}
func (errTimeout) Timeout() bool { return true }
func (errTimeout) Temporary() bool { return true }
func (errTimeout) Err... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.