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 |
|---|---|---|---|---|---|---|---|---|
2b4b59e818e540b4623241f25a1777ad8fa09e3a | f0ce10bbaf4fcbf0f20c4ea268e05be08a468e30 | matthiaswh/bit4 | /test589-go_qstat/dis/dis_test.go | Go | go | 4,154 | no_license | package dis
import (
"bufio"
"strings"
"testing"
)
func TestEncodeInt(t *testing.T) {
testCases := []struct {
input int64
expected string
}{
{0, "+0"},
{1, "+1"},
{9, "+9"},
{10, "2+10"},
{100, "3+100"},
{1234567890, "210+1234567890"},
{-1, "-1"},
{-9, "-9"},
{-10, "2-10"},
{-100, "3-1... |
89f4f508eecd6e714ac98654df3c81678a0cb50c | cf0948d0974f35aa709869f330d919dcf053345a | taras1k/telegrambot | /types.go | Go | go | 15,670 | permissive | package telegrambot
//structs for all https://core.telegram.org/bots/api#available-types
type User struct {
Id int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name,omitempty"`
Username string `json:"username,omitempty"`
}
type Chat struct {
Id int64 `json:"id"`
... |
22dc921a44554d15541b71cf3139a5ae54e42860 | 488f9fdea2091c31495a46c1e06ccc4d13b3bf44 | mbacvanski/qgo | /sim/matrix.go | Go | go | 5,577 | no_license | package sim
import (
"fmt"
"gonum.org/v1/gonum/blas"
"gonum.org/v1/gonum/blas/cblas128"
"math"
)
type Matrix cblas128.General
type ColVec Matrix
type Ket ColVec
type RowVec Matrix
type Bra RowVec
// Coerces a matrix into column vector format
func NewColVec(mat Matrix) ColVec {
return ColVec{
Rows: mat.Rows ... |
86c27f2f6cb4e4a4e9bdef02cfa2388cfd721754 | 72294de4b4f48f31b7ab6cb639a6507aafbfa2b0 | xqk/good | /contrib/config/kubernetes/config_test.go | Go | go | 683 | permissive | package kubernetes
import (
"log"
"path/filepath"
"testing"
"github.com/xqk/good/config"
"k8s.io/client-go/util/homedir"
)
func TestSource(t *testing.T) {
home := homedir.HomeDir()
s := NewSource(
Namespace("mesh"),
LabelSelector(""),
KubeConfig(filepath.Join(home, ".kube", "config")),
)
kvs, err := s... |
348d20a3c43aa3db8018dcabaeb67daa3666a416 | 90492eb41eabd51e2ede79324985a2bbdaa6d827 | alfredxiao/gofrankie | /models/validation_test.go | Go | go | 4,990 | no_license | package models
import (
"testing"
"github.com/alfredxiao/gofrankie/set"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestKeyValuePairObjectNotEmptyAndTypeIsLegal(t *testing.T) {
assert := assert.New(t)
cases := []struct {
Key, Value string
Type EnumKVPType
IsVa... |
8032a7ac81eb64bcd93dd070545d5ac7ae177139 | 78f9b661c137d8c39708288bda30ce9bcc210b68 | newblue/oauth | /oauth.go | Go | go | 17,928 | no_license | // OAuth 1.0 consumer implementation.
// See http://www.oauth.net and RFC 5849
//
// There are typically three parties involved in an OAuth exchange:
// (1) The "Service Provider" (e.g. Google, Twitter, NetFlix) who operates the
// service where the data resides.
// (2) The "End User" who owns that data, and wants ... |
689ba2ce100215ce423e3c403b9ea941df7dde28 | b7b1e83b94ce22f2da2b3235a4083a3f73e89223 | rock59/goydb | /pkg/port/view_server.go | Go | go | 457 | permissive | package port
import (
"context"
"github.com/goydb/goydb/pkg/model"
)
type ViewEngines map[string]ViewServerBuilder
// ViewServerBuilder build a new ViewServer using the passed map function
type ViewServerBuilder func(fn string) (ViewServer, error)
type ViewServer interface {
ExecuteView(ctx context.Context, doc... |
305c9f3099f94204ea4336222ccfc753194ddadf | 5c2ed6d4ada31889db862669c99d556c7cd57d96 | openshift/cluster-api-provider-aws | /vendor/github.com/awslabs/goformation/v4/cloudformation/kms/aws-kms-alias.go | Go | go | 4,111 | permissive | package kms
import (
"bytes"
"encoding/json"
"fmt"
"github.com/awslabs/goformation/v4/cloudformation/policies"
)
// Alias AWS CloudFormation Resource (AWS::KMS::Alias)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html
type Alias struct {
// AliasName AWS CloudFor... |
b8523248b3107d8fbe20c0b901f7d904cd68ea4b | d7d67436323fc9c67d212b109fee88d7e2f5c349 | kidtronnix/sentiment | /word/word_test.go | Go | go | 358 | no_license | package word
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestWordScoreMarshalJSON(t *testing.T) {
assert := assert.New(t)
w1 := WordScore{
Word: "heart",
Score: 0.1,
}
marshalled, err := w1.MarshalJSON()
assert.NoError(err)
expected := `{"heart":0.1}` //
assert.Equal(expect... |
7edc18d5223d032ef25f3841e593ce3299f5274d | 56b5807897c2de25bce0521cd2750ef0a6b4d847 | DukeHuangWP/gSheetAPIv4 | /gSheetAPIv4.go | Go | go | 14,981 | no_license | package gSheetAPIv4
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/sheets/v4"
)
const (
googleErrorTitle = "Google Sheet API 預期錯誤"
)
type GoogleSheet struct {
Srv ... |
b522c03d1c703339801e08660d3627fb7bcf013c | 97af006bbf25e9ec3a364a453a42c438adf15183 | Nv7-GitHub/chromego | /element.go | Go | go | 1,983 | permissive | package chromego
// Clear clears an element
func (e *Element) Clear() error {
_, err := e.el.Clear()
return err
}
// Click clicks an element
func (e *Element) Click() error {
_, err := e.el.Click()
return err
}
// Type sends keys to an element
func (e *Element) Type(text string) error {
_, err := e.el.SendKeys(... |
93826af9b17dedef6adb85fc64b3da12f4db1f62 | fc80a6e5dddfdd7c524969b6af0c04e7e7f76c69 | lwojciechowski/mildchat-server | /server.go | Go | go | 3,654 | permissive | package main
import (
"log"
"net/http"
"reflect"
"golang.org/x/net/websocket"
)
type server struct {
path string
addr string
clients []*client
reg chan *client
clinames map[*client]string
nicks map[string]bool
}
func NewServer(path, addr string) *server {
return &server{
path: path... |
432f41dd5aace7d0124dc759f1349c746e80c9e8 | 316df9683013c6a62641c11f6f881eea621ef4f5 | problaems/rbxmk | /filter/minify.go | Go | go | 1,483 | permissive | package filter
import (
"github.com/anaminus/rbxmk"
"github.com/anaminus/rbxmk/types"
"github.com/yuin/gopher-lua"
"io/ioutil"
)
//go:generate gobake -package=$GOPACKAGE -compress -output minify.lua.go minify.lua
func init() {
Filters.Register(
rbxmk.Filter{Name: "minify", Func: Minify},
rbxmk.Filter{Name: ... |
3a4b7f5d979a150c4c6dfa478f57867d61db820e | 5ac5c7fc398b91baade43ba64dd81312612b9f9e | jakubknejzlik/surveyjs-graphql-api | /gen/loaders.go | Go | go | 2,273 | permissive | package gen
import (
"context"
"github.com/graph-gophers/dataloader"
)
func GetLoaders(db *DB) map[string]*dataloader.Loader {
loaders := map[string]*dataloader.Loader{}
surveysBatchFn := func(ctx context.Context, keys dataloader.Keys) []*dataloader.Result {
var results []*dataloader.Result
ids := make([]s... |
c2ce95f07ca12a7f168a82bfa46fc3511b444ac1 | b3fec9e8564493eaf6779b7b6778b023f06c39f7 | hackdou/vscan | /pkg/naabu/runner/banners.go | Go | go | 1,904 | permissive | package runner
import (
"net"
"strings"
"github.com/projectdiscovery/gologger"
"github.com/veo/vscan/pkg/naabu/scan"
)
const banner = `
__
___ ___ ___ _/ / __ __
/ _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/ v2.0.5
`
// Version is the current version of naabu
const Version = `2.0... |
dc8b3f4f79cb255961e3c5ca926a9868be0f6308 | c646f1bf54924d082fe60ae6d5a64ff0cba9129a | luohl364218/golangPractice | /practice10/mysql/select/TestSelect.go | Go | go | 735 | no_license | package main
import (
"github.com/jmoiron/sqlx"
_ "github.com/go-sql-driver/mysql"
"fmt"
)
var Db *sqlx.DB
type Person struct {
UserId int `db:"user_id"`
UserName string `db:"username"`
Sex string `db:"sex"`
Email string `db:"email"`
}
func init() {
//root是数据库用户名,admin123是密码
database, err := sqlx.Open("mys... |
57f74f0678cdc4b8780e9666052054fa3c18c3f5 | 5f06ca5e1989b6ace8722f7b7ef02951f86524d8 | webitel/flow_manager | /flow/math.go | Go | go | 1,472 | no_license | package flow
import (
"context"
"math/rand"
"net/http"
"github.com/webitel/flow_manager/model"
)
type MathArgs struct {
Data []interface{}
SetVar string `json:"setVar"`
Fn string `json:"fn"`
}
func (r *router) Math(ctx context.Context, scope *Flow, c model.Connection, args interface{}) (model.Response,... |
3f42a4a5db4cfa7cadfd81c75b5789e4aa20f513 | aa79d02554eb8a6afeb6dbca6158cc17f4678ca0 | codechimp-io/keti | /version/version.go | Go | go | 2,340 | no_license | package version
import (
"bytes"
"fmt"
"runtime"
"strings"
"text/template"
"github.com/prometheus/client_golang/prometheus"
)
// Build information. Populated at build-time.
var (
Name string
Version string
Revision string
Branch string
BuildDate string
GoVersion = runtime.Ver... |
86893b50b41ac4c01d3741ec0c946aa2660c3788 | cf6446ab8d54d87f0791e179cd36b3587f172bae | sourcegraph/sourcegraph | /internal/extsvc/gitlab/version.go | Go | go | 639 | permissive | package gitlab
import (
"context"
"net/http"
"time"
"github.com/cockroachdb/errors"
)
// GetVersion retrieves the version of the GitLab instance.
func (c *Client) GetVersion(ctx context.Context) (string, error) {
time.Sleep(c.rateLimitMonitor.RecommendedWaitForBackgroundOp(1))
var v struct {
Version string... |
15ec253e5e2c60fd1c298144072f78b0d68f500b | 098caaacf445005e34c04cb93e86c460e0fbc706 | aiordache/ecs-plugin-1 | /pkg/amazon/backend/up.go | Go | go | 3,326 | permissive | package backend
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/compose-spec/compose-go/cli"
"github.com/compose-spec/compose-go/types"
"github.com/docker/ecs-plugin/pkg/compose"
)
func (b *Backend) Up(ctx context.Context, options *cli.ProjectOptions) error {
project, err := cli.ProjectFromO... |
fd628d6465b6de7f3dccb56808512116cdc6bcea | d881b9cf735c31f29718747009a05baf34365e56 | Gitart/mdserver | /config.go | Go | go | 482 | no_license | package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
// Config - структура для считывания конфигурационного файла
type Config struct {
Listen string `yaml:"listen"`
}
func readConfig(ConfigName string) (x *Config, err error) {
var file []byte
if file, err = ioutil.ReadFile(ConfigName); err != nil {
return... |
18d91778ce231627ab45a4c6ca1b291b245a8e39 | bc9d103303412e97467e6a9175d9989db5aa16f7 | ciband/go-client | /client/one/delegates.go | Go | go | 3,355 | permissive | // This file is part of Ark Go Client.
//
// (c) Ark Ecosystem <info@ark.io>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
package one
import (
"context"
"net/http"
)
// DelegatesService handles communication with the signatures
//... |
680f786f73751fea39d5cc20b88d5789061c29da | c5546de58934276a68b2f2377ab94c6c697adc92 | theNorstroem/spectools | /cmd/genDoc/GenMD.go | Go | go | 646 | permissive | package main
import (
"bytes"
"github.com/spf13/cobra/doc"
"github.com/theNorstroem/spectools/cmd"
"io/ioutil"
"log"
"github.com/spf13/cobra"
)
var docPath = "./_generateddocs"
func main() {
// gen root command
genMD(cmd.RootCmd.Use+".md", cmd.RootCmd)
// generate the other commands
for _, c := range cmd.... |
a1b110ddc0ad36eadf33d7f81cdb192697492f32 | 7cd87ec1c344fe2d0f8c79c93437cdcc55cfa160 | qmutz/go-livepeer | /vendor/github.com/ipfs/go-ipfs/commands/legacy/legacy_test.go | Go | go | 3,232 | permissive | package legacy
import (
"bytes"
"context"
"io"
"testing"
oldcmds "github.com/ipfs/go-ipfs/commands"
cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
cmds "gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
)
type WriteNopCloser struct {
io.Writer
}
func (wc Wr... |
8e6c41cdb2bc3f57bc719c2de0b2e2aeb722cc26 | fe7855c4c792a24c01e8e278803f7397b818e733 | mesosxzan/erda | /modules/core-services/services/org/org.go | Go | go | 28,977 | permissive | // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
deb17adaee61eeaf18ec842103bc414340ca7c71 | 1c4d3d540b453aeed74e3e481cce15d435707b82 | fossabot/sectionctl | /commands/ps.go | Go | go | 2,444 | permissive | package commands
import (
"fmt"
"os"
"strconv"
"time"
"github.com/section/sectionctl/api"
)
// PsCmd checks an application's status on Section's delivery platform
type PsCmd struct {
AccountID int `short:"a" help:"ID of account to query"`
AppID int `short:"i" help:"ID of app to query"`... |
167790d0d2a468067f65aec73e8f092ad0fa11be | 8fd28f319c3d1ee6dee76d8ed1ae0c60f8176a2f | tulir/go-whatsapp | /binary/token/token.go | Go | go | 2,848 | permissive | package token
import "fmt"
var SingleByteTokens = [...]string{"", "", "", "200", "400", "404", "500", "501", "502", "action", "add",
"after", "archive", "author", "available", "battery", "before", "body",
"broadcast", "chat", "clear", "code", "composing", "contacts", "count",
"create", "debug", "delete", "demote",... |
a0379526f1c019faf22a2e0ca9a4826e1ea36862 | 08d86d8d97c042f10c92d06779a239d84f1c14f3 | microsoftgraph/msgraph-beta-sdk-go | /users/item_oauth2_permission_grants_count_request_builder.go | Go | go | 4,742 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors"
)
// ItemOauth2PermissionGran... |
8c30f6a5e1daa906eee47e90cc489740fbc77241 | bb8d1ac559127aef6b72d29133952aad98de3f34 | security-geeks/fibratus | /pkg/handle/snapshotter.go | Go | go | 12,913 | permissive | //go:build windows
// +build windows
/*
* Copyright 2019-2020 by Nedim Sabic Sabic
* https://www.fibratus.io
* 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
*
... |
69e7ecec5677a628943736b593ce8ea857cd170d | 2b1e13fc413e664f1220341f88c359d7682af462 | novriyantoAli/go-insinyur-radius-v1 | /package/delivery/http/package_handler.go | Go | go | 1,714 | no_license | package http
import (
"net/http"
"strconv"
"github.com/dgrijalva/jwt-go"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"github.com/novriyantoAli/go-insinyur-radius-v1/domain"
"github.com/novriyantoAli/go-insinyur-radius-v1/helper"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
//... |
d22fc86c446abb9fb138e5f537cf6d71da20650d | 6e6bfea26b153ff55e7db8f1e66e5a6011a5677f | trig-skillz/sync-server-go | /server/runtime_go.go | Go | go | 118,204 | no_license | // //
//
// 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
// distrib... |
3157f2f2ca2a3a10ab0e91085b076e96d3ed29b3 | 373789d1a315c88cb407f4142892fa04b3478fe1 | Kirchen99/grafana | /pkg/services/supportbundles/supportbundlesimpl/api.go | Go | go | 4,175 | permissive | package supportbundlesimpl
import (
"context"
"encoding/json"
"fmt"
"net/http"
grafanaApi "github.com/grafana/grafana/pkg/api"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/models"
"githu... |
41e5b379b9d1d2da887c04278a9cc7af40fc4312 | 104320298b332572bf9e76d21bccca97e1ed5db6 | renesugar/istio | /pilot/pkg/networking/core/v1alpha3/translate.go | Go | go | 13,627 | permissive | // Copyright 2018 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... |
6fc683f9a6977195597f9d599eb61d2927abc3c1 | 449b3ac879617cfad09055a69885b7a5a57a988b | vucongthanh92/golang-sqlite | /models/batch.go | Go | go | 3,087 | no_license | package models
import (
"strconv"
"time"
libs "github.com/TIG/api-sqlite/helpers"
)
// Batch struct
type Batch struct {
BatchID int `gorm:"column:BatchId;primary_key;AUTO_INCREMENT;not null" json:"BatchId"`
OrderDate *time.Time `gorm:"column:OrderDate;"`
PrinterLabel s... |
e7df11871f5fd5c391a81abb9cbb4be29fd81ef6 | 47552f89c9819a3a2dac84580d702814a20d01e9 | gstackio/cf-rabbitmq-multitenant-broker-release | /src/rabbitmq-service-broker/broker/broker_suite_test.go | Go | go | 1,160 | permissive | package broker_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"rabbitmq-service-broker/broker"
"rabbitmq-service-broker/config"
"github.com/pivotal-cf/brokerapi"
"rabbitmq-service-broker/rabbithutch/fakes"
"code.cloudfoundry.org/lager/lagertest"
)
func TestBroker(t *testing... |
5b350f2e13fb7eb6b41e063886659fe26bc7d9d3 | 3d7329b3026d48b004aa3e95c67c42121bd79d41 | piotrkowalczuk/pqt | /type.go | Go | go | 8,159 | permissive | package pqt
import "fmt"
// Type is a common interface that needs to be implemented so a type can be considered the Type in PQT sense.
type Type interface {
fmt.Stringer
// Fingerprint returns unique identifier of the type. Two different types can have same SQL representation.
Fingerprint() string
}
// BaseType .... |
d738293891a7d8a5f36c66270db283f0917f1215 | 41980de4e11119b0ea4c243c77b447d7bfb63935 | gregnebu/kubernetes-operator | /pkg/controller/jenkins/configuration/base/validate_test.go | Go | go | 26,755 | permissive | package base
import (
"context"
"testing"
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/configuration/base/resources"
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/constants"
"github.com/jenkinsci/kubernet... |
ffd04f3cdfa2121faadb81efc1e687e3852529ad | cf1077e2e76318721527038ffd88170fa3812028 | Saberml/mmctl | /vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go | Go | go | 2,738 | permissive | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"encoding/json"
"io"
"net/http"
"strings"
)
const (
COMPLIANCE_STATUS_CREATED = "created"
COMPLIANCE_STATUS_RUNNING = "running"
COMPLIANCE_STATUS_FINISHED = "finished"
COMP... |
7e4a0c0d333cdfef1949ff2e3d3ba4bc232e7810 | 11dfdf424557ef56edb05c16fbd1ef723e7dd3f7 | uepoch/m3 | /src/dbnode/integration/index_block_rotation_test.go | Go | go | 4,668 | permissive | // +build integration
//
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to... |
302a840f3931c16cfce955f120054e6862a06e6a | 586afa0f037ce1a1de5a7b72fbd2f9c9820517ca | AndrewTestma/The_Go_Programming_Language | /ch7/ex7.5/ex7.5_test.go | Go | go | 328 | no_license | package ex7_5
import (
"bytes"
"strings"
"testing"
)
func TestLimitReader(t *testing.T) {
s := "hello andrew"
b := &bytes.Buffer{}
r := LimitReader(strings.NewReader(s), 5)
n, _ := b.ReadFrom(r)
if n != 5 {
t.Logf("n=%d", n)
t.Fail()
}
if b.String() == "hello" {
t.Logf(`"%s" == "%s"`, b.String(), s[:5... |
940084bfffd35d3ef0cab524a76b15c16b6c3840 | 0725da3a00fd1915123296dc739a47a76e06d8bc | EAHITechnology/weir | /pkg/proxy/backend/connpool.go | Go | go | 6,164 | permissive | package backend
import (
"context"
"fmt"
"strings"
"time"
"github.com/tidb-incubator/weir/pkg/proxy/backend/client"
"github.com/tidb-incubator/weir/pkg/proxy/constant"
"github.com/tidb-incubator/weir/pkg/proxy/driver"
"github.com/tidb-incubator/weir/pkg/proxy/metrics"
"github.com/tidb-incubator/weir/pkg/util... |
920ac46043ca476bc82a7cefd18851e92d5f28a7 | abf68ee1eaaa7bb76e7ca1e237133818eec3bec4 | mrMigles/yandex-dialogs | /masha/masha.go | Go | go | 8,227 | no_license | package masha
import (
"bytes"
"encoding/json"
"fmt"
"github.com/azzzak/alice"
"github.com/gorilla/mux"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
"strings"
"time"
"yandex-dialogs/common"
)
var helloSentences = [...]string{"Привет", "Добрый день", "Здравствуйте"}
var helloAnswers = [...]string{"П... |
565a36b1a32333e8a3bb8404c8a7204af22b204d | 413a21ec75866f4e7742dc77cc069ed9609d1b26 | jiaobendaye/go-distribute | /registry/server.go | Go | go | 4,776 | no_license | package registry
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sync"
"time"
)
const ServerPort = ":3000"
const ServerURL = "http://localhost" + ServerPort + "/services"
type registry struct {
registrations []Registration
mutex *sync.RWMutex
}
func (r *registry) add(item Regi... |
f01e7e3aa409bbab53bdf1e40fd3f2d5ba9eda22 | 19238012060836ba8d0b5866f09f3cd69dd8de30 | sgtest/monorepo-test-3 | /kubernetes-15/pkg/client/listers/core/v1/event.go | Go | go | 3,066 | 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, ... |
bc93df89c785c77d611b026449e09a6cc1159a9a | c761fb4dfc978f4423e1ac97db6e5a4a05dd1d06 | alberliu/gim | /pkg/db/db.go | Go | go | 1,213 | permissive | package db
import (
"fmt"
"gim/config"
"gim/pkg/logger"
"gim/pkg/util"
"github.com/go-redis/redis"
"github.com/jinzhu/gorm"
_ "github.com/go-sql-driver/mysql"
)
var (
DB *gorm.DB
RedisCli *redis.Client
RedisUtil *util.RedisUtil
)
func init() {
InitMysql(config.Config.MySQL)
InitRedis(config.Con... |
6f58f8ef4bf2b03c3851a0b5a16ebcfce18d1265 | b30371b04a1381a32af20871d0bcc2a91b388865 | drunkwater/leetcode | /medium/golang/c0285_583_delete-operation-for-two-strings/00_leetcode_0285.go | Go | go | 718 | no_license | // DRUNKWATER TEMPLATE(add description and prototypes)
// Question Title and Description on leetcode.com
// Function Declaration and Function Prototypes on leetcode.com
//583. Delete Operation for Two Strings
//Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, ... |
8abb3f739e0892e1c1c5e93096379f93ef99825b | 4a63b426a152cb30467aa961cc604cbb7bcbfaec | shieldproject/shield | /client/v2/shield/auth.go | Go | go | 1,867 | permissive | package shield
import (
"fmt"
)
type AuthMethod interface {
Authenticate(*Client) (bool, error)
}
type LocalAuth struct {
Username string `json:"username"`
Password string `json:"password"`
}
func (auth *LocalAuth) Authenticate(c *Client) (bool, error) {
r := &Response{}
err := c.post("/v2/auth/login", auth, ... |
99c3ce4b8a9238a77662a638544b920eb8009419 | f349324500afafa707480f043313db5c243a02b5 | am05mhz/go-guerrilla | /backends/backend.go | Go | go | 8,955 | permissive | package backends
import (
"bytes"
"fmt"
"github.com/am05mhz/go-guerrilla/log"
"github.com/am05mhz/go-guerrilla/mail"
"reflect"
"strconv"
"strings"
"sync"
"sync/atomic"
)
var (
Svc *service
// Store the constructor for making an new processor decorator.
processors map[string]ProcessorConstructor
b Backe... |
c4ac552e253e23747b9fb5e04f3ca60c6e1297d0 | dda12bc780e9faf1f160c9c739f8a12696ec8e53 | code-lucidal58/go_lang_basics | /single_page_scripts/hello.go | Go | go | 1,288 | no_license | package main
import "fmt"
func changeByValue(y string) {
y = "This was passed by value"
}
func changeByRef(y *string) {
*y = "This was passed by reference"
}
// multiple return
func multipleReturnFunction(x string) (string, int) {
return "It was good", len(x)
}
//naked return
func nakedReturnFunction(sum int) (... |
34d1168f15d2a403a9de828249d40858ecafe548 | 477891914c11b2daa375bfd84b5d4ad2a357c56d | kublr/kubernetes | /pkg/apis/certificates/validation/validation_test.go | Go | go | 53,219 | permissive | /*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
a997b1c0239376467abe3c0be24e9c25a5dcd507 | c08e3b797ad0118adf8d8ac922e70835b9dd736b | dystudio/kubemq-community | /pkg/authentication/local/options.go | Go | go | 657 | permissive | package local
import (
"encoding/json"
"fmt"
"github.com/ghodss/yaml"
)
type Options struct {
Method string `json:"method"`
Key string `json:"key"`
}
func NewOptions(config string) *Options {
ops := &Options{}
err := json.Unmarshal([]byte(config), ops)
if err != nil {
_ = yaml.Unmarshal([]byte(config), ... |
93e4964489547842699e40cd53274cd16d095da9 | 23b031763353b0a279adbaf368702d88a6abd685 | davidnuzik/k3s | /pkg/agent/netpol/network_policy_controller.go | Go | go | 23,526 | permissive | // Apache License v2.0 (copyright Cloud Native Labs & Rancher Labs)
// - modified from https://github.com/cloudnativelabs/kube-router/blob/73b1b03b32c5755b240f6c077bb097abe3888314/pkg/controllers/netpol/network_policy_controller.go
// +build !windows
package netpol
import (
"bytes"
"crypto/sha256"
"encoding/base3... |
d56b9bea0519dcf735d102ec863f039d3930ed52 | ede7ab549066a2b53c22f6a136531a8c6a86c5c8 | latermonk/micro-go-course-study | /section11/user/dao/user_dao_test.go | Go | go | 769 | permissive | package dao
import (
"testing"
)
func TestUserDAOImpl_Save(t *testing.T) {
userDAO := &UserDAOImpl{}
err := InitMysql("127.0.0.1", "3306", "root", "123456", "user")
if err != nil{
t.Error(err)
t.FailNow()
}
user := &UserEntity{
Username:"aoho",
Password:"aoho",
Email:"aoho@mail.com",
}
err = userD... |
f2e19e055c7d19947820bcb8724e0f8263045e8e | bf3892192112c5c03901d1263b80ee2cd63c08cc | Huawei/eSDK_K8S_Plugin | /storage/oceanstor/attacher/attacher.go | Go | go | 22,599 | permissive | /*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-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.... |
4665d000232d5ae8f7461af0604162c17bc4d2fb | 87ca51c010b94c6f3e086afc0d7611972c2fe015 | tmc/gqlgen | /codegen/testserver/singlefile/resolver.go | Go | go | 14,615 | permissive | package singlefile
// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES.
import (
"context"
introspection1 "github.com/99designs/gqlgen/codegen/testserver/singlefile/introspection"
invalid_packagename "github.com/99designs/gqlgen/codegen/testserver/singlefile/invalid-packagename"
"gi... |
904c651753ced44fc2a8c679af8c2e0c77b9c680 | 96c816b6f65fa3191da6545b905625bad3d33a4b | TylerTang06/-algorithm015 | /Week_06/647-countSubstrings.go | Go | go | 541 | no_license | package week06
func countSubstrings(s string) int {
if s == "" {
return 0
}
// dp[i,i] = true
// dp[i,j] = dp[i+1,j-1] if s[i] == s[j]
dp := make([][]bool, len(s))
for i := 0; i < len(s); i++ {
dp[i] = make([]bool, len(s))
dp[i][i] = true
}
res := 0
for j := 1; j < len(s); j++ {
for i := 0; i < j; i... |
845fff38a7bea6d848103b7e140e84d294f3cb61 | 5b298f0fef62808429f577c5fb493894c3d54ee6 | LuciusSec/vitess | /go/vt/vtgate/vindexes/region_json.go | Go | go | 3,816 | permissive | /*
Copyright 2020 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
6e3490985280f869d765a86889f53570473b072e | 4a1ea93d55b7a2baf9368fca7354cf52afc9a041 | vence722/gcoll | /lru/lru.go | Go | go | 489 | no_license | // gcoll
// @description gcoll is a collection library of the most frequently used data structures in Go programing language
// @authors Vence Lin(vence722@gmail.com)
package lru
// Data entry
type entry[K comparable, V any] struct {
key K
value V
}
// LRUCache LRU Cache interface
// All implementations shou... |
d6fe31ea4df2b406da07ad985b3af389d75b6a85 | 29ec88b26b93005a7536628519e90646f379b395 | benoitkugler/textlayout | /graphite/table_gloc_glat.go | Go | go | 6,520 | permissive | package graphite
import (
"errors"
"fmt"
"math/bits"
"github.com/benoitkugler/textlayout/fonts/binaryreader"
)
type subboxMetrics struct {
Left uint8 // Left of subbox
Right uint8 // Right of subbox
Bottom uint8 // Bottom of subbox
Top uint8 // Top of subbox
DiagNegMin uint8 // Defines... |
21f90686c26ebd157bf12e6d7b2190ff6a6b4b2a | 2d9306a9b716f88aa9c8d9b64a6d388eed02fd14 | sacloud/terraformer | /vendor/github.com/sacloud/libsacloud/v2/sacloud/state_functions.go | Go | go | 2,924 | permissive | package sacloud
import "github.com/sacloud/libsacloud/v2/sacloud/types"
// WaiterForUp 起動完了まで待つためのStateWaiterを返す
func WaiterForUp(readFunc StateReadFunc) StateWaiter {
return &StatePollWaiter{
ReadFunc: readFunc,
TargetAvailability: []types.EAvailability{
types.Availabilities.Available,
},
PendingAvailabi... |
be06ab3652d7d7d6507cc71b935e45041e36bba5 | 743e7b580f83ddbaf060375ab2fe8ce456a37322 | bluebosh/bosh-agent | /vendor/github.com/nats-io/nats/test/reconnect_test.go | Go | go | 13,533 | permissive | package test
import (
"sync"
"sync/atomic"
"testing"
"time"
"github.com/nats-io/gnatsd/server"
"github.com/nats-io/nats"
)
func startReconnectServer(t *testing.T) *server.Server {
return RunServerOnPort(22222)
}
func TestReconnectTotalTime(t *testing.T) {
opts := nats.DefaultOptions
totalReconnectTime := t... |
d196cc4cc2b7b7ea846e4af07e943be453685b8e | c12e61f1507bce78d5284c7646fbf808a7b8eb8a | martin-belanger/sonic-mgmt-framework | /src/cvl/cvl.go | Go | go | 42,819 | permissive | ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or //
// its subsidiaries. ... |
23b69febd4f59e5e935de8f1dd946bdcce53b7c4 | 35794a490a11d96f81d938d0f64dc0a1e8e4fb6a | saurav-ionos/vendor | /github.com/ionosnetworks/qfx_cp/syncmgr/dbhandler/syncDbHandler.go | Go | go | 6,355 | no_license | package dbhandler
import (
"encoding/json"
"fmt"
"os"
"github.com/ionosnetworks/qfx_cmn/blog"
"github.com/ionosnetworks/qfx_cmn/db/mongodb"
"github.com/ionosnetworks/qfx_cmn/utils"
syncDbObjects "github.com/ionosnetworks/qfx_cp/syncmgr/dbobjects"
syncObjects "github.com/ionosnetworks/qfx_cp/syncmgr/objects"
... |
2c6200878716865b972eadbfab0cb9df4f6a245e | f7ff6feb632e005f8893c29e27edaeff2ebec484 | jecho/interview_questions | /go/reverse_linkedlist.go | Go | go | 680 | no_license | package main
import (
"fmt"
)
type Node struct {
data int
next *Node
}
type List struct {
head *Node
}
func (n *Node) Next() *Node {
return n.next
}
func reverseList(h *Node) *Node {
var newNode *Node = nil
var cur *Node = h
var prev *Node = nil
for ; cur != nil; {
newNode = cur.next
cur.next = ... |
16c7a2fecd6529024670dd1a4d689ef5eb05a236 | d58b0c5d302b8f6c7af352ce13d5424617c651bf | willieschoeman/ms-mongo | /main.go | Go | go | 5,982 | no_license | package main
import (
"context"
"encoding/json"
"log"
"net/http"
"time"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo"
)
/*
-----------------------
-- DB CONFIG SECTION --
------------... |
89c94c34a939f30fec936bc03c14274a49b28f3e | 0e100a4149eafbb20c63c25c54de5b78651d11ae | treymer/osde2e | /vendor/github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1/cluster_metric_type_json.go | Go | go | 3,047 | permissive | /*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
cf1aa14e1c118016c9cda53e52052993a037878f | 6eed45d1c7e7bb25ae401a00e9eb306d76b8d5a7 | chainpoint/tendermint | /types/params_test.go | Go | go | 3,438 | permissive | package types
import (
"bytes"
"sort"
"testing"
"github.com/stretchr/testify/assert"
abci "github.com/chainpoint/tendermint/abci/types"
)
var (
valEd25519 = []string{ABCIPubKeyTypeEd25519}
valSecp256k1 = []string{ABCIPubKeyTypeSecp256k1}
)
func TestConsensusParamsValidation(t *testing.T) {
testCases := []... |
0eacf222148681c60979ad44ee92550802722c82 | 1d4634d77d7cc5c51cb00b92aa8e910e5dd23d0a | Djarvur/gocc | /internal/lexer/items/item.go | Go | go | 9,820 | permissive | //Copyright 2013 Vastech SA (PTY) 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 la... |
e58222b801b0055ad2a7ad4efd30609761686170 | 8ed8dc0d671ab03f647a5a661f98d0d443f79b15 | wansuiye/istio | /pkg/features/pilot/pilot.go | Go | go | 3,989 | permissive | // Copyright 2018 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 ... |
4dd37948ab8b70eb46f8425ca1da25cbbb1da474 | 58aba006fbe35900f5dac198813becaa92f2d3be | kubeedge/kubeedge | /vendor/k8s.io/kubernetes/pkg/volume/projected/projected.go | Go | go | 11,672 | 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, ... |
1890c0c01686dfdc7115c53acf42f6b04e8693c9 | fbb6f390849c0aa230e986635d2e3b05a7246914 | yudaprama/iso20022 | /model/CorporateActionPrice62.go | Go | go | 1,611 | permissive | package model
// Specifies prices related to a corporate action option.
type CorporateActionPrice62 struct {
// Indicates whether the price is an indicative price or a market price.
IndicativeOrMarketPrice *IndicativeOrMarketPrice9Choice `xml:"IndctvOrMktPric,omitempty"`
// Initial issue price of a financial inst... |
6379a6088b9f565a8a90774f36a24a610099c844 | 7fcd132b648593f599c991cd1afc83cf32b88b66 | yudaprama/iso20022 | /model/CorporateActionRate76.go | Go | go | 4,965 | permissive | package model
// Specifies rates related to a corporate action option.
type CorporateActionRate76 struct {
// Rate used for additional tax that cannot be categorised.
AdditionalTax *RateAndAmountFormat46Choice `xml:"AddtlTax,omitempty"`
// Cash dividend amount per equity before deductions or allowances have been ... |
a7585ee50972d08c0627abca223babe611951881 | b22f0b525253eaee2e1b1680161a762c98eab2ac | apc-unb/apc-api | /web/components/admin/controller.go | Go | go | 14,063 | permissive | package admin
import (
"context"
"errors"
"math/rand"
"strconv"
"strings"
"github.com/apc-unb/apc-api/web/components/user"
"github.com/apc-unb/apc-api/web/utils"
"github.com/togatoga/goforces"
"github.com/mongodb/mongo-go-driver/bson/primitive"
"github.com/mongodb/mongo-go-driver/mongo"
"github.com/mongod... |
d2d953a67c153c293adbaa211b01f57858f0bddb | 7ef48435064c481bdb3aa0ae271c80f40c1f3096 | ksubrmnn/csi-proxy | /internal/os/disk/api.go | Go | go | 11,209 | permissive | // +build windows
package disk
import (
"encoding/json"
"fmt"
"os/exec"
"regexp"
"strconv"
"strings"
"syscall"
"unsafe"
shared "github.com/kubernetes-csi/csi-proxy/internal/shared/disk"
"k8s.io/klog"
)
var (
kernel32DLL = syscall.NewLazyDLL("kernel32.dll")
)
const (
IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x... |
0192075cdb05a6073cfb31266186e20d04d137ba | 7d2883fcaf48fda50565985334785b0395db76eb | go-dockly/utility | /xhelper/helper.go | Go | go | 387 | no_license | package xhelper
import (
"github.com/go-dockly/utility/xlogger"
"github.com/stretchr/testify/suite"
)
// Helper for testify suite
type Helper struct {
suite *suite.Suite
logger *xlogger.Logger
}
// NewHelper constructs a helper class to ease the most mundane test tasks
func NewHelper(s *suite.Suite, logger *xlo... |
fd64f9832663a4e08ef7cadfbb488dad98d8f8aa | 9799528aa500201f36ad0e0779d80f1908c687f1 | go-pg/pg | /types/hstore_parser_test.go | Go | go | 1,006 | permissive | package types
import (
"testing"
"github.com/go-pg/pg/v10/internal/pool"
)
var hstoreTests = []struct {
s string
m map[string]string
}{
{`""=>""`, map[string]string{"": ""}},
{`"k''k"=>"k''k"`, map[string]string{"k''k": "k''k"}},
{`"k\"k"=>"k\"k"`, map[string]string{`k"k`: `k"k`}},
{`"k\k"=>"k\k"`, map[strin... |
e3eb743b4c0409507b05051ecbb4b3a685c311b1 | 1e927018cebf86281832fb0d2b197a484384d759 | hahawangxv/kevin | /tools/jupiter/common/util.go | Go | go | 805 | permissive | package common
import (
"fmt"
"github.com/hahawangxv/kevin/pkg/util/xregexp"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
// GetModPath ...
func GetModPath(projectPath string) (modPath string) {
dir := filepath.Dir(projectPath)
for {
for {
if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {
... |
746a580e1030a441571436399c3639c16939ca28 | d63b73c1d6bb060d864005a6eb13e85a43f74bca | jpadrianoGo/anino_backend | /server/router.go | Go | go | 928 | permissive | package server
import (
"github.com/gin-gonic/gin"
"github.com/jaadriano/anino_backend/controller"
"github.com/jaadriano/anino_backend/db"
)
func NewRouter() *gin.Engine {
router := gin.New()
router.Use(gin.Recovery()) //, middleware.Logger(), gindump.Dump())
db.Init()
client := db.GetDB()
if client == nil ... |
40f4703787a54d3bb42e9c3e954c00433c6d485b | 5fb02e0070f1c207b8fd01dfabd66c96e3d41b3c | snowflakedb/libsnowflakeclient | /deps/arrow-0.17.1/go/arrow/datatype_fixedwidth_test.go | Go | go | 2,041 | permissive | // 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 License, Version 2.0 (the
// "License"); you may... |
91b38307e4425ea5d281a175f7b62cd6192fe103 | 043505e0b1fe022632f1059aa3848a9c632595b6 | Swatisoni/cli | /src/cf/models/quota.go | Go | go | 510 | permissive | package models
func NewQuotaFields(name string, memory uint64) (q QuotaFields) {
q.Name = name
q.MemoryLimit = memory
return
}
type QuotaFields struct {
Guid string `json:"guid,omitempty"`
NonBasicServicesAllowed bool `json:"non_basic_services_allowed"`
Name string `json:... |
7e9b202701716f1219a841362dfa46f9ec5a022e | de73689eb8390f9954ff72fa6540f88ccbf889d6 | cshong0618/simple-bank-event-sourcing | /eventstore/eventstore.go | Go | go | 2,863 | no_license | package eventstore
import (
"context"
"github.com/EventStore/EventStore-Client-Go/client"
"github.com/EventStore/EventStore-Client-Go/direction"
"github.com/EventStore/EventStore-Client-Go/messages"
"github.com/EventStore/EventStore-Client-Go/streamrevision"
"github.com/gofrs/uuid"
"log"
"math"
)
var esc *cli... |
9d60ef3b19db0d72b6e9c469c42be1428df413f8 | ae4c6396826cdcef73b74fec433cdfaf87965d48 | sacloud/usacloud | /pkg/core/resource.go | Go | go | 4,794 | permissive | // Copyright 2017-2023 The sacloud/usacloud 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 applicab... |
a496f626f06090b4f59519f57aedc6865af3d8c3 | ef96aeef1936d8fa85a58a35642cb1048bab74fc | AndreaG93/SDCC-Project | /aftmapreduce/storage/http.go | Go | go | 552 | permissive | package storage
import (
"bytes"
"io/ioutil"
"net/http"
)
func Upload(url string, data []byte) error {
var err error
if request, err := http.NewRequest("PUT", url, bytes.NewReader(data)); err == nil {
_, err = http.DefaultClient.Do(request)
}
return err
}
func Download(url string) ([]byte, error) {
var... |
610cd7f153177865928cd894f615bd2c9129c3bc | 303f943d10a1e672f8d86222bdbffb1857d4010c | alexshtin/temporal | /service/history/workflow/fx.go | Go | go | 1,576 | permissive | // The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Soft... |
9db9133bf8583502f58817c8cd2c63b695c7fbfb | 4254539adec63363b675a2b73075028e4ce9c9c4 | Squarespace/ghostunnel | /auth_test.go | Go | go | 3,220 | permissive | /*-
* Copyright 2015 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
*
* Unless required by applicable law or agreed to... |
84b9ed1a3ef4e23885934cc1ad3f38eaee87b217 | 69472d1dac52035e7350a1aa4cc78499defdf65f | stefanos1316/Rosetta-Code-Research | /Scripts/Task/pig-the-dice-game/go/pig-the-dice-game.go | Go | go | 1,143 | no_license | package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano()) //Set seed to current time
playerScores := [...]int{0, 0}
turn := 0
currentScore := 0
for {
player := turn % len(playerScores)
fmt.Printf("Player %v [%v, %v], (H)old, (R)oll or (Q)uit: ", player,
... |
4b7f46f52f945f92173213acacd7f43a09a97cce | 87ddd3c57e21746e2b612571a4de99adcb3ba0ca | bediger4000/vigenere-ciphering-deciphering | /src/poly/poly.go | Go | go | 3,100 | no_license | package main
/*
* Poly-transposition enciphering program.
*/
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
)
func main() {
shiftPtr1 := flag.String("h", "", "Use N/M/... for horizontal extraction, N, M... < 256")
shiftPtr2 := flag.String("v", "", "Use N/M/... for vertical extraction,... |
21a5f657f8cbca1d9bd84d1218a5c1da1c1fac1d | b7431ec99f92f0652d65e30f262d977350954b74 | spectrocloud/cluster-api-provider-vsphere | /apis/v1alpha3/vspherefailuredomain_types.go | Go | go | 3,541 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
4a295cf7c3c462a9ed9d78ebc827bd3824d99957 | 5995233fe9723a461030f85ed9a4cfe1211d5457 | joohoi/matterbridge | /vendor/github.com/lrstanley/girc/cap.go | Go | go | 6,246 | permissive | // Copyright (c) Liam Stanley <me@liamstanley.io>. All rights reserved. Use
// of this source code is governed by the MIT license that can be found in
// the LICENSE file.
package girc
import (
"strings"
)
// Something not in the list? Depending on the type of capability, you can
// enable it using Config.Supported... |
ccba21a715423dd01f28d6c15aa7fa9dace2b08a | 12032e58d870325d4efcf3452ed3233c4b431d2d | mongodb/go-net-utils | /track/util_test.go | Go | go | 3,646 | permissive | // Copyright 2017 Eric Daniels
//
// 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 ... |
947a8c212079e31e2c7ff2f76ee3f715382f9b65 | 18bcbce7789bdfa80c676a63f38c4d962e7cf686 | carlso70/Pizza | /backend/repo/repo_test.go | Go | go | 1,610 | no_license | package repo
import (
"testing"
"github.com/carlso70/pizza/backend/class"
"github.com/carlso70/pizza/backend/user"
)
func TestAddUserToDB(t *testing.T) {
usr := user.NewUser()
usr.Id = -1
usr.Username = "JimmyTest"
// Create dummy user
if err := AddUserToDB(*usr); err != nil {
t.Error("Error CreatingUser:... |
8cf0fece0c0ccf91c7c38ec4a93e4d850717cb56 | 6871bc00d1686044ef4991db91c78b58bbf18c11 | stephenhu/mboard-go | /game_test.go | Go | go | 3,410 | permissive | package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
"testing"
"time"
"github.com/gorilla/websocket"
)
var invalidURL = []string{
"127.0.0.1:8000/games",
"ws://127.0.0.1:8000/games",
"ws://127.0.0.1:8000/games/",
"ws://127.0.0.1:8000/api/games/",
"ws://127... |
8caea766617070e90367b88803eae2a4314f4a80 | 2917dfce10c826f1e728fadd0196ad728a0de789 | linanh/go-mysql-server | /sql/analyzer/resolve_orderby_test.go | Go | go | 10,752 | permissive | // Copyright 2020-2021 Dolthub, 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... |
fbd14f15bbed14345a4243387a3f88b900294aa9 | 93b01291f5d26bee849eef47c249946f0922e897 | qsupremacy/huaweicloud-sdk-go-v3 | /services/mrs/v1/model/model_create_cluster_req.go | Go | go | 21,008 | permissive | package model
import (
"encoding/json"
"errors"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
type CreateClusterReq struct {
// 集群版本。 MRS目前支持MRS 1.8.10、MRS 1.9.2、MRS 2.1.0、MRS 3.0.2版本。
ClusterVersion string `json:"cluster_version"`
// 集群名称,不允许相同。 只能由字母、数字、中划线和下划线组成,并且长度为1~64个字符。
... |
a920f38f7aed8adacfe21463d909cd5b30dd4486 | 943a1437a8a159a3da1592f4b729b304cc104978 | apg-pk/changeagent | /stress/stress_common_test.go | Go | go | 3,536 | permissive | package stress
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"strconv"
"time"
. "github.com/onsi/ginkgo"
)
const (
DebugNodes = false
)
type RaftState struct {
State string `json:"state"`
Leader string `json:"leader"`
}
func launchAgent(port int, dataDir string) (*os.Process, er... |
d24e2605f5a4be8d61d99b2cb6f140c47232ae2c | 3431d6f672d966acca533db95043aa7539126410 | llSourcell/go-ipfs | /Godeps/_workspace/src/github.com/jbenet/go-multihash/sum_test.go | Go | go | 1,465 | permissive | package multihash
import (
"bytes"
"testing"
)
type SumTestCase struct {
code int
length int
input string
hex string
}
var sumTestCases = []SumTestCase{
SumTestCase{SHA1, -1, "foo", "11140beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"},
SumTestCase{SHA1, 10, "foo", "110a0beec7b5ea3f0fdbc95d"},
SumTestCase{S... |
226146942fcef0c50e554d3b2c5a300842706074 | 462ab2dc9ddce7bbe8a072e4511e27df14e9fd25 | go-wyvern/grafana | /pkg/api/pluginproxy/pluginproxy.go | Go | go | 2,680 | permissive | package pluginproxy
import (
"encoding/json"
"net"
"net/http"
"net/http/httputil"
"net/url"
"github.com/go-wyvern/grafana/pkg/bus"
"github.com/go-wyvern/grafana/pkg/log"
"github.com/go-wyvern/grafana/pkg/middleware"
m "github.com/go-wyvern/grafana/pkg/models"
"github.com/go-wyvern/grafana/pkg/plugins"
"git... |
41e451cc4074dcc3cb7dd1c16063f9d7a779684a | e887dfff6b90427ada87f6819400b8f47c8658ac | leobcn/ft | /cmd_serve.go | Go | go | 2,040 | permissive | package main
import (
"io"
"log"
"net"
"os"
"path/filepath"
google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
proto "github.com/mattn/ft/proto"
"github.com/urfave/cli"
"google.golang.org/grpc"
)
type fileTransferService struct {
root string
}
func (fts *fileTransferService) ListFiles(_ *proto.... |
4e68af98193b667256d546e7657f9261c1d1ccea | 9e5bcd8099f3e08e2fbbdc009962c875ec469918 | drand/drand | /core/drand_beacon_control.go | Go | go | 44,311 | permissive | package core
import (
"bytes"
"context"
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"io"
"strings"
"time"
clock "github.com/jonboulle/clockwork"
"github.com/drand/drand/chain"
"github.com/drand/drand/chain/beacon"
commonutils "github.com/drand/drand/common"
"github.com/drand/drand/... |
553a4ff9c15ef74a6ec395597ce6450c89c70898 | 12c90c25f16b9d3efa4d2eaaffcfb17582a616e4 | analaka/bosh-agent | /infrastructure/registry_provider_test.go | Go | go | 1,966 | permissive | package infrastructure_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
fakeinf "github.com/cloudfoundry/bosh-agent/infrastructure/fakes"
fakesys "github.com/cloudfoundry/bosh-agent/system/fakes"
boshlog "github.com/cloudfoundry/bosh-agent/logger"
. "github.com/cloudfoundry/bosh-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.