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 |
|---|---|---|---|---|---|---|---|---|
dcff1aef99a6e36c133bebb8594651416afe64df | ea93401de25a21bfe5ab98b947f7936546d134b7 | BlakeHolifield/insights-ingress-go | /config/config.go | Go | go | 3,759 | no_license | package config
import (
"fmt"
"os"
"regexp"
"strings"
clowder "github.com/redhatinsights/app-common-go/pkg/api/v1"
"github.com/spf13/viper"
)
// IngressConfig represents the runtime configuration
type IngressConfig struct {
Hostname string
MaxSize int64
StageBucket string
... |
2ea5aa660e4ed84558090968a02e5adb89625d23 | 3bc96aa08d1851825bfca0c1aa3a7eeea40d7869 | thbkrkr/go-utilz | /elastic/elastic.go | Go | go | 460 | no_license | package elastic
import (
"github.com/Sirupsen/logrus"
"gopkg.in/olivere/elastic.v3"
)
// NewClient creates an Elasticsearch client
func NewClient(elasticURL string) *elastic.Client {
opts := elastic.SetURL(elasticURL)
client, err := elastic.NewClient(opts)
if err != nil {
logrus.WithError(err).WithField("url",... |
1ae83d0777a2bb210eead9635f6df7565aa9701f | 2cfeaf62092be715fa5d9580f5b20ee02594437b | sumit-awasthi/golang-Kloudlearn | /RESTAPI/funcmux.go | Go | go | 381 | no_license | package main
import (
"io"
"net/http"
)
func welcome(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Welcome!")
}
func howru(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "hey whatsup!")
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/welcome", welcome)
mux.HandleFunc(... |
0d79f638c60632cb2b7633f5720153367aa73518 | 5be4b723ef7b2451c55ee9cced84b616a48b181e | iris-contrib/clean-arch | /author/repository/mysql_repository.go | Go | go | 1,042 | permissive | package repository
import (
"context"
"database/sql"
"github.com/kataras/golog"
"github.com/iris-contrib/clean-arch/author"
"github.com/iris-contrib/clean-arch/models"
)
type mysqlAuthorRepo struct {
DB *sql.DB
}
// NewMysqlAuthorRepository will create an implementation of author.Repository
func NewMysqlAuth... |
11602d3def2c8dfb68b31765b4173fb2326f75ae | 7f2dadd01fa973e49aaadb85d3884cbf6539d754 | jgoguen/chezmoi | /main_test.go | Go | go | 15,789 | permissive | package main
import (
"bufio"
"bytes"
"fmt"
"os"
"path"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"testing"
"time"
"github.com/rogpeppe/go-internal/testscript"
"github.com/twpayne/go-vfs/v2"
"github.com/twpayne/go-vfs/v2/vfst"
"github.com/twpayne/chezmoi/v2/cmd"
"github.com/twpayne/chez... |
a811ed39ca36fecbd148db28baf1a9a790d64658 | e3df5167e1cd08712e846cd10b7f43329b21027d | bineetdubey/datacol | /cmd/stack.go | Go | go | 6,043 | permissive | package main
import (
"errors"
"fmt"
log "github.com/Sirupsen/logrus"
term "github.com/appscode/go-term"
pb "github.com/dinesh/datacol/api/models"
"github.com/dinesh/datacol/cmd/provider/gcp"
"github.com/dinesh/datacol/cmd/stdcli"
"gopkg.in/urfave/cli.v2"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
var (... |
47935a562d9afe7206698d873b4ff9ac467ae835 | eef8f618c6b7e8de78202d5e6667263636afe178 | eaware/coreroller | /backend/vendor/src/gopkg.in/mgutz/dat.v1/where.go | Go | go | 4,140 | permissive | package dat
import (
"reflect"
"regexp"
"strconv"
"strings"
"gopkg.in/mgutz/dat.v1/common"
)
// Eq is a map column -> value pairs which must be matched in a query
type Eq map[string]interface{}
type whereFragment struct {
Condition string
Values []interface{}
EqualityMap map[string]interface{}
}
fun... |
6b78ad3f72f9bb9566523515ed4a1fde96314086 | 07d4f00081349a7f003faa4b020a2d1e6fca02d4 | codeready-toolchain/member-operator | /controllers/memberoperatorconfig/mapper_test.go | Go | go | 965 | permissive | package memberoperatorconfig
import (
"testing"
"github.com/codeready-toolchain/toolchain-common/pkg/test"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
)
func TestSecretToMemberOperatorConfigMapper(t *testing.T) {
// when
secretData := map[string][]byte{
... |
18c2240597d1df8daceb2e4a56faa116b2415cdb | c24e5d38b5dded0696b10739d9822a8b3476b2aa | mmcloughlin/trunnel | /gen/fuzz.go | Go | go | 570 | permissive | package gen
import "github.com/mmcloughlin/trunnel/tv"
// Fuzzers generates fuzzing functions for the types in the corpus.
func Fuzzers(pkg string, c *tv.Corpus) ([]byte, error) {
p := &printer{}
p.markgenerated()
p.printf("// +build gofuzz\n\n")
p.pkg(pkg)
for _, s := range c.Suites {
if constrained(s.Vecto... |
cedc61aa2de801b756d5d0ec9b968f181c8d9054 | eb449d3647c7ba23e9b84f53c9f67f952e9cf254 | cfoust/cy | /pkg/mux/stream/reader.go | Go | go | 714 | permissive | package stream
import (
"io"
)
type Reader struct {
r *io.PipeReader
w *io.PipeWriter
}
var _ Stream = (*Reader)(nil)
// Return the handle that allows you to write to this stream.
func (s *Reader) Writer() io.Writer {
return s.w
}
// Resizing does nothing to a stream.
func (s *Reader) Resize(size Size) error {... |
fa8ed4a01cd26661f1e3a99d6157b7daa9667d32 | ec64e6a445ca50f5bfff42c58541939ebc43a192 | didil/bucket-text-api | /api/handlers.go | Go | go | 508 | permissive | package api
import "net/http"
type SaveTextReqData struct {
Name string `json:"name"`
Content string `json:"content"`
}
// HandleSaveText saves text
func (app *App) HandleSaveText(w http.ResponseWriter, r *http.Request) {
reqData := &SaveTextReqData{}
err := readJSON(r, reqData)
if err != nil {
app.Handle... |
fb648e523eaa112e96a973ce526cae7020b8a8eb | 64f8270a1380d68798cd1977817940dfff282b83 | Andrii464/pantahub-base | /changes/service.go | Go | go | 13,995 | permissive | //
// Copyright 2020 Pantacor Ltd.
//
// 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 ... |
641a5518d3a6e14e19e9bcd4ab2d57183fc29e69 | 6c366c302a36248016055ffc4e14ea1fc951595c | supermouseno1/GolangWebApp | /src/viewmodels/about.go | Go | go | 1,154 | no_license | package viewmodels
import ()
type About struct {
Title string
Active string
Skills []Skill
Summary string
Quote string
Image string
LoggedIn bool
LoggedName string
}
type Skill struct {
Skill string
}
func GetAbout() About {
result := About{
Title: "About me:",
Active: "about",
Quote: "First ... |
621cb1c7ca0484093f8d9a5ff130b1c72fc29f1b | 57e6eb8a4b6826a6440b215d040538daec33a3bc | cxuhua/xginx | /bech32_test.go | Go | go | 4,762 | permissive | package xginx
import (
"bytes"
"math/rand"
"testing"
)
type validTestAddress struct {
address string
data []byte
}
var (
validChecksum = []string{
"A12UEL5L",
"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs",
"abcdef1qpzry9x8gf2tvdw0s3jn54kh... |
91e65b4750a8b2593c5bd60c59b6611b0e447b7a | b6cd053bf7cc2f7286c42600b9cd3fb62956a0ab | whosonfirst/go-whosonfirst-export | /vendor/github.com/sfomuseum/go-edtf/parser/tests.go | Go | go | 641 | permissive | package parser
import (
"github.com/sfomuseum/go-edtf"
"github.com/sfomuseum/go-edtf/tests"
)
var Tests map[string]map[string]*tests.TestResult = map[string]map[string]*tests.TestResult{
"Unknown": map[string]*tests.TestResult{
edtf.UNKNOWN: tests.NewTestResult(tests.TestResultOptions{
StartLowerIsUnknown: tr... |
65934ce00081f53d3080d3625ac0ada2327582e5 | 6951ff786f455846f5e24ac552dec1e0e6e96f40 | Genocs/golang-course | /src/hellomodule/rabbit_receive.go | Go | go | 1,265 | permissive | package hellomodule
import (
"encoding/json"
"log"
"github.com/streadway/amqp"
)
// ReceiveMessages messages from amqp
func ReceiveMessages() {
conn, err := amqp.Dial("amqps://zcoqmbte:2hLTwEGHEPy9iXbWz9NWSi5DZch8eq1a@flamingo.rmq.cloudamqp.com/zcoqmbte")
failOnError(err, "Failed to connect to RabbitMQ")
ch, ... |
fde1d52c056fdc4a743864c0526536b0a294df6e | 88fe1864749c3c69b2565e66f8b748eedc145910 | zhangzw001/go-example | /go圣经/01/1.4/1.4lissajous.go | Go | go | 1,206 | no_license | // Lissajous generates GIF animations of random Lissajous figures.
package lissajous
import (
"fmt"
"image"
"image/color"
"image/gif"
"io"
"math"
)
var palette = []color.Color{color.White, color.Black}
type Lconfig struct {
Cycles float64
Res float64
Freq float64
Size int
Nframes int
Delay int
}
... |
b9cc3dd1e5591fa5d462feaee7e345321c3cd0fd | 01f45835f3e6dcdf1d765a46d4432941d10ff879 | lifa1225/aspose-words-cloud-go | /v2107/api/models/delete_comment_request.go | Go | go | 6,798 | permissive | /*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="delete_comment_request.go">
* Copyright (c) 2021 Aspose.Words for Cloud
* </copyright>
* <summary>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of thi... |
e5d0aea5c7a2bfc4c237244c230402c4cba22681 | 4b0a108f3cc9b700f2d8b6869db537adc6698de8 | rsc/client | /go/engine/login_state_test.go | Go | go | 10,222 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package engine
import (
"errors"
"testing"
"github.com/keybase/client/go/libkb"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
"github.com/stretchr/testify/require"
"golang.org/x/... |
aa67e9db5823ff03049b33d7d6c61979be31680f | cc86677e97e54bd52904285ac3ad5a057d426091 | anandbanik/carsales-fabric | /chaincode/go/dealer/dmvdealer.go | Go | go | 8,083 | no_license | package main
import (
"bytes"
"crypto/x509"
"encoding/json"
"encoding/pem"
"fmt"
"strconv"
"strings"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
var logger = shim.NewLogger("CarSalesChaincode")
type CarSalesChaincode struct {
}
type Negotiation stru... |
7fef09c21c7d90683354f08dd91fdaf591db4be8 | 0b0ecaa78d1816620299e2e9475abe52a55019b9 | pradyuz3rocool/microgateway | /activity/sqld/injectsec/gru/gru.go | Go | go | 4,685 | permissive | package gru
import (
"fmt"
"math/rand"
"regexp"
"sort"
"strings"
"github.com/project-flogo/microgateway/activity/sqld/injectsec/data"
G "gorgonia.org/gorgonia"
)
const (
embeddingSize = 10
outputSize = 2
hiddenSize = 5
)
// Chunks are SQL chunks
var Chunks = []string{
"0x",
"/*",
"*/",
"--",
"b... |
29748bd88e1fa405cee043bf2a206c87d28fe08a | 39aad31fcd7751ecd4613e0b72270f0aa92534b8 | ericfengchao/treasure-hunting | /model_types.go | Go | go | 1,213 | no_license | package treasure_hunting
import (
"errors"
"fmt"
)
type Gamer interface {
// read
GetGameStates() []*PlayerState
GetGridView(playerId string) string
GetSerialisedGameStats() *CopyRequest
// write
MovePlayer(playerId string, move Movement) error
CleanupPlayer(playerList []*Player)
}
var (
InvalidCoordinate... |
ebcff298eb6288d6e26c7f6ce54621c02b00af00 | a408c631e24dbf39d98fd820c91711206f0d198f | SmarkSeven/email | /email.go | Go | go | 10,705 | permissive | // Package email is designed to provide an "email interface for humans."
// Designed to be robust and flexible, the email package aims to make sending email easy without getting in the way.
package email
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"io"
"mime"
"mime/multipart"
"net/mail"
"net/textproto"
... |
0bd5049ef29b97183e15dab5a97938fd58376b53 | dc079c5752b4d74e55457f1f141a863e43e347fa | Alanthur/openyurt | /pkg/yurthub/proxy/remote/remote.go | Go | go | 3,973 | permissive | /*
Copyright 2020 The OpenYurt 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, so... |
71c99e26b73af6c4ee741703ebb4a04c35076c4e | 33803f5d1ce24db98e6226fbe4c084b8ac52f51d | etsangsplk/aws-go | /aws/types.go | Go | go | 1,425 | permissive | package aws
// A StringValue is a string which may or may not be present.
type StringValue *string
// String converts a Go string into a StringValue.
func String(v string) StringValue {
return &v
}
// A BooleanValue is a boolean which may or may not be present.
type BooleanValue *bool
// Boolean converts a Go bool... |
fae268a533df1973b960744090bb303586ca9ebe | 6612bd5cdc4e6d0e86003414640f3a8a4a3f0e57 | KyberNetwork/reserve-stats | /tradelogs/storage/postgres/big_trades.go | Go | go | 4,591 | permissive | package postgres
import (
"fmt"
"math/big"
"time"
"github.com/KyberNetwork/reserve-stats/lib/blockchain"
"github.com/KyberNetwork/reserve-stats/lib/caller"
"github.com/KyberNetwork/reserve-stats/tradelogs/common"
ethereum "github.com/ethereum/go-ethereum/common"
)
const (
getBigTradesQuery = `
SELECT bt.trad... |
5336b31405c5cd54c1d29efaab256667b9f80e1d | 8942b43b1979d8dc6f2a4d8ceda3ae3e41e62ce8 | ki0/telegraf | /plugins/outputs/devo/devo_test.go | Go | go | 2,207 | permissive | package devo
import (
"bufio"
"bytes"
"net"
"testing"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestDevo_tcp(t *testing.T) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t... |
05095aba9d3d825f24affc2d46df5abeee8f0afb | e38a519b7ecf9265ae6b5c27d5fb1ca8a38994cf | Soreil/eulersolutions | /utils/factorial_test.go | Go | go | 602 | permissive | package utils
import "testing"
var testCases = []struct {
input float64
expected float64
}{
{0, 1},
{1, 1},
{10, 3628800},
{23, 25852016738884976640000},
{13, 6227020800},
{100, 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109... |
ed10b09422544b0f12c7cc31990e0042fda06828 | 84a985469bc11d6ee98ab3759eec9d919edd7e0c | player-two/cloudflare-go | /auditlogs.go | Go | go | 4,062 | permissive | package cloudflare
import (
"encoding/json"
"net/url"
"path"
"strconv"
"time"
)
// AuditLogAction is a member of AuditLog, the action that was taken.
type AuditLogAction struct {
Result bool `json:"result"`
Type string `json:"type"`
}
// AuditLogActor is a member of AuditLog, who performed the action.
typ... |
dcaec9df2361f648f7adf2a0e7ea8e24f3d57367 | 32dc77764acd840fc30357cf54d06ab7ed4b8da6 | Oooska/irc | /conn_test.go | Go | go | 5,485 | permissive | package irc
import (
"bufio"
"log"
"net"
"testing"
)
func getListener() net.Listener {
l, err := net.Listen("tcp", "127.0.0.1:8080")
if err != nil {
log.Fatalf("Unable to listen on port 8080: %s", err.Error())
}
return l
}
//TODO: Test SSL
func TestNewConnection(t *testing.T) {
l := get... |
f31e2447e4fea3159dc9dbb27467ae2f2f340a37 | 1c60a8136df10378fcfd0868dfd9c0e2c620c4a7 | juanbg/goTraining | /14_functions/02_param_arg/main.go | Go | go | 222 | no_license | package main
import (
"fmt"
)
func main() {
greet("John")
greet("Josep")
}
func greet(name string) {
fmt.Println("Hello", name)
}
//func greet is declared with a parameter
//when calling greet, pass in an argument
|
ecc8ae36a88f9dfcebe690ff8fd29473ad02590d | f13613db6fc2afb7a187c956ed6ca1f43995605f | liuhengloveyou/easyTask | /api/delTaskApi.go | Go | go | 1,174 | no_license | package api
import (
"net/http"
"strconv"
"github.com/liuhengloveyou/easyTask/services"
gocommon "github.com/liuhengloveyou/go-common"
passportcommon "github.com/liuhengloveyou/passport/dao"
passport "github.com/liuhengloveyou/passport/face"
"github.com/liuhengloveyou/passport/sessions"
)
func DeleteTaskAPI(... |
6de5db84aa93fecdc4bbd8aa8696adadaab080fb | b49d2ba43100aae0b9932e06f65a6174a77edc69 | MichaelKaaden/redux-server-golang | /handlers.go | Go | go | 4,088 | permissive | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/MichaelKaaden/redux-server-golang/counters"
"github.com/gin-gonic/gin"
)
type CounterResponse struct {
Counter counters.Counter `json:"counter"`
}
type CounterData struct {
Data CounterResponse `json:"data"`
... |
e90771eba3fd18f67d7172a2f33eb323717b8025 | b5e1a74fd5be85979fc6407a0233a6f1ec94eb0b | kaivalya97/space-cloud | /gateway/modules/crud/sql/delete.go | Go | go | 1,927 | permissive | package sql
import (
"context"
"strings"
"github.com/doug-martin/goqu/v8"
"github.com/spaceuptech/space-cloud/gateway/model"
"github.com/spaceuptech/space-cloud/gateway/utils"
_ "github.com/denisenkom/go-mssqldb" // Import for MsSQL
_ "github.com/doug-martin/goqu/v8/dialect/postgres" // Dialec... |
ceddd01c4e789dcc11873239e4c8f17232bf29e9 | fe36a9ca57a5ff395f4de54604dbabb0a66fd43e | tklauser/cue | /cue/ast/astutil/apply.go | Go | go | 13,630 | permissive | // Copyright 2018 The CUE 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... |
7e98953be41bd4f9a956099c70aadc635976877a | 602391e5c4f1ce8779ef0f749b2db2d836c61f05 | hyqhyq3/avsocks | /handler/client.go | Go | go | 1,034 | no_license | //client
package handler
import (
"crypto/cipher"
"errors"
"log"
"net"
)
type Client struct {
Server string
ClientCipher, ServerCipher cipher.Block
}
var connections = 0
func handshake(conn net.Conn) (err error) {
b := make([]byte, 2)
_, err = conn.Read(b)
if err != nil {
return
}
... |
0d3d85524b11268ec0aa7639bac9c2ed3939d3f1 | 9763194cc4c8005fc126f57e60c5bcf6ebcce06b | kohpai/oo2go | /model/deny_all_strategy.go | Go | go | 1,149 | no_license | package model
import (
"container/heap"
)
type DenyAllStrategy struct {
BaseStrategy
leastReplicatedRank int
rankCount RankCount
}
func (strategy *DenyAllStrategy) countBeingRemovedReplicas() int {
return strategy.countEdgeReplicas()
}
func (strategy *DenyAllStrategy) Apply(rankedStudent *RankedStude... |
1e19ee2f657ec2e4166ac0ded7b8b5a93c15ef9e | c828d520e701584f24a9fe5d8d6f30a5650e6260 | tshepang/dry | /appui/swarm/node_row.go | Go | go | 3,096 | permissive | package swarm
import (
"strconv"
"github.com/docker/docker/api/types/swarm"
units "github.com/docker/go-units"
termui "github.com/gizak/termui"
"github.com/moncho/dry/appui"
"github.com/moncho/dry/docker/formatter"
drytermui "github.com/moncho/dry/ui/termui"
)
//NodeRow is a Grid row showing runtime informati... |
87a7cd330b70687a4d1773f8c9e0045cd0569e14 | bbda252f27676bb20185c773a60caebe8bcd2833 | DeveloperJim/bk-bcs | /bcs-common/common/tcp/tcpserver/tcpserver.go | Go | go | 3,464 | 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... |
c2404099560c3b440e81e2827688f1665f6184bc | cebcf2ab23345cabf60f721e5d0875f8cf6c2f34 | andy0937/api-linter | /rules/aip0135/message_rules_test.go | Go | go | 3,865 | permissive | // Copyright 2019 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
e8697d66da18e7f1ed47eb8632ff6de94135319d | 3b3d359ff35d5262b6606ecfc9b201761a3f0699 | emilva/converge | /rpc/grapher.go | Go | go | 3,059 | permissive | // Copyright © 2016 Asteris, 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 ... |
b24b9a2e51be72e2d879f4c6ca0a5844482fa1f1 | 8b94efba9243ee6a4ab2b14c2841050f1fafcefe | XiaShe/Chatroom | /server/model/user.go | Go | go | 268 | no_license | package model
// 定义用户结构体
type User struct {
// 序列化与反序列化成功,需保证用户json字符串key与结构体对应的tag名字对应一致
UserId int `json:"userId"`
UserPwd string `json:"userPwd"`
UserName string `json:"userName"`
} |
1f39e642cb1523c1cab4c209fde6715d2167ef5a | 2837ccd67ea4b5d5ee203ed4a6f1a1d5ada4169e | go-numb/go-bitflyer | /public_test.go | Go | go | 4,723 | permissive | package bitflyer
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"sync"
"testing"
"time"
"github.com/go-numb/go-bitflyer/public"
"github.com/stretchr/testify/assert"
"github.com/tcnksm/go-httpstat"
)
func TestRequestClientResolver(t *testing.T) {
var (
urls = []string{
V1,
... |
a3337be69508a49a86cbee1515ce2b2eb76bddee | b1c928d15d7915e7bb821f58a446bd97d29eed00 | liuhuaming2017/gotest | /vendor/github.com/ServiceComb/go-chassis/vendor/github.com/apache/thrift/tutorial/go/src/handler.go | Go | go | 2,899 | permissive | // +build !go1.7
package main
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache Licens... |
057b2b1e2427e835a47a58cae1919909e1645285 | f8a616ddae51fa201c5425dda3502700ac5d1f99 | BrahmaOS/brahmaos-ipfs | /unixfs/mod/dagmodifier.go | Go | go | 12,649 | permissive | // Package mod provides DAG modification utilities to, for example,
// insert additional nodes in a unixfs DAG or truncate them.
package mod
import (
"bytes"
"context"
"errors"
"io"
help "github.com/ipfs/go-ipfs/importer/helpers"
trickle "github.com/ipfs/go-ipfs/importer/trickle"
mdag "github.com/ipfs/go-ipfs/... |
1594d54f7736e4bd827116c29394d0ec624fef7d | a8497691843814ef1af965a12843cc01d8785293 | kjx98/c4go | /vendor/github.com/disiqueira/gotree/gotree.go | Go | go | 1,621 | permissive | package gotree
const (
newLine = "\n"
emptySpace = " "
middleItem = "├── "
continueItem = "│ "
lastItem = "└── "
)
type (
tree struct {
text string
items []Tree
}
Tree interface {
Add(text string) Tree
AddTree(tree Tree)
Items() []Tree
Text() string
Print() string
}
print... |
babf05295564b9ad0e5b87523fcda29b29bb0bc6 | fbf2ed9368ce6825f6ae2a2b027f36de2b3b76af | drewwells/helium-graphql | /mock/oracle.go | Go | go | 278 | no_license | package mock
import (
"fmt"
"net/http"
"github.com/drewwells/helium-graphql/typs"
)
func init() {
Handle(typs.OracleURL, func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, `{"data":{"timestamp":"2021-02-08T04:03:26.000000Z","price":42,"block":42}}`)
})
}
|
8e75c87772b2fbab643eb146a7095014cabce881 | eb3222595087b377cf2b55992d66c8f82521c8ea | ligato/cn-infra | /messaging/kafka/doc.go | Go | go | 6,980 | permissive | // Copyright (c) 2017 Cisco and/or its affiliates.
//
// 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 applicabl... |
891e6ab78dd1470eb5e95f7a6de7b4f219e90634 | 8926c282af587d8e43f09a52926ce68f911ec0fa | 256dpi/fire | /torch/testing.go | Go | go | 2,043 | permissive | package torch
import (
"time"
"github.com/256dpi/xo"
"github.com/256dpi/fire"
"github.com/256dpi/fire/axe"
"github.com/256dpi/fire/coal"
"github.com/256dpi/fire/roast"
)
// Env is a testing environment.
type Env struct {
*roast.Tester
Queue *axe.Queue
Reactor *Reactor
Operation *Operation
}
// Test... |
0e7c296e22575e06ce06619d4a5d013d89516091 | 49fa4e1daad1822714773c59c03ba708034e344f | kusubooru/monban | /monban/boltdb/whitelist_test.go | Go | go | 1,175 | permissive | package boltdb
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"time"
"github.com/kusubooru/monban/jwt"
"github.com/kusubooru/monban/monban"
)
func setup() (monban.Whitelist, *os.File) {
f, err := ioutil.TempFile("", "monban_boltdb_tmpfile_")
if err != nil {
log.Fatal("could not create boltdb temp fi... |
768ae3840f927641a05c66c82a91086bd3a33548 | 093699ee2e9ecd9f4e23835b69852feca98f756a | Huawei/eSDK_K8S_Plugin | /cli/resources/validate.go | Go | go | 3,225 | permissive | /*
* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. 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.... |
8633776723c2e9b56d4189cb9ece36ee62086a0d | 7a43d92ba84072995c9628be59e8d7ef153a8334 | hongchaodeng/crd-code-generation | /vendor/k8s.io/code-generator/_examples/apiserver/apis/example/zz_generated.deepcopy.go | Go | go | 3,974 | permissive | // +build !ignore_autogenerated
/*
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 applica... |
e467f5ede15cd3c32d79ccb7072c88582a7d83ad | 955fda81d00288c37246c33b2f06d13a3b07b603 | jorson-chen/gofor | /src/share/proxy/interface.go | Go | go | 417 | no_license | package proxy
type ProxyType int
const (
ProxyTypeTCP = iota + 1
ProxyTypeHTTP
)
// Proxy ...
type Proxy interface {
Run() (string, error)
}
// NewProxy ...
func NewProxy(proxyType ProxyType, target string) Proxy {
switch proxyType {
case ProxyTypeTCP:
return &TCPProxy{target: target}
case ProxyTypeHTTP:
... |
8bb24719aa5dd3d9b8681de79c57a2c49f64c445 | f8c92ce9a0acafac19c58f6ffcdeb85dba3e09b5 | lmq1117/golx | /ch2/4/a.go | Go | go | 288 | no_license | package main
import "fmt"
func main() {
var x int
x = 1 //命名变量的赋值
fmt.Println(x)
var p = &x
fmt.Println(p)
*p = 2 //通过指针间接赋值
fmt.Println(x)
//结构体字段赋值 todo
//数组 slice map元素赋值 todo
// *=
// i++ 语句 不是表达式
}
|
1837b93bd8aa4d0c00447a21727efc375438395f | 4bb697a17997488a01b9523cf0a33e85de32bfe5 | Xiaohong027/djzh2 | /x/djzh/internal/keeper/keeper.go | Go | go | 4,715 | no_license | package keeper
import (
"fmt"
/* "github.com/tendermint/tendermint/crypto"*/
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/changtong1996/djzh/x/djzh/internal/types"
)
// ... |
c4a9dc44ea7c483a1991eaf00d41fa3ed8f3a582 | c4ed7d7df7deb561c7bcbfa5ac965efd6314eb29 | luhuaipei/kademlia-DHT | /kademlia/routingTable.go | Go | go | 2,204 | no_license | package kademlia
import (
"log"
"net"
"container/list"
"net/rpc"
"strconv"
"sync"
)
const BUCKETSIZE = 20
type RoutingTable struct {
NodeID ID
Buckets [160]*list.List
RoutingLock *sync.Mutex
}
func (table *RoutingTable) NewRoutingTable(node ID, RoutingLock *sync.Mutex) {
table.NodeID = node
table.... |
660a5c46d134cbd546c0b1d1bf075aa7efa1f819 | 6cf05b8d25c5633c759beb3df06deebcb60062e2 | wp-jackliu/opentaobao | /model/charity/ThreehoursResult.go | Go | go | 383 | permissive | package charity
// ThreehoursResult 结构体
type ThreehoursResult struct {
// 消息
Msg string `json:"msg,omitempty" xml:"msg,omitempty"`
// 错误码
Code int64 `json:"code,omitempty" xml:"code,omitempty"`
// 结果
Data *UserActionSyncResult `json:"data,omitempty" xml:"data,omitempty"`
// 是否成功
Success bool `json:"success,omi... |
9890b77d2dcb0c6d3a667d68db0f43d16729f791 | 0409eae66d0fc5bbc94a90e6c6e15ada328b1758 | shufai/nri-flex | /internal/load/load.go | Go | go | 25,585 | permissive | /*
* Copyright 2019 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package load
import (
"sync"
"time"
sdkArgs "github.com/newrelic/infra-integrations-sdk/args"
"github.com/newrelic/infra-integrations-sdk/integration"
logrus "github.com/sirupsen/logrus"
)
// ArgumentList ... |
2375ca2e66ee829827ada97608e98eae5064a3d5 | 572b676aa3450f6ef9e667d9f58c5f193c4f1219 | mmyj/tidb | /plugin/plugin.go | Go | go | 12,887 | permissive | // Copyright 2019 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... |
3b7283be923a8fc27fa91ffd2d0ad45b1983d745 | 1f26e19d1a57a752d4a3e0820dd6b8e1326bf40a | chef/automate | /components/compliance-service/inspec/cli_test.go | Go | go | 2,614 | permissive | package inspec
import (
"io/ioutil"
"testing"
"time"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
yaml "gopkg.in/yaml.v2"
)
func TestInspecErrReturnsCorrectErr(t *testing.T) {
target := &TargetConfig{
TargetBaseConfig: TargetBaseConfig{Hostname: "test"}... |
477708fb1baeefd47b4e00366d63ceb9e9bb6cf4 | 655729ab57c94646c529efaa699a54deffbf9875 | wfxiang08/skia-buildbot | /go/issues/issues.go | Go | go | 2,344 | permissive | package issues
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/skia-dev/glog"
"go.skia.org/infra/go/util"
)
const (
API_QUERY_TEMPLATE = "%s.&fields=items/id,items/state&key=%s"
API_URL_TEMPLATE = "https://www.googleapis.com/projecthosting/v2/projects/skia/issues?q=%s"
)
// IssueTracker is... |
26bd22f2b137aa6d3a405ba82e251297538dca4b | 492806433895b1eaea5aabd154f9ace50f595328 | netsec-ethz/scion | /go/co/reservation/sqlite/db_test.go | Go | go | 11,760 | permissive | // Copyright 2020 ETH Zurich, Anapaya Systems
//
// 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... |
6c6d89c4f820fc319d67247dfb0ffc9b81bceed8 | 5aefaee5befa13de594f01befd632c37abdf8098 | blp1526/terraform-provider-sakuracloud | /sakuracloud/resource_sakuracloud_gslb_server_test.go | Go | go | 3,133 | permissive | package sakuracloud
import (
"errors"
"testing"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/sacloud/libsacloud/sacloud"
)
func TestAccResourceSakuraCloudGSLBServer(t *testing.T) {
var gslb sacloud.GSLB
resource.Test(t, resource.TestCase{
PreCheck: ... |
279f426eb91372db6c101c66afe0fb9e8f015fee | 61ac3d8b897f9cd027cf9dd9a09a257a287961cb | norand94/golearn | /naive/bernoulli_nb.go | Go | go | 10,491 | permissive | package naive
import (
"fmt"
"github.com/norand94/golearn/base"
"math"
)
// A Bernoulli Naive Bayes Classifier. Naive Bayes classifiers assumes
// that features probabilities are independent. In order to classify an
// instance, it is calculated the probability that it was generated by
// each known class, that is... |
a44740b5e319304e06d277190ddccb6d55a02b42 | ac29d8787cb3a073510299059b38f73d0450a773 | masterada/logspout | /logspout.go | Go | go | 1,772 | permissive | package main
import (
"fmt"
"log"
"os"
"strings"
"text/tabwriter"
"github.com/gliderlabs/logspout/router"
)
// Version is the running version of logspout
var Version string
func getopt(name, dfault string) string {
value := os.Getenv(name)
if value == "" {
value = dfault
}
return value
}
func main() {
... |
87f133c2376966fa7df4e34b3fcb4d26be695c4a | 830858767c2f666a1d262490275c02e6df8ab792 | vidmed/status | /pkg/service/dto/dto.go | Go | go | 1,036 | no_license | package dto
// ------------------ requests
type OrderStatusRequest struct {
OrderId int
}
type OrderStatusesRequest struct {
OrderIds []int
}
type StatusHistoryRequest struct {
OrderId int
Limit int
Offset int
Filter string
}
// ------------------ responses
type OrderStatus struct {
OrderInfo *OrderInf... |
7b37e97950506e57cbe55e81225f28fc6456dc3d | 3df6e495981db5c20d61d2417093898f26dd3158 | chronos-tachyon/go-raft | /rpc/rpc_access.go | Go | go | 1,372 | permissive | package rpc
import (
"fmt"
"log"
"strings"
)
type AccessLevel uint8
const (
NoAccess AccessLevel = iota
ReadAccess
WriteAccess
AdminAccess
PeerAccess
)
var accessLevelNames = []string{
"NoAccess",
"ReadAccess",
"WriteAccess",
"AdminAccess",
"PeerAccess",
}
func (access AccessLevel) String() string {
... |
07421e318869724aed50679591c62606a5a87f28 | aba817c8faa4e4f3a2367b3b56a84b3547ba0e8a | Hasan-Ibrahim/snyk-docker-analyzer | /pkg/util/fs_utils.go | Go | go | 4,591 | permissive | /*
Copyright 2017 Google, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... |
bed5a455137797c38ef66fc8d394f1795eef60af | 11528bfae2b088136c18f611bb2d6e7de85364f5 | damiandragowski/rook | /tests/integration/ceph_base_deploy_test.go | Go | go | 6,643 | permissive | /*
Copyright 2016 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 ... |
b2f6a9e236d4dfbe61dc62bea0051ddfe4fdbfed | b55ba5db66baede88ce7b95fb2f67accafca514d | kzmake/nifcloud-sdk-go | /nifcloud/defaults/shared_config.go | Go | go | 786 | permissive | package defaults
import (
"github.com/kzmake/nifcloud-sdk-go/internal/shareddefaults"
)
// SharedCredentialsFilename returns the SDK's default file path
// for the shared credentials file.
//
// Builds the shared config file path based on the OS's platform.
//
// - Linux/Unix: $HOME/.nifcloud/credentials
// - Wi... |
01f847e30e6c99b87aeb565ac831aa651f7c39da | 86d93d61c4eec1f162fd17e9f83b45198df3244e | yokkoi21/go-paiza | /c/free_coffee/main.go | Go | go | 614 | no_license | package main
import "fmt"
import "strings"
import "os"
import "strconv"
import "bufio"
func main(){
var sc = bufio.NewScanner(os.Stdin)
var input string
var split_input []string
var i int
var coffee_price,d_rate int
var coffee_price_count int
sc.Scan()
input = sc.Text()
split_input = strings.Split(input," ... |
b573c9f0ad681f37ace12e3c9e21dab86c0064c2 | 94577fd3a01f498c325fcd0f1bba913f5a4afc5e | bellwood4486/sample-go-gcf | /functions/helloworld/hello_http.go | Go | go | 202 | no_license | package helloworld
import (
"fmt"
"net/http"
)
func HelloHTTP(w http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprint(w, "Hello, World!7")
}
func Verify(r *http.Request) error {
return nil
}
|
d10df07395a2a6d2a89663fe8bd6f53f07d7c2e1 | 4bb409037e343225ba625dd8d3a9351a87d82c57 | lukedemi/goformation | /cloudformation/resources/aws-ses-receiptruleset.go | Go | go | 4,491 | permissive | package resources
import (
"bytes"
"encoding/json"
"fmt"
"github.com/lukedemi/goformation/cloudformation/policies"
)
// AWSSESReceiptRuleSet AWS CloudFormation Resource (AWS::SES::ReceiptRuleSet)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptruleset.html
type AWSSES... |
bbe4e824efa94cf54f0725934bccb7c12f3c2a0d | 6119dae3c70b38e3861ca0fb3caf1f722d1bb919 | wansuiye/istio | /pilot/cmd/pilot-agent/main.go | Go | go | 15,937 | permissive | // Copyright 2017 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 i... |
393f88cd695aca7395bf35c2f313f323eb65d9fd | 4b2a34962fe166f7bc7da256c9ceb949c1cb28f4 | Robbin-Liu/go-binance-sdk | /client/rpc/types.go | Go | go | 4,414 | permissive | package rpc
import (
"github.com/Robbin-Liu/go-binance-sdk/types/tx"
"github.com/tendermint/tendermint/abci/types"
//cmn "github.com/tendermint/tendermint/libs/common"
cmn "github.com/tendermint/tendermint/libs/bytes"
abci "github.com/tendermint/tendermint/types"
tmkv "github.com/tendermint/tendermint/libs/kv"
... |
5a3cc80ce1a9941037b83b9bc0dfe21bdf7f22cb | 917a6835409e43199f2cec3966ce982d7858dddf | dankenigsberg/hyperconverged-cluster-operator | /tests/func-tests/main_test.go | Go | go | 1,599 | permissive | package tests_test
import (
"context"
"testing"
ginkgo_reporters "kubevirt.io/qe-tools/pkg/ginkgo-reporters"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
tests "github.com/kubevirt/hyperconve... |
fa10073bd517b591b9a0d48ffe0c2a7b47b529a1 | 2bcc813b0169419a71128acc4f317e60f77018c3 | huaweicloud/huaweicloud-sdk-go-v3 | /services/nlp/v2/model/model_run_domain_sentiment_request.go | Go | go | 467 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// RunDomainSentimentRequest Request Object
type RunDomainSentimentRequest struct {
Body *DomainSentimentReq `json:"body,omitempty"`
}
func (o RunDomainSentimentRequest) String() string {
data, err := utils.Marshal(o)
... |
8c13c1e3bddc6cc4c851ccbdc8916e7a6f0039a1 | 90636651aa87f4e7fc62d3ac33994808dc511466 | beemesh/go-orbit-db | /stores/replicator/events.go | Go | go | 1,098 | permissive | package replicator
import (
ipfslog "berty.tech/go-ipfs-log"
"github.com/ipfs/go-cid"
)
// EventLoadAdded An event triggered when entries have been added
type EventLoadAdded struct {
Hash cid.Cid
}
// NewEventLoadAdded Creates a new EventLoadAdded event
func NewEventLoadAdded(h cid.Cid) *EventLoadAdded {
return ... |
a1df8cc4e8ab4f626827193ccf0eac83112592ca | 864c34e30bcc313343a330f8645466539690abf5 | quorauk/dmux | /messagecontext.go | Go | go | 810 | no_license | package dmux
import (
"github.com/bwmarrin/discordgo"
)
type DiscordMessageContext struct {
messageCreate *discordgo.MessageCreate
}
func (d DiscordMessageContext) Guild() Guild {
return DiscordGuild{id: d.messageCreate.GuildID}
}
func (d DiscordMessageContext) Channel() Channel {
return DiscordChannel{id: d.me... |
edf750b282a3e6ff2886ac712d19b484c8d4d4ce | e68f3135bdf0976d7a83bb05d76005ce7c628f67 | Zeitlin1/openbazaar-go | /vendor/gx/ipfs/QmWzfrG1PUeF8mDpYfNsRL3wh5Rkgnp68LAWUB2bhuDWRL/go-libp2p-transport/tcp.go | Go | go | 5,064 | permissive | package transport
import (
"fmt"
"net"
"sync"
"time"
lgbl "gx/ipfs/QmNaS34WZRjs4U1kDfRR2aooYSsBSusFPMEg3dAKk7VZid/go-libp2p-loggables"
manet "gx/ipfs/QmPpRcbNUXauP3zWZ1NJMLWpe4QnmEHrd2ba2D3yqWznw7/go-multiaddr-net"
ma "gx/ipfs/QmYzDkkgAEmrcNzFCiYo6L1dTX4EAG1gZkbtdbd9trL4vd/go-multiaddr"
context "gx/ipfs/QmZy2... |
054b666e6b0cb6fc2551cf3f11addb1863a62c17 | b4d23f84c2d9d2800ac41d1262e0651bc83dfa8b | mehrati/golang-code-snippets | /progressBar/main.go | Go | go | 377 | permissive | package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i <= 100; i++ {
ProgessBar(i)
time.Sleep(time.Second / 10)
}
}
func ProgessBar(percent int) {
hash := "####################"
space := " "
lspace := len(space)
max := percent / 5
for i := 0; i <= max; i++ {
fmt.Printf("\r ... |
f9b7efbd6c67fea062ee29f08a9456eb742e2d2f | b06892de3c01db6273abf494388e2855d6b61d4d | antoinealexisb/subfinder | /libsubfinder/sources/sitedossier/sitedossier.go | Go | go | 1,898 | permissive | //
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License
// Copyrights (C) 2018 Ice3man
//
// Package sitedossier is a Sitedossier Scraping Engine in Golang
package sitedossier
import (
"fmt"
"io/ioutil"
"math/rand"
"regexp"
"time"
"github.com/subfinder/subfinder/libsubfinder/helper"
)
/... |
82d999c9431ef7e47a7a23f68c0a32706ef9787d | d74b1dff9054b154febd011dac041223945c730e | harlesbayu/bookstore-user-api | /utils/mysql_utils/mysql_utils.go | Go | go | 675 | no_license | package mysql_utils
import (
"github.com/harlesbayu/bookstore-utils-go/rest_errors"
"strings"
"github.com/go-sql-driver/mysql"
)
const (
ErrorNoRows = "no rows in result set"
)
func ParseError(err error) rest_errors.RestErr {
sqlErr, ok := err.(*mysql.MySQLError)
if !ok {
if strings.Contains(err.Error(), E... |
b343daba163bad7b7f9c7e947cf961e444a1dee1 | bfc6dd5d46ece1bb75d6d9a7280e1467dddc2da0 | jusk9527/video_server | /src/api/dbops/internal.go | Go | go | 1,934 | no_license | package dbops
import (
"api/defs"
"database/sql"
"log"
"strconv"
"sync"
)
func InsertSession(sid string, ttl int64, uname string) error {
ttlstr := strconv.FormatInt(ttl, 10)
stmtIns, err := dbConn.Prepare("INSERT INTO sessions (session_id, TTL, login_name) VALUE (?, ?, ?)")
if err != nil {
return err
}
... |
d76b8429c8a421d55d1fbd575a249a59209b0a6a | 51da6e31d0f07d3ad0dc055707c1b5f4d61669c2 | jayaraman33/largest-series-product | /largest_series_product.go | Go | go | 708 | no_license | package lsproduct
import (
"fmt"
)
func LargestSeriesProduct(digits string, n int) (int64, error) {
if len(digits) < n {
return -1, fmt.Errorf("span must be smaller than string length")
}
if n < 0 {
return -1, fmt.Errorf("span must be greater than zero")
}
l := len(digits)
end := l - n + 1
var maxprod... |
48a3ae8864b96142dbc2843c9f725e34a187f253 | 66bf09fba4caa988f855faf69117f02a6f17258f | k-ueki/treasure-app | /chukan/backend/repository/iine.go | Go | go | 1,324 | no_license | package repository
import (
"database/sql"
"github.com/jmoiron/sqlx"
"github.com/voyagegroup/treasure-app/model"
)
// func CreateIdeaTag(db *sqlx.Tx, ideaId int64, tagId int64) (sql.Result, error) {
// stmt, err := db.Prepare(`
// INSERT INTO idea_tag (idea_id, tag_id) VALUES (?, ?)
// `)
// if err != nil {
// ... |
2c6a3baacf180d556515eeff5a3bdf900d166555 | a148882d2690c833af397e1348eaeb0f4bbebd53 | downey9762/osmosis | /x/gamm/types/key.go | Go | go | 791 | permissive | package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "gamm"
StoreKey = ModuleName
RouterKey = ModuleName
QuerierRoute = ModuleName
)
var (
// KeyNextGlobalPoolNumber defines key to store the next Pool ID to be used
KeyNextGlobalPoolNumber = []byte{0x01}
// KeyPref... |
6770d39123f55fe3cb8b8dc46ac8179b4ae24af4 | b7d49abe134c0ef8a80480facab169ac37c2dbc9 | AstroProfundis/tiup | /pkg/tidbver/tidbver.go | Go | go | 5,526 | permissive | // Copyright 2022 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... |
84fe387e25bca638e9c340cbc5710bc9e87757ce | 91684eb1407556056cc72345abb668daa5155979 | evandroferreiras/machinery-tutorial | /api/stackoverflow.go | Go | go | 811 | no_license | package api
import (
"encoding/json"
"io/ioutil"
"net/http"
"sort"
)
var stackOverflowURL = "https://api.stackexchange.com/2.2/tags?order=desc&sort=popular&site=stackoverflow"
type tagItems struct {
Count int `json:"count"`
Name string `json:"name"`
}
type tags struct {
Items []tagItems
}
func GetTopSta... |
cfffe85329c6759aa347ca2a208dc8be5a30d4ff | 2b85e2a198f70bc7592130f1d1f9cd14c85bd21f | kinvolk/cilium | /pkg/maps/metricsmap/doc.go | Go | go | 860 | permissive | // Copyright 2018-2019 Authors of Cilium
//
// 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... |
2afc16ab47702c4b36e24325f136c950f47c2960 | 764598fce9e96cfb9b2b04e666393e57a9158d64 | sinanazemi/global-hiring | /model/month.go | Go | go | 1,620 | no_license | package model
import(
"errors"
"github.com/sinanazemi/global-hiring/util"
)
type Month struct{
Value int `json:"value"`
Name string `json:"name"`
}
var months []Month = make([]Month, 0)
var emptyMonth Month = Month{0, ""}
func (m Month) isEmpty() bool {
return m.Value <= 0
}
func (m Month) clone() Month... |
571346fe3e2438be75bad966eb7fcbb8b303626b | 87144da583966b1762f2055e65309ff7ce9fc572 | jianghang8421/telemetry | /cmd/client.go | Go | go | 5,547 | permissive | package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"time"
"github.com/gorilla/mux"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/rancher/norman/clientbase"
collector "github.com/rancher/telemetry/collector"
publish "github.com/rancher/telemetry/publish"
re... |
a07c2cefcfc729c6fa64daab5273f12f0eb008e1 | 5da1bb2c0c3c40c19c83db76664d93cc70b12b70 | zlogic/vogon-go | /data/user.go | Go | go | 3,754 | permissive | package data
import (
"bytes"
"encoding/gob"
"fmt"
"strings"
"github.com/google/uuid"
"golang.org/x/crypto/bcrypt"
)
// User keeps configuration for a user and information used to link a user with their data.
type User struct {
username string
newUsername string
UUID string
Password string
}
... |
1f94a18a9ff0f07167bd2afa473673321d94313d | 1b3ccb00dc39a2d579e4f8231eb5bfc50641eb2c | sudeepgoyal75/terraform-provider-nuagenetworks | /5.2.2/nuagenetworks/data_source_nuagenetworks_redirectiontarget.go | Go | go | 8,695 | no_license | package nuagenetworks
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/5.2.2"
"github.com/nuagenetworks/go-bambou/bambou"
)
func dataSourceRedirectionTarget() *schema.Resource {
return &schema.Resource{
Read: dataSourceRedirectionTargetRead... |
2575e5fdd085ebf1111a4367d60a70d6328f5a85 | eac73b9a66d6f49e53b06f38556f2d236cc199ae | aaron-prindle/go-containerregistry | /cmd/ko/resolve.go | Go | go | 3,350 | permissive | // Copyright 2018 Google LLC 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... |
f06b0379d76bd06426cb534561a738f99f4fb1a9 | af06d61e3c941d58060b98e09f47bbf208dcbaa4 | kubeedge/kubeedge | /edge/pkg/common/message/message.go | Go | go | 961 | permissive | package message
import (
"github.com/kubeedge/beehive/pkg/core/model"
)
// constant defining node connection types
const (
ResourceTypeNodeConnection = "node/connection"
SourceNodeConnection = "edgehub"
OperationNodeConnection = "connect"
OperationSubscribe = "subscribe"
OperationUnsubscribe ... |
54a8e957f0d2d472cfa5f7ed65100f2666441a91 | 2dd54e2db3a36edbe83774114ae8914e4effcf18 | isgasho/gopium | /walkers/wout.go | Go | go | 3,938 | permissive | package walkers
import (
"context"
"path/filepath"
"regexp"
"github.com/1pkg/gopium/collections"
"github.com/1pkg/gopium/fmtio"
"github.com/1pkg/gopium/gopium"
)
// list of wout presets
var (
jsonfile = wout{
fmt: fmtio.Jsonb,
writer: fmtio.File{Name: gopium.NAME, Ext: fmtio.JSON},
}
xmlfile = wout{
... |
5f0a029e3e7e4c89b584dad48dcbd03190de1041 | a70ad6c339c9d8d957c7fee30a544feede3c04a1 | kimai07/grpc-gateway-sample | /gateway/main.go | Go | go | 771 | no_license | package main
import (
"flag"
"net/http"
"github.com/golang/glog"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"golang.org/x/net/context"
"google.golang.org/grpc"
gw "github.com/kenji-imi/grpc-gateway-sample/pb"
)
var (
echoEndpoint = flag.String("hello_endpoint", "localhost:50051", "endpoint of YourServ... |
65cc939a74c5746939c12a839231e3994901b929 | 5e593c58a51a4a0114b9c4e9a0cf8aefbb42660e | chuckwilbur/go-scm | /scm/driver/stash/repo_test.go | Go | go | 10,293 | permissive | // Copyright 2017 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stash
import (
"context"
"encoding/json"
"io/ioutil"
"testing"
"github.com/jenkins-x/go-scm/scm"
"github.com/google/go-cmp/cmp"
"github.com/h2no... |
ddd20ee358a8f75083d8fc809fbe7970db22f4ac | af3c5b3c062c5a86f57b9431c35e1eeb4a18cd64 | altipla-consulting/baster | /vendor/go.opencensus.io/exporter/prometheus/prometheus_test.go | Go | go | 8,874 | permissive | // Copyright 2017, OpenCensus 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.