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 |
|---|---|---|---|---|---|---|---|---|
d4c7bb64317b93c914942c1939dbc1da8d08b71b | 62ef84e4807beeadd4446c51f1edd1869f5a7286 | teknoraver/spread | /spread/runner.go | Go | go | 24,846 | no_license | package spread
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"sync"
"time"
"gopkg.in/tomb.v2"
"math/rand"
)
type Options struct {
Password string
Filter Filter
Reuse bool
ReusePid int
Debug bool
Shell bool
She... |
ca50845bb39a11554e7af0a431a1bb80a3f0a2ad | 93733d6648fe081529a592c944eef7a3547d5d28 | h12w/hdb | /codec/raw/raw.go | Go | go | 625 | permissive | package raw
import (
"bytes"
"io"
"github.com/alecthomas/binary"
)
var defaultEndian = binary.BigEndian
func Marshal(v interface{}) ([]byte, error) {
var buf bytes.Buffer
err := NewEncoder(&buf).Encode(v)
return buf.Bytes(), err
}
func Unmarshal(b []byte, v interface{}) error {
err := NewDecoder(bytes.NewRe... |
1b21a491098090fccbb755fcf458be566c7253a8 | 95820fe9b66f0869ed996447cf7de6ec704d6138 | sawood14012/blockchain-go-node | /src/blockchain/blockchain.go | Go | go | 2,264 | no_license | package blockchain
import (
"fmt"
"github.com/sawood14012/blockchain-go-node/src/student"
"github.com/sawood14012/blockchain-go-node/src/utils"
)
type BlockChainIterator struct {
CurrentHash []byte
}
func InitBlockChain() {
firstblock := InitFirstBlock()
utils.StoreInBLOCKCHAIN(firstblock.H... |
1eb7874b654fbb2eabcdcb9deccc58e91edf721b | 3037ad5cb6807db1f24db7c3198ce97d5aa9ae2a | evt/flow-dps | /api/rosetta/configuration.go | Go | go | 932 | permissive | // Copyright 2021 Alvalor S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
4ddf1f7a1e493e2eb76d9d58c7ce65ab0ea6d556 | 57fa95c7bcf09f4a3cc9db7927c530be400f70fd | storj/drpc | /drpchttp/protocol_twirp.go | Go | go | 2,586 | permissive | // Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package drpchttp
import (
"context"
"encoding/json"
"io"
"net/http"
"storj.io/drpc"
)
//
// protocol handler
//
type twirpProtocol struct {
ct string
marshal marshalFunc
unmarshal unmarshalFunc
}
func (tp twirpProtocol... |
f6e81e1764cfdad330a5429423e8a1fd72da33cd | 801fb374eb991fabb79ee58b0a2424bf1c1df755 | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go | Go | go | 35,092 | permissive | /**
* Copyright (C) 2015 Red Hat, 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... |
0c8f51ff23df110cd719c8bbde83deae48f18821 | d8e08a621d40fa7cac452ddc80c142dc8de9d4c8 | yelau/go-pusher | /src/im/service/logic/service/user/userop.go | Go | go | 2,961 | permissive | /*******************************************************************
* Copyright(c) 2015-2016 Company Name
* All rights reserved.
*
* File :
* Date :
* Author :
* Description:
******************************************************************/
package user
import (
//"time"
"im/service/logic/model... |
c5bfd64bdb03557a42ac29135735d5f17ed7d96d | 491d8a7a935e9827aca2ccbe2b3e42be816c1b30 | fangdingjun/GoEx | /cryptopia/Cryptopia.go | Go | go | 10,546 | permissive | package cryptopia
import (
"crypto/hmac"
"crypto/md5"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"strconv"
"strings"
. "github.com/fangdingjun/GoEx"
"net/http"
"net/http/httputil"
"net/url"
"time"
)
const (
API_BASE_URL = "https://www.cryptopia.co.nz/api/"
... |
54a6dbf0e250f1286f5a36c7c78f4cac4d417711 | 0cb7c3fee33cd64fb7d33936b4cd9126d6f0f5a6 | NVIDIA/gpu-operator | /controllers/resource_manager.go | Go | go | 5,718 | permissive | package controllers
import (
"os"
"path/filepath"
"regexp"
"sort"
"strings"
promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
nodev1 "k8s.io/api/node/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
rbacv1 "k8s.io/api/rba... |
a00a5823245df7f6926f9ce9d2b3c7a18eb7f582 | 2a3a5b1e56542048b0c9b33e8e6e08f4cd010297 | ivanturianytsia/go-bp-chat | /room.go | Go | go | 1,597 | no_license | package main
import (
"log"
"net/http"
"github.com/ivanturianytsia/trace"
"github.com/gorilla/websocket"
"github.com/stretchr/objx"
)
const (
socketBufferSize = 1024
messageBufferSize = 256
)
var upgrader = &websocket.Upgrader{
ReadBufferSize: socketBufferSize,
WriteBufferSize: socketBufferSize,
}
type... |
1a7c051856a596256d8962ed31504b784ade412b | d0d3cac8a2031c57892926cd5ae30dc8f0f29bed | Minusis/gqlgen | /plugin/federation/federation.go | Go | go | 11,898 | permissive | package federation
import (
_ "embed"
"fmt"
"sort"
"strings"
"github.com/vektah/gqlparser/v2/ast"
"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/99designs/gqlgen/plugin"
"github.com/99designs/gqlgen/plugin/feder... |
18dc9f4828d4968410579ac7115d16b6026a205a | 25ba53cedc5bee93b85692725e1ae95c0e872060 | kyma-project/cli | /internal/k3d/k3d_test.go | Go | go | 5,409 | permissive | package k3d
import (
"fmt"
"testing"
"time"
"github.com/kyma-project/cli/internal/k3d/mocks"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
const (
testClusterName = "kyma"
testTimeout = 5 * time.Second
)
type K3dTestSuite struct {
suite.... |
4d79c562b2d02a4d384c5ca2b114bf72dc61bb23 | 80fed6dd87f36c66fd56c66702548b1f199003d9 | richardcase/vault-initializer | /pkg/client/clientset/versioned/typed/vaultinit/v1alpha1/fake/fake_vaultinit_client.go | Go | go | 1,176 | permissive | /*
Copyright 2017 The Vault Initializer 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 wr... |
35b6fd50b999ff0e678b508e0a7d306f1b564d63 | 51c8d9c079eeab0a288d7f11a43f1a79d4e094e1 | stack-labs/stack-rpc-plugins | /registry/consul/registry_test.go | Go | go | 5,184 | no_license | package consul
import (
"bytes"
"encoding/json"
"errors"
"net"
"net/http"
"testing"
"time"
consul "github.com/hashicorp/consul/api"
"github.com/stack-labs/stack-rpc/registry"
)
type mockRegistry struct {
body []byte
status int
err error
url string
}
func encodeData(obj interface{}) ([]byte, err... |
73484576aad751df6c475c9d411b5c542ccf0f4d | 08158388849b2b8df1c192af3501a2ff9c9e1293 | lapis-zero09/5 | /ch03/ex08/main_test.go | Go | go | 600 | no_license | package main
import (
"io/ioutil"
"testing"
"github.com/5/ch03/ex08/newton"
)
func BenchmarkNewtonComplex64(b *testing.B) {
for i := 0; i < b.N; i++ {
plot(newton.NewtonComplex64, ioutil.Discard)
}
}
func BenchmarkNewtonComplex128(b *testing.B) {
for i := 0; i < b.N; i++ {
plot(newton.NewtonComplex128, io... |
8a2b85a976330d0ca8eced17d521e9a178abfa4a | ce5d134a658adccf7ee1758ae200e6ed970a825b | birkh8792/golang-coding | /boot/time.go | Go | go | 231 | no_license | package boot
import (
"github.com/gogf/gf/os/glog"
"golang-coding/app/service"
"time"
)
func bootTime() {
service.BootTime = time.Now().Format("2006-01-02 15:04:05")
glog.Info("application boot time :" + service.BootTime)
}
|
5239b6006ecdacc918356392642b3aebedf96a42 | 15ee21232fba36904662709870633c98fbb61e3b | yanirq/cnf-features-deploy | /vendor/github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1/tuned_types.go | Go | go | 8,430 | permissive | package v1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
operatorv1 "github.com/openshift/api/operator/v1"
)
const (
// TunedDefaultResourceName is the name of the Node Tuning Operator's default custom tuned resource
TunedDefaultResourceName = "default"
// TunedRenderedRes... |
96f08d161005a0c055691206faee17f0972f464e | 1d13de26e953279d9608c8e0ebe2c16cd43e2343 | ryanhelms/eksctl | /pkg/actions/cluster/owned.go | Go | go | 4,246 | permissive | package cluster
import (
"time"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"github.com/weaveworks/eksctl/pkg/cfn/manager"
"github.com/weaveworks/eksctl/pkg/ctl/cmdutils"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksc... |
978a8caac104ed0b03ea5d804f6c080b4b405ee9 | 418275848c5e7aca23ead64624a5b72bc9472b02 | minskylab/neocortex | /cortex_creator.go | Go | go | 2,653 | permissive | package neocortex
import (
"context"
"log"
"time"
"os"
"os/signal"
)
func newDefaultEngine(cognitive CognitiveService, channels ...CommunicationChannel) *Engine {
engine := &Engine{}
engine.channels = channels
engine.cognitive = cognitive
engine.registeredResolvers = map[CommunicationChannel]map[*Matcher]*... |
cc313eaf49706614934a6858a672d46f7ddd2cd5 | d3bb1dc66c8414ebeaa809d7eeabd67ba44b598d | mojo-zd/golang-shred | /cmd/alg/sorts/insert_sort.go | Go | go | 444 | no_license | package sorts
// 插入排序 边赋值边遍历
// 1. 每次取出i+1的位置一次和前一个数进行比较, 如果参考数据arr[i+1]大于arr[j]则进行位置交换
// 2. 通过1计算得到j的位置数据轮空,把arr[i+1]值赋给arr[j]
func InsertSort(arr []int) {
for i := 0; i < len(arr)-1; i++ {
value := arr[i+1]
var j int
for j = i + 1; j >= 0 && value < arr[j-1]; j-- {
arr[j] = arr[j-1]
}
arr[j] = value
... |
70d858be29f7db529f2331c6853c314476542683 | 9e98b6a35d1fe5adabd39ecf8302ef8f818139de | Sterks/apiGosOblako | /common/common.go | Go | go | 268 | no_license | package common
import (
"bytes"
"encoding/json"
"fmt"
)
// JSONPretty Красивый вывод
func JSONPretty(br []byte) {
var responseJSON bytes.Buffer
json.Indent(&responseJSON, br, "", "\t")
fmt.Printf("Response: %v \n", string(responseJSON.Bytes()))
}
|
3dfcf54297d3cfe0a0c3deea21a451f5dfe74385 | c7baf22bf4db6163154ed4a7123f1f783d74550e | heroku/hsup | /Godeps/_workspace/src/github.com/armon/go-metrics/metrics_test.go | Go | go | 5,419 | permissive | package metrics
import (
"reflect"
"runtime"
"testing"
"time"
)
func mockMetric() (*MockSink, *Metrics) {
m := &MockSink{}
met := &Metrics{sink: m}
return m, met
}
func TestMetrics_SetGauge(t *testing.T) {
m, met := mockMetric()
met.SetGauge([]string{"key"}, float32(1))
if m.keys[0][0] != "key" {
t.Fatal... |
5b52822a86a3c84a5924937392068dfb25ec220f | 14315bbb0d19ee1f68841fbc61c5d7a2fc8964f9 | zhenyuyan/Life-of-Bacteria | /simulation/initialization.go | Go | go | 4,786 | permissive | // Code by Kwanho Kim, Xinling Li, Zhenyu Yang
package main
import (
"math"
"math/rand"
)
// Picks a random initial location to create a bacterium
func (b Bacteria) PickInitialLocation(petriRadius float64) (float64, float64) {
r := rand.Float64() * (petriRadius - b.sizeRadius)
theta := rand.Float64() * 2 * math.... |
88d0f6add915b6cdbf2ba047e6355890f9321439 | 87374d2dd908e25956e1a7dcf7c69b59d617e808 | bamboooo-dev/himo-outgame | /internal/usecase/interactor/list_histories_interactor.go | Go | go | 1,341 | no_license | package interactor
import (
"context"
"github.com/bamboooo-dev/himo-outgame/internal/domain/model"
"github.com/bamboooo-dev/himo-outgame/internal/domain/service"
"github.com/bamboooo-dev/himo-outgame/internal/registry"
himo_repo "github.com/bamboooo-dev/himo-outgame/internal/usecase/repository/himo"
"github.com... |
85ec41b110fc01e98aa95e4b8bdff4c9d495bc93 | 6cb8405d7df03b7171ccc05abe727c5045086e2e | yunfengsay/golang_learn | /go_web/gin/myPageServer/models/base.go | Go | go | 1,818 | no_license | package models
import (
"fmt"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
// "github.com/go-pg/pg"
)
type User struct {
Id int `json: id`
Nick_Name string `json: nick_name`
User_Name string `json: user_name`
Age int `json: age`
Pwd string `json: pwd`
Emails []strin... |
0427f6383df6bb5a16d06647d08242a57b761a4c | b3870ba2d27ee17e8fe07aea6133a90ad4ba40c7 | mayunmeiyouming/Panda | /test/windows/registers/register.go | Go | go | 529 | permissive | package main
import (
"fmt"
"golang.org/x/sys/windows/registry"
)
func main() {
fmt.Printf(getDefaultConnectionSettingsValue())
}
func getDefaultConnectionSettingsValue() string {
key, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections`, regis... |
cca70913328a66769b1d722955f1b7e1efaa5e8b | 9594c24e5a2426c9e50514f37311e59f90034573 | ecletus/core | /test/utils/test_db.go | Go | go | 943 | permissive | package utils
import (
"fmt"
"os"
"github.com/go-aorm/aorm"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
)
// TestDB initialize a db for testing
func TestDB() *aorm.DB {
var db *aorm.DB
var err error
var dbuser, dbpwd, dbname = "qor", "qor", "qor_test"
if os.Getenv("DB_USER") != "" {
dbuser =... |
5cf6a2118c8d8d519e05b66ada62ffb3cf22fd3a | 116952a98146031a5700a8499e2b55f7f0024222 | kubernetes/kubernetes | /test/e2e/storage/volumes.go | Go | go | 3,316 | 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, ... |
5b69dbfee1fca6ef5a38e1f6d20c0d1336136c6e | ba169bda3bf5768bf2d91cf911b33f085663c6be | viant/afsc | /gs/key.go | Go | go | 473 | permissive | package gs
import (
"github.com/viant/afs/option"
"net/http"
)
//SetCustomKeyHeader set encryption headers
func SetCustomKeyHeader(key *option.AES256Key, headers http.Header) error {
err := key.Init()
if err == nil {
err = key.Validate()
}
if err != nil {
return err
}
headers.Set("x-goog-encryption-algori... |
10e8d4a2ef27956a8d75e3ffca00c52b24c53cf3 | 292e587a4ca56794993fd446c2db5166881c0495 | delhanty/frontend | /vendor/github.com/linkai-io/am/pkg/webhooks/slack.go | Go | go | 7,009 | permissive | package webhooks
import (
"encoding/json"
"fmt"
"strings"
"time"
"github.com/linkai-io/am/am"
)
type SlackImageTitle struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
}
type SlackImage struct {
Type string `json:"type"`
Title *SlackImageTitle `json:"title"`
ImageURL s... |
dcd76c0322672a276b041c6ee774185266bef4d1 | 40cd82174c950097bff43d76e09497a0f1097c19 | AlexanderChen1989/xrest | /plugs/i18n/i18n.go | Go | go | 1,643 | permissive | package i18n
import (
"net/http"
"os"
"path/filepath"
"strings"
"github.com/AlexanderChen1989/xrest"
"github.com/beego/i18n"
"golang.org/x/net/context"
)
var ctxI18nKey uint8
func FetchLocale(ctx context.Context) (*i18n.Locale, bool) {
l, ok := ctx.Value(&ctxI18nKey).(*i18n.Locale)
return l, ok
}
type Fin... |
9f55d9f3b11c2e213c8d7b2ada28ff284113a61d | 76bee0bd9c97224cb2b0e1655b1a4bd768006b87 | Mo3m3n/kubernetes-ingress | /controller/haproxy/rules/reqTrack.go | Go | go | 1,225 | permissive | package rules
import (
"fmt"
"github.com/haproxytech/client-native/v2/models"
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/api"
"github.com/haproxytech/kubernetes-ingress/controller/utils"
)
type ReqTrack struct {
TableName string
TablePeriod *int64
TableSize *int64
TrackKey string
}... |
4033efd16422c07d0495ffba23ac65b6c3776696 | 7bab1dd4cd3c1b01f2733c1281a25c73a43f8565 | fanyetu/leetcode | /no14/golang/sol2/sol2.go | Go | go | 692 | no_license | package main
import (
"fmt"
"strings"
)
func main() {
//strs := []string{"flower", "flow", "flight"}
//strs := []string{"dog","racecar","car"}
//strs := []string{"aa", "a"}
strs := []string{"c", "acc", "ccc"}
s := longestCommonPrefix(strs)
fmt.Print(s)
}
/*
https://leetcode-cn.com/problems/longest-common-pre... |
c0ba32792177d0d551ee9969a70e850b3f414bd8 | 797b89a3619497252d59eac292b9a84ada403192 | Snowitty/fabler | /internal/database/db.go | Go | go | 542 | no_license | package database
import (
"log"
"github.com/snowitty/fabler/conf"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
_ "github.com/jinzhu/gorm/dialects/sqlite"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
var DB *gorm.DB
var err error
func init(){
DB, err = gorm.Open(conf.Config().DB.Driv... |
f17fc14cf3770cb2912183957333c0a820c11a64 | 0b14c623471e6a11f9e633b0ebbf09bdbd700f88 | chuwt/bee | /pkg/transaction/event_test.go | Go | go | 3,775 | permissive | // Copyright 2021 The Swarm 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 transaction_test
import (
"errors"
"math/big"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
... |
2117494ff2671b2ad016401fd844ed083bf0994d | 9855e296df7b63c2869850412d6d26edfd8a59ac | qoodblock/burrow | /txs/payload/call_tx.go | Go | go | 1,515 | permissive | package payload
import (
"fmt"
"github.com/hyperledger/burrow/acm/state"
"github.com/hyperledger/burrow/crypto"
)
func NewCallTx(st state.AccountGetter, from crypto.PublicKey, to *crypto.Address, data []byte,
amt, gasLimit, fee uint64) (*CallTx, error) {
addr := from.Address()
acc, err := st.GetAccount(addr)
... |
f930a82731346f442c9784094ba1f5718bc5540c | dbc447ce0fd9719f44ec9d8f0c87d8d7b0c59353 | janmir/go-weather | /pkg/apixu.go | Go | go | 2,669 | no_license | package weather
// Apixu ...
type Apixu struct {
Location struct {
Name string `json:"name"`
Region string `json:"region"`
Country string `json:"country"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
TzID string `json:"tz_id"`
LocaltimeEp... |
86ffacf6cf4557a5b660a9361357482cc53848d7 | e53805abece4ed21ad45c14c8aea4df820c7c96e | Altinity/tsbs | /cmd/tsbs_generate_queries/utils/query_generator.go | Go | go | 702 | permissive | package utils
import "github.com/timescale/tsbs/query"
// QueryGenerator is an interface that a database-specific implementation of a
// use case implements to set basic configuration that can then be used by
// a specific QueryFiller, ultimately yielding a query.Query with information
// to be run.
type QueryGenerat... |
92b34ce08c56cb17e579bfb6b5749a7b6d395487 | b4cf8b75e443543221e23470003fbea9697f3e01 | containers/podman | /vendor/github.com/ulikunitz/xz/internal/hash/doc.go | Go | go | 480 | permissive | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package hash provides rolling hashes.
Rolling hashes have to be used for maintaining the positions of n-byte
sequences in the dictionary buffer.
The pa... |
e57ecc821f1c099bad3f35e1f1b12bbd6e0e56ba | 9abade8ce2b6383c4b548e6202007f8794643b64 | kubernetes-sigs/kind | /pkg/cluster/internal/providers/common/namer.go | Go | go | 1,064 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
2288b065f0a9d663eb22091c87f0631958b1f830 | dfda8f877a673f89e7a7cce0bf61eaf979f7b94a | mrparkers/cert-manager | /pkg/webhook/handlers/testdata/apis/testgroup/validation/validation_test.go | Go | go | 3,899 | permissive | /*
Copyright 2019 The Jetstack cert-manager contributors.
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... |
a851998923884a51f2de8caacf98361bff38cc95 | d3e836568664ce038c65589f38c9782c86ce2156 | monder/route53-etcd | /utils/path_test.go | Go | go | 2,490 | permissive | package utils
import "testing"
func TestCorrectPathMatching(t *testing.T) {
assert := func(value bool, log string, args ...interface{}) {
if value != true {
t.Fatalf(log, args...)
}
}
assert(MatchPath("/aaa/bbb/ccc", "/aaa/bbb/ccc"), "/aaa/bbb/ccc")
assert(MatchPath("/aaa/bbb/ccc", "/aaa/bbb/*"), "/aaa/bbb... |
3a66c44cd17c3cd71e9befeb7001ee4b1620f9f8 | 5e7c6c95e3c8f9a275a88b5d118b16eb83977ae1 | fr34k8/amazon-ecs-cli | /ecs-cli/modules/utils/waiters/waiters.go | Go | go | 2,788 | permissive | // Copyright 2015-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license... |
a65f8d35518641e038ecc9fbba9d592f7a0e2c6a | a2d34fcab714703e072f575ddfd1347c48bf9431 | qiniu-ava/mxnet-operator | /vendor/github.com/kubernetes-incubator/kube-arbitrator/pkg/client/listers/v1alpha1/queuejob.go | Go | go | 3,063 | 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, ... |
b0e4e6d1b162fe257f9bff3868b000f46e547c22 | 44c987a8d2c9b8a1e85d971e463761cbda98d3d6 | prodhe/gopher | /gophermap.go | Go | go | 1,452 | permissive | package main
import (
"bufio"
"os"
"path/filepath"
"strconv"
"strings"
)
var (
filename string = "gophermap"
)
// Gophermap parses the given file 'fn' and returns a proper gopher list of items
func Gophermap(fn string) List {
var l List
f, err := os.Open(fn)
defer f.Close()
if err != nil {
return Error(... |
c994acfa81d4355f0dad9d67b35f6e84fd5ee423 | 900160ff4cc1def09ec7be72ba25ebc8759ca9f6 | hprateek43/kubernetes | /staging/src/k8s.io/legacy-cloud-providers/azure/azure_routes.go | Go | go | 19,126 | permissive | //go:build !providerless
// +build !providerless
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless re... |
fc9c429f56863152e39a8a09bf8735e164501097 | fad204cf0546dce60e9cc29a40d1bd4fc033360c | gcash/bchwallet | /waddrmgr/common_test.go | Go | go | 9,773 | permissive | // Copyright (c) 2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package waddrmgr
import (
"encoding/hex"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
"github.com/gcash/bchd/chaincfg"
"github.com/gcash/bchwallet/walletdb"
_... |
00f46714b1986247ad726b9c9617c24c0c12f4ac | c70cfbd94fac4decc2fe57929e6e02740ac4976f | SergeyArtemov/Logistics_Strela | /StrelaAreas_Server2/go/routers.go | Go | go | 2,442 | no_license | /*
* Area API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 1.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"encoding/json"
"io/ioutil"
"net/http"
"os"
"strconv"
"github.co... |
3d10e3ab56dcbb08cca1dd3d833b9ae5ac8d8a89 | de7d451200d9eb590bb1fa97b7d50325f3aba149 | nozgurozturk/mercury-server | /api/server.go | Go | go | 340 | no_license | package api
import (
"fmt"
"github.com/joho/godotenv"
"github.com/nozgurozturk/mercury-server/api/controllers"
"os"
)
var server = controllers.Server{}
func Start() {
e := godotenv.Load()
if e != nil{
fmt.Print(e)
}
server.Initialize()
port := ":" + os.Getenv("PORT")
if port == ""{
port = ":8000"
}
... |
b5c5369d448ae39a2dc8ec498336f025437e84a1 | bb4452e03c952605b776d12a7dfb3529bb263820 | lupes/leetcode | /question_001_100/question_31_40/33_search_in_rotated_sorted_array_test.go | Go | go | 534 | no_license | package question_31_40
import "testing"
func Test_search(t *testing.T) {
type args struct {
nums []int
target int
}
tests := []struct {
name string
args args
want int
}{
{"test#0", args{nil, 0}, -1},
{"test#1", args{[]int{4, 5, 6, 7, 0, 1, 2}, 0}, 4},
{"test#2", args{[]int{4, 5, 6, 7, 0, 1, 2}, ... |
05ff4de215d232d1de7076726f5f64b1bbbeff12 | 3049f7561b74abd31ae8e50a3b5e7b04aa8d28af | kokizzu/go-sarah | /_examples/simple/plugins/todo/command.go | Go | go | 5,604 | permissive | /*
Package todo is an example of stateful command that let users input required arguments step by step in a conversational manner.
On each valid input, given argument is stashed to *args.
*args is passed around until all required arguments are filled.
*/
package todo
import (
"context"
"fmt"
"github.com/oklahomer/... |
6cdcec5b01e26a573147a84edb1675a210e76687 | efbbfabb7d533fa0098c93f0762d5001985869e5 | reyoung/mustache | /lookup.go | Go | go | 3,654 | permissive | // Copyright (c) 2014 Alex Kalyvitis
// Portions Copyright (c) 2009 Michael Hoisie
package mustache
import (
"reflect"
"strings"
)
// lookupFieldInStruct try to look a field in reflect struct. Returns nil when
// there is no field or method is that `name`.
func lookupFieldInStruct(reflectValue reflect.Value, name ... |
89300a86c16be2607b6157189d5490a4d5f7b8e1 | 2ea18ea8dd0ef478f1b3a31e9769dc3d538a6d39 | Pororochenzy/leetcode-by-go | /leetcode/1038.Binary-Search-Tree-to-Greater-Sum-Tree/1038. Binary Search Tree to Greater Sum Tree.go | Go | go | 536 | no_license | package leetcode
import (
"leetcode-by-go/structures"
)
// TreeNode define
type TreeNode = structures.TreeNode
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func bstToGst(root *TreeNode) *TreeNode {
if root == nil {
retur... |
25ab582bacfdb837dcaeef3fd07a3fee6e251790 | 62360ae0a0fa0abd6c1bb6b4cd5b3e965d01cc75 | BobDeng1974/alexa-local-server | /internal/alexa/request.go | Go | go | 2,418 | permissive | package alexa
import (
"context"
"log"
"net/http"
"strings"
"github.com/AndreasAbdi/alexa-local-server/internal/encoding"
"github.com/mikeflynn/go-alexa/skillserver"
)
const launchRequestType = "LaunchRequest"
const intentRequestType = "IntentRequest"
const sessionEndedRequestType = "sessionEndedRequest"
const... |
3670c33a5b20f0b177c63f82df43c9e0862ff236 | 06757cb0dbb4463511537c73e5a9c1e588c8f7df | Corporex/origin | /pkg/project/cache/cache.go | Go | go | 3,306 | permissive | package cache
import (
"fmt"
"time"
"k8s.io/klog"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/runtime"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/cache"
projectapi "github.com/openshift/origin/pkg/project/apis... |
3be8b24b041d32c86cd4c2e37fec9fc9eca8c8ea | 2f760d04b7df60fa2f3f1867bfae41cf0b0d6f7a | funktionslust/gobulk | /input/s3.go | Go | go | 8,701 | permissive | package input
import (
"context"
"fmt"
"path"
"strconv"
"strings"
"time"
"github.com/funktionslust/gobulk"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"go.uber.org/zap"
)
// S3InputConfig ... |
237fd851ce94149d309e3308f58ab616217c821b | 538650b454147e6f60c3d32effa5fb132093cd5d | nya3jp/tast-tests | /src/chromiumos/tast/local/network/wpa_supplicant.go | Go | go | 296 | permissive | // Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package network
// Constants for interacting with wpa_supplicant via dbus.
const (
DBusWPASupplicantInterface = "fi.w1.wpa_supplicant1.Interface"
)
|
93b63782f5648cb5a856c38dd8f079b722e50531 | a2d2d97958d2067f5fea821f7e8aaefc2893b3b7 | ferhatelmas/fleet | /server/service/service_fim_test.go | Go | go | 2,020 | permissive | package service
import (
"context"
"testing"
"github.com/kolide/fleet/server/kolide"
"github.com/kolide/fleet/server/mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetFIMService(t *testing.T) {
ds := &mock.Store{
AppConfigStore: mock.AppConfigStore{
AppConfigF... |
c06901eb9e89124de561ad3006102413ccd4dc65 | 6e22c2de210c589c0e5114948c58851a13eb5b9b | mfaulk/arbitrum | /packages/arb-node-core/challenge/common_test.go | Go | go | 11,966 | permissive | /*
* Copyright 2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
8e0abfd5212be2f6d93822e434e17b9ab0cab7ca | c11a6fcf0b9d7801ba6fa8ed9a46b5f577230d7d | kubernetes/kubernetes | /staging/src/k8s.io/pod-security-admission/test/fixtures_seLinuxOptions.go | Go | go | 3,090 | permissive | /*
Copyright 2021 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, ... |
0b1787093adcf56bb5b3ad976dd1e8335e08ced3 | 76a8c874bd238e9128e96fda81e5c3a09940a514 | mojo-lang/mojo | /go/pkg/mojo/parser/syntax/get_position.go | Go | go | 293 | no_license | package syntax
import (
"github.com/antlr4-go/antlr/v4"
"github.com/mojo-lang/lang/go/pkg/mojo/lang"
)
func GetPosition(token antlr.Token) *lang.Position {
position := &lang.Position{}
position.Line = int64(token.GetLine())
position.Column = int64(token.GetColumn())
return position
}
|
bc2fd340980d86ecb177afbff078910d347da1cc | 3ffd9a1602340ae1ce164bbae7c0227c8db540df | JxGolibs/configor | /configor.go | Go | go | 3,587 | permissive | package configor
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path"
"reflect"
"regexp"
"strings"
"time"
)
type Configor struct {
*Config
configModTimes map[string]time.Time
}
type Config struct {
Environment string
ENVPrefix string
Debug bool
Verbose ... |
26b873afe9d6ff64ad59ea4426695b962d04b73c | 5822c372ececf17c49988b15e5812d5c45ece95f | stoyanr/gardener-extensions | /pkg/controller/operatingsystemconfig/oscommon/template/template_generator.go | Go | go | 3,612 | permissive | // Copyright (c) 2019 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... |
f71b30b8d4905aff7736938ca9837c87ebf25cca | f6421f3212c5fd7a41e9126ec5994fc2c40b07cb | sgtest/monorepo-test-3 | /kubernetes-4/federation/pkg/dnsprovider/providers/coredns/rrchangeset.go | Go | go | 4,519 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
3516f7e32cfc001948c9fbbe7c2599e6e5a8ab9b | 7e62d4f7de0aaa85f357133881212d7d22b81264 | lonjoy/Open-IM-Server | /src/api/chat/pull_msg.go | Go | go | 2,295 | permissive | package apiChat
import (
"Open_IM/src/common/config"
"Open_IM/src/common/log"
"Open_IM/src/grpc-etcdv3/getcdv3"
"Open_IM/src/proto/chat"
"Open_IM/src/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
type paramsUserPullMsg struct {
ReqIdentifier *int `json:"reqIdentifier" binding:"require... |
6797bd498612e25c9101dcf9fa1b8c7ba6c6e243 | 7f5561598134cb2b2ff97e7af839424eb206220d | paulusss/rekayasa | /Serialization.go | Go | go | 880 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net"
"os"
)
func main() {
if len(os.Args) != 3 {
fmt.Fprintf(os.Stderr, "Usage: %s host:port filename ", os.Args[0])
os.Exit(1)
}
file, err := os.Open(os.Args[2])
checkError(err)
defer file.Close()
fmt.Println("file ", file.Name(), " berhasil dibuka")
servi... |
3fa92c7a4f92c0b7653dc52f5468cd0a266a1702 | 6fe8e4ae9681f1f58ad29f02a0fa8f4c89ae5f4a | mateothegreat/k9s | /internal/render/sts_test.go | Go | go | 436 | permissive | package render_test
import (
"testing"
"github.com/derailed/k9s/internal/render"
"github.com/stretchr/testify/assert"
)
func TestStatefulSetRender(t *testing.T) {
c := render.StatefulSet{}
r := render.NewRow(4)
assert.Nil(t, c.Render(load(t, "sts"), "", &r))
assert.Equal(t, "default/nginx-sts", r.ID)
assert... |
a1a9e829103111f20ef7e9b8bf628b81be7305a1 | 6167aca625585b80fa82ee88b13e05e9bf335e90 | fastock/fastock-chain | /x/slashing/internal/types/expected_keepers.go | Go | go | 2,568 | permissive | // noalias
// DONTCOVER
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
"github.com/fastock/fastock-chain/x/params"
stakingexported "github.com/fastock/fastock-chain/x/staking/exported"
)
// AccountKeeper expected account keeper
type Acco... |
d7fa12969dc8072e4784281f04a8e3e982b9a1b5 | e7c5007fee5cb80c99eb20e7c67f4ba660c7aa06 | smcavallo/pixie | /src/cloud/api/controller/testutils/testutils.go | Go | go | 5,111 | permissive | /*
* Copyright 2018- The Pixie 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... |
917557430f780506a122a49be24fea6b86fa9c97 | 10eba33d2fa84dca552ad00981cf713baf157b1b | infobloxopen/docker-infoblox | /vendor/github.com/docker/engine-api/client/container_export_test.go | Go | go | 1,280 | permissive | package client
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
"golang.org/x/net/context"
)
func TestContainerExportError(t *testing.T) {
client := &Client{
transport: newMockClient(nil, errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ContainerExport(conte... |
d022912f5d657c91b3f2a5f50454a268c474fe35 | 45c2268562a5d53d23d6a42246d333a6144e48dc | techmexdev/oauthlib | /memstorage.go | Go | go | 4,451 | permissive | package oauthlib
import (
"errors"
"log"
"sync"
)
// Logger is a func compatible with most logging func's.
type Logger func(string, ...interface{})
// MemStorage is a simple Storage compatiable example data store.
//
// It is not suitable for use in production.
type MemStorage struct {
sync.RWMutex
// Clients ... |
234a3dfc0b16bf464fe41e8110b2658fad0c3711 | 0c4911466c1d234f2054304c18d263feef88fbce | cloudflare/cfssl | /vendor/github.com/zmap/zlint/v3/lints/rfc/lint_ext_san_empty_name.go | Go | go | 2,662 | permissive | package rfc
/*
* ZLint Copyright 2023 Regents of the University of Michigan
*
* 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 requi... |
c3c18b499089acda0284fd3bcfd920854a8058f7 | c0f6d8f1e07f2b3a8396eba933c3559388a083b9 | jsha/certlint-1 | /checks/certificate/subject/oid.go | Go | go | 5,300 | permissive | package subject
import (
"encoding/asn1"
"fmt"
)
// Max field length:
// https://www.itu.int/ITU-T/formal-language/itu-t/x/x520/2001/UpperBounds.html
type object struct {
oid asn1.ObjectIdentifier
maxLength int
}
func (o *object) Equal(oid asn1.ObjectIdentifier) bool {
return o.oid.Equal(oid)
}
func (o *... |
5d0c760189b53c21e69dbef3298fa40a408cf9b5 | 92f51af4adcd92c2a1f4f724f6761bb9722be8a1 | l0k18/9 | /pkg/peer/mrunoncemap_test.go | Go | go | 4,404 | permissive | package peer
import (
"fmt"
"testing"
)
// TestMruNonceMap ensures the mruNonceMap behaves as expected including limiting, eviction of least-recently used entries, specific entry removal, and existence tests.
func TestMruNonceMap(
t *testing.T) {
// Create a bunch of fake nonces to use in testing the mru nonce code... |
de12a1f7e5a1851629dbada9444ecbc8ca0e79d4 | 1d2271526e78ce9ede16aa20e29b38edaf6ba8f8 | boundray/baetyl-cloud | /api/sync_test.go | Go | go | 2,652 | permissive | package api
import (
"encoding/json"
"os"
"testing"
"github.com/baetyl/baetyl-go/v2/log"
specV1 "github.com/baetyl/baetyl-go/v2/spec/v1"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/baetyl/baetyl-cloud/v2/config"
ms "github.com/baetyl/baetyl-cloud/v2/mock/service"
)
func... |
4b7e72c14b57c19c9ce1fa947c557e06b95c219e | 6a2a170cc5f10c0f6fb039ae67b1a54cd6058f60 | jalasoft/webcam-go | /camserver/params/parameters.go | Go | go | 1,423 | no_license | package params
import (
"errors"
"flag"
"fmt"
"strings"
)
type Port uint
type VideoFile struct {
Name string
Path string
}
type videofiles_parser struct {
files []VideoFile
}
func (d *videofiles_parser) Set(str string) error {
index := strings.Index(str, "=")
name := str[:index]
file := str[index+1:]
... |
242b9ddc0773ef3c413568247a2c39675018e7fc | 74aaf8ab948b4c22c1a021191bee5765dbb6bd15 | etcd-io/etcd | /tests/framework/integration/bridge.go | Go | go | 3,960 | permissive | // Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
6072890c23e3e8b8ba2410cb748c1c4865e79406 | 8d457b180212a9559752a32c9fa988108bd69a49 | rkbright/script | /filters_test.go | Go | go | 12,239 | permissive | package script
import (
"bytes"
"errors"
"io/ioutil"
"regexp"
"strings"
"testing"
)
func TestBasename(t *testing.T) {
t.Parallel()
testCases := []struct {
testFileName string
want string
}{
{"\n", ".\n"},
{"/", "/\n"},
{"/root", "root\n"},
{"/tmp/example.php", "example.php\n"},
{"./src/... |
27ed40873a29e2e1394896c6707b9225e3495b1e | f9abe72007743f0520ee67e00edcf5e7d93c938a | Hangzhi/Thanos-REST-API-test | /rules-go-server-generated/go/model_alert.go | Go | go | 891 | no_license | /*
* Rules
*
* / Rules represents API that is responsible for gathering rules and their statuses.
*
* API version: 0.0.4
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
type Alert struct {
// / state returns the maximum state of alert instances for this r... |
07a146ceba4e8fab01dbfefe673cae6a0f55ca2c | a872e0ef603e032a102a9a2a82eb0eae75753bee | proxy-p/howtocode-golang | /exercises_ninja_lvl6/exercise4/exercise4.go | Go | go | 451 | no_license | package main
import (
"fmt"
)
//Creating a TYPE 'PERSON'
type person struct {
first string
last string
age int
}
//Creating a 'SPEAK' METHOD for a TYPE 'PERSON'
func (p person) speak() {
fmt.Println("I am", p.first, p.last, "and I am", p.age, "years old.")
}
func main() {
//ASSIGNING a VALUE of TYPE 'PERSO... |
a13ec6f0808a1ccf51afc68152440a8864f607af | 2e5f208f6633d3692ca0ccd3c7b55d9069e72d78 | neerfri/pack | /internal/archive/tar.go | Go | go | 3,878 | permissive | package archive
import (
"archive/tar"
"bytes"
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/pkg/errors"
)
var NormalizedDateTime time.Time
func init() {
NormalizedDateTime = time.Date(1980, time.January, 1, 0, 0, 1, 0, time.UTC)
}
func WriteDirToTar(tw *tar.Wri... |
4125f6791049ba7f10d6ce6053145ad5296817da | 4931956c4aabcc21aad84bcc8352bc15bf9ed27b | inkyblackness/deck | /src/github.com/inkyblackness/shocked-client/ui/LimitedAnchor.go | Go | go | 1,226 | permissive | package ui
type limitedAnchor struct {
from Anchor
to Anchor
reference Anchor
}
// NewLimitedAnchor returns an anchor which limits the value of another
// anchor within two reference anchors.
// Requests to set a new value are forwarded to the reference anchor if the
// new value is within the allowed ... |
694c19c8fcb418f108f020ebadef6ca115e83419 | 8e64ec6b7d18a115e65e0ecf863d2bffac554220 | saurav-c/tasc | /lib/storage/storage.go | Go | go | 1,392 | no_license | package storage
import "strings"
const (
keyVersionDelim = ":"
)
type StorageManager interface {
// Commit all of the changes made in this transaction to the storage engine.
//CommitTransaction(tid string, CommitTS string, writeBuffer map[string][]byte) error
// Retrieve the given key as a part of the transacti... |
3e066c349bca29d95a66229d20ca8aabe1b9c34f | e954f6d302e98963f2c504e15044125474f2d724 | isabella232/terraform-provider-sparkpost | /main.go | Go | go | 394 | permissive | package main
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/SurveyMonkey/terraform-provider-sparkpost/internal/provider"
)
var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary
version string = "dev"
)
func main() {
opts := &plu... |
5616897693175e2061bf74f2f55a2e27c6a26187 | 08855418b045d0cb8d6ee2ac64a2f69c1fc1ff53 | diatmpravin/golang-practice | /gods/equal-stack-v1/stack_test.go | Go | go | 498 | no_license | package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
var equalStackTest = []struct {
arr1, arr2, arr3 []int
result int
}{
{[]int{}, []int{}, []int{}, 0},
{[]int{1}, []int{1}, []int{1}, 1},
{[]int{1, 1, 1, 1, 1}, []int{1, 2, 2}, []int{4, 1}, 5},
{[]int{3, 2, 1, 1, 1}, []int{4, 3, 2}... |
69a301288bf55aa90acbf963c873b0f342d887f8 | 4bd6d4d5a6b6908f55baf6b2b0594cf22c6654a1 | cep21/gaming | /src/blackjack/rules.go | Go | go | 6,578 | no_license | package blackjack
func AllValues() []uint {
return []uint{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}
}
type BlackjackPayout float64
const NORMAL_PAYOUT = 1.5
const SIXFIVE_PAYOUT = 6.0 / 5.0
type SurrenderOption interface {
Name() string
}
type surrenderOptionImpl struct {
name s... |
66e8dcf38e4dc461c1cc95007fd69a2157feccec | 5d611e09573c050748ca0b50be3b842d2e35a347 | anthonyroux/amadeus-go | /pkg/services/service.go | Go | go | 15,178 | no_license | package services
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/go-kit/kit/log"
)
type AmadeusService interface {
FlightLowFareSearch(context.Context, *FlightLowFareSearchRequest) (*Response, error)
FlightInspirationSearch(context.Context, *FlightInspirationSearchRequest)... |
f9f6158e6ab16e92098cc4f156a128e883a88073 | 8313dc2700d74973b4a2261bbf066c613603663b | nyumbapoa/mpesa | /main.go | Go | go | 475 | permissive | package main
import (
"fmt"
"github.com/nyumbapoa/mpesa/mpesa/pay"
"log"
)
const (
appKey = ""
appSecret = ""
)
func main() {
fmt.Println("Welcome to the world of mpesa")
svc, err := pay.New(appKey, appSecret, pay.SANDBOX)
if err != nil {
panic(err)
}
res, err := svc.C2BRegisterURL(
600157,
"... |
c9edef5f95bebb45870588c85001dcc05d0989e9 | c9aaa00aaa0232bf37ad561bdf882b6d820c6511 | MachineLearningMentor/go-ipfs | /unixfs/io/directory.go | Go | go | 7,314 | permissive | package io
import (
"context"
"fmt"
"os"
mdag "github.com/ipfs/go-ipfs/merkledag"
format "github.com/ipfs/go-ipfs/unixfs"
hamt "github.com/ipfs/go-ipfs/unixfs/hamt"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"... |
3cc41442568d4fb3384623eafda68cce8b9714ce | 412b95dd60b5e0b1d2b6d48082d1b0f5d318807c | owainlewis/oci-cloud-controller-manager | /vendor/github.com/oracle/oci-go-sdk/v50/core/instance_configuration_instance_source_via_boot_volume_details.go | Go | go | 1,897 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
c48de4a81e884744bbb73e0281ed7972adade849 | e524d8210d78023c62fe8be8bc88bffa6965f997 | openshift/installer | /terraform/providers/openstack/vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes/requests.go | Go | go | 6,820 | permissive | package volumes
import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
// CreateOptsBuilder allows extensions to add additional parameters to the
// Create request.
type CreateOptsBuilder interface {
ToVolumeCreateMap() (map[string]interface{}, error)
}
// CreateOpts conta... |
9d52f585f8c601b367763b279d8c85969bb83eee | 058258dc29e8eddda637a52e5c0d64c13afa0269 | themayurkumbhar/1build | /cmd/config/parse.go | Go | go | 2,308 | permissive | package config
import (
"errors"
"fmt"
"strings"
"github.com/gopinath-langote/1build/cmd/utils"
"gopkg.in/yaml.v3"
)
// OneBuildConfigFileName one global declaration of config file name
var OneBuildConfigFileName = "1build.yaml"
// OneBuildConfiguration is a representation of yaml configuration as struct
type ... |
19a6854ca54e6fabf77c7771bf870c5b8ad2a4b9 | 4b1979e13fbb895fdbbd8ec6a837d364a6b6f1e0 | luiz-couto/taskit | /taskit-frontend/cmd/time.go | Go | go | 1,411 | permissive | package cmd
import (
"errors"
"fmt"
"os"
"strconv"
"time"
"github.com/spf13/cobra"
)
// timeCmd represents the time command
var timeCmd = &cobra.Command{
Use: "time [taskID]",
Short: "See the working time spent on a task",
Long: ``,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < ... |
33705e4566059a1da7391cd3e6291db80fe5ca5e | cac72898233d82993df908ff8177b3db21f16b58 | sanglt/es-writer | /e2e_test.go | Go | go | 11,251 | permissive | package es_writer
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"path"
"runtime"
"strings"
"testing"
"time"
"github.com/streadway/amqp"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
"gopkg.in/olivere/elastic.v5"
)
func c... |
179d28e455f634fbc11984ab8020a723e65b47ad | 370e643d4b2b8f73466526662d2ec50a9ed25900 | jangocheng/osp | /pkg/router/views/kube_views/serializers.go | Go | go | 1,327 | permissive | package kube_views
type ListSerializers struct {
Cluster string `json:"cluster" form:"cluster"`
Name string `json:"name" form:"name"`
Namespace string `json:"namespace" form:"namespace"`
LabelSelector interface{} `json:"label_selector" form:"label_selector"`
CronjobUID string ... |
6e0bffb125e8e938a966987ad222bfc2b368a959 | 09d829dfa20ef26f9c1c6c02ca9e0d70f27e2bc2 | Kubuxu/go-skiplist-ipld | /skiplist.go | Go | go | 4,912 | permissive | package skiplist
import (
"bytes"
"context"
"errors"
"math/bits"
lru "github.com/hashicorp/golang-lru"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log/v2"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
)
var log = logging.Logger("skiplist")
var ... |
e1b776ad0a3d8853965331507b2496f5a398877f | c9e6a5e61175363fce9099c528953f9802345a0b | warrensbox/bulk-emailer | /vendor/gopkg.in/jpoehls/gophermail.v0/base64mime.go | Go | go | 1,916 | permissive | package gophermail
import (
"bytes"
"encoding/base64"
"io"
)
var delimiter = []byte("\r\n") // CRLF
// Lines should be no longer than 76 characters excluding the CRLF.
// See RFC 2045 and GitHub Issue #13.
const maxLength = 76
// splittingWriter is an io.WriteCloser that delimits
// the written data into fixed l... |
0262a40d39f356ecd8171260468b47e720ea22c1 | a6ef31f7f820195f2d1ee5e6bdcd0d6effd85f6c | jamesgoodhouse/terraform-provider-duo | /main.go | Go | go | 296 | no_license | package main
import (
"github.com/broamski/terraform-provider-duo/duo"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/terraform"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: func() terraform.ResourceProvider {
return duo.Provider()
},
})
}
|
f673e7aae71fe1ec3637cc81282ddca240cacbac | 7166b2bc2bb71194994fae2ab1be694bdc518554 | yourchanges/hole | /session.go | Go | go | 269 | no_license | package hole
type Session struct {
Id []byte
r *ReadStream
w *WriteStream
}
func NewSession(sessionId []byte, conn Conn) Session {
return Session{
Id: sessionId,
r: NewReadStream(),
w: &WriteStream{
conn: conn,
sessionId: sessionId,
},
}
}
|
de9c292fcc34e0ac35835d6ba9de5c4b4aa36251 | d6a50dfc499f1d6615a2f7180b8b1f32fcb0012e | ntrianta/ar-web-api | /utils/caches/handleCache.go | Go | go | 1,793 | no_license | /*
* Copyright (c) 2014 GRNET S.A., SRCE, IN2P3 CNRS Computing Centre
*
* 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 req... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.