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 |
|---|---|---|---|---|---|---|---|---|
7d38b9492dfbe85ebfdc899a22afb584bc235e72 | d6cbe3b252df5744c496f7327bf51907df5dbb74 | pstibrany/loki | /vendor/github.com/cortexproject/cortex/pkg/distributor/ha_tracker.go | Go | go | 11,253 | permissive | package distributor
import (
"context"
"errors"
"flag"
"fmt"
"math/rand"
"net/http"
"strings"
"sync"
"time"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/gogo/protobuf/proto"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/prom... |
0c7793d39d3a04049b8ee116dc8d7c9df83bb6ba | efb1286f1452b4d250e2df26f9c268691a45bd03 | Tradent/chainlink | /core/services/offchainreporting/validate_test.go | Go | go | 10,787 | permissive | package offchainreporting
import (
"testing"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/manyminds/api2go/jsonapi"
"github.com/smartcontractkit/chainlink/core/services/job"
"github.com/smartcontractkit/chainlink/core/store/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testi... |
a603700cc1cbf326aa0b7c348028f04cd9410fee | 0048f153db5e4349c81d5ef5bc89142630d5a879 | Kevinrobot34/atcoder | /joi/yo/2015yo/a.go | Go | go | 277 | no_license | package main
import "fmt"
func min(x, y int) int {
if x < y {
return x
}
return y
}
func max(x, y int) int {
if x > y {
return x
}
return y
}
func main() {
var a, b, c, d, p int
fmt.Scan(&a, &b, &c, &d, &p)
ans := min(a*p, b+d*max(0, p-c))
fmt.Println(ans)
}
|
a6154498d51cebfb0de6c7a7a7df1349a2ba88ac | 21863ae65caa66f14f589c460fc6e0044df9fe5b | smartcontractkit/chainlink | /core/chains/evm/config/chain_scoped_ocr2_test.go | Go | go | 344 | permissive | package config_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
)
func Test_ocr2Config(t *testing.T) {
evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values
require.Equal(t, uint32(5300000), evmOcrCfg.EVM().OCR2().Aut... |
79c595e58460b4cd2a3f2ca73c0c4586219fd293 | 8605073f2c163fb792bc648b6917b4cb3677d58a | mvanwaveren/SafeScale | /lib/server/iaas/abstract/enums/hostproperty/enum.go | Go | go | 1,364 | permissive | /*
* Copyright 2018-2020, CS Systemes d'Information, http://csgroup.eu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless r... |
43aa26e41cb5e5c187a838042564c46a7e51b5f9 | 226aa5f73c14aa4d1d682f9406f42d479ac35441 | fangyufangxuan/go-elasticsearch | /esapi/api.xpack.ml.delete_model_snapshot.go | Go | go | 4,101 | permissive | // Code generated from specification version 8.0.0: DO NOT EDIT
package esapi
import (
"context"
"net/http"
"strings"
)
func newMLDeleteModelSnapshotFunc(t Transport) MLDeleteModelSnapshot {
return func(snapshot_id string, job_id string, o ...func(*MLDeleteModelSnapshotRequest)) (*Response, error) {
var r = ML... |
fcc5acd19f74a25efe953c6c8e91af712efa1245 | 4ccdc8ce9e4f422c5743097598f89e15860c54df | delyaG/sharito-backend | /internal/configs/configs.go | Go | go | 831 | no_license | package configs
import (
"backend/internal/infra/http"
"backend/internal/infra/postgres"
"backend/internal/infra/security"
"backend/pkg/logging"
"github.com/jessevdk/go-flags"
"os"
)
type Config struct {
Logger *logging.Config `group:"Logger args" namespace:"logger" env-namespace:"SHARITO_LOGGER"`
HTTP ... |
a6752ec732aba649ccf6fc763046c4aeff6d96f8 | cbfeca8948637cb04cdc2f9c1016fea1bd1ef05b | thomasmitchell/shield | /db/schema_v2.go | Go | go | 700 | permissive | package db
type v2Schema struct{}
func (s v2Schema) Deploy(db *DB) error {
err := db.Exec(`ALTER TABLE archives ADD COLUMN purge_reason TEXT DEFAULT ''`)
if err != nil {
return err
}
err = db.Exec(`ALTER TABLE archives ADD COLUMN status TEXT DEFAULT 'valid'`)
if err != nil {
return err
}
err = db.Exec(`U... |
6154784a582bbac8e2879aa6c19becb4c8cbf854 | 72b6e811af2f2aabe11fa194efc1bda23b0f3fb2 | kumahq/kuma | /test/e2e_env/kubernetes/healthcheck/virtual_probes.go | Go | go | 1,398 | permissive | package healthcheck
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/kumahq/kuma/test/framework"
"github.com/kumahq/kuma/test/framework/deployments/testserver"
"github.com/kumahq/kuma/test/framework/envs/kubernetes"
)
func VirtualProbes() {
const name = "test-server"
const names... |
d84642a19348326c3cfce8ba06bae74c69e48dd7 | 7f934059597666157aa9c90d2a65bcb2d029a946 | matisidler/echo_testing | /authorization/certificates.go | Go | go | 957 | no_license | package authorization
import (
"crypto/rsa"
"io/ioutil"
"sync"
"github.com/golang-jwt/jwt"
)
//Creamos las variables que van a contener la información de mis certificados.
var (
signKey *rsa.PrivateKey
verifyKey *rsa.PublicKey
once sync.Once
)
//
func LoadFiles(privateFile, publicFile string) error {
... |
695945eeb71081307c0451ff344fbe5ca25e11e7 | 4d9e088faaaceb577d9eb2e57babbf29abf1ffb6 | yarokko/go-rest-service | /internal/membership/repository.go | Go | go | 3,188 | no_license | package membership
import (
"context"
"database/sql"
"fmt"
"strings"
"github.com/yassinekhaliqui/go-rest-service/internal/model"
)
type Repository interface {
GetGroupsForUser(ctx context.Context, userId uint64) (*[]model.Group, error)
GetUsersForGroup(ctx context.Context, groupId uint64) (*[]model.User, erro... |
fe54c8f804aa0f0582db053c09a1500f2c88d0c1 | 5499f199ec07c9ff4a829ce30f5791872d2bf88d | openshift/insights-operator | /pkg/gatherers/clusterconfig/gather_net_namespace.go | Go | go | 2,021 | permissive | package clusterconfig
import (
"context"
networkv1 "github.com/openshift/api/network/v1"
networkv1client "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/openshift/insights-operator/pkg/r... |
9369289aaa88373459c7684e4c5e69b199912dcd | 6bec6f2b35329ee5667f3a7945e3148712f0c523 | BurntSushi/toml | /internal/toml-test/runner.go | Go | go | 10,410 | permissive | //go:generate ./gen-multi.py
package tomltest
import (
"bytes"
"embed"
"encoding/json"
"errors"
"fmt"
"io/fs"
"os/exec"
"path/filepath"
"sort"
"strings"
"github.com/BurntSushi/toml"
)
type testType uint8
const (
TypeValid testType = iota
TypeInvalid
)
//go:embed tests/*
var embeddedTests embed.FS
//... |
34445cee15a5850100aea171b780052feea8e096 | 26702beb38fbf4d4354f74bb297ec2663d12a07f | Xillez/CloudTechAssign2 | /mongodb/MongoDB.go | Go | go | 13,592 | no_license | package mongodb
import (
"bytes"
"log"
"net/http"
"strconv"
"time"
"github.com/Xillez/CloudTechAssign2/types"
"github.com/Xillez/CloudTechAssign2/utils"
mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// MongoDB stores the details of the DB connection.
type MongoDB struct {
DatabaseURL string
DatabaseNa... |
a1f43a477e130ec861265fb2c3046ba532e4e3b3 | 493c7549eb2ab8c93ff86b541f5a9e8312b9ecd3 | avityagi90/gotty | /go_19/go/src/image/gif/writer.go | Go | go | 10,101 | permissive | // Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gif
import (
"bufio"
"bytes"
"compress/lzw"
"errors"
"image"
"image/color"
"image/color/palette"
"image/draw"
"io"
)
// Graphic control exten... |
6b5e0d769617ea306dc5bfc11999b370653a1b87 | de3af47faea04f45e444ab7f5924bf9d50421a8b | LouisFettet/Graph_Algorithm_Parallelization | /src/graph/test.go | Go | go | 5,560 | no_license | // test.go
// Generates graphs based on examples that can be found in the sample-problems
// directory and runs the Edmonds-Karp algorithm on them.
package graph
var flow int
var solution *Graph
// Function SolveGraph1 runs the algorithm on the graph
// sample-problems/problem1;solution-5.png
func SolveGraph1(paral... |
1ea5b7fa2202f16880307f4be843026ec429a991 | fa3eb04168e3a5533a36899c8a107231eeaa1355 | lion2luo/motan-go | /metrics/graphite.go | Go | go | 3,176 | permissive | package metrics
import (
"fmt"
"net"
"strconv"
"strings"
"github.com/rcrowley/go-metrics"
"github.com/weibocom/motan-go/log"
)
const (
messageMaxLen = 65000
graphiteWriter = "graphite"
)
var (
Charmap = map[rune]bool{
'.': true,
'/': true}
)
type graphite struct {
Host string
Port int
Name string
... |
fb3d27941a842d66aa99dfdd3e4c1b2768b312f6 | 9ef9a219170cd9a610bba6fc59e8b743cd85ce03 | VKTRS2/finance-messaging | /iso20022/RateDetails11.go | Go | go | 7,826 | permissive | package iso20022
// Provides information about the rates related to securities movement.
type RateDetails11 struct {
// Rate used for additional tax that cannot be categorised.
AdditionalTax *RateAndAmountFormat5Choice `xml:"AddtlTax,omitempty"`
// Rate used to calculate the amount of the charges/fees that cannot... |
87aad9aa19190edb9c5c5b5956967c2b110e7311 | 59d4a0d892bc4034fe2f90ee3513b59e9655df00 | urionz/fresh | /runner/runner.go | Go | go | 534 | permissive | package runner
import (
"io"
"os/exec"
)
func run() bool {
runnerLog("Running...")
cmd := exec.Command(buildPath(), command(), flag())
stderr, err := cmd.StderrPipe()
if err != nil {
fatal(err)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
fatal(err)
}
err = cmd.Start()
if err != nil {
fatal... |
f4d2453d56a6681bfffb7515c6f60b04be805061 | 44de2bf8754a1b18af1e075c532b9fd9a7c5db78 | lihongbin99/hongbin-p2p | /common/log/Logger.go | Go | go | 689 | no_license | package logger
import (
"fmt"
"time"
)
func Info(format string, a ...interface{}) {
format = getTime() + format
if len(a) > 0 {
fmt.Printf(format+"\n", a...)
} else {
fmt.Printf(format + "\n")
}
}
func Debug(format string, a ...interface{}) {
format = getTime() + format
if len(a) > 0 {
fmt.Printf(forma... |
df776d4a4b85ac9d174d59fea7132b92fd51d5ac | eadf0d3d0e555b0067a3aaa5743435a0178f8f29 | whipstein/golinalg | /golapack/dlaic1.go | Go | go | 5,119 | no_license | package golapack
import (
"math"
"github.com/whipstein/golinalg/mat"
)
// Dlaic1 applies one step of incremental condition estimation in
// its simplest version:
//
// Let x, twonorm(x) = 1, be an approximate singular vector of an j-by-j
// lower triangular matrix L, such that
// twonorm(L*x) = sest
// Th... |
b17ef7278feaccada80c4a13a3a1b5eacd5e6323 | f57a9143c1df2321f32b092bc1f181357bac107c | msychalice/ultimate-go | /go/language/embedding_1.go | Go | go | 983 | permissive | // -------------------------------
// Declaring Fields, NOT embedding
// -------------------------------
package main
import "fmt"
// user defines a user in the program.
type user struct {
name string
email string
}
// notify implements a method notifies users
// of different events.
func (u *user) notify() {
f... |
b47d053cfd32d59b2cfb1fed9acd78201daa462a | e5ad8ee61deda641ce328fd2495e2ac025a13fc2 | justhyx/go-ipfs | /merkledag/merkledag_test.go | Go | go | 14,161 | permissive | package merkledag_test
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"math/rand"
"strings"
"sync"
"testing"
"time"
bserv "github.com/ipfs/go-ipfs/blockservice"
bstest "github.com/ipfs/go-ipfs/blockservice/test"
. "github.com/ipfs/go-ipfs/merkledag"
mdpb "github.com/ipfs/go-ipfs/merkledag/p... |
c94a40cbf8b32557973ce0f5728d285a8158e3fd | 19c2af566b04da7808088e82d8ef081b39ea4cfa | kubernetes-sigs/cloud-provider-huaweicloud | /vendor/github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpc/v2/model/model_create_subnet_option.go | Go | go | 3,080 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
//
type CreateSubnetOption struct {
// 功能说明:子网名称 取值范围:1-64个字符,支持数字、字母、中文、_(下划线)、-(中划线)、.(点)
Name string `json:"name"`
// 功能说明:子网描述 取值范围:0-255个字符,不能包含“<”和“>”。
Description *string `json:"description,omitempty"`
// 功能... |
40503a1f7b33326f520cfc728b563bde3774296b | 4a34263a53ea6567bb0285a4d847ebf95f33e5af | qiniu/qshell | /cmd_test/upload_resume_test.go | Go | go | 5,817 | permissive | //go:build integration
package cmd
import (
"github.com/qiniu/qshell/v2/cmd_test/test"
"strings"
"testing"
)
// ------------------- v1 -----------------------
func TestResumeV1Upload(t *testing.T) {
test.RunCmdWithError("delete", test.Bucket, "qshell_rput_5M")
path, err := test.CreateTempFile(1 * 1024)
if err... |
ee4ff23231154d7e862a32c80578222a911fa49b | 49382f8af65537f8123c0505f67cb6826dd8283c | jplobosgle/k8s-cluster-bundle | /pkg/apis/bundle/doc.go | Go | go | 658 | permissive | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
970d78dc18ba34e158b5dd8709975d700de8051c | bd554e8051a3bce7ff514b8a79dc91ff58e0f4fc | weibocom/motan-go | /provider/httpxProvider.go | Go | go | 7,541 | permissive | package provider
import (
"errors"
"fmt"
"net/http"
URL "net/url"
"strings"
"time"
"github.com/valyala/fasthttp"
motan "github.com/weibocom/motan-go/core"
"github.com/weibocom/motan-go/log"
)
// Default options for httpxProvider confs
const (
ExtConfSection = "http-service"
ClientName ... |
09b2ba4c8d2bf95c71892597a14d6b399d45bb70 | 5fe138e79836ebb86686c8092afa762afcc5971e | openshift/assisted-service | /vendor/github.com/openshift-online/ocm-sdk-go/authorizations/v1/export_control_review_server.go | Go | go | 4,283 | 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... |
6c03409ec9047fe9b42c3fd5b14a966371c3159e | ad93b66223f442b1a0c6abdaa6ed3e1594933098 | rancher-sandbox/rancher-desktop | /src/go/rdctl/pkg/utils/utils_linux.go | Go | go | 1,163 | permissive | package utils
import (
"errors"
"fmt"
"os"
"path/filepath"
)
// Returns the absolute path to the Rancher Desktop executable,
// or an error if it was unable to find Rancher Desktop.
func GetRDPath() (string, error) {
rdctlSymlinkPath, err := os.Executable()
if err != nil {
return "", fmt.Errorf("failed to get... |
0b7b94c171714bcd90ff3e47d1b7290c5d2df476 | ee1fca84b15a80777f9de671dcac2c229ade8056 | youht88/bcgo | /block/block.go | Go | go | 9,038 | no_license | package block
import (
//"time"
//"fmt"
"strings"
"strconv"
"math"
"encoding/json"
"bcgo/utils"
"bcgo/transaction"
"gopkg.in/mgo.v2/bson"
)
type BlockHeader struct {
Index int
PrevHash string
Timestamp int64
LockTime int64
Diffcult int
MerkleRoot string
}
func (self *BlockHeader) Hea... |
ca641d381649d60c3aceb55a6035d9fb32c6feba | a4f616bd7f11d5200b12add191e8528ecd378f3f | varunkumar/contour | /internal/contour/metrics_test.go | Go | go | 14,245 | permissive | // Copyright © 2018 Heptio
// 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 writin... |
af62b780d40a4162f20703b87bfece88b7cf75fc | a3c6c4f3eaff03d8d625cf6508c9d01afa3c4f0c | akamai/AkamaiOPEN-edgegrid-golang | /pkg/appsec/selected_hostname.go | Go | go | 9,614 | permissive | package appsec
import (
"context"
"fmt"
"net/http"
validation "github.com/go-ozzo/ozzo-validation/v4"
)
type (
// The SelectedHostname interface supports retrieving and modifying the list of hostnames protected under
// a configuration.
// Deprecated: this interface will be removed in a future release. Use th... |
c368e1aed520b755dce119088d438e41a2c44819 | 2c72f136231db8ce1cd19de61f2a2f9680b506b0 | miraclew/tao | /pkg/ce/errors.go | Go | go | 2,176 | no_license | package ce
import "net/http"
type Error struct {
Code int
Message string
}
func (err *Error) NotFound() bool {
return err.Code == http.StatusNotFound
}
func (err *Error) Unauthorized() bool {
return err.Code == http.StatusUnauthorized
}
func (err *Error) TooManyRequests() bool {
return err.Code == http.Sta... |
ee69cc4349900b16aa403a95342a7d088404db04 | cc057f35f19c0e96926b460e946653f6fd39a6c9 | isgasho/dtype | /dtype_test.go | Go | go | 3,398 | permissive | package dtype
import (
"reflect"
"testing"
)
type Float16 uint16
func TestRegisterType(t *testing.T) {
dt := Dtype{reflect.TypeOf(Float16(0))}
RegisterFloat(dt)
if err := typeclassCheck(dt, floatTypes); err != nil {
t.Errorf("Expected %v to be in floatTypes: %v", dt, err)
}
if err := typeclassCheck(dt, num... |
6ea73f3a319dbc60905b79d646f9ca3963dc1465 | 97f6a1a0a3a0e24ea28200c70bfd983c945cc02b | carsonoid/sloop | /pkg/sloop/store/untyped/badgerwrap/mock.go | Go | go | 5,310 | permissive | /*
* Copyright (c) 2019, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
package badgerwrap
import (
"fmt"
"github.com/dgraph-io/badger"
"sort"
"strings"
"syn... |
58be38ad2e435064f24a99066bb1079859d56055 | 88e37424937d714d1dcd3e5db7f444decb2cf607 | tspannhw/nigoapi | /pkg/nifi/model_processor_status_entity.go | Go | go | 883 | no_license | /*
* NiFi Rest Api
*
* The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... |
4aa9c7259110f9226ac1a4403b6323930c9afb4a | 07ebda735bdbd4d47fb99453284b926d40282f8a | u-nation/openapi-generator | /samples/openapi3/server/petstore/go-api-server/go/api_fake.go | Go | go | 3,417 | permissive | /*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package petstoreserver
import (
"n... |
f14f7c29a78ecc9ecc7d74ae1f5c58e6f6cda6db | 1636a3f4a5b59214c43c74ff0577695eb0946e66 | rianekacahya/go-kafka | /infrastructure/persistence/orders_test.go | Go | go | 3,199 | no_license | package persistence
import (
"context"
"database/sql/driver"
"fmt"
"github.com/rianekacahya/go-kafka/domain/entity"
"github.com/rianekacahya/go-kafka/pkg/helper"
"gopkg.in/DATA-DOG/go-sqlmock.v1"
"testing"
"time"
)
func TestSaveOrderCommit(t *testing.T) {
order := &entity.Orders{
OrderHeaders: &entity.Orde... |
00f32f9172c0e8afb0f6ac64ff3780d8151cc97e | 19f2dba7ec15eec99a41791f713cc9eb0803be6f | lukasschlueter/buffalo-auth | /vendor/github.com/gobuffalo/genny/movinglater/gotools/gomods/gomods.go | Go | go | 662 | permissive | package gomods
import (
"strings"
"github.com/gobuffalo/envy"
"github.com/pkg/errors"
)
const ENV = "GO111MODULE"
var ErrModsOff = errors.New("go mods are turned off")
var modsOn = (strings.TrimSpace(envy.Get(ENV, "off")) == "on")
func On() bool {
return modsOn
}
func Disable(fn func() error) error {
gm := e... |
461e4e2f4aa771556d397d163e13c9dbff45fed9 | aaf392eec3af7bc5219fb775154dfe806e3adc42 | 19neloyk/golang_practice_stuff | /methods_images.go | Go | go | 509 | no_license | package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
//Add the three methods under this to become an image
type Image struct{
dim_x int
dim_y int
}
func (i Image) ColorModel() color.Model {
return color.RGBAModel
}
func (i Image) Bounds() image.Rectangle {
return image.Rect(0, 0, i.dim_x, i.... |
ff01b5dd2ea25f5b3d26507c8aa92b99553bced9 | a45a0a8897e82160ccf7d54b751497652276c550 | berlingoqc/yawf | /config/build_module_test.go | Go | go | 258 | no_license | package config
import "testing"
func TestBuildModule(t *testing.T) {
bm, err := GoBuildModule("github.com/berlingoqc/yawf", "module/blog", "/home/wq/go/src/github.com/berlingoqc/yawf/website/root/module")
if err != nil {
t.Fatal(err)
}
t.Log(*bm)
}
|
cb6651ca4d1b1d729fd2683e64692faf04a3544f | 1d00012cd0046987395b786ea5a18c9656dd1f79 | dayaftereh/discover | /server/game/universe/generator/stargen/chemical/chemical.go | Go | go | 981 | permissive | package chemical
// Weight
// &Chemical{1, "H", "Hydrogen", 1.0079, 14.06, 20.40, 8.99e-05, 0.0, 0.0, 0.0, 0.00125893, 27925.4, 1, 0.0, 0.0}
type Chemical struct {
Num int64 `json:"num"` // Atomic number
Symbol string `json:"symbol"`
Name string `json:"name"`
Weight ... |
850ab9e3cefb1fa7443f321976f97f24293cd3fa | c9913d7fc57144f2bb0f109f6367134c64cd85e3 | mihaimelonari/awscnfm | /cmd/action/update/cluster/minor/error.go | Go | go | 485 | permissive | package minor
import "github.com/giantswarm/microerror"
var invalidConfigError = µerror.Error{
Kind: "invalidConfigError",
}
// IsInvalidConfig asserts invalidConfigError.
func IsInvalidConfig(err error) bool {
return microerror.Cause(err) == invalidConfigError
}
var invalidFlagsError = µerror.Error{
K... |
a1b7be96873bb0f0a9c3eb5e8328939b7ab2e98c | ae0672ea0e9cff72f3324a180e13f9b0005e0dc0 | zzzzzzzzzzz0/zsp-go | /src/util4/os.go | Go | go | 3,534 | no_license | package util4
import (
. "github.com/zzzzzzzzzzz0/zhscript-go/zhscript"
"os"
"os/exec"
"io"
"path/filepath"
"strconv"
"fmt"
"bytes"
)
func Errln__(v interface{}) {
//fmt.Println(v)
fmt.Fprintf(os.Stderr, "%v\n", v)
}
func Errgotoln__(g *Goto___) {
Errln__(New_errinfo__("无法到达目标", g.S, g.Kw))
}
func Exit__... |
701a0957cd8ef366e2c550cc213a804f13d3bc68 | 6b34bee16b0563fe5ae0f8c256c1f15fdc6b41ed | gohxs/httpu | /muxhelper.go | Go | go | 4,305 | no_license | package httpu
import (
"context"
"log"
"net/http"
"strings"
"github.com/gohxs/httpu/chain"
)
// Muxer http.ServeMux compatible muxer interface
type Muxer interface {
Handle(pattern string, handler http.Handler)
HandleFunc(pattern string, handlerFunc func(w http.ResponseWriter, r *http.Request))
}
// MuxPrefi... |
5b7bee9a662357383034b9887559b330c2e58ecb | 2829066a81ad96e29e60a66279495c5499cfa16f | lexdorf/belajar-bersama-kaka | /Gyandra/container.go | Go | go | 450 | no_license | package main
import (
"fmt"
"container/list"
)
func main() {
data := list.New()
data.PushBack("Gya")
data.PushBack("Naufal")
data.PushBack("Pratama")
data.PushFront("Joko")
// dari depan ke belakang
for element := data.Front(); element != nil; element = element.Next() {
fmt.Println(element.Value)
}
//... |
5b29683ec637d6bef3c57530e2da73d93467d94b | 54f7b71f8b093f01291ed26b2e7e6a7cb7af9055 | FauxFaux/coredns | /middleware/file/xfr.go | Go | go | 1,581 | permissive | package file
import (
"fmt"
"log"
"github.com/coredns/coredns/middleware"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
"golang.org/x/net/context"
)
// Xfr serves up an AXFR.
type Xfr struct {
*Zone
}
// ServeDNS implements the middleware.Handler interface.
func (x Xfr) ServeDNS(ctx context.Co... |
a7bd3ef07c7bff092ab2646e6ff7a21fbe1480c0 | f62a5f52921e421e7f4b69b571f1741e2ab2af85 | kev009/tsbs | /cmd/tsbs_generate_queries/databases/influx/devops.go | Go | go | 6,623 | permissive | package influx
import (
"fmt"
"net/url"
"strings"
"time"
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/query"
)
// Devops produces Influx-specific queries for all the devops query types.
type Devops struct {
*devops.Core
}
// NewDevops makes an Devops object rea... |
8c4ee045e443ee687754e5ea2d629917bce4db59 | 0b0885b6d03fdd94be7370c8b1d866774fa6442a | GeorgeLuo/MIDIControllerTools | /main.go | Go | go | 402 | no_license | package main
import (
"github.com/rakyll/portmidi"
"github.com/GeorgeLuo/MIDIControllerTools/environment"
)
func main() {
portmidi.Terminate()
portmidi.Initialize()
environment.InitializeDeviceLayout()
environment.InitializePortToPortMap()
// environment.InitializePortNoteChannelMapping()
environment.Read... |
249db9592a940f2559898652c57e6adee14b95a9 | 401087a5191efceab4305f8178a26105b9627057 | smallnest/dive-to-gosync-workshop | /11.classical_problems/h2o_problem2/main.go | Go | go | 1,874 | no_license | package main
import (
"context"
"log"
"math/rand"
"sort"
"time"
"github.com/marusama/cyclicbarrier"
)
// 有问题的例子
// H2O 水分子工厂.
type H2O struct {
// 等待水分子的产生
b cyclicbarrier.CyclicBarrier
}
// 创建一个水分子工厂.
func New() *H2O {
return &H2O{
b: cyclicbarrier.New(3),
}
}
// 被氢原子goroutine调用,满足条件的时候就会提供一个H原子来产生一个... |
ba872b40d648bc6ac1f2bf70eaa35ab283448062 | 3ffd2bfb7b13e091fcfff2b4ca56a0341d30e5a9 | berrydv/kubernetes | /pkg/client/events.go | Go | go | 7,065 | permissive | /*
Copyright 2014 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 ... |
6dae0a5767b602d77ac80988bddaf41a10a213c7 | c267315afa5abbd047c92cc9dc0af227055b5999 | ian-howell/1build | /testing/fixtures/command_list_fixtures.go | Go | go | 2,578 | permissive | package fixtures
import (
"github.com/gopinath-langote/1build/testing/utils"
"github.com/stretchr/testify/assert"
"testing"
)
func featureListTestData() []Test {
var feature = "list"
return []Test{
shouldShowListOfCommands(feature),
shouldNotShowAnyCommandsIfNoCommandsFound(feature),
shouldShowCommandsWith... |
1f6cc25e1518876f48f8f985c2e35524ca84f9ab | da000aa41fad07ef8624151e4ac10f97bca62707 | test-repo-arcturus/azure-sdk-for-go | /tools/versioner/cmd/tags_test.go | Go | go | 10,733 | permissive | // Copyright 2018 Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
7c82e39b794718fe8cfca58428afac47f3dd3615 | 5a62ac7008cbc1e42bf007c89de254bb1692588d | ittechblog/godemo | /vendor/github.com/tsuna/gohbase/hrpc/disable.go | Go | go | 1,250 | permissive | // Copyright (C) 2015 The GoHBase Authors. All rights reserved.
// This file is part of GoHBase.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package hrpc
import (
"context"
"github.com/golang/protobuf/proto"
"github.com/tsuna/gohbase/pb"
)
// Disab... |
1d148e2d543f6e51f3b83e18e27386efffa3a776 | 2beb773fe1ae45c0daa987bf21265cb695fa6ecb | x1unix/foodcourt | /orders/repository.go | Go | go | 6,237 | no_license | package orders
import (
"fmt"
"foodcourt/dishes"
"foodcourt/menu"
"github.com/Masterminds/squirrel"
"github.com/jmoiron/sqlx"
)
// Order dishes from the menu for specific date
func OrderDishes(dishIds []int, date int, userId int, db *sqlx.DB) error {
// Start transaction
tx := db.MustBegin()
// Delete prev... |
81c75e14f79962553143ebe9688af75eb65bb5e3 | f6f2cb76f35634e0783346e82d5854d20d511d77 | PacktPublishing/Hands-on-Microservices-with-Go-and-MongoDB | /profilemgr/server/router.go | Go | go | 1,286 | no_license | package server
import (
"fmt"
"net/http"
"github.com/gautamrege/sweatbead/profilemgr/api"
"github.com/gautamrege/sweatbead/profilemgr/config"
"github.com/gautamrege/sweatbead/profilemgr/user"
"github.com/gorilla/mux"
)
const (
versionHeader = "Accept"
)
func initRouter(dep dependencies) (router *mux.Router) ... |
a1cc8fa2310ad2a5724feafc9f3cfb0370483314 | 2eee44ef0b05a862f907a6ba99d298385ec57b5f | yanqingjin/go-mutesting | /util/query.go | Go | go | 2,498 | permissive | package util
import (
"go/ast"
"go/token"
"go/types"
)
// IdentifiersInStatement returns all identifiers with their found in a statement.
func IdentifiersInStatement(pkg *types.Package, info *types.Info, stmt ast.Stmt) []ast.Expr {
w := &identifierWalker{
pkg: pkg,
info: info,
}
ast.Walk(w, stmt)
return... |
b722c4c5d8a67ff319b78c66506344209c8d9c79 | bd6a76e6cd6233d0b7f546f70352d90db059c494 | s7techlab/cckit | /examples/cpaper/chaincode_test.go | Go | go | 3,362 | permissive | package cpaper_test
import (
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/s7techlab/cckit/examples/cpaper"
testcc "github.com/s7techlab/cckit/testing"
expectcc "github.com/s7techlab/cckit/testing/expect"
)
const (
IssuerName = "SomeIssuer"
BuyerName = "SomeBuyer"
)
f... |
63ce0f9d0816ec8142bc29ff6870e6265015e0a5 | 5c94bd30702d5d4e344d4427a2e3851865a71c61 | tanglei528/iam | /pkg/file/file.go | Go | go | 2,003 | no_license | package file
import (
"fmt"
"io/ioutil"
"mime/multipart"
"os"
"path"
)
// GetSize get the file size
func GetSize(f multipart.File) (int, error) {
content, err := ioutil.ReadAll(f)
return len(content), err
}
// GetExt get the file ext
func GetExt(fileName string) string {
return path.... |
f432aff2a80ba1128f3d974044be903f269baa08 | 801987c0684449e9f1830609dd3014851f3f705f | smukk9/cadence-intro-workshop | /solutions/example02/workflow.go | Go | go | 298 | permissive | package example02
import (
"go.uber.org/cadence/workflow"
)
type Input struct {
A int
B int
}
type Output struct {
Result int
}
func Workflow(ctx workflow.Context, input Input) (Output, error) {
workflow.GetLogger(ctx).Info("starting example 02")
return Output{input.A + input.B}, nil
}
|
3bd9d835a5a56f838a50bb852369a2c7d0bda3a0 | e71cb0c724404c8ae668d03c4fa2d46cd8aaa79c | zouyee/ci | /test/kubernetes/federation_test.go | Go | go | 1,630 | permissive | package kubernetes
import (
"fmt"
"testing"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)
func TestFederation(t *testing.T) {
var testCases = []test.Case{
{ // A query of a federated service should return a CNAME and A record
Qname: "fedsvc.default.testfed.svc.cluster.local.", Qtype: d... |
ebdcc28fdcc3881bbf3ff545c25f3f31f25c099d | ee30255db1612732a76133b99e9397ffe8adb714 | Keerthana511/todo-app | /Day3/Ninja level 2/handson4.go | Go | go | 289 | no_license | /*assigns int to a variable
prints that int into dec,binary,hex
shifts the bit of int over 1 position to left and assign that to a variable
*/
package main
import (
"fmt"
)
func main() {
a := 40
fmt.Printf("%d\t%b\t%#x\n", a, a, a)
b := a << 1
fmt.Printf("%d\t%b\t%#x", b, b, b)
}
|
a7bb4af652295c4c7b781d247b98b1571d4fed99 | a471c3b82564730edf90defb1be77984f08c89e6 | SwingbyProtocol/go-sdk | /types/msg/wire.go | Go | go | 3,598 | permissive | package msg
import (
"github.com/tendermint/go-amino"
)
var MsgCdc = amino.NewCodec()
func RegisterCodec(cdc *amino.Codec) {
cdc.RegisterInterface((*Msg)(nil), nil)
cdc.RegisterConcrete(SideChainSubmitProposalMsg{}, "cosmos-sdk/MsgSideChainSubmitProposal", nil)
cdc.RegisterConcrete(SideChainDepositMsg{}, "cosm... |
dc54c80251ba7a39f40fbfebe88783efd84d705b | a7048d80e9e70e9ca8a3ca1766c3f0e3052b5f71 | lukebull/go-zero | /core/discov/publisher_test.go | Go | go | 4,526 | permissive | package discov
import (
"errors"
"sync"
"testing"
"time"
"github.com/351423113/go-zero/core/discov/internal"
"github.com/351423113/go-zero/core/lang"
"github.com/351423113/go-zero/core/logx"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
clientv3 "go.etcd.io/etcd/client/v3"
)
func ini... |
da42fff1717fa1ebc4d7c15230ce46d5a3e8b44b | be0bf3157712c77a4dd258ffc6f8f59c7160e745 | bbamsch/esp-v2 | /tests/integration_test/service_control_retry_timeout_test/service_control_retry_timeout_test.go | Go | go | 10,362 | 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
a83bf629caac2e7a5a5dc8218ce2fef207a86945 | 3d22ce7eb6a5565cda2eda8a4cf74a4278cad42e | shaohef/rmd | /db/config/config.go | Go | go | 940 | permissive | package config
import (
"github.com/spf13/viper"
"sync"
)
// Database struct
type Database struct {
Backend string `toml:"backend"`
Transport string `toml:"transport"`
DBName string `toml:"dbname"`
}
var configOnce sync.Once
// FIXME , the DBName should not be "bolt", "rmd" is more better.
var db = &Datab... |
92dbb135a1837fdb5a81e87c6f7d3a2843561e61 | 01e1fe485fd64dcbe023e9c9b0138436bd6f48eb | michael-reichenauer/depgoparser | /functionParser.go | Go | go | 1,034 | permissive | package main
import "go/ast"
// Parses a function declaration
func parseFunction(function *ast.FuncDecl, fileContext *fileContext) {
functionName := addFunctionNode(function, fileContext)
parseParameterTypes(function, functionName, fileContext)
parseResultTypes(function, functionName, fileContext)
}
func addFun... |
992ab32815477d7b823fd34753666d650fc221a0 | a30e194340257773dbceb45657c1f32e5c4ede9d | rjseymour66/go-inpractice | /4_errors-panics/two-errors.go | Go | go | 622 | no_license | package main
import (
"errors"
"fmt"
"math/rand"
)
var ErrTimeout = errors.New("The request timed out")
var ErrRejected = errors.New("The request was rejected")
var random = rand.New(rand.NewSource(35))
func main() {
response, err := SendRequest("Hello")
for err == ErrTimeout {
fmt.Println("Timeout. Retryin... |
8803997cab534bb491c20e18a1e7f53153feb115 | 29662d7f3670fed7a1dd2a7561efc2fa6f6c2eae | Peakchen/go-snake | /src/common/myNats/codec.go | Go | go | 206 | permissive | package myNats
import (
"github.com/Peakchen/xgameCommon/utils"
)
var (
natsCodec utils.ICodec
)
func SetCodec(codec utils.ICodec){
natsCodec = codec
}
func Codec()utils.ICodec{
return natsCodec
} |
2af6ec20e39a261407dc7c5b60a16fab0209005a | 123fe1e27064cce667c9a8aeeecdbbb8f12bff06 | FabioCoelho27/exposure-notifications-server | /internal/generate/handler.go | Go | go | 3,734 | permissive | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
04703366f0b5c41498625fa80fc2e0e76df0eb1a | 24ca00e93216ec93b162c65baa9ced988f5cc739 | strideynet/jambon-coin | /cmd/jambon-coind/main.go | Go | go | 316 | no_license | package main
import (
"os"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/strideynet/jambon-coin/app"
"github.com/strideynet/jambon-coin/cmd/jambon-coind/cmd"
)
func main() {
rootCmd, _ := cmd.NewRootCmd()
if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {
os.Exit(1)
}
}
|
4ccd07f46656f355d45b04fe8f7a58d53769ed7f | 59d67ce7ab30003dc92e00e9b474758b44e7d563 | hicqu/tidb | /x-server/server.go | Go | go | 3,506 | permissive | // Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
e9a33eab2d908ee2352a32e7deabde4f34e0d738 | 2d6f1bb1422e682408e30d42891b7288536a33a7 | gcurtis/stripe-go | /reversal/client.go | Go | go | 3,298 | permissive | //
//
// File generated from our OpenAPI spec
//
//
// Package reversal provides the /transfers/{id}/reversals APIs
package reversal
import (
"fmt"
"net/http"
stripe "github.com/stripe/stripe-go/v72"
"github.com/stripe/stripe-go/v72/form"
)
// Client is used to invoke /transfers/{id}/reversals APIs.
type Client... |
dfe77920cf572122ade63acf3cc323821d92edb2 | 64498a89714f2e38cde4e56285cae979c308c51f | TAIPANBOX/hub | /fixtures/test_configs.go | Go | go | 1,572 | permissive | package fixtures
import (
"io/ioutil"
"os"
)
type TestConfigs struct {
Path string
}
func (c *TestConfigs) TearDown() {
os.Setenv("HUB_CONFIG", "")
os.RemoveAll(c.Path)
}
func SetupTomlTestConfig() *TestConfigs {
file, _ := ioutil.TempFile("", "test-gh-config-")
content := `[[hosts]]
host = "github.com"
... |
221fa5699b64f62730a47a7cf0d6b1cfa335b491 | 5198f5d656664c78a4b15bb5aba5cf94b7f07f28 | shafinsiddique/page | /page/mathExprNode.go | Go | go | 766 | no_license | package main
import "log"
type MathExpressionNode struct {
operator TokenType
children []IExpression
}
func (node MathExpressionNode) Evaluate() interface{} {
index := 1
var output int
if value, ok := node.children[0].Evaluate().(int); ! ok {
log.Fatal(TypeMismatchErrorNumber(value))
} else {
for index < l... |
28de93757142cc762e68686eba77ab92eb2e59ab | 771e33b60100b76804b3ed7a720f315d6ab5753b | yudaprama/iso20022 | /model/PartyIdentification54.go | Go | go | 1,219 | permissive | package model
// Choice of identification of a party. The party can be identified by providing a BIC or a proprietary code.
// Optionally, the client account number can also be provided.
type PartyIdentification54 struct {
// Code allocated to a financial or non-financial institution by the ISO 9362 Registration Aut... |
c3088fef51590bbde904ead323eec84a4449a5f2 | 273a3a3d30cf12e52e8d416c26255b129470e62b | obscure76/learn-go | /interfaces/componsite_interfaces.go | Go | go | 902 | no_license | package main
import (
"fmt"
)
type SalaryCalculatorLocallocal interface {
DisplaySalary()
}
type LeaveCalculatorLocal interface {
CalculateLeavesLeft() int
}
type EmployeeOperations interface {
SalaryCalculatorLocallocal
LeaveCalculatorLocal
}
type EmployeeLocal struct {
firstName string
lastName strin... |
fea340397c78225ca795c6bb6c3aa94fcec7295b | d0a5ec8d0b45225b5947a25c598ea4175c5cadc2 | nya3jp/tast-tests | /src/chromiumos/tast/local/memory/memoryuser/chrome_task.go | Go | go | 1,693 | permissive | // Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package memoryuser
import (
"context"
"fmt"
"chromiumos/tast/errors"
"chromiumos/tast/local/chrome"
)
// ChromeTask implements MemoryTask to ope... |
774b2d19e710feae5046f246b08dd715f153e69a | d9f05b78cc7153b98f87be52faf5182d8c03df30 | wr4javaee/leetcode-solution | /no0239_sliding-window-maximum/solution.go | Go | go | 960 | no_license | package no0239_sliding_window_maximum
import "container/list"
func maxSlidingWindow(nums []int, k int) []int {
// 异常校验
if nums == nil {
return []int{}
}
// 使用双向队列
deque := list.New()
numsLen := len(nums)
// 遍历数组
res := make([]int, 0, numsLen - k + 1)
for i := 0; i < numsLen; i++ {
// 维持双向队列按照从大到小的顺序排列
... |
7234899ab17a946f4ab3f8f1580670e3610fba16 | 68338e4e6277a60b8735c5150930507f31a2a269 | samsalisbury/engulf | /main.go | Go | go | 5,196 | no_license | package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"golang.org/x/tools/cover"
)
type (
blank struct{}
result struct {
j *exec.Cmd
o []byte
e error
}
)
var (
nothing = blank{}
pkgWarnRE = regexp.MustCompile(`(?m)^warning: no packages being tested depend on \S+$\... |
fe66ea9a3080a4454133287e7c4b8389c2f10b01 | 9927e8c7ba8d76a00c57f378595f74a55eb66be4 | k1eran/onos-config | /pkg/controller/controller_test.go | Go | go | 2,991 | permissive | // Copyright 2019-present Open Networking Foundation.
//
// 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... |
8c6b13f95d56542d795bb72f7e9d04a9c067354f | 9e15f0de194e10182686cfabdb43d65507a291c7 | ulrichSchreiner/dockmon | /vendor/github.com/docker/docker/daemon/info.go | Go | go | 3,939 | permissive | package daemon
import (
"os"
"runtime"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/d... |
3a0a8b8482d747b13819b2ec61073ce532186979 | 2416459d9c3342adf80288b264c0298d0c28bcf2 | willshang/go-leetcode | /source/2101-2200/2183_count-array-pairs-divisible-by-k/1-数学-最大公约数.go | Go | go | 637 | no_license | package main
func main() {
}
func countPairs(nums []int, k int) int64 {
res := int64(0)
m := make(map[int]int)
for i := 0; i < len(nums); i++ {
m[gcd(k, nums[i])]++ // k和nums[i]的最大公约数
}
for k1, v1 := range m {
for k2, v2 := range m {
// 核心:a*b是k的倍数 => gcd(a,k)*gcd(b,k)是k的倍数
if k1*k2%k == 0 {
res =... |
ea16e6eb3b46366a20c21206719716cd2cd9522b | 4b91d563d6f4e05e2e95bfcbc6ff05414f723eac | Xuanwo/tidb | /planner/core/preprocess.go | Go | go | 51,056 | permissive | // Copyright 2015 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... |
5cd186d46d78444e57fb831712b034e2fc6c39ba | 3b3cab53b26e4b4ef67ba9f7651dd187a6126cba | CenturyLinkLabs/panamax-kubernetes-adapter-go | /Godeps/_workspace/src/github.com/CenturyLinkLabs/pmxadapter/server_test.go | Go | go | 2,361 | permissive | package pmxadapter
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
var testServer *httptest.Server
func init() {
martini := NewServer(new(NoOPAdapter)).(*martiniServer)
testServer = httptest.NewServer(martini.svr)
}... |
51a2a12b25f4612e95dcf6530ac0f992b2883fe7 | 70c357c2499c16532fa10aa2a22ed8fc3f7db076 | sbinet/go-github-client | /gists/gist.go | Go | go | 4,048 | permissive | // Copyright 2012 Alca Società Cooperativa. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gists
import (
"bytes"
"encoding/json"
"errors"
ghclient "github.com/sbinet/go-github-client/client"
"net/http"
)
var (
ErrInvalidGist... |
0f85583232228dcc0d7e44866e7a2a5123b6fe8a | 9a3a45313579ecb3aa54dc1dbc6ce72edb3dbf4d | SilentCicero/relay | /pkg/repository/mcast.go | Go | go | 1,902 | permissive | package repository
import (
"gitlab.com/jonas.jasas/httprelay/pkg/model"
"sync"
)
type McastSeqMap map[string]*model.McastSeq
type McastRep struct {
McastSeqMap
sync.RWMutex
stopChan <-chan struct{}
}
func NewMcastRep(stopChan <-chan struct{}) *McastRep {
result := &McastRep{
McastSeqMap: McastSeqMap{},
s... |
95298b7c2296cb959a7a529cf2c79e908566c11b | f8c6967dbdbff4353a288f4c67390699c581a591 | Flaque/wikiracer | /wikimedia/routes_test.go | Go | go | 392 | no_license | package wikimedia
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetLinksRoute(t *testing.T) {
req, err := getLinksRoute([]string{"Cat", "Dog", "Sea Lion"}, "")
assert.Nil(t, err)
assert.Equal(t, req.URL.String(), "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=links&pllimi... |
ec75645225413139355acd7bf281204cdd6a2c15 | 675b29cdf96a12598c19f4967f856eb0f9376b0a | LarsSch/starter | /packs/compose-to-service-yml/pack.go | Go | go | 2,537 | permissive | package compose_to_service_yml
import (
"github.com/cloud66/starter/packs"
"github.com/cloud66/starter/common"
"github.com/cloud66/starter/definitions/docker-compose"
"github.com/cloud66/starter/transform"
)
type Pack struct {
packs.PackBase
Analysis *Analysis
}
func (p *Pack) Name() string {
return "docker-c... |
f8d2b6277120fc4dad0ad6a204032b4840e2e8a5 | 81e029e15cca47b70215d9e6d84790ff1bd9d202 | aschiefe/octant | /internal/api/content_manager_test.go | Go | go | 5,020 | permissive | /*
* Copyright (c) 2019 the Octant contributors. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package api_test
import (
"context"
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/vmware-tanzu/octant/internal/api"
"github.com/vmware-tanzu/octant/in... |
45a0481cf96dd2132d1ae2cc07c788d0ce7af129 | aface097baf2dfea7d3e531ecfff55962d2a9aec | nicle-lin/restic | /internal/repository/packer_manager_test.go | Go | go | 3,401 | permissive | package repository
import (
"context"
"io"
"math/rand"
"os"
"testing"
"github.com/restic/restic/internal/backend/mem"
"github.com/restic/restic/internal/crypto"
"github.com/restic/restic/internal/fs"
"github.com/restic/restic/internal/mock"
"github.com/restic/restic/internal/restic"
)
type randReader struc... |
3173df83a1dc05199a6bcc9df83bb8eb6b42e1d9 | 2de05341ea7dd96572badab0d201cb28b0c837a6 | bryanmurray/cluster-api | /cmd/clusterctl/pkg/client/repository/metadata_client.go | Go | go | 6,895 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
650b575dad584cce07ca2657a94425209b1e4341 | c328cc446498ac2553177f3c17eab622b338cfe3 | strongit/rancher-operator | /pkg/controllers/cluster/reference.go | Go | go | 2,301 | permissive | package cluster
import (
"fmt"
v1 "github.com/rancher/rancher-operator/pkg/apis/rancher.cattle.io/v1"
v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
)
const (
claimedLabelNamespace = "rancher.cattle.io/claimed-by-namespace"
c... |
2e0ccebbed372ec69eda3c93f83de6cb827569d1 | f4454a53a6e78882562b8e5a51b2a710b9645896 | jkassis/dragonboat | /nodehost.go | Go | go | 75,881 | permissive | // Copyright 2017-2020 Lei Ni (nilei81@gmail.com) and other Dragonboat 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
//
// ... |
1a550846a90c36e7411ff61758791672aef28954 | 46f3f722a9f9a539099b4efd46a2d809b3bc3d06 | bububa/opentaobao | /api/product/CainiaoCntecItemChangeMessage.go | Go | go | 584 | permissive | package product
import (
"github.com/bububa/opentaobao/core"
"github.com/bububa/opentaobao/model/product"
)
// CainiaoCntecItemChangeMessage 商品变更消息
// cainiao.cntec.item.change.message
//
// 供货商商品信息变更消息
func CainiaoCntecItemChangeMessage(clt *core.SDKClient, req *product.CainiaoCntecItemChangeMessageAPIRequest, ses... |
e6c72472a491df3425e8526eb4bbaa1a02634b95 | dcb87017e13e1b4a0e0bb857a35d147a491f5965 | miku/bleve | /index/upside_down/upside_down_test.go | Go | go | 26,180 | permissive | // Copyright (c) 2014 Couchbase, 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 w... |
1f4d4ad8fe9ace2b3527708e872b358b41d83076 | 0c39bb008505acc7093da0e31e070909dd682fbd | mattermost/mattermost-plugin-jira | /server/user_server.go | Go | go | 4,800 | permissive | // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License for license information.
package main
import (
"crypto/x509"
"encoding/pem"
"net/http"
"path"
"strings"
"github.com/dghubble/oauth1"
"github.com/pkg/errors"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mat... |
af64e389093b6a2248c5091d043c35a3e13cc298 | 78f91dd4a3e45a9eb4d282bfb51e8de14940f44a | bububa/opentaobao | /model/trade/AlibabaWdkTradeRefundCreateAPIRequest.go | Go | go | 1,889 | permissive | package trade
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// AlibabaWdkTradeRefundCreateAPIRequest 外部渠道逆向订单创建 API请求
// alibaba.wdk.trade.refund.create
//
// 该接口是创建退货订单的服务。当外部渠道发起退款后,调用此接口可以完成五道口底层交易、履约、配送等一系列流程进行退货。
type AlibabaWdkTradeRefundCreateAPIRequest struct {
model.Params
// 退货请求
_refundGo... |
a8e44ea82f37771190a4e596ed95ab5fb72f1d24 | fd36e981ad13e5aae484531a0022eef8953a8441 | nabertrand/g10k | /vendor/github.com/henvic/uiprogress/bar.go | Go | go | 5,953 | permissive | package uiprogress
import (
"bytes"
"errors"
"fmt"
"sync"
"time"
"github.com/henvic/uiprogress/util/strutil"
)
var (
// Fill is the default character representing completed progress
Fill byte = '='
// Head is the default character that moves when progress is updated
Head byte = '>'
// Empty is the defau... |
d19a020ee644f262b866bc1a1921721180aacb15 | 3637188a782e0f62ac9ab101aa13ba96f92044cb | CodeBoy2006/SSoP | /tests/default_test.go | Go | go | 947 | permissive | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "day3/routers"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(file... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.