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 |
|---|---|---|---|---|---|---|---|---|
38cfc2fc01e064052f711ed2fab1d80dd3280ca4 | a6e688b0f20637b8b001dc3ac424d2f48201a6b5 | leachiM2k/go-shorten | /vendor/github.com/mrcrgl/pflog/pkg/encoding/text/encoder.go | Go | go | 1,895 | no_license | package text
import (
"bytes"
"github.com/mrcrgl/pflog/pkg/logging"
"github.com/mrcrgl/bytesf"
"github.com/mrcrgl/timef"
)
type severityStringRep []byte
var (
infoStringRep severityStringRep = []byte("I")
warningStringRep severityStringRep = []byte("W")
errorStringRep severityStringRep = []byte("E")
f... |
9bd6a590217ebfd64be989cd6203f34b6efdb0ff | 6e4d72892f8304f179d40efff479e6010cfc0531 | muskanmahajan37/Golang | /interfaces.go | Go | go | 552 | no_license | // wagp to understand the behavior of Kind() method of reflect package
package main
import (
"fmt"
"reflect"
)
func main() {
var x float64= 3.14
var y interface{} = x
fmt.Println("value:", reflect.ValueOf(x).String())
fmt.Println("value:", reflect.ValueOf(x).Float())
fmt.Println("value:", reflect.TypeOf(y... |
dc3734ffc708ffed638542b7e9a0e32679ea8b7a | c6f834fee43ac32be177d9b41c23d855a0df0b04 | service-exposer/exposer | /service/router_test.go | Go | go | 2,971 | permissive | package service
import (
"net"
"testing"
"github.com/juju/errors"
)
func TestRouter_Prepare(t *testing.T) {
r := NewRouter()
err := r.Prepare("")
if errors.Cause(err) != ErrServiceExist {
t.Fatal("expect(error)", ErrServiceExist, "got", errors.Cause(err))
}
err = r.Prepare("test")
if err != nil {
t.Fa... |
2280dbad30e3c799f4eb570853b68accbefe88bd | 25b8271ca5f21345ebcac41ae04909f9e9902ee3 | lorock/termshark | /cmd/termshark/termshark.go | Go | go | 101,989 | permissive | // Copyright 2019 Graham Clark. All rights reserved. Use of this source
// code is governed by the MIT license that can be found in the LICENSE
// file.
package main
import (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"io"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"... |
973add744ca525ccf1b200846e2ebc774cee2cab | 3fbe1c71dea76734d71e7c7aad43a43ca8c64c9d | aspenmesh/istio | /tests/e2e/tests/bookinfo/demo_test.go | Go | go | 12,867 | permissive | // Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
30110c95cde90e02e52065d538d604985368d9c4 | 17b536992a1c5ccaee8e336c4876872d6bc63497 | vazha/gocryptotrader | /exchanges/coinbasepro/coinbasepro_wrapper.go | Go | go | 27,234 | permissive | package coinbasepro
import (
"errors"
"fmt"
"sort"
"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... |
7d702d62af9e240e8680bc099d5acccb666e5359 | 2903b8a71a4f93a7442855084ae46f0c6a261418 | aavarghese/serving | /pkg/reconciler/autoscaling/kpa/kpa_test.go | Go | go | 63,856 | permissive | /*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
9a2d457de75f097d5e601496085f8698ec398349 | c2424164845dbf498fb38644dae027280183dce8 | minishift/minishift | /pkg/minikube/machine/client_test.go | Go | go | 2,227 | 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... |
9116d3a660d743d4fe8e8cb6c3100b184c9eb6f0 | fb7e3a2119eb17c67d7a9954d191a4acc10c14d8 | mojokertofoss/OffensiveGo | /HybridShell/src/butYbuilder.go | Go | go | 7,528 | no_license | package main
import (
"bufio"
"fmt"
"html/template"
"log"
"net/http"
"os"
"os/exec"
"runtime"
"strings"
"time"
"github.com/gorilla/mux"
)
var butytemplate *template.Template
type DownloadLink struct {
Link string
}
var dwnloadlink DownloadLink
func init() {
butytemplate = template.Must(template.Parse... |
95db8acbe3859518c02a381741ee9512f8ae15cf | 5c01550ef79f7cf8b363db08ced5540531164c4d | viccom/influxdb | /gather/metrics_test.go | Go | go | 3,880 | permissive | package gather
import (
"bytes"
"encoding/json"
"testing"
"time"
"github.com/google/go-cmp/cmp"
)
func TestMetricsReader(t *testing.T) {
cases := []struct {
name string
ms MetricsSlice
wants string
or string
}{
{
name: "single value only",
ms: []Metrics{
{
Name: "cpu_load_short... |
6bb7ea1a9173c9d815a772cadf1b9cb9b2ce8ed9 | b2b8e70adcf717195a5143ee6e8bda156e875db5 | idoqo/refsys | /db/pg.go | Go | go | 10,056 | no_license | package db
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
"github.com/rs/zerolog"
"github.com/shopspring/decimal"
"math/rand"
"strings"
"time"
)
type Config struct {
Host string
Username string
Password string
Port int
Schema string
}
type PgDb struct {
Conn *sql.DB
Logger zerolog.Logger
}
func... |
a2ac1478a95ee6a8ce465f8942463706432409c0 | 9740a299f9def855c9a2128fd3cffc4c2e48d8b8 | phil-mansfield/gotetra | /render/render.go | Go | go | 6,947 | permissive | package render
import (
"log"
"path"
"runtime"
"github.com/phil-mansfield/gotetra/render/density"
"github.com/phil-mansfield/gotetra/render/geom"
"github.com/phil-mansfield/gotetra/render/io"
"github.com/phil-mansfield/gotetra/math/rand"
)
const (
UnitBufCount = 1 << 6
tetraIntr = true
)
var (
NumCores =... |
fa58ebb006f230574ce71e7bb7629a4a272e9f01 | 496cbf5adc26d3d4921980274c582602cc21032a | organization0012/aliyungo | /ecs/route_tables.go | Go | go | 4,861 | permissive | package ecs
import (
"time"
"github.com/bjlhlin/aliyungo/common"
"github.com/bjlhlin/aliyungo/util"
)
type DescribeRouteTablesArgs struct {
VRouterId string
RouteTableId string
common.Pagination
}
type RouteTableType string
const (
RouteTableSystem = RouteTableType("System")
RouteTableCustom = RouteTabl... |
892d21cde9c80505f2dc92dbe53ac67056937820 | 1e579cc06407a6e587be5d84c02b570c34a83f12 | ardeshir/stdlib | /extra/codezip/22/code/image/resize.go | Go | go | 2,135 | permissive | package main
import (
"flag"
"image"
"image/jpeg"
"image/png"
"io"
"log"
"os"
)
var (
jpgout = flag.String("jpg", "", "output to a jpg")
pngout = flag.String("png", "", "output to a png")
in = flag.String("in", "", "input file")
size = flag.Int("size", 0, "the new max dimension")
)
type encf func(io... |
17968643eea279a4e0e7cc5edacc4f0146cb4103 | 9f188d5e3657dca4104ea65dcdafac05f0d531e0 | samaitra/eventing | /pkg/buses/stub/dispatcher/main.go | Go | go | 1,790 | permissive | /*
* Copyright 2018 The Knative Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
838f0afa7a02a923eb080b6cb724233c6e467928 | d8c2cf045d89cc805083b2d1dd04104200d7d8aa | aygit/gloo | /pkg/plugins/google/plugin.go | Go | go | 3,471 | permissive | package google
import (
"net/url"
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"
envoyroute "github.com/envoyproxy/go-control-plane/envoy/api/v2/route"
envoyh... |
e15ed0c8ee9aa02b48131121c9fe7697a14680d8 | f61e25de9eea5f830c1f0b1eb0e8058bf48e2fd3 | asiragusa/benthos | /lib/util/text/function_vars.go | Go | go | 8,212 | permissive | // Copyright (c) 2017 Ashley Jeffs
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, ... |
5348cabf0fd50338a0ef6dbc9db1d562cd24d82f | 2fd303eb669e8797cd209c3959a1976fc85a55d2 | dominodatalab/vagrant-exec | /machine.go | Go | go | 4,223 | permissive | package vagrantexec
import (
"bufio"
"fmt"
"strings"
)
const (
// Unknown represents any unhandled state.
Unknown MachineState = iota
// Aborted means the VM was abruptly stopped without properly closing the session.
Aborted
// GuruMeditation means that an internal error in VirtualBox caused the VM to fail.
... |
be7d69eb687f45ad6042256a5622310f24f39688 | 0ffe5ce082cc246ea2c4c68321352ced5eb9783d | pperret/GoExercices | /Chapter-13/Exercice-3/bzip/bzip2.go | Go | go | 2,077 | permissive | // Package bzip provides a writer that uses bzip2 compression (bzip.org).
package bzip
/*
#cgo CFLAGS: -I/usr/include
#cgo LDFLAGS: -L/usr/lib -lbz2
#include <bzlib.h>
#include <stdlib.h>
bz_stream* bz2alloc() { return calloc(1, sizeof(bz_stream)); }
int bz2compress(bz_stream *s, int action,
char *in, ... |
ea9ad1190ef8f25a138da9ccd21b48228a1bf29d | e7048faaaa1db7a11b7364f11e4797a88e07fa05 | Julian-Chu/Leetcode-golang | /leetcode/leetcode165/leetcode165_test.go | Go | go | 987 | no_license | package leetcode165
import "testing"
func Test_compareVersion(t *testing.T) {
type args struct {
version1 string
version2 string
}
tests := []struct {
name string
args args
want int
}{
{
name: "0.1 vs 1.1",
args: args{
version1: "0.1",
version2: "1.1",
},
want: -1,
},
{
name... |
bb0f771e87541c83921472b3da25ef82d582886f | 6556b1f6ac7eb22b08bacb9c1ffcefae5843f0b3 | achimweigel/component-cli | /pkg/commands/ctf/add_test.go | Go | go | 1,487 | no_license | // SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors.
//
// SPDX-License-Identifier: Apache-2.0
package ctf_test
import (
"context"
"github.com/gardener/component-spec/bindings-go/ctf"
testlog "github.com/go-logr/logr/testing"
"github.com/mandelsoft/vfs/pkg/layerfs"
"gith... |
75144465999d26c1dd20eb54187e663890e12d90 | 87678bef053ad31fee6e2afca64fddc61b718481 | DGHeroin/rpc | /p2p.go | Go | go | 415 | no_license | package rpc
import "time"
func NewP2PServer() *Server {
return &Server{
ReadWriteTimeout: time.Second * 10,
servant: NewServant(),
}
}
func NewP2PClient(addr string) *Client {
cli := &Client{
ReadWriteTimeout: time.Second * 10,
servant: NewServant(),
... |
007de29231681cb2d2900477f3ecba081c84b296 | e389aaf165634899852697f7a92354ee262cd35f | Rennbon/boxwallet | /signature/txutil_test.go | Go | go | 4,005 | no_license | package signature_test
import (
"fmt"
"reflect"
"testing"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil/hdkeychain"
"math/big"
"github.com/ethereum/go-ethereum/accounts"
"... |
79dc7c3adb8c8aec3899b8686e68d71ae688705b | d34930c83edff88de23a476cc6e9ee2691aafe82 | rl1987/spiderswarm | /lib/urljoinaction_test.go | Go | go | 1,499 | permissive | package spsw
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestURLJoinActionRun(t *testing.T) {
action := NewURLJoinAction("http://example.com/directory/")
relativeURLStr := "../../..//search?q=golang"
absoluteURLStr := "http://example.com/search?q=golang"
inDP := NewDataPipe()
outDP := New... |
bb28831141767c49aef342edebe6a07bbaec073b | 3b9c5fdf5d1a30e4214cced0ccfcebf11a60864e | LonelyPale/goutils | /encoding/msgpack/msgpack_test.go | Go | go | 597 | permissive | package msgpack
import (
"testing"
"github.com/vmihailenco/msgpack/v5"
)
func Test(t *testing.T) {
type User struct {
Id string
Name string `msgpack:"-"`
}
v := User{
Id: "123",
Name: "tom",
}
bs, err := msgpack.Marshal(v)
if err != nil {
t.Fatal(err)
}
var user User
if err := msgpack.Unm... |
264aa998170698d12cd8e22ef8ecddb0a8b39550 | d1c853c43bf66c9a11b7fb1c32944a74ee54438d | gmpify/pumba | /pkg/chaos/docker/stop.go | Go | go | 3,682 | permissive | package docker
import (
"context"
"time"
"github.com/alexei-led/pumba/pkg/chaos"
"github.com/alexei-led/pumba/pkg/container"
"github.com/alexei-led/pumba/pkg/util"
log "github.com/sirupsen/logrus"
)
const (
// DeafultWaitTime time to wait before stopping container (in seconds)
DeafultWaitTime = 5
)
// StopC... |
afbc1080ffec32010bb64098fb8ba1f296a6bd85 | 835362d5b5970b771fd7911bedbdc7ca7ba35d05 | csyfek/ringcentral-go | /definitions/serviceproviderconfig.go | Go | go | 484 | no_license | package definitions
// ServiceProviderConfig Service Provider Config
type ServiceProviderConfig struct {
AuthenticationSchemes []AuthenticationScheme `json:"authenticationSchemes"`
Bulk BulkSupported `json:"bulk"`
ChangePassword Supported `json:"changePassword"`
Etag Supported `json:"etag"`
Filter FilterSupported... |
bef560f66963df4ad2b8b0e27d4af362ff8ebeae | 4a020f7bd017a73aaf875eb3bf847e8ce53ce94f | jjacob27/go-learning | /assignment3-interfaces/main.go | Go | go | 451 | no_license | package main
import (
"fmt"
"io"
"os"
"strings"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Missing file arguement")
os.Exit(1)
}
filename := os.Args[1]
filename = strings.TrimSpace(filename)
fmt.Println("Attempting to open file = ", filename)
f, err := os.Open(filename)
if err != nil {
fm... |
0e938b4c67b480539056c5cb8f85cd9b801cea2d | f6631425ee1c35afdb226247ec9d23b8622d99d5 | nataliechen1/git-lfs | /lfs/gitscanner_refs.go | Go | go | 4,213 | permissive | package lfs
import (
"encoding/hex"
"regexp"
"github.com/git-lfs/git-lfs/config"
"github.com/git-lfs/git-lfs/git"
)
var z40 = regexp.MustCompile(`\^?0{40}`)
type lockableNameSet struct {
opt *ScanRefsOptions
set GitScannerSet
}
// Determines if the given blob sha matches a locked file.
func (s *lockableNameS... |
a019e7a612130c107fbde85c0fdaa47228057aa5 | a353371af3d55d3377c2447f65a636d75aea6771 | senarukana/goplayground | /transactionlog/main.go | Go | go | 698 | no_license | package main
import (
"log"
"os"
"path/filepath"
"strings"
)
var (
START = "START"
END = "END"
COMMIT = "COMMIT"
CKPT = "START CKPT"
ABORT = "ABORT"
)
func main() {
if len(os.Args) != 3 {
log.Printf("usage %s <logtype>(undo,redo,redo-undo) <logfile>\n, ", filepath.Base(os.Args[0]))
os.Exit(1)
}... |
34433321ae46de2ee3ab977984578a39c5e0df71 | e0bb55576ef53eedc91da2f13f9630275f205bbd | icobani/creatingWebAppWithGo | /MVCViewLayer/DeliveryStaticAssest.go | Go | go | 2,414 | permissive | /******
* B1 Yönetim Sistemleri Yazılım ve Danışmanlık Limited Şirketi
* B1 Digitial
* http://www.b1.com.tr
*
*
*
* Date : 27/12/2016
* Time : 23:04
* Developer : ibrahimcobani
*
*******/
package MVCViewLayer
import (
"net/http"
"os"
"text/template"
"strings"
"bufio"
"fmt"
)
func DeliveryStaticAss... |
8c0b1b39332cca5024eab2def3d7eff4ba7a2f88 | 80fcc36e514dab7043432575f1d8e2b01f23b079 | arno99x/go_study | /base/007_struct_interface/duck/green/Duck.go | Go | go | 232 | no_license | package green
import (
"strconv"
)
type Duck struct {
Color string
Weight float64
GreenValue string
}
func (duck *Duck) GetInfo() string {
return duck.Color + " , " + strconv.FormatFloat(duck.Weight, 'E', -1, 64)
}
|
1f510ec8bca63285bf6ef615912d037754682bd0 | bed351d1ee8871a41f59df039bd74dac57fccc52 | RafelCorsten/serverHuD | /hud-server/main.go | Go | go | 2,718 | no_license | package main
import (
"crypto/rand"
"crypto/tls"
b64 "encoding/base64"
"fmt"
"log"
"net"
"net/http"
"os/exec"
"strconv"
"strings"
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/host"
)
var configUrl = "http://jamesdchase.co... |
a8db94ca5b029ee0c2d3493ed9b95df33a27eea9 | 0dbfa3a302e0dd81ef179bab0bde1b15fb99c413 | gbonnefille/tusc | /internal/util/docopt.go | Go | go | 448 | permissive | package util
import (
"github.com/docopt/docopt-go"
"strconv"
)
func GetInt64(arg docopt.Opts, key string) int64 {
s, _ := arg.String(key)
i, _ := strconv.ParseInt(s, 10, 64)
return i
}
func GetBool(arg docopt.Opts, key string) bool {
v, _ := arg[key]
if b, ok := v.(bool); ok {
return b
}
return false
}
... |
eadcf74c074f3a86a8fbde0f18ac73166c9e0510 | 57c7a9ffb449a060c77298820bdd8b6da0a711d7 | cloudfoundry/cli | /integration/v7/global/update_security_group_command_test.go | Go | go | 7,009 | permissive | package global
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"code.cloudfoundry.org/cli/integration/helpers"
"code.cloudfoundry.org/cli/resources"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("update-... |
3e4d51539643231eed53987a144f27d27ab02c0c | 282484063bad52eb2082d0841134aef667163e7c | jrkhan-bot/flow-cli | /pkg/flowkit/arguments.go | Go | go | 4,769 | permissive | /*
* Flow CLI
*
* Copyright 2019-2021 Dapper Labs, 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 appl... |
ceb37f006a81ce94eb4265658f78fcf7641e1ad7 | 9db56dee6b2693d1f21802c185796fb327731350 | petersellars/go-hello | /prime-concurrency.go | Go | go | 950 | no_license | // This sample program demonstrates how to create goroutines and
// how the scheduler behaves.
package main
import (
"fmt"
"sync"
)
// wg is used to wait for the program to finish
var wg sync.WaitGroup
// main is the entrypoint for all Go programs
func main() {
// Add a count of two, one for each goroutine.
wg.... |
641327f1231c4debf32852e0487e33fb7bbad70d | f3be2967205c4f98ad51fb9b83c7ededd5088b10 | zxDiscovery/serving | /pkg/activator/throttler_test.go | Go | go | 9,106 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
79dbe86a75158d37e23057c5e02ea566c27f3437 | a4caed35578476915bcc6e439764897fe92d3446 | gusseleet/lora-simulator | /vendor/github.com/brocaar/lorawan/mac_commands.go | Go | go | 21,216 | permissive | //go:generate stringer -type=CID
package lorawan
import (
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"sync"
)
// macPayloadMutex is used when registering proprietary MAC command payloads to
// the macPayloadRegistry.
var macPayloadMutex sync.RWMutex
// CID defines the MAC command identifier.
type CID byte... |
7da12dc3fc165e9bd22d73b5000e305e11bc4f4c | 47f89d1f09444f4c5e4c27611beadd34d08ea6c0 | 188660660/FullStack-go | /Go07-练习篇/ch2【一处不理解】/constant_test/constant_try_test.go | Go | go | 269 | no_license | package constant_test
import "testing"
const(
a = iota + 1 //快速设置连续的值
b
c
)
//标记★
const(
d = 1 << iota
e
f
)
func TestConstTry1(t *testing.T) {
t.Log(a,b,c)
}
func TestConstTry2(t *testing.T) {
d := 0
t.Log(d&d == d,d&e==e,d&f==f)
}
|
b666daebda1b2e29bc290f3eec062d5349ee082c | e2318ab91be33880de57e53ddde30980d6e1817e | DonaldJoao/twittor | /models/devuelvoTweets.go | Go | go | 450 | no_license | package models
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// DevuelvoTweets es la estructura con la que devolveremos los tweets
type DevuelvoTweets struct {
ID primitive.ObjectID `bson:"_id" json:"_id,omitempty"`
UserID string `bson:"userid" json:"userId,omitempty"`
Mensaje... |
e694f56a14028733706212191d3c6ae4745b7f47 | c4da7fc29807c2aee261a178add0d36bad09fd8f | timburks/google-api-go-client | /pubsub/v1beta1a/pubsub-gen.go | Go | go | 104,581 | permissive | // Copyright 2021 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package pubsub provides access to the Cloud Pub/Sub API.
//
// This package is DEPRECATED. Use package cloud.google.com/go/pubsub instead.
//
//... |
cb812c5d8418886e802ce5536cc63d8468e359fd | dcbf9add223d8a6321fc1f02edba55516f692470 | yutaro1985/compro-source | /AtCoder/ABC/abc132/a/A.go | Go | go | 3,560 | no_license | package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
const (
initialBufSize = 1e4
maxBufSize = 1e6 + 7
)
var buf []byte = make([]byte, initialBufSize)
var sc = bufio.NewScanner(os.Stdin)
func init() {
sc.Split(bufio.ScanWords)
sc.Buffer(buf, maxBufSize)
}
// 問題によって値は調整する
const (
mod = int(... |
cb8a03ccf55f227ff9c2d33ea4924ff525388d9b | 996306bebb6756c8dca2b33a2775064e993434f6 | ayushrkt123/Interview-Preparation | /Topics/Stack/Evaluate Reverse Polish Notation/main.go | Go | go | 641 | no_license | package main
import (
"fmt"
"strconv"
)
//Question Link: https://leetcode.com/problems/evaluate-reverse-polish-notation/
func main() {
arr := []string{"2", "1", "+", "3", "*"}
fmt.Println(evalRPN(arr))
}
func evalRPN(tokens []string) int {
res := []int{}
for _, e := range tokens {
n := len(res)
switch e ... |
6d627e798f29fe3b16fc975d2218e9734b229939 | 6d63bb005cf4e832231050e1ab630744cdf45788 | gqlxj1987/logs | /logs_test.go | Go | go | 1,992 | no_license | package logs
import (
"testing"
"github.com/cgCodeLife/logs/context"
)
func TestDefaultLogger(t *testing.T) {
SetLevel(LevelTrace)
AddProvider(NewConsoleProvider())
Trace("Trace")
Debug("Debug")
Info("Info")
Notice("Notice")
Warn("Warn")
Error("Error")
Fatal("Fatal")
Flush()
t.Log("Test Logger Pass.")
}... |
4db6043888133c5c6d01b85ec5775c89696d11f6 | 06407664548a52a03db1e6d2f32b81d6f6c40fe0 | zerocurve/goptuna | /_examples/enqueue_trial/main.go | Go | go | 1,314 | permissive | package main
import (
"log"
"math"
"github.com/c-bata/goptuna"
"github.com/c-bata/goptuna/rdb"
"github.com/c-bata/goptuna/tpe"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
func objective(trial goptuna.Trial) (float64, error) {
x1, _ := trial.SuggestUniform("x1", -10, 10)
x2, _ := t... |
dd9d5d5af3b5902ac436d96edee317a7cc511eed | 97ed06b12ee7b079b3e33cfcabc77d6d42dc9121 | peterdocter/youku-3 | /video_test.go | Go | go | 1,188 | no_license | package youku
import (
"io/ioutil"
"testing"
)
func TestYoukuParse(t *testing.T) {
data, err := ioutil.ReadFile("data.json")
if err != nil {
t.Error(err)
}
r := new(Youku)
err = r.Parse(&data)
if err != nil {
t.Error(err)
}
//logger.Printf("%v", *r)
}
func TestNewYouku (t *testing.T) {
id := "XMjI2... |
038aed723bbbded37100ae15e733906f8b655ded | 55e6aa8b28cf91af81f40b43b65cf72ff6e37219 | Vorringer/oci-go-sdk | /datasafe/connection_option.go | Go | go | 2,678 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
681539b592888106ada74b3c27a27e427b0b3f1c | 2ed1f12aaf64a7a0b94da3f54bb278f6396bc0a2 | Shenung/191T-Go | /presentationEx/memCh/main.go | Go | go | 2,492 | no_license | package main
import (
"encoding/json"
"net/http"
"strconv"
"google.golang.org/appengine"
"google.golang.org/appengine/datastore"
"google.golang.org/appengine/log"
"google.golang.org/appengine/user"
)
type ToDo struct {
ID int64 `datastore:"-"`
Email string `json:"-"`
Text string
}
func init() {
http... |
7b1906e340f049feb89e59a87dacf86745bef04c | b7b399ddbe20434c612833bd6d576607a39db748 | adpjay/interlock | /ext/lb/utils/alias_domains_test.go | Go | go | 677 | permissive | package utils
import (
"testing"
ctypes "github.com/docker/docker/api/types/container"
"github.com/ehazlett/interlock/ext"
)
func TestAliasDomains(t *testing.T) {
cfg := &ctypes.Config{
Labels: map[string]string{
ext.InterlockAliasDomainLabel + ".0": "foo.bar",
ext.InterlockAliasDomainLabel + ".1": "bar.... |
5afe39f92216404364594a2ff7847a09cce582ac | 947a0dada99eb2da849e44402955e425ac80722a | golint-fixer/lark | /lib/lark/lark.go | Go | go | 630 | permissive | //go:generate ./build_lib.sh
package lark
import (
"github.com/bmatsuo/lark/gluamodule"
"github.com/bmatsuo/lark/lib/doc"
"github.com/bmatsuo/lark/lib/fun"
"github.com/bmatsuo/lark/lib/lark/core"
"github.com/bmatsuo/lark/lib/lark/task"
"github.com/yuin/gopher-lua"
)
// Module is a gluamodule.Module that loads ... |
d3d003e3c087498153aa9de461b7fe523ddcee13 | d2b2665dc94d0fc2079b13204e4f510008585062 | BastienBalaud/signmykey | /builtin/signer/local/Signer.go | Go | go | 3,331 | permissive | package local
import (
"crypto/rand"
"encoding/binary"
"fmt"
"io/ioutil"
"time"
"github.com/pkg/errors"
"github.com/signmykeyio/signmykey/builtin/signer"
"github.com/spf13/viper"
"golang.org/x/crypto/ssh"
)
// Signer struct represents local options for signing SSH Key.
type Signer struct {
CACert ... |
818c5b2a1ddcb7a136b08f6432fdd7e8d15e00db | 6a85121c6d40314c20ae9fc9358788678d87acf5 | isotopsweden/docker-farmer | /vendor/github.com/docker/docker/client/client.go | Go | go | 4,487 | permissive | package client
import (
"fmt"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/docker/docker/client/transport"
"github.com/docker/go-connections/tlsconfig"
)
// DefaultVersion is the version of the current stable API
const DefaultVersion string = "1.23"
// Client is the API client that perfor... |
675d1fd9c99642fd931550d6ff82640e041f6bcf | c3bce8d73f19e04ab1887b830550b958c06e4a10 | Gel0bmstu/2019_1_Kasatiki | /main_test.go | Go | go | 5,709 | no_license | package main_test
import (
"."
"encoding/json"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
)
var testInstance main.App
func executeRequest(req *http.Request) *httptest.ResponseRecorder {
rr := httptest.NewRecorder()
testInstance.Router.ServeHTTP(rr, req)
return rr
}
func checkResponseCode(t *... |
a156fedc9101440fb0a3c87a7319f2cf232337bb | dc58f603d2b4562424936c739d04f1a2cd4b59d3 | richhx/core | /x/ref/runtime/internal/testing/concurrency/sync/sync.go | Go | go | 1,494 | permissive | // Copyright 2015 The Vanadium 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 sync
import (
"sync"
"v.io/x/ref/runtime/internal/testing/concurrency"
)
// Mutex is a wrapper around the Go implementation of Mutex.
type Mu... |
e992aa1a2c92508d4b0da039766ea5390f5436b6 | d90b8c607ac8c03507f5598956664745bab83638 | Rusty-Trueno/kubeedge | /cloud/pkg/cloudhub/channelq/channelq.go | Go | go | 11,422 | permissive | package channelq
import (
"fmt"
"strings"
"sync"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
beehiveContext "github.com/kubeedge/beehive/pkg/core/context"
beehiveModel "github.com/kubeedge... |
ae746a5f02cfba3c8ea7c390789ae76b224d3fa1 | b853e6f0d9241f0ff7f2a5cb252753d32f9a8387 | ribtoks/listing | /cmd/listing-cli/subscribe.go | Go | go | 1,601 | permissive | package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/ribtoks/listing/pkg/common"
)
var (
errMissingNewsletter = errors.New("Newsletter parameter is empty")
errMissingEmail = errors.New("Email parameter is empty")
)
func (c *listingClient) sendSu... |
3dbf12d4d94d07ea7d5ddab53bf7d7f56e5f3243 | 5c34558d387ddd76950ec3002eb42be9c71ed2d2 | LINBIT/drbd-flex-provision | /vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion/fake/fake_authorization_client.go | Go | go | 1,561 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
3ec6f92d2ca66f983049dbae76788fddea201703 | a2e3f71ed0bd69559de107c82759ddbfd82e59e9 | Kern--/Cryptopals | /krypto/singlebytexor.go | Go | go | 1,976 | no_license | package krypto
import (
"math"
"encoding/hex"
"github.com/kern--/Cryptopals/util"
)
type singleByteXorResult struct {
input string
plainText []byte
key byte
score float64
}
// CrackSingleByteXor takes a byte array which has been xor'd against a single byte
// and finds the byte which it was x... |
50cd29cd3492bd48f8cbe4b194581ee6bdf488b0 | c1e76694d799642e44f75c3cd341ecb66a11c305 | fabricioism/gozxing | /datamatrix/decoder/decoded_bit_stream_parser.go | Go | go | 16,494 | permissive | package decoder
import (
"strconv"
"golang.org/x/text/encoding/charmap"
"github.com/makiuchi-d/gozxing"
"github.com/makiuchi-d/gozxing/common"
)
// Data Matrix Codes can encode text as bits in one of several modes, and can use multiple modes
// in one Data Matrix Code. This class decodes the bits back into text... |
bacebe7a0abc773ddc5ed74acdcef728139204b3 | 59d1abae3ed1deac4f97ac59f39c2ae23dd8b0ce | sheeeng/sandbox | /go/hello.go | Go | go | 1,114 | permissive | package main
import "fmt"
func main() {
fmt.Printf("Hello, Go 世界!\n")
fmt.Printf("%s\n", `( ꒪Д꒪)ノ`)
fmt.Printf("%s\n", `☆*・゜゚・*\(^O^)/*・゜゚・*☆`)
fmt.Printf("%s\n", `٩(^ᴗ^)۶`)
fmt.Println(len("Hello World"))
fmt.Println("Hello World"[1])
fmt.Println("Hello " + "World")
const loremIpsum string = "Lorem Ipsum"
... |
28114c5ad3f23278711ca653c813cf340b16a61d | 3a5b3277fa7a55b1a06bcbad65c8cecf2bcd7b83 | bpkgoud/pulumi-azure-native | /sdk/go/azure/security/alertsSuppressionRule.go | Go | go | 4,830 | permissive |
package security
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type AlertsSuppressionRule struct {
pulumi.CustomResourceState
AlertType pulumi.StringOutput `pulumi:"alertType"`
Comment pulumi.StringPtrOutp... |
ab5f4a058de911ceff0e7484eb4e1bf73970970a | 3ca3fd6930645d246a1ab30171458aa51d58b06a | qiniu/logkit | /vendor/gopkg.in/olivere/elastic.v5/search_aggs_bucket_missing.go | Go | go | 2,401 | permissive | // Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// MissingAggregation is a field data based single bucket aggregation,
// that creates a bucket of all documents in the... |
9c1368f77a610e6dfb77b3383555c889ea4876d1 | afe5399a1eabbcf76116e70a5bf6a72928f3cff3 | 1307super/carbon | /const.go | Go | go | 3,900 | permissive | package carbon
import "time"
// 版权信息
const (
Version = "v1.2.2"
Author = "gouguoyin"
Email = "mail@gouguoyin.cn"
Blog = "www.gouguoyin.cn"
)
// 时区常量
const (
Local = "Local"
CET = "CET"
EET = "EET"
EST = "EST"
GMT = "GMT"
UTC = "UTC"
UCT = "UCT"
MST = "MST"
Cuba = "Cuba"
Egypt ... |
cf2aa04687f1985b4c21cfce9c19f4a1db940cd1 | 5cc6bab7f6d9a96acaddbd00757f3cb92fda9bf9 | bamaplumbcrazy/sourcegraph | /enterprise/cmd/frontend/internal/registry/publisher_graphql.go | Go | go | 4,524 | permissive | package registry
import (
"context"
"errors"
"fmt"
"github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
"github.com/sourcegraph/sourcegraph/cmd/frontend/backend"
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
frontendregistry "github.com/sourcegraph/sourcegraph/... |
e514af252efb5948df28d180bbbd65de9a12981b | 53cf61b01f710d6807c96a314a55f9557a2a863e | enzoism/beego_myBlog | /controllers/default.go | Go | go | 381 | no_license | package controllers
import (
"github.com/astaxie/beego"
"fmt"
)
type MainController struct {
beego.Controller
}
func (c *MainController) Get() {
c.Data["Website"] = "beego.me"
c.Data["Email"] = "astaxie@gmail.com"
c.TplName = "index.tpl"
}
func (this *MainController) Go404() {
fmt.Println("-----------------... |
287756bd822e82e0bfd816c2c61d45670b019a4f | bb9c2cd9cc9f674d4ff28b1154d40cf4098a498e | behroozam/linkerd2 | /pkg/profiles/template.go | Go | go | 2,324 | permissive | package profiles
// Template provides the base template for the `linkerd profile --template` command.
const Template = `### ServiceProfile for {{.ServiceName}}.{{.ServiceNamespace}} ###
apiVersion: linkerd.io/v1alpha1
kind: ServiceProfile
metadata:
name: {{.ServiceName}}.{{.ServiceNamespace}}.{{.ClusterZone}}
name... |
e34934c10af243fe5aa13778a371f94d7ad8626d | 1bbe905f54c46fc879f16fb2fd2657ceab301abd | GoWXL/zinx | /zinx/znet/request.go | Go | go | 746 | no_license | package znet
import "zinx/ziface"
//链接和数据绑定模块
type Request struct {
//链接信息
conn ziface.IConnection
/*//数据内容
data []byte
//数据长度
len int*/
//得到消息的数据
msg ziface.IMessage
}
//初始化方法
func NewRequest(conn ziface.IConnection, msg ziface.IMessage) ziface.IRequest {
req := &Request{
conn: conn,
msg: msg,
}
re... |
c0c055e58f6a5641bf9f029d674d1dcc013b6d57 | 33f30a971e9b8b8be9422fbe61e352a126b1e363 | aruaru0/golang_myatcoder | /PM9/ABC/abc264/A/main.go | Go | go | 1,784 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
func getF() ... |
33ce89918bb4cdd0c5b8bd0e91542efe9c866086 | a2c5f5da4afade8f1881fb497ac8f901ee60bad6 | sirdesmond/serverless-eventbus | /endpoints/subscriptions/create/main.go | Go | go | 1,008 | no_license | package main
import (
"net/http"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/awslabs/aws-lambda-go-api-proxy/gin"
"github.com/gin-gonic/gin"
"github.com/sirdesmond/serverless-eventbus/eventbus"
)
var initialized = false
var ginLambda *ginadapter.GinLambda
func Handl... |
a431b859953488efbf478d2bc02f90b639bf06ae | e2fc8f34df1bc7ee14b69ced75e54bf20445aa89 | rna-afk/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/model_contentsource.go | Go | go | 429 | permissive | package dscnodeconfiguration
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type ContentSource struct {
Hash *ContentHash `json:"hash,omitempty"`
Type *ContentSourceType `json:"type,omitempty"`
... |
a022c4b24e1cfeea5b9a59c2f31c57080aaf63c8 | b8488cfb497dc0b36fc094599f847a6d38bdb571 | baloo/bird_exporter | /metrics/generic_exporter.go | Go | go | 10,625 | permissive | package metrics
import (
"github.com/czerwonk/bird_exporter/protocol"
"github.com/prometheus/client_golang/prometheus"
)
type GenericProtocolMetricExporter struct {
labelStrategy LabelStrategy
upDesc *prometheus.Desc
importCountDesc *prometheus.Desc
exp... |
2cf0dcc24fd5797be8ad5e84455f8576c523e8ef | a103193fe88fd8c79409664afbcce363a2de9419 | hyeth/kubernetes | /pkg/kubectl/cmd/create_service.go | Go | go | 8,028 | 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, ... |
af57f4b0adf6325fa38ec1d1a5212411a8fd2351 | e9c703ee630a31fbced5827a5ed57c52f7832608 | NickyMateev/compass | /components/kyma-environment-broker/internal/lms/client.go | Go | go | 11,774 | permissive | package lms
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/json"
"encoding/pem"
"fmt"
"io/ioutil"
"net/http"
"github.com/hashicorp/go-multierror"
"github.com/kyma-incubator/compass/components/kyma-environment-broker/internal/iosafety"
"github.com/pkg/errors"
"gith... |
c5125fe94b158bb7f457ae8b3b293cfb9e15ecdd | 623a515b86c989982348cbb6225ae6a26d7fc9d4 | Shyp/rest | /example_test.go | Go | go | 2,615 | permissive | // +build go1.7
package rest_test
import (
"bufio"
"bytes"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"github.com/Shyp/rest"
)
func ExampleRegisterHandler() {
rest.RegisterHandler(500, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
err := rest.CtxErr(r)
fmt.Println("Server... |
46dae8f5b0d685f9fd85a984e70aefc0bf29b0bd | fdba589db74c1d7e009d25ed6d961a67cde0d156 | microsoftgraph/msgraph-beta-sdk-go | /drives/item_items_item_workbook_functions_gamma_ln_precise_post_request_body.go | Go | go | 6,204 | permissive | package drives
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
ie8677ce2c7e1b4c22e9c3827ecd078d41185... |
809eb63e69ce38c4f1de46bcd32a5d97bc0f1bc9 | 67a5e2fcc9dd3cf773cfd7ea4e1cb3796cbaa0bc | spotinst/kubernetes-kops | /upup/pkg/fi/cloudup/openstacktasks/instance.go | Go | go | 11,649 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
0b3a7a93a0d8ea7f6c082389d18a48368bd33d3c | 1fa7eb196548ba5d87d6a55b28d08dc70a5e7dd9 | adlerjohn/arbitrum | /packages/arb-rpc-node/arbostest/owner_test.go | Go | go | 3,405 | permissive | /*
* Copyright 2020, Offchain Labs, 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... |
10454ecd233311c17e20c8c67c4817bb7952378d | 93b19be57d4f66c445165e371cdbf3920494f520 | openshift/installer | /terraform/providers/azurestack/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provisioner_mock.go | Go | go | 4,335 | permissive | package terraform
import (
"fmt"
"sync"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/convert"
"github.com/hashicorp/terraform-plugin-sdk/internal/provisioners"
)
var _ provisioners.Interface = (*MockProvisioner)(nil)
// MockProvisioner implements provisioners.Interface but mocks out all the
... |
07294c0a466da49ed1e96786bbe4abf48fdc0c67 | cefa5b568fb47c1e6e2764e7c87c1ad1bdae6118 | vdongchina/ratgo | /controller.go | Go | go | 1,526 | no_license | // Copyright 2020 ratgo Author. All Rights Reserved.
// Licensed under the Apache License, Version 1.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing, software
// distributed und... |
31c012a0f716b5ac96496d1a50c6d479df293df6 | f4c5875e4c25fed1ca13d60d31a661b78b1cb73f | voximplant/apiclient-go | /_examples/Rules/add_rule.go | Go | go | 505 | permissive | package main
import (
"fmt"
"github.com/voximplant/apiclient-go/config"
"github.com/voximplant/apiclient-go/methods"
)
func main() {
voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json")
client, err := methods.NewClient(voxConfig)
if err != nil ... |
262373227a1d3c1305318c53dd9f50470206027b | 3678c28e5f815a78ed2e52d08d32edf3972af7e9 | NodixBlockchain/gostream | /hello.go | Go | go | 28,673 | no_license | package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"encoding/hex"
"fmt"
"log"
"net/http"
"os"
"strconv"
"sync"
"time"
"github.com/gorilla/websocket"
)
type Message struct {
messageType int
roomID int
challenge string
answer string
audioOut, audioIn int
fr... |
7f9b6106acbb928b5820ff3787ec9537216f72a2 | dd3f6950ded767bf69aedaafae152b1a5e4c0e08 | sirodoht/heartfort | /models/users.go | Go | go | 12,060 | permissive | package models
import (
"regexp"
"strings"
"time"
"github.com/sirodoht/heartfort/hash"
"github.com/sirodoht/heartfort/rand"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
"golang.org/x/crypto/bcrypt"
)
const (
ErrNotFound modelError = "models: resource not found"
ErrIDInvalid model... |
b6cb667d8d242b68213c65899281a9ce3d58d767 | 22bf522c96fdd5bea6341daec9b5c3f5c56daf5f | rms1000watt/vals | /pkg/expansion/expand_match.go | Go | go | 1,110 | permissive | package expansion
import (
"fmt"
"regexp"
"strings"
)
type ExpandRegexMatch struct {
Target *regexp.Regexp
Lookup func(string) (string, error)
}
var DefaultRefRegexp = regexp.MustCompile(`ref\+?([^\+:]*://.+)`)
func (e *ExpandRegexMatch) InString(s string) (string, error) {
var sb strings.Builder
for {
ixs... |
367070638d04ff6460b12a3e37d4ce0df4022c1b | 473b6cf097e54a62ca75cf5b3749cf3166c57fc4 | last-Battle/gin_project | /controller/ch05/basic_auth.go | Go | go | 579 | no_license | package ch05
import (
"github.com/gin-gonic/gin"
"net/http"
)
var mapData map[string]interface{} = map[string]interface{}{
"zs": gin.H{"age": 22, "address": "xxx"},
"ls": gin.H{"age": 25, "address": "yyy"},
"ww": gin.H{"age": 36, "address": "zzz"},
}
func AuthTest(ctx *gin.Context) {
userName := ctx.Query("use... |
c622c1dd00837054587c941ca0b4d2ae8d4aecf2 | 562ca568cb9d6a4e281af9a83df1c269f723dcf2 | yguilai/go-gateway | /dao/service_grpc_rule.go | Go | go | 1,550 | permissive | package dao
import (
"github.com/e421083458/gorm"
"github.com/gin-gonic/gin"
"github.com/yguilai/go-gateway/public"
)
type GrpcRule struct {
ID int64 `json:"id" gorm:"primary_key"`
ServiceID int64 `json:"service_id" gorm:"column:service_id" description:"服务id "`
Port int `json:"po... |
66eea5a3dfaaebe3e7f824898450248f1c33e4bb | ecb2d23214ff24912a31a21f8aab76f4bc2d86e3 | qiniu-ava/ava-alluxio | /tools/golang/src/qiniu.com/app/avio/util/walker.go | Go | go | 2,697 | no_license | package util
import (
"fmt"
"io/ioutil"
"os"
"path"
"sync"
)
type WalkStatus int
var (
NotWalked WalkStatus = 0
Walking WalkStatus = 1
Walked WalkStatus = 2
)
func (w *WalkStatus) increase() *AvioError {
switch *w {
case NotWalked:
w = &Walking
break
case Walking:
w = &Walked
break
default:... |
187bf92cdd8a12cdab10ce614f022b9accd1cce4 | 52a387843a9a7167b0ebc9acd6436e4e6d5a88c1 | gotask/gost | /stnet/spb.go | Go | go | 14,270 | permissive | package stnet
import (
"errors"
"io"
"reflect"
"strconv"
"unsafe"
)
var (
errNoEnoughData = errors.New("NoEnoughData")
errOverflow = errors.New("integer overflow")
errInvalidType = errors.New("invalid type")
errStructEnd = errors.New("struct end")
errNeedPtr = errors.New("ptr is needed")
)
//`... |
f50a9734c67a21f8288dffe22af51bb6d7fe4e56 | e6e046affa5b8633061a6b59fa26593ab17babeb | tlwr/gorouter | /integration/main_test.go | Go | go | 39,202 | permissive | package integration
import (
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
"net/url"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"syscall"
"time"
tls_helpers "code.cloudfoundry.org/cf-routing-test-helpers/tls"
"code.cloudfoundry.org/gor... |
41a4c91997a08fa5c4c5a2e7338038d6cc80610e | 71ec03395459fb518e7e4282d7e802009d4ddd5d | dmiruke/provision | /backend/bootenv.go | Go | go | 19,294 | permissive | package backend
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"sync"
"text/template"
"github.com/VictorLowther/jsonpatch2/utils"
"github.com/digitalrebar/provision/backend/index"
"github.com/digitalrebar/pro... |
b34fa44da83bccb486d0949d2fc2a06d2f8253a3 | 58c6495eed879a49de24321f13a436ee25f9e8da | L04DB4L4NC3R/chutkula-bot | /src/transit/handler/jokes_handler.go | Go | go | 5,607 | no_license | package handler
import (
"context"
"github.com/L04DB4L4NC3R/jokes-rss-bot/src/feed"
repo "github.com/L04DB4L4NC3R/jokes-rss-bot/src/transit/repository"
"github.com/L04DB4L4NC3R/jokes-rss-bot/src/transit/service"
log "github.com/sirupsen/logrus"
"github.com/yanzay/tbot/v2"
)
func NewJokesHandler(bot *tbot.Serve... |
ac65dd6c1044f57831150fee8de571d83e70fd61 | ac683ef6bf7175090baf6221b7500aa4f1a7f217 | atlas-comstock/req | /dump_test.go | Go | go | 1,958 | permissive | package req
import (
"bytes"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
log "github.com/sirupsen/logrus"
)
func TestDumpText(t *testing.T) {
SetFlags(LstdFlags | Lcost)
reqBody := "request body"
respBody := "response body"
reqHeader := "Request-Header"
respHeader := "Response-Header"
... |
863142df6be45d14198d9ecf5a2d821efdc78e5e | 202c9c3a6a451b2f5b1f8ad8ed76876c681c9805 | spring-operator/cnab-k8s-installer-base | /pkg/fileutils/copier_test.go | Go | go | 11,920 | permissive | /*
* Copyright 2014-2018 The original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appl... |
f1b6b87901ae25662bcfbd49d9fb06c71d5ca81a | ba50ffe874fac1c8e1f8b69457874c98a10962cc | stgraber/incus | /incusd/db/cluster/projects.go | Go | go | 6,391 | permissive | //go:build linux && cgo && !agent
package cluster
import (
"context"
"database/sql"
"fmt"
"github.com/lxc/incus/incusd/db/query"
"github.com/lxc/incus/shared"
"github.com/lxc/incus/shared/api"
)
// Code generation directives.
//
//go:generate -command mapper incus-generate db mapper -t projects.mapper.go
//go... |
a5570ec9bb5b345ef3eefdca0baf99a7def73b2f | 5abc9133c22477b0ad4ad7a5c240dadd278dcdea | ok213/taskManagement | /vendor/myapp/myhandlers/incomingInstr.go | Go | go | 1,186 | no_license | package myhandlers
import (
"errors"
"log"
"myapp/models"
"net/http"
"strconv"
)
type pageIncomingInstr struct {
*MyCustomClaims
Instruction *models.Instruction
Error string
}
// IncomingInstr выводит информацию по входящим поручениям
func (c *AppContext) IncomingInstr(w http.ResponseWriter, r *http.Re... |
e1298ae0ca3a4cce53ee5fd85f6998b9b1f5a9d1 | b9528a6c8960d063d7c7d6b8a9645f835104cc06 | denkhaus/thunder | /livesql/binlog.go | Go | go | 11,506 | permissive | package livesql
import (
"context"
"crypto/rand"
"database/sql"
"encoding/binary"
"errors"
"fmt"
"os"
"reflect"
"strings"
"sync"
"time"
"github.com/denkhaus/thunder/internal/fields"
"github.com/denkhaus/thunder/logger"
"github.com/denkhaus/thunder/sqlgen"
"github.com/siddontang/go-mysql/mysql"
"github... |
07e3e789b9b6cfcd2cacaeb9f13bc354ad740cb9 | 3ba8799656ed9fe05586572a5d35702056e6eee2 | wooque/bench | /go/src/test-go/bench.go | Go | go | 2,678 | no_license | package main
import (
"database/sql"
"encoding/json"
_ "github.com/lib/pq"
"math/rand"
"net/http"
"strconv"
"time"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
func RandString(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = le... |
9eeee4ad7cfc0e543ba5134369830585189bd463 | d44bdddb2401fd208959f5e7932949dfed029feb | phirmware/magma | /symphony/graph/ent/customer_create.go | Go | go | 4,718 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated (@generated) by entc, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"strconv"
"time"
"github.com/facebookincubator/... |
d54e5ff83ab65c74a6d0b946b045c3794c7e5fb3 | 5e9403f2ba26475325be5e293fa0d6a28902752b | linus5/cost-model | /main.go | Go | go | 13,712 | permissive | package main
import (
"context"
"encoding/json"
"flag"
"net/http"
"os"
"strconv"
"time"
"k8s.io/klog"
"github.com/julienschmidt/httprouter"
costAnalyzerCloud "github.com/kubecost/cost-model/cloud"
costModel "github.com/kubecost/cost-model/costmodel"
prometheusClient "github.com/prometheus/client_golang/a... |
08a8d33ca3a5cfec4f501956ebe75acd29a41fc5 | 8161c8909c9a4a23ad1ea504cc3f64b48760c5fe | eddycjy/etcd | /tools/etcd-dump-logs/main.go | Go | go | 12,541 | permissive | // Copyright 2018 The etcd 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 t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.