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 |
|---|---|---|---|---|---|---|---|---|
a455b08a2dec20ff7337e8dc4902e2ba9d1e522f | 25b807f6a64eb6faeaa39336bada06a4dc4c042d | readren/functional-go | /typectors/templates/Func1/absent.go | Go | go | 392 | no_license | package fung
type aType struct{}
type xType struct{}
type yType struct{}
type Guard func(error) bool
type Errors_aType map[aType]error
type FuncFrom_yType_to_aType func(y yType) aType
type FuncFrom_xType_to_aType func(x xType) aType
func recover__catch(errPtr *error, guard Guard) {}
func ... |
e6bbfb6c85b625f1e8d6860884a9966d7b97c723 | 6fb708683416feea7d4f6a962f88ba48e424aefc | lvlam/goplayground | /path_validation.go | Go | go | 2,172 | no_license | package main
import (
"io/ioutil"
"net/http"
"html/template"
"regexp"
"errors"
)
var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
type Page struct {
Title string
Body []byte
}
func getTitle(w http.Resp... |
e2c9dbad5dba410e55e5762db3ec2f35b976600d | 688e411ca520602f8ec29c81e7e2b1da8f865beb | justinrcs/skipper | /proxy/proxy_test.go | Go | go | 45,400 | permissive | package proxy
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net"
"net/http"
"net/http/httptest"
"net/url"
"os"
"reflect"
"strconv"
"strings"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/zalando/skipper/eskip"
"github.com/zalando/skipper/filters"
"github.com/zala... |
2e4b7dba005106a3f6b1b38f9996f275b10f680f | fc95b601b8222015412a0cbbac1f5348b41575f1 | uid09552/lxkns | /discovery.go | Go | go | 10,781 | permissive | // Defines the core procedures for discovering Linux kernel namespaces in
// different places of a running Linux system.
// Copyright 2020 Harald Albrecht.
//
// 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 ... |
7b8559bf892e6a3910e27077eca0344da35afbc5 | 60b3378199da8970102cc9e8b5be305e5cf0d798 | stonehost/bhp | /x/token/types/util_test.go | Go | go | 3,975 | permissive | package types
import (
"testing"
"github.com/bhpnet/bhp-dev/x/common"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/secp256k1"
)
func TestAmountToCoins(t *testing.T) {
coinStr := "2btc,1" + common.... |
c125652817d6e8eea6ae1355afa89b5b699dc9f0 | 6dd3bc959af4bfbe3b3f34b6811f2ac1bf678a48 | stsully/oci-go-sdk | /bds/change_bds_instance_compartment_details.go | Go | go | 1,073 | permissive | // Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
725703f4e507e8028650439ea7cef5ecd44c9ecb | 5e042bb14ac11cdfa3d87ffe1e80e9189cb9f62f | sulaimantok/onos-config | /pkg/controller/change/network/controller.go | Go | go | 15,824 | 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... |
63594fa4a10c47a4c2c381ee68f1e09a5f6a99bd | 2799920e3095f947bfe415b299116943b9234861 | backwardn/syzkaller | /pkg/csource/csource.go | Go | go | 17,506 | permissive | // Copyright 2015 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// Package csource generates [almost] equivalent C programs from syzkaller programs.
package csource
import (
"bytes"
"fmt"
"regexp"
"sort"
"strings"... |
0c9199342726b176ce5eac4550a8ced54a0654d3 | 23ff4d39b46135a456ad1ec842bfd3c49164f48c | ri-paul/jfrog-cli-core | /common/commands/config.go | Go | go | 17,481 | permissive | package commands
import (
"errors"
"fmt"
"io/ioutil"
"reflect"
"strconv"
"strings"
"sync"
"syscall"
"github.com/jfrog/jfrog-cli-core/utils/coreutils"
"github.com/jfrog/jfrog-cli-core/utils/ioutils"
"github.com/jfrog/jfrog-client-go/auth"
"github.com/jfrog/jfrog-cli-core/artifactory/utils"
"github.com/j... |
5fd542f5ff0a623c8d0cd867b6d373e871fe5f1e | bc14779bbd931f52353e16473df31a105c014903 | nipuntalukdar/hllserver | /hll/utility.go | Go | go | 2,409 | permissive | package hll
func murmur3_64(data []byte, seed uint64) uint64 {
var m uint64 = 0xc6a4a7935bd1e995
var r uint64 = 47
length := uint64(len(data))
hashval := (seed & 0xffffffff) ^ (length * m)
numeightbytes := length - (length & 7)
for i := uint64(0); i < numeightbytes; i += 8 {
k := uint64(data[i+7])
k = k<<8 +... |
2f53eed4a33626268c14f029b6b1c4389dbe166d | 148d633b42aea83d2644e2dce0464a75568f0e5b | michealchen730/LeetcodeGolang | /main/leetcode/985.go | Go | go | 489 | no_license | package main
func sumEvenAfterQueries(A []int, queries [][]int) []int {
sum := 0
for _, v := range A {
if v%2 == 0 {
sum += v
}
}
var res []int
for _, v := range queries {
val, ind := v[0], v[1]
flag1 := A[ind]%2 == 0
flag2 := val%2 == 0
A[ind] += val
if flag1 && !flag2 { //even odd
sum -= A[i... |
fdeffa6db56ee329849481135d80b2f8d1cc312e | c488c892018fb2e51f1d1943a97eadb48b51d31d | abstractmj/bk-bcs | /bcs-services/bcs-cluster-manager/internal/cloudprovider/component/vcluster/install.go | Go | go | 1,596 | permissive | /*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obta... |
9347b3f268a586b1db664aea650ff0b7b2f5cb6e | 299a5b530651572cde8d3f008f317e241ef55935 | newrelic-forks/migrate | /vendor/github.com/cznic/ql/btree.go | Go | go | 12,187 | permissive | // Copyright 2014 The ql 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 ql
import (
"io"
)
const (
kx = 128 //DONE benchmark tune this number if using custom key/value type(s).
kd = 64 //DONE benchmark tune this number... |
7c637bc2d9c5b9246330d06101a068fdd24f46a0 | eab8112860b75311e96053551fd40f0a73a495a5 | toodm/fastapi | /app_protocol.go | Go | go | 4,194 | permissive | package fastapi
import (
"bufio"
"encoding/binary"
"fmt"
"io"
"net"
"time"
"github.com/funny/link"
)
func (app *App) newClientCodec(rw io.ReadWriter) (link.Codec, error) {
return app.newCodec(rw, app.newResponse), nil
}
func (app *App) newServerCodec(rw io.ReadWriter) (link.Codec, error) {
return app.newCo... |
54fe849747d12c75a6c7e663416a284eac67fbc0 | 4faae2b3cd10dc17bf802120258c6ec2a39f9eaf | chirag1603/airflow-on-k8s-operator | /vendor/sigs.k8s.io/controller-reconciler/pkg/finalizer/doc.go | Go | go | 903 | 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 not... |
13721111a7ea1552432da687658525398c212fb5 | 6dc94ada8f15f1cf704c714d0d7547e243652fa1 | csrwng/boatswain | /pkg/apis/boatswain/v1alpha1/doc.go | Go | go | 891 | no_license | /*
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, ... |
8b3b1fc955bd974fdd3a98aef50da9df0b09f778 | 3331afb6785babdbe9255ad337b4e839e041f803 | jbloxham/go-ipfs | /test/dependencies/iptb/iptb.go | Go | go | 712 | permissive | package main
import (
"fmt"
"os"
cli "gx/ipfs/QmckeQ2zrYLAXoSHYTGn5BDdb22BqbUoHEHm8KZ9YWRxd1/iptb/cli"
testbed "gx/ipfs/QmckeQ2zrYLAXoSHYTGn5BDdb22BqbUoHEHm8KZ9YWRxd1/iptb/testbed"
plugin "gx/ipfs/QmTzWwfHZr9N6Tnk4iDTtKMWY57D3wik73qNCVo21Bu1UP/iptb-plugins/local"
)
func init() {
_, err := testbed.RegisterPlug... |
1ca20644ee44c634d1bcfde58e0a548cd5428b03 | b507ea41e0703f5944eacfd157c73df062367782 | eggsbenjamin/k8s_controller_experiment | /controllers/actions.go | Go | go | 509 | no_license | package controllers
import "k8s.io/apimachinery/pkg/runtime"
// Action defines an interface for performing an arbitrary action
type Action interface {
Execute() error
}
// ActionIdentifier defines an interface for inspecting a k8s resource to determine if
// there are any differences between it's spec and status. T... |
ca40f6cbbd10f602760905ec4c5cf2fc1695d21e | 5c94e4f76b8a76c2dbfa63f6a976c16c0509b2fe | hhstore/go-plugins | /transport/grpc/grpc.go | Go | go | 394 | permissive | // Package grpc provides a grpc transport
// Deprecated: use `github.com/micro/go-micro/transport/grpc` instead
package grpc
import (
"github.com/micro/go-micro/transport"
"github.com/micro/go-micro/transport/grpc"
)
// Deprecated: use `github.com/micro/go-micro/transport/grpc` instead
func NewTransport(opts ...tra... |
f7744dd1f7480bc58518c938e15abf4eca1dbcef | 379b914b652384dafefc8942501029fcaf5e5665 | zengchen221/go-qlc | /vm/contract/representative.go | Go | go | 10,612 | permissive | package contract
import (
"errors"
"fmt"
"math/big"
"github.com/qlcchain/go-qlc/common"
"github.com/qlcchain/go-qlc/common/types"
"github.com/qlcchain/go-qlc/common/vmcontract/contractaddress"
cfg "github.com/qlcchain/go-qlc/config"
cabi "github.com/qlcchain/go-qlc/vm/contract/abi"
"github.com/qlcchain/go-ql... |
3fd74270b8a4610b51ddf2f5e76620a6ab24f36f | ac02f817e21b7dd004dffc631d3cc8db73886c33 | danilloricardo/remp | /Beam/go/vendor/golang.org/x/build/version/go1.8.6/main.go | Go | go | 379 | permissive | // Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The go1.8.6 command runs the go command from go1.8.6.
//
// Deprecated: Use https://godoc.org/golang.org/dl/go1.8.6 instead.
package main
import "golang.org... |
69807bea42d0dc6db4687a99c23c5a70bb3404b4 | 287ea8dca46bf4f942f9e81be3c909ddf21be95e | xylong/youku | /tests/default_test.go | Go | go | 950 | no_license | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "youku/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(fil... |
e02e8d73de37678373c36a330a3633764d24e5f1 | 062120bf9bb39e7c5e6246b748455c92f215d62d | liam-b/robocup-2018 | /src/behaviours/chemical_spill.go | Go | go | 7,551 | no_license | package main
import "strconv"
const SAVE_CAN_VERIFY_SPEED = 50
const SAVE_CAN_VERIFY_ATTEMPTS = 30
const SAVE_CAN_ENTER_SPEED = 300
const SAVE_CAN_ENTER_POSITION = 570
const SAVE_CAN_SEARCH_SPEED = 50
const SAVE_CAN_SEARCH_CAN_DISTANCE = 830
const SAVE_CAN_SEARCH_CAN_COUNT = 7
const SAVE_CAN_SAVE_SPEED = 130
cons... |
8c20c2749919d28beb5fcc9c38e7b824c9604708 | f4d7ee5e544be3cb6be6a7fc1a4d107de5efd1f5 | smyrman/rest-layer | /schema/null.go | Go | go | 287 | permissive | package schema
import "errors"
// Null validates that the value is null.
type Null []FieldValidator
// Validate ensures that value is null
func (v Null) Validate(value interface{}) (interface{}, error) {
if value != nil {
return nil, errors.New("not null")
}
return value, nil
}
|
3154f53b040a588a83d98afa15d793dcedac333b | 4e98ae3c41011b03ff1502f3f79052a7c265aefa | darkmastermindz/yagpdb | /logs/web.go | Go | go | 10,292 | permissive | package logs
import (
"errors"
"fmt"
"github.com/jonas747/discordgo"
"github.com/jonas747/yagpdb/bot/botrest"
"github.com/jonas747/yagpdb/common"
"github.com/jonas747/yagpdb/logs/models"
"github.com/jonas747/yagpdb/web"
"github.com/volatiletech/null"
"github.com/volatiletech/sqlboiler/boil"
"goji.io"
"goji.... |
b76f1f48bfa4946f862c17790d0f73df32931f37 | dd33a54d863d5c0fbc871ae63788c7c2b7a43a97 | ljfranklin/gcs-resource | /integration/check_test.go | Go | go | 15,752 | permissive | package integration_test
import (
"bytes"
"encoding/json"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
//"strconv"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
"github.com/frodenas/gcs-resource"
"github.com/frodenas/gcs-resource/chec... |
f2f4abdc2fe5b0991fe1966ce1b25920a64a5f42 | e80a99a8509ce903931a19e1812293f31c4f53ed | huaweicloud/huaweicloud-sdk-go-v3 | /services/dataartsstudio/v1/model/model_create_standard_template_request.go | Go | go | 561 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// CreateStandardTemplateRequest Request Object
type CreateStandardTemplateRequest struct {
// DataArts Studio工作空间ID
Workspace string `json:"workspace"`
Body *StandElementFieldVo `json:"body,omitempty"`
}
func (o Cre... |
205841fbf1f14ed064e79d934e391806a3ef52af | 1764fa24e17363aa498ee9ebf1089c3050235098 | AccelByte/accelbyte-go-sdk | /cloudsave-sdk/pkg/cloudsaveclient/admin_record/admin_delete_admin_game_record_v1_responses.go | Go | go | 8,135 | permissive | // Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package admin_record
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"strings"
"github.com/go-op... |
f1a8722898236569ff5824ac8afb6db7db18b644 | 98855105d7818eb58b3437eb30cb226c864c3a01 | mathuin/kerbal-science-tracker | /science_test.go | Go | go | 1,891 | permissive | package main
import (
"bytes"
"errors"
"reflect"
"testing"
"github.com/alecthomas/repr"
)
var filltests = []struct {
in *Term
out *ScienceSubject
err error
}{
{
&Term{Name: "empty"},
nil,
errors.New("no terms in science term"),
},
{
&Term{Name: "novalues", Terms: []*Term{
&Term{Name: "novalue"... |
63993816676cea8e42241966be6f8252873e7774 | 68786a5e9937d5974e172a621ae43a31f7772e6e | vedoalfarizi/sea-apd | /domain/transaction/transaction.go | Go | go | 1,963 | no_license | package transaction
import (
"github.com/labstack/echo"
"github.com/williamchang80/sea-apd/domain"
"github.com/williamchang80/sea-apd/dto/request/transaction"
"time"
)
type Transaction struct {
domain.Base
BankNumber string `json:"bank_number"`
BankName string `json:"bank_name"`
Amount int `json:"amo... |
ab27d6cdf59e8a562d25b17971ed3811d71a9554 | 360b19e608a958373bf8f0a6626021df7f65e611 | Laymer/cds | /engine/api/database/database.go | Go | go | 4,680 | permissive | package database
import (
"database/sql"
"fmt"
"sync"
"time"
"github.com/go-gorp/gorp"
"github.com/lib/pq"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/log"
)
// DBConnectionFactory is a database connection factory on postgres with gorp
type DBConnectionFactory struct {
DBDriver string
DBRole ... |
f21020978b4dea81bba75a4c814bd2a47045f7cd | 17f3dd3064249f587157c6feec51ea8862d1a164 | wireturn/bsv | /protocols/payd/transports/http/middleware/error_handler.go | Go | go | 1,610 | permissive | package middleware
import (
"errors"
"fmt"
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
validator "github.com/theflyingcodr/govalidator"
"github.com/theflyingcodr/lathos"
"github.com/theflyingcodr/lathos/errs"
)
// ErrorHandler we can flesh this out.
func ErrorHand... |
0eba809575828a4f360fdea3692a57a7c6d92bc8 | 4f5cbbaf40b1387fed2e60bc9f073cc75cd8d488 | newrelic/go-agent | /v3/integrations/nrlambda/handler.go | Go | go | 5,638 | permissive | // Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// Package nrlambda adds support for AWS Lambda.
//
// Use this package to instrument your AWS Lambda handler function. Data is
// sent to CloudWatch when the Lambda is invoked. CloudWatch collects Lambda
// log data... |
1eea7a1fa114f719d1af42af07d0f7592fe57459 | d4f0a7571aec33f08175452f0c34509ca663956a | yunyun/fabric | /common/ledger/blkstorage/fsblkstorage/fs_blockstore.go | Go | go | 3,089 | permissive | /*
Copyright IBM Corp. 2016 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 wri... |
d55ec127aeddd2c69f0f477814c596a156fd41e0 | c7f0a52a598063378b526363c5a3a62b011d0ee3 | One-E2-Team/nistagram | /campaign/handler/campaignHandler.go | Go | go | 12,848 | permissive | package handler
import (
"context"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"gorm.io/gorm"
"net/http"
"nistagram/campaign/dto"
"nistagram/campaign/model"
"nistagram/campaign/service"
"nistagram/util"
)
type CampaignHandler struct {
CampaignService *service.CampaignService
}
func (handler CampaignHan... |
dab5bf7db87c37ececf55daa55dc5751a5ccd90a | e5865339ac53bb44ba23b1d7e0ce0bc63a82f913 | wakiyamap/monad | /wire/msgmerkleblock.go | Go | go | 4,714 | permissive | // Copyright (c) 2014-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wire
import (
"fmt"
"io"
"github.com/wakiyamap/monad/chaincfg/chainhash"
)
// maxFlagsPerMerkleBlock is the maximum number of flag bytes that could
// poss... |
d6ec1b0513baff8c518aa274d7ab5d99c9e70fa3 | 6ecde5085abecd4840c1d317dba7192eefbe851b | johnbirdau/pulumi-azure-native | /sdk/go/azure/storage/v20150501preview/init.go | Go | go | 1,049 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20150501preview
import (
"fmt"
"github.com/blang/semver"
"github.com/pulumi/pulumi-azure-native/sdk/go/azure"
"github.com/pulumi/pulumi/sdk/v3/go/pul... |
1d0a4d661ba7e8f0d2bb3202f5c16de440aae634 | 0be0613b5da62cae2a04589fbbbe8d06e42f22c5 | srgyrn/codewars | /decode_morse_code/decodemorsecode.go | Go | go | 561 | no_license | package decodemorsecode
import (
"strings"
)
func DecodeMorse(morseCode string) string {
if len(morseCode) == 0 {
return ""
}
morseWords := strings.Split(strings.TrimSpace(morseCode), " ")
result := make([]string, len(morseWords))
var word string
for _, morseWord := range morseWords {
word = ""
for _... |
70a6131ea20a17b680ebb5f668737bd7edaec0bd | 4a92759914e1c5664b5811942e3843de073f6291 | TrishaPW/maccer | /database.go | Go | go | 1,794 | no_license | package main
import (
"strings"
"github.com/Southclaws/maccer/types"
"github.com/pkg/errors"
"gopkg.in/mgo.v2/bson"
)
var (
// ErrUserDiscordDuplicate is triggered when a discord ID is attempted to be registered twice
ErrUserDiscordDuplicate = errors.New("discord ID already registered")
// ErrUserForumDuplica... |
8655e9e891cd0aeb808fbeeebc03d056a9da5b98 | b28bdaa2f5bfbffdcec1dc17d62b81be399ed738 | starchou/elastigo | /indices/analyze.go | Go | go | 1,738 | permissive | // Copyright 2013 Matthew Baird
// 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... |
ce0ab260f881a4d9bab837745b57afd64719c07b | eda57d4675664e432f94b8674fe0946ac89f5aa9 | overvenus/ticdc | /cdc/model/string.go | Go | go | 1,303 | permissive | // Copyright 2020 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... |
93c1e3a74583cfa3108dab70ed15eb7ea7a88271 | 6e3d4026e8fa6e2eef9524b26824e164c9247d72 | AmirNaghibi/sourcegraph | /enterprise/internal/insights/compression/compression.go | Go | go | 7,643 | permissive | // Package compression handles compressing the number of data points that need to be searched for a code insight series.
//
// The purpose is to reduce the extremely large number of search queries that need to run to backfill a historical insight.
//
// An index of commits is used to understand which time frames actual... |
616536da530c184997f5c52b7eb1e19c95881a7b | c8c2ee4bd6ef38eecf2123d734f03d230cb3780e | kedacore/keda | /vendor/github.com/newrelic/newrelic-client-go/pkg/alerts/conditions.go | Go | go | 12,129 | permissive | package alerts
import (
"context"
"fmt"
"github.com/newrelic/newrelic-client-go/pkg/errors"
)
// ConditionType specifies the condition type used when creating the alert condition.
type ConditionType string
var (
// ConditionTypes enumerates the possible condition types for an alert condition.
ConditionTypes = ... |
69f0102468a27a4a56e1dd3060bf159886d6983d | cc0a67f6a1aa6e9feb47a9682e4839f13f023533 | apelisse/kubernetes | /contrib/mesos/pkg/scheduler/service/publish.go | Go | go | 3,787 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
9875a985c2791b9e0ee818b3b68bc8ab00f008ea | 7daa21ed60f5b32ae499d62bb0d3458aa377993d | stardog-union/stardog-graviton | /vendor/github.com/hashicorp/terraform/vendor/github.com/hashicorp/consul/testutil/server.go | Go | go | 14,930 | permissive | package testutil
// TestServer is a test helper. It uses a fork/exec model to create
// a test Consul server instance in the background and initialize it
// with some data and/or services. The test server can then be used
// to run a unit test, and offers an easy API to tear itself down
// when the test has completed.... |
086a9803392d6a3d65ec3c0f8ad4449091ebb302 | 68000dcaa3ca6a74f3b2a779c072720207cf57d0 | vivimouret29/pulumi-azure-native | /sdk/go/azure/web/v20210101/webAppAzureStorageAccounts.go | Go | go | 5,841 | permissive |
package v20210101
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type WebAppAzureStorageAccounts struct {
pulumi.CustomResourceState
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Name pulumi.StringOutput `pulu... |
0f5aee9366a4fbe55d17047ce4453b9819ba65fe | 62fc83e8fd1552e21b91f950ae06e37b0e0b023b | orange-cloudfoundry/artifactory-resource | /vendor/github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/argsutils.go | Go | go | 1,280 | permissive | package utils
import (
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
)
func ExtractBuildDetailsFromArgs(args []string) (cleanArgs []string, buildConfig *BuildConfiguration, err error) {
var flagIndex, valueIndex int
var buildName, buildNumber, project, module string
buildConfig = &BuildConfiguration{}
cle... |
21ee1fc6cbf7d902b2858e700a7100e1dbbe948a | 1db31db693b01605b663b4550801d620698b4177 | vaginessa/onionscan | /deanonymization/common_correlations.go | Go | go | 1,726 | permissive | package deanonymization
import (
"github.com/Minyall/onionscan/config"
"github.com/Minyall/onionscan/report"
"strconv"
"strings"
)
// CommonCorrelations extracts relationships from other non-web protocols
// FIXME: At somepoint we probably want to separate these out into their
// own files as non-http functionali... |
9a2d8056b4625b1b0a84524cf18bfef7f679dc5c | 8dad3cf9437910876ea41f14605dacdd438f5e20 | monjovi/gloo | /test/kube_e2e/containers/grpc-test-service/main.go | Go | go | 1,527 | permissive | package main
import (
"flag"
"fmt"
"log"
"net"
"github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
"github.com/grpc-ecosystem/go-grpc-middleware/tags"
"github.com/solo-io/gloo/test/kube_e2e/containers/grpc-test-service/bookstore/protos"
"github.com/solo-i... |
3d34043c0ceb7c2dbffbf62c986af8a745457b66 | 4b3490b1f5783b62d7066d33f2d8916ddfd7507d | drinkin/gunit | /context.go | Go | go | 1,323 | permissive | package gunit
import (
"fmt"
"strconv"
"strings"
)
func FormatFailureContext(lineNumber int, code string) string {
lines := strings.Split(code, "\n")
if len(lines) == 0 || lineNumber >= len(lines) {
return ""
}
failure := []string{formatFailure(lines[lineNumber], lineNumber)}
if len(lines) > lineNumber {
... |
7589887c2e077aa5e632979010acf05f5842bd93 | 89ad3a86f2b96b6da60fe9434858f899df739d59 | openshift/installer | /terraform/providers/ignition/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_multi.go | Go | go | 1,522 | permissive | package schema
import (
"fmt"
)
// MultiLevelFieldReader reads from other field readers,
// merging their results along the way in a specific order. You can specify
// "levels" and name them in order to read only an exact level or up to
// a specific level.
//
// This is useful for saying things such as "read the fi... |
312b055925d88cebaad7bf3929330ab728056215 | 03579a64b7b78a1dc979b26ae96fe14b0bb71232 | openshift/oc | /vendor/github.com/openshift/library-go/pkg/template/generator/expressionvalue.go | Go | go | 4,646 | permissive | package generator
import (
"fmt"
"math/rand"
"regexp"
"strconv"
"strings"
)
// ExpressionValueGenerator implements Generator interface. It generates
// random string based on the input expression. The input expression is
// a string, which may contain "[a-zA-Z0-9]{length}" constructs,
// defining range and lengt... |
c3418deadc4d5d471269b9136574f435946acfd9 | 120104a81fdfe215d287a8da121c9281eb393504 | houxinjie/golang | /collection_functions/1.go | Go | go | 1,409 | no_license | package main
import "strings"
import "fmt"
func Index(vs []string, t string) int{
for i, v := range vs {
if v == t{
return i
}
}
return -1
}
func Include(vs []string, t string) bool{
return Index(vs, t) >= 0
}
func Any(vs []string, f func(string) bool) bool{
for _, v ... |
bd3fa5e1c0bd8ac7ab650698d42bb8d6c64daf2b | c331120e43be185b6eb7b6706d39afd77a0c0941 | andyZheng/link | /util.go | Go | go | 1,806 | permissive | package link
import (
"bufio"
"net"
"sync/atomic"
"time"
)
var dialSessionId uint64
// The easy way to setup a server.
func Listen(network, address string, protocol PacketProtocol) (*Server, error) {
listener, err := net.Listen(network, address)
if err != nil {
return nil, err
}
return NewServer(listener, ... |
e38bf977df9f3564b7670ade6cd9bdcd580bf0f3 | 586f35dbf3c4a3cef1ec5a1c4877092c915e8bdc | golint-fixer/api2go-gorm-gin-crud-example | /resource/resource_user.go | Go | go | 4,826 | permissive | package resource
import (
"errors"
"net/http"
"sort"
"strconv"
"github.com/hnakamur/api2go-gorm-gin-crud-example/model"
"github.com/hnakamur/api2go-gorm-gin-crud-example/storage"
"github.com/manyminds/api2go"
)
// UserResource for api2go routes
type UserResource struct {
ChocStorage *storage.ChocolateStorage... |
71fe3a7228ef351ecfdea40512524a86cf0e5a23 | db36750e508c57f971b6159ba28f6e817538c62a | zsse/grafana | /pkg/tsdb/mssql/mssql_test.go | Go | go | 26,249 | no_license | package mssql
import (
"fmt"
"math/rand"
"strings"
"testing"
"time"
"github.com/go-xorm/xorm"
"github.com/rkrikbaev/grafana/pkg/components/simplejson"
"github.com/rkrikbaev/grafana/pkg/log"
"github.com/rkrikbaev/grafana/pkg/services/sqlstore/sqlutil"
"github.com/rkrikbaev/grafana/pkg/tsdb"
. "github.com/sm... |
90362a6e77a22f9db6e826b5d1acb42db0072e09 | 4acfaa25a6a3efdc570b1d57fe487b46e96d9bfa | mwaaas/grpc_tutorial | /greeter_server/main.go | Go | go | 825 | no_license | package main
import (
pb "github.com/mwaaas/grpc_tutorial/hello_world"
"golang.org/x/net/context"
"net"
"log"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"fmt"
)
// server is used to implement helloworld.GreeterServer.
type server struct {}
func (s *server) SayHello(ctx context.Context, requ... |
e5c756ebbe9cb032c488bf3a9b606406ccd248fd | 27316232f84c6bca8857945fdb73a4948c06c080 | mc2soft/goose | /status.go | Go | go | 1,818 | permissive | package goose
import (
"database/sql"
"fmt"
"log"
"path/filepath"
"time"
)
// Status prints the status of all migrations.
func Status(db *sql.DB, dir string) error {
// collect all migrations
migrations, err := CollectMigrations(dir, minVersion, maxVersion)
if err != nil {
return err
}
// must ensure tha... |
ee6136dff2c09bb390915c61003b1d6a9ef26c66 | 67b6864e7db264ba21d7f408a7b2da1a9453709e | checkr/codeflow | /server/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go | Go | go | 2,256 | 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, ... |
64c4b3874473a1f268d4eeccce820226f177327a | dfb991529891d5c7514710b90d87f8f95e85ac04 | zuxingyu/origin | /pkg/image/generated/informers/internalversion/image/internalversion/imagestream.go | Go | go | 2,313 | permissive | // This file was automatically generated by informer-gen
package internalversion
import (
image "github.com/openshift/origin/pkg/image/apis/image"
internalinterfaces "github.com/openshift/origin/pkg/image/generated/informers/internalversion/internalinterfaces"
internalclientset "github.com/openshift/origin/pkg/ima... |
8c42be774aa20c551985e8781bf31daa72376eed | af4aacefdaed36e5a4eec279082324141e4301f9 | SheimyRahman/GophersButt | /main.go | Go | go | 2,490 | no_license | package main
import (
"image/color"
"image/gif"
"log"
"os"
"strconv"
)
var (
ParrotColors []color.Color
DarkParrotColors []color.Color
LightGopherBlue color.Color
DarkGopherBlue color.Color
)
func init() {
var err error
for _, s := range []string{
"FF6B6B",
"FF6BB5",
"... |
ce9eeb4590f50f5407ba941d550214778f1abd07 | 1204e374e7719677d5b140714ad0963563771ff7 | mucena/go-swagger | /fixtures/goparsing/classification/models/nomodel.go | Go | go | 18,877 | permissive | // Copyright 2015 go-swagger maintainers
//
// 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... |
a3ce6f26685276f2c79caf3eda536d150d2ed02e | 85dc6b86afd3efba29ba0d2ce87d65fa49d99f3b | reinventer/madsquid | /src/handlers/messages.go | Go | go | 1,580 | no_license | package handlers
import (
"encoding/json"
"fmt"
"log"
)
type PostMessage struct {
For string `json:"for"`
From string `json:"from"`
Content json.RawMessage `json:"content"`
}
type InMessage struct {
For string `json:"for"`
Content json.RawMessage `json:"content"`
}
type... |
6a7dede61560495413cf8d3f5f736879dad5efda | a4b81cb9322e5cd4b47219c2c69588c184b2ebd1 | cchen435/photon-controller-cli | /photon/configuration/config_test.go | Go | go | 3,374 | permissive | // Copyright (c) 2016 VMware, Inc. All Rights Reserved.
//
// This product is licensed to you under the Apache License, Version 2.0 (the "License").
// You may not use this product except in compliance with the License.
//
// This product may include a number of subcomponents with separate copyright notices and
// lice... |
6446e03de17f8f096c24e0d001ba02a9d4a76576 | 0b49e295c211d037d6ab98ae3afeba50d4623e9a | GramYang/GoTest | /net/http/multirequest/main.go | Go | go | 551 | no_license | package main
import (
"fmt"
"net/http"
"sync"
)
func main() {
var wg sync.WaitGroup
a := &Array{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func(m1 *Array) {
a.add(getTest())
wg.Done()
}(a)
}
wg.Wait()
for _, v := range a.a {
fmt.Println(v)
}
}
type Array struct {
a []int
b sync.Mutex
}
func ... |
56c4fde17a84b9b826f9c09ba4e2c5ce150938a4 | c217fca55de766877d56f854a2c3bcc174e36e20 | dbrabera/slip | /internal/repl.go | Go | go | 718 | permissive | package internal
import (
"bufio"
"fmt"
"io"
"os"
)
// REPL executes a Read-eval-print loop until the program is closed.
func REPL() error {
fmt.Printf("Slip %s\n", Version)
env := NewEnviroment()
reader := bufio.NewReader(os.Stdin)
for lineNo := 0; ; lineNo++ {
fmt.Printf("slip:%d:> ", lineNo)
line, e... |
6558ff2c210e984c223e7765036642be314ac706 | 7c7d45ecaeb501e3235f192b5042298d22675816 | MitchellTesla/cosmos-sdk | /x/staking/types/msg.go | Go | go | 13,962 | permissive | package types
import (
"bytes"
"encoding/json"
"fmt"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/bls12_381"
yaml "gopkg.in/yaml.v2"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// ensure Msg interface compliance at co... |
521dd4516a62030d534d9252198453992b6c1571 | a5bbe41937aab3ad295c8a81862ea679f54da7aa | shuidong/easygo-server | /Gate/src/Gate/Main.go | Go | go | 976 | no_license | /**
作者:Kyle Ding
模块:
说明:
创建时间:2015-12-20
**/
package main
import (
"fmt"
"math/rand"
"os"
"runtime"
"strconv"
"time"
)
import (
. "GxMisc"
)
var r *rand.Rand
func start_server() {
go clientRouter.Start(config.Host1 + ":" + strconv.Itoa(config.Port1)) //Start client tcp server.
serverRouter.Start(config.Hos... |
444155e542795e21f1df77bea1a0bcc224aa9389 | 7d5f7535f3e3ce725b58390cfeead40d49bd82c2 | sdtk/logkit | /transforms/mutate/discard.go | Go | go | 5,235 | permissive | package mutate
import (
"sort"
"strings"
"sync"
"github.com/qiniu/logkit/transforms"
. "github.com/qiniu/logkit/utils/models"
)
var (
_ transforms.StatsTransformer = &Discarder{}
_ transforms.Transformer = &Discarder{}
_ transforms.Initializer = &Discarder{}
)
type Discarder struct {
Key st... |
b94e79b0ee034a04cf5fb4261cc63e1283dc36ad | 9066f5c177f2cadaeb7068b25c9cfc61f66e06c8 | wheaton5/hts | /bam/writer.go | Go | go | 4,029 | permissive | // Copyright ©2012 The bíogo 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 bam
import (
"bytes"
"compress/gzip"
"encoding/binary"
"errors"
"io"
"github.com/biogo/hts/bgzf"
"github.com/biogo/hts/sam"
)
// Writer im... |
ab26f855f916456723800e62f687943fe53f94d6 | 078a43c8b09ec37d4040fe8706a39b8cb6d33ee7 | hrntknr/ospfviz | /configParser.go | Go | go | 3,060 | no_license | package main
import (
"bufio"
"fmt"
"net"
"os"
"reflect"
"strconv"
"strings"
)
func configParser(fd *os.File) (*[]Router, error) {
reader := bufio.NewReaderSize(fd, 4096)
routers := []Router{}
var line string
var next = true
var initRouter = true
var initLink = false
var returnCount = 0
var marginRe... |
6243406809fa25895cafb2b8c83673ea27139653 | af5007fc18bde2f7ebc664cf22ad7cc1fe97ba38 | grafana/cortex | /vendor/github.com/prometheus/prometheus/tsdb/querier.go | Go | go | 23,206 | permissive | // Copyright 2017 The Prometheus 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... |
09c683752d602e3d9fd4248534f93615bda52561 | 580edafe5093fbd04a2b2c6872f234f8f833f213 | pastrylabs/fogg | /migrations/yaml.go | Go | go | 1,724 | permissive | package migrations
import (
"path/filepath"
"github.com/chanzuckerberg/fogg/config"
"github.com/chanzuckerberg/fogg/errs"
prompt "github.com/segmentio/go-prompt"
"github.com/sirupsen/logrus"
"github.com/spf13/afero"
"gopkg.in/yaml.v3"
)
//JSONToYamlMigration Defines a fogg json to yaml config file migration
t... |
b6a4edeb846a177efd9e7b9a872853c992314c7f | 92d56b570b83569ec7282909affc8f28c4ef4ce1 | admpub/spider | /gui/offline.go | Go | go | 5,766 | permissive | package gui
import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"github.com/admpub/spider/app"
"github.com/admpub/spider/config"
"github.com/admpub/spider/logs"
"github.com/admpub/spider/runtime/status"
)
func offlineWindow() {
mw.Close()
if err := (MainWindow{
AssignTo: &mw,
DataBinder: ... |
fd310fee6ad701704848eb1701d97a398123048f | 9f6e65246dc666a7d2e32824ac1928e64dbc97bf | lorenzo-stoakes/gojay | /encode_number_float_test.go | Go | go | 2,698 | permissive | package gojay
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestEncoderFloat64(t *testing.T) {
var testCasesBasic = []struct {
name string
v float64
expectedJSON string
}{
{
name: "basic",
v: float64(1),
expectedJSON: "[1,1]",
}... |
a3cb6ffe1fd22c6315534693b7fa97160b72a3c9 | daa19b62ffe2285ff95781599d4fc1ae9b28e70e | microsoftgraph/msgraph-beta-sdk-go | /models/cloud_pc_supported_region_status.go | Go | go | 1,315 | permissive | package models
import (
"errors"
)
//
type CloudPcSupportedRegionStatus int
const (
AVAILABLE_CLOUDPCSUPPORTEDREGIONSTATUS CloudPcSupportedRegionStatus = iota
RESTRICTED_CLOUDPCSUPPORTEDREGIONSTATUS
UNAVAILABLE_CLOUDPCSUPPORTEDREGIONSTATUS
UNKNOWNFUTUREVALUE_CLOUDPCSUPPORTEDREGIONSTATUS
)
func (i... |
119a45f238c0c023113510b2df45a984ada2d187 | 75de6dc16aee8504aed50bb32f0674b089d93b32 | andrepatete/amazon-ecs-agent | /agent/stats/utils_test.go | Go | go | 2,392 | permissive | //+build unit
// Copyright Amazon.com Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "lic... |
47a66d859725c97868bfe37a7c948d1cecdc8340 | f6429b681e238f3531e009a5ee5f11d7705b1765 | pulumi/pulumi-random | /provider/resources.go | Go | go | 4,592 | permissive | // Copyright 2016-2023, Pulumi 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... |
f6640351961de3f31ba8a6524593c7be1dd8e035 | 78c9b792336b75de37b2202dfd716897c976df5e | panjunwei/wechat | /mp/media/mpvideo.go | Go | go | 994 | permissive | package media
import (
"github.com/panjunwei/wechat/mp/core"
)
// UploadVideo2 创建视频素材, 返回的素材一般用于群发消息.
// mediaId: 通过 UploadVideo 上传视频文件得到
// title: 标题, 可以为空
// description: 描述, 可以为空
func UploadVideo2(clt *core.Client, mediaId, title, description string) (info *MediaInfo, err error) {
const i... |
c05f92d8857aadadc40657ce227894387261c696 | afbb89348ff485e6aa15befc3c949fc8fa4f5411 | shoito/gopl-learning | /ch02/ex05/bench_test.go | Go | go | 336 | permissive | package main
import (
"testing"
)
var input uint64 = 0x1234567890ABCDEF
var output int
func BenchmarkPopCount(b *testing.B) {
var c int
for i := 0; i < b.N; i++ {
c = PopCount(input)
}
output = c
}
func BenchmarkPopCountByClear(b *testing.B) {
var c int
for i := 0; i < b.N; i++ {
PopCountByClear(input)
... |
3fa9f6244e59f44d57bd784fd0494d6b5b3777a1 | 2e56ad62a086148687b569b8df0cc78c731e687f | unichainplatform/uni-web3go | /p2pAPI.go | Go | go | 1,028 | no_license | package rpc
func GetPeerCount() (int, error) {
peerCount := int(0)
err := ClientCall("p2p_peerCount", &peerCount)
return peerCount, err
}
func AddPeer(url string) (uint64, error) {
peerCount := uint64(0)
err := ClientCall("p2p_addPeer", &peerCount, url)
return peerCount, err
}
func RemovePeer(url string) (bo... |
b136664cf6658e366d9c1f85f2c50ca31984085c | a6c23893765233c30d8f17337270527227d21bd2 | huayl/fabio | /proxy/tcp/tcp_proxy.go | Go | go | 2,056 | permissive | package tcp
import (
"io"
"log"
"net"
"time"
"github.com/fabiolb/fabio/metrics"
"github.com/fabiolb/fabio/route"
)
// Proxy implements a generic TCP proxying handler.
type Proxy struct {
// DialTimeout sets the timeout for establishing the outbound
// connection.
DialTimeout time.Duration
// Lookup return... |
c6bcb20aeb2dab1028318e5c081550f9b2b1d32d | 4df730ec568ae57a5af2fcd758ea281294750360 | Banyango/gornament | /gornament.go | Go | go | 2,240 | no_license | package main
import (
"bufio"
"flag"
"fmt"
"github.com/labstack/gommon/log"
"io/ioutil"
"net/url"
"os"
"path"
"path/filepath"
"text/template"
)
type TemplateData struct{
Path string
Name string
}
type Data struct{
Templates string
}
func main() {
mapUrlPtr := flag.String("mapurl", "", "your url for ... |
b4d19976c1c987f9a75e091bc44d98762424e2c3 | 4fee7212eeeb1112155bd7e564a3fb7be39caa27 | iandelahorne/eve-sdeloader | /inventory/import_test.go | Go | go | 1,891 | permissive | package inventory
import (
sqlmock "gopkg.in/DATA-DOG/go-sqlmock.v1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Import", func() {
It("Tests inserting bonuses", func() {
bonuses := []Bonus{
{
Amount: 5,
BonusText: map[string]string{
"en": "A bonus",
"de": "ein... |
db0865baa4b4e8880058dbbfdcd5a51efc6bd3dc | 072882383cf11aa0aab7f20650c40498b536b3f1 | rajat404/pinniped | /internal/kubeclient/kubeclient_test.go | Go | go | 31,045 | permissive | // Copyright 2021 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package kubeclient
import (
"context"
"fmt"
"io"
"net"
"net/http"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/me... |
fc4ba008acab1c81219e14b9eeeb937e8ffaa5c5 | 51c32fbdcd3074a1a1b894b84717c2d72f159816 | cchen435/photon-controller-cli | /Godeps/_workspace/src/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go | Go | go | 3,157 | permissive | package remote
import (
"bytes"
"encoding/json"
"io"
"net/http"
"github.com/vmware/photon-controller-cli/Godeps/_workspace/src/github.com/onsi/ginkgo/config"
"github.com/vmware/photon-controller-cli/Godeps/_workspace/src/github.com/onsi/ginkgo/types"
)
//An interface to net/http's client to allow the injection... |
d0e67db2fbcdcaba457546e70ba732816201fd93 | 6a5b2b3239ed9c12d6ae60ddecbbc94a4981452f | aws/telegraf | /plugins/inputs/synproxy/synproxy.go | Go | go | 702 | permissive | package synproxy
import (
"os"
"path"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
type Synproxy struct {
Log telegraf.Logger `toml:"-"`
// Synproxy stats filename (proc filesystem)
statFile string
}
func (k *Synproxy) Description() string {
return "Get synproxy counte... |
f21447fd6ff21cc06859ce786278efe51dab4892 | 83fa19e812d1c9331c86c6ff465676305f467acc | czilm/genms | /cmd/protoc-gen-go-genms-dal/generator/rest/message.go | Go | go | 623 | no_license | package rest
import (
"github.com/rleszilm/genms/cmd/protoc-gen-go-genms-dal/generator"
protocgenlib "github.com/rleszilm/genms/internal/protoc-gen-lib"
"google.golang.org/protobuf/compiler/protogen"
)
// Message adds functionality to the underlying message.
type Message struct {
*generator.Message
}
// NewMessa... |
9410d6d0e9565d117dfa8240c2be05149dc34e85 | b98a3b26fd7e9cdddd49f624b4e9c3443a2ffeb5 | tarikbauer/gobot | /app/handler.go | Go | go | 828 | no_license | package app
import (
"net/http"
"github.com/tarikbauer/gobot/application"
)
type serverHandler struct {
service application.Bot
}
func (sh *serverHandler) serve(w http.ResponseWriter, r *http.Request) {
content, err := sh.service.Render(r.Context())
if err != nil {
w.WriteHeader(http.StatusInternalServerErro... |
4363f7b2b0f4d5bf94d8c4a833bf6cbc8e2f6ad2 | d39f52419761eada42052d87fa72373f428948ca | gobins/go-ipfs-log | /test/signed_log_test.go | Go | go | 8,304 | permissive | package test
import (
"context"
"fmt"
"testing"
ipfslog "berty.tech/go-ipfs-log"
"berty.tech/go-ipfs-log/accesscontroller"
"berty.tech/go-ipfs-log/errmsg"
idp "berty.tech/go-ipfs-log/identityprovider"
ks "berty.tech/go-ipfs-log/keystore"
dssync "github.com/ipfs/go-datastore/sync"
mocknet "github.com/libp2p/... |
21d49aba2dab735e8b14ba0522b23bb4ab1d48c1 | 077c1507ac046868a41340be0c294e306b7da1a9 | Fea-Sin/gopl | /book/ch7/gc.go | Go | go | 521 | no_license | /*
/*
@Time : 2020/11/24 4:32 下午
@Author : chengqunzhong
@File : gc
@Software: GoLand
*/
package main
import (
"fmt"
"golang.org/x/net/html"
"os"
)
func outline(stack []string, n *html.Node) {
if n.Type == html.ElementNode {
stack = append(stack, n.Data)
fmt.Println(stack)
}
for c := n.FirstChild; c != nil... |
174eda29dfa9fd7889a405a014b0c0cfd1abcee6 | 6bac72456f66176efc6d227c404fc454590835d8 | yusank/klyn-log | /consts/consts.go | Go | go | 722 | permissive | // Copyright 2018 Yusan Kurban. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package consts
import "time"
const (
// MaxSizeOfCache - max size of cache
MaxSizeOfCache = 1 << 15 // 32k
)
const (
// DefaultTickerDuration - ticker for c... |
03bb88da33d0e0866597568e2f589c0a64e5d128 | 839e224cfac3c87d45f5182987b6c4ac74ef028a | panotza/pgsql | /string.go | Go | go | 514 | permissive | package pgsql
import (
"database/sql"
"database/sql/driver"
)
// NullString scans null into empty string
func NullString(s *string) interface {
driver.Valuer
sql.Scanner
} {
return &nullString{s}
}
type nullString struct {
value *string
}
func (s *nullString) Scan(src interface{}) error {
var t sql.NullStrin... |
9fc34f0c5733dc381c0e73ef06126d813f6ab11b | 8b4d45e23567b86ccce52e26bf4fb32dcd5e7f7c | qlik-oss/gopherciser | /helpers/distribution.go | Go | go | 4,432 | permissive | package helpers
import (
"fmt"
"strconv"
"time"
"github.com/pkg/errors"
"github.com/qlik-oss/gopherciser/enummap"
)
type (
//DistributionType type of distribution
DistributionType int
// DistributionSettings think time settings
DistributionSettings struct {
// Type of timer delay
Type DistributionType ... |
075292545bb3b21dea1d3c88ff19c46b9de0d0b9 | 85fa640303be79af4ff4b5d960750cbf1bfb5c06 | devbuddy/devbuddy | /pkg/env/env_test.go | Go | go | 2,569 | permissive | package env
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestEnviron(t *testing.T) {
values := []string{"K1=V1", "K2=V2", "K3=V3"}
require.ElementsMatch(t, values, New(values).Environ())
}
func TestSetUnset(t *testing.T) {
env := New([]string{})
env.Unset("NOOP")
require.ElementsMatch(t, ... |
1812ffc727505cc5b88b186904d87b2efc625299 | f096b67de18bbd9e7762dc4c4ea7b3985444a300 | antcs/go-vice | /types.go | Go | go | 727 | permissive | package vice
var CertProductType = struct {
HAServer _CertProductType
HAGlobalServer _CertProductType
Server _CertProductType
GlobalServer _CertProductType
IntranetServer _CertProductType
IntranetGlobalServer _CertProductType
PrivateServer _CertProductType
G... |
1e6f453930fd2bdfe1e61b68953918887f81ea0c | 7d41741cdbae73803bba62f549dd5d710ad51611 | anbring/sdns | /middleware/edns/edns.go | Go | go | 2,134 | permissive | package edns
import (
"github.com/miekg/dns"
"github.com/semihalev/sdns/config"
"github.com/semihalev/sdns/ctx"
"github.com/semihalev/sdns/dnsutil"
"github.com/semihalev/sdns/middleware"
)
// EDNS type
type EDNS struct {
cookiesecret string
}
func init() {
middleware.Register(name, func(cfg *config.Config) ct... |
7bb8765483447291d7b3f94288ef42e81c3a49ce | 5d74df8fa6bc397185bd8e41987c4cfe4290a676 | growdu/go-work | /src/net_test/IP.go | Go | go | 734 | no_license | package main
import (
"fmt"
"net"
)
func main(){
args:=[]string{"IP","192.168.1.124"}
ParseIP(args)
}
func ParseIP(args []string) {
if len(args) != 2 {
fmt.Println("Invalid error")
return
}
name := args[1]
addr := net.ParseIP(name)
if addr == nil {
fmt.Println("Invalid address.")
return
} /*else{
... |
a4af430a357e395998c0f8643e77dd14a4239a32 | 411a872463a4ccf3430fe650ed09453f837bb053 | confluentinc/datadog-agent | /pkg/security/probe/kfilters_bpf.go | Go | go | 2,505 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build linux
// +build linux
package probe
type activeKFilter inter... |
fd6313985616b292c6c95e0a4732f2063daf8f4d | 216abcbb53f775e0a27f0b4785183073094be584 | morrell/pulumi-azure-native | /sdk/go/azure/documentdb/v20210301preview/sqlResourceSqlUserDefinedFunction.go | Go | go | 11,365 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20210301preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An Azure Cosmos DB userDefined... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.