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 |
|---|---|---|---|---|---|---|---|---|
ac59cda0662331b40c2a824a216f64d4d396e655 | b0a5993a24b3fc2dfa21f7cec8e4c4a75b65f52c | Chachanidze29/GoLang | /UploadImage.go | Go | go | 1,018 | no_license | package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
"text/template"
)
var tpl *template.Template
func init() {
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
}
func main() {
http.HandleFunc("/", foo)
http.Handle("/resources/", http.StripPrefix("/resources", http.Fil... |
32ef778f0a0efdb222f3aa7e8fb9e7237b0c337c | a29cae14428e8fac4caf60f6055ecbacd50935cf | 1800alex/go-git-cmd-wrapper | /worktree/worktree.go | Go | go | 2,320 | permissive | package worktree
import (
"github.com/1800alex/go-git-cmd-wrapper/v2/types"
)
// Add git worktree add [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<branch>]
func Add(path, branch string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("add")
g.AddOptions(path)
if len(branch) > 0... |
740e534e2b5e3964c93e48a0290e1aba6cc4fc5f | 3b99c54722a51420525b1bada35eb1351e91b9a1 | zhangqin19920901/kubernetes | /pkg/util/configuration_map.go | Go | go | 1,271 | permissive | /*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
d21030587c8f13d02ad3b06665425e0671c66633 | b11f118b583e250d57f5af3d0b86a3e2e95a0d27 | ocswor/GoNetwork | /demo/base/unpack/tcp_client/main.go | Go | go | 798 | no_license | package main
import (
"GoNetwork/demo/base/unpack/unpack"
"bufio"
"fmt"
"net"
"os"
"strings"
)
func receiveProcess(conn net.Conn) {
for {
bt, err := unpack.Decode(conn)
if err != nil {
fmt.Printf("receive from connect failed, err: %v\n", err)
break
}
str := string(bt)
fmt.Printf("receive from ... |
a7026fb2f921bf2548cc6605eed7c645cc477caf | 327cbb371d3661f3b371ed7b436cdd0c857d98ec | meCrypto/go-binance | /v2/delivery/websocket_service.go | Go | go | 23,603 | permissive | package delivery
import (
"encoding/json"
"fmt"
"strings"
"time"
)
// Endpoints
const (
baseWsMainUrl = "wss://dstream.binance.com/ws"
baseWsTestnetUrl = "wss://dstream.binancefuture.com/ws"
)
var (
// WebsocketTimeout is an interval for sending ping/pong messages if WebsocketKeepalive is enabled
Websocke... |
124e1cc73eb740c61fee98e28cdb8cf16b72e879 | 967d8c67242cdbe06fbefbf357ac3046cec28bc2 | cf-furnace/k8s-tps | /lib/swagger/operations/k8s_swagger_api.go | Go | go | 6,395 | permissive | package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"strings"
loads "github.com/go-openapi/loads"
runtime "github.com/go-openapi/runtime"
middleware "github.com/go-openapi/runtime/middl... |
df368ad8290130b53114d3d4a082fa77f346bda9 | 1e7ddc4a4133e2a55e92d6d7b2390c2bd8ac6e71 | rkartiyanta/design_pattern | /creational/object_pool.go | Go | go | 591 | no_license | package creational
type PockerCard struct {
King string
Queen string
Jack string
Ten string
Nine string
Eight string
Seven string
Six string
Five string
Four string
Three string
Two string
As string
}
// NewStraight and NewFullhouse use the same PockerCard object as a parameter
func NewStra... |
a7370c859aaa09e08e91d40d98b0ff9a877786cf | 590441f02ceae1e2449d863e6295276c52297af1 | shortintern2020-C-cryptograph/TeamF | /server/handler/sql_handler.go | Go | go | 513 | no_license | // @author Futa Nakayama
package handler
import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"log"
"os"
)
var sqlHandler = NewSQLHandler()
type SQLHandler struct {
DB *sqlx.DB
}
func NewSQLHandler() SQLHandler {
// db接続
dbenv := os.Getenv("DBENV")
dburl := fmt.Sprintf("root:password... |
4b142995cea65ee20462fd5f86b669ba37c69939 | 213f75da732cd82b85dc520f41f8d151c81bd843 | vmorris/mygopl | /ch5/ex5.18/deferFetch/main.go | Go | go | 1,059 | no_license | // Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 148.
// Fetch saves the contents of a URL into a local file.
package main
import (
"fmt"
"io"
"net/http"
"os"
"path"
)
//!+
// Fetch downloads the URL and returns the
// name ... |
0fac034bd1f9cf329ef8c6afa1af7c5e576699fe | e336e3c65ad0a317032a71cddedb83846a335d95 | nanovms/ops | /lepton/ldd_freebsd.go | Go | go | 843 | permissive | package lepton
import (
"debug/elf"
"errors"
"github.com/nanovms/ops/types"
)
// GetElfFileInfo returns an object with elf information of the path program
func GetElfFileInfo(path string) (*elf.File, error) {
return nil, errors.New("un-implemented")
}
// HasDebuggingSymbols checks whether elf file has debugging ... |
713d4a482f321718bf919fb17574cbfa72fccd4a | 821c84c95130e58613e3ecc9569ccdf5c3f69c58 | pawelurbanski/hugo | /hugolib/site_url_test.go | Go | go | 4,621 | permissive | // Copyright 2019 The Hugo 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 ... |
69b7a87af92696e479cfcb31bdef41f5598c9542 | 3f65d23cabe67205efa91ef935bcdf8ef7e37ad7 | knightjdr/cmgo | /internal/pkg/read/list/parseslice.go | Go | go | 587 | permissive | package list
import (
"encoding/csv"
"io"
"log"
"github.com/knightjdr/cmgo/pkg/fs"
)
// ParseSlice parses a txt list to a slice of strings
func ParseSlice(filename string) []string {
file, err := fs.Instance.Open(filename)
if err != nil {
log.Fatalln(err)
}
reader := csv.NewReader(file)
reader.Comma = '\... |
3fc1b94dfcf61b5efd68b87fc10ae6a436fba5fe | ccaa71eb571479c0d5b3322c2a2a9a9b7d2c1f4e | pirr/go_couchdb | /server_test.go | Go | go | 2,206 | no_license | package couchdb_test
import (
"mypackages/couchdb"
"net/http"
"testing"
)
var server = &couchdb.Server{`http://127.0.0.1:5984`, `admin`, `admin`, &http.Client{}}
var db couchdb.Database
func TestCreate(t *testing.T) {
db = *server.Create(`go-test`)
if *db.URL != `http://127.0.0.1:5984/go-test` {
t.Error("Expe... |
ba17bfa5fc4012fb9fba344ae470fcd2bd0fb620 | 99cee35225ed6df4618c1482d3bdd5c60e9074f4 | enterpriseih/leetcode-32 | /914/main.go | Go | go | 662 | no_license | package main
import "fmt"
func main(){
a := []int{1,2,3,4,1,2,3,4}
b := hasGroupsSizeX(a)
fmt.Println(b)
}
func hasGroupsSizeX(deck []int) bool {
index := make(map[int]int)
min := 10000000
for i:=0 ; i< len(deck) ; i++{
index[deck[i]]++
min = minfind(min,index[deck[i]])
}
gongyue :=0
for _,num := ran... |
05dfd090fb0055c91e84f9f1d25a3545bed1c1a5 | 2567d04aa276ceb4b0aa607c7fe2763090f5665c | vliulan/ALOR | /pd_server/schedule/operator.go | Go | go | 13,134 | no_license | // Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
c6cc93be243fff422b0cf0d78ec831d64e3563da | fb47fde4e5674959ae16eb25de5457ffca6a1b24 | 0x113/x-media | /tvshow/service/service.go | Go | go | 6,392 | no_license | package service
import (
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
"github.com/0x113/x-media/tvshow/common"
"github.com/0x113/x-media/tvshow/data"
"github.com/0x113/x-media/tvshow/external/tvmaze"
"github.com/0x113/x-media/tvshow/models"
"github.com/0x113/x-media/tvshow/utils"
"github.com/go-playground/vali... |
1d80b77f5eb0bda3528373fd56b8458f3014a0be | 903191051441cd288d94465c006e2d45fef3a96c | ts3ng/zk-cli | /cli/get.go | Go | go | 1,557 | no_license | package cli
import (
"github.com/behance/go-logging/log"
"flag"
"io"
"fmt"
)
type ZkGet struct {
convertToString bool //AclList
convertToHex bool //AclList
}
func ( zk *ZkGet) FlagSet(flags *flag.FlagSet) *flag.FlagSet {
flags.BoolVar(&zk.convertToString, "as-string", false, `convert the node value to a st... |
6a266f28ae8222eab0a56e22e31e070bdd9f4a27 | c37f8418760b3c1db613e1ff3f920bb38262efb3 | micromoral/akash | /x/cert/types/msgs.go | Go | go | 2,385 | permissive | package types
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const (
MsgTypeCreateCertificate = "cert-create-certificate"
MsgTypeRevokeCertificate = "cert-revoke-certificate"
)
var (
_ sdk.Msg = &MsgCreateCertificate{}
_ sdk.Msg = &MsgRevo... |
2f639c24f27cc492488818cf30b6d94743c2d444 | 698961aa0a5cc9648d9735bcd467511a381ee7c5 | d3zd3z/godump | /src/godump/manager/mirror-step.go | Go | go | 409 | no_license | package manager
// Mirror the data using rsync
type MirrorStep struct {
StepData
}
func (m *MirrorStep) Setup() (err error) {
m.banner(m.rsyncLog, "rsync")
return m.inDirToRun(
m.rsyncLog,
"rsync", "-aiHX", "--delete",
m.backupDir()+"/",
*m.host.Mirror+"/"+m.fs.Volume)
}
func (m *MirrorStep) Teardown() (... |
ebe41cc7aa0559628817a69c1a27fe957a09341b | 380de3a60a2843ffe49495620ba0ed26005cb4a7 | axel-freesp/sge | /freesp/mapping/mapelem.go | Go | go | 2,734 | permissive | package mapping
import (
"fmt"
"github.com/axel-freesp/sge/freesp"
bh "github.com/axel-freesp/sge/interface/behaviour"
gr "github.com/axel-freesp/sge/interface/graph"
mp "github.com/axel-freesp/sge/interface/mapping"
pf "github.com/axel-freesp/sge/interface/platform"
tr "github.com/axel-freesp/sge/interface/tre... |
31ad0da283f8a76ce7a73f7ca096d6a680d0cb5e | f4f3caff1cc313c3f6222f49ef6815eb2c5f1e52 | insisthzr/leetcode | /leetcode71/leetcode71_test.go | Go | go | 418 | no_license | package leetcode71
import "testing"
func TestSimplifyPath(t *testing.T) {
tests := []struct {
input string
want string
}{
{"/home/", "/home"},
{"///home/", "/home"},
{"/a/./b/../../c/", "/c"},
{"/a/../../b/../../../c", "/c"},
}
format := "simplifyPath(%q) = %q\n"
for _, test := range tests {
got ... |
cd507155ac979e31ba9da7b0a4641e4e616d2d39 | a4a48804807d3a1cd76774d89cade91aa6b4b9a7 | nwct/easyProxy | /utils/crypt.go | Go | go | 2,052 | permissive | package utils
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"encoding/hex"
"errors"
"math/rand"
"time"
)
//en
func AesEncrypt(origData, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
blockSize := block.BlockSize()
origData = PKCS5Padding(or... |
1d6e51d1367f835fc1ace67a34d826f73ad98ee9 | 37d3367cce71041d903479d0a94509e89a89acb4 | liyinda/BeeGo_VEA | /beego/controllers/login.go | Go | go | 3,221 | no_license | /**********************************************
** @Des: login
** @Author: copy
** @Date: 2019-2-20
** @Last Modified by: bjlfp
** @Last Modified time: 2019-2-20
***********************************************/
package controllers
import (
"fmt"
"strconv"
"strings"
"time"
"encoding/json"
"github.com/astaxie... |
005d6ee20077a7f637c4357635e5728271867de3 | 9c37ea6b5662fce46154d0344ea54dfc09e9bae2 | iamhopaul123/amazon-ecs-cli-v2 | /internal/pkg/template/template_functions.go | Go | go | 6,461 | permissive | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package template
import (
"encoding/json"
"fmt"
"regexp"
"strconv"
"strings"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aw... |
b628b802940cc76d5bc5fa4b060d07b568dca5c7 | ffc900588ee9bd313c5152f5a6cfba93d5fb4657 | bauerm97/oras | /cmd/oras/push_windows.go | Go | go | 561 | permissive | package main
import (
"strings"
"unicode"
)
// parseFileRef parse file reference on windows.
// Windows systems does not allow ':' in the file path except for drive letter.
func parseFileRef(ref string, mediaType string) (string, string) {
i := strings.Index(ref, ":")
if i < 0 {
return ref, mediaTyp... |
e2e18295aa0e16778e0bf7582c412f8f119a46e7 | abfe6f6a3aa3bc476bbe55ea63f1a576d5acc057 | nikitamirzani323/gofiber_svelte | /main.go | Go | go | 223 | no_license | package main
import (
"log"
"github.com/nikitamirzani323/gofiber_svelte/db"
"github.com/nikitamirzani323/gofiber_svelte/routes"
)
func main() {
db.InitMysql()
app := routes.Init()
log.Fatal(app.Listen(":4000"))
}
|
b63df1dad84c1b82324d889bef2dafe2ce099f00 | 649b2dfd803582d3fadd7f5d891de94b6de74afe | rockacola/go-chance | /depth_test.go | Go | go | 256 | permissive | package chance
import (
"testing"
)
func TestDepth(t *testing.T) {
c := NewChance()
actual := c.Depth()
if actual < -10994 || actual > 0 {
t.Errorf("Depth() was incorrect, expect: [a float value between -10994 and 0], actual: %6.2f.", actual)
}
}
|
eda7231e559a623e895f080d2a64c47bd8b60cd9 | 83911ef75fc215aea4f1ad54f2db92220b977849 | zzl200012/komorebi | /classfile/constantMemberRef.go | Go | go | 1,054 | no_license | package classfile
/**
* @Author: Zhou Zilong
* @Date: 2020/6/13 21:18
*/
/*
CONSTANT_Fieldref_info {
u1 tag;
u2 class_index;
u2 name_and_type_index;
}
CONSTANT_Methodref_info {
u1 tag;
u2 class_index;
u2 name_and_type_index;
}
CONSTANT_InterfaceMethodref_info {
u1 tag;
u2 class_inde... |
b9baa50ae7aeb2c7b7fcf6fb9b42039043526e8f | f85cac309d16a6b01250c01bbe8b95c32bd3dd8c | ShamroOoz/Go-Backend-Auth-Application | /.history/main_20210524020907.go | Go | go | 273 | no_license | package main
import (
"./database"
"./routes"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
)
func main() {
app := fiber.New()
app.Use(cors.New(cors.Config{
AllowCredentials: true,
}))
routes.Setup(app)
app.Listen(":8000")
} |
e9b24a33fd6434a3aa399b6d127569c02028fa92 | a126971221eb173ab651c97905fe6137f46a024a | seebs-markley/influxdb | /cmd/influx/cli/cli.go | Go | go | 33,428 | permissive | // Package cli contains the logic of the influx command line client.
package cli // import "github.com/influxdata/influxdb/cmd/influx/cli"
import (
"bytes"
"context"
"encoding/csv"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"os"
"os/signal"
"path/filepath"
"reflect"
"sort"
"strconv"
"strings... |
8e95cad969fcc5573adfee49f0ea1e7420bda382 | 439890ccf71a49b67ec6d2a466ade93b7852faa7 | karan-gada/CSE508-NetworkSecurity | /hw4/encryption.go | Go | go | 2,343 | no_license | package main
import(
"golang.org/x/crypto/pbkdf2"
"crypto/aes"
"crypto/sha1"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"os"
// "strings"
// "bytes"
)
var(
flag_val *bool
)
func main(){
val_for_flag := false
flag_val = &val_for_flag
fmt.Printf("%v %v %v\n", flag_val, *f... |
99e6a86cb2f6899e97fb54e526f91b752bab3af5 | 2e1d1cad8ebf29f1dcbf7c2d8a8f50e33a519ad6 | delicb/kioto | /middlewares/responsebody/responsebody_test.go | Go | go | 2,546 | permissive | package responsebody_test
import (
"errors"
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/stretchr/testify/require"
"bytes"
"github.com/delicb/kioto/cliware"
"github.com/delicb/kioto/middlewares/responsebody"
)
func TestJSON(t *testing.T) {
for _, data := range []struct {
RawData string
Exp... |
4ff8c829ba278e2d0d4425d6fa3f4da8eedf3aa5 | 47ebf033ed4fe04f8c4ba818e77fe97b910fa25b | sgtest/monorepo-test-3 | /kubernetes-8/pkg/registry/extensions/thirdpartyresource/storage/storage_test.go | Go | go | 4,555 | permissive | /*
Copyright 2015 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, ... |
04f4273988eabc6566cfd6c70abfeae77d1cd942 | ff1f8907b2f310050d08336f4c2282123c631ca9 | ParaServices/checkr | /screenings.go | Go | go | 1,190 | no_license | package checkr
// Screenings ...
type Screenings struct {
SSNTrace *SSNTrace `json:"ssn_trace,omitempty"`
SexOffenderSearch *SexOffenderSearch `json:"sex_offender_searches,omitempty"`
GlobalWatchListSearch *GlobalWatchListSearch `json:"glob... |
dcc2f2d969e7b195fad53c315e25cd2f0c852ff5 | ddd469188f6681fdcba592cef432c01fd2397798 | decred/dcrlnd | /lnrpc/signrpc/log.go | Go | go | 753 | permissive | package signrpc
import (
"github.com/decred/dcrlnd/build"
"github.com/decred/slog"
)
// log is a logger that is initialized with no output filters. This
// means the package will not perform any logging by default until the caller
// requests it.
var log slog.Logger
// The default amount of logging is none.
func ... |
54133e750af8234b3aac41f409a845f1ace5f19e | 7003bc8ddc6190bcdbac8c57d5ccdffbfa9cbca4 | myclass242/The-Go-Programming-Language | /chapter2/tempcov/conv.go | Go | go | 418 | no_license | package tempcov
func CtoF(c Celsius) Fahrenheit {
return Fahrenheit(c * 9 / 5 + 32)
}
func FtoC(f Fahrenheit) Celsius {
return Celsius((f - 32) * 5 / 9)
}
func CtoK(c Celsius) Kelvin {
return Kelvin(c + AbsoluteZeroC)
}
func KtoC(k Kelvin) Celsius {
return Celsius(k - Kelvin(AbsoluteZeroC))
}
func FtoK(f Fahre... |
79d593116b5bc3fe2512467c1e860c4b34409cf2 | f1f4b913974e016f1e29f5d4baff6b49d0bd14cd | aliscott/infracost | /internal/providers/terraform/aws/fsx_windows_file_system.go | Go | go | 854 | permissive | package aws
import (
"github.com/infracost/infracost/internal/resources/aws"
"github.com/infracost/infracost/internal/schema"
)
func getFSxWindowsFSRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "aws_fsx_windows_file_system",
Notes: []string{"Data deduplication is not supported by Te... |
556e1a1a988e6c87351195a3fa04606c4f53022d | 70a9e4875a816c3621555436cf90fed4d1e9ad26 | neut0ne/todo | /cmd/do.go | Go | go | 928 | permissive | package cmd
import (
"fmt"
"strconv"
"github.com/neut0ne/todo/db"
"github.com/spf13/cobra"
)
var doCmd = &cobra.Command{
Use: "do",
Short: "Marks a task as complete.",
Run: func(cmd *cobra.Command, args []string) {
var ids []int
for _, arg := range args {
id, err := strconv.Atoi(arg)
if err != nil... |
6d82e9c162eea8aa60c0a169d48ca129b6b2e755 | 3f804c984a7d8d0ca3bee8291892cc0b175d99f3 | ZHAOLIANKE/lindb | /app/storage/handler/write.go | Go | go | 3,724 | permissive | // Licensed to LinDB under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. LinDB licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compli... |
cc35e9c2c934ece05d5b28d1fc43ddf724647972 | 731df414f64edff1fb39297d6afee3a5d00f46a8 | mixieer/go-xshoppy | /xssdk/model.go | Go | go | 3,682 | no_license | package xssdk
type Order struct {
ShopUrl string `json:"shop_url"` //店铺访问的url
Id string `json:"id"` //订单号
OrderNumber string `json:"order_number"` //订单号带店铺名称
CustomorId string `json:"customor_id"`
Gateway string `json:"gateway"`
TotalPrice ... |
a8fdd6b6cd225ba0afaa34fac05e8bc09d2bda95 | 0b12b1e6f40bf318d18847b29efe2b6cc87e9e4e | linkeee/go-learning | /leetcode/209. 长度最小的子数组.go | Go | go | 625 | no_license | package main
import "fmt"
func minSubArrayLen(target int, nums []int) int {
left := 0
sum := 0
minLen := len(nums) + 1 // 不加一无法分辨出是不是整个数组满足情况还是都不满足情况
for right := 0; right < len(nums); right++ {
sum += nums[right]
for sum >= target { // 满足这个条件,就要先计算长度
if right - left + 1 < minLen {
minLen = right - lef... |
0308ea03ffe0f53657d2a8477776af4ee232b022 | 3892001663c927b779b26c560baf817d701a9f82 | farzadrastegar/simple-cab-tracking | /gateway/bus/bus_test.go | Go | go | 581 | no_license | package bus_test
import (
"github.com/farzadrastegar/simple-cab/gateway/bus"
)
var testParams = &bus.Params{
NSQLookupdAddress: ":4161",
NSQDAddress: ":4150",
Topic: "test_locations",
MaxInFlight: 25,
Channel: "test_store_location",
HandlerConcurrency: 4,
}
// Bus is a t... |
99a474ec8b765edd6e4ff8f5831ca098d698273b | b67ec667246d786f3355725f3033463cdf7e7a98 | kdembler/swan | /pkg/isolation/topo/thread.go | Go | go | 1,985 | permissive | // Copyright (c) 2017 Intel Corporation
//
// 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... |
698b0d59def301ab343830fe0861b895b4a1c84a | 96ec8d42a7f8643133133f3e04f232d9915430b4 | ManinderSinghRajput/ApacheArrowParquet | /services/server.go | Go | go | 2,995 | no_license | package services
import (
"apacheArrowParquet/go/apis"
"context"
"fmt"
"github.com/apache/arrow/go/arrow"
"github.com/apache/arrow/go/arrow/array"
"strconv"
"strings"
)
type Server struct {
Schema *arrow.Schema
Records []array.Record
}
// GetTotalItems : To get no of invoice lines
func (s Server) GetTotalI... |
7b311706fd4cbddf315cb767eccbc0fe451288dc | 65c5eb381b19d3905ffb7bfbf4422aa0c999dc4b | pracucci/kubernetes | /pkg/kubelet/kubelet.go | Go | go | 90,154 | permissive | /*
Copyright 2015 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, ... |
4a601d67b6f2dbdf79b011b71fa0af5749608f94 | 4c01f0c2d28ca4095ef6d858adb2de70f685a9d5 | saulr7/evaluaciones-be | /services/ReasignacionSevice.go | Go | go | 763 | no_license | package services
import (
"time"
"../config"
"../models"
)
func NewReasignacion(Modelo models.Reasignacion) (models.Reasignacion, error) {
Modelo.IdAsignacion = 0
Modelo.FechaModificacion = time.Now()
db := config.ConnectDB()
defer db.Close()
db.Create(&Modelo)
return Modelo, nil
}
func GetReasignacion... |
cf049cb9f3b209ac7da1f7b3863de01e8d07a576 | 868093ceb26fd88040fa328ab65a43917ca76028 | mt-inside/golang-graceful-shutdown | /grpc/server/main.go | Go | go | 2,387 | no_license | package main
import (
"context"
"errors"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
log.Println("Serving for 5s")
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer func() {
cancel() // mutliple cancels is not an error
}()
signalCh := installSignalHan... |
1825f53aefd2d77b791edd54cb50ef844b07e19f | 1ed9bb499b352c61c74f33ec79134868d15f29e9 | cortexproject/cortex | /vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/util/metautils/doc.go | Go | go | 819 | permissive | // Copyright 2016 Michal Witkowski. All Rights Reserved.
// See LICENSE for licensing terms.
/*
Package `metautils` provides convenience functions for dealing with gRPC metadata.MD objects inside
Context handlers.
While the upstream grpc-go package contains decent functionality (see https://github.com/grpc/grpc-go/bl... |
fedfa08d2e1244a9a4878183995a11d3b87c1519 | c27bbde03b1dfa2267ca6521629c9090a47d36a9 | jiweigang1/mosn | /pkg/trace/skywalking/driver.go | Go | go | 2,073 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
3e6030d86d4f77539c793fbed5e52738e5daad9e | 9939aa8f0a4ab14e39c378783780b62eba91d4c7 | yangguoandresolution/amazon-vpc-cni-k8s | /cmd/cni-metrics-helper/main.go | Go | go | 2,925 | permissive | // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file ... |
6bc8143351a6a00fa255c40d18ec19bfa1eb25e5 | f58398b5bdbcd68109aaa694fe1970b1ed824232 | TrendingTechnology/yuhaiin | /pkg/net/proxy/shadowsocks/v2ray_plugin.go | Go | go | 1,238 | permissive | package shadowsocks
import (
"fmt"
"net"
"net/url"
"strconv"
"strings"
"github.com/Asutorufa/yuhaiin/pkg/net/proxy/vmess"
)
func NewV2raySelf(conn net.Conn, options string) (net.Conn, error) {
// fastOpen := false
path := "/"
host := "cloudfront.com"
tlsEnabled := false
cert := ""
// certRaw := ""
mode ... |
b754049d33402b21d8af954bd9a4cac31bf98019 | e8c3eab178ba765809ff484ffe49fbb21e03cc63 | beogaCDO/tobs | /cli/pkg/utils/utils_test.go | Go | go | 1,470 | permissive | package utils
import (
"reflect"
"testing"
)
func TestExportValuesFieldValue(t *testing.T) {
type args struct {
chart string
keys []string
}
tests := []struct {
name string
args args
want interface{}
wantErr bool
}{
{
name: "Success test-case to fetch nothing as the provided keys are ... |
192b9a74bb92203ec695c5dc869f8a405d3771ec | d919f195291a93cd59db16a692a859441d9bcc4c | patrickToca/kbfs | /test/simple_test.go | Go | go | 8,819 | permissive | // Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
// These tests all do one conflict-free operation while a user is unstaged.
package test
import (
"testing"
"time"
)
func TestFavoritesBasic(t *testing.T) {
test(t... |
05c282a89e5d376808fae4ac85f5512032c6986b | b2c4e97eb4a34e13e87d15916982f2ce16598639 | n-is/stream | /pipeline/stage.go | Go | go | 3,056 | permissive | package pipeline
import (
"fmt"
"github.com/project-flogo/core/support"
"github.com/project-flogo/core/activity"
"github.com/project-flogo/core/data/mapper"
"github.com/project-flogo/core/data/resolve"
"github.com/project-flogo/core/support/log"
)
//var (
// exists = struct{}{}
//)
type Stage struct {
act ac... |
68077b547067ef736b86946217535d1f13d2f863 | 1eb5aacdd52d6666d774b7bf6ca12ef785a39a8e | stephenfin/hugo | /hugolib/pagebundler_test.go | Go | go | 26,062 | permissive | // Copyright 2017-present The Hugo 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 app... |
d1d6daf3c996f266d2d04e9103a6b2b55afee6cb | aeec372b96c86900dd8e5fcbeaee967c9f8a52ef | chinashuguo/go-zero | /example/bookstore/api/internal/svc/servicecontext.go | Go | go | 473 | no_license | package svc
import (
"bookstore/api/internal/config"
"bookstore/rpc/add/adder"
"bookstore/rpc/check/checker"
"github.com/chinashuguo/go-zero/zrpc"
)
type ServiceContext struct {
Config config.Config
Adder adder.Adder
Checker checker.Checker
}
func NewServiceContext(c config.Config) *ServiceContext {
retu... |
fc794ec7ba2d178e4888387c2561e631ac26d71b | 483614162e0802e295a5004f2aee147d942106e1 | gorexlv/rocketmq-client-go | /consumer/statistics_test.go | Go | go | 5,219 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this fi... |
2313efc022beb2a1d916dac51bf566ae1606b1c5 | 7f283f217bb3ff67f05ae876a46e9589943384bd | artrepreneur/pktd | /blockchain/compress_test.go | Go | go | 15,136 | permissive | // Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
import (
"bytes"
"encoding/hex"
"testing"
)
// hexToBytes converts the passed hex string into bytes and will panic if there
// is an error. This... |
366380103521039c98988b46515288ad12332d46 | 3103ae025dc8e450d28e012e7e31f72a2ed9e0fc | mrbuk/neato-http | /neato/types.go | Go | go | 1,992 | no_license | package neato
import (
"encoding/json"
)
type StandardResponse struct {
Version int `json:"version"`
ReqID string `json:"reqId"`
Result string `json:"result"`
Data map[string]interface{} `json:"data"`
}
func (r StandardResponse) String() string {
b, _ :=... |
0cc2f01e86d79b9819c226eb5abbf3145eeb3bb7 | aecbae3e03ae2449b6dc4c06607c5532012c2565 | udistrital/api_academica | /models/matricula_estudiante.go | Go | go | 5,485 | no_license | package models
import (
"errors"
"fmt"
"reflect"
"strings"
"github.com/astaxie/beego/orm"
)
type MatriculaEstudiante struct {
Id int `orm:"column(id);pk"`
PregradoPrimeraVez bool `orm:"column(pregrado_primera_vez);null"`
CreditosInscrit... |
9c15ffa05161baf99f4d89e4c17a8b129f3571cf | 5faac7bf25db25474f93089757b2319f8975c2a5 | mkch/rw | /dialog_windows.go | Go | go | 2,931 | no_license | package rw
import (
"github.com/mkch/rw/internal/native/windows/dialog"
"github.com/mkch/rw/internal/native/windows/window"
"github.com/mkch/rw/internal/stackescape"
"github.com/mkch/rw/native"
"github.com/mkch/rw/util"
)
func (dlg *windowBase) CloseModal(result interface{}) {
dlg.dialogResult = result
dialog.... |
4ceac3fa6af1b75aac19627c88b778fb34486f0e | 59fc9473226d1ed826c88f39006d4c4de6ee5e84 | JessicaCGlenn/xerogolang | /accounting/expense_claim.go | Go | go | 6,804 | permissive | package accounting
import (
"encoding/json"
"encoding/xml"
"time"
"github.com/jessicacglenn/xerogolang"
"github.com/jessicacglenn/xerogolang/helpers"
"github.com/markbates/goth"
)
//ExpenseClaim is a collection of receipts from personal spending that needs to be reimbursed by the business
type ExpenseClaim str... |
ea223154f796a6357f2d397e00fe88340e650b3f | 019a46b50e7d113d82bff399bff0a5fedc31916b | tommy-donavon/PRO290-twitter-clone | /users-service/auth/jwt.go | Go | go | 1,165 | no_license | package auth
import (
"errors"
"time"
"github.com/dgrijalva/jwt-go"
)
type (
JwtWrapper struct {
SecretKey string
Issuer string
ExpirationHours int64
}
JwtClaim struct {
UserType int
Username string
jwt.StandardClaims
}
)
func (j *JwtWrapper) CreateJwToken(username string, userType... |
354e465cbad2a34e42b93bdc71cffdfa35191a76 | f3e57fa3b313b30bdaade66a506cd2a96cabace8 | isabella232/plot | /plotgio/util.go | Go | go | 900 | permissive | package plotgio
import (
"image/color"
"gioui.org/f32"
"github.com/loov/plot"
)
func pt(p plot.Point) f32.Point {
return f32.Point{X: float32(p.X), Y: float32(p.Y)}
}
func rect(r plot.Rect) f32.Rectangle {
return f32.Rectangle{Min: pt(r.Min), Max: pt(r.Max)}
}
// mustExists checks whether style is valid and p... |
dfda51e40a6210ff749337e6e5811a69c841b489 | e69e42c347f97708e29df191a0842e80fcd71fef | oxpay/gdrive | /drive/info.go | Go | go | 2,817 | permissive | package drive
import (
"fmt"
"google.golang.org/api/drive/v3"
"io"
"encoding/json"
)
type FileInfoArgs struct {
Out io.Writer
Id string
SizeInBytes bool
JsonOutput bool
}
func (self *Drive) Info(args FileInfoArgs) error {
f, err := self.service.Files.Get(args.Id).Fields("id", "name", "size... |
02610442a114fbeecf69ce97ef015665b16e3f52 | 029fe6e22e989abbb13f41588121875b45461395 | klyed/hivesmartchain | /vent/test/events.go | Go | go | 2,914 | permissive | package test
import (
"context"
"testing"
"github.com/klyed/hivesmartchain/encoding"
"github.com/klyed/hivesmartchain/rpc/web3/ethclient"
"google.golang.org/grpc"
"github.com/klyed/hivesmartchain/crypto"
"github.com/klyed/hivesmartchain/execution/evm/abi"
"github.com/klyed/hivesmartchain/execution/exec"
"gi... |
e83e633c3b288a6dbfff56e68ff85fdece8aeb3c | 33e34f749f1c583711727ad42a9ebe5a724d5bf6 | Lunkov/srv-sendmail | /mime.go | Go | go | 3,700 | no_license | package main
import (
"bytes"
"crypto/rand"
"fmt"
"io"
"mime/multipart"
"mime/quotedprintable"
"net/textproto"
)
func (m *MailYak) buildMime() (*bytes.Buffer, error) {
mb, err := randomBoundary()
if err != nil {
return nil, err
}
ab, err := randomBoundary()
if err != nil {
return nil, err
}
return... |
6e5d219884c36644fecdf5d780dbf67cc3ea2027 | 86133bdf42bc9d478d84afa9a273d588e9cac36d | kacejot/kyverno | /pkg/engine/variables/vars.go | Go | go | 13,187 | permissive | package variables
import (
"encoding/json"
"errors"
"fmt"
"path"
"regexp"
"strings"
"github.com/go-logr/logr"
kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
"github.com/kyverno/kyverno/pkg/engine/anchor/common"
"github.com/kyverno/kyverno/pkg/engine/context"
jsonUtils "github.com/kyverno/kyverno/p... |
f933b95528830f11411a437b10835258b25bd6c0 | 1bc44433bae04220193ad269fbad16ddf0c99db0 | KernelDeimos/LaME | /lamego/engine/enginerunconfig.go | Go | go | 1,628 | no_license | package engine
import (
"encoding/json"
"errors"
)
type EngineRunConfig struct {
Name string `yaml:"name"`
TargetLanguage string `yaml:"target"`
ModelSourceDirectory string `yaml:"source"`
Generato... |
e507e6adfc31bc22f1386166a7b258cc686019b9 | 1fd8679e832348dacf2e9fe8695ad9860ff16efd | Fistelo/fosite | /handler/oauth2/introspector_test.go | Go | go | 3,768 | permissive | /*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... |
7c2bfe911ece6db5b6b76d92e16be066165a02b5 | 4fa0d957efe89c6963b15bbb76045e6369161bc1 | UniversityRadioYork/ury-ical | /structs/template.go | Go | go | 254 | permissive | package structs
import (
"github.com/UniversityRadioYork/myradio-go"
)
type TimeslotTemplateData struct {
Timeslot myradio.Timeslot
Config Config
}
type CalendarTemplateData struct {
Show myradio.ShowMeta
User myradio.User
Config Config
}
|
56c1e22941b77869f2206f67fdef8b3f5612afe4 | e75e99c69d4f10b09f004cb853e7d9a386763897 | chyeh/leetcode_archive | /123_best-time-to-buy-and-sell-stock-iii/solution_test.go | Go | go | 635 | no_license | package solution
import (
"reflect"
"testing"
)
func TestMaxProfit(t *testing.T) {
tests := []struct {
input []int
expected int
}{
{[]int{3, 3, 5, 0, 0, 3, 1, 4}, 6},
{[]int{1, 2, 3, 4, 5}, 4},
{[]int{7, 6, 4, 3, 1}, 0},
{[]int{1, 2, 4, 2, 5, 7, 2, 4, 9, 0}, 13},
{[]int{2, 1, 2, 0, 1}, 2},
{[]i... |
1f19e7af81de8c2126167c1f7ef6622edb3ff7e0 | 1c2bd9bc247f3ec68178b8092bdb8cdc6101f5e5 | barreiro/euler | /src/main/go/src/euler/solver029.go | Go | go | 1,913 | permissive | // COPYRIGHT (C) 2017 barreiro. All Rights Reserved.
// GoLang solvers for Project Euler problems
package euler
import (
"euler/algorithm"
)
// Consider all integer combinations of a^b for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
// 2^2=4, 2^3=8, 2^4=16, 2^5=32
// 3^2=9, 3^3=27, 3^4=81, 3^5=243
// 4^2=16, 4^3=64, 4^4=256, 4... |
f1ba9eea1eb9d8d2d1ae4db794d469081b7a9f99 | a56c87053a5838f50feed9b1ef70e6a2b8733c18 | ashtonc/go-poker | /templates/templateCache.go | Go | go | 1,841 | no_license | package templates
import (
"html/template"
"log"
)
func BuildTemplateCache() map[string]*template.Template {
log.Print("Building the template cache...")
templateCache := map[string]*template.Template{
"Home": BuildWithError("templates/base.tmpl", "templates/head_base.tmpl", "templates/navigat... |
f630c290aade87eebe78ccf42964ebac9f92c947 | e6210af24ca9b97dc95fe2b6274a64f4dc91e4fa | distributedio/tips | /vendor/github.com/pingcap/tidb/util/misc.go | Go | go | 1,598 | permissive | // Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
e326cd5052a79e32733d548d17414d1a351a9e5e | 225149e411df61267fa92701bb665343d215b726 | dianjiu/gos-log | /logc/controllers/file/file.go | Go | go | 7,521 | permissive | package file
import (
"archive/zip"
"bufio"
"encoding/json"
"io"
"log"
"net"
"os"
"path/filepath"
"strings"
"time"
"github.com/astaxie/beego"
)
type FileController struct {
beego.Controller
}
type FileReq struct {
Path string `json:"path"`
Key string `json:"key"`
Line int64 `json:"line"`
}
func (t... |
65a9783cf55fb62f90002a17dc3e95d72e80c111 | a08557eb5fe744756879dbe70348104c37004632 | mvladev/gardener | /pkg/utils/secrets/basic_auth_test.go | Go | go | 5,641 | permissive | // Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
a29c7dfd0ec1fd9f626061b5946b116566c80955 | 8b1f3dfc8338721c7335757e4aa97ee289d5cc32 | leaddevops/kubernetes | /staging/src/k8s.io/client-go/pkg/apis/authentication/v1beta1/register.go | Go | go | 1,599 | permissive | /*
Copyright 2015 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, ... |
d50a5f77edc261f0a70f8f82b256e4c77664209f | 5442e6c973861de84679d28da3dbf6bdf3a7abb9 | bart747/gota | /gota_test.go | Go | go | 581 | permissive | package gota
import (
"os"
"testing"
)
func TestExtendPaths(t *testing.T) {
p := []string{"a", "b"}
newP := extendPaths("a", p)
if newP[0] != "a/a" || newP[1] != "a/b" {
t.Error("Expected 'a/a a/b', got ", newP[0], newP[1])
}
}
func TestCreatePage(t *testing.T) {
tmplSet := []string{"testlayout.html", "test... |
61f3f0346b2eba23a963dd2117027b7fab1d76b8 | 453b08cad50925362589384c04c48a3a684d5f82 | kitt1987/monkey2 | /pkg/char/monkey.go | Go | go | 819 | permissive | package char
import (
"github.com/git-roll/monkey2/pkg/notify"
"os"
"time"
)
type Monkey interface {
StartWork(stopC <-chan struct{})
Halt()
}
type monkeyChar interface {
Work()
}
type monkey struct {
recover func(string)
idle *time.Timer
monkeyChar monkeyChar
}
func (m monkey) Halt() {
if m.idle !=... |
1e7d73612a561161a5d15e25c0f287fdadb2c996 | e193d85587d341039e33a3d179c035b44da22015 | abates/monkey-go | /ast/ast_test.go | Go | go | 602 | no_license | package ast
import (
"testing"
"github.com/abates/monkey-go/token"
)
func TestString(t *testing.T) {
program := &Program{
Statements: []Statement{
&LetStatement{
Token: token.Token{Type: token.LET, Literal: "let"},
Name: &Identifier{
Token: token.Token{Type: token.IDENT, Literal: "myVar"},
... |
b3b3c8adc6fbe47246ee47ec292d8a5e592ac796 | b0eca5c19bee1f06a1b44f23b424ed8f0d4872de | hashicorp/azure-sdk-for-go | /profiles/preview/privatedns/mgmt/privatedns/privatednsapi/models.go | Go | go | 1,038 | permissive | // +build go1.9
// Copyright 2021 Microsoft Corporation
//
// 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... |
5b39437261b0be9da22be0a0156002b86b4f121a | 36e41d552a276e3204994a0b25e7c75f421756d6 | bkmoovio/ach | /addenda98_test.go | Go | go | 8,721 | permissive | // Licensed to The Moov Authors under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. The Moov Authors licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this... |
d86c090d71547434801faf9a1515f9a8b032e0b3 | 3b23031973b09b8c20d62ae844fdbfcbddcd62df | mrVanboy/kiwi-robot | /src/kiwi-robot/robot/move.go | Go | go | 878 | no_license | package robot
import (
"errors"
)
var ErrTargetPositionIsOutOfField = errors.New(`target position is out of field`)
// cmdMove implements ICommand interface and move robot to the one position
// forward in the direction, where it is faced.
type cmdMove struct {
robot *Robot
}
func (c *cmdMove) Execute() error {
... |
d4ac0a2ee1504007f7d361e07d732d1e4e0ab0b5 | 4de2d46b2d3bc1bd62bd030c64eb47e393b36aed | foreversmart/plate | /middleware/context.go | Go | go | 463 | permissive | package middleware
import (
"context"
"github.com/foreversmart/plate/common"
"github.com/gin-gonic/gin"
)
func SetRequestIdToContext() gin.HandlerFunc {
return func(c *gin.Context) {
requestID := c.GetString(common.RequestID)
ctx := c.Request.Context()
ctx = context.WithValue(ctx, common.RequestID, request... |
3f4bd9a240fd6b2eaf6d8cddfa0c1ebf01afa009 | dc270a1499467f1b242f88495f9846d4eaaacfd2 | multimfi/archivegen | /elf/resolver.go | Go | go | 7,349 | permissive | package elf
import (
"debug/elf"
"io/ioutil"
"os"
"path"
"strings"
)
const ldConfigDir = "/etc/ld.so.conf.d"
// overridden in testing
var open = eopen
type errorNotFound struct {
e string
}
func (e errorNotFound) Error() string {
return "resolver: not found: " + e.e
}
func split(a []string) []string {
var... |
3913a0f1b08da27dad004caa23df0d4df8591741 | b06bcda549cedb3f00da554de66b3633fbfde088 | derekyu332/goii | /helper/extend/runtime.go | Go | go | 265 | no_license | package extend
import (
"bytes"
"runtime"
"strconv"
)
func Goid() int64 {
b := make([]byte, 64)
runtime.Stack(b, false)
b = bytes.TrimPrefix(b, []byte("goroutine "))
b = b[:bytes.IndexByte(b, ' ')]
n, _ := strconv.ParseInt(string(b), 10, 64)
return n
}
|
61d09e46d781860be785d817a06972f842294730 | aea307f87e725408d233866f21c01174c447c873 | huanglei0809/platform_build | /tools/compliance/policy/policy_test.go | Go | go | 12,130 | permissive | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
20941403d774876f9fb20356f157f4d2a84ca385 | 1de495501c4c5c9d85b5619ec1eff4882af2265b | robshelly/enmasse | /pkg/accesscontrolserver/amqp/sasl.go | Go | go | 1,486 | permissive | /*
* Copyright 2020, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*
*/
package amqp
// SASL Codes
const (
codeSASLOK saslCode = iota // Connection authentication succeeded.
codeSASLAuth // Connection authentication ... |
86ec74c0286021392b11a9988afec1d99f74aff0 | c412369e8a891964c9ed26d2cfa4be7c123d62bf | zainkai/LeetCodeChallenges | /Completed/Go/328.go | Go | go | 861 | permissive | /**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func oddEvenList(head *ListNode) *ListNode {
if head == nil || head.Next == nil {
return head
}
var oddHead, oddTail *ListNode = nil, nil
var evenHead, evenTail *ListNode = nil,... |
d92a844f96c0ad1f3d45b6751dd5e81a2bfacb8c | f86adcee3f3b34a63015ae1a336b0dc2ba065805 | theantichris/go-kit-tutorial | /main.go | Go | go | 1,439 | permissive | package main
import (
"context"
"database/sql"
"flag"
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
_ "github.com/lib/pq"
"github.com/theantichris/go-kit-tutorial/account"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
)
const dbSource = "" // TODO
func main() {
var httpAddr = flag.String... |
c8990dc805dc10c4a09750623c37147cc8b693f7 | 104df52d56a787e8f80347c9c8b567f08577917a | justdueck/sourcegraph | /internal/database/outbound_webhook_jobs.go | Go | go | 5,839 | permissive | package database
import (
"context"
"database/sql"
"fmt"
"time"
"github.com/keegancsmith/sqlf"
"github.com/lib/pq"
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
"github.com/sourcegraph/sourcegraph/internal/database/dbutil"
"github.com/sourcegraph/sourcegraph/internal/encryption"
"github.... |
ef65362ca5b9fc5be26539fe24fd054a537c99e3 | 40905990101e7efc874cce0d95916a5c3c941d07 | b-harvest/tendermint | /state/validation.go | Go | go | 5,855 | permissive | package state
import (
"bytes"
"errors"
"fmt"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
)
//-----------------------------------------------------
// Validate block
func validateBlock(evidencePool EvidencePool, stateDB dbm.DB, state Sta... |
47680948824ff47ad1f134de8835e975fd9380b7 | 7e8ec1bd2aece8d2b85192451f27f172de5daf29 | isabella232/nmcd | /cmd/findcheckpoint/findcheckpoint.go | Go | go | 5,040 | permissive | // Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/melange-app/nmcd/blockchain"
"github.com/melange-app/nmcd/chaincfg"
"github.com/melange-app/nmcd/database"... |
6a9e6dbcc034fd7a7e23e07a36dde7ea0497cef9 | 038d5336d6846956184a901f1bab2f06b59aa49a | yusufyilmazfr/tasarim-desenleri-turkce-kaynak | /memento/go/stack.go | Go | go | 682 | no_license | package main
type Stack []*TextMemento
// IsEmpty : check if stack is empty
func (s *Stack) IsEmpty() bool {
return len(*s) == 0
}
// Push : a new value onto the stack
func (s *Stack) Push(m *TextMemento) {
*s = append(*s, m) // Simply append the new value to the end of the stack
}
// Pop : Remove and return top ... |
07ce8b7fa52e11cfe52fda59fa3bbf04499b43f4 | 935304dc6ef5a1aa90a65d6122d9b4520774da6f | bitmark-inc/autonomy-api | /external/cadence/encoded.go | Go | go | 1,242 | no_license | package cadence
import (
"bytes"
"fmt"
"reflect"
"github.com/vmihailenco/msgpack/v4"
)
// MsgPackDataConverter is DataConverter that uses msgpack to
// encode and decode data between workflows and activities
type MsgPackDataConverter struct{}
func NewMsgPackDataConverter() *MsgPackDataConverter {
return &MsgPa... |
75bef685dde18f7d96e2886f1eeda3ca870e1362 | e5a7f2b636581d7d31c2ce5aeff8557f7acfa868 | erichen86/go-tenancy | /tests/client_attr_template_test.go | Go | go | 3,617 | no_license | package tests
import (
"fmt"
"net/http"
"testing"
)
func TestGetAttrTemplateList(t *testing.T) {
auth := tenancyWithLoginTester(t)
defer baseLogOut(auth)
obj := auth.POST("v1/merchant/attrTemplate/getAttrTemplateList").
WithJSON(map[string]interface{}{"page": 1, "pageSize": 10}).
Expect().Status(http.Status... |
6efead1577d80e230e1840dd39ecaa7d853063c6 | a101a2036309ab7d9dc32ca4e7935a1b4374d0df | eric-burel/rgo | /sample/sampleFloat_test.go | Go | go | 3,259 | permissive | package sample
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFloatImplementSampler(t *testing.T) {
//@see https://splice.com/blog/golang-verify-type-implements-interface-compile-time/
// this won't compile if Int does not implement Sampler
var _ Sampler = (*Float)(nil)
}
func TestFloatImple... |
ffa4688a101ae1331a604ccb32e8eec71ba83fa8 | 68fe1c86473370df0e44249e6751ba035412d077 | moolen/bent | /pkg/provider/node.go | Go | go | 7,324 | permissive | package provider
import (
"fmt"
"time"
"github.com/gogo/protobuf/types"
"github.com/moolen/bent/envoy/api/v2"
"github.com/moolen/bent/envoy/api/v2/cluster"
"github.com/moolen/bent/envoy/api/v2/core"
"github.com/moolen/bent/envoy/api/v2/endpoint"
"github.com/moolen/bent/envoy/api/v2/route"
_type "github.com/m... |
367ff7991e333bfe146aff2016b4dbd8dec0b380 | 7513566b7ed2a0ebba607398056e7ae600aaed27 | malikchaya2/evergreen | /config_test.go | Go | go | 23,979 | permissive | package evergreen
import (
"context"
"os"
"path/filepath"
"reflect"
"testing"
"github.com/evergreen-ci/evergreen/util"
"github.com/mongodb/grip/send"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"go.mongodb.org/mongo-driver/bson"
"go.mongod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.