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 |
|---|---|---|---|---|---|---|---|---|
042ccfcc4ef74164935b7bdf7d478b3ea5232383 | 870ceacff47187feb61cc852e32fb98676e1b592 | jpsilva-daitan/examples | /vendor/fyne.io/fyne/v2/internal/driver/gomobile/folder.go | Go | go | 332 | permissive | package gomobile
import (
"fmt"
"fyne.io/fyne/v2"
)
type lister struct {
fyne.URI
}
func (l *lister) List() ([]fyne.URI, error) {
return listURI(l)
}
func listerForURI(uri fyne.URI) (fyne.ListableURI, error) {
if !canListURI(uri) {
return nil, fmt.Errorf("specified URI is not listable")
}
return &lister{... |
4d780f405b3e3e16eec149228892c3ecf2b402d7 | cd9729e57c172114ddf76b4de5f99c673b54f20e | FabioFi/voyager | /pkg/haproxy/controller/configmap.go | Go | go | 3,030 | permissive | /*
Copyright The Voyager 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, software... |
186d229df3ea88aa11b5ceae6b5834d95ddfa993 | 82c936594671e6141cf6b658c1729719ee356e33 | DeBankDeFi/cosmos-sdk | /tests/e2e/slashing/client/testutil/suite.go | Go | go | 5,155 | permissive | package testutil
import (
"fmt"
"strings"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
"gith... |
998c0bbc5361da072493ab99af5a152a7cd85665 | d9041448855a321a6411ff6ac94ac05d2c0b4f24 | phacops/gods | /uevent.go | Go | go | 819 | permissive | package main
import (
"bufio"
"os"
"strconv"
"strings"
)
type Hash struct {
values map[string]string
}
func parseFile(path string) *Hash {
file, err := os.Open(path)
hash := &Hash{values: make(map[string]string)}
if err != nil {
return hash
}
defer file.Close()
var buffer []string
scanner := bufio.N... |
44b2fe5f11742cbdb4ee1c45414d85dc583c3310 | fb929ec29c2cd5671a01e53a84fe3b17dc195a6c | tai-ga/gowhoson | /pkg/whoson/constants.go | Go | go | 3,694 | permissive | package whoson
import (
"expvar"
"runtime"
"runtime/pprof"
"time"
"github.com/client9/reopen"
katsubushi "github.com/kayac/go-katsubushi/v2"
"go.uber.org/zap"
)
// ProtocolType is whoson protocol types.
type ProtocolType int
// MethodType is whoson protocol methods.
type MethodType int
// ResultType is whos... |
ad04d4aaf3805d5effc57ec8e34cbf878786057a | 7e1a86a58b91f196d3e93740d265cbfa37a52f8f | GettEngineering/effe | /testdata/DecisionReturnDifferentTypes/foo/steps.go | Go | go | 854 | permissive | package main
import (
"fmt"
"example.com/foo/entities"
)
type a string
func failure() func(error) error {
return func(err error) error {
return err
}
}
func step2() func(a) (entities.Cmd, []int, [3]int) {
return func(v a) (entities.Cmd, []int, [3]int) {
fmt.Println(v)
return nil, []int{}, [3]int{}
}
}
... |
33feecc5619a5e9f330961ec8fceb282ed67ab85 | 89cf5551527e688d5729c3c389cfa3bec7d61797 | amy/rancher-compose-executor | /lookup/fileenv.go | Go | go | 2,039 | permissive | package lookup
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/Sirupsen/logrus"
"github.com/rancher/rancher-compose-executor/config"
"github.com/rancher/rancher-compose-executor/utils"
)
type FileEnvLookup struct {
parent config.EnvironmentLookup
variables map[string]string
}
func NewFileEnvLookup(fil... |
dc3e3ef36e3e2b9555a4b51687717b9273e1f6e4 | 0cd2854335db077e8157ef4959b174458e1f0c52 | ceshihao/leetcode | /golang/714_best-time-to-buy-and-sell-stock-with-transaction-fee.go | Go | go | 255 | no_license | func maxProfit(prices []int, fee int) int {
cash := 0
hold := -prices[0]
for _, price := range prices {
cash = max(cash, hold+price-fee)
hold = max(hold, cash-price)
}
return cash
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
|
ecc1f0f0029181eb25c014361cdb52df412265c0 | 49b083f6b5635220391c9e15763f92a722478c2f | hongjie104/gosproto | /sprotogen/gen_csharp.go | Go | go | 5,500 | permissive | package main
import (
"bytes"
"fmt"
"github.com/davyxu/gosproto/meta"
)
// namespace {{.PackageName}} 写死了 namespace Net
const csharpCodeTemplate = `// DO NOT EDIT!
using System;
using Sproto;
using System.Collections.Generic;
namespace Sproto
{
{{range $a, $enumobj := .Enums}}
public enum {{.Name}} {
{{range... |
20e5cd47de6644e1f07a0b755c7f748f2ee005f3 | 64d4ade131598426f6a577c3040346d12ecaacf2 | faizshukri/restic | /cmd/restic/secondary_repo.go | Go | go | 1,914 | permissive | package main
import (
"os"
"github.com/restic/restic/internal/errors"
"github.com/spf13/pflag"
)
type secondaryRepoOptions struct {
Repo string
password string
PasswordFile string
PasswordCommand string
KeyHint string
}
func initSecondaryRepoOptions(f *pflag.FlagSet, opts *secon... |
2855c93f96c9eeace1c6b87cc958163a7e26f37e | 9ada8705b76ec7100594a7a5e71ff5ed5fc281c5 | bigbroproject/BigBroCore | /protocols/ftp.go | Go | go | 256 | permissive | package protocols
import (
"github.com/bigbroproject/bigbrocore/models"
)
type FTP struct {
}
func (ftp FTP) CheckService(Protocol models.Protocol) error {
//TODO
//log.Println(Protocol.Customs["user"]+"-"+Protocol.Customs["password"])
return nil
}
|
fd86e0158a79409d3fa86a3d826e60b84b488735 | 8d6d79d86c0e3244ee2ab12460c0598ad77a5f2b | erwadba/tidb | /executor/insert_test.go | Go | go | 80,812 | permissive | // Copyright 2018 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... |
d64c2a56d212f4e06bc001d839d531736d88589f | 90070269d07c27c6a9e962ff1044c8dabee0d607 | st-fresh/client | /go/libkb/globals.go | Go | go | 44,130 | permissive | /// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
//
// globals
//
// All of the global objects in the libkb namespace that are shared
// and mutated across various source files are here. They are
// accessed like `G.Log` or `G.Env`. They'... |
4ec71f506c2b764547b191d26cfdf23793095b6f | 3b5b54e8cb73b5673424a34846f5b4b39825c791 | ffacp/kubeturbo | /pkg/k8s_tap_service.go | Go | go | 5,312 | permissive | package kubeturbo
import (
"encoding/json"
"errors"
"fmt"
"github.com/turbonomic/kubeturbo/pkg/discovery/detectors"
"io/ioutil"
restclient "k8s.io/client-go/rest"
"github.com/turbonomic/kubeturbo/pkg/action"
"github.com/turbonomic/kubeturbo/pkg/discovery"
"github.com/turbonomic/kubeturbo/pkg/discovery/confi... |
8ac2f7847eae32498cf8e4df5607e2c0a4f9323b | cd1801fbf4840c4adb41a05fb3083497b3b6c844 | parthlaw/Gochat | /server/rabbit/Queue.go | Go | go | 298 | no_license | package rabbit
import (
"parthlaw/chat-server/utils"
"github.com/streadway/amqp"
)
func QueueDeclare(ch *amqp.Channel) amqp.Queue {
q, err := ch.QueueDeclare(
"backend_messages",
false,
false,
false,
false,
nil,
)
utils.FailOnError(err, "Fail to declare the queue")
return q
}
|
5c9d5f04a56fc1a8ae2a4379ff4644e59a6555c1 | 305aa7dcfec9105f83d72e6944c791e026d3faf1 | deepdive7/design_pattern | /creational/prototype.go | Go | go | 1,177 | permissive | package creational
import (
"errors"
"fmt"
)
// CloneStruct ...
type CloneStruct interface {
Clone() interface{}
}
// Person ...
type Person interface {
CloneStruct
Show()
}
type chinese struct {
headColor string
eyesColor string
Mark int
}
func (c chinese) Clone() interface{} {
var pClone interface{... |
21108b18a3098a50c68bb5e3f66520acab00e159 | 044d8bf48727b06583e494383deddf569ea3ee8e | wangyiyang/RedisShake | /src/pkg/libs/oplog/oplog.go | Go | go | 7,282 | permissive | package oplog
import (
"bytes"
"encoding/binary"
"fmt"
"strconv"
"strings"
"time"
"unsafe"
)
type errorOplog struct {
s string
}
func (e *errorOplog) Error() string {
return e.s
}
/*
struct OplogHeader {
uint32_t version:8; // version of oplog
uint32_t cmd_num:4; / number of commands in one oplog, ... |
00b79fbacf683590a5315c89ff74ddf2ec74a6f2 | 521bed286979163ebf71e9572cd6d18ed0c21029 | Benricheson101/disgo | /api/cache_flags.go | Go | go | 1,742 | permissive | package api
// CacheFlags are used to enable/disable certain internal caches
type CacheFlags int
// values for CacheFlags
const (
CacheFlagsNone CacheFlags = 0
CacheFlagDMChannels CacheFlags = 1 << iota
CacheFlagCategories
CacheFlagTextChannels
CacheFlagVoiceChannels
CacheFlagStoreChannels
CacheFlagRoles
... |
ce1107575d45920819430ae7f012c113a42677f9 | 83a5fee639fce52b7657c33bc0a8d9393aa131c2 | willscott/go-nfs | /file/file_unix.go | Go | go | 315 | permissive | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
package file
import (
"os"
"syscall"
)
func getInfo(info os.FileInfo) *FileInfo {
fi := &FileInfo{}
if s, ok := info.Sys().(*syscall.Stat_t); ok {
fi.Nlink = uint32(s.Nlink)
fi.UID = s.Uid
fi.GID = s.Gid
return fi
}
return nil
}
|
43eb4707a978608829871b5a26621193fc6774e0 | 93984e616c2fa67fb2413d212600379eee103005 | arewedancer/cockroach | /pkg/sql/sqlbase/table.go | Go | go | 57,175 | 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... |
3ad259e324ac9dd3a3521977a4ff2a2b645a8f09 | 1c939cb24516a2336fe057c788caf54656fbaa58 | DataDog/datadog-agent | /test/integration/config_providers/zookeeper/zookeeper_provider_test.go | Go | go | 5,539 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
package zookeeper
import (
"context"
"testing"
"time"
log "github.c... |
1b8427ed9648615b01012189917c29868e173f13 | 2c4bb2ffba581bc66f944db367c02d901e59e08c | retailcrm/mg-transport-api-client-go | /v1/errors_test.go | Go | go | 1,775 | permissive | package v1
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewCriticalHTTPError(t *testing.T) {
err := &url.Error{Op: "Get", URL: "http//example.com", Err: errors.New("EOF")}
httpErr := NewCriticalHTTPError(err)
assert.IsType(t, n... |
8bcc638ec3f5f1a5a892d79031b80d377b2202da | e0b4e22eb821b82a355526ac8e220a32f6b35b06 | julz/garden-runc | /Godeps/_workspace/src/github.com/cloudfoundry-incubator/garden-linux/container_daemon/fake_user/fake_user.go | Go | go | 1,286 | no_license | // This file was generated by counterfeiter
package fake_user
import (
osuser "os/user"
"sync"
"github.com/cloudfoundry-incubator/garden-linux/container_daemon"
)
type FakeUser struct {
LookupStub func(name string) (*osuser.User, error)
lookupMutex sync.RWMutex
lookupArgsForCall []struct {
name ... |
154b99289c64ef940cfff4a979f0f9f0db1dab82 | 95d4bc31acd13b65d41b28ca3d123b1b7d059f10 | glebik555/steganographyDCT-Koch- | /main.go | Go | go | 862 | no_license | package main
import (
"fmt"
"path"
)
/* Image size - power of two, degree - the number of G components of pixels,
into which the message size will be written.
A message is written to the rest of the pixels using the Koch algorithm.
On the decryption side, a similar algorithm */
func main(){
img, pixels := selec... |
97be527c0b380da07bd1a5e509217844a347ad07 | 351b606c18336ba55a82a9ee8c050676ae66be07 | outyua/micro-kit | /pkg/database/database.go | Go | go | 1,046 | no_license | package database
import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"sync"
)
type Config struct {
Host string
Port int
User string
Pass string
Name string
}
var dbs sync.Map
var dbLock sync.Mutex
func Init(name string, config Config) error {
load, ok := dbs.Load(name)
if ok && lo... |
5dc99cd06603161fe0b3a224854a8020bda4ac5c | 1e526f9c0940f9b4c7d36699e299dc7f4262280c | ssinha20/toolchain-e2e | /setup/idlers/update_idler.go | Go | go | 1,567 | no_license | package idlers
import (
"context"
"fmt"
"time"
toolchainv1alpha1 "github.com/codeready-toolchain/api/pkg/apis/toolchain/v1alpha1"
"github.com/codeready-toolchain/toolchain-common/pkg/test"
cfg "github.com/codeready-toolchain/toolchain-e2e/setup/configuration"
"github.com/codeready-toolchain/toolchain-e2e/tests... |
27ca67962b3d968d5628078ab44ba4b40dc3167f | a4ace80d68ec84b2e5c609192acadafbde7cde53 | CUCEI20B/go-condiciones-zodiaco-26kevin1997 | /zodiaco.go | Go | go | 1,452 | no_license | package main
import "fmt"
func main(){
var dia float64
var mes float64
fmt.Println("Dia")
fmt.Scan(&dia)
fmt.Println("Mes")
fmt.Scan(&mes)
if (((dia>=22 && dia<=31) && mes==12)||((dia>=1 && dia<=20) && mes==1)){
fmt.Println("Capricornio")
} else if (((dia>=21 && dia<=31) && mes==1)||... |
98cec955f2644eeb4bc44921a9e2b825341b5b7a | 21094bd58c6cd4c7eb5959a47a30a076028f2642 | yinshuwei/nrpc | /server.go | Go | go | 3,469 | permissive | // NRPC server 从gob改写成msgpack
package nrpc
import (
"bufio"
"fmt"
"io"
"log"
"net"
"net/rpc"
"os"
"os/signal"
"syscall"
"github.com/vmihailenco/msgpack"
)
type serverCodec struct {
rwc io.ReadWriteCloser
dec *msgpack.Decoder
enc *msgpack.Encoder
encBuf *bufio.Writer
closed bool
}
func (c *s... |
593cbc1a3582c229b0bec9b4f5077f1c6adc9583 | 520b8d26c9cc8bf82fc2431429d400deaef6003d | stripedpajamas/cryptopals-go | /set4/challenge29/29_test.go | Go | go | 1,838 | permissive | package challenge29
import (
"bytes"
"testing"
"github.com/stripedpajamas/cryptopals/set4/challenge28"
)
func TestMDPad(t *testing.T) {
input := []byte("hello world")
output := []byte{104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... |
bf085436356dae33d0fcdb8c9a9519059717b5ad | f147fd8fa49e3990438270b777e44f045aa81c45 | nzlov/graphics-go | /graphics/rotate.go | Go | go | 825 | permissive | // Copyright 2011 The Graphics-Go 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 graphics
import (
"github.com/nzlov/graphics-go/graphics/interp"
"errors"
"image"
"image/draw"
)
// RotateOptions are the rotation parame... |
3e285a4bcfe4e942a7aa448883332f425e7a47d0 | b41c301c43222b9ee9aa678deb38e0ce31538464 | LINBIT/drbd-flex-provision | /vendor/k8s.io/kubernetes/pkg/kubelet/cm/cgroup_manager_unsupported.go | Go | go | 1,884 | permissive | // +build !linux
/*
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 agre... |
0857d87931d503dc4476bf7a4ba5e434455af4c1 | 579526161355c39beefebb768a3adafbc6149079 | radekg/terraform-state-ansible-module | /vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/variables_test.go | Go | go | 4,934 | permissive | package hclsyntax
import (
"fmt"
"reflect"
"testing"
"github.com/hashicorp/hcl2/hcl"
"github.com/kr/pretty"
"github.com/zclconf/go-cty/cty"
)
func TestVariables(t *testing.T) {
tests := []struct {
Expr Expression
Want []hcl.Traversal
}{
{
&LiteralValueExpr{
Val: cty.True,
},
nil,
},
{
... |
bf99427c1cea650e5fedb561e5add24151c9b8e0 | abf95d2a40d6c21dd2603f97c37df5f9a056203b | grpc/grpc-go | /xds/internal/xdsclient/xdsresource/unmarshal_cds.go | Go | go | 30,387 | permissive | /*
*
* Copyright 2021 gRPC 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... |
fd160805d24d40e5189157d78be5dc4b72fc51d6 | d793ae86e60a58248751779bbf8f29d0775b772a | zengzhiying/programming_languages | /go/socket_demo/socket_server_demo.go | Go | go | 1,165 | no_license | package main
import (
"fmt"
"net"
)
func handleConn(conn net.Conn) {
if conn == nil {
return
}
//读取所有数据
bytes := make([]byte, 0)
buf := make([]byte, 4096)
for {
cnt, err := conn.Read(buf)
// fmt.Printf("%d %q\n", cnt, buf)
bytes = append(bytes, buf[:c... |
fa14c855aec4b606d47d33ea4496d9e09857980f | 16c4abf67c5bb0b7fbf8dd3a5ea6803c1bf6152a | lumapps/atlantis | /server/events/command_context.go | Go | go | 1,922 | permissive | // Copyright 2017 HootSuite Media 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 ... |
d39ccb4d8a6ad0116cac96ade68f2834e884a982 | 437bb739b331ba9ca2f86d99d51a745f82fa8a33 | piotrnosek/autoscaler | /cluster-autoscaler/core/scaledown/actuation/drain.go | Go | go | 11,384 | permissive | /*
Copyright 2022 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, ... |
786d600412c5a0a67abaa1a4014e7011dfe1cea0 | 63b38ff0641a713725050515e024f42ad66639c2 | forbearing/k8s | /clusterrolebinding/tools.go | Go | go | 2,111 | permissive | package clusterrolebinding
import (
"time"
rbacv1 "k8s.io/api/rbac/v1"
)
type Role struct {
Kind string
Name string
}
type Subject struct {
Kind string
Name string
Namespace string
}
// GetRole get the clusterrole binding by this clusterrolebinding.
func (h *Handler) GetRole(object interface{}) (*... |
3e8e28b129931fdf753d42d8babeef04dca10166 | fa3389d857eac1acfaaf52bd1062eab8920a400f | zhmu/ananas | /external/gcc-12.1.0/libgo/go/runtime/mem_gccgo.go | Go | go | 6,420 | permissive | // Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The gccgo version of mem_*.go.
package runtime
import (
"unsafe"
)
// Functions called by C code.
//go:linkname sysAlloc
//go:linkname sysFree
//extern ... |
fa073d84e7bcfce2a907567d8eabab62ac93c215 | 23a86fb0780bf32d34eb05462badefe2977ca7aa | razbaa/netm4ul | /modules/recon/recon.go | Go | go | 427 | permissive | package recon
import (
"fmt"
"github.com/netm4ul/netm4ul/modules/recon/whois"
"github.com/netm4ul/netm4ul/modules/recon/shodan"
)
func Shodan(domain string) (data string) {
fmt.Println("----------Shodan module----------")
api_key := "my_api_key"
data = shodan.Run(domain, api_key)
return
}
func Whois(domain st... |
0dbe0922fc26d37c5656c66d73cb212161142595 | b57426e38e6cbba6724449f826fe217e25e8712a | davehenton/go-ipfs | /unixfs/io/dagreader_test.go | Go | go | 5,331 | permissive | package io
import (
"bytes"
"io/ioutil"
"os"
"strings"
"testing"
mdag "github.com/ipfs/go-ipfs/merkledag"
"github.com/ipfs/go-ipfs/unixfs"
context "context"
testu "github.com/ipfs/go-ipfs/unixfs/test"
)
func TestBasicRead(t *testing.T) {
dserv := testu.GetDAGServ()
inbuf, node := testu.GetRandomNode(t, ... |
25893fb0ddcaaa7ed71da26f010e49bc7b2ef64e | 2d126b24b0e090a2968ebe356a3429a68a950216 | aruaru0/golang_myatcoder | /ABC/286/C/main.go | Go | go | 2,135 | no_license | package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func out(x ...interface{}) {
fmt.Fprintln(wr, x...)
}
func getI() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
... |
6d925a947f089e41e35331aaeee41ebce13f7e21 | 52fbea37d81eaef411586d9189176ab3b5dd3f41 | memoryliu/goc | /pkg/qiniu/client.go | Go | go | 6,649 | permissive | /*
Copyright 2020 Qiniu Cloud (qiniu.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 required by applicable law or agreed to in wri... |
1451192d4eaefb3177464fb21df11affe650f2b6 | 26b8cfcd0b8e5a84102a899b2a44ea3cf0f53ee5 | purzelrakete/quality | /evaluate_test.go | Go | go | 3,102 | permissive | package quality
import "testing"
// Mean Reciprocal Rank
func TestMRR(t *testing.T) {
corpus := Corpus{
testIN("deadmau5"): []Label{
Label{
Doc: testDoc(1),
Relevant: true,
},
},
testIN("beethoven"): []Label{
Label{
Doc: testDoc(7),
Relevant: true,
},
},
}
results :=... |
69ca11cc5660e0f1419c03f94b71b98349f61c2c | 653e8d0a04390919513219c3293e1fdd8226dc3c | lyft/kubernetes | /pkg/volume/util/atomic_writer_test.go | Go | go | 27,983 | permissive | //go:build linux
// +build linux
/*
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 applic... |
7398d5683f764cc3011d08e7ba1b249c7d3845f9 | 70d1c5829f7e45521eafdf3db0fd5b2eac77f02c | jconer/origin | /pkg/oauth/apiserver/apiserver.go | Go | go | 5,301 | permissive | package apiserver
import (
"fmt"
"sync"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apiserver/pkg/registry/rest"
genericapiserver "k8s.io/apiserver/pkg/server"
restclient "k8s.io/client-go/rest"
coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalcli... |
e46a1562ed225dffb6408498fd91359a4d548564 | b59e5c453e50e54709f5ab13a96fa346bf2cc7fe | incu6us/goutils | /assert/equals_test.go | Go | go | 5,186 | no_license | package assert
import (
"reflect"
"testing"
"time"
)
func TestEqual(t *testing.T) {
type innerStruct struct {
Value string
}
type testStruct struct {
ID int
Value string
CreatedAt time.Time
InnerStruct innerStruct
}
type args struct {
actual interface{}
expected in... |
a470f9e0bb05abc06f36730e463826392b734f1c | dbb5c87b79f0f1598e13e26ee387c64d196abfaf | Aish025/topological-sort | /toposort/toposort_test.go | Go | go | 2,410 | permissive | package toposort_test
import (
"fmt"
"reflect"
"testing"
"github.com/otaviokr/topological-sort/toposort"
)
type Testable struct {
T map[string][]string
R [][]string
}
var (
TestableTrees []Testable
)
func init() {
TestableTrees = []Testable{
{
T: map[string][]string{
"Parent": {"Child"},
"Chil... |
e4f23ef9f355c248c2148512912c18c7a0521552 | ddbfdcef8913d676097b71475855915a4ea85c44 | renovate-testing/test-9748-google-cloud-go | /internal/generated/snippets/billing/apiv1/CloudBillingClient/UpdateProjectBillingInfo/main.go | Go | go | 1,336 | permissive | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
df0c264188e11be39d41175e41df77fae9a14131 | b3fb9cbc0a78eae0be5e60791f3b62d43e4a57aa | acstech/corkboard | /imagehandles.go | Go | go | 4,776 | no_license | package corkboard
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
//This blank import is to ensure proper use of autoload
_ "github.com/joho/godotenv/auto... |
7c9543f0454eea26f68e598a23078e3e950c1315 | 7a7fbb3aa34631d394e6f210ba398b59c21fa82c | RivenZoo/dsncfg | /dsncfg.go | Go | go | 5,022 | no_license | package dsncfg;
import (
"errors"
"net/url"
"strconv"
"strings"
)
const (
MySql = "mysql"
Postgresql = "postgres"
Sqlite = "sqlite"
)
// 0 - dbTypeMySql
// 1 - dbTypePgSql
// 3 - dbTypeSqLite
const (
dbTypeMySql = iota
dbTypePgSql
dbTypeSqLite
)
const (
defaultMysqlPort = 3306
defaultPgsq... |
cf3c7ee3f9c859a76c13aec50b13ed41aa5c0803 | ff966196241928592e93e5632ecb0c0e28250206 | yunionio/sdnagent | /vendor/yunion.io/x/cloudmux/pkg/multicloud/natgateway_base.go | Go | go | 1,475 | permissive | // Copyright 2019 Yunion
//
// 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 writi... |
544d5519234052653391951a45f5e1ee0d47dc8f | 4bf2bf51c3af82a70d27d6fdacd3698ab161b048 | sergeichikan/rs485 | /modbus/serial.go | Go | go | 2,071 | no_license | // Copyright 2014 Quoc-Viet Nguyen. All rights reserved.
// This software may be modified and distributed under the terms
// of the BSD license. See the LICENSE file for details.
package modbus
import (
"io"
"log"
"sync"
"time"
"rs485/serial"
)
const (
// Default timeout
serialTimeout = 5 * time.Second
... |
1499d5f4550e4f098dd4c07c3fb4a4d514867dc4 | 63ca3286a414c34a430fe22886d09b45ac677a15 | bigsupanat/oanda-trading-api-orchestrator | /goanda/instrument.go | Go | go | 4,294 | no_license | package goanda
// Supporting OANDA docs - http://developer.oanda.com/rest-live-v20/instrument-ep/
import (
"time"
)
type Candle struct {
Open float64 `json:"o,string"`
Close float64 `json:"c,string"`
Low float64 `json:"l,string"`
High float64 `json:"h,string"`
}
type Candles struct {
Complete bool `j... |
3fcc7a8ca6af4ac4f8f6a46863600ee982616127 | 85c3a2199d824a2e01f845191e5939f021c512af | lichuan0620/logtap | /pkg/logger/explicit.go | Go | go | 706 | no_license | package logger
import (
"fmt"
"io"
"time"
)
type explicitLogger struct {
writer io.Writer
name string
msg string
timestampFormat string
}
// NewExplicitLogger creates a Logger that prints a explicitly defined message.
func NewExplicitLogger(writer io.Writer, msg, name string, t... |
efdb43a883cb804c77aae11f7320c6f54d8ce333 | 8f6fe504e4bc172767aa2b60d0e66a65dda14292 | portworx/kvdb | /vendor/go.etcd.io/etcd/etcdserver/api/membership/errors.go | Go | go | 1,225 | 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... |
cca825101f9179cdce6e1dea2514071646168759 | 5ae279d1ed94978b1cd33c2002bf2d372065df7f | s3dteam/go-toolkit | /db/localcache/localcache_test.go | Go | go | 1,224 | permissive | package localcache
import (
"bufio"
"errors"
"fmt"
"os"
"testing"
"github.com/naoina/toml"
)
type RelayConfig struct {
Name string
Role string
Cache CacheOptions
}
func loadConfig(file string, cfg *RelayConfig) {
f, err := os.Open(file)
if err != nil {
panic(err)
}
defer f.Close()
err = toml.NewDe... |
2328b3811cb91ed0365a2290da3b5cedb9fe26ca | 086a5bb1bca89e7edfcb24bcfe6012a5260b8c21 | gorda0/go-examples | /cmdproxy.go | Go | go | 1,560 | no_license | package main
import (
"bufio"
"fmt"
"io"
"os"
"os/exec"
)
// main runs the bc Linux command and proxies stdin input to it... all in one method
func main() {
cmd := exec.Command("pianobar")
in, err := cmd.StdinPipe()
if err != nil {
panic(err)
}
out, err := cmd.StdoutPipe()
if err != nil {
panic(err)
... |
bc7cd9a4aa27ed5f25bb430c4f0c42f10790a896 | 2f5ed6c03c721d42ad9ca27d82180d78ce973dee | MMMzq/route-1 | /internal/config/provider.go | Go | go | 5,716 | permissive | package config
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"reflect"
"strings"
)
type Provider interface {
ProvideByFlag([]string)
ProvideByEnv()
unmarshal() error
}
type Provide struct {
config interface{}
tags map[string]bool
values map[string]string
ignoreCase bool
prefix st... |
676fa806ba4c3a7ef3690c102216163542c515b9 | 6b5edc553d265c003208847d593ecf49da7819ac | eric135/YaNFD | /face/multicast-udp-transport.go | Go | go | 5,957 | permissive | /* YaNFD - Yet another NDN Forwarding Daemon
*
* Copyright (C) 2020-2021 Eric Newberry.
*
* This file is licensed under the terms of the MIT License, as found in LICENSE.md.
*/
package face
import (
"errors"
"net"
"runtime"
"strconv"
"github.com/named-data/YaNFD/core"
"github.com/named-data/YaNFD/face/imp... |
3b3da06d46718e09e2583bf6fd4c5e71b0873c5d | 2793a50a9f344be8aad92208f451086ad4871979 | gogs/git-module | /signature_test.go | Go | go | 1,103 | permissive | // Copyright 2020 The Gogs 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 git
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func Test_parseSignature(t *testing.T) {
tests := []struct {
line stri... |
6dfbbb7ddc9df4f3177ac59ebd0543e17beefaee | c21676a4e0e7800b6cae0dbf7b8c48bfa3016777 | ianmcorvidae/search | /vendor/github.com/cyverse-de/querydsl/clause/owner/owner.go | Go | go | 1,409 | no_license | package owner
import (
"context"
"errors"
"github.com/cyverse-de/querydsl"
"github.com/cyverse-de/querydsl/clause"
"github.com/cyverse-de/querydsl/clauseutils"
"github.com/mitchellh/mapstructure"
"gopkg.in/olivere/elastic.v5"
)
const (
typeKey = "owner"
)
var (
documentation = clause.ClauseDocumentation{
... |
4872600509d8793848d06644cdd747ea4e1bf19a | 111b0fcc6cda9daa7843fd8305c76332bdfcfde8 | sourcegraph/sourcegraph | /enterprise/internal/codeintel/stores/dbstore/migration/committed_at.go | Go | go | 5,779 | permissive | package migration
import (
"context"
"time"
"github.com/cockroachdb/errors"
"github.com/keegancsmith/sqlf"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
"github.com/sourcegraph/sourcegraph/internal/gitserver"
... |
0936136203c69c7facb7b49e71fd9b2e13e299d3 | 1cb94203ee350889146b51b46a73389f1059d4a9 | trapchain/go-perun | /pkg/test/onlyonce_test.go | Go | go | 964 | permissive | // Copyright 2020 - See NOTICE file for copyright holders.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... |
c166e3b679ace0cc1338888f1481e88f05017451 | 59381b22e2482372c5e08f93e1a17eed86fb283f | zeta1999/redskyops-controller | /internal/oauth2/authorizationcode/authorizationcode.go | Go | go | 5,511 | permissive | /*
Copyright 2020 GramLabs, 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
... |
96ecb3fb114e85124a0e7bd071324bdaa8892f82 | fd55260418436d780c86fcad5c21f87390539116 | morrell/pulumi-azure-native | /sdk/go/azure/kusto/v20200614/attachedDatabaseConfiguration.go | Go | go | 8,347 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20200614
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Class representing an attached databa... |
5abdb3707d858327518510d06fd91aa54a1e0ffa | 9d43eda0bdb8e1cd14040dd4beb391ec93a74f72 | shoebox/do-the-thing | /internal/action/archive.go | Go | go | 1,128 | no_license | package action
import (
"context"
"dothething/internal/api"
"dothething/internal/xcode"
"github.com/rs/zerolog/log"
)
func NewArchive(api *api.API) api.Action {
return ActionArchive{api}
}
type ActionArchive struct {
*api.API
}
func (a ActionArchive) Run(ctx context.Context) error {
err := xcode.ParseXCodeB... |
619cbcec37385c91c3c1226ddbacf173492afa39 | 2f8b08cf77e80c8b7c5d48baa03b91caea57b2ae | cryptogarageinc/cfd-go | /tests/json_hdwallet_test.go | Go | go | 15,283 | permissive | package tests
import (
"encoding/json"
"fmt"
"path"
"strconv"
"strings"
"testing"
cfdgo "github.com/cryptogarageinc/cfd-go"
"github.com/cryptogarageinc/cfd-go/types"
"github.com/stretchr/testify/assert"
)
func TestHDWallet(t *testing.T) {
jsonData := readFile(path.Join(".", "data", "hdwallet_test.json"))
... |
5e90f6055a39dab1380d4ba9eae5757b67ddf118 | c1acd80d7a20773020bfe9c25091237b1965c535 | bombela/yarpc-go-fun | /loadbalancer/main.go | Go | go | 5,059 | no_license | package main
import (
"flag"
"fmt"
"hash/fnv"
"log"
"sync"
"github.com/bombela/yarpc-go-fun/broker"
"github.com/bombela/yarpc-go-fun/broker/yarpc/brokerclient"
"github.com/bombela/yarpc-go-fun/broker/yarpc/brokerserver"
"github.com/bombela/yarpc-go-fun/broker/yarpc/loadbalancerserver"
"github.com/yarpc/yarp... |
be2edbfe0026a143e9cb5277fdf306bc8a08328c | 7c4958f8a1e11bfddf41f04c0a46b10f8f82f507 | Dzhan85/awsls | /aws/aws_iam_access_key.go | Go | go | 700 | permissive | // Code is generated. DO NOT EDIT.
package aws
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/iam"
)
func ListIamAccessKey(client *Client) ([]Resource, error) {
req := client.iamconn.ListAccessKeysRequest(&iam.ListAccessKeysInput{})
var result []Resource
p := iam.NewListAccessKeysPaginator(req)
fo... |
8038420bc47373e6b34a1af1afab875cfe42493b | 407331bb8323d4de455c9ee0b1588f170623356d | cloudflare/go | /src/runtime/testdata/testwinlib/main.go | Go | go | 925 | permissive | //go:build windows && cgo
// +build windows,cgo
package main
// #include <windows.h>
// typedef void(*callmeBackFunc)();
// static void bridgeCallback(callmeBackFunc callback) {
// callback();
//}
import "C"
// CallMeBack call backs C code.
//
//export CallMeBack
func CallMeBack(callback C.callmeBackFunc) {
C.bridg... |
afcf376e1345978bd1992f93d0e747e50be5d36b | 4acf0c9252cdbecabb0a784e69170a8c0818eb2c | ysohta/gopl-ex | /ch08/ex07-mirroring/links.go | Go | go | 1,866 | no_license | package main
import (
"fmt"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"golang.org/x/net/html"
)
func Extract(rawURL string) ([]string, error) {
resp, err := http.Get(rawURL)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Erro... |
d9f42cf1d217193c7bef8e84a8fa07d3c2bc9b5b | 56edd9d4a0925f18224fcbdde522a7b8ca1f95a6 | sumanth797/Golang-practice | /Topics/customsort.go | Go | go | 538 | no_license | package main
import (
"fmt"
"sort"
)
type Person struct {
Name string
Age int
}
// ByName implements sort.Interface based on the Age field.
type ByName []Person
func (a ByName) Len() int { return len(a) }
func (a ByName) Less(i, j int) bool { return a[i].Name < a[j].Name }
func (a ByName) Swap(i, j i... |
2d85bf21d4cd9b6a6b8e159e2b623d13dc85bb47 | dba37aac783cbe77ab58c01312d8a575dbaf3a52 | hails/zeus-server | /vendor/gopkg.in/redis.v5/commands_test.go | Go | go | 89,254 | permissive | package redis_test
import (
"encoding/json"
"fmt"
"reflect"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"gopkg.in/redis.v5"
)
var _ = Describe("Commands", func() {
var client *redis.Client
BeforeEach(func() {
client = redis.NewClient(redisOptions())
Expect(client.FlushDb().Err()).NotT... |
e4ce9d950aef65873e0c864b93eec2eaf428881c | 890e33a8f6280d5b9ff7da7c585ea244be7b37bf | rebider/Fgame | /client/server/handler/server.go | Go | go | 568 | permissive | package handler
import (
uipb "fgame/fgame/common/codec/pb/ui"
"fgame/fgame/core/session"
log "github.com/Sirupsen/logrus"
)
//处理获取服务器列表
func handleServerList(s session.Session, msg interface{}) (err error) {
log.Debug("server:获取服务器列表")
scServerList := msg.(*uipb.SCServerList)
for _, server := range scServerLi... |
3a339a8f51ba043712ac95115219d7ea5995a19a | 9403843a6aa88cce92685d355c01994cf0b4f0bf | bernardokowacic/golang-migration | /server.go | Go | go | 518 | no_license | package main
import (
"log"
"net/http"
"github.com/golang-migration/routes"
"github.com/joho/godotenv"
_ "github.com/denisenkom/go-mssqldb"
)
func init() {
log.SetPrefix("LOG: ")
log.SetFlags(log.Ldate | log.Lmicroseconds | log.Lshortfile)
log.Println("init started")
errEnv := godotenv.Load()
if errEnv !... |
5d826e77b78edd21b9962cc818ef4cac7f3f617a | e98e59e47a768d079b364689c396760a569d41e0 | n4j/kata-containers | /src/runtime/virtcontainers/device/drivers/vfio_test.go | Go | go | 1,027 | permissive | // Copyright (c) 2017-2018 Intel Corporation
// Copyright (c) 2018 Huawei Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package drivers
import (
"testing"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
"github.com/stretchr/testify/assert"
)
func TestGetVFIODetail... |
523e4e789a7490ae642b378ad1e1d886eb039fc7 | 7a59ed192a02e6e3cf2cfa99d184592d37039cf0 | fengcunwu/Space_go | /YHTriangle/yhTriangle.go | Go | go | 476 | no_license | package main
import "fmt"
func GetYangHuiTriangleNextLine(inArr []int) []int {
var out []int
var i int
arrLen := len(inArr)
out = append(out, 1)
if 0 == arrLen {
return out
}
for i = 0; i < arrLen-1; i++ {
out = append(out, inArr[i]+inArr[i+1])
}
out = append(out, 1)
return out
}
func main... |
8370cc610bf994249a1d814f111e348df220590d | c5c851021fd75c281a8a3f30f67e4e2d2f9c53a8 | generalzgd/grpc-svr-frame | /cluster/main.go | Go | go | 777 | no_license | /**
* @version: 1.0.0
* @author: zgd: general_zgd
* @license: LGPL v3
* @contact: general_zgd@163.com
* @site: github.com/generalzgd
* @software: GoLand
* @file: main.go
* @time: 2019-05-20 19:44
*/
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/astaxie/beego"
"github.com/astaxie/b... |
17984d57dc2cca623a09d5bb2e31a69d30a4ea14 | 8ad7b0c12b670f2248d96918f572117bc90b2206 | vfarcic/jx | /pkg/jx/cmd/create_vault.go | Go | go | 8,685 | permissive | package cmd
import (
"fmt"
"io"
"time"
"github.com/banzaicloud/bank-vaults/operator/pkg/client/clientset/versioned"
"github.com/jenkins-x/jx/pkg/kube/services"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"gopkg.in/AlecAivazis/survey.v1/terminal"
"github.com/jenkins-x/jx/pkg/cloud/gke"
gkevault "github... |
adb7cba48be3e2eda725d9b7c8960839eaca3232 | 3311c1837e0f1734676326259941cde30da5ef2f | bankwing/heketifix | /dbentry.go | Go | go | 7,417 | no_license | //
// Copyright (c) 2016 The heketi Authors
//
// This file is licensed to you under your choice of the GNU Lesser
// General Public License, version 3 or any later version (LGPLv3 or
// later), or the GNU General Public License, version 2 (GPLv2), in all
// cases as published by the Free Software Foundation.
//
packa... |
65841bf0bad560a870217fb250598b5934c703ea | 7f007a8651eba9948fa369ef59c897edce05881d | AlnsV/go_commons | /schedule_test.go | Go | go | 721 | no_license | package utils
import (
"testing"
)
func TestNewIndexSchedule(t *testing.T) {
idx := NewIndexSchedule("http://172.31.46.109:5100/")
err := idx.UpdateSchedule()
if err != nil {
t.Log(err)
}
errTwo := idx.UpdateSchedule()
if errTwo != nil {
t.Log(errTwo)
}
idxTwo := NewIndexSchedule("http://... |
abc03cfb14362bb59c76061a333d10160c37e666 | e120cbfb96531c124730fb7e1562566f604d4378 | bbutkovic/fastly-cli | /pkg/healthcheck/create.go | Go | go | 3,023 | permissive | package healthcheck
import (
"io"
"github.com/fastly/cli/pkg/cmd"
"github.com/fastly/cli/pkg/compute/manifest"
"github.com/fastly/cli/pkg/config"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v3/fastly"
)
// CreateCommand calls the Fastly API to create healthchecks.
type CreateCommand struct {
... |
0b2acc52fd108f545648be2eceb1aee996d45d57 | 93942051c502349a605c9fe561a6d4198d893de1 | ddaddaddda/etcd | /server/etcdserver/corrupt_test.go | Go | go | 15,914 | permissive | // Copyright 2022 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... |
76eb30c38114f5bbdff39d88efc2e601fa65e5ce | 25fd093e8902da8eb6b90b0f9c64a48a2afcf0aa | davidsa13/AMSE_CPSC546_Cartelize | /accounts/pkg/models/admin.go | Go | go | 2,115 | no_license | package models
import (
"database/sql"
"errors"
"fmt"
"github.com/jmoiron/sqlx"
"golang.org/x/crypto/bcrypt"
)
// Admin model
type Admin struct {
ID int `db:"id" json:"id,omitempty"`
Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"`
Password string `db:"password" jso... |
93fa51a8d1d3b6996c724868c8ee35f4fa42ac72 | 6bff81eea9285cfd8d6e7a7283b272cfc509f988 | cloudfoundry/metric-store-release | /vendor/github.com/scaleway/scaleway-sdk-go/scw/client.go | Go | go | 16,541 | permissive | package scw
import (
"crypto/tls"
"encoding/json"
"fmt"
"io"
"math"
"net"
"net/http"
"reflect"
"strconv"
"strings"
"sync"
"time"
"github.com/scaleway/scaleway-sdk-go/internal/auth"
"github.com/scaleway/scaleway-sdk-go/internal/errors"
"github.com/scaleway/scaleway-sdk-go/internal/generic"
"github.com/... |
fc5368487ba50517018ba811d5a5e2d926751e0d | 7a7cd78bf09f75614308bf14908f3bfd876198f8 | minguu42/filess | /cmd/filess/main.go | Go | go | 1,425 | no_license | package main
import (
"flag"
"github.com/minguu42/filess"
)
const version = "0.1.0"
var revision = ""
func main() {
var IsVOptionActive bool
flag.BoolVar(&IsVOptionActive, "v", false, "show version")
flag.BoolVar(&IsVOptionActive, "version", false, "show version")
var IsCOptionActive bool
flag.BoolVar(&IsCO... |
600f69bf5b3d46df2f5bf3d7db2605c8e64e3602 | de2c4c047bdaf7eb879f04aae4d73847caa7b1dd | webclinic017/docker-slim | /pkg/pdiscover/pinfo_darwin.go | Go | go | 1,445 | permissive | package pdiscover
import (
"os"
"path/filepath"
"syscall"
"unsafe"
)
const (
CTLKern = 1
KernProcArgs = 38
)
func GetOwnProcPath() (string, error) {
return GetProcPath(os.Getpid())
}
func GetProcPath(pid int) (string, error) {
nameMib := []int32{CTLKern, KernProcArgs, int32(pid), -1}
procArgsLen := u... |
fde80438abe2fb1cc7884019d3f4f5a8bb7d4ab5 | e6ea3f4202c67368757f12ad61dc19d875cc8e19 | Daqlet/GoLang | /main/Chapter_10_Concurrency/useContext.go | Go | go | 1,381 | no_license | package main
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"sync"
"time"
)
var (
myUrl string
delay int = 5
w sync.WaitGroup
)
type myData struct {
r *http.Response
err error
}
func connect(c context.Context) error {
defer w.Done()
data := make(chan myData, 1)
tr := &http.Transport{}
httpClie... |
935d314e42620f513c1442ae1280271067a70e6b | e05500d988fc9fb9ccd4a5008d2e7b03e5cf5910 | NeoTim/bk-bcs | /bcs-k8s/bcs-hook-operator/pkg/controllers/hook/hook_reconcile.go | Go | go | 18,375 | permissive | /*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obta... |
977ccecdf8ea83416974a2e2f6ede6382f09308c | d6e216c7edce0f9cc1f83bbea7b7e4c2b7f78607 | joyplus/adexchange | /lib/lib.go | Go | go | 3,817 | permissive | package lib
import (
"bytes"
"crypto/md5"
"encoding/gob"
"encoding/hex"
"fmt"
"math/rand"
"strconv"
"strings"
"time"
)
//create md5 string
func Strtomd5(s string) string {
h := md5.New()
h.Write([]byte(s))
rs := hex.EncodeToString(h.Sum(nil))
return rs
}
//password hash function
func Pwdhash(str string)... |
c06b4ca48862a58a63dc82c11f0573610552fe02 | 51abcee65d46e6f91cfa1feaeed77e8fb1a4286f | macheema/go_programming_language_practise | /src/ch1/section12/echo2.go | Go | go | 206 | no_license | //Package section12 ...
package section12
import (
"fmt"
"os"
)
/*
Echo2 ...
*/
func Echo2() {
var str, sep string
for _, arg := range os.Args {
str += sep + arg
sep = " "
}
fmt.Println(str)
}
|
71d5f4787ccc2be8a7e3485104c79d65a033d696 | fe81c8d99fc22227ef8573533ef28b1a1389ff1c | freedomofkeima/google-api-go-client | /firebasedynamiclinks/v1/firebasedynamiclinks-gen.go | Go | go | 83,176 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package firebasedynamiclinks provides access to the Firebase Dynamic Links API.
//
// For product documentation, see: https://firebase.google.co... |
6d694156d8f0e4097b7d56527d5696f312c59276 | 1ce7bb5be2dbe6f784fd12804337134a197030f8 | dimiro1/experiments | /go-lua/example/main.go | Go | go | 706 | permissive | package main
import (
"fmt"
"github.com/Shopify/go-lua"
)
type step struct {
name string
function interface{}
}
func main() {
steps := []step{}
l := lua.NewState()
lua.BaseOpen(l)
lua.NewMetaTable(l, "stepMetaTable")
lua.SetFunctions(l, []lua.RegistryFunction{{"__newindex", func(l *lua.State) int {
k... |
98a3586c593ece62fcd21b91e75a890fb9874396 | c0854d9fa0271d06878bf362a6d176e15dc03526 | SummerCash/ursa | /common/commonio.go | Go | go | 770 | permissive | package common
import (
"os"
"path/filepath"
)
/* BEGIN EXPORTED METHODS */
/*
BEGIN I/O METHODS
*/
// GetDefaultDataDir - get default data directory
func GetDefaultDataDir() string {
abs, _ := filepath.Abs(filepath.FromSlash("./data")) // Get absolute dir
return filepath.FromSlash(abs) // Match slashes
}
//... |
f392fa09e6b6f3fb81df3ffe03780185d974d85b | c2d2151c54ed87b811f9abebf3340adc2c8ab0d7 | insolar/go-jose | /jwt/builder_test.go | Go | go | 17,044 | permissive | /*-
* Copyright 2016 Zbigniew Mandziejewicz
* Copyright 2016 Square, 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
*
* Unle... |
6dc5059bd12f843c984f814b9e6e04c298c582ca | 481e179383e026d8a9de2f7b41d943861450e509 | webcat12345/go-one | /model/user.go | Go | go | 493 | no_license | package model
import "time"
type User struct {
Id int `json:"id"`
Email string `json:"email" sql:"type:varchar(255),notnull,unique"`
Password []byte `json:"-" sql:",notnull"`
IsDeleted bool `json:"is_deleted" sql:",notnull;default:false"`
IsVerified bool `json:"is_verified s... |
52ff6d0fbdf4d1c297ca83cbb3d20b3a44df2dbe | 3bcbf9c753d8fea33be19ec000a57050e62ab4fc | bkochendorfer/external-dns | /registry/txt.go | Go | go | 5,571 | 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, ... |
3c448d705f1ca7bd4e6e18313b86953ce1947891 | 77c4149ec3b64df97b924758fffcf87adbd13eb6 | xinhua5/pd | /server/api/unsafe_operation_test.go | Go | go | 2,963 | permissive | // Copyright 2021 TiKV Project 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 agr... |
10df31b456ce01073a750d10ce3bca0b3c217eb4 | aced452a7941e3e8d6afa7fe7c00db83f5636058 | pablohenrique6/portainer | /api/cmd/portainer/main.go | Go | go | 6,619 | permissive | package main // import "github.com/portainer/portainer"
import (
"github.com/portainer/portainer"
"github.com/portainer/portainer/bolt"
"github.com/portainer/portainer/cli"
"github.com/portainer/portainer/cron"
"github.com/portainer/portainer/crypto"
"github.com/portainer/portainer/file"
"github.com/portainer/p... |
14ab20f3c050e2e23c449f3be3fe8b7f206c4f70 | 15813e44ed88f47ded9d29b046e24eea57f68e99 | dmage/oc | /pkg/cli/admin/catalog/mirror.go | Go | go | 10,063 | permissive | package catalog
import (
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/klog"
kcmdutil "k8s.io/kubectl/p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.