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 |
|---|---|---|---|---|---|---|---|---|
0b45020109594c42d77848d46f9cf0c371a50bb8 | 9b38319dec03e6aec4fc6854560d61e2b3688e6c | pidario/disposable | /disposable.go | Go | go | 1,286 | permissive | // Package disposable contains a helper function used to check whether an email domain
// is to be considered disposable
package disposable
import (
"bufio"
"encoding/json"
"sort"
"strings"
)
//go:generate go run vfsdata_generate.go
// Domains contains the list of the disposable domains and error (if any)
type D... |
c5a09c62ba857d42d45f6dd39bfdc84db799fc94 | e4b0cb79a65a8d9f99d0e23290ad70668877dcfb | evilsmile/scripts | /Bash/DBTable2DBGo/replace_go_template.go | Go | go | 1,444 | no_license | package main
import (
"fmt"
"os"
"text/template"
)
func readFileAll(filename string) ([]byte, error) {
fp, err := os.Open(filename)
if err != nil {
return nil, err
}
defer fp.Close()
fileInfo, err := fp.Stat()
if err != nil {
return nil, err
}
buffer := make([]byte, fileInfo.Size())... |
e5b438af9afb2cd3966a295f6b9f5da8aa664049 | 6a76b134b91fe6839b2dd48eac6ce41e0b4f6d6d | ha666/gin_demo | /initial/config/parser.go | Go | go | 595 | no_license | package config
import (
"github.com/ha666/logs"
"gopkg.in/yaml.v2"
"io/ioutil"
)
// InitConfig 读取并解析配置到Config对象
// 没有检查配置是否完整
func InitConfig() {
// 启动时解析出错,程序退出
err := parseConfig()
if err != nil {
logs.Emergency("解析配置文件出错:%s", err.Error())
}
}
// parseConfig 解析并解密配置
func parseConfig() error {
Config = ... |
41a47c1f7ab4935709b54012b8c4e3ba15f0a7b5 | 00e0229538499ba59ed4d89e8dceab4203a650c6 | daniel3303/gvisor | /pkg/sentry/fs/ext/inode.go | Go | go | 4,532 | permissive | // Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
8754fffae0947f9b3e00493fce2b9becaf547d4b | 089a5016e427d7828c2e856665781ff43f455320 | xz0/go-udp | /server.go | Go | go | 2,175 | permissive | package main
import (
"fmt"
"os"
"github.com/BurntSushi/toml"
"github.com/apex/log"
lcli "github.com/apex/log/handlers/cli"
"github.com/fatih/color"
"github.com/fitzix/go-udp/server/models"
"github.com/fitzix/go-udp/server/reader"
"github.com/urfave/cli"
)
var (
VERSION = "DEV"
COMMIT = "UNKNOWN"
DA... |
16dbb99a2fac2719016910fbeabf5c133df0216e | 2bc139fe138bf0166c6de5c32d5d7cfa9607eb01 | qianqianyeye/gin-websocket- | /src/socketio/Claw.go | Go | go | 3,915 | no_license | package socketio
import (
"AdPushServer_Go/src/db"
"AdPushServer_Go/src/model"
"AdPushServer_Go/src/webgo"
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"golang.org/x/net/websocket"
"io"
"log"
"strings"
"time"
)
func (c *Client) ClawListen(ctx *gin.Context) {
go c.ClawListenWrite(ctx)
c.... |
8f2da122cd1b53fa6d208e6baf56584f9391f4a9 | 6408c5a76032cccb6a2510d89a7d4e5156ba9a7e | Huynhhung0/godx | /internal/web3ext/web3ext.go | Go | go | 18,561 | permissive | // Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
18a50821ded206f16dae5d3476599490381d4d4e | 1295391d175cf0490b8d3fc6a70af950eb1e5c52 | romzasandysman/avarage | /main.go | Go | go | 341 | no_license | package main
import (
"fmt"
"github.com/romzasandysman/datafile"
"log"
)
func main() {
numbers, err := datafile.GetFloats("data.txt")
if err != nil{
log.Fatal(err)
}
var sum float64 = 0
for _, number := range numbers{
sum += number
}
simpleCount := float64(len(numbers))
fmt.Printf("Average: %0.2f\n"... |
a6ee134bd2c8c32bd559d0bedb6f45fafdd337f1 | 9bfa1b2dd2835583e54f8f0881c3ea71d1b2d934 | nanopx/go-authentication-test | /config/config.go | Go | go | 967 | no_license | package config
import (
"os"
"fmt"
"io/ioutil"
"encoding/json"
)
type Config struct {
PublicKeyPath string
PrivateKeyPath string
JWTExpirationHours int
}
var config *Config = nil
var env = "development"
func Initialize() {
env = os.Getenv("GO_ENV")
if env == "" {
fmt.Println("Warning: GO_ENV not found,... |
136a508212b40a666b79450edfe6bba02ae8fdd0 | 310484d8e705f193e51adf276e950a45ef4a8832 | pkpfr/gorm | /statement.go | Go | go | 14,972 | permissive | package gorm
import (
"context"
"database/sql"
"database/sql/driver"
"fmt"
"reflect"
"sort"
"strconv"
"strings"
"sync"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gorm/utils"
)
// Statement statement
type Statement struct {
*DB
TableExpr *clause.Expr
Table string
Mo... |
a5c93180f4e5c54c5f77aaef193fc996affa3b6a | 91d7ac7c93f99f68dba20aa4a8fadfdd96f8eb8c | tsingson/ws | /wsutil/upgrader.go | Go | go | 1,564 | permissive | package wsutil
import (
"bufio"
"bytes"
"io"
"io/ioutil"
"net/http"
"github.com/tsingson/ws"
)
// DebugUpgrader is a wrapper around ws.Upgrader. It tracks I/O of a
// WebSocket handshake.
//
// Note that it must not be used in production applications that requires
// Upgrade() to be efficient.
type DebugUpgrad... |
11b852c65ffffa207650eaf5ad4fdbdae2289c7e | 653912d2e2fe38704252bf0b5c53d12528e8cc92 | gospodinzerkalo/currency_api | /currency/models.go | Go | go | 1,319 | no_license | package currency
import "encoding/xml"
type JsonCurrency struct {
Title string `json:"title"`
PubDate string `json:"pub_date"`
Description float64 `json:"description"`
Quant int `json:"quant"`
Index string `json:"index"`
Change string `json:"change"`
}
type ResponseCurrency struct {
CurrencyP... |
33821d488d0a95ec13ad648ac7fb0e97e7168bf9 | 68a246cfa8dbf44d1b32dbd45a4ce8a7c6def82a | razmussen/kontroller | /cmd/k8s/mongo-sidecar/replicaset.go | Go | go | 7,966 | permissive | // Copyright 2019 Tad Lebeck
//
// 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 wr... |
a03156d6d927b092c6ebdf470ffbb48698e28151 | 2e15196d123bd980a8e8cde721437ec8536b0e44 | dhleong/beholder | /src/ui/tui/simple-renderer.go | Go | go | 464 | permissive | package tui
import beholder "github.com/dhleong/beholder/src"
// NewSimpleRenderer will create a Renderer that can render
// anything that's just a name and text. The label will be
// rendered immediately after the name.
func NewSimpleRenderer(label string) *EntityRenderer {
return &EntityRenderer{
replacements: f... |
bea6b120106ffda55da46f3f9d9cb556e7b97022 | 5b2830a1b1aa06997800f454eacc4eb1f3d48494 | bpkgoud/pulumi-azure-native | /sdk/go/azure/cache/v20210201preview/redisEnterprise.go | Go | go | 4,921 | permissive |
package v20210201preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type RedisEnterprise struct {
pulumi.CustomResourceState
HostName pulumi.StringOutput `pulumi:"hostName"`
Location pulumi... |
54e47c32cfa40b8b08c74c734a4d723dc6e74e94 | ff1cf1abe811f553785c711dc25a660631e2439d | google/gousb | /fakelibusb_devices.go | Go | go | 6,215 | permissive | // Copyright 2017 the gousb 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 ap... |
d89774b97022612cea2a1b27611e9de1f97570d6 | 0c4154680e33508e07889f1efcbd63278cade773 | prakriti07/volcano | /pkg/controllers/job/job_controller_actions.go | Go | go | 19,909 | permissive | /*
Copyright 2019 The Volcano Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
2d51881bb9ca679e26f87eaf1ddafc57995ff647 | bbff82dc38803da7c1009db93a5d0a199fdf1608 | papito/ballot | /ballot/vendor/github.com/joomcode/errorx/error.go | Go | go | 8,479 | permissive | package errorx
import (
"fmt"
"io"
"strings"
)
// Error is an instance of error object.
// At the moment of creation, Error collects information based on context, creation modifiers and type it belongs to.
// Error is mostly immutable, and distinct errors composition is achieved through wrap.
type Error struct {
... |
b6e7005e6d862cc6044bb6e8a82ff5a0389cb1a3 | cf8795307b60d5749c51cb774cf7a8dd73958782 | bdematte/osdctl | /cmd/clusterdeployment/listresources.go | Go | go | 7,566 | permissive | package clusterdeployment
import (
"context"
"fmt"
"strings"
awsv1alpha1 "github.com/openshift/aws-account-operator/pkg/apis/aws/v1alpha1"
gcpv1alpha1 "github.com/openshift/gcp-project-operator/pkg/apis/gcp/v1alpha1"
hivev1 "github.com/openshift/hive/pkg/apis/hive/v1"
"github.com/spf13/cobra"
corev1 "k8s.io/... |
4ae9374cb332e5a8e98ef9c9b602bf77e04d04a0 | 54535e98534b9ef688cfdc5f7f3fec1efff4079f | PEDx/blog_server | /pkg/errno/code.go | Go | go | 1,089 | permissive | package errno
var (
// Common errors
OK = &Errno{Code: 0, Message: ""}
InternalServerError = &Errno{Code: 10001, Message: "服务端错误"}
ErrBind = &Errno{Code: 10002, Message: "请求体绑定错误"}
ErrValidation = &Errno{Code: 20001, Message: "参数错误."}
ErrDatabase = &Errno{Code: 20002, Message:... |
5df7fd54254a4824772cf0607e39fd2999e887d9 | 25fa68f262cfed8c9ba578c2ab0838d9cc8bbd30 | ProgRub/piscine-go | /makerange.go | Go | go | 221 | no_license | package piscine
func MakeRange(min, max int) []int {
if min >= max {
var final []int
return final
}
final := make([]int, max-min)
nums := min
for i := range final {
final[i] = nums
nums++
}
return final
}
|
00101e12ffa39fb33b7252f318cae9a6f50f293b | 74303b63adbe93e6f0a57523a2cc894b627ebff0 | lental/aws-sdk-go | /service/dynamodb/dynamodbattribute/marshaler_test.go | Go | go | 16,871 | permissive | package dynamodbattribute
import (
"math"
"reflect"
"testing"
"github.com/lental/aws-sdk-go/aws"
"github.com/lental/aws-sdk-go/aws/awserr"
"github.com/lental/aws-sdk-go/aws/awsutil"
"github.com/lental/aws-sdk-go/service/dynamodb"
)
type simpleMarshalStruct struct {
Byte []byte
String string
Int int... |
dafcc4f2e1ef9a880b1853493d95f1806d3f09a1 | 6e804cae660e764032619ecf82ab26ab6335b43a | sunfmin/qortexapi | /errors.go | Go | go | 3,433 | no_license | package qortexapi
import "errors"
var (
ServerError = errors.New("Oops, something is wrong!")
OrganizationNotFoundError = errors.New("organization not found")
OrganizationNotJoinedError = errors.New("not join organization yet")
OrganizationsNotFoundError = errors.New("organizations... |
59837fcb6d274a01c3273e54fa0674774d3e9377 | dff55fd039e1375fac0ec77c2ab4e0ff0d8441bc | labd/commercetools-go-sdk | /platform/client_product_discounts_by_project_key_product_discounts_key_by_key_post.go | Go | go | 2,597 | permissive | package platform
// Generated file, please do not change!!!
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
type ByProjectKeyProductDiscountsKeyByKeyRequestMethodPost struct {
body ProductDiscountUpdate
url string
client *Client
headers http.Header
params *ByProjectKey... |
dd392de2a1b5b58295fc1e0776bebb8082de9eac | b07c58eed12a01b8691509518cdc93e0370cc21f | HuberyChang/golearn | /day06/03time_demo/main.go | Go | go | 1,160 | no_license | package main
import (
"fmt"
"time"
)
// 时间
func main() {
now := time.Now()
fmt.Println(now.Year())
fmt.Println(now.Month())
fmt.Println(now.Day())
fmt.Println(now.Hour())
fmt.Println(now.Minute())
fmt.Println(now.Second())
// 时间戳
fmt.Println(now.Unix())
fmt.Println(now.UnixNano())
// time.Unix
ret :=... |
0a0e1a760df8c78c0f08edff3241db26e82475c4 | f3ec935f574f63dbc0de855a049f396a989305a6 | TomasWilliam/hiccup-repository | /internal/body.go | Go | go | 775 | no_license | package internal
import (
"math"
)
type body struct {
position location
velocity location
force location
mass float64
netForce float64
}
func (b *body) addForce(n *node) {
thetaIJ := math.Atan2(n.centerOfMass.y-b.position.y, n.centerOfMass.x-b.position.x) + math.Pi
dx := n.centerOfMass.x - b.position... |
450526b479dc4fd0d1bc98f1802854945db1fd1e | b7602e193e27e2592dcf7302c8d12f729b4c48bd | gunturaf/opentelemetry-collector-contrib | /receiver/jmxreceiver/factory.go | Go | go | 1,913 | permissive | // Copyright 2020, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
147aa20109d768463e7982e173fa0b491049c302 | c4e2692d1ffbf4eeea2dd5176a73ee1645d53768 | navneet1075/go-lang-basics | /waitgroup2.go | Go | go | 617 | no_license | package main
import (
"fmt"
"log"
"net/http"
"sync"
)
var urls = []string{"https://google.com", "https://yahoo.com", "https://microsoft.com"}
func fetchStatus(response http.ResponseWriter, req *http.Request) {
var wg sync.WaitGroup
for _, url := range urls {
wg.Add(1)
go func(url string) {
resp, err := ... |
eb7d54dcf00d47418deb065d652f879f5ecf2226 | 48738a7ad095e5bf83a9f9e3255380b37e66338c | FeeViper75/thai-covid19-discord-bot | /dbo.go | Go | go | 2,487 | permissive | package main
import (
"log"
"os"
"time"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
type (
channel struct {
gorm.Model
DiscordID string
Active bool
}
broadcastStamp struct {
BroadcastDate string
}
)
var db *gorm.DB
func initDb() {
err := touchFile("data.db")
if err ... |
04b8bfea484f483d4d2c1a3c0fd8939e50b8596d | dd15580988a5aead131e3a8573d63bbd2d66c882 | langenhagen/experiments-and-tutorials | /Go/arrays-slices-hello.go | Go | go | 829 | no_license | // Showcase the usage of arrays and slices in Go.
package main
import (
"fmt"
"strings"
)
func array() {
a := [6]int{2, 3, 5, 7, 11, 13}
fmt.Printf("Array via %%v: %v\n", a) // [2 3 5 7 11 13]
fmt.Printf("Array via %%+v: %+v\n", a) // [2 3 5 7 11 13]
fmt.Printf("Array via %%+v: %#v\n", a) // [6]int{2, 3, 5, 7... |
5651a78ef6a64584c0991eeb05a3a8b4b41851d5 | b23a5e62929a0a95eccd4901c72b3d24799f99ee | kyleknighted/kolide | /server/datastore/datastore_password_reset_test.go | Go | go | 703 | no_license | package datastore
import (
"testing"
"time"
"github.com/kolide/kolide-ose/server/kolide"
"github.com/stretchr/testify/assert"
)
func testPasswordResetRequests(t *testing.T, db kolide.Datastore) {
createTestUsers(t, db)
now := time.Now().UTC()
tomorrow := now.Add(time.Hour * 24)
var passwordResetTests = []str... |
7d8255ea5811fcf717a8c0b67a9ff2d4693c3496 | 4d2d79aed41c0877ed782167f3287d4dcdb7a4e8 | yashbhutwala/aws-operator | /service/controller/v26/resource/s3bucket/desired.go | Go | go | 976 | permissive | package s3bucket
import (
"context"
"github.com/giantswarm/microerror"
"github.com/giantswarm/aws-operator/service/controller/v26/controllercontext"
"github.com/giantswarm/aws-operator/service/controller/v26/key"
)
func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error) {
... |
509c85c0fef5631ddb0b9b6dd97497c710253a51 | ee2dc8a049e30127f40e8a6b38ada73b0c0d574d | karthick18/locksmith | /lock/etcd.go | Go | go | 2,227 | permissive | package lock
import (
"encoding/json"
"errors"
etcdError "github.com/coreos/locksmith/third_party/github.com/coreos/etcd/error"
"github.com/coreos/locksmith/third_party/github.com/coreos/go-etcd/etcd"
)
const (
keyPrefix = "coreos.com/updateengine/rebootlock"
holdersPrefix = keyPrefix + "/holders"
Sem... |
0482c95a1bec0e2b133e93bf5e4e3a3c6117f5b2 | 6b1fd5e78f19fcd29e4b19cb12494973f8b3063e | ouromoros/merge_blocks | /heap_test.go | Go | go | 518 | no_license | package main
import (
"container/heap"
"testing"
)
func TestMergeHeap(t *testing.T) {
nodes := make([]Node, 0)
h := &MergeHeap{data: nodes}
for _, n := range []int64{5, 3, 1, -1, 6} {
heap.Push(h, Node{index: int(n)%2, value: n})
}
expected := []int64{-1, 1, 3, 5, 6}
result := make([]int64, 0)
for i := 0... |
61bed53d6603615cc3ccf6a9a320c38da1c39b15 | 54e8f0603f2fa8b3083368bcd675918c1c93cf59 | whipstein/golinalg | /golapack/zlargv.go | Go | go | 4,082 | no_license | package golapack
import (
"math"
"math/cmplx"
"github.com/whipstein/golinalg/mat"
)
// Zlargv generates a vector of complex plane rotations with real
// cosines, determined by elements of the complex vectors x and y.
// For i = 1,2,...,n
//
// ( c(i) s(i) ) ( x(i) ) = ( r(i) )
// ( -conjg(s(i)) c(... |
302c4f1ef544c52d2bb0826dfcf65cf1045b2ac0 | a3d136cd09ff236243c30cd4991201cf4abae363 | ttomsu/spin | /cmd/account/get.go | Go | go | 2,161 | permissive | // Copyright 2019 New Relic Corporation. 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... |
f0c59daa61c99c209f8c3a57c03b83d4332f281e | 0a3e4328d6a451c10f66cfdf0ae4fa91e2083510 | HurSungYun/CHATTING_GO | /main.go | Go | go | 4,711 | permissive | package main
import (
"fmt"
"time"
"log"
"net/http"
"io"
"bufio"
"strings"
"golang.org/x/net/http2"
)
type User struct {
nick string
roomID string
lastSent time.Time
}
type Event struct {
nick string
ch chan string
}
type Message struct {
nick string
text string
timestamp time.Tim... |
277936f7dead59ab7c73e0358991a394bfa3b132 | 0f736aeb22df6543f594b0c843a4c8a72cdd22a9 | n4to4/learn-go-with-tests | /reading-files/post.go | Go | go | 940 | no_license | package blogposts
import (
"bufio"
"bytes"
"fmt"
"io"
"strings"
)
const (
titleSeparator = "Title: "
descriptionSeparator = "Description: "
tagsSeparator = "Tags: "
)
type Post struct {
Title, Description string
Tags []string
Body string
}
func newPost(postFile io... |
f5fb5525c5912d71ede958be200ac8c3bbda6d7c | a6b41b75686d6f75b874591c4c919c4240d3524f | arturcorreia1/go-smpp | /smpp/transmitter_test.go | Go | go | 9,865 | permissive | // Copyright 2015 go-smpp 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 smpp
import (
"fmt"
"testing"
"time"
"golang.org/x/time/rate"
"github.com/fiorix/go-smpp/smpp/pdu"
"github.com/fiorix/go-smpp/smpp/pdu/pdufiel... |
398f6d74cb3226d0700bef71c9124d5731fa5bb9 | f312e41b778a09df0df7baa20462ee4489d28b59 | DeanHH/xorm | /session.go | Go | go | 94,178 | permissive | package xorm
import (
"database/sql"
"encoding/json"
"errors"
"fmt"
"hash/crc32"
"reflect"
"strconv"
"strings"
"time"
"github.com/go-xorm/core"
)
// Struct Session keep a pointer to sql.DB and provides all execution of all
// kind of database operations.
type Session struct {
Db *core.... |
8af160241f52bdb2d13d3bbd51148f2222cecbdc | 06abded6cbdcc2c3372994a566c748a951f3b530 | lawrencegripper/kubernetes | /vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go | Go | go | 1,568 | permissive | package storageservice
// Copyright 2017 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
//
// U... |
c3a95454ba6f8fa7f0beb5a9b9d007c103eff15f | e7a1897062842e2e7c8dee1ca3781220b78e2292 | areller/multichan | /examples/infinite/main.go | Go | go | 517 | permissive | package main
import (
"os"
"fmt"
"time"
"github.com/areller/multichan"
)
func main() {
c := multichan.New()
listener := c.ListenInfinite()
fastTicker := time.NewTicker(10 * time.Millisecond)
slowTicker := time.NewTicker(time.Second)
done := time.After(10 * time.Second)
for {
select {
case t := <-fastT... |
d4e5e469f9311b9010e1597ce3fb375eb9922b59 | 4c1fe76b3f1856140ac3d73ef8d212c2889a0f2a | JingHanZhan/Winner-Tree | /WinnerTree.go | Go | go | 3,835 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
"strings"
"time"
)
func main() {
var (
fileTable []string
mergeTable []string
layerNumber int
mergeSize int
outputNumber int
)
for i := 1; i < 12; i++ {
fileName := "div/divFile" + strconv.Itoa(i) + ".txt"
fileTable = append(fi... |
7d56a0a6e2f139a1c87740003d6c749e1317e431 | 553bb0f40bcb896c8036f43e091f5df9faa574d4 | soberkoder/go-orders-api | /orders.go | Go | go | 2,584 | no_license | package main
import (
"encoding/json"
"log"
"net/http"
"strconv"
"time"
"github.com/gorilla/mux"
)
// Order represents the model for an order
type Order struct {
OrderID string `json:"orderId"`
CustomerName string `json:"customerName"`
OrderedAt time.Time `json:"orderedAt"`
Items []Ite... |
d67d755761b26d03158237f548a37d5c17cc00a7 | 2e93976e80583211e7791ea8b993410808c7e153 | reasland/prometheus | /cmd/prometheus/main.go | Go | go | 45,467 | permissive | // Copyright 2015 The Prometheus 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... |
dc315dc85e3bdf80e8fd15b3725f1091d724dc9c | b4afe463a6980745a2e5f059f509dae61214722f | ihxzihxz/leaf | /module/skeleton.go | Go | go | 2,552 | permissive | package module
import (
"github.com/ihxzihxz/leaf/chanrpc"
"github.com/ihxzihxz/leaf/console"
"github.com/ihxzihxz/leaf/go"
"github.com/ihxzihxz/leaf/timer"
"time"
)
type Skeleton struct {
GoLen int
TimerDispatcherLen int
AsynCallLen int
ChanRPCServer *chanrpc.Server
g ... |
90828835aba93cc763ff78bdaa81221b50b242ee | 2e4928c8fc8476c864296da886602c0a1ef0231a | qmutz/go-livepeer | /vendor/github.com/ethereum/go-ethereum/cmd/swarm/global-store/explorer_test.go | Go | go | 7,282 | permissive | // Copyright 2019 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
d22a1650d50c3aa72ddf2b4d20ef5a99bdf03d8e | ed607a3bf7565a9ac1148c4af84f2805f1faca35 | Yivens/gf | /g/util/gvalid/gvalid_check_map.go | Go | go | 3,569 | permissive | // Copyright 2017-2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gvalid
import (
"github.com/gogf/gf/g/uti... |
67839970f4aef98e69daea06bb88e41b7de35c55 | bdcb5fae52611ab4b709071c90e4953a67140ddc | glasware/cli | /pipe.go | Go | go | 395 | permissive | package main
import (
"io"
)
// TODO: replace with a buffer that deletes the front of it after
// it reaches max size and use in all write operations.
type pipe struct {
surface *surface
}
var _ io.Writer = new(pipe)
func (p pipe) Write(b []byte) (int, error) {
l, err := p.surface.buf.Write(b)
if err != nil {
... |
cb5f4055bf3357588e253a1c0986fd9ec9fa883a | 2c29f0603be5861ff340f305b6a746ccd0284253 | jmaucher/mangos | /test/busnonblock_test.go | Go | go | 1,270 | permissive | // Copyright 2019 The Mangos Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use 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... |
d7c7232aa9aa39863ae745dff61cc594e6db70a3 | 59b9a2e4da653409b080263c1d4fce4988853c37 | microsoftgraph/msgraph-beta-sdk-go | /communications/online_meetings_item_alternative_recording_request_builder.go | Go | go | 7,037 | permissive | package communications
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors"
)
// OnlineMeetingsI... |
a2369bc29c4af77976f72a92c969134d702d21dd | e9eae1195a89cce3b1225487a7afc30f39cb8745 | wdhif/nes | /nes/nes.go | Go | go | 255 | permissive | package nes
import "log"
type NES struct {
Cpu *CPU
Memory *Memory
Rom *Rom
}
func NewNES(path string) (*NES, error) {
rom, err := Loader(path)
if err != nil {
log.Fatal(err)
}
nes := NES{NewCpu(), NewMemory(), rom}
return &nes, nil
}
|
ce2b2fadaf1ab3f1e042b95e46fc520a7362369d | 3ad31cc00b5f8796e54d9940afd224b6a46fb637 | mangr3n/chezmoi | /chezmoi2/internal/chezmoi/attr.go | Go | go | 5,530 | permissive | package chezmoi
import (
"os"
"strings"
)
// A SourceFileTargetType is a the type of a target represented by a file in the
// source state. A file in the source state can represent a file, script, or
// symlink in the target state.
type SourceFileTargetType int
// Source file types.
const (
SourceFileTypeFile Sou... |
b9e8c2d3db37d4e2d5df9df166905add5bbdac66 | 0b67de2b1a0aebae01921e64bed025c348bcce7c | hodgesds/slab_exporter | /slab_exporter/main.go | Go | go | 1,007 | permissive | // Copyright © 2020 Daniel Hodges <hodges.daniel.scott@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless require... |
b041d6855e99a5b6dd25f2e3e17efa90d02574ed | df6bcd4dffaaa09a02b474798693129aa1de952f | JuliardiDev/go-ci | /main.go | Go | go | 629 | no_license | package main
import (
"flag"
"log"
"net/http"
redigo "github.com/gomodule/redigo/redis"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
)
var redisAddress = flag.String("redis-address", ":6379", "Address to the Redis server")
func main() {
_, err := sqlx.Connect("postgres", "user=postgres dbname=postgres pas... |
077c3e91213ce9eafffe75247365f0070c0ef762 | b3248820caea01228f1ca62026227ec977f7e024 | Personal-Library/learn-go-with-tests | /pointers/wallet.go | Go | go | 856 | permissive | package pointers
import (
"errors"
"fmt"
)
type Bitcoin int
type Wallet struct {
balance Bitcoin
}
// This interface is defined in the fmt package nad lets you define
// how your type is printed when used with the %s format string in prints
// type Stringer interface {
// String() string
// }
func (b Bitcoin) ... |
69c979804b84fe90bdfab4cf2e35ba5b721d7e95 | a0c4d1d9f07098b3719b61cc9c7f1ae752db39d4 | kedixa/gopl-exercises | /ch08/15/main.go | Go | go | 1,632 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net"
)
type client struct {
Name string
C chan<- string
}
var (
entering = make(chan client)
leaving = make(chan client)
messages = make(chan string) // all incoming client messages
)
func broadcaster() {
clients := make(map[client]bool) // all connected clie... |
3436c58e334f788994b11726158d79e86149dbea | 986582e40ce4fe079c5261be5a1995c47eba3df6 | omniql/reflect | /local/local_test.go | Go | go | 7,808 | permissive | package local
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
"github.com/omniql/reflect"
"github.com/nebtex/hybrids/golang/hybrids"
)
func Test_Load_App(t *testing.T) {
Convey("Scalar app", t, func() {
app, err := LoadApplication("fixtures/scalar-app")
So(err, ShouldBeNil)
Convey("Test tha... |
016a446791f2aab875dc699aee34ac0a05478dd7 | d03ccc920e4358ae68d6e3b99836c894643a3207 | Melody12ab/godai | /base.go | Go | go | 3,279 | no_license | package godai
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"strings"
"time"
)
const CLIENT_ID = "***"
const CLIENT_SECRET = "***"
const TOKEN_URL_FORMAT = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_cr... |
005cd66860c6ab4ee5aeeebcd0d3a7063330514c | d05e9bca9296d7fe22e26c73c75518a9f062c61d | amrchnk/advertisement_service | /pkg/models/advert.go | Go | go | 1,252 | no_license | package models
import (
"errors"
"strings"
// "encoding/json"
// "strconv"
)
type Advert struct{
Id int `json:"-" db:"id"`
Title string `json:"title"`
Description string `json:"description"`
Price int `json:"price"`
Photos []string `json:"photos"`
}
func (m *Advert) ValidateFields()error{
if... |
3956873c52d11427a5c081c120faf264b8fcbee5 | 0155a3411c126de57e484d8eddd24d09a93ff273 | nzinfo/corteza-server | /messaging/internal/repository/unread.go | Go | go | 3,685 | permissive | package repository
import (
"context"
"github.com/titpetric/factory"
"github.com/cortezaproject/corteza-server/messaging/types"
)
type (
// UnreadRepository interface to channel member repository
UnreadRepository interface {
With(ctx context.Context, db *factory.DB) UnreadRepository
Find(filter *types.Unr... |
aa97cdbd89b8cf992fbc0ece6bd24c1d3265f7dc | 937bef72d04aa5e153ac1111790c2d8134f169d8 | fossabot/kopia | /internal/server/api_snapshot_list.go | Go | go | 2,498 | permissive | package server
import (
"context"
"net/http"
"net/url"
"strings"
"time"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/policy"
"github.com/kopia/kopia/snapshot"
)
type snapshotListEntry struct {
ID string `json:"id"`
Source snapshot.SourceInfo `json:"source"`
De... |
5829325d9076f978b9fd22cc2c2e1e1f2611af35 | 9c1d513f5b072bde80d4828ea4e6491fa2d505a5 | teubanks/signalr | /examples/basic/main.go | Go | go | 524 | permissive | package main
import (
"log"
"github.com/teubanks/signalr"
)
func main() {
// Prepare a SignalR client.
c := signalr.New(
"fake-server.definitely-not-real",
"1.5",
"/signalr",
`[{"name":"awesomehub"}]`,
nil,
)
// Define message and error handlers.
msgHandler := func(msg signalr.Message) { log.Printl... |
a7e92bb121e4c7c9145f42a47135e27bb1ef3ee5 | e8eb2836c0ad3767fed50f49094e4b25674b5117 | whsprite/animerating | /backend/Controller/anime.go | Go | go | 1,920 | no_license | package Controller
import (
"Goweb_cli/Logic"
"Goweb_cli/dao/mysql"
"Goweb_cli/modules"
"go.uber.org/zap"
"github.com/gin-gonic/gin"
)
func GetAnimeHandler(c *gin.Context) {
animes := make([]modules.Anime, 0)
var err error
animes, err = mysql.GetAnime()
if err != nil {
zap.L().Error("mysql.GetAnime() fai... |
d9c70b29345f3900e6fb0f29cd427448c3ff67f8 | eaee1970b5e06f512486b5ebac0b202ed2b557b6 | Xanik/Emitter | /destroyer/messenger/pulsar.go | Go | go | 1,042 | no_license | package messenger
import (
"context"
"fmt"
"log"
"os"
"time"
"github.com/apache/pulsar-client-go/pulsar"
)
// Connect instantiate Pulsar a client
func Connect() (pulsar.Client, error) {
log.Printf("\nCreating new Pulsar connection")
url := fmt.Sprintf("pulsar://%v:6650", os.Getenv("PULSAR"))
client, err :... |
53ff423dee4901b296ae3125e4c3a500e680a34b | b05e5dc3a0f1aead3eef3666515d23307e5c723a | tzuyichao/go-basic | /src/go-workshop/ch5/fizzbuzz/main.go | Go | go | 348 | no_license | package main
import (
"fmt"
)
func main() {
fmt.Println("main is in control")
fizzBuzz()
fmt.Println("Back to main")
}
func fizzBuzz() {
for i := 0; i <= 30; i++ {
if i%15 == 0 {
fmt.Println("FizzBuzz")
} else if i%3 == 0 {
fmt.Println("Fizz")
} else if i%5 == 0 {
fmt.Println("Buzz")
} else ... |
fd95b3ac2e19ca9addfc5e9e0fa659043bd04cd8 | 0d4fb43d1f2b49ab3ac93ba57a0809042a69c631 | GuanceCloud/datakit | /vendor/github.com/cortexproject/cortex/pkg/util/module_service.go | Go | go | 3,486 | permissive | package util
import (
"context"
"fmt"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/cortexproject/cortex/pkg/util/services"
)
// This service wraps module service, and adds waiting for dependencies to start before starting,
// and... |
df3d69d2837c6b41fe9a9fc174c74a962f791979 | b8fea33b405a9a6f2f81edf2ea43f2fc1380daff | pgunn/dws | /reviewhtml.go | Go | go | 2,984 | no_license | package main
import (
"strconv"
"strings"
"time"
)
// #############
// reviewhtml
//
// These are functions used to do layout for the review portion of dws.
// initially this is just a slightly-tweaked version of bloghtml, but I expect
// later to differentiate them more. If I find that they're really not differen... |
0cbd01f85b42d8405de7f1b2ea0134d768dd6f51 | 34f936e110bea475649e82b30573a3acb3733bb4 | dianqiji/contrail | /pkg/apiserver/homepage_test.go | Go | go | 6,478 | permissive | package apiserver_test
import (
"context"
"fmt"
"strings"
"testing"
"github.com/Juniper/asf/pkg/apiserver"
"github.com/Juniper/contrail/pkg/cache"
"github.com/Juniper/contrail/pkg/keystone"
"github.com/Juniper/contrail/pkg/proxy"
"github.com/Juniper/contrail/pkg/services"
"github.com/Juniper/contrail/pkg/te... |
e7ff7c61638efa6278f5943f4b7552f0287ac84b | 886efce60897f7f609294bf8b33cc7a0921e4a3d | amphisbe/gohper | /slices/rune.go | Go | go | 357 | permissive | package slices
func FitCapToLenForRune(slice []rune) []rune {
if l := len(slice); l != cap(slice) {
newslice := make([]rune, l)
copy(newslice, slice)
return newslice
}
return slice
}
func IncrAppendForRune(slice []rune, s rune) []rune {
l := len(slice)
newslice := make([]rune, l+1)
copy(newslice, slice)
... |
2757ea297c38d62df4fa4a301e8b629afbcd39c7 | f55674180c914614c4eef1b9b2e154edd79d6563 | vrdong/go_is_fun | /binary_tree/lowest_common_ancestor/main.go | Go | go | 1,044 | no_license | /* Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on WIKIPEDIA. The lowest common ancestor is defined between 2 nodes p and q as the
lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself)
*... |
5974ae46cd65344ddcccc9f790d257ff3d85e7b3 | 6548bf3d8007eaf6efa5399fd9816e271f88c732 | demon-xxi/gosamples | /median.go | Go | go | 613 | no_license | package main
import "fmt"
func main(){
array := []int{1, 1, 3, 3, 2, 2}
fmt.Println(array)
sort(array)
fmt.Println(array)
}
func mid(arr []int) int{
sum := 0;
for _, val := range arr{
sum += val
}
return sum/len(arr)
}
func sort(arr []int){
m := mid(arr)
mpos ... |
7bfb6b06636324a4d93ff7b76804989716c965d8 | b6af152e4349e2b1367e9fdfb2478bda58ff2dd1 | veverkap/swagger | /go-frame-io/structs/PresentationItem.go | Go | go | 214 | no_license | package structs
import (
"time"
"github.com/google/uuid"
)
type PresentationItem struct {
Asset *Asset
Id uuid.UUID
Index int
InsertedAt time.Time
Presentation *Presentation
UpdatedAt time.Time
}
|
df047b1513528a080812a1f07cb03424655c37f8 | e56c46acd3e6cdf0844d6ef77f2934a2d750f8fc | xyproto/drawillego | /basic/basic.go | Go | go | 812 | no_license | package main
import (
"fmt"
. "github.com/xyproto/drawillego"
"math"
)
const (
rad = math.Pi / 180.0
)
func main() {
c := NewCanvas()
for x := 0; x < 1800; x++ {
c.Set(x/10.0, int(math.Sin(float64(x)*rad)*10.0))
}
fmt.Println(c.Frame())
c.Clear()
for x := 0; x < 1800; x += 10 {
c.Set(x/10.0, 10+int... |
986887dbc4a9c0af854da1ba29cb517bbe3ae57f | 5547912a8dbe4aaaeb5e30437d478c6f7d94c17e | ibraheemdev/authboss-1 | /oauth2/oauth2.go | Go | go | 9,493 | permissive | // Package oauth2 allows users to be created and authenticated
// via oauth2 services like facebook, google etc. Currently
// only the web server flow is supported.
//
// The general flow looks like this:
// 1. User goes to Start handler and has his session packed with goodies
// then redirects to the OAuth serv... |
1dc8501d98aa637fe4a4f00a1c8145605acec653 | 3ec00e850bb945c3234dfd07fbbc3cd9cf708641 | ppcsuite/ppcd | /blockchain/chainview_test.go | Go | go | 16,013 | permissive | // Copyright (c) 2017 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 (
"fmt"
"math/rand"
"reflect"
"testing"
"github.com/ppcsuite/ppcd/wire"
)
// testNoncePrng provides a deterministic prng for the nonce in ge... |
823f6dd33c6e25908d86ee9387f7db53c7f0e319 | 3e2b221311ad8698500291eb14c83650a294ecad | jonathanvillareal485/elastic-indexer-go | /factory/indexerFactory_test.go | Go | go | 4,689 | no_license | package factory
import (
"errors"
"net/http"
"net/http/httptest"
"testing"
indexer "github.com/ElrondNetwork/elastic-indexer-go"
"github.com/ElrondNetwork/elastic-indexer-go/mock"
"github.com/ElrondNetwork/elrond-go/core"
"github.com/ElrondNetwork/elrond-go/testscommon/economicsmocks"
"github.com/stretchr/te... |
6bfdc1721aa3c83eddcb06372f9650489497d896 | 541764df6c7e5a6ec238ba5fb10a0bcdb0fca0a4 | tucksaun/goofys | /internal/goofys_test.go | Go | go | 96,352 | permissive | // Copyright 2015 - 2017 Ka-Hing Cheung
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
e07648596d42a002dad262bc76e808c02d47d52b | 17979e4365f47c96a4b5e7ecb41e2d9037d6e6ca | morix1500/atcoder | /atcoder/ABC122/C/main.go | Go | go | 332 | no_license | package main
import (
"fmt"
)
func main() {
var N, Q int
var S string
fmt.Scan(&N, &Q, &S)
t := make([]int, N)
a := 0
for i := 0; i < N; i++ {
if S[i] == 'C' {
if i != 0 && S[i-1] == 'A' {
a++
}
}
t[i] = a
}
for i := 0; i < Q; i++ {
var l, r int
fmt.Scan(&l, &r)
fmt.Println(t[r-1] - t... |
8eaab6d034a192033da62b9d63dee8aad82c0993 | 7d6bd5eff40c47ee60cb12b43615f582cb3309db | viethapascal/cic-project | /service/crawlService.go | Go | go | 1,063 | no_license | package service
import (
"encoding/json"
"fmt"
"github.com/gocolly/colly"
"log"
)
type PrettyReport struct{
Date string `json:"date"`
Description string `json:"description"`
Temperature string `json:"temperature"`
}
func PrettyForecast() {
urls := "https://www.bbc.com/weather/4887398"
c := colly.NewCollecto... |
d7ed5b711579ca0800c7cd4a11325a3e8bf6fa60 | 6d2f4073540a9ea2c285ee7e346e8f14139d6863 | hahagan/study | /struct/go/stack/list.go | Go | go | 495 | permissive | // 两种stack实现,数组线性表与链表
package stack
import (
"github.com/hahagan/study/struct/go/list/pointer"
)
// 底层使用指针链表作为存储
type ListStack struct {
pointer.PointerList
}
func (s *ListStack) Init() *ListStack {
s.PointerList.Init()
return s
}
func (s *ListStack) GetTop() interface{} {
return s.Get(0)
}
func (s *ListStack... |
72deb23c938bd567d80046b2c4305ea8245fe208 | 902e0923756cf7473b97f795c08021a1e936da7f | motivator/go-choria | /providers/agent/mcorpc/golang/provider.go | Go | go | 1,701 | permissive | package agents
import (
"context"
"fmt"
"github.com/choria-io/go-choria/choria"
"github.com/choria-io/go-choria/providers/agent/mcorpc/golang/choriautil"
"github.com/choria-io/go-choria/providers/agent/mcorpc/golang/discovery"
"github.com/choria-io/go-choria/providers/agent/mcorpc/golang/rpcutil"
"github.com/c... |
ce36601260698caf47a03f341d5fa32c3c1cb44a | 88cb6ce2a379102ca1d1d283e14432ebec7aaf95 | Josephu/go | /hsm/thales_cc_command.go | Go | go | 4,150 | permissive | package hsm
import (
"bytes"
"encoding/hex"
"fmt"
)
type thalesCCReq struct {
_pro prologue
sourceZpk string
destinationZpk string
maximumPinLen uint
sourcePinBlock string //change type to []byte
sourcePinblkFmt uint
destinationPinblkFmt uint
acctNo ... |
81748a39ee02e32ab34297a3a86d382ca6d1da38 | 6f5069978faad28f9c710af820967ac05a2ad743 | vzvu3k6k/txtarfs | /txtarfs_test.go | Go | go | 433 | no_license | package txtarfs
import (
"io/fs"
"testing"
"github.com/google/go-cmp/cmp"
)
var txtArchive = []byte(`-- foo/foo.go --
package foo
-- main.go --
package main`)
func TestTxtarfs(t *testing.T) {
rootFS := Parse(txtArchive)
gotBody, err := fs.ReadFile(rootFS, "foo/foo.go")
if err != nil {
t.Fatal(err)
}
if ... |
1c9b28bf7792c1be2c6493d21ec150f0f528803e | 25fec8e57222483e0130a2a3db3e81731e5e34f0 | woshizilong/erda | /modules/cmp/cluster_resource.go | Go | go | 13,656 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
5c0fe1a6c7b9c49bfca4523d608d2f8881af773b | 000d754d81c83ec52ac5092b200616e9b5d023e9 | waseem18/mattermost-plugin-google-calendar | /build/manifest/vendor/github.com/mattermost/mattermost-server/model/version.go | Go | go | 2,995 | permissive | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"fmt"
"strconv"
"strings"
)
// This is a list of all the current versions including any patches.
// It should be maintained in chronological order with most current
// release at ... |
26e99eaf9c83ef129b291f7f32c81ab254fa964c | 22f71745a9078e3b3c372389719dd98f54193431 | huehnerhose/pgtype | /int2_array_test.go | Go | go | 5,596 | permissive | package pgtype_test
import (
"reflect"
"testing"
"github.com/jackc/pgtype"
"github.com/jackc/pgtype/testutil"
)
func TestInt2ArrayTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "int2[]", []interface{}{
&pgtype.Int2Array{
Elements: nil,
Dimensions: nil,
Status: pgtype.Present,
}... |
697b9105be46101eab0f677e02bb258a2c96d2a4 | 10e898c43875302d7443a5bbb7c017a2190d4f18 | antoniotamer/flux | /remote/rpc/baseclient.go | Go | go | 2,549 | permissive | package rpc
import (
"context"
"github.com/pkg/errors"
"github.com/weaveworks/flux/api"
"github.com/weaveworks/flux/api/v10"
"github.com/weaveworks/flux/api/v11"
"github.com/weaveworks/flux/api/v6"
"github.com/weaveworks/flux/api/v9"
"github.com/weaveworks/flux/job"
"github.com/weaveworks/flux/remote"
"git... |
50ba4e9abc0b815c96c1b331991b1255bdc4611a | b5b48f40d49b8e5e2ccfb1c358b65066f84457c7 | LeastAuthority/go-graphsync | /benchmarks/testinstance/testinstance.go | Go | go | 5,091 | permissive | package testinstance
import (
"context"
"time"
"github.com/ipfs/go-datastore"
ds "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/delayed"
ds_sync "github.com/ipfs/go-datastore/sync"
blockstore "github.com/ipfs/go-ipfs-blockstore"
delay "github.com/ipfs/go-ipfs-delay"
"github.com/ipld/go-ipld-pri... |
36c6a6ae4e512dafe6136f5eb89a7a1ed332660a | 3c572b7be5b88d238bcb9bfc9f43ffccde42d2c1 | bpkgoud/pulumi-azure-native | /sdk/go/azure/web/v20201001/getWebAppHostNameBinding.go | Go | go | 1,664 | permissive |
package v20201001
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupWebAppHostNameBinding(ctx *pulumi.Context, args *LookupWebAppHostNameBindingArgs, opts ...pulumi.InvokeOption) (*LookupWebAppHostNameBindingResult, error) {
var rv LookupWebAppHostNameBindingResult
err := ctx.Invoke("azure-nativ... |
3dedc258d852706e2ee5be121c809122cd85a506 | 579bec0e3aaabc7db2ba1098c5e3583e2eedaa39 | BobDeng1974/micro-go | /commons/controllers/delivery/delivery.go | Go | go | 2,585 | no_license | package delivery
import (
"crypto/md5"
"encoding/json"
"fmt"
"github.com/dreamlu/gt"
"github.com/dreamlu/gt/tool/result"
"github.com/gin-gonic/gin"
json2 "gopkg.in/square/go-jose.v2/json"
"io/ioutil"
"net/http"
"strings"
)
// String key = ""; //贵司的授权key
// String customer = ""; //贵司的查询公司编号
// Strin... |
c88f50b580f691e2fd26cf0ebe8e502cb24cc9be | 0ce5b858114fd606b655f519081f3db8f01c7f61 | alanrong/goblueprints | /trace/tracer.go | Go | go | 578 | no_license | package trace
import (
"fmt"
"io"
)
//Tracer is the interface that describes and object capable of
// tracing events throughout code.
type Tracer interface {
Trace(...interface{})
}
//New generate a new tracer
func New(w io.Writer) Tracer {
return &tracer{out: w}
}
type tracer struct {
out io.Writer
}
func (t... |
ccf75d19bf49f5a31d3912f22e02cebfbe793820 | 04faa6fd91d0a64ebb59f75d6c74fd8926facf63 | control-center/serviced | /tools/serviced-storage/thinpool_test.go | Go | go | 9,461 | permissive | // Copyright 2015 The Serviced 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... |
87495e6fa31c0761f7857615e9dbee58dca177db | c26f3738cb3fb9a2fd3c3e18eb105dfa9730a846 | asifdxtreme/cri-containerd | /pkg/server/events.go | Go | go | 4,992 | 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, ... |
9b8a903fb2f989f7fee4799d5ee34e7ec4e3f790 | 569029b4383854528d31fcc206a1b3fd56d73fb0 | cplemm/secrets-store-csi-driver | /pkg/util/fileutil/filesystem.go | Go | go | 1,254 | permissive | /*
Copyright 2020 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, ... |
fe8654e481131a04ef7c03c38dd80a0a74e2467b | 312bc654732d3a44acd9a6e6ecb00d0499ec3737 | JonPulfer/gofiggy | /pkg/handlers/website_fetch_test.go | Go | go | 3,451 | no_license | package handlers
import (
"testing"
api_v1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
func TestParseAnnotationData(t *testing.T) {
exampleAnnotationContent := "joke=curl-a-joke.herokuapp.com"
fetchReq, err := parseAnnotationData(exampleAnnotationContent... |
91b6a14adee445144d80acf6bf73c3ba7ce567d7 | 42aafb1bff031cf6c38368392e3b57a34c7f5ffc | huangnauh/jv | /jsontree/jsontree_test.go | Go | go | 1,444 | permissive | package jsontree
import (
"reflect"
"strings"
"testing"
)
var sampleJson = createLinesFromString(`{
"foo": 0,
"bar": {
"baz": true
}
}`)
func TestToggleLine(t *testing.T) {
tree := New(sampleJson)
tree.ToggleLine(2)
actual := tree.Line(3)
expected := createLinesFromString(` "baz": ... |
cdd5d3fac97489811bc9f4f3760178371f218550 | f81ef946f0e9d1a8962c06eb46c92607507cd101 | Nerdsav/seaweedfs | /weed/filer2/cassandra/cassandra_store.go | Go | go | 4,237 | permissive | package cassandra
import (
"context"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/gocql/gocql"
)
func init() {
filer2.Stores = append(filer2.Stores, &CassandraStore{})
}
type CassandraStore struct {
cluste... |
ba8456453d34a7afb44f8ad2e73e9e8be3083cd2 | 26a1eb640d569c40891088597f240af4cb32f9e3 | d1rtym0nk3y/telegraf | /internal/config/config.go | Go | go | 16,253 | permissive | package config
import (
"errors"
"fmt"
"io/ioutil"
"log"
"path/filepath"
"sort"
"strings"
"time"
"github.com/influxdb/telegraf/internal"
"github.com/influxdb/telegraf/outputs"
"github.com/influxdb/telegraf/plugins"
"github.com/naoina/toml"
"github.com/naoina/toml/ast"
"github.com/influxdb/influxdb/cli... |
67160a6f824a24180f319491631c62239d212f58 | 87c07082dc5620ac55f8c5386017334d637cde3d | PetarTodorovv/compass | /tests/external-services-mock/tests/fetch_request_test.go | Go | go | 5,776 | permissive | package tests
import (
"context"
"fmt"
"testing"
"github.com/kyma-incubator/compass/tests/pkg/assertions"
"github.com/kyma-incubator/compass/tests/pkg/fixtures"
"github.com/kyma-incubator/compass/tests/pkg/testctx"
"github.com/kyma-incubator/compass/components/director/pkg/graphql"
"github.com/stretchr/testi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.