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 |
|---|---|---|---|---|---|---|---|---|
9613ea4e338c092506a7ef397d6b58cc88287c5e | e6ab7fb2ee0b1a591feb3b6342a2113e8a6bfe8b | r0fls/gitql | /runtime/remotes.go | Go | go | 2,104 | permissive | package runtime
import (
"github.com/cloudson/git2go"
"github.com/cloudson/gitql/parser"
"log"
)
func walkRemotes(n *parser.NodeProgram, visitor *RuntimeVisitor) {
s := n.Child.(*parser.NodeSelect)
where := s.Where
remoteNames, err := builder.repo.ListRemotes()
if err != nil {
lo... |
2f89a9c43e0e65f51587e1ecfa09cf7220a3bd81 | 110074df518430685e74d8cabe68bc1f884180f6 | soxueren/gloo | /projects/ingress/pkg/translator/translate_test.go | Go | go | 12,521 | permissive | package translator
import (
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/plugins/kubernetes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
gloov1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1"
ingresstype "github.com/solo-io/gloo/projects/ingress/pkg/api/ingress"
v1 "github.com/solo-io/gloo/pro... |
78e777ebc5bc81f218f1441bdee77c73bac22d81 | b517326ab1e0d99cf26951f28fce0d9f5d457514 | marun/origin | /pkg/sdn/client/clientset_generated/release_v1_5/clientset.go | Go | go | 2,554 | permissive | package release_v1_5
import (
"github.com/golang/glog"
v1core "github.com/openshift/origin/pkg/sdn/client/clientset_generated/release_v1_5/typed/core/v1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/flowcontrol"
_ "k8s.i... |
1f994e00f7d208e3b5cf755fcf0c456abce771c1 | 569ede76efd3ef09dd1505343ae78c938ae6fe17 | kojmay/GoPractice | /1.go-conccurency/1.file_transport/reciever.go | Go | go | 1,235 | permissive | package main
import (
"fmt"
"io"
"net"
"os"
"time"
)
func main() {
// Listening
listener, err := net.Listen("tcp", "127.0.0.1:8000")
if err != nil {
fmt.Println("net.Listen err:", err)
return
}
defer listener.Close()
// connnected to client
conn, err := listener.Accept()
if err != nil {
fmt.Printl... |
9af51d0ae5aa4a8d7426c6010cff888b66007c5d | bab75bbe69ccb8813e78b5e0443ecfac2ad87c94 | maksd/control-plane | /components/provisioner/internal/operations/stages/deprovisioning/cleanup_cluster_test.go | Go | go | 3,650 | permissive | package deprovisioning
import (
"errors"
"testing"
"time"
"github.com/kyma-project/control-plane/components/provisioner/internal/operations"
installationMocks "github.com/kyma-project/control-plane/components/provisioner/internal/installation/mocks"
"github.com/kyma-project/control-plane/components/provisioner... |
67da9fa4169af7018cbf87ee2547e950d3b082e5 | 2aeb9a66c1e14a932414b1757095170b0677f048 | Junzki/link-preview | /tests/handler_generic_test.go | Go | go | 618 | permissive | package tests
import (
"github.com/Junzki/link-preview/handlers"
"github.com/stretchr/testify/assert"
"testing"
)
func TestGetHandler(t *testing.T) {
cxt := handlers.LinkPreviewContext{
TargetType: handlers.StandardMetaTags,
Link: "https://golang.org",
}
handler, err := handlers.GetPreviewHandler(&cx... |
76ff0cbf0e56bac022a824fa24f4ba1a6dd53194 | 5bfb9aa1d884047c8efdea4917c807a2d3ca9f65 | chinalichen/graphql | /schema.go | Go | go | 14,735 | permissive | package graphql
type SchemaConfig struct {
Query *Object
Mutation *Object
Subscription *Object
Types []Type
Directives []*Directive
Extensions []Extension
}
type TypeMap map[string]Type
// Schema Definition
// A Schema is created by supplying the root types of each type of operation,
// q... |
7a8c7ad840abcfdd4a254b02657620568bad5fa5 | 49ca57c3156bfd5eea020d0544231a6a0dc6022c | fader2/platform-archive | /core/access_token.go | Go | go | 2,881 | permissive | package core
import (
"crypto/rsa"
"fmt"
"net/http"
"time"
jwt "github.com/dgrijalva/jwt-go"
request "github.com/dgrijalva/jwt-go/request"
"github.com/fader2/platform/config"
"github.com/fader2/platform/consts"
uuid "github.com/satori/go.uuid"
lua "github.com/yuin/gopher-lua"
)
const (
tokenDuration = 72
... |
149947f04864016c073b0ad4b33949fa92f727ab | 46cb3a3f0df0d0ded65d58cfc4228e7fd4e52b84 | detailyang/dcrdata | /vendor/github.com/decred/dcrd/chaincfg/params.go | Go | go | 44,229 | permissive | // Copyright (c) 2014-2016 The btcsuite developers
// Copyright (c) 2015-2017 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package chaincfg
import (
"encoding/hex"
"errors"
"fmt"
"math"
"math/big"
"time"
"github.com/decred/dcrd/chainc... |
d590065801aa234b290381359770027e7fa063dd | 94e8e90f5b83bb341e44012625e54b95efc8e8de | leixwang/prod-serv | /models/order_express.go | Go | go | 1,876 | permissive | package models
import (
"encoding/json"
"github.com/astaxie/beego/orm"
"prod-serv/services"
"prod-serv/utils"
)
/**
* 获取最新的订单物流信息
* @param orderId
* @returns {Promise.<*>}
*/
func GetLatestOrderExpress(orderid int) services.ExpressRtnInfo {
var expressinfo services.ExpressRtnInfo = services.ExpressRtnInfo{... |
0090e30d18dba14a324dacf2551b1487a6dfd299 | a8fa306c41dcbbacd09152ff73174fc399c3187c | hf/pulumi | /pkg/cmd/stack_tag.go | Go | go | 4,977 | permissive | // Copyright 2016-2018, 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... |
0819f31a2d17fa8a41a2371b08cfcbe6e79373bf | 26c0f137d4e62ed4fbd0e7cc3be64650b3c03bb0 | zasdaym/exercism | /go/animal-magic/animal_magic_test.go | Go | go | 2,660 | no_license | //nolint:gosec // In the context of this exercise, it is fine to use math.Rand instead of crypto.Rand.
package chance
import (
"math/rand"
"sort"
"testing"
"time"
)
func TestSeedWithTime(t *testing.T) {
const tests = 100
var last int64
for i := 0; i < tests; i++ {
SeedWithTime()
got := rand.Int63()
if i ... |
f8e115751b261a48677b31b5508010ab5ffb1fc0 | 9329527889f1f8d95703fe6edbd29cfdb9b3d62c | floverde/royce-tech-demo | /src/models/user.go | Go | go | 862 | no_license | package models
import "time"
// Defines the data structure of a user stored on the database.
//
// This data structure is also used as output by the REST read endpoints.
type User struct {
Id uint `json:"id" gorm:"primary_key"` // user ID (must be unique)
Name string ... |
71995916342faa8267e8f323b71e82be5cd4a1b8 | 448162a2abe91421db72d75a9933038cd116b594 | AmundsenJunior/gopl | /ch1/echo1.go | Go | go | 478 | no_license | // echo1 prints CL args
package main
import "fmt"
import "os"
func main() {
// vars s, sep are string types
// implicitly initialized empty ""
var s, sep string
// for initialization; condition; post-action
for i := 1; i < len(os.Args); i++ {
// empty sep, w/space added after first arg appended to s
// ensu... |
62824565f0f1da1eda8d9182e6d27e91031e6154 | d7b33ecb8e1c8eb83a17aa4b7d7f5b2488223401 | cr0sh/encore | /raknet/proto.go | Go | go | 2,176 | permissive | package raknet
import (
"github.com/cr0sh/encore/util/binary"
)
// Packet ID: 0x00
type ConnectedPing struct {
SendPingTime int64
}
func (*ConnectedPing) ID() byte {
return 0x00
}
// Packet ID: 0x01
type UnconnectedPing struct {
PingID uint64
OfflineMsg offlineMessageDataID
}
func (*UnconnectedPing) ID() ... |
a5b14bfc0ecdab7e2179a8a3d3471f9b7e0db558 | e7352d6454b15071feefba54834439ac7385134f | binchencoder/letsgo | /grpc/opentracing.go | Go | go | 2,751 | no_license | package grpc
import (
"context"
"flag"
"fmt"
"log"
"net"
"strings"
"time"
"github.com/golang/glog"
opentracing "github.com/opentracing/opentracing-go"
jaeger "github.com/uber/jaeger-client-go"
"github.com/uber/jaeger-client-go/config"
"github.com/uber/jaeger-client-go/rpcmetrics"
xkit "github.com/uber/ja... |
f900d221bad6c3e058f3859daa85f0fdea45e2d9 | 960b2ff9917e808824063f8dc42cf2a8cf2523ed | phsieh0821/fullstack | /api/middlewares/middlewares.go | Go | go | 624 | no_license | package middlewares
import (
"errors"
"net/http"
"github.com/phsieh0821/fullstack/api/auth"
"github.com/phsieh0821/fullstack/api/responses"
)
func SetMiddlewareJSON(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json"... |
822e59a8aecb102744919feca72c7566ac8c7e59 | afd3d88324e56aa7459c626deb449c832729b8d1 | ailabteam/Daily-Working | /GO-practices/blockchain/go-p2p-blockchain/dashboard-demo/1-server-simple.go | Go | go | 3,158 | permissive | package main
import (
"io"
"fmt"
"log"
"flag"
"time"
"strconv"
"net/http"
"math/rand"
"encoding/json"
"github.com/gorilla/mux"
"github.com/davecgh/go-spew/spew"
)
///// GLOBAL VARIABLES
var listenPort *int
type Product struct {
Name string `json:"Name"`
SerialNo ... |
be5b7c8138d246d9d0a64d8c3c9b2c840dee2dd3 | fcd5ce79e88d5d78eabb2a7a793b8173f898548d | serj-lubin/stolon | /cmd/sentinel/cmd/sentinel.go | Go | go | 68,402 | permissive | // Copyright 2015 Sorint.lab
//
// 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... |
6d65be6949844c38aa503a81cca12106738cb4c4 | f9b90504f46d8080d4cf4b8a56291abe8ccab66b | citrix/terraform-provider-citrixadc | /citrixadc/resource_citrixadc_vpnvserver_vpntrafficpolicy_binding_test.go | Go | go | 6,163 | permissive | /*
Copyright 2016 Citrix Systems, 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, softwar... |
ac58072c5f3fd28af15fd27b1b1bdce6ebe47190 | 505359e5c05bcf8182fdfc01c22c8095b32c1455 | tech-geek29/cluster-api-provider-aws | /pkg/cloud/scope/managedcontrolplane.go | Go | go | 12,370 | permissive | /*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
f6d63136ce271aee2d211e81193ae90e09ea5278 | 78a3348e8a5a8da1dc38b20f77e5ce67834c4d9b | NataliaZabelina/monitoring | /internal/app/monitoring.go | Go | go | 1,922 | no_license | package monitoring
import (
"context"
"time"
"github.com/NataliaZabelina/monitoring/internal/app/command"
"github.com/NataliaZabelina/monitoring/internal/config"
"github.com/NataliaZabelina/monitoring/internal/storage"
"go.uber.org/zap"
)
type Monitoring struct {
db *storage.DB
logger *zap.SugaredLogger
... |
72c2f93c8ebfb2079bedb519b84b70712fcbfbc2 | e48c4adabcecc45c1eea418afc490127007b72c1 | kubevirt/kubevirt | /cmd/network-slirp-binding/domain/domain_suite_test.go | Go | go | 800 | permissive | /*
* This file is part of the KubeVirt project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
c746e349af525f1d0ae68750ba6bf401f6541e32 | 04e245a69d4b888330484ca43689c1cf9cd2454b | catyguan/bma.go.esp | /src/esp/cluster/n2n/auth.go | Go | go | 3,861 | no_license | package n2n
import (
"acl"
"crypto/md5"
"esp/cluster/nodebase"
"esp/espnet/auth"
"esp/espnet/esnp"
"esp/espnet/espsocket"
"fmt"
"logger"
"math/rand"
"time"
)
type authReq struct {
NodeId nodebase.NodeId
Token string
}
func (this *authReq) String() string {
return fmt.Sprintf("[NodeId=%d, Token=%s]", th... |
be38d924d65e2b972f1b5f4157f88fa1795bc6ee | 67c8da35a492ae1c28e5f11d8b83abd925d0ba01 | sapcc/gophercloud-limes | /resources/client.go | Go | go | 636 | permissive | // Package resources provides integration between Limes and Gophercloud.
package resources
import (
"github.com/gophercloud/gophercloud"
)
// NewLimesV1 creates a ServiceClient that may be used to interact with Limes.
func NewLimesV1(client *gophercloud.ProviderClient, endpointOpts gophercloud.EndpointOpts) (*gopher... |
074a596087fe5b93e89c908df638271370396cb3 | 6dd3e53511effcf8a6c815086b6bddac165e9d24 | sudeepgoyal75/terraform-provider-nuagenetworks | /5.3.2/nuagenetworks/resource_nuagenetworks_captiveportalprofile.go | Go | go | 4,541 | no_license | package nuagenetworks
import (
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/5.3.2"
)
func resourceCaptivePortalProfile() *schema.Resource {
return &schema.Resource{
Create: resourceCaptivePortalProfileCreate,
Read: resourceCaptivePortalProfileRead,
... |
f9464bd593b6504d60351d6f569cd29a4b778d39 | 6e8d15f62bf572eb8a3a30d39e4c48066a9d3c0f | cuckooemm/teleport | /quic/inherit.go | Go | go | 4,993 | permissive | package quic
import (
"crypto/tls"
"fmt"
"net"
"os"
"strconv"
"strings"
"sync"
"github.com/henrylee2cn/goutil/graceful"
quic "github.com/lucas-clemente/quic-go"
)
// InheritedListen announces on the local network address laddr. The network net is "quic".
// It returns an inherited net.Listener for the match... |
e3c94f14acf0d7d3b444cb9485dab415e3f51654 | 39f19c4411294115c0c4ebaced824551432484a6 | dpb587/fly | /integration/sync_test.go | Go | go | 2,101 | permissive | package integration_test
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/ghttp"
)
var _ = Describe("Syncing", func() {
var (
atcServer *ghttp.Server
newF... |
f727e557369ada3a8cc93a2ef994556467aaccc7 | 440f8c042186f110241d1245b5f4140f2d3c6139 | henriqueholanda/photoprism | /internal/maps/maps.go | Go | go | 1,483 | permissive | /*
Package maps encapsulates external geolocation APIs.
Copyright (c) 2018 - 2020 Michael Mayer <hello@photoprism.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either vers... |
8c80ed5b81b3f81683ad2688390729a773d9ad7c | 178b48438d768a5816e875bf327e32227ca7ed74 | kamilwoloszyn/photo-cms | /models/utils_test.go | Go | go | 8,743 | permissive | package models_test
import (
"time"
"github.com/google/uuid"
"github.com/kamilwoloszyn/photo-cms/configs"
"github.com/kamilwoloszyn/photo-cms/models"
"github.com/kamilwoloszyn/photo-cms/pkg/database"
. "github.com/onsi/ginkgo"
"github.com/pkg/errors"
)
var _ = Describe("Util testing", func() {
})
func Conne... |
1554ea95ba8a1c6baa105fc5f018839c9bb186b1 | 9d067b58fe2a8b9a14c361a1cb3386d5938b16d4 | tangzixiang/mplus | /message/message.go | Go | go | 13,576 | permissive | package message
import (
"net/http"
"sync"
)
// MSGType 消息语言类别
type MSGType string
// 支持的语言类别
const (
MSGLangZH MSGType = "zh"
MSGLangEN MSGType = "en"
)
var defaultLang = MSGLangEN
type message struct {
StatusCode int
ErrorCode int
Callback
lock sync.Mutex
MessageStr map[MSGType]string
}
// Mes... |
98d26147df60dde93e97ed8cb8cd2c0717420649 | 86207dab98523646a0b225ea1cc8a80ccf553d4b | hcampbel/go-bdd-terratest | /main_test.go | Go | go | 1,555 | no_license | package go_bdd_terratest
import (
"errors"
"fmt"
"github.com/go-bdd/assert"
"github.com/gruntwork-io/terratest/modules/aws"
"testing"
"github.com/go-bdd/gobdd"
"github.com/gruntwork-io/terratest/modules/terraform"
)
var bucketName string
var region string
func setS3BucketContext(t gobdd.StepTest, ctx gobdd.... |
231ee181c4ab8da76ef9d360b603d88e2955bccb | 12b2970353159cf8891952f400c77f45e7b58df7 | kyma-incubator/compass | /components/hydrator/pkg/oathkeeper/req_data_parser.go | Go | go | 1,042 | permissive | package oathkeeper
import (
"encoding/json"
"io"
"net/http"
"github.com/kyma-incubator/compass/components/director/pkg/apperrors"
"github.com/kyma-incubator/compass/components/director/pkg/log"
"github.com/pkg/errors"
)
// NewReqDataParser missing godoc
func NewReqDataParser() *reqDataParser {
return &reqDat... |
b72074be36f9ae1d1de4eff59a8d973e2c1a7217 | 439441de5e22ab2db40c8133faf557dae4a4c019 | chouandy/goex | /gormex/loggable_callbacks.go | Go | go | 1,621 | no_license | package gormex
import (
"github.com/jinzhu/gorm"
)
const (
actionCreate = "create"
actionUpdate = "update"
actionDelete = "delete"
)
func init() {
gorm.DefaultCallback.Query().After("gorm:after_query").Register("loggable:query", loggableQuery)
gorm.DefaultCallback.Create().After("gorm:after_create").Register("... |
a01cbced6075ca7c85da9974557064876940b640 | 4b7405434bc661f9e1a0154c6e32d2910d07239f | luca-moser/iotacaddy | /caddyhttp/header/header_test.go | Go | go | 3,140 | permissive | // Copyright 2015 Light Code Labs, 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 agre... |
c11dd13b678152631c5f2df7ea00189df98c0471 | 7c269717706eccc2738b590b6526d9ca0eb2ca08 | hypermint/tm-pkcs11 | /privval/socket_dialers.go | Go | go | 980 | permissive | package privval
import (
"github.com/tendermint/tendermint/privval"
"net"
"time"
"github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tendermint/libs/common"
pkconn "github.com/hypermint/tm-pkcs11/conn"
)
// DialTCPFn dials the given tcp addr, using the given timeoutReadWrite and
// privKey for... |
b9bdbb81a1848ac57f14b9a5c388bd46863af163 | b9c7de4d77f746f6ed6dbb26f1c067eecce8b58f | convee/golab | /map/main.go | Go | go | 753 | no_license | package main
import (
"fmt"
"sort"
)
//map按照key顺序读取
func sortMapByKey(maps map[string]string) {
keys := []string{}
for k := range maps {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Println("key:", k, "value:", maps[k])
}
}
func sortMapByValue(maps map[string]string) {
values... |
2bcad5493ca126899661c2cef92a152076387ba6 | 98a48229c755517e9eff597cae1dfa944feaf5c4 | iridium-browser/iridium-browser | /third_party/dawn/tools/golang/src/net/sock_posix.go | Go | go | 7,014 | permissive | // Copyright 2009 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.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
package net
import (
"context"
"internal/poll"
"os"
"... |
9d71e426cff60435e8b7d55424eac904ed7fe9de | 99614f25866b379de591ac00a33f961a2b9a29f1 | SmartMeshFoundation/Photon | /cmd/tools/smoketest/cases/CConnecting2TokenNetwork.go | Go | go | 637 | no_license | package cases
import (
"net/http"
"time"
"github.com/SmartMeshFoundation/Photon/cmd/tools/smoketest/models"
)
// Connecting2TokenNetworkTest : test case for connect token network
func Connecting2TokenNetworkTest(env *models.PhotonEnvReader, allowFail bool) {
case1 := &APITestCase{
CaseName: "Connecting2TokenN... |
eaaa677bc913b869e568741191688878939b374c | 8d0b936daee9ecb5cd6bdeb359c30cd2cfc883ca | eduardofcgo/dedup | /file/search.go | Go | go | 885 | no_license | package file
import (
"log"
"os"
"path/filepath"
"time"
)
type File struct {
Path string
Size int64
ModTime time.Time
info *os.FileInfo
}
func Search(folderPath string) ([]File, error) {
var files []File
alreadyFound := func(info os.FileInfo) bool {
for _, file := range files {
//TODO: We sh... |
67dbef6d8a76c9bd8762c8c5974395997cad6949 | 33e5ae79abc72a5c382ca7c272d0fb0f557aed9a | dwburke/ynab.go | /api/budget/service.go | Go | go | 2,313 | permissive | package budget
import (
"fmt"
"go.bmvs.io/ynab/api"
)
// NewService facilitates the creation of a new budget service instance
func NewService(c api.ClientReader) *Service {
return &Service{c}
}
// Service wraps YNAB budget API endpoints
type Service struct {
c api.ClientReader
}
// GetBudgets fetches the list ... |
bd3f5dc2d6075bd9da3198a0fb8c3b64a712047b | 0591b6dc9c04bfeb27185ae437f1081c1bae4a80 | cnh/origin | /pkg/deploy/generator/rest.go | Go | go | 849 | permissive | package generator
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
deployapi "github.com/openshift/origin/pkg/deploy/api"
)
// REST is a RESTStorage implementation for a DeploymentConfigG... |
0fa8bb65f328afbd1f414b06701315cbc9341033 | 4806383357cae3e7d8c3d4a272347b95fd0f51e8 | aerostitch/kubernetes-node-terminator | /aws_ec2.go | Go | go | 1,248 | permissive | package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/golang/glog"
)
type awsEc2 interface {
terminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
}
type awsEc2Client struct {
session *... |
eb697afbca1636b27b2fddad75ba98041f518235 | 0891cc3515417ee74965564e30a819b2951e1977 | kthatoto/termworld | /app/commands/play.go | Go | go | 1,324 | no_license | package commands
import (
"os"
"fmt"
"bufio"
"strings"
"net/rpc"
"github.com/spf13/cobra"
)
func init() {
rootCommand.AddCommand(playCommand)
}
var playCommand = &cobra.Command{
Use: "play",
Short: "Play command",
RunE: func(cmd *cobra.Command, args []string) error {
if (len(args) == 0) {
fmt.Println... |
6e782ee7032e049493b96576f7fcfbe421260271 | 1f66af8509fe88cf9ed796d8b125233f3e2c2c71 | forging2012/go-backend | /user_interface/resource/auth_resource/login_test.go | Go | go | 1,580 | permissive | package auth_resource
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/emicklei/go-restful"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
func TestLoginSuccess(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
wsContainer := restful.NewCont... |
2af1a63e9bfecfa705827a16db363c8ea6a33f65 | f034847f28234d7ff37d56aa1f39b92bf6c871e1 | DevopsArtFactory/klocust | /pkg/klocust/apply_test.go | Go | go | 1,343 | permissive | /*
Copyright 2020 The klocust Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
d16fe5fa90ca62169efc4f668d1290ff39c3b706 | 8ce39df8d7654960d0377e56e994d441556c3f19 | mbenkmann/aptly | /cmd/cmd.go | Go | go | 4,056 | permissive | // Package cmd implements console commands
package cmd
import (
"bytes"
"fmt"
"os"
"text/template"
"time"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/deb"
"github.com/smira/commander"
"github.com/smira/flag"
)
// Various command flags/UI things
const (
Yes = "yes"
No = "no"
)
// ListPackagesR... |
e3d909aa3826067bac6ad57f0c6073f3dbc0e936 | d496934a41777b2bb5b1111df5a7d5c776e51f36 | caputomarcos/tsuru | /cmd/cmd.go | Go | go | 13,029 | permissive | // Copyright 2015 tsuru 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 cmd
import (
"bytes"
gerrors "errors"
"fmt"
"io"
"net/http"
"os"
"sort"
"strconv"
"strings"
"github.com/sajari/fuzzy"
"github.com/tsuru/tsur... |
e853e5de1bc3cca347e4a3616ecd727ffcee6755 | fadcb942ac7ce7bba9a5acd1757b9b314409bd01 | adrianbrs/fbreqs | /console/logger.go | Go | go | 1,785 | no_license | package console
import (
"strings"
"github.com/fatih/color"
)
// Info ...
func Info(msg string, args ...interface{}) {
color.New(color.BgHiCyan).Print(" ")
color.New(color.FgCyan).Printf(LeftW("[INFO] ", consoleConfig.LeftOffset)+msg+"\n", args...)
}
// Warn ...
func Warn(msg string, args ...interface{}) {
col... |
032a51d56fe03a72a3885c93cc3f48b9d150f2cc | 68ac2fd1c285e6b3a26db3595471b1768d42f18e | sudeepgoyal75/terraform-provider-nuagenetworks | /5.4.1/nuagenetworks/resource_nuagenetworks_firewallrule.go | Go | go | 15,026 | no_license | package nuagenetworks
import (
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/5.4.1"
)
func resourceFirewallRule() *schema.Resource {
return &schema.Resource{
Create: resourceFirewallRuleCreate,
Read: resourceFirewallRuleRead,
Update: resource... |
3c179d87ea4959ef2f3f2093de1420f4e9f73185 | 68c28ce9d41119fa869367d09f93d4531b62893e | Emreu/goqu | /dataset_test.go | Go | go | 35,998 | permissive | package goqu
import (
"database/sql/driver"
"fmt"
"regexp"
"testing"
"time"
"github.com/c2fo/testify/assert"
"github.com/c2fo/testify/suite"
)
type datasetTest struct {
suite.Suite
}
func (me *datasetTest) Truncate(buf *SqlBuilder) *SqlBuilder {
buf.Truncate(0)
buf.args = make([]interface{}, 0)
return bu... |
b84e4d9d047bd745783104bff0b8fa55293d2ac3 | 7386ddcd8aee2b25591aa08c2c81e7321bfc5d2c | mohamedkashifuddin/Web-application-with-golang | /pkg/mod/golang.org/x/tools@v0.0.0-20200226224502-204d844ad48d/internal/lsp/highlight.go | Go | go | 1,133 | permissive | // Copyright 2019 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 lsp
import (
"context"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/lsp/teleme... |
ff4144306ee851d0adfe22170cc688e584ed734b | a4c18b787699094f52bee7e5cdb83a46a6c3e500 | kaiCu/magnacarto | /regression/regression_cases_test.go | Go | go | 2,019 | permissive | package regression
import (
"testing"
)
func Test_010_linestrings_default(t *testing.T) { testIt(t, testCase{Name: "010-linestrings-default"}) }
func Test_011_linestrings_cap_end(t *testing.T) { testIt(t, testCase{Name: "011-linestrings-cap-end"}) }
func Test_012_linestrings_dasharray(t *testing.T) {
testIt(t, t... |
85db9577dbae06bd35f57f7b4f29f76a26b59302 | 0e2c2758d84d92b5f9b6a503c9d91321df29c182 | kerthcet/kubeedge | /cloud/pkg/cloudhub/servers/httpserver/signcerts.go | Go | go | 3,726 | permissive | /*
Copyright 2020 The KubeEdge 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, sof... |
1669b0eeb9fe6fe255f5926ca2f5d44ebefd43c7 | 5a2052d6b7a7039bd09656f21da99eec55916637 | lyouthzzz/framework | /pkg/bytex/pool.go | Go | go | 233 | no_license | package bytex
import (
"bytes"
"sync"
)
type Pool struct {
p *sync.Pool
}
func (p Pool) Get() *bytes.Buffer {
buf := p.p.Get().(*bytes.Buffer)
buf.Reset()
return buf
}
func (p Pool) Put(buf *bytes.Buffer) {
p.p.Put(buf)
}
|
bef06f148b3e77a4a53c12e07dafd09790559610 | 5bef0337b6daba94e1b4e82d22d09815eb20000a | avhimkov/TgBoot | /main.go | Go | go | 9,696 | permissive | package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"log"
"net/http"
"os"
"strings"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
type Config struct {
TelegramBotToken string
BotanApiToken string
}
type BotanMessage struct {
Text string
ChatId int
}
func MainHandler(resp http... |
78c30f5b531b39f2caec7730575b186a9773e323 | 8f835194d965dd3bdfd2c37ab2cb4782d84eaa0b | HyperLiar/leetcode | /31.next-permutation.go | Go | go | 573 | no_license | /*
* @lc app=leetcode id=31 lang=golang
*
* [31] Next Permutation
*/
// @lc code=start
func nextPermutation(nums []int) {
i := len(nums) - 2
for i >= 0 && nums[i+1] <= nums[i] {
i--
}
// i is the min index out of ascending order
if i >= 0 {
// find the pos to swap with i
j := len(nums) - 1
for j >=... |
666f95fdc7f061ebf83064a18f92daa5045d0fad | 45847838d9017e94cd43a809bc1697c71d63cddd | shevilangle/qmgo | /collection_test.go | Go | go | 17,724 | permissive | /*
Copyright 2020 The Qmgo 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, sof... |
5931716267c03411709eeada86527b4e0ede5660 | c8a1f7a91338f48ca6ced38e15fcc52d3e685808 | sjindal22/aws-sdk | /main.go | Go | go | 1,512 | no_license | package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
func createSession(r string, prof string) *session.Session {
sess, err := session.NewSessionWithOptions(session.Options{
Config: aws.Config{
Region: aws.String(r),
... |
4820646dc183178ac2b173dcbb689d1bf00fbc8e | 8a8d38ff743a6a1d513543167c0cda849100bffc | mikqi/wtf | /wtf.go | Go | go | 5,886 | permissive | package main
import (
"fmt"
"log"
"os"
"time"
"github.com/gdamore/tcell"
"github.com/olebedev/config"
"github.com/radovskyb/watcher"
"github.com/rivo/tview"
"github.com/senorprogrammer/wtf/bamboohr"
"github.com/senorprogrammer/wtf/clocks"
"github.com/senorprogrammer/wtf/cmdrunner"
"github.com/senorprogram... |
2308c57d2109bdff24888391f2f710bfb7f30bba | bf4688dfda80cc89160260fff1bcd0b9b755578b | watermint/toolbox | /infra/control/app_opt/common.go | Go | go | 4,038 | permissive | package app_opt
import (
"encoding/json"
"github.com/watermint/toolbox/essentials/model/mo_string"
"github.com/watermint/toolbox/infra/control/app_budget"
"io/ioutil"
"runtime"
)
const (
OutputNone = "none"
OutputText = "text"
OutputMarkdown = "markdown"
OutputJson = "json... |
2fd2a959ac99009e7435a1391ba7effe36da4e38 | 176b6e5a390af41846076a9ff7160b104bf15048 | oneweek20169902/algorithm | /main.go | Go | go | 2,073 | no_license | package main
import (
"algorithm/action"
"fmt"
"math/rand"
"time"
)
type Node struct {
item int
next *Node
}
func createLink(li []int) Node {
head := Node{item: li[0]}
for i := 1; i < len(li); i++ {
node := Node{item: li[i]}
node.next = &head
head = node
}
return head
}
func isUnique(astr string) bo... |
fd6452889cfde7375345f3b7360625a8217ad540 | 552303c2d249a6592ec1743cdc75a8b50a4760a0 | omuron/ecs-plugin | /pkg/console/progress_test.go | Go | go | 1,532 | permissive | package console
import (
"fmt"
"testing"
"gotest.tools/v3/assert"
)
func TestProgressWriter(t *testing.T) {
c := &bufferConsole{}
p := progress{
console: c,
}
p.ResourceEvent("resource1", "CREATE_IN_PROGRESS", "")
assert.Equal(t, c.lines[0], "resource1 ... CREATE_IN_PROGRESS ")
p.ResourceEvent("resource2... |
0d6fd5557be900c0b95daa910b18628193e0c37b | 6d5b731b0b43d50cbfe44c771e56b67f9fd038af | obasajujoshua31/go-blog-app | /api/repository/repository_users.go | Go | go | 348 | no_license | package repository
import "github.com/obasajujoshua31/blogos/api/models"
type UserRepository interface {
Save(models.User) (models.User, error)
FindAll() ([]models.User, error)
FindByID(uint32) (models.User, error)
Update(uint32, models.User) (models.User, error)
FindByEmail(string) (models.User, error)
// Dele... |
7eced8e16e20db3dc6ebaf288c96404fe6a73551 | 30b3f81b69e818dded8da522030c16140fbda752 | coolzhang/vitess | /go/vt/topo/helpers/tee_topo_test.go | Go | go | 2,341 | permissive | // Copyright 2013, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package helpers
import (
"fmt"
"testing"
"code.google.com/p/go.net/context"
"github.com/youtube/vitess/go/vt/topo"
"github.com/youtube/vitess/go/vt/topo/te... |
78ba177d6ece7fa2564294755c663d86344d61b9 | 0272ef85a4ccfd48d309920445658f052ec77b6c | kubernetes/kubernetes | /vendor/go.opencensus.io/tag/map.go | Go | go | 5,690 | permissive | // Copyright 2017, OpenCensus Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
606624e9b52723bc452baa90332f3bc413005a73 | 9ec4710bdd7a169762dc98b770ebf7257a2ecf7a | floriecai/ink-blockchain | /misc/encrypt.go | Go | go | 2,127 | no_license | package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"encoding/hex"
"fmt"
"os"
)
// To encode publicKey use:
// publicKeyBytes, _ = x509.MarshalPKIXPublicKey(&private_key.PublicKey)
// Private Key:
// 3081a40201010430d35b96ee7ced244b5a47de8968b07ecd38a6dd756f0ffb40a72ccd5895e96f2... |
413e8087d80bbe0351762b8a6780cbb204922bad | bd9492b5a7f4bc36a330c8f42163ce3338dee58b | morrell/pulumi-azure-native | /sdk/go/azure/scheduler/v20140801preview/getJobCollection.go | Go | go | 1,318 | 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 v20140801preview
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupJobCollection(ctx *pulumi.Context, args *LookupJobCollectionArgs, opts... |
9161b6a45665be47acc527057e9f72d65677d1c9 | f16fb0171bdbd625facacaaf21ef6b8c5143341e | vmlemon/eve | /pkg/pillar/cmd/zedmanager/memorysizemgmt.go | Go | go | 1,637 | permissive | // Copyright (c) 2021 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package zedmanager
import (
"fmt"
"github.com/lf-edge/eve/pkg/pillar/types"
)
// getRemainingMemory returns how many bytes remain for app instance usage
// which is based on the running and about to run app instances.
// It also returns a c... |
c68ab4cbdb2008102134e748f541c2090dd290b2 | 2c106f952f606e41abb085d8b99c4699b7510301 | thought-machine/finance-messaging | /iso20022/seev/MeetingResultDisseminationV05.go | Go | go | 3,337 | permissive | package seev
import (
"encoding/xml"
"github.com/thought-machine/finance-messaging/iso20022"
)
type Document00800105 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:seev.008.001.05 Document"`
Message *MeetingResultDisseminationV05 `xml:"MtgRsltDssmntn"`
}
func (d *Document00... |
40e70c6945e6dc5d1de1543fb3f981e2b012625d | 2291ff501ae102e6d924d396f0d9b6c5b9763069 | kempeng/gocryptotrader | /currency/forexprovider/currencylayer/currencylayer_test.go | Go | go | 1,576 | permissive | package currencylayer
import (
"testing"
"github.com/thrasher-/gocryptotrader/decimal"
)
var c CurrencyLayer
// please set your API key here for due diligence testing NOTE be aware you will
// minimize your API calls using this test.
const (
APIkey = ""
Apilevel = 3
)
func TestGetRates(t *testing.T) {
_, er... |
deef1d699ec3dd331e7cf43ec95093f542787c3d | d9f693c2de93e5c6143311bd0bb0e466504c4138 | yanlingli3799/algorithm | /Week_02/id_7/type.go | Go | go | 657 | no_license | package geekcode
/*
二叉树基本类型定义,及常用方法添加,
左边加入节点,
右边加入节点,
左右两边同时加入数据
同时返回加入后新生成的节点
*/
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func Node(val int) *TreeNode {
return &TreeNode{val, nil, nil}
}
func (self *TreeNode) addLeft(l int) *TreeNode {
self.Left = Node(l)
return self.Left
}
func (s... |
8f952e28919d843d9a536a5a736de186ef7ab8e8 | 40e31be900e337a1c9bf5c351453f8c5693d43c6 | bububa/opentaobao | /model/alsc/VoucherSendOpenReq.go | Go | go | 895 | permissive | package alsc
// VoucherSendOpenReq 结构体
type VoucherSendOpenReq struct {
// 外部品牌ID
OutBrandId string `json:"out_brand_id,omitempty" xml:"out_brand_id,omitempty"`
// 请求id
RequestId string `json:"request_id,omitempty" xml:"request_id,omitempty"`
// 品牌id
BrandId string `json:"brand_id,omitempty" xml:"brand_id,omitem... |
0560ac5b8b1d9750058e35bfc82706c6b5c3c2ff | 79a41932cda567ebc6b87b37a51621685e9cc96b | xzwl233/zed | /expr/shaper.go | Go | go | 13,258 | permissive | package expr
import (
"fmt"
"github.com/brimdata/zed/zcode"
"github.com/brimdata/zed/zng"
"github.com/brimdata/zed/zson"
)
// A ShaperTransform represents one of the different transforms that a
// shaper can apply. The transforms are represented as a bit flags that
// can be bitwise-ored together to create a si... |
8d34ce8e8a5faf360ef7a4840c01a7ca9a3389d8 | cae855df082efc611c737cf0d93aac8cc52f7e07 | zhenyu-sha/tegola | /mvt/cleanline_internal_test.go | Go | go | 1,992 | permissive | package mvt
import (
"testing"
"github.com/go-spatial/tegola"
"github.com/go-spatial/tegola/basic"
)
func TestCleanline(t *testing.T) {
type tcase struct {
line basic.Line
expected basic.Line
}
fn := func(tc tcase) func(t *testing.T) {
return func(t *testing.T) {
el := cleanLine(tc.line)
if !... |
e1a5b9d04a3b05952f325de8a0908d79ce579373 | 2c5690ad7116c9391c76f852c67e8ec1e86e5d3f | zero101010/go-gin-api | /controllers/foods.go | Go | go | 2,090 | no_license | package controllers
import (
"context"
"fmt"
"go-gin-api/database"
"go-gin-api/models"
"net/http"
"time"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"gopkg.in/mgo.v2/bson"
)
var foodCollection *mongo.Collection = database.OpenCollection(databa... |
c7f5d89e2c72ef22a5406647044ac4f3d542968e | 8c417f0e4f4d2af981ccce01575769d2d7ee28f9 | rhcarvalho/decrypt-ola | /adfgx/adfgx.go | Go | go | 473 | no_license | // http://en.wikipedia.org/wiki/ADFGVX_cipher
package main
import (
"fmt"
"strings"
)
func Decode(code string) byte {
table := "btalpdhozkqfvsngicuxmrewy"
label := "ADFGX"
row := strings.Index(label, code[0:1])
col := strings.Index(label, code[1:2])
return table[row*5+col]
}
func main() {
m := "AD XF AF XA D... |
d91111bd8a7f1a6edb4ae2755afdeb0d601da9e1 | a02808dbc30447afecf395a6eb61f755125ef138 | macroblock/imed | /pkg/cli/error.go | Go | go | 2,209 | permissive | package cli
import (
"fmt"
"strings"
)
type (
tErrorHandler func(error) (string, error)
// IOnError -
IOnError interface {
HandleError(error) (string, error)
}
tInternalError struct {
msg string
}
// TErrorNotEnoughArguments -
TErrorNotEnoughArguments struct {
msg string
}
)
// ErrorNotEnoughArgume... |
bbf9c740b7ab95243973fe6affb635e43c0a012e | c1f9207fd92389136502726af10aafe16f108427 | b3nnb/gosal | /sal/sal_test.go | Go | go | 1,710 | permissive | package sal
import (
"net/http"
"net/http/httptest"
"net/url"
"testing"
)
func TestCheckin(t *testing.T) {
// test values
serial := "foo"
values := url.Values{
"serial": []string{serial},
"sal_version": []string{"bar"},
}
// create a fake API endpoint served by the test server
checkin := func(w ht... |
2b6dca16c777d53be4a442d9590e742f61707c80 | f77713223730f27790d781bf9513ca6a260cc22d | ecojuntak/go-my-rabbit | /work-queue/receive.go | Go | go | 1,657 | no_license | package main
import (
"bytes"
"log"
"time"
"github.com/streadway/amqp"
)
const QUEUE_NAME = "hello"
func failOnError(err error, msg string) {
if err != nil {
log.Fatalf("%s: %s", msg, err)
}
}
func connectToServer() *amqp.Connection {
conn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
failOnErr... |
61e2bbeeeab7e7787a39e84a8bb564f0798e2de7 | eba6b5714117ee8aa1cb0ec1e548e82ce52198b7 | smartsdk/ngsi-timeseries-api-go | /go-server/go/routers.go | Go | go | 3,101 | permissive | package
import (
"net/http"
"fmt"
"github.com/gorilla/mux"
)
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type Routes []Route
func NewRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
var handl... |
6527642e2ff65562cef8681ae8a749fe21d98cfb | 53bd9b12ed0791f346e8c127ae189cbaff75af74 | rdrake/kubernetes | /test/integration/garbagecollector/garbage_collector_test.go | Go | go | 17,701 | permissive | // +build integration,!no-etcd
/*
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 applicab... |
bfa67174d2666b73cca484c808d834568739008d | a3219197aae85b77fb3932a39d7b97de3c0fd5fe | michaelorr/studious-broccoli | /go/raindrops/raindrops.go | Go | go | 341 | no_license | package raindrops
import (
"bytes"
"fmt"
)
const testVersion = 2
func Convert(n int) string {
var buf bytes.Buffer
if n%3 == 0 {
buf.WriteString("Pling")
}
if n%5 == 0 {
buf.WriteString("Plang")
}
if n%7 == 0 {
buf.WriteString("Plong")
}
res := buf.String()
if res == "" {
res = fmt.Sprintf("%d",... |
a6b181ba49473949743f38a3f32e83852528c381 | ce1c79052526b8e87c5f3effc4530587470bd99b | alibaba/pipelines | /backend/src/crd/controller/scheduledworkflow/util/periodic_schedule_test.go | Go | go | 3,555 | 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 writ... |
66927b367fe0e6eabd1041abd2244e2db4be9290 | a91d2848f4e02906a82743b30fd72fcda41e5c81 | ommadawn46/gopl | /ch02/ex04/popcount.go | Go | go | 479 | no_license | package popcount
var pc [256]byte
func init() {
for i := range pc {
pc[i] = pc[i/2] + byte(i&1)
}
}
func PopCountTable(x uint64) int {
return int(
pc[byte(x>>(0*8))] +
pc[byte(x>>(1*8))] +
pc[byte(x>>(2*8))] +
pc[byte(x>>(3*8))] +
pc[byte(x>>(4*8))] +
pc[byte(x>>(5*8))] +
pc[byte(x>>(6*8))] ... |
5c745030028ef5f2ecc23f2610023d0cdcdd67f6 | 7de886865a4b367f242298218aa151312157f584 | swetakedia/test | /services/testhorizon/internal/reap/system.go | Go | go | 2,120 | permissive | package reap
import (
"time"
"github.com/test/go/services/testhorizon/internal/errors"
"github.com/test/go/services/testhorizon/internal/ledger"
"github.com/test/go/services/testhorizon/internal/toid"
"github.com/test/go/support/log"
)
// DeleteUnretainedHistory removes all data associated with unretained ledge... |
5fc98026b6392395d7e9c952742a11eefb320779 | b79c3f56885be7e8b87160736d7fef3652cc7d22 | li-bit/go-nsq | /doc.go | Go | go | 1,978 | permissive | /*
Package nsq is the official Go package for NSQ (http://nsq.io/).
It provides high-level Consumer and Producer types as well as low-level
functions to communicate over the NSQ protocol.
Consumer
Consuming messages from NSQ can be done by creating an instance of a Consumer and supplying it a handler.
type myMessa... |
c05db8d7aa11e507303cb40b8eeaa9584589e360 | c47b407507ad18601278f6a7a055100da55b511d | AndreyBronin/insolar | /cmd/insolard/main.go | Go | go | 3,197 | permissive | //
// Copyright 2019 Insolar Technologies GmbH
//
// 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... |
743997cc210e305b47e36a3ed8009c7853a35cab | a5e5eaabb99c08ef886d7d6e163f844f36cb0e88 | kabychow/go-mosestokenizer | /nonbreaking_prefix/data/ga.go | Go | go | 780 | permissive | package data
var GA = map[string]interface{}{
"a": nil,
"b": nil,
"c": nil,
"d": nil,
"e": nil,
"f": nil,
"g": nil,
"h": nil,
"i": nil,
"j": nil,
"k": nil,
"l": nil,
"m": nil,
"n": nil,
"o": nil,
"p": nil,
"q": nil,
... |
79ce2c23de0f22f67eddf4cd47528e541938228d | 9b816032f030a4c354220d45d84ca82e4001dcfd | hklhai/kubevela | /references/cli/top/view/app_test.go | Go | go | 2,354 | permissive | /*
Copyright 2022 The KubeVela 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, softw... |
ede5e6a7dddc2fb54287198b91ba2a73256550b7 | 6bb61fa4d4972a524c5dc79be1cfda5d76408c3e | iwasawahideto/graphql_sample | /graph/resolver.go | Go | go | 248 | no_license | package graph
import (
"graphql_sample/graph/model"
)
// This file will not be regenerated automatically.
//
// It serves as dependency injection for your app, add any dependencies you require here.
type Resolver struct{
todos []*model.Todo
}
|
96b1d5271df5c064f3720cd1b25a6177b1f8083d | 4662dcfda275bf4f7c243b6ab85d2065f903daab | gr33nh00d/rocket | /rkt/rkt.go | Go | go | 3,381 | permissive | // Copyright 2014 CoreOS, 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... |
7b89bf294e9574533244e249812db04cb920664d | b764df80a9e04db40a7310a8e6d3a0b99efbd0a0 | smsouthard/kubernetes | /pkg/apis/batch/types.generated.go | Go | go | 59,799 | permissive | /*
Copyright 2015 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
dacefe593250bcd2ba962e7729f4904ff4765af7 | c402fc0127e15a3f4e02820ed8c50f4f5f0d984d | advance512/rack | /provider/aws/aws_test.go | Go | go | 1,324 | permissive | package aws_test
import (
"bytes"
"net/http/httptest"
"os"
"github.com/convox/logger"
"github.com/convox/rack/pkg/structs"
"github.com/convox/rack/pkg/test/awsutil"
"github.com/convox/rack/provider/aws"
)
func init() {
logger.Output = &bytes.Buffer{}
}
type AwsStub struct {
*aws.Provider
server *httptest.... |
f17d95d4f69a2596ea4c9e9eb2b223e5407c0116 | 3a4da301bac37da62b6541ed4ead99194629db91 | aravindtj/sflow | /flow_record.go | Go | go | 4,088 | permissive | package sflow
import (
"encoding/binary"
"io"
"net"
)
type RawPacketFlowRecord struct {
Protocol uint32
FrameLength uint32
Stripped uint32
HeaderSize uint32
Header []byte
}
type EthernetFrameFlowRecord struct {
Length uint32
SourceMac net.HardwareAddr
DestMac net.HardwareAddr
Type u... |
8eeb5dfcf87bf5acc93cee5741a25bb8ce0bd767 | baa85c475156c4b09dc139d84e7171b76f4a3505 | openshift/installer | /vendor/github.com/microsoftgraph/msgraph-sdk-go/communications/onlinemeetings/item/attendancereports/count/count_request_builder.go | Go | go | 3,918 | permissive | package count
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
)
// CountRequestBuilder provides ... |
e167e7d10dcf2bf1c7b173b29a5738f167257c72 | b4129653063a3f58ef85f7c1c9c7fe63d58ba781 | tchssk/tagiron | /game.go | Go | go | 366 | no_license | package main
type Game struct {
Tiles Tiles
Stock Questions
Questions Questions
Players Players
}
func NewGame() Game {
var (
tiles = NewTiles()
stock = NewQuestions()
)
tiles.Shuffle()
stock.Shuffle()
questions := stock.Remove(0, 6)
return Game{
Tiles: tiles,
Stock: stock,
Quest... |
fdff0bf1ca1beeaa302cde9676fdbf6ba68443ad | c265c9859c0ae7a206f8f5d3fd48ca4b0e3f5c57 | wang502/go-collections | /lru/lru_test.go | Go | go | 1,752 | permissive | package lru
import(
"testing"
)
const iterations = 10
func TestNewLRU(t *testing.T) {
lru1 := NewLRU(10)
if lru1 == nil{
t.Errorf("NewLRU() expected to return pointer to LRU struct, but returned nil instead")
}
lru2 := NewLRU(-1)
if lru2 != nil{
t.Errorf("NewLRU() expected to ... |
56666377e4d7e78d27703315dba72a7bfe478369 | 9f78ed2137657c2dc120a866077917fc4b3aa1f0 | rawlingsj/jx-helpers | /pkg/gitclient/setup.go | Go | go | 4,570 | permissive | package gitclient
import (
"os"
"os/user"
"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
"github.com/jenkins-x/jx-api/v4/pkg/util"
"github.com/jenkins-x/jx-helpers/v3/pkg/homedir"
"github.com/jenkins-x/jx-helpers/v3/pkg/kube"
"github.com/jenkins-x/jx-logging/v3/pkg/log"
"github.com/pkg/errors"
)
var (
... |
6e76279f1d5833fa8919cde98621bd00ad5a2df3 | a0379edbb91ffb517805ddc6b72c23031c0a830e | Jiasm/algs4 | /src/chapter1/section1/three-equal.go | Go | go | 271 | no_license | package main
import (
"fmt"
"os"
"strconv"
)
func main() {
var cur int
first, _ := strconv.Atoi(os.Args[1])
for _, v := range os.Args[2:4] {
cur, _ = strconv.Atoi(v)
if cur != first {
fmt.Println("not equal")
return
}
}
fmt.Println("equal")
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.