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 |
|---|---|---|---|---|---|---|---|---|
d3c8bdddf9b4ea7944683acc9fb5c57134cc6bb9 | 4f8df635ea6e06ed4d0d0d6fe13cc4ab10d88299 | authelia/authelia | /internal/suites/scenario_regulation_test.go | Go | go | 2,496 | permissive | package suites
import (
"context"
"log"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
type RegulationScenario struct {
*RodSuite
}
func NewRegulationScenario() *RegulationScenario {
return &RegulationScenario{
RodSuite: NewRodSuite(""),
}
}
func (s *Regulat... |
c871cbdf9e020b4fa400b709d6493119834b927c | 306ad69d5a8f0cf588cb325e8f27aebae62c7d82 | terminalnode/dotfiles | /src/decimal_time.go | Go | go | 1,777 | no_license | package main
import (
"flag"
"fmt"
"os"
"time"
)
const (
msInDay = 86_400_000
msInDHour = 8_640_000
msInDSecond = 864
)
var format = flag.String("f", "long", "output format (long, short, hour, minute, second)")
var padding = flag.Bool("0", false, "toggle zero-padding for hour")
type printFunction func(... |
1bde3b7a27b0b61e0c12734d95d412503f324794 | 22e3f47e587b2ca13bbfe2427abbc8bae0ae9b39 | risooonho/goguelike | /game/floor/floor_serialize.go | Go | go | 2,295 | permissive | // Copyright 2014,2015,2016,2017,2018,2019,2020 SeukWon Kang (kasworld@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 r... |
72d94223224a8bf8b262d85ade96b1d6b8e43c66 | 816a412b7d6e0ba6bc34e834e6b185d155fcdba7 | voor/kubo-ci | /src/tests/integration-tests/generic/ulimit_test.go | Go | go | 657 | no_license | package generic
import (
"strconv"
"tests/test_helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Ulimit", func() {
var (
runner *test_helpers.KubectlRunner
)
BeforeEach(func() {
runner = test_helpers.NewKubectlRunner()
runner.Setup()
})
AfterEach(func() {
runner.Te... |
91124bc7ecedd8b603f84c34aa424f6aa64afb4c | 84c16a208a7b6169d67595714689fe1d96f1cc38 | nkubala/minikube | /pkg/minikube/driver/install.go | Go | go | 4,852 | permissive | /*
Copyright 2019 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
885f9d69ad9d1a14ff6568ae0100e60db7c0adc7 | 45f0a242e2d548d894dbb4b0a5f51e2965b7ebe3 | terraform-google-modules/terraform-example-foundation | /helpers/foundation-deployer/utils/logger.go | Go | go | 1,169 | permissive | // Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
9bd92692bdeb8794a97eac2f1276fe6024bf8718 | 4a6ef5c4136346021556723b09451e12047cf228 | ppwfx/go-rdfgen | /gen/schema/AMRadioChannel.go | Go | go | 308 | no_license | package schema
type AMRadioChannelTrait struct {
}
type AMRadioChannel struct {
MetaTrait
AMRadioChannelTrait
RadioChannelTrait
BroadcastChannelTrait
IntangibleTrait
ThingTrait
AdditionalTrait
}
func NewAMRadioChannel() (x AMRadioChannel) {
x.Type = "http://schema.org/AMRadioChannel"
return
}
|
547e3974707eb0011b6d2f637cf19053a185e235 | 18a205120df7c22bb87c60c0f5682dd7f5681c70 | TranBaVinhSon/go-libra | /types/contract_event.go | Go | go | 6,318 | permissive | package types
import (
"errors"
"fmt"
"github.com/the729/go-libra/crypto/sha3libra"
"github.com/the729/go-libra/generated/pbtypes"
"github.com/the729/go-libra/types/proof"
"github.com/the729/go-libra/types/proof/accumulator"
"github.com/the729/lcs"
)
type EventKey []byte
type EventHandle struc... |
ff0d486e31caec6b962706784035c8b2c1b1c56a | 25e29858d3b0eb7a6aaf4b96937c815df5fd3820 | One-boy/nuobel-cloud | /models/loginModel.go | Go | go | 1,009 | permissive | package models
import (
. "nuobelcloud/conf"
sql "nuobelcloud/mysql"
"nuobelcloud/session"
. "nuobelcloud/tools"
"time"
)
/*
登陆相关数据处理
*/
//用户信息结构
type UserInfo struct {
Uid int
UserName string
Pass string
Email string
}
//登陆操作
func (c *UserInfo) LoginHandle() (*session.SessionInfo, error) {
... |
8b637d3f7e04971d3a1c330124f860e51dfa4bf2 | c14d16ab20e9d62f68d5397c4d82cd6b5510a831 | rj08zhou/timerwheel | /timerwheel/common/model/safe_map.go | Go | go | 801 | permissive | package model
import "sync"
type SafeMap struct {
sync.RWMutex
M map[string]string
}
func NewSafeMap() *SafeMap {
return &SafeMap{M: make(map[string]string)}
}
func (this *SafeMap) Get(key string) (string, bool) {
this.RLock()
defer this.RUnlock()
value, ok := this.M[key]
return value, ok
}
func (this *Safe... |
bbad700c86a3e13a1bdaed69703249f2d36bd94e | 9140205b4889cdc6e89fd97b9dd32bbedab9a455 | IanCode/neonKUBE | /Go/src/github.com/loopieio/cadence-proxy/cmd/cadenceproxy/messages/cluster/cancel_reply.go | Go | go | 3,128 | permissive | package cluster
import (
"github.com/loopieio/cadence-proxy/cmd/cadenceproxy/cadenceerrors"
"github.com/loopieio/cadence-proxy/cmd/cadenceproxy/messages"
"github.com/loopieio/cadence-proxy/cmd/cadenceproxy/messages/base"
)
type (
// CancelReply is a ProxyReply of MessageType
// CancelReply. It holds a referenc... |
5a093a4b60365522b8f583299090389f66cca2e0 | 4d2ae4cb1d8724a3b3ee1df90754f2f7f44a8b7b | jin502437344/gf | /os/glog/glog_logger_rotate.go | Go | go | 6,695 | permissive | // Copyright 2020 gf Author(https://github.com/jin502437344/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/jin502437344/gf.
package glog
import (
"fmt"
"github.c... |
66934b471d598b79d44282bde619e588f6b8bfdd | d1f2ea43238399952ca94bb35d40ae26a3ced1ea | dmmarkov/ygot | /ytypes/leafref_test.go | Go | go | 30,740 | permissive | // Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
3bc083334de4ef3d47fdb278a42b1add02c66b95 | d3ce7cf995fa0d119f25fc473c206dcfb243ff5f | Kitsana24/umami | /helpers/user.go | Go | go | 1,913 | no_license | package helpers
import (
"net/http"
"strconv"
"umami/models"
c "github.com/astaxie/beego/context"
"github.com/astaxie/beego/orm"
"github.com/gorilla/securecookie"
)
var s = securecookie.New(
securecookie.GenerateRandomKey(64),
securecookie.GenerateRandomKey(32))
//KeepLogin login
func KeepLogin(w *c.Respons... |
20d6f246831fbd5943b76e6078590c2d37eab817 | 18ac330ac1fe6d52f3850055e5e6995034e25bb6 | rootsongjc/openfaas-cloud | /buildshiprun/handler_test.go | Go | go | 12,148 | permissive | package function
import (
"encoding/json"
"os"
"testing"
)
func TestGetEvent_ReadLabels(t *testing.T) {
want := map[string]string{
"com.openfaas.scale": "true",
}
val, _ := json.Marshal(want)
os.Setenv("Http_Labels", string(val))
eventInfo, err := getEventFromEnv()
if err != nil {
t.Errorf(err.Error()... |
d512921c5a4decdff5524925b8aee71421518e41 | 90941878a26a86092f46eb406f3f75774ddfe000 | xiaoyanli-lyft/buildah | /buildah.go | Go | go | 23,552 | permissive | package buildah
import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
"time"
"github.com/containers/buildah/define"
"github.com/containers/buildah/docker"
"github.com/containers/image/v5/types"
encconfig "github.com/containers/ocicrypt/config"
"github.com/containers/stora... |
e516d67e7da1de8e4f3a6ef615576b21195b487b | 1d5a323ce32d424bcc5300632abd9632abe4f87d | Jennal/goplay | /aop/sequence.go | Go | go | 1,721 | permissive | // Copyright (C) 2017 Jennal(jennalcn@gmail.com). All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agr... |
eaacceca6d6c0aa3b0f14febda2917e1966e7e23 | e98d24b7bd4f7bc8d0213ec71a74ebabd9b5c49c | openshift/assisted-service | /subsystem/ams_subscriptions_test.go | Go | go | 12,122 | permissive | package subsystem
import (
"context"
"net/http"
"github.com/go-openapi/strfmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/assisted-service/client/installer"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"github.com/open... |
2647427e7e7aa5d962f653b5527e77d7e035794a | c0218033f6d14a65b94c39c10635f6a9c0864c4c | Lumexralph/go-datastructures-algorithms | /dataStructures/doublyLinkedList/doublyLinkedList.go | Go | go | 2,359 | permissive | package main
import (
"fmt"
)
// Node for a doubly linked list
type Node struct {
property string
prevNode *Node
nextNode *Node
}
// DoublyLinkedList container for the nodes
type DoublyLinkedList struct {
headNode *Node
}
// NodeBetweenValues method returns the node that has a property
// lying between the fir... |
0675df8adab8b0a881c8da7663c3a1a209319e50 | 290a2dc9cb4cbf2cf3247d022c5d4a87936da532 | ridvanenis/rook | /tests/integration/edgefs_test.go | Go | go | 3,562 | permissive | /*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
504675f6db0d4b2a20968d128de782049978beb3 | 5976becc78b08d228458211f9b179589f616781e | ashizaki/go-clean-architecture | /domain/repository/handler.go | Go | go | 714 | no_license | package repository
type DbHandler interface {
SqlHandler
Beginner
}
type SqlHandler interface {
Error() error
Create(value interface{}) SqlHandler
Select(out interface{}) SqlHandler
Where(query interface{}, args ...interface{}) SqlHandler
Get(out interface{}, where ...interface{}) SqlHandler
Save(value interf... |
c7d1756b0d6275abab02d6793353104f6be410ae | a991186b6679156d8d3d2ae62510a1e9ee404c96 | jackzzj/etcd-operator | /pkg/backup/backend.go | Go | go | 805 | permissive | // Copyright 2016 The etcd-operator 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... |
020a545872a806950364510dc962979d6e47e321 | d351bb6603c105fb169daa0a9bdc46aeac4ae186 | robinWongM/cobra | /command.go | Go | go | 25,797 | permissive | package cobra
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"text/template"
"unicode"
flag "github.com/spf13/pflag"
)
type Command struct {
// Use is the one-line usage message.
// Recommended syntax is as follow:
// [ ] identifies an optional argument. Arguments that... |
2c0035f30f8119d27921fba4ccb2d8b325d2f30f | f026bfd6ae3875976dcdc2a7a781a8f8845690a6 | andrefsp/go-multicast | /node.go | Go | go | 232 | no_license | package gomulticast
import "time"
type Node struct {
Hostname string
IP string
LastHeartbeat time.Time
}
func (n Node) GetHostname() string {
return n.Hostname
}
func (n Node) GetIP() string {
return n.IP
}
|
20e9f1b56675c0474edc08f3fee72715fa174588 | f9839f42ed8df0f88033a63e43ea5325fbe08548 | markxp/KML | /extendedData_test.go | Go | go | 2,991 | permissive | package kml
import (
"encoding/xml"
"testing"
)
const raw = `
<ExtendedData>
<Data name="CGI">
<value>466561000000001</value>
</Data>
<Data name="CELLNAME">
</Data>
<Data name="CELLID">
<value>1</value>
</Data>
<Data name="eNB">
<value>521</value>
</Data>
<Data name="TAC">
... |
66984b00585fbd94b4424016fdf6f7968538339f | c8a46e6c56b5463e532617d24b6d6046956cfdb0 | chitkokowin/lxd | /lxd/main_test.go | Go | go | 2,880 | permissive | package main
import (
"crypto/tls"
"fmt"
"io/ioutil"
"os"
"github.com/lxc/lxd/lxd/db"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/idmap"
)
func mockStartDaemon() (*Daemon, error) {
certBytes, keyBytes, err := shared.Gener... |
19bfa252fe6411e204eda3f6af807c828a99f7e1 | 440a79749e0819df9b3f2f53f477e29ebc07c92b | p12s/2gis-catalog-api | /pkg/service/street.go | Go | go | 540 | permissive | package service
import (
"github.com/p12s/2gis-catalog-api/pkg/repository"
)
// StreetService - сревис рубрики
type StreetService struct {
repo repository.Street
}
// NewStreetService - конструктор
func NewStreetService(repo repository.Street) *StreetService {
return &StreetService{repo: repo}
}
// CreateIfNotEx... |
de2617ad30e5998c9120ae0ee3b4201eaca232bb | 6f6ea60fe0b496cd81d403d606ad40526b0d11cd | gabstv/gowrap | /generator/generator.go | Go | go | 11,856 | permissive | package generator
import (
"bytes"
"path/filepath"
"strings"
"go/ast"
"go/token"
"io"
"text/template"
"github.com/pkg/errors"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/imports"
"github.com/gabstv/gowrap/pkg"
"github.com/gabstv/gowrap/printer"
)
//Generator generates decorators for the interf... |
536f23c0221a5061353201e78d0f41268ca9e86a | de921bf90968c303592586dbed570d7c9a4c43f9 | watermint/toolbox | /essentials/file/es_filehash/hash_test.go | Go | go | 992 | permissive | package es_filehash
import (
"github.com/watermint/toolbox/infra/control/app_control"
"github.com/watermint/toolbox/quality/infra/qt_file"
"github.com/watermint/toolbox/quality/recipe/qtr_endtoend"
"testing"
)
func TestHashImpl_MD5(t *testing.T) {
qtr_endtoend.TestWithControl(t, func(ctl app_control.Control) {
... |
9b51db40bb365c2d49d0f109f4c20e17f58c8405 | 6f05443d4516dbf9631f1e4ed252401ea2fe1052 | cloud-gov/bosh-deployment-resource | /vendor/github.com/cloudfoundry/bosh-cli/cmd/delete_deployment.go | Go | go | 597 | permissive | package cmd
import (
. "github.com/cloudfoundry/bosh-cli/cmd/opts"
boshdir "github.com/cloudfoundry/bosh-cli/director"
boshui "github.com/cloudfoundry/bosh-cli/ui"
)
type DeleteDeploymentCmd struct {
ui boshui.UI
deployment boshdir.Deployment
}
func NewDeleteDeploymentCmd(ui boshui.UI, deployment boshdi... |
14c133d312d3143a5c45beb7465b23dfada39e22 | 6031867d81f2b6f159ce1b32b55e583d3ae63097 | kevin51034/go_practices | /61. Rotate List.go | Go | go | 593 | no_license | /**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func rotateRight(head *ListNode, k int) *ListNode {
if head == nil || head.Next == nil || k == 0 {
return head
}
count := 0
last := head
cur := head
for cur != nil {
... |
4d8ba3192ab474cb4f14509263ae6f4c1575313b | db09b8afa071ac41946d875edd87cc447720962a | gophergala/i_love_indexes | /Godeps/_workspace/src/github.com/shaoshing/train/handler_test.go | Go | go | 2,615 | permissive | package train
import (
"github.com/shaoshing/gotest"
"io/ioutil"
"net/http"
"net/http/httptest"
"os/exec"
"strings"
"testing"
)
var httpClient = http.Client{}
var httpServer *httptest.Server
func initServer() {
http.DefaultServeMux = http.NewServeMux()
ConfigureHttpHandler(nil)
httpServer = httptest.NewSer... |
c1aa2a043d7a3f7294c876574a53117c8c4d6d32 | 36fa58c0ae61b1671c71d53f1e3ef79a80c58547 | sejvlond/go-kafkalog | /decoder/gzip_decoder_test.go | Go | go | 760 | no_license | package decoder
import (
"github.com/stretchr/testify/assert"
"github.com/sejvlond/go-kafkalog/common"
"testing"
)
func TestGzip(t *testing.T) {
data := []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x35\xde\x8e\x7a\xe7\x00\x01\xff\xff\xff\xff\x00\x00\x00\x27\x78\x9c\x62\x80\x00\x5d\x20\x96\xdc\x9e\x3a\xe7... |
7034041ff445b5f2f0f39a7d88438d8c75f60b0b | ef7b9337a25a1ad34ad84c8a29781efaae3d41e8 | qi20088/tidb | /distsql/distsql.go | Go | go | 10,399 | permissive | // Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
c858a65fe2092aca94f21fc912dcbdcc3facf886 | 512bd1982929ae923a7b6aab980c9392ee0f1b1a | Amigo007/luago-book | /code/go/ch18/src/luago/state/api_misc.go | Go | go | 1,902 | permissive | package state
import "luago/number"
// [-0, +1, e]
// http://www.lua.org/manual/5.3/manual.html#lua_len
func (self *luaState) Len(idx int) {
val := self.stack.get(idx)
if s, ok := val.(string); ok {
self.stack.push(int64(len(s)))
} else if result, ok := callMetamethod(val, val, "__len", self); ok {
self.stack... |
b1b8a40eec1bae75bd8b6ef3144cceb1f7848e24 | 26c68cf29ee00e527dbd4d07cb9364f998d68d59 | anji-plus/captcha | /service/go/util/uuid.go | Go | go | 778 | permissive | package util
import (
"bytes"
"crypto/rand"
"fmt"
"io"
rand2 "math/rand"
"time"
)
// GetUuid 获取UUID
func GetUuid() string {
b := make([]byte, 16)
io.ReadFull(rand.Reader, b)
b[6] = (b[6] & 0x0f) | 0x40
b[8] = (b[8] & 0x3f) | 0x80
return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])... |
61b7c7f11703190f61a87f641b70917c1a6d0a5a | f97ce2a288d4fab7de41f0ea9d5329a5d1495dfa | nicholaskh/opendts | /replicator_plan.go | Go | go | 20,827 | permissive | /*
Copyright 2019 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
4bf42f9ed3554e04894d8d604bf160313fa5ab06 | ebe12812c63bb63fe06b8e4133cc9a49f8dda79f | tonistiigi/gvisor | /pkg/sentry/kernel/ipc_namespace.go | Go | go | 1,748 | permissive | // Copyright 2018 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... |
60c4e0294918560a7a8e2fb8c79422ce566ca422 | e949ac9c475342b131d1d0b2fa28593d01a3e7d7 | dev-wei/milvus | /internal/storage/unsafe.go | Go | go | 1,436 | permissive | // Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... |
3133887977a6b34061bdeecbb3728164eb8041e9 | 4f191d72a74d4cc72154021995a9fdbea4482b51 | buildpacks/lifecycle | /buildpack/dockerfile.go | Go | go | 4,747 | permissive | package buildpack
import (
"bytes"
"errors"
"fmt"
"os"
"strings"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"github.com/moby/buildkit/frontend/dockerfile/parser"
"github.com/buildpacks/lifecycle/log"
)
const (
DockerfileKindBuild = "build"
DockerfileKindRun = "run"
buildDockerfileName... |
e0b3f41908fe80a1a5dfd377d50c74559e5d1ec4 | 8ae14b37fb7aae013c6f7319fb48931799f4c5b4 | comeonjy/util | /agora/model.go | Go | go | 1,528 | permissive | package agora
type AcquireModel struct {
ResourceID string `json:"resourceId"`
}
type QueryResp struct {
ResourceID string `json:"resourceId"`
Sid string `json:"sid"`
ServerResponse struct {
FileListMode string `json:"fileListMode"`
FileList []struct {
Filename string `json:"filen... |
647e43dac374ff6e44eadc327c6debd8949cbbf1 | 35b0d452fb09d43205dcf92a74ccef036a79a9e4 | tf369/oasis-core | /go/oasis-test-runner/scenario/e2e/runtime/runtime.go | Go | go | 16,205 | permissive | package runtime
import (
"context"
"fmt"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/oasisprotocol/oasis-core/go/common"
"github.com/oasisprotocol/oasis-core/go/common/cbor"
"github.com/oasisprotocol/oasis-core/go/common/node"
"github.com/oasisprotocol/oasis-core/go/common/sgx"
"github.com/oasis... |
053e118acaa7539c33e2c714f168d38c94bd322c | e9d463604251c69cc3379f3458e40c653a9c2500 | mercuryyy/prebid-server | /adapters/appnexus/appnexus.go | Go | go | 13,782 | permissive | package appnexus
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/prebid/prebid-server/pbs"
"golang.org/x/net/context/ctxhttp"
"github.com/mxmCherry/openrtb"
"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/openrtb_ext"
)
type AppN... |
ca917593e5ffe85cba14224ecc9b9978729fbb36 | 79944a219acc4299e5eedd3450e7a8200bbcc59f | raymondlwb/core | /scheduler/simple/magnesium.go | Go | go | 3,837 | permissive | package simplescheduler
import (
"fmt"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/projecteru2/core/types"
)
type magnesium struct {
sync.Mutex
}
// Get a random node.
// Actually it's not random, it's the one with biggest cpu quota.
// Returns the node name.
func (m *magnesium) RandomNode(nodes map[st... |
ece59da139d0a3b4519ac4e87ea7011966383afe | b7264579ab878347b3c004bd7db1182efedd30f7 | kubevirt/controller-lifecycle-operator-sdk | /examples/sample-operator/cmd/manager/main.go | Go | go | 6,441 | permissive | package main
import (
"context"
"errors"
"flag"
"fmt"
"os"
"runtime"
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
kubemetrics "github.com/operator-framework/operator-sdk/pkg/ku... |
322bb6334b70b252a2df62d73eb3651f89764884 | d11c4aac0bf85d8103936cb01672c358f95bb84d | microsoftgraph/msgraph-beta-sdk-go | /drives/item_items_item_workbook_functions_power_post_request_body.go | Go | go | 7,634 | permissive | package drives
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
ie8677ce2c7e1b4c22e9c3827ecd078d41185... |
ffad9b833e14ccbfe146b48e0879a95296e5f7b1 | 680db2b319c6292e5b143bedcc2fffed58ef00b0 | mongodb/mongo-tools-common | /json/decode_test.go | Go | go | 32,763 | permissive | // Copyright (C) MongoDB, Inc. 2014-present.
//
// 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
//
// Based on github.com/golang/go by The Go Autho... |
18828ebff17b7e0fdf7c5eb1124b031a44645e65 | e8c00a8bf556101dc7c7acf2adf0ad1380097c23 | danielmellado/ovn-kubernetes-1 | /go-controller/pkg/ovn/ovn.go | Go | go | 37,852 | permissive | package ovn
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net"
"reflect"
"sync"
"time"
goovn "github.com/ebay/go-ovn"
hocontroller "github.com/ovn-org/ovn-kubernetes/go-controller/hybrid-overlay/pkg/controller"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
egressipv1 "github.com/ovn-org/... |
c75a1c3fba24b6dd302136c71391b6e14d81fcf9 | b9cede88196d2f5e84a3614a96deaf44d414003d | parkjd14/aergo | /types/vote.go | Go | go | 444 | permissive | package types
import "math/big"
const AergoSystem = "aergo.system"
func (vl VoteList) Len() int { return len(vl.Votes) }
func (vl VoteList) Less(i, j int) bool {
return new(big.Int).SetBytes(vl.Votes[i].Amount).Cmp(new(big.Int).SetBytes(vl.Votes[j].Amount)) < 0
}
func (vl VoteList) Swap(i, j int) { vl.Votes[i], vl.... |
ee0a72aef6f3e1cad8d68276df9275929b7cdd11 | c0c0324ea88eb459c00ad6e1196473422a858c03 | taragu/serving | /test/conformance/api/v1/util.go | Go | go | 9,848 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
9c365db8c79fef2f8adcbe97954a860379d32ef0 | 15b213fda0d6a8a9f82703ca6869710125d3e7d6 | openshift/eventrouter | /eventrouter.go | Go | go | 6,547 | permissive | /*
Copyright 2017 Heptio Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
54c5015727255eefd7dd05f0cb654e8cf0e33fe5 | 8345518c4805ba3d3e8a14fa6be78f67df8d5365 | mayur-tolexo/pg-shifter | /shifter_test.go | Go | go | 4,903 | permissive | package shifter
import (
"testing"
"github.com/mayur-tolexo/contour/adapter/psql"
"github.com/mayur-tolexo/pg-shifter/db"
"github.com/stretchr/testify/assert"
)
func addAllTables(s *Shifter) {
s.SetTableModel(&db.TestAddress{})
s.SetTableModel(&db.TestAdminUser{})
s.SetTableModel(&db.TestUser{})
}
func TestC... |
57efc444ea41a0f1c708c78ae4836f5caad0f25b | c17518cc7713abedf5c9bd72c5a2d3582fac77db | PerforMance308/RestService | /database/database.go | Go | go | 1,140 | no_license | package database
import (
"encoding/json"
"errors"
"fmt"
"strings"
)
// Datas contains mock datas in database
var Datas = map[interface{}][]byte{}
// MockDB contains a Database client
type MockDB struct {
}
// NewDbClient creates a DB client, could be either kind of Database, just mock here
func NewDbClient() *... |
a1a66cd398d8c3ba0b137cbbf9c1581e144c5a05 | daa265e18b6af443d5b3e532b57a980dda5a8f93 | Osourth/WanghStudyGo | /datatype/array/array_test.go | Go | go | 674 | no_license | package array
import (
"fmt"
"testing"
)
//===================================================复制=====================================
//Go数组是值类型,复制和传参操作都会复制整个数组数据
func test1(x [2]int) {
fmt.Printf("x: %p, %v\n",&x,x)
}
func TestCopy1(t *testing.T) {
a := [2]int{10,20}
var b [2]int
b = a
fmt.Printf("a: %p, ... |
75f080de82dbced5bdd6ec5595853a3f578db344 | aef3755491762f11abd58d88dee3b270ec130548 | barnettZQG/cloud-adaptor | /internal/adaptor/ack/nas.go | Go | go | 8,049 | no_license | // RAINBOND, Application Management Platform
// Copyright (C) 2020-2021 Goodrain Co., Ltd.
// This program 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 opt... |
783e6cb3b4af2eddf9388b8f7cd9a29d86da88d7 | 57db86caf0fbcc032a5e2f51ec26104cf42fd1b3 | opentracing/basictracer-go | /recorder_test.go | Go | go | 607 | permissive | package basictracer
import (
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestInMemoryRecorderSpans(t *testing.T) {
recorder := NewInMemoryRecorder()
var apiRecorder SpanRecorder = recorder
span := RawSpan{
Context: SpanContext{},
Operation: "test-span",
Start: time.N... |
af22598bfac82577b333dfea0bca752b6980ae21 | 978a983eff995f59425f7980e2e9da0c94da9bb3 | stsully/oci-go-sdk | /managementagent/management_agent_plugin_summary.go | Go | go | 1,595 | permissive | // Copyright (c) 2016, 2018, 2020, 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... |
fd5f966fec290cce53b9d76447f2fb57770c5c5e | 1c69780996183760bdb633caa76ea2feed1a4bea | fadeev/stargate-scaffold | /x/foo/handler.go | Go | go | 859 | no_license | package foo
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/foo/foo/x/foo/keeper"
"github.com/foo/foo/x/foo/types"
)
// NewHandler ...
func NewHandler(k keeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result,... |
1131e9fa02a1f19690596e3879815bcaa7ea6267 | aa697af763334e437f07294e2b3a6caec7f7edfa | eduardoflorendo/salus-telemetry-envoy | /ingest/for_test.go | Go | go | 757 | permissive | /*
* Copyright 2018 Rackspace US, 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 app... |
1f0909773208d84209eda38ef5a930c4ebcf7b5e | 59c54c46b28d4a491ec2e6cbdc18a4e87b55e6fd | enriquebris/goworkerpool | /error.go | Go | go | 1,940 | permissive | // ** goworkerpool.com **********************************************************************************************
// ** github.com/enriquebris/goworkerpool **
// ** v0.10.0 *******************************************************************************************************
package goworker... |
034ee8709ab38a48914079748da7a39f833a1b0c | 8a0a4ec5eec27c2216f613203baa2d3edf1cbdf2 | anson-dev/godemo | /test_restful.go | Go | go | 1,014 | no_license | package main
import (
"fmt"
"github.com/drone/routes"
"net/http"
)
func getuser(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
uid := params.Get(":uid")
fmt.Fprintf(w, "you are get user %s", uid)
}
func modifyuser(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
uid := pa... |
79013bbdbcb8976708f5740216c88383c24fdc5e | 748315a3f6ba94776b020a71991642697f8cafbd | dollarkillerx/Golang-Study | /GolangGuide/study2/struct.go | Go | go | 316 | no_license | package main
import "fmt"
type person struct {
name string
age int
}
func (ps person)print() {
fmt.Printf("%v 12 12",ps)
}
type bs struct {
person
pser int
}
func main() {
person := person{"dollarkiller",18}
fmt.Printf("%v",person)
person.print()
fmt.Println()
ps := bs{person,16}
fmt.Println(ps)
}
|
65d6e4fee0eb9b652910826f4fe0426b830d619e | bdd7fe235f74e8c2b1441803d13407e2c3a875ad | fmladenovic/FractalTree | /experiment/go/strong/2.go | Go | go | 1,186 | no_license | package main
import (
"math"
"time"
"fmt"
"sync"
)
func tree(wg *sync.WaitGroup, spawnedAsRoutine bool, spawnControle, x, y, base, resize float64, end float64, angle float64, forkAngle float64) {
if spawnedAsRoutine {
defer wg.Done()
}
if base > end {
base = resize*base
angle1 := forkAngle - angle... |
8bd96d26c99525ce6c0bc4487b9bc6870d21c479 | e31a1c9a2ecd8ff364dbce43462a87ad8e0e2e23 | johnnyaug/lakeFS | /catalog/value_entry_iterator.go | Go | go | 987 | permissive | package catalog
import (
"github.com/treeverse/lakefs/graveler"
)
type valueEntryIterator struct {
it graveler.ValueIterator
value *EntryRecord
err error
}
func NewValueToEntryIterator(it graveler.ValueIterator) *valueEntryIterator {
return &valueEntryIterator{
it: it,
}
}
func (e *valueEntryIterator) ... |
70da694290220bdbbc80d0b65f069544af764e83 | c36abb83b537f433cc6a844b575564ccc2fc498a | itdove/registration-operator | /pkg/helpers/queuekey_test.go | Go | go | 6,421 | permissive | package helpers
import (
"testing"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
fakeoperatorclient "github.com/open-cluster-management/api/client/operator/clientset/versioned/fake"
operatorinformers "github.com/open-cluster-management/api/c... |
a16ee31fe22a8fb093b356f95a8fb82a0de9907b | 02cbde4128534de5102d2f1c8473ddb253e6c385 | liu826250634/go_common | /log/log_test.go | Go | go | 539 | permissive | package log
import (
"testing"
"time"
)
//测试日志实例打点
func TestLogInstance(t *testing.T) {
nlog:= NewLogger()
logConf:= LogConfig{
Level:"trace",
FW: ConfFileWriter{
On:true,
LogPath:"./log_test.log",
RotateLogPath:"./log_test.log",
WfLogPath:"./log_test.wf.log",
RotateWfLogPath:"... |
5fe6289836af44702294c40726ac20f2e5da9069 | 6dfc017ea3eac212c52fc564eb31c6cefed12514 | dhconnelly/advent-of-code-2019 | /geom/point3.go | Go | go | 514 | permissive | package geom
import (
"github.com/dhconnelly/advent-of-code-2019/ints"
)
type Pt3 struct {
X, Y, Z int
}
var Zero3 Pt3
func (p1 *Pt3) TranslateBy(p2 Pt3) {
p1.X += p2.X
p1.Y += p2.Y
p1.Z += p2.Z
}
func (p1 Pt3) Add(p2 Pt3) Pt3 {
p3 := p1
p3.TranslateBy(p2)
return p3
}
func (p Pt3) IsZero() bool {
return ... |
85a3e040e7c24c64d3f688289c17023f1c48175a | 796c8f4bddb1dd88aa3d7d89762d0a3e2b23207e | Arelav/remark | /backend/vendor/github.com/go-pkgz/auth/provider/oauth2.go | Go | go | 5,992 | permissive | package provider
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/go-pkgz/lgr"
"github.com/go-pkgz/rest"
"golang.org/x/oauth2"
"github.com/go-pkgz/auth/token"
)
// Oauth2Handler implements /login, /callback and /logout handlers from aout... |
842d8c7d2706a176c099c030aff6fa728e144810 | 34f571dd3bfc04b38664b38df99abda798558095 | yadisnel/go-ms-plugins | /config/source/configmap/options.go | Go | go | 990 | permissive | package configmap
import (
"context"
"github.com/yadisnel/go-ms/v2/config/source"
)
type configPathKey struct{}
type prefixKey struct{}
type nameKey struct{}
type namespaceKey struct{}
// WithNamespace is an option to add namespace of configmap
func WithNamespace(s string) source.Option {
return func(o *source.O... |
a8c02866ea5d90e2e3be0cfab700c56ca7150e6c | a650cf4a3af97d8c98f04c19a0e381c8e62693a8 | x140cc/cfs | /disk/disk.go | Go | go | 3,594 | permissive | package disk
import (
"io"
"os"
"path"
)
// TODO: interface?
type Disk struct {
// Name is the name of the disk.
Name string
// Root is the root path of the disk
// Usually it is the mount point of a disk or a directory
// under the mount point.
Root string
}
// ReadAt reads up to len(p) bytes starting at b... |
033bdd2021c3be85e7617dbf1d810b0686db9126 | 7bdbd9275aaeeab8dff0a465863bf684c2a1b969 | cloe-lang/cloe | /src/lib/ast/import.go | Go | go | 643 | permissive | package ast
import (
"fmt"
"github.com/cloe-lang/cloe/src/lib/debug"
)
// Import represents an import of a sub module.
type Import struct {
path string
prefix string
info *debug.Info
}
// NewImport creates an Import.
func NewImport(path, prefix string, info *debug.Info) Import {
return Import{path, prefix... |
4aa2e20749182853bd3f7fcf88b922092deed233 | 7d5bc83b595a842e70253f005d0bec1904f9b450 | kierdavis/avr | /loader/ihexloader/ihexloader.go | Go | go | 801 | permissive | // Package ihexloader encapsulates loading of IHEX files into an Emulator.
package ihexloader
import (
"github.com/kierdavis/avr/emulator"
"github.com/kierdavis/ihex-go"
"io"
)
// Load parses an IHEX file from r and loads the program data contained in
// it into em.
func Load(em *emulator.Emulator, r io.R... |
a4c2a21d242c9a031310a1615535fca466eed362 | 8840190b02cab42ce59208f66b239378ea8e6693 | VonRosenchild/cloud-protocol | /proto/v1/cmd.go | Go | go | 1,943 | no_license | package proto
import (
"encoding/json"
"fmt"
"log"
"strings"
"time"
)
/**
* JSON message structures
*/
// Sent by API to agent
type Cmd struct {
Ts time.Time
User string
AgentUuid string
Service string
Cmd string
Data []byte `json:",omitempty"`
// --
RelayId string `json:",omi... |
23358817c3cf756a4ab64c52ae089072d8f8402d | 8d517701df30eb91a465db831d07e2a67763c5a5 | muhammadaser/stockbit | /second_answer/movie/client/modules/handler.go | Go | go | 1,900 | no_license | package modules
import (
"context"
"github.com/gorilla/mux"
proto "github.com/muhammadaser/stockbit_proto/movie"
"log"
"net/http"
"strconv"
)
func (m *Module) HandleMovies(w http.ResponseWriter, h *http.Request) {
// get query string parameter for search and page
q := h.URL.Query()
searchString := q.Get("s"... |
0cee54f4bceb01dd7fdeac95d7d2138d0de73b88 | d1b1b8e2e94414a30a5efbb7b3f633432fff95f2 | kaspanet/kaspad | /domain/miningmanager/miningmanager_test.go | Go | go | 41,351 | permissive | package miningmanager_test
import (
"github.com/kaspanet/kaspad/cmd/kaspawallet/libkaspawallet"
"github.com/kaspanet/kaspad/domain/consensusreference"
"github.com/kaspanet/kaspad/domain/miningmanager/model"
"github.com/kaspanet/kaspad/util"
"github.com/kaspanet/kaspad/version"
"reflect"
"strings"
"testing"
"... |
78683695fde9e06dc421319fee9b3c84ad87ecfa | ab279c20ef4c54414280ef32d5efacd63acb991b | lukeyan/go2o | /src/app/front/partner/category_c.go | Go | go | 3,199 | permissive | /**
* Copyright 2014 @ z3q.net.
* name :
* author : jarryliu
* date : 2014-02-05 21:53
* description :
* history :
*/
package partner
import (
"encoding/json"
"fmt"
"github.com/jsix/gof"
"github.com/jsix/gof/web"
"github.com/jsix/gof/web/mvc"
"github.com/jsix/gof/web/ui/tree"
"go2o/src/cache"
"go2o/src/... |
f25d72cb992eec3935407ce645d050051f424c8b | bf7c3997044dabb66e6525210296b66f81bdbff4 | zhiyuan2007/skycoin | /src/api/spend.go | Go | go | 21,211 | no_license | package api
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
"github.com/shopspring/decimal"
"github.com/skycoin/skycoin/src/cipher"
"github.com/skycoin/skycoin/src/coin"
"github.com/skycoin/skycoin/src/params"
"github.com/skycoin/skycoin/src/transaction"
"github.com/skycoin/skycoin/src/util/d... |
7f4456711a2937927d6d0196480c171a5376ca77 | 6a65384d5838327541f6315a568eae78603cfa6d | liuyinggithub/beeblog | /controllers/reply.go | Go | go | 757 | no_license | package controllers
import (
"beeblog/models"
"github.com/astaxie/beego"
)
type ReplyController struct {
BaseController
}
func (this *ReplyController) Post() {
}
func (this *ReplyController) Get() {
}
func (this *ReplyController) Add() {
tid := this.Input().Get("tid")
name := this.Input().Get("nickname")
... |
8d77f6049f282421de69418e5a2b571bbf0baa53 | 320e5808426668ce9347075a28fc406498950dda | ruckstack/ruckstack | /server/system_control/internal/kube/kubeclient.go | Go | go | 1,545 | permissive | package kube
import (
"github.com/ruckstack/ruckstack/common/ui"
"github.com/ruckstack/ruckstack/server/system_control/internal/environment"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
"time"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
var KubeconfigFile string
var client *kubern... |
6775092f59f50b85c94087911c568bb04ae2900c | c347e854eda93774e7898e81d5618495c652bdcd | thebigjc/contrib | /mungegithub/mungers/e2e/e2e.go | Go | go | 15,629 | 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, ... |
f92d03087215ba6d716c42e2362779e064699150 | 44ba31ed093adb83224bfb8af90c3f274f2efe69 | soulgo/go-go_code | /src/laonanhai/PhaseOne/day8/test/student.go | Go | go | 414 | no_license | package main
import (
"encoding/json"
"io/ioutil"
)
type student struct {
ame string
Sex string
Age int
}
func (p *student)Save()(err error) {
data, err :=json.Marshal(p)
if err !=nil{
return
}
err = ioutil.WriteFile("H:/stu.dat",data,0755)
return
}
func (p *student)Load() (err error) {
data,err :=io... |
fbbbd0de4c8bf1473df9c138ff6360db1042e871 | d854165d5fe647bd30669375805245650eb28edc | Apokleos/image-service | /contrib/nydusify/converter/converter.go | Go | go | 2,662 | permissive | // Copyright 2020 Ant Financial. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
package converter
import (
"os"
"path/filepath"
"github.com/gosuri/uiprogress"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"contrib/nydusify/nydus"
"contrib/nydusify/registry"
)
type Option struct {
Sou... |
3aba8c4b9bbb86d3d6894b245265e73a5e42ae95 | bcf26c8d5b2d2146dbe0a112e960b4982a84f78d | lh232510/MassNet-miner | /database/ldb/chaindb_test.go | Go | go | 1,678 | permissive | package ldb
import (
"crypto/rand"
"fmt"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"massnet.org/mass/database/storage"
"massnet.org/mass/wire"
)
func TestWriteBatch(t *testing.T) {
stor, err := storage.CreateStorage("leveldb", "./testData/testBatch/test", nil)
if err != nil {
t.Fatal(err... |
0b92f1915fdbb24280bb26c8cbf87d3875ac6b1f | 1148a02d49a912edea7344593d2f0d67a9a5c488 | detailyang/cilium | /pkg/endpoint/proxy.go | Go | go | 2,638 | permissive | // SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package endpoint
import (
"context"
"reflect"
"github.com/cilium/cilium/pkg/completion"
"github.com/cilium/cilium/pkg/policy"
"github.com/cilium/cilium/pkg/proxy/logger"
"github.com/cilium/cilium/pkg/revert"
)
// EndpointProxy defines any L... |
5889966072e9aafad12f2b9477c5f452a69aef9d | dff236cb8b4de6f259b56c4cfc59744d6459077a | K8-Cloud/k8-cloud | /models.go | Go | go | 1,205 | permissive | package main
type helmRepository struct {
name string
url string
username string
password string
}
type helmRelease struct {
name string
namespace string
version string
chart string
valuesfile string
}
type HelmConfig struct {
Releases []struct {
Name string `yaml:"name"`
... |
cf6a5a8475ac38daa5ffe5b6b7b634f5870dd2cf | 7baa28213ac7ff205e7078e439a6954c8da0a8ba | yunionio/telegraf | /plugins/inputs/ceph/ceph.go | Go | go | 17,650 | permissive | package ceph
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os/exec"
"path/filepath"
"strings"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
const (
measurement = "ceph"
typeMon = "monitor"
typeOsd = "osd"
typeMds = "mds"
typeRgw = "rgw"
osdPre... |
958c45b66e7952e0d3c2522f4889bf4858ec4275 | 36b70988a308c61701937526089aa85ad5ce78aa | open-lambda/gvisor | /pkg/tcpip/transport/icmp/protocol.go | Go | go | 4,705 | permissive | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... |
c4e251393f8463d0d07e3f5b890c76a88b16f56d | b07d2a897351e35efffe28abf24b6e1321e6000e | PeterNashaat/gitea | /modules/repofiles/temp_repo.go | Go | go | 13,852 | permissive | // Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package repofiles
import (
"bytes"
"context"
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strings"
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/git... |
f1e679d94d12feac3f35c69d4349f8b8f1ace725 | 9cc38d7671c62c10885037c987ec4ea16158c5b4 | doytsujin/nats-server | /server/leafnode.go | Go | go | 49,666 | permissive | // Copyright 2019-2020 The NATS 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 ... |
03c3257e58b7658c0580d5a959917cd1d2c61a26 | 1897020014ee2f4ff552d10034f18cbae69697c0 | 348754714/go-study | /day03/bibao2/main.go | Go | go | 1,451 | no_license | package main
import (
"fmt"
"strings"
)
// 闭包是什么
// 闭包是一个函数,包含了他外部作用域的一个变量
// 底层原理
// 1. 函数可以作为一个返回值
// 2. 函数内部查找变量顺序,先在自己内部找,找不到往外层找
// 3. 闭包=函数 + 外部变量的引用
func adder() func(int) int {
var x = 100
return func(y int) int {
x += y
return x
}
}
func adder1(x int) func(int) int {
return func(y int) int {
x +... |
81d4b18b24c29fbc8a1cb20e1fbab15c0cff0392 | 4f5ea7e7b6f222165a9dd9929ba16cfc39f48f9d | sigmonsays/cask | /container/cgroup/log.go | Go | go | 200 | no_license | package cgroup
import (
gologging "github.com/sigmonsays/go-logging"
)
var log gologging.Logger
func init() {
log = gologging.Register("cgroup", func(newlog gologging.Logger) { log = newlog })
}
|
4a6875aa144006c30889eb877a8d46446687acf8 | 42dd08714ef5843c60d76726fb40b508f1781311 | ajayaa/cockroach | /sql/server.go | Go | go | 6,738 | permissive | // Copyright 2015 The Cockroach 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... |
fa517e48f609db35d46141bafd2e000f541db6fd | 3e8e70fea14a86f35607c0f08bed9072327c812a | zhangbaitong/AT | /src/rcenter/resource/utils.go | Go | go | 2,641 | no_license | package resource
import (
"common"
"database/sql"
"fmt"
"time"
)
const (
SELECT_ALL string = "select * from resource_tab"
SELECT_BY_ID string = "select * from resource_tab where res_id=%s"
INSERT string = "insert into resource_tab (res_id,res_name,owner_acid,operator_acid,status,create_time) values (?,... |
b0b8da172072a744ddfaf68f644c36eb0a0aa542 | 09a2da7ec507ebc8bc5f172030d51b772e172bb0 | liucaihs/tea | /network/protocol/processor.go | Go | go | 428 | no_license | package protocol
import (
"github.com/k4s/tea/network"
)
type Processor interface {
// must goroutine safe
Route(msg interface{}, agent network.ExAgent) error
//must goroutine safe
SetHandler(msg interface{}, msgHandler MsgHandler)
//must goroutine safe
Register(msg interface{})
// must goroutine safe
Unmars... |
e1f66cc7fa1313d200d537c72342d721076ccafd | 109edcb90cca648441064139ee8ba7627e69c023 | openshift/machine-config-operator | /vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go | Go | go | 7,246 | permissive | package commands
import (
"bytes"
"context"
"crypto/sha256"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"
"github.com/fatih/color"
"github.com/gofrs/flock"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"gopkg.in/yaml.v3"
"github.com/golangci/golangci-lint/internal/cache"
"github.com/golangci/g... |
615acdf44f69a503ac670a14d8f015bf266ec6c9 | b5925a8f6c2fc736713a47a654189b7947642048 | Maxia51/golog | /logger.go | Go | go | 729 | no_license | package golog
var (
level Level = TRACE
colorLevel bool = false
timeFormat string = "02/01/2006 - 15:04:05"
)
func T(m ...string) {
lvl := TRACE
if lvl >= level {
print(YELLOW, lvl, m...)
}
}
func D(m ...string) {
lvl := DEBUG
if lvl >= level {
print(GREEN, lvl, m...)
}
}
func I(m ...string) {... |
3fee2a49f5cc466d8648335cff82000c1f4932c3 | 02c7ee7cc13891080d10e5d4993f0e7e3f349d60 | stanim/svgof | /svgo1f/flower/flower.go | Go | go | 2,338 | permissive | // The original library github.com/ajstarks/svgo uses int coordinates.
// This port "svgo1f" uses float coordinates, which are formatted as "%.1f".
// This file was automatically generated by modifying the syntax tree.
// (There are other precisions available at github.com/stanim/svgo.)
//
// flower - draw random flow... |
9a39791021cde41f1155396b74be3ea50a534b6c | fd8ac2a74f77cb89c5a0aaa0b0175acae977d991 | Darth-Knight/GamezopTask | /main/main.go | Go | go | 1,022 | no_license | package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
type bodyStruct struct {
Name string
Address string
}
func saveData(w http.ResponseWriter, req *http.Request) {
if err := req.ParseForm(); err != nil {
fmt.Fprintf(w, "ParseForm() err: %v", err)
return
}
decod... |
121208c340fc9ccfd9607efedf5079745c219a3e | 23338c81e1b85815acbf025ec8a3589b2c594a51 | Monkeyanator/istio | /operator/pkg/util/util.go | Go | go | 3,840 | permissive | // Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
bfd9a92b125243619dd11f5823af9ffb79f1ca19 | ab45b83cfa88f8adbf8390e90c781aff1469c1c1 | longfengpili/go_learning | /pattern.go | Go | go | 769 | no_license | /*
* @Author: chunyang.xu
* @Date: 2020-12-14 18:00:55
* @Last Modified by: chunyang.xu
* @Last Modified time: 2020-12-14 18:04:57
*/
package main
import (
"fmt"
"regexp"
"strconv"
)
func main() {
//目标字符串
searchIn := "John: 2578.34 William: 4567.23 Steve: 5632.18 test 0.02"
pat := "[0-9]+.[0-9]+" //正则
f :... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.