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 |
|---|---|---|---|---|---|---|---|---|
ac58c0060b11fe65bde46d862f9c7c0515fa8b37 | c431f315a42e60c16d7e53c92643487d37c752a9 | ladydascalie/core | /pagination/pagination_test.go | Go | go | 3,355 | permissive | package pagination_test
import (
"encoding/json"
"fmt"
"net/http"
"testing"
"github.com/LUSHDigital/core/pagination"
"github.com/LUSHDigital/core/rest"
)
// TestMakeResponse tests that the response is being tested
func TestMakeResponse(t *testing.T) {
tt := []struct {
name string
perPage ... |
1ced6c2c020f1b63ec2c6215f8dfbbd5f71ba30d | 802d186f3f29fbf2954805444bacc1426bb7a446 | sgtest/monorepo-test-3 | /kubernetes-7/pkg/volume/cinder/attacher_test.go | Go | go | 19,249 | permissive | /*
Copyright 2016 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, ... |
7da0a5fb814325b62e52d46a3cf447f6ba05e626 | ac8e48f55241577c2ebc9901d90d57309bb296f1 | rosbit/go-wxpay-gateway | /wx-pay-api/refund.go | Go | go | 3,610 | permissive | // +build gateway
package wxpay
import (
"fmt"
)
type FnRefund func(appId,mchId,mchApiKey,id,refundId string,totalFee,refundFee int, refundReason,refundNotify,certFile,keyFile string, isSandbox bool) (res *RefundResultParams, sent, recv []byte, err error)
func RefundByTransactionId(
appId string,
mchId s... |
139e99ac49a127d19ace82396ca11421bb191e3b | 748976c00e802459bd7155d073a47325099a56e8 | splunk/splunk-cloud-sdk-go | /cmd/scloud/cmd/collect/collect-gen.go | Go | go | 9,623 | permissive | // Package collect -- generated by scloudgen
// !! DO NOT EDIT !!
//
package collect
import (
"github.com/spf13/cobra"
impl "github.com/splunk/splunk-cloud-sdk-go/cmd/scloud/pkg/collect"
)
// createExecution -- Creates an execution for a scheduled job based on the job ID.
var createExecutionCmd = &cobra.Command{
U... |
a371b2b3b8d916061f83082255569d760ed62d61 | ff3d682063068923a52ca395fbb6ee0be9c62fb9 | replicatedhq/kots | /cmd/kots/cli/version.go | Go | go | 1,904 | permissive | package cli
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
"github.com/replicatedhq/kots/pkg/buildversion"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
type VersionOutput struct {
Version string `json:"version"`
LatestVersion string `json:"latestVersion,omitempty"`
InstallLatest string ... |
ff50e15cf651f5fd0cff7bdf8e5a2c063e1d2647 | 667082fe462101a34fa7df684679d2cf79d83f3a | treaster/codepatterns | /store/impl.go | Go | go | 1,461 | no_license | package store
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
type memImpl struct {
data map[string]string
}
func (i *memImpl) Get(key string) (string, error) {
if i.data == nil {
return "", fmt.Errorf("key %q not found", key)
}
value, hasKey := i.data[key]
if !hasKey {
return "", fmt.Errorf("key %q ... |
2e3ecbd2c83018931b27bc3335873af93519a28b | 213cf6df6e52e0989b47f9095dacf60c6e8a1068 | wkirschbaum/neogo | /neogo.go | Go | go | 5,990 | no_license | // Copyright 2014 Paul Jolly <paul@myitcv.org.uk>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package neogo
import (
"fmt"
"strings"
"go/ast"
"go/parser"
"go/token"
"github.com/myitcv/neovim"
)
type Neogo struct {
c *neovim.Cl... |
59cbfb34324ebbebd056878acf66ee30f7cc0317 | 60b64ca4b8bb7b21ededb5d7cafcbf308c4faedb | halkeye/flexvolume | /commands.go | Go | go | 2,507 | no_license | package flexvolume
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
"github.com/urfave/cli"
"os"
)
// Commands is a list of actions supported by this flex volume
func Commands(fv FlexVolume) []cli.Command {
var commands []cli.Command
commands = append(commands, cli.Command{
Name: "init",
Usage: "Ini... |
2eb858f27187f3373a5d242ef91d52abc2981d21 | 1073ede9284d06f65e3b3620bf3064ad5bc2506e | erwinloar92/client | /go/teams/implicit_test.go | Go | go | 29,130 | permissive | package teams
import (
"encoding/hex"
"fmt"
"strings"
"testing"
"time"
"golang.org/x/net/context"
"github.com/davecgh/go-spew/spew"
"github.com/keybase/client/go/externals"
"github.com/keybase/client/go/kbtest"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/keybase1"
"github.... |
4637983cd6772a5427fd88fd4031c59b7305691a | 8af6b4761470fbbeba9920947c580b9832393889 | stormnoms/nomsredis | /cmd/noms/noms_version.go | Go | go | 835 | permissive | // Copyright 2016 Attic Labs, Inc. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0
package main
import (
"fmt"
"os"
"github.com/stormasm/nomsredis/cmd/util"
"github.com/stormasm/nomsredis/go/constants"
flag "github.com/juju/gnuflag"
)
var no... |
e57f0f65cc9a8ad05351c81a8e7fd057f57a244b | d811d63ee44d61d92292f57c2e710ba4e64f390e | jwelch92/newrelic-kubernetes-operator | /controllers/alerts_policy_controller_integration_test.go | Go | go | 45,589 | permissive | // +build integration
package controllers
import (
"context"
"errors"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/newrelic-client-go/pkg/alerts"
ctrl "sigs.k8s.io/controller-runtime"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
nrv1 "github.com/newrelic/newrelic-kubern... |
9503be6318cdd2d497e53f9726d0949bb1bdc444 | 351333e9ce7053e1c402417bf485694049c895f9 | Elegenthus/fabric | /gossip/protoext/msgcomparator_test.go | Go | go | 11,070 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package protoext_test
import (
"testing"
"github.com/Elegenthus/fabric-protos-go/gossip"
"github.com/hyperledger/fabric/gossip/common"
"github.com/hyperledger/fabric/gossip/protoext"
"github.com/stretchr/testify/assert"
)
func ... |
278617b2d9b10fb7d9eea9bad464f2e91c0c0bf4 | 1cba1fe2d1a6ce2d846160786cb82c72512d714d | alex/zlint | /lints/lint_sub_cert_key_usage_crl_sign_bit_set_test.go | Go | go | 881 | permissive | // lint_sub_cert_key_usage_crl_sign_bit_set_test.go
package lints
import (
"testing"
)
func TestCrlSignBitSet(t *testing.T) {
inputPath := "../testlint/testCerts/subKeyUsageInvalid.pem"
desEnum := Error
out, _ := Lints["e_sub_cert_key_usage_crl_sign_bit_set"].ExecuteTest(ReadCertificate(inputPath))
if out.Result... |
b547a22bafda6a16c1ca504e601de4da89e6717f | c0b9fef5bf747855f88fc6db9c4a24c86a9e6014 | yunkon-kim/poc-cicd-spider | /interface/api/request/security.go | Go | go | 4,613 | permissive | // gRPC Runtime of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// by CB-Spider Team, 2020.09.
package request
import (
... |
150bfda0915550c7aadb0e416a3ca64ce2279ba6 | 8bf5cd461b526248aeb65455402de088730b264b | tbruyelle/giphy | /giphy.go | Go | go | 1,110 | no_license | package giphy
import (
"github.com/tbruyelle/apiclient"
"net/http"
)
type Client struct {
api *apiclient.API
key string
}
func NewClient(APIKey string) *Client {
c := &Client{
api: apiclient.New("http://api.giphy.com/v1/"),
key: APIKey,
}
return c
}
type Query struct {
APIKey string `url:"api_key"`
}
t... |
0178ddbb0622e65c8aad01fcd629ac3f0fdeb37a | 3b3cf401982c6b52b2ff1a6b6ec24d1a41e5679f | shengyou/golang-demo | /repeat/repeat_test.go | Go | go | 419 | no_license | package repeat
import "testing"
func TestRepeat(t *testing.T) {
t.Run("Should repeat 'a' 5 times", func(t *testing.T) {
want := "aaaaa"
got := Repeat(5, "a")
if got != want {
t.Errorf("want '%s' but got '%s'", want, got)
}
})
t.Run("Should repeat 'b' 3 times", func(t *testing.T) {
want := "bbb"
go... |
283e126b160574ef490496831f194cbdc9a87a6e | 2209233f8ee7339a924148abb5b72c1ba8811410 | comeonjy/go-project | /src/ylog/main.go | Go | go | 274 | permissive | package main
import (
"ylog/core"
"strconv"
"sync"
)
func main() {
var w sync.WaitGroup
for i := 0; i < 10000; i++ {
i:=i
w.Add(1)
go func() {
for j:=0;j<100;j++ {
ylog.Info("xixi"+strconv.Itoa(i), "./sql/log.txt")
}
w.Done()
}()
}
w.Wait()
}
|
57441344df3b021597df8c1c753626f10975e145 | 6b961b1825e2567ef37310f068aaaee177286abd | palmseung/demo-go | /src/carfactory/main.go | Go | go | 1,516 | no_license | package main
import (
"fmt"
"strconv"
"time"
)
type Car struct {
val string
}
type Plane struct {
val string
}
func MakeTire(carChan chan Car, planeChan chan Plane, outCarChan chan Car, outPlaneChan chan Plane) {
for {
select {
case car := <-carChan:
car.val += "Tire_C, "
outCarChan <- car
case pl... |
f7046d91177b9ab3137821718d0e5e2d1d353bf7 | f1fc9b4886bf56dd3404309857947a86fef7e6a8 | vijay-avi/load-balancer-and-ingress-services-for-kubernetes | /vendor/github.com/avinetworks/sdk/go/clients/avi_client.go | Go | go | 15,784 | permissive | /***************************************************************************
* ------------------------------------------------------------------------
* Copyright 2020 VMware, Inc. All rights reserved. VMware Confidential
* ------------------------------------------------------------------------
*/
package clien... |
7d1f6ae43b570989e76c5e0b9c142b972a81f59c | 2eb5ab43e01232bcec361904929939773148646d | sanathp/api-to-ai-util | /authUtil/cookie.go | Go | go | 547 | no_license | package authUtil
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/sanathp/api-to-ai-util/constants"
)
func SetAuthCookie(ginWriter gin.ResponseWriter, value string, age int) {
cookie := &http.Cookie{
Name: constants.AuthTokenCookieKey,
Value: value,
Path: "/",
MaxAge: age,
}
http.SetCook... |
44d7e1ee798cb77ec0e112d7e4b1ab232e42ff99 | 431479b3cfdd30760d61ea603071dc8ece29eb82 | twreporter/go-api | /models/bookmark.go | Go | go | 1,844 | permissive | package models
import (
//"database/sql"
"time"
)
// Bookmark this is bookmarks table description
type Bookmark struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
Users ... |
7334f1a930bc721f0081670045dba738f64c3e0c | 31396281202fbf5dc70ee4adc8fcc128a4c4b9b5 | gh-aw/acs-engine | /pkg/api/apiloader.go | Go | go | 11,357 | permissive | package api
import (
"encoding/json"
"io/ioutil"
"github.com/Azure/acs-engine/pkg/api/agentPoolOnlyApi/v20170831"
apvlabs "github.com/Azure/acs-engine/pkg/api/agentPoolOnlyApi/vlabs"
"github.com/Azure/acs-engine/pkg/api/v20160330"
"github.com/Azure/acs-engine/pkg/api/v20160930"
"github.com/Azure/acs-engine/pkg... |
d559eeb8768dc073b14feaf7ddf0675af2ae1cca | f14af14b29a5299301544b4c5014fc22ac0fe347 | snowlyg/go_mqtt | /udp/main.go | Go | go | 1,428 | permissive | package main
import (
"bufio"
"fmt"
"net"
"os"
)
func checkError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func localIP() string {
ip := ""
if addrs, err := net.InterfaceAddrs(); err == nil {
for _, addr := range addrs {
if ipnet, ok := addr.(*net.IPNet); ok && !ipnet.IP.IsLoopbac... |
b7468d8215fede3fe70a339350f14d92dcbe529d | 65cb858c978129d8e2e7bed59d9a7089d94e28de | fannycchen/magma | /cwf/cloud/go/services/analytics/calcluations.go | Go | go | 7,474 | permissive | package analytics
import (
"context"
"fmt"
"time"
"github.com/golang/glog"
"github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"magma/orc8r/cloud/go/metrics"
)
const (
APNLabel = "apn"
DaysLabel = "days"
... |
b05d53f1c998388124e10bed853d834abf93c42c | 7d654b57e0718f887f0423ace9c9a0cecab33866 | NYULibraries/dlts-finding-aids-zek-generated-code_archived | /sample-set-2-individual-ead-files/tam_407.go | Go | go | 5,144 | no_license | type Ead struct {
XMLName xml.Name `xml:"ead"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Xlink string `xml:"xlink,attr"`
Xsi string `xml:"xsi,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
Eadheader struct {
Text ... |
6117376cc3ecf62ab7153856a527952a74635cd0 | e3b4720f6297acae7abc31972cc77f660d97a0fe | cetricokola/iReferral | /controllers/del_emp.go | Go | go | 1,837 | no_license | package controllers
import (
"encoding/json"
"fmt"
"github.com/astaxie/beego/orm"
)
type DelEmpController struct {
MainController
}
type DelEmpJson struct {
Empdel string
Empid string
}
func (this *DelEmpController) Get() {
this.Facility_management()
}
func (this *DelEmpController) Post() {
session := t... |
eb0827db52c61e2e754bdfc1986c89a853c121c2 | c2411ac3e94f46c3cecd143cc74869044ad45aba | sawaq7/go14_ver1 | /client/sgh/html2/deliver_showprivate.go | Go | go | 1,582 | no_license | package html2
const Deliver_showprivate = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>car-list</title>
<link rel="stylesheet" href="css/member1_show.css" type="text/css">
</head>
<body>
<article>
</article>
<section id="main">
... |
3766925a5f3e55918d143245db413d43fd063bf2 | a4d5ac544cef930ffaf791ed451106fa9e7a107c | qinxiongzhou/easegress | /pkg/object/httpserver/listen.go | Go | go | 2,453 | permissive | /*
* Copyright (c) 2017, MegaEase
* 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 ap... |
2ad70aa207453fd97edba4b0b674511fc67edf2c | 36badf53fcb95605ac36f7d6e1b56e0fb9239b62 | abitrolly/go-fuse | /example/loopback/main.go | Go | go | 2,891 | permissive | // Copyright 2016 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This is main program driver for the loopback filesystem from
// github.com/hanwen/go-fuse/fs/, a filesystem that shunts operations
// to an underlying f... |
f98c923547a71eee7edfeaf1303b87413190616a | 7a98a234a480ecd895f531ddf68bd27e59d1b61d | f33rx/vitess | /go/test/endtoend/vtorc/gracefultakeover/graceful_takeover_test.go | Go | go | 8,884 | permissive | /*
Copyright 2021 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
aff62369ae86b7d49c68e083ac4d4447a87f427b | 040c517d209ec2894c91a5d228cb76bb00991631 | DEK-Technologies/lora-gateway-bridge | /internal/backend/semtechudp/packets/push_data_test.go | Go | go | 8,177 | permissive | package packets
import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/brocaar/loraserver/api/common"
"github.com/brocaar/loraserver/api/gw"
"github.com/brocaar/lorawan"
)
func TestPushDataTest(t *testing.T) {
ass... |
9011ffb88ee0dbd143bbd9eaaa72c26d097655e8 | 15447cd0cfd35f11b3d6149db22f6393f3923ce8 | ytx0574/go-Demos | /LearnGoProject/demo41_web/demo2-http/main/main.go | Go | go | 1,450 | no_license | package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
)
type JHandler struct {
}
func (this JHandler)ServeHTTP(w http.ResponseWriter, r *http.Request) {
r.Body.Close()
fmt.Fprintf(w, "响应文本1")
time.Sleep(time.Millisecond * 100)
fmt.Fprintf(w, "响应文本2")
}
func httpHandler(w http.ResponseWriter, r *h... |
74fc8c59fb249d255106ac6cfa3fd102e3490df4 | 78dc74e1503c683b6de3d3574dd9d1534e404990 | pjoc-team/etcd-config | /config/consul/consul.go | Go | go | 3,223 | permissive | package consul
import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"fmt"
consul "github.com/hashicorp/consul/api"
log "github.com/sirupsen/logrus"
"github.com/pjoc-team/etcd-config/config"
"io/ioutil"
"net"
"net/http"
"net/url"
"time"
)
type consulBackend struct {
url *url.URL
client *consul.Clie... |
96c855e079c770a74fcf9352b442f38a0d79a6c6 | b90301a88a37cc113127addecf63145e9e3d50c6 | ybshen/gonatsd | /gonatsd/conn_test.go | Go | go | 9,566 | permissive | // Copyright (c) 2012 VMware, Inc.
package gonatsd_test
import (
"bufio"
"code.google.com/p/gomock/gomock"
. "gonatsd/gonatsd"
. "gonatsd/gonatsd/mocks"
"io"
. "launchpad.net/gocheck"
"time"
)
type ConnSuite struct {
delegate *TestReporterDelegate
ctrl *gomock.Controller
conn C... |
66e3ebd74e42923e15b3bb66b128e96f0f8418f8 | 10f51dd0f4a14de6bc4b456c1ba6373f2f5061d8 | s1377427321/myServer | /src/github.com/tabalt/gracehttp/server.go | Go | go | 5,066 | no_license | package gracehttp
import (
"crypto/tls"
"fmt"
"log"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
const (
GRACEFUL_ENVIRON_KEY = "IS_GRACEFUL"
GRACEFUL_ENVIRON_STRING = GRACEFUL_ENVIRON_KEY + "=1"
DEFAULT_READ_TIMEOUT = 60 * time.Second
DEFAULT_WRITE_TIMEOUT = DEFAULT_READ_TIMEOUT
)
// refer... |
f584d14afb2ef907f61d04947a31d30ff0997b98 | b04b754fa17e9549eb4d7e6eb8f2b8de8aa6d507 | kasworld/wasmwebsocket | /wasmclient.go | Go | go | 2,628 | permissive | // +build ignore
// Copyright 2015,2016,2017,2018,2019 SeukWon Kang (kasworld@gmail.com)
// 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
// ... |
322339d3558539099789c1e36a7c1af624aeb983 | a6cac9a4960fcada53cc4bf67e8ef0534fdcb7bb | chenzhezheopen/godemo | /zhe/demo2/channel2/channel4/channel4.go | Go | go | 540 | no_license | package main
import (
"fmt"
"time"
)
//发送者
func sender(c chan int) {
for i := 0; i < 100; i++ {
c <- i
if i >= 5 {
time.Sleep(time.Second * 7)
} else {
time.Sleep(time.Second)
}
}
}
func main() {
c := make(chan int, 4)
go sender(c)
timeout := time.After(time.Second * 1)
for {
select {
case ... |
3afac08a2d282a484a1e67bf4f79dfdc14f0e855 | 24bbd24c90606f0363c7896f4845a9e31257736c | 1819997197/gokit | /ch04/main.go | Go | go | 565 | no_license | package main
import (
"fmt"
"gokit/server"
"net/http"
)
func main() {
server.InitLog()
var service server.OrderServer
service = &server.OrderService{}
service = server.LoggingMiddleware(server.Log)(service) //日志中间件
service = server.MetricsMiddleware(server.RequestCount, server... |
c3d992e9fbfa04c78dcc8fd441e62b146cbac014 | 851b5033984b625dd1ba0e2fc1f2981e89848d2e | stoyanr/gardener-extension-provider-gcp | /pkg/webhook/controlplane/webhook.go | Go | go | 2,165 | permissive | // Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
ac216ecae456a390d0212e7150556f9f1bf00a48 | dfabfc5960799ef9d5f5bb87152abc6bfc04484a | NUCsimple/alibaba-cloud-metrics-adapter | /pkg/naming/errors.go | Go | go | 919 | permissive | package naming
import "errors"
var (
// ErrUnsupportedOperator creates an error that represents the fact that we were requested to service a query that
// Prometheus would be unable to support.
ErrUnsupportedOperator = errors.New("operator not supported by prometheus")
// ErrMalformedQuery creates an error that ... |
e92d0a06c3bd78b166031b0f845ec304d7afc51a | 2250099fad6053de20de7225b625a8b4732b874a | carbocation/go.stripe | /stripe.go | Go | go | 3,278 | permissive | package stripe
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
)
// enable logging to print the request and reponses to stdout
var _log bool
// the API Key used to authenticate all Stripe API requests
var _key string
// the default URL for all Stripe API request... |
56d12b194b1bc1e3aac476fff4866a940169f8c2 | 5e073f67c1a498c69e56d704e18ad35909dac777 | feisuzhu/rook | /pkg/daemon/util/cmdreporter.go | Go | go | 9,375 | permissive | /*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
a9f295bf06d13d4606e18b4d9d988832e5f50748 | 97a93837bb7d9784c41460e2b159eae270f1f640 | rodkeys/openbazaar-go | /net/encryption.go | Go | go | 7,587 | permissive | package net
import (
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"errors"
"fmt"
libp2p "gx/ipfs/QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK/go-libp2p-crypto"
"io"
extra "github.com/agl/ed25519/extra25519"
"golang.org/x/crypto/hkdf"
"golang.org/x/crypto/n... |
f8d255a3b8f7b37dfc1e8ec372d01f53a6eab9dd | 501f2488d5e9ffd0e8c15e1b2235264b9333a0a4 | zjy2012/blockchain | /bcli.go | Go | go | 1,657 | no_license | package main
import (
"blockchain/blockchain"
"blockchain/wallet"
"flag"
"fmt"
"github.com/syndtr/goleveldb/leveldb"
"log"
"os"
"strings"
)
//命令行工具
func main() {
//fmt.Println(os.Args[2])
//数据库连接
dbpath := "testdb"
db, err := leveldb.OpenFile(dbpath, nil)
if err != nil {
log.Fatal(err)
}
def... |
86ec31e6164d02dd0e41b750f21c0c3cc70fcce6 | 66ee7540857a68818e08d209ee59ffd7b6737133 | DaniilSolovyov/qs | /git/gitcmds.go | Go | go | 3,894 | permissive | package git
import (
"fmt"
"os"
"time"
"github.com/untillpro/gochips"
"github.com/untillpro/qs/utils"
"github.com/untillpro/qs/vcs"
)
// Status shows git repo status
func Status(cfg vcs.CfgStatus) {
err := new(gochips.PipedExec).
Command("git", "remote", "-v").
Command("grep", "fetch").
Command("sed", "... |
59204c2e485b71afb6c25e85c87bc405fccd3801 | 67af619366329a4a4fd0e8d0b83c40e12b84e242 | nopost/portainer | /api/http/proxy/secrets.go | Go | go | 4,090 | permissive | package proxy
import (
"net/http"
"github.com/portainer/portainer/api"
)
const (
// ErrDockerSecretIdentifierNotFound defines an error raised when Portainer is unable to find a secret identifier
ErrDockerSecretIdentifierNotFound = portainer.Error("Docker secret identifier not found")
secretIdentifier ... |
9ee13341f9509bce9bd8e343df9fb3971b12c3f5 | faecf550580935806acfdf91b6c7e6ea723ffad3 | yaoshipu/peco | /pipeline/interface.go | Go | go | 1,452 | permissive | package pipeline
import (
"sync"
"golang.org/x/net/context"
)
// EndMarker is an interface for things that tell us the input
// sequence has ended
type EndMarker interface {
error
EndMark() bool
}
// EndMark is a dummy struct that gets send as an EOL mark of sorts
type EndMark struct{}
// Producer is an object... |
ae2942a275de0e327e274c7eaafa702375fb6463 | 99f6b8341b650d6b038a95d7de1ed8f7c8e070b4 | bobcallaway/relic | /lib/signappx/sign.go | Go | go | 5,419 | permissive | //
// Copyright (c) SAS Institute 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 agre... |
0a154ca6aa3e20708e950ee4d2023df66017a10b | 73f9055655a5cd797e117f3b6b5df86aa6b81d38 | liz3/irc-server | /commands/command.go | Go | go | 528 | no_license | package commands
import (
"irc-server/models"
)
func GetCommands() *models.CommandsList {
var cmdList []*models.Command
cmdList = append(cmdList, NickCmd())
cmdList = append(cmdList, UserCmd())
cmdList = append(cmdList, PingCmd())
cmdList = append(cmdList, JoinCmd())
cmdList = append(cmdList, PrivMsgCmd())
cm... |
364e73e8b7015cc74625debe0b6e3ed167871db7 | 337edbfc4e9b23432bc2435d7221dffe08d7583b | dhairya0904/GoHex | /internal/core/services/productservice/service.go | Go | go | 612 | no_license | package productservice
import (
"rotteneggs/productservice/internal/core/domain"
"rotteneggs/productservice/internal/core/ports"
)
type service struct {
firestoreRepository ports.FirestoreRepository
}
// New : Creates product service
// Parameter: Implementation of firestoreRepository
func New(firestoreRepository... |
fe570ff91261c6321252383796c1f77b3e95c9ae | 87a70dda0e39a69821a165fb5e38a2fb41706dea | deepfabric/etcd | /integration/member_test.go | Go | go | 3,136 | permissive | // Copyright 2015 The etcd 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 t... |
742adc56c297d46b107bf53bd19d63596dcb9226 | d226c4c77a5d72d23cf952af3e9b68d865bfd8e8 | gabeio/teleport | /lib/web/app/middleware.go | Go | go | 3,854 | permissive | /*
Copyright 2020 Gravitational, 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, soft... |
d7298e313a11c00ea06a023f56d9edcccdbb48cb | 23f3f2d00eb9999365de901dd40510d7519f1d9f | zjj2wry/netfilter | /attribute_test.go | Go | go | 8,954 | permissive | package netfilter
import (
"errors"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAttributeScalarPanicEmpty(t *testing.T) {
emptyData := Attribute{}
// All should panic on empty Data
assert.PanicsWithValue(t, "Uint1... |
a0f7a4e215063ec0edf35cde0b9f7b181713b7ca | da80c41f0d176809f7f09f0fc466efbdf36d29ce | EgorKekor/chat_backend | /api/api.go | Go | go | 458 | no_license | package api
import (
st "github.com/EgorKekor/chat_backend/storage"
"github.com/fasthttp/websocket"
"github.com/valyala/fasthttp"
)
var storageManager st.Storage
var upgrader websocket.FastHTTPUpgrader
func init() {
upgrader = websocket.FastHTTPUpgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
Ch... |
b3376c3a1367b40c1061c24d168fd6eeb20b62c8 | 5f82cdf9e4e67a8a03ab4b70021945c77d596082 | speshak/aws-nuke | /resources/kms-keys.go | Go | go | 1,485 | permissive | package resources
import (
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/kms"
)
type KMSKey struct {
svc *kms.KMS
id string
state string
alias string
}
func (n *KMSNuke) ListKeys() ([]Resource, error) {
respAlias, err := n.Service.ListAliases(nil)
if err != nil {
... |
1c3b3da247eeb5fd6dc811fd558355c9fe79cd4c | 385841f9eebe0849cbae9a116f8ae3aad7028492 | guptachirag/stats | /stats.go | Go | go | 6,216 | no_license | package stats
import (
"errors"
"fmt"
"net/http"
"sort"
"strings"
"sync"
"time"
influxdb "github.com/influxdata/influxdb/client/v2"
)
type qps struct {
stat string
count int64
}
type latency struct {
stat string
delta time.Duration
}
type InfluxDBConfig struct {
Host string
Port int
User... |
3f0a6459a3cb8e516c76158938e8fa1a979d4520 | ac77476a27b557c9653907c6cd89b1f7515a0159 | Shahar-Y/Tutorials | /rabbitmq/part1/send/send.go | Go | go | 989 | no_license | package main
// go run send/send.go
import (
"fmt"
"log"
"github.com/streadway/amqp"
)
const (
rabbitURL = "amqp://guest:guest@localhost:5672/"
)
func main() {
fmt.Printf("starting...\n")
conn, err := amqp.Dial(rabbitURL)
failOnError(err, "Failed to connect to RabbitMQ")
defer conn.Close()
ch, err := conn... |
f81f938ec2757bf17414a371c37a941545a25a7c | c1dff3105ea6fe9c1205c8484d139d0bcee84588 | O3Labs/neo-go | /pkg/consensus/consensus.go | Go | go | 19,323 | permissive | package consensus
import (
"errors"
"fmt"
"sort"
"time"
"github.com/nspcc-dev/dbft"
"github.com/nspcc-dev/dbft/block"
"github.com/nspcc-dev/dbft/crypto"
"github.com/nspcc-dev/dbft/payload"
"github.com/nspcc-dev/neo-go/pkg/config"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
coreb "github.com/nspcc-dev/... |
e904b0345fcd323c30ebcc23a6698764c97ab4a0 | 7af3b306d402377b0d213ae5bb877a740fb7f115 | mumubin/jx | /pkg/jx/cmd/opts/common.go | Go | go | 32,723 | permissive | package opts
import (
"fmt"
"io"
"os"
"strings"
"time"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/heptio/sonobuoy/pkg/client"
"github.com/jenkins-x/jx/pkg/io/secrets"
"github.com/jenkins-x/jx/pkg/jx/cmd/clients"
"github.com/jenkins-x/jx/pkg/vault"
"github.com/jenkins-x/jx/pkg/kube... |
9c25508e5d49480eb51dbdd41b7b0c45c54ac395 | 6e25474b7463c9345429c36159e9114a54486659 | lineCode/p2p | /client/udp.go | Go | go | 4,165 | no_license | package main
import (
"fmt"
"time"
"net"
"../common"
)
const (
udpRecvBufSize int = 4096
)
var (
listenConn net.PacketConn
proxyAddr net.Addr
serverAddr net.Addr
)
func udp(clientString string, proxyString string) int {
p, err := net.ResolveUDPAddr("udp", proxyString)
if err != nil {
... |
5f39d39a04032550ad0da0bf7c35a8cecbe3a876 | 74fbca5fb4eb585841363848e07c1ef71739408e | kaepa3/parallel_golang | /ch3/cond_broadcast.go | Go | go | 829 | no_license | package main
import (
"fmt"
"sync"
)
type Button struct {
Clicked *sync.Cond
}
func main() {
button := Button{Clicked: sync.NewCond(&sync.Mutex{})}
subscrive := func(c *sync.Cond, fn func()) {
var goroutineRunning sync.WaitGroup
goroutineRunning.Add(1)
go func() {
goroutineRunning.Done()
c.L.Lock()
... |
7ef2ed273a750f5c1358af2ace1a22e355bcfca0 | a17f0b3692a760b48761df6beaa55b70300fbe3d | TharushiSuwaris/e16-CO328-Appointment-Scheduling-Software | /backend/middlewares/middlewares.go | Go | go | 1,408 | no_license | package middlewares
import (
"errors"
"fmt"
"os"
"github.com/dgrijalva/jwt-go"
"github.com/gofiber/fiber/v2"
)
func extractToken(c *fiber.Ctx) (string,error){
bearToken := string(c.Request().Header.Peek("Authorization"))
if len(bearToken) == 0 {
return "",errors.New("No Authheader")
}
return bearToken... |
5a6a24a5b3f136de523a4ab9055855b887b7a78a | d2241c0106b91c1eacf8b5467ccec0b94e859764 | sneal/uptimer | /cfWorkflow/cfWorkflow_suite_test.go | Go | go | 203 | permissive | package cfWorkflow_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestCfWorkflow(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "CfWorkflow Suite")
}
|
79fb44e07057132eb7f63e2517a91b78984efbd0 | e4621a956609a7773398c4b147e84851ece65aad | ifls/gorm | /gorm.go | Go | go | 7,765 | permissive | package gorm
import (
"context"
"database/sql"
"errors"
"fmt"
"sync"
"time"
"gorm.io/gorm/clause"
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
)
// Config GORM config
type Config struct {
// GORM perform single create, update, delete operations in transactions by default to ensure database data integrity
/... |
8e0d680b0e0cd1360eb7837ee95fb1f1f5f50fa3 | 273386d7742dea005261a929d44c8a16a022c12b | ZCKun/EastMoneySpider | /search/lhb_list.go | Go | go | 3,090 | no_license | package search
import (
"EastMoneySpider/utils"
"container/list"
"encoding/json"
"fmt"
"github.com/mitchellh/mapstructure"
"gorm.io/gorm"
"log"
"os"
"strings"
"sync"
"time"
)
const formatLayout = "2006-01-02"
type (
lhbList struct {
startDate string
endDate string
data list.List
pageSize ... |
5af92ec4b470f5da14fa4980781a9d8291499ef9 | 235820ee8efb52c1345dd8f4b7a73c7367a09bd1 | ctfang/command | /examples/main.go | Go | go | 1,674 | no_license | package main
import (
"fmt"
"github.com/ctfang/command"
"log"
)
func main() {
app := command.New()
app.AddBaseOption(command.ArgParam{
Name: "TEST",
Description: "fffffffffffffffffffffffff",
Default: "false",
Call: nil,
})
app.AddCommand(Echo{})
app.AddCommand(Hello{})
app.Run()
}... |
8ccba95ee000c3904f5fa4e024ec797def59fd40 | 9a7f1bb3531b87ac7d3797214b86dcc6d64644c0 | tuzaix/hedis | /src/hedis-server/main.go | Go | go | 582 | no_license | package main
import (
"common"
"flag"
"fmt"
"hbase"
"net/http"
_ "net/http/pprof"
)
var (
conf = flag.String("conf", "../conf/hedis.conf", "hedis toml config")
)
func main() {
flag.Parse()
// 加载配置
common.LoadConfig(*conf)
// 启动pprof
go func() {
http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", common.Con... |
7bea612be4aedd29c45decca842cc5905aa62400 | 5136849feca7a68786aeaae6bd3f1244058ad9ec | fengkx/miniflux | /http/request/context.go | Go | go | 3,709 | permissive | // Copyright 2018 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package request // import "miniflux.app/http/request"
import "net/http"
// ContextKey represents a context key.
type ContextKey int
// List of context k... |
36e0e9d609d6b1b89424425b53224e1a75d83ec9 | 78ab942f9706ed36ca3a9025a75d1b7424caaf8e | kadel/kedge | /vendor/github.com/openshift/origin/pkg/cmd/server/admin/legacyetcd/clusterpolicybinding/registry.go | Go | go | 6,567 | permissive | package clusterpolicybinding
import (
metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/watch"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/rest"
kapi "k8s... |
16d65e2956dd0fc59d7d46c34c5170aa284646ab | e09956deec42d4629df187effcd1ce93a6725d3b | hnakamur/netutil | /private_addr_test.go | Go | go | 1,046 | permissive | package netutil_test
import (
"net"
"testing"
"github.com/hnakamur/netutil"
)
func TestIsUniqueLocal(t *testing.T) {
testCases := []struct {
ip string
want bool
}{
{ip: "fbff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", want: false},
{ip: "fc00::", want: true},
{ip: "fd00::1", want: true},
{ip: "fdff:ffff... |
336a3a39a702ea8e03481f789b34e34de9422059 | 418ff9183154e8df4a73acf028db5970df3742a4 | cockroachdb/google-cloud-go | /internal/generated/snippets/appengine/apiv1/InstancesClient/ListInstances/main.go | Go | go | 1,329 | permissive | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
a7bc7502271b7f8750da4597d40a79909c7dc345 | 9b81b31a6cfc52945e8eb7805e62eea8d9915a94 | zyfdegh/graduation-project | /ci-system/src/linkernetworks.com/linker_common_lib/rest/response/response.go | Go | go | 1,191 | no_license | package response
import (
"github.com/emicklei/go-restful"
)
type Response struct {
Success bool `json:"success"`
Error *Error `json:"error,omitempty"`
Data interface{} `json:"data,omitempty"`
}
func WriteSuccess(resp *restful.Response) {
success := NewResponse(true)
success.Write(resp)
}
fun... |
b841edb4ab3f78b56344e4e64c2290e52ec18483 | 5a0155c65559fb9ccb7dd2e8e5fcefc45fd66e0a | hongda3141/xuperunion | /consensus/tdpos/tdpos.go | Go | go | 18,985 | permissive | //Copyright 2019 Baidu, Inc.
package tdpos
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"math/big"
"os"
"strconv"
"sync"
"time"
log "github.com/xuperchain/log15"
"encoding/hex"
"encoding/json"
"github.com/xuperchain/xuperunion/common"
"github.com/xuperchain/xuperunion/common/config"
cons_base "github... |
09987ffedca774556e893829135a35806ca7d237 | 34f249e08126d985238a2e362ae7fc3ac4207c71 | 9622034/go-epik | /chain/actors/builtin/paych/state.go | Go | go | 2,336 | permissive | package paych
import (
"encoding/base64"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
ipldcbor "github.com/ipfs/g... |
b7c59751b504c7597e0a7637f3cd5cb901a18720 | 370c57e099e4c122bf31107bbc60290b7f30ee89 | whosthatknocking/cherami-client-go | /client/cherami/outputhostconnection.go | Go | go | 11,645 | permissive | // Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
8b350c6758dd51e91085abce10f441f352d32cf0 | 72da0eec502f3cbdc5d8303dde5431c362cb1883 | rajkrishnamurthy/octant | /cmd/octant-electron/main.go | Go | go | 2,623 | permissive | /*
* Copyright (c) 2020 the Octant contributors. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"context"
"fmt"
golog "log"
"os"
"github.com/spf13/viper"
"github.com/vmware-tanzu/octant/internal/api"
ocontext "github.com/vmware-tanzu/octant/internal/context"
"github.c... |
b56de939f08eae0bf49477310b044ac4a3f4045a | d6de85ea52a477600d0e3fe5399776e20d568de8 | insomniacslk/u-root | /pkg/boot/uefi/fv_test.go | Go | go | 2,556 | permissive | // Copyright 2021 the u-root 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 uefi
import (
"io/ioutil"
"testing"
)
func TestFindSecurityCorePEEntry(t *testing.T) {
dat, err := ioutil.ReadFile("testdata/fv_with_sec.fd")
i... |
c4938a918f586ef6c431e41eec04feba378a09af | 59b2ba8de1c3c1e4f25c1f854d78f27f8c3f498f | patrickdlogan/manul | /imports.go | Go | go | 2,300 | permissive | package main
import (
"go/build"
"log"
"os"
"path/filepath"
"sort"
"strings"
)
func recursiveParseImports(
imports map[string]bool, path string, cwd string,
) error {
if path == "C" {
return nil
}
// catch internal vendoring in net/http since go 1.7
if strings.HasPrefix(path, "golang_org/") {
return n... |
f6aebfdcc99a47a57700208f84472b459e40d4ca | 86b23a30fbab6830f9c7cbc68fbea3ced263d3e7 | go-ldap/ldap | /examples_test.go | Go | go | 13,913 | permissive | package ldap
import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"time"
)
// This example demonstrates how to bind a connection to an ldap user
// allowing access to restricted attributes that user has access to
func ExampleConn_Bind() {
l, err := DialURL("ldap://ldap.example.com:389")
if e... |
3575a0a1f6a1584cb827f58e6dd783903b7d2bf2 | 4235488c0ecaa2f147b185977b4f8cb2cc2318ca | tegarajipangestu/kratos | /selfservice/strategy/password/settings_test.go | Go | go | 13,929 | permissive | package password_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"testing"
kratos "github.com/ory/kratos-client-go"
"github.com/ory/kratos/corpx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tidwall/gjson"
"github.com/ory/... |
7a5bb4c62bc48f918d2751a951cdcd9f0a7519fc | d93ced5e7eeff8221f6b46a3241520e71139564c | skatsuta/kiso-golang | /src/arithmetic_type.go | Go | go | 366 | permissive | package main
import (
"fmt"
)
const (
// 型をもたない定数
C1 = 12345
// 型 (int) をもつ定数
C2 int = 23456
)
func main() {
// C2 が int なので、型をもたない C1 も int として計算される
var x int = C1 * C2
fmt.Println("12345 * 23456 =", x)
var a int32 = 123
var b int64 = 234
fmt.Println("123 + 234 =", a+int32(b))
}
|
18b64d698199457364b7be1818190f2c743bc7d3 | af1f64dc082bd75800c74bebf5ae89aab8bcd10d | ninchat/ninchat-go | /websocket_go.go | Go | go | 2,191 | permissive | // +build !js
package ninchat
import (
"encoding/json"
"sync"
"time"
"github.com/gorilla/websocket"
)
const webSocketSupported = true
type webSocket struct {
notify chan struct{}
goingAway bool
err error
conn *websocket.Conn
lock sync.Mutex
buf [][]byte
}
func newWebSocket(host string, header... |
c499849229e2e9817925a3625756701b424ff217 | 0e95a3c462b39530ee19a45c6623e4c7416d074d | MitchellTesla/cli | /pkg/cmd/alias/set/set_test.go | Go | go | 8,960 | permissive | package set
import (
"bytes"
"io/ioutil"
"testing"
"github.com/MakeNowJust/heredoc"
"github.com/cli/cli/internal/config"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams"
"github.com/cli/cli/test"
"github.com/google/shlex"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"gi... |
ac60088f55f724166f22d4664d19d65625775980 | 776e238f9886f4220bcd48c7bbf04dbbf3001d77 | EndlessCheng/codeforces-go | /main/1200-1299/1208E.go | Go | go | 1,243 | permissive | package main
import (
"bufio"
. "fmt"
"io"
)
// https://space.bilibili.com/206214
func CF1208E(_r io.Reader, _w io.Writer) {
in := bufio.NewReader(_r)
out := bufio.NewWriter(_w)
defer out.Flush()
max := func(a, b int64) int64 {
if b > a {
return b
}
return a
}
var n, w, m int
Fscan(in, &n, &w)
d ... |
32e93448cc113d7ca0a8b8406be6ec2d0d756ec9 | d011a79c32ae8ef030ce130bf7d08f71c40254a1 | glyn/riff | /pkg/core/system.go | Go | go | 10,916 | permissive | /*
* Copyright 2018 The original author or 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 applicabl... |
f82918d74afff7333bfc10a4ae64c06303d4e512 | 61fe1a3d23723cbb9a7ac7c3054da13c54f6bcb0 | msingle/go-gg | /gg/facet.go | Go | go | 8,166 | permissive | // Copyright 2016 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 gg
import (
"fmt"
"reflect"
"github.com/aclements/go-gg/generic"
"github.com/aclements/go-gg/table"
)
// TODO: What if there are already layers? ... |
09a5b37f85c040a7ef38adeda1c98b04ea98c62e | b1210a60bd3609d2fed472edcbad2371ac62e84f | microsoftgraph/msgraph-sdk-go | /models/registry_key_state.go | Go | go | 17,467 | permissive | package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e "github.com/microsoft/kiota-abstractions-go/store"
)
// RegistryKeyState
type RegistryKeyState... |
adbd2c15005cebf641eb30ed4496aa0a2e3cd421 | b024edacf11ccb80c73976cedcce636cac06562a | nimmalagautam/ODIM | /lib-utilities/response/response.go | Go | go | 7,028 | permissive | //(C) Copyright [2020] Hewlett Packard Enterprise Development LP
//
//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 a... |
192c9d7e664816d045fe945905a5e9c91659e0d3 | 7fd3f1a797533862a8e4692d7ebb949f22b96972 | sgotti/agola | /internal/services/configstore/readdb/org.go | Go | go | 10,895 | permissive | // Copyright 2019 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... |
e86aa5f41b88b29c6850b22be8435af7b66f91ff | 4557f081177f80c07d26930d3bf04fa96c32c984 | shubhank-saxena/anax | /persistence/node_policy_test.go | Go | go | 6,941 | permissive | // +build unit
package persistence
import (
"github.com/open-horizon/anax/externalpolicy"
"testing"
)
// Verify that FindNodePolicy works when there is no node policy in the database.
func Test_ReadNodePolicy(t *testing.T) {
dir, db, err := utsetup()
if err != nil {
t.Error(err)
}
defer cleanTestDir(dir)
... |
c17cc471b018327d9f829a16362d613a39b507de | 8ed088ed819a9a86803588502afb04edca1a692a | NukeWilliams/infogather | /pkg/authpaid/hibp/hibp.go | Go | go | 4,165 | no_license | package hibp
import (
"encoding/json"
"time"
"github.com/krishpranav/infogather/internal/http"
)
// BreachList is a representation of the names of site breaches returned by the GetBreaches() function.
type BreachList []struct {
Name string `json:"Name"`
}
// BreachedSites is a representation of a plethora of de... |
4d41a14ad4cc63e583ec9926f0f037c7dba3508c | ff7bae82dfd1c24737210a1684f30ad221fa6583 | xrstf/kubermatic-old | /api/cmd/seed-controller-manager/controllers.go | Go | go | 10,533 | no_license | package main
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"time"
"github.com/kubermatic/kubermatic/api/pkg/controller/seed-controller-manager/addon"
"github.com/kubermatic/kubermatic/api/pkg/controller/seed-controller-manager/addoninstaller"
backupcontroller "github.com/kubermatic/kubermatic/api/pkg/controlle... |
69ca0bad7162af3ea979286327a33619b0264d1d | 1544b8db1c026b241b299632099b2395bb8a2f1f | apascual-telnet/voltha-go | /common/ponresourcemanager/ponresourcemanager.go | Go | go | 38,585 | no_license | /*
* 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 applicable law ... |
9c1b5c88e9f065e17fe7d048ffd058c170407779 | 27124233d4531f49b0c48e61e4150ff5cd6f77d9 | stevemats/golang-samples | /run/pubsub/e2e_test.go | Go | go | 1,531 | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
d46af28fdb390d261b9a8a0615379f3b364468bf | 401c80e16cd66feabf98b77ced1ccd18dd1339a2 | lalit-verma/gorush | /vendor/github.com/asdine/storm/errors.go | Go | go | 2,438 | permissive | package storm
import "errors"
// Errors
var (
// ErrNoID is returned when no ID field or id tag is found in the struct.
ErrNoID = errors.New("missing struct tag id or ID field")
// ErrZeroID is returned when the ID field is a zero value.
ErrZeroID = errors.New("id field must not be a zero value")
// ErrBadType... |
020c29bc91e83ba8b50df995ea933c3c78a8d498 | 62328624bc33df079726d720a768c3bd63fd8baa | Asana/telegraf | /Godeps/_workspace/src/github.com/influxdb/influxdb/snapshot/snapshot_test.go | Go | go | 10,984 | permissive | package snapshot_test
import (
"bytes"
"io"
"io/ioutil"
"reflect"
"testing"
"time"
"github.com/influxdb/influxdb/snapshot"
)
// Ensure a manifest can be diff'd so that only newer files are retrieved.
func TestManifest_Diff(t *testing.T) {
for i, tt := range []struct {
s *snapshot.Manifest
other *sn... |
3fc9570a0e12d253fef3af80585dcbffee9cf13d | 9c92594a34cb059110b68fe0e8ea5bfce4f56ea7 | doc22940/rancher | /vendor/github.com/rancher/kontainer-engine/drivers/gke/gke_driver.go | Go | go | 44,481 | permissive | package gke
import (
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"sync"
"time"
"github.com/rancher/kontainer-engine/drivers/options"
"github.com/rancher/kontainer-engine/drivers/util"
"github.com/rancher/kontainer-engine/types"
"github.com/rancher/rke/log"
"github.com/sirupse... |
cd7f6a397cd29b26b40fd1c12780603a98d00ef4 | 2f54e3cf5a6ba482e94304fe15b833466a8d339c | Djarvur/go-mk-ms01-swagger | /restapi/operations/ping/ping.go | Go | go | 1,404 | permissive | package ping
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
middleware "github.com/go-openapi/runtime/middleware"
)
// PingHandlerFunc turns a function with the right signature into a ping handler
type PingHandlerFun... |
6f6b6b7ef3492344a378bd6c81a538e8fda0dac6 | 20518e3ac44b45e85e072227f4a57c4f677f625b | lxdcc/gophercloud | /acceptance/openstack/blockstorage/extensions/volumeactions_test.go | Go | go | 5,669 | permissive | //go:build acceptance || blockstorage
// +build acceptance blockstorage
package extensions
import (
"testing"
"github.com/lxdcc/gophercloud/acceptance/clients"
blockstorage "github.com/lxdcc/gophercloud/acceptance/openstack/blockstorage/v2"
blockstorageV3 "github.com/lxdcc/gophercloud/acceptance/openstack/blocks... |
1cf0fb1e3ea2082caab0f41338380bced3c0374f | f35f66882291033f96d211ca7b31384227a30714 | hishamk/go-shopify | /shop_test.go | Go | go | 1,574 | permissive | package goshopify
import (
"testing"
"time"
"github.com/jarcoal/httpmock"
)
func TestShopGet(t *testing.T) {
setup()
defer teardown()
httpmock.RegisterResponder("GET", "https://fooshop.myshopify.com/admin/shop.json",
httpmock.NewBytesResponder(200, loadFixture("shop.json")))
shop, err := client.Shop.Get(n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.