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 |
|---|---|---|---|---|---|---|---|---|
c93ffaeea77b302a5c96bd73b3819bd99a2fe897 | f3ef5ea25d5e84265e59d806a6609fc30c18ccaf | hemantra/magma | /symphony/graph/ent/equipmentportdefinition_update.go | Go | go | 28,573 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated (@generated) by entc, DO NOT EDIT.
package ent
import (
"context"
"errors"
"strconv"
"time"
"github.com/facebookincubator/ent/dia... |
b5b69ac562c9e8552ef9494a701d82a3fae323f0 | 2a6a20e6e0331395fbdc194ef1f313ea1bd0117b | Ricechainorg/chainlink | /core/services/synchronization/explorer_client_test.go | Go | go | 5,502 | permissive | package synchronization_test
import (
"net/http"
"net/http/httptest"
"net/url"
"testing"
"time"
"github.com/smartcontractkit/chainlink/core/internal/cltest"
"github.com/smartcontractkit/chainlink/core/services/synchronization"
"github.com/smartcontractkit/chainlink/core/store"
"github.com/stretchr/testify/a... |
4ee7eb1618e58c2ee5521be74b21ec6c54c6f69c | 56890e124f8a820e96ee26ac856978d7231f80bd | numerology/pipelines | /backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow.go | Go | go | 11,066 | 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... |
df568fa6eb637f6b21b9227d45dd3c6099e0aa29 | 4703e2c01b608fdd6570786731a359c2829175f7 | katydid/katydid | /encode/reflect/reflect.go | Go | go | 4,416 | permissive | // Copyright 2016 Walter Schulze
//
// 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... |
06d9049a7daef4a228c4f45c6f8d8e163439826b | e8078a7f814fd959d861a8e83ecfc03787cdb7ba | nicktrav/spincycle | /request-manager/request/error.go | Go | go | 510 | permissive | package request
import (
"errors"
"fmt"
)
var (
ErrInvalidParams = errors.New("invalid request type and/or arguments")
)
type ErrInvalidState struct {
expectedState string
actualState string
}
func (e ErrInvalidState) Error() string {
return fmt.Sprintf("request not in %s state (state = %s)", e.expectedStat... |
869d0715d38c41c950da4e074f6b05240e6cbef5 | 1fb4f224da8907483f043e6b05e8989df64de7dd | hharnisc/img | /vendor/github.com/opencontainers/runc/libcontainer/specconv/spec_linux.go | Go | go | 21,511 | permissive | // +build linux
// Package specconv implements conversion of specifications to libcontainer
// configurations
package specconv
import (
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/seccomp"
libcontainerUtils "gi... |
e840f1c75cbb409ec032130d5c81198b0d7ed5f8 | 8394ea83ee5d23974fa79bb37327027216a732e7 | launchpadcentral/recurly | /billing.go | Go | go | 5,069 | permissive | package recurly
import (
"encoding/xml"
"net"
)
// Billing represents billing info for a single account on your site
type Billing struct {
XMLName xml.Name `xml:"billing_info,omitempty"`
FirstName string `xml:"first_name,omitempty"`
LastName string `xml:"last_name,omitempty"`
Company... |
f9b5e2c6b9aa484c55e9ce34bea4018a393c6f95 | 74c3c002186455ab9d506a6ec171e1218894808c | phaibin/gh-ost | /go/mysql/instance_key_map.go | Go | go | 2,479 | permissive | /*
Copyright 2015 Shlomi Noach, courtesy Booking.com
See https://github.com/github/gh-ost/blob/master/LICENSE
*/
package mysql
import (
"encoding/json"
"strings"
)
// InstanceKeyMap is a convenience struct for listing InstanceKey-s
type InstanceKeyMap map[InstanceKey]bool
func NewInstanceKeyMa... |
941d8479df371a3d5ab574b54bd046942fc1f008 | 2ba0b753ab601c75bfdf713a589b1bf356772a27 | zwlxt/ticket_query | /Railway_ticket.go | Go | go | 3,811 | no_license | package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"time"
"./query_parser"
"./stationname_parser"
"github.com/tealeg/xlsx"
)
const (
configFile = "./config.json"
stationNamesFile = "./stationname_parser/station_name.js"
queryUrlPattern = "https... |
a328f665eac9e3edae6508f08662f50345fbc246 | 4e6acd076f66907fecb8e9bb31c6070719584471 | linhailan/luci-go | /vpython/options.go | Go | go | 5,722 | permissive | // Copyright 2017 The LUCI 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... |
ce34b88930299643f6590122a9b5dec8920a181c | 572a916e696634cc88d6820f1e1d831198721353 | chenbk85/kythe | /kythe/go/services/xrefs/xrefs.go | Go | go | 18,228 | permissive | /*
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicabl... |
0aae9532d6c6c493de90c11b7ae214a665130361 | 214549bdadba0829d3b2c21d31079fc0ae3f307d | anfernee/kubernetes | /pkg/kubelet/kuberuntime/helpers.go | Go | go | 11,103 | 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, ... |
4e4dea86f09ea868eded9867460dbc396a49fbb3 | ba15dd356aa15e806dcd9c8bcfab1e0309d7e59f | andreasanta/go-away | /internal/http/server.go | Go | go | 2,755 | permissive | package http
import (
"goaway/internal/models"
"goaway/internal/utils"
"log"
"os"
"runtime"
"strconv"
"time"
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
var IpList map[uint32]models.IPRange
var RangeIpList utils.RangeSet
func LoadDatabase() (int, int64) {
l... |
0bc7a8a309541e64147e5def118dda80d061d7a3 | ae8e468b71b78c9702768a38e0c177d7887cf269 | ckettell/fizzbuzz-in-go | /fizzbuzz_test.go | Go | go | 520 | no_license | package main
import "testing"
// Testing that 3 should equal 0
func TestIsDivisibleByThree(t *testing.T){
if IsDivisibleByThree(3) == true {
t.Logf("Success!")
}
}
func TestIsDivisibleByFive(t *testing.T){
if IsDivisibleByFive(5) == true {
t.Logf("Success!")
}
}
func TestIsNotDivisibleByFive(t *tes... |
7fcac62885aa48b30e6958acaf9c7618f03b20a5 | 0ba92e8ed29d2ecf35b8a2fb7704752f6cb56b2b | Tapfury/go-iap | /appstore/validator_test.go | Go | go | 7,134 | permissive | package appstore
import (
"context"
"errors"
"io/ioutil"
"net/http"
"net/http/httptest"
"reflect"
"strings"
"testing"
"time"
)
func TestHandleError(t *testing.T) {
tests := []struct {
name string
in int
out error
}{
{
name: "status 0",
in: 0,
out: nil,
},
{
name: "status 21000... |
362abbc0b38374eb7d76981c48b03b257a2a456d | 8a5b2e4efdfe7c1cb13f1adfceefdd6ecfb906dc | s4kibs4mi/lachesis | /src/net/server_socket.go | Go | go | 420 | permissive | package net
import (
"context"
)
type ClientConnectHook interface {
OnConnect(CID string, err error)
}
type ClientMessageHook interface {
OnMessage(CID string, msg []byte, err error)
}
type ServerSocket interface {
Listen(addr string, path string) error
AddConnectHook(hook ClientConnectHook)
AddMessageHook(ho... |
72e9beb9a50803463ff50b50a40c5e4f6640aca6 | f1716a7a4d166091e3d1b713d0a7ec1ea8995a4b | ramonguiu/infrastructure-agent | /pkg/integrations/v4/manager_test.go | Go | go | 37,091 | permissive | // Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package v4
import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
"github.com/newrelic/infrastructure-agent/internal/integrations/v4/constants"
"github.com/... |
91a58592317b32529887bedc005d212a3bec40a6 | 609e8a8eaa3b1b0a2388f78f6149191ad044fe10 | ROCHAIA01/lorawan-stack | /pkg/oauth/storage.go | Go | go | 8,474 | permissive | // Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
eb8bac502e92033cbda90be650ff25a3a0e37464 | a0dab0850d1e7542b25a4a831bf1219cd54ab658 | nacore/GoHM | /TLibDecoder/TDecCavlc.go | Go | go | 77,609 | no_license | /* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2012-2013, H265.net
* All rights reserved.
... |
3611640aeaf08928c38585b621833bb63bd8f7c1 | af69eb9f29b27f401f922aa61063adb515b48d71 | panjjo/mongo-go-driver | /x/mongo/driver/topology/sdam_spec_test.go | Go | go | 3,651 | permissive | // Copyright (C) MongoDB, Inc. 2017-present.
//
// 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
package topology
import (
"encoding/json"
"fmt"... |
d6ea9c992804556fb5fa03d06250218377c1ebef | 3b5e08ae24942bd335b30feb31930651a53ef6e9 | guilhem/k8s-config-connector | /pkg/apis/accesscontextmanager/v1beta1/register.go | Go | go | 2,717 | permissive | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
d5be177f9b3ef107aba963433a36054decc647fe | 5775f1d10ceb57aaa0cd7c9b155f3c27a0e94707 | sapcc/kubernikus | /pkg/client/openstack/roles/results.go | Go | go | 1,136 | permissive | package roles
import "github.com/gophercloud/gophercloud/pagination"
// Role represents a Role in an assignment.
type Role struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
DomainID string `json:"domain_id,omitempty"`
}
// ExtractRoles returns a slice of Domains contained in a... |
9a215759902e8c48d4e5fc4ceeba3dc90fa51beb | 71794e81c3c27192efe2400d6f55989c7e491ab3 | intelsdi-x/kubernetes | /pkg/proxy/util/utils_test.go | Go | go | 15,056 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
83b8fb19d0c12d82542537cb89a231969638503c | 0024b771c99eebd1458fb1b139581e4f4ff40479 | cmwylie19/gloo | /projects/envoyinit/pkg/downward/template_test.go | Go | go | 2,899 | permissive | package downward_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/solo-io/gloo/projects/envoyinit/pkg/downward"
)
type mockDownward struct {
podName string
podNamespace string
podIp string
podSvcAccount string
podUID string
nodeName string
n... |
91192c52c03df93e4c4b378904f21a53da58d15f | 943e4efe607bb232c9a9f77b6fc3868e7b0c07aa | johnyu916/courseware | /models.go | Go | go | 1,588 | no_license | package courseware
import (
"fmt"
"github.com/attic-labs/noms/go/datas"
"github.com/attic-labs/noms/go/dataset"
"github.com/attic-labs/noms/go/marshal"
"github.com/attic-labs/noms/go/spec"
"github.com/attic-labs/noms/go/types"
)
type Exam struct {
Name string
Problems []Problem
}
type Problem struct {
I... |
3e884a77a4e9621693417c29580c9a66427feee0 | 3faabf959bf7ea68afe1e54b19f4f6fc6782869c | gitql/vitess | /go/vt/hook/hook.go | Go | go | 7,391 | permissive | // Copyright 2012, 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 hook
import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
"path"
"strings"
"syscall"
log "github.com/golang/glog"
vtenv "github.com/gitql/vitess/go/vt/en... |
751cab3759430b3e563538a0ea1fd180cb6f9070 | 720b13a5cb7408cf1335ae4c6ab323c7da5720e9 | gartnera/machine | /drivers/openstack/client.go | Go | go | 14,682 | permissive | package openstack
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/docker/machine/libmachine/log"
"github.com/docker/machine/libmachine/mcnutils"
"github.com/docker/machine/libmachine/version"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack"... |
364b71813b3ad6457eca7a7f1b64c9617e1299b7 | a1422bd4626516f515579d57d96be7a27d1fa08a | budougumi0617/leetcode | /142.linked-list-cycle-ii.go | Go | go | 1,967 | no_license | package main
/*
* @lc app=leetcode id=142 lang=golang
*
* [142] Linked List Cycle II
*
* https://leetcode.com/problems/linked-list-cycle-ii/description/
*
* algorithms
* Medium (38.86%)
* Likes: 3522
* Dislikes: 268
* Total Accepted: 395.7K
* Total Submissions: 1M
* Testcase Example: '[3,2,0,-4]\n1... |
34b2027fd13f86968c0c7fab595ff2805e4a7f3f | 2889f33b32023738adcd9d34e729b2669dda2c11 | tnsardesai/goformation | /cloudformation/fis/aws-fis-experimenttemplate_experimenttemplatetargetfilter.go | Go | go | 2,124 | permissive | package fis
import (
"github.com/awslabs/goformation/v4/cloudformation/policies"
)
// ExperimentTemplate_ExperimentTemplateTargetFilter AWS CloudFormation Resource (AWS::FIS::ExperimentTemplate.ExperimentTemplateTargetFilter)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fis-ex... |
05af32acfd7de4fb0f2fafe124941ad944308f83 | 3ec5313843266b100affc34fbf0ed6b23ee20fb9 | ubogdan/eebinary | /generate/compress.go | Go | go | 435 | no_license | package generate
import (
"bytes"
"compress/zlib"
)
func Compress(byteSlice []byte) []byte {
// Compress byte array to zlib
var b bytes.Buffer
en := zlib.NewWriter(&b)
if _, err := en.Write(byteSlice); err != nil {
panic(err)
}
if err := en.Flush(); err != nil {
panic(err)
}
if err := en.Close(); err !... |
5e99a4451f351dc7135010bf87c888003079baae | 0ebd3165db390196486e652b66a94ab6507b9c77 | alxarch/njson | /unjson/marshal_test.go | Go | go | 1,694 | permissive | package unjson
import (
"testing"
)
func TestMarshal(t *testing.T) {
v := struct {
Foo string
Bar string
}{"foo", "bar"}
data, err := AppendJSON(nil, v)
assertNoError(t, err)
assertEqual(t, string(data), `{"Foo":"foo","Bar":"bar"}`)
}
func TestMarshalBasicTypes(t *testing.T) {
v := struct {
String string... |
3c7f22b377af36ca0b5414015aae58bd4a983ebc | edee59c02ee586c391e55b9bb5d56773df6bf66c | watermint/toolbox | /essentials/network/nw_congestion/congestion.go | Go | go | 11,787 | permissive | package nw_congestion
import (
"container/list"
"github.com/watermint/toolbox/essentials/collections/es_number"
"github.com/watermint/toolbox/essentials/go/es_goroutine"
"github.com/watermint/toolbox/essentials/log/esl"
"github.com/watermint/toolbox/infra/app"
"runtime"
"sync"
"time"
)
const (
hardLimitConge... |
a192ec342c11acb4fc9b3a5f5c10da0994fbc7ae | 13c961ad900895252f1f6852916c7326b3b82ee7 | yanming-zhang/hade | /framework/util/file.go | Go | go | 1,242 | permissive | package util
import (
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
)
// 判断所给路径文件/文件夹是否存在
func Exists(path string) bool {
_, err := os.Stat(path) //os.Stat获取文件信息
if err != nil {
if os.IsExist(err) {
return true
}
return false
}
return true
}
// 路径是否是隐藏路径
func IsHiddenDirectory(path st... |
68a413089a2e617fc6f69506e16ea47257b87135 | 96c995941a63fa8d4bcc4fb9c361337bd449e9cf | gambarini/kombustion | /pkg/parsers/properties/Thing_AttributePayload.go | Go | go | 343 | permissive | package properties
// DO NOT EDIT: This file is autogenerated by running 'go generate'
// It's generated by "github.com/KablamoOSS/kombustion/generate"
type Thing_AttributePayload struct {
Attributes interface{} `yaml:"Attributes,omitempty"`
}
func (resource Thing_AttributePayload) Validate() []error {
errs := []e... |
30a90a874e01fc3fd98aa61923184efe9924bd43 | 63ee597d8f8bb4e884f2d5bdb3d2b4f346e2a05e | teocci/go-sorts | /src/core/gosort.go | Go | go | 494 | permissive | // Package gosorts
// Created by RTT.
// Author: teocci@yandex.com on 2021-Sep-01
package gosorts
import "sort"
func Heapsort(data sort.Interface) {
heapSort(data, 0, data.Len())
}
func GuessIntShift(data Int64Interface, l int) uint {
return guessIntShift(intWrapper{data}, l)
}
func SetQSortCutoff(i int) int {
o... |
fbd78fa02cf723133bb750fa6c86228ef4f2632a | 0824e5487a86e5690b4d9b8b97d6ddf230ae3fbf | aiwuTech/wechat | /mp/user/user.go | Go | go | 5,550 | permissive | // @description wechat 是腾讯微信公众平台 api 的 golang 语言封装
// @link https://github.com/chanxuehong/wechat for the canonical source repository
// @license https://github.com/chanxuehong/wechat/blob/master/LICENSE
// @authors chanxuehong(chanxuehong@gmail.com)
package user
import (
"errors"
"fmt"
"net/url"
"... |
2c9846c3acec8cba8d989cebf5dc81ff688f89d9 | 1a482bd364c22d81e307fb1ed61e4525e165eeb0 | terryli1643/apidemo | /api/bcc/middleware/maintenance.go | Go | go | 434 | no_license | package middleware
import (
"github.com/gin-gonic/gin"
)
func Maintenance() gin.HandlerFunc {
return func(c *gin.Context) {
// paramService := service.NewParamSettingService()
// _, enable, _ := paramService.GetParamByName("Maintenance")
// if enable {
// log.Warn("system is under maintenance")
// c.A... |
702735f17bd37a98b432512adfa9cbef09aa0544 | 8d1e7f15999eebdb7f205f297868b1e6224208a8 | rvamsig/golang-personal-budget-cli | /module2/budget_2.go | Go | go | 1,981 | no_license | package module2
import (
"errors"
"time"
)
// START Initial code
// Budget stores Budget information
type Budget struct {
Max float32
Items []Item
}
// Item stores Item information
type Item struct {
Description string
Price float32
}
var report map[time.Month]*Budget
// InitializeReport creates an ... |
185bdbc6317dc545de927ba7135e0a0f4a820dff | 73625cdbd3306b33afe2a438c2df3a9c6a44c055 | whoami-ops/baremetal-operator | /pkg/provisioner/provisioner.go | Go | go | 6,739 | permissive | package provisioner
import (
"errors"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metal3v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
"github.com/metal3-io/baremetal-operator/pkg/bmc"
"github.com/metal3-io/baremetal-operator/pkg/hardware"
)
/*
Package provisioning defines... |
89d7c1b5dad33f340abb0ed6214c4daefa0d18df | 5dcc4ad46a78b1f8399021f63ca1939b267c7f8c | lenny-intel/edgex-go | /internal/security/secretstore/container/config.go | Go | go | 1,393 | permissive | /*******************************************************************************
* Copyright 2017 Dell Inc.
* Copyright 2018 Dell Technologies Inc.
* Copyright (c) 2019 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the L... |
7a496e853b7e70eb334a9191fe6305100f71ce5b | 22237df45be0c5da28cbc582feb88dd22e01bbe2 | edwinlee1234/tomato | /handler/api.go | Go | go | 16,273 | no_license | package handler
import (
"context"
"encoding/json"
"strconv"
"time"
"tomato/config"
"tomato/model"
"tomato/pkg/redis"
"tomato/pkg/res"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
// Ping Ping
func Ping(c *gin.Context) {
res.Success(c, gin.H{
"msg": "pong",
})
}
// CreateTask CreateTa... |
8bd6ade9197edeb2839776796da7bbc7b2d108e8 | 75cd61c21637022fe0ab05dd973396febe0997af | kubernetes/kubernetes | /test/e2e/storage/drivers/in_tree.go | Go | go | 62,726 | permissive | /*
Copyright 2018 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, ... |
7649afbae078e2689152280e76c530f927eefd67 | 1ab55e474544d11e51253e8dff357a25aab86cc9 | luohao/csilvm | /pkg/csilvm/metrics_test.go | Go | go | 9,205 | permissive | // +build !unit
//nolint:errcheck
package csilvm
import (
"context"
"testing"
"github.com/uber-go/tally"
)
func TestMetricsUptime(t *testing.T) {
// We set an empty prefix as it adds noise to the metric names.
const prefix = ""
scope := tally.NewTestScope(prefix, nil)
var vgname string
func() {
vgname = ... |
c1d45301250349b2b644d581d1966dd2d8319bb2 | 53aaeadcaaa30429805ee0092beb19f25c2d121c | tokbes/hostctl | /pkg/host/profile.go | Go | go | 4,329 | permissive | package host
import (
"bytes"
"fmt"
"io"
"net"
"github.com/guumaster/hostctl/pkg/host/errors"
"github.com/guumaster/hostctl/pkg/host/render"
)
// Profile contains all data of a single profile
type Profile struct {
Name string
Status Status
IPList []string
Routes map[string]*Route
}
// DefaultProfile con... |
cd48ff2959e1482878b643983310240a12677d7c | da7a35f3f7addcbcabb313cbd7e77e82b01d7a0d | DennisRutjes/tegola | /cmd/tegola_lambda/main.go | Go | go | 3,153 | permissive | package main
import (
"log"
"net/http"
"net/url"
"os"
"github.com/arolek/algnhsa"
"github.com/go-spatial/tegola/atlas"
"github.com/go-spatial/tegola/cmd/internal/register"
"github.com/go-spatial/tegola/config"
"github.com/go-spatial/tegola/dict"
"github.com/go-spatial/tegola/mvt"
"github.com/go-spatial/teg... |
6c550c2f272af4c3cf813919b091d2e0c6e5a919 | eb493de2266311a0f3bf2ec7dd9cf5bbb76765b9 | jasonkuhrt/origin | /pkg/cmd/flagtypes/net.go | Go | go | 1,750 | permissive | /*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
74b7a01eacf0b0a47f1081d962727020eb986f03 | 12d04e0e8416c5cae16b1302520c66f1aac8e0e6 | cppforlife/packer-bosh | /provisioner/assets.go | Go | go | 581 | permissive | package provisioner
// Assets represents assets directory that can be uploaded to a remote location
type Assets struct {
localDir string
}
func NewAssets(localDir string) Assets {
return Assets{localDir: localDir}
}
func (a Assets) Upload(remoteDir string, cmds SimpleCmds) error {
err := cmds.MkdirP(remoteDir)
i... |
fb5d2926e199ad3366de473247d8c8ce3df7ac42 | 381614de2df4de52638ae1c4f23497baba25cd53 | mirolima/fabric | /core/chaincode/exectransaction_test.go | Go | go | 49,010 | permissive | /*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
3c923665994c4d198e4a0cfd9d5cfa603d78352f | 8fbac0b60b42f4ab336cd97b36f3a1aac465dccb | norand94/bitcoin-address-info | /main.go | Go | go | 434 | no_license | package main
import (
"io/ioutil"
"os"
"github.com/norand94/bitcoin-address-info/app"
"github.com/norand94/bitcoin-address-info/app/config"
"gopkg.in/yaml.v2"
)
func main() {
file := os.Getenv("APP_CONFIG")
if file == "" {
file = "conf.yaml"
}
bts, err := ioutil.ReadFile(file)
if err != nil {
panic(er... |
ad1768139465a614ec9a94d8fbc8f36ab4f51579 | 692861b60f84f0876c0e4d70161d69798383d09c | ManchersterByTheSea/openBilibili | /go-common/app/interface/main/dm/dao/notify_test.go | Go | go | 877 | no_license | package dao
import (
"context"
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestDaonotifyURI(t *testing.T) {
convey.Convey("notifyURI", t, func(convCtx convey.C) {
convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
p1 := testDao.notifyURI()
convCtx.Convey("Then p1 sho... |
bedcc05b6a94edb233b294123b5f75a2d19d026c | 4ea13118ee6acd959e4f5f311818cf3604171f6c | TopBlockChain/fabric-sdk-go | /pkg/fab/events/deliverclient/dispatcher/dispatcher_test.go | Go | go | 8,741 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package dispatcher
import (
"testing"
"time"
"github.com/blockchain/fabric-sdk-go/pkg/common/providers/fab"
clientdisp "github.com/blockchain/fabric-sdk-go/pkg/fab/events/client/dispatcher"
clientmocks "github.... |
68692d03647fc1dcf3909ca8f036a5e150f4b14c | a0821cb0d20e20f38d742e25dd5c531ca2a9011f | pedropinheiro75/materialize-feed | /feed/actions/users.go | Go | go | 5,482 | no_license | package actions
import (
"feed/models"
"fmt"
"github.com/gobuffalo/buffalo"
"github.com/gobuffalo/pop/v5"
"github.com/gobuffalo/x/responder"
"net/http"
)
// This file is generated by Buffalo. It offers a basic structure for
// adding, editing and deleting a page. If your model is more
// complex or you need mor... |
798f67d71003e2b86c578ab390eb7ef047e76f8a | 6145ba7ae25470fba77047172e7dddb5527cf8a0 | looplanguage/loop_core | /models/ast/array.go | Go | go | 831 | no_license | package ast
import (
"fmt"
"github.com/looplanguage/loop/models/tokens"
"strings"
)
type IndexExpression struct {
Token tokens.Token
Index Expression
Value Expression
}
func (ie *IndexExpression) expressionNode() {}
func (ie *IndexExpression) TokenLiteral() string { return ie.Token.Literal }
func (ie *Ind... |
671cc115ce65a0232e131a746745e8f6df659ff2 | de50edf2862658c112deb35a92f1120823056023 | a20351766/mchain | /core/chaincode/platforms/node/platform.go | Go | go | 5,843 | permissive | /*
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
*/
package node
import (
"archive/tar"
"bytes"
"compress/gzip"
"errors"
"fmt"
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/hyperledger/mchain/common/flogging"
"github.com/hyperledger/mchain/core/chainco... |
83d15c7d3e95a53f5de9b93882f3c444a9da219d | 70f112e9e81533810f280e8d47ad41aa26023c8d | postmannen/go-learning | /http/001-calhounCourse/controllers/users.go | Go | go | 1,380 | permissive | package controllers
import (
"fmt"
"net/http"
"github.com/gorilla/schema"
"github.com/postmannen/go-learning/http/001-calhounCourse/views"
)
//NewUsers to prepare and create a new user
func NewUsers() *Users {
return &Users{
NewView: views.NewView("bootstrap", "views/users/new.html"),
}
}
//SignupForm is u... |
2bf54ad8dd48c7ec375b354e701b566e90341708 | 00eb76bdc11531535dfc6067df5a1715f2275123 | fubrenda/a | /recordstore/store_test.go | Go | go | 3,036 | no_license | package recordstore_test
import (
"fmt"
"testing"
"github.com/coreos/bbolt"
"github.com/fubrenda/a/recordstore"
"github.com/fubrenda/a/testtools"
"github.com/stretchr/testify/assert"
)
func TestNewStorageOperation(t *testing.T) {
op := recordstore.NewStorageOperation("a", "b", "c", []byte("b"))
assert.IsTy... |
bcea9de37446e11ea0315ed68231d084e9f133ce | ab63fad825edaf2e2bb4021d30f986daf8c07019 | wzhanw/modelmesh-serving | /controllers/modelmesh/endpoint.go | Go | go | 1,558 | permissive | // Copyright 2021 IBM 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 agreed to... |
67b6d1ad0fc2e57a105baeb8da841d221cfdea3c | 26b0326ae4dc705ec518e65af6007e401d58c335 | ludanfeng/baetyl-cloud | /models/callback.go | Go | go | 712 | permissive | package models
import (
"time"
)
type Callback struct {
Name string `json:"name,omitempty" validate:"omitempty,resourceName"`
Namespace string `json:"namespace,omitempty"`
Method string `json:"method,omitempty" binding:"required"`
Url string `json... |
b5c8dad7221de5f7d09ee4ad20fa0f39a708b53d | 89401fc51ca5b99fa798cd5dceda2de59c64eee4 | twitchtv/retool | /_tools/src/github.com/mitchellh/gox/platform.go | Go | go | 2,447 | permissive | package main
import (
"fmt"
"strings"
)
// Platform is a combination of OS/arch that can be built against.
type Platform struct {
OS string
Arch string
// Default, if true, will be included as a default build target
// if no OS/arch is specified. We try to only set as a default popular
// targets or targets... |
d30b95695f735b50cb3d97cedad53001074a6bf1 | fff47155e43678082252c91331b703f7fd31cb02 | rebider/Fgame | /game/quest/check/check_realm_challenge.go | Go | go | 1,305 | permissive | package check
import (
"fgame/fgame/game/player"
"fgame/fgame/game/player/types"
playerquest "fgame/fgame/game/quest/player"
"fgame/fgame/game/quest/quest"
questtypes "fgame/fgame/game/quest/types"
playerrealm "fgame/fgame/game/realm/player"
gametemplate "fgame/fgame/game/template"
log "github.com/Sirupsen/lo... |
bf579e91b3c1529c1005aa3a96fdf5191400e0d6 | f4b952386c0f73ae45859e60d4d15a1d23db4992 | lebrancconvas/kratos | /transport/grpc/resolver/discovery/resolver.go | Go | go | 1,720 | permissive | package discovery
import (
"context"
"net/url"
"time"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry"
"google.golang.org/grpc/attributes"
"google.golang.org/grpc/resolver"
)
type discoveryResolver struct {
w registry.Watcher
cc resolver.ClientConn
log *log.Helper
ctx ... |
4f24754050964c5d57f7f041e48bb78cbfaf19dd | 7354bde88116d3f660c2c0faca95379aa27bf06b | timshen/milvus-operator | /controllers/predicate_debug.go | Go | go | 1,694 | permissive | package controllers
import (
"fmt"
milvusiov1alpha1 "github.com/milvus-io/milvus-operator/api/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
)
var debugLog = logf.Log.W... |
717644a754404d725e6cfe432278196078501d9a | f7d6a3b1ba7926c21b0379709542ca3e35f2ca11 | kissthink/goc | /protocol/emulation/events.go | Go | go | 351 | permissive | package emulation
const (
// Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
VirtualTimeBudgetExpiredEvent = "Emulation.virtualTimeBudgetExpired"
)
// Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
type VirtualTimeBud... |
5906fc8c5aa196f769b7a0ec8c6666f5b71cebf5 | d1c42a8ebc823901103d4bc651513de8a9db90cc | aws-cloudformation/rain | /internal/cmd/fmt/fmt.go | Go | go | 3,724 | permissive | package fmt
import (
"fmt"
"io"
"os"
"strings"
"github.com/aws-cloudformation/rain/cft/format"
"github.com/aws-cloudformation/rain/internal/config"
"github.com/aws-cloudformation/rain/internal/console"
"github.com/aws-cloudformation/rain/internal/ui"
"github.com/aws-cloudformation/rain/cft/parse"
"github.c... |
2874f24258f3b1ea26efb9823525622d7ad665b6 | e832b0c92731c869ebe2471dfb95ca3d7adf068f | michft/nats-1 | /reconnect_test.go | Go | go | 8,345 | permissive | package nats
import (
"sync"
"sync/atomic"
"testing"
"time"
)
func startReconnectServer(t *testing.T) *server {
return startServer(t, 22222, "")
}
func TestReconnectDisallowedFlags(t *testing.T) {
ts := startReconnectServer(t)
ch := make(chan bool)
opts := DefaultOptions
opts.Url = "nats://localhost:22222"
... |
e9aac2e0671cf38b06258c38ac79ed99f53efc56 | fda730a9d59846471ea046569bf8a1bb5838d4d7 | miracl/core | /go/TestMPIN.go | Go | go | 12,983 | permissive | /*
* Copyright (c) 2012-2020 MIRACL UK Ltd.
*
* This file is part of MIRACL Core
* (see https://github.com/miracl/core).
*
* 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... |
a5020db1e69e88ea8dfb55d58dd429f127b337d7 | ca87c71664150fa0f13bb979b53afe711bf978a8 | tianziaxe/sdk-tutorials | /blog/blog/cmd/blogd/main.go | Go | go | 3,439 | permissive | package main
import (
"encoding/json"
"io"
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/... |
24146319995f80ee0d341070dd4c34fad8b16664 | 96740ad2939b3117f3cf909e2201a857d2a5df84 | kimiazhu/slf4g | /logger.go | Go | go | 2,272 | permissive | // Copyright 2011 ZHU HAIHUA <kimiazhu@gmail.com>.
// All rights reserved.
// Use of this source code is governed by MIT
// license that can be found in the LICENSE file.
// Description: slf4g
// Author: ZHU HAIHUA
// Since: 2016-05-02 21:22
package slf4g
import (
"time"
"runtime"
"fmt"
)
type ILogger interface {... |
d197eb609d81ec7d1ba5f5d11dce513eeb170917 | d73e1f03bee01cc144101a9f027ac6af359afccb | chaseterry/argo-events | /gateways/server/resource/start.go | Go | go | 8,184 | permissive | /*
Copyright 2018 BlackRock, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
74d02dcb0473c4b30cac56a69a7439a2fa6a55cd | 7473f71546de125d8a3f2634a12c6ffa37455750 | garcialuis/Gossip | /api/mocks/nutriport_food.go | Go | go | 873 | no_license | package mocks
import nutriportclient_models "github.com/garcialuis/Nutriport/sdk/models"
type FoodClient struct{}
func NewFoodClientMock() *FoodClient {
return &FoodClient{}
}
func (c *FoodClient) CreateFoodItem(foodItem nutriportclient_models.FoodItem) nutriportclient_models.FoodItem {
newFoodItem := nutriportc... |
8efc33df1564b04537a0c5a62b53621e05f7b610 | af0678b8a6b2ba6fb9ccd534b91b47ed3165d194 | bonitoo-io/telegraf | /plugins/inputs/amqp_consumer/amqp_consumer.go | Go | go | 10,237 | permissive | //go:generate ../../../tools/readme_config_includer/generator
package amqp_consumer
import (
"context"
_ "embed"
"errors"
"fmt"
"math/rand"
"strings"
"sync"
"time"
amqp "github.com/rabbitmq/amqp091-go"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/teleg... |
36144443d291fb485efeb37499c7a602da645241 | effd686db209bd8f47bf934cc40df70a47359966 | FearlessSolutions/k8straining | /app-multiplier/main.go | Go | go | 2,932 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"math"
"net/http"
"net/url"
"os"
"strconv"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
)
func main() {
portString := os.Getenv("PORT")
if portString == "" {
log.Fatal("PORT must be set")
}
// Validate it parses to an int
_, err := strconv... |
9af37636ad89456dec2dbe3d382e44c40007f243 | 9f285c967132122ad3b1e0c6a381cbffa14de17d | odinlinkorg/odin | /core/chain_indexer_test.go | Go | go | 7,306 | no_license | // Copyright 2017 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
1fb1a0a266fc0da83bfe4a8c6dccbe513a275f2b | a8b60143c15dde72d49a9c79c50b63132a82a760 | avarf/bbgo | /pkg/exchange/ftx/rest_order_request.go | Go | go | 3,461 | permissive | package ftx
import (
"context"
"encoding/json"
"fmt"
"strconv"
"time"
)
type orderRequest struct {
*restRequest
}
/*
{
"market": "XRP-PERP",
"side": "sell",
"price": 0.306525,
"type": "limit",
"size": 31431.0,
"reduceOnly": false,
"ioc": false,
"postOnly": false,
"clientId": null
}
*/
type Pl... |
ecb8465637cb3fa03e66b65bc50ab42080d6ed1a | e31d197fadbff427e144cb96a9038cdc8b8a83ec | sheepcat/pouch | /ctrd/client.go | Go | go | 7,772 | permissive | package ctrd
import (
"context"
"fmt"
"io"
"os"
"os/exec"
"path"
"strconv"
"strings"
"sync"
"syscall"
"time"
"github.com/alibaba/pouch/pkg/scheduler"
"github.com/alibaba/pouch/pkg/utils"
"github.com/containerd/containerd"
"github.com/sirupsen/logrus"
)
const (
unixSocketPath = "/run/c... |
b831b7313c83ef644c66203f4471a6e0ff3ca75c | b6113992e08e8bdfad3a759a0ba956eab13db00f | oracle/cluster-manager | /vendor/github.com/docker/docker/integration-cli/docker_test_vars.go | Go | go | 4,107 | permissive | package main
import (
"encoding/json"
"fmt"
"os"
"os/exec"
"github.com/docker/docker/pkg/reexec"
)
var (
// the docker binary to use
dockerBinary = "docker"
// path to containerd's ctr binary
ctrBinary = "docker-containerd-ctr"
// the private registry image to use for tests involving the registry
regist... |
a1b7b1bb872c715f9c4187f9dc766b219939a063 | b05a015126f03d769afc3e702c2470d97b0072c2 | troyzzz01/data-structure | /queue/interface_blocking_queue.go | Go | go | 2,463 | permissive | package queue
import "time"
type BlockingQueue interface {
Queue
/**
* Inserts the specified element into this queue, waiting if necessary
* for space to become available.
*
* @param e the element to add
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if the s... |
152658334ffb45c3479772a59c218ffdfdeabbd8 | ee4e1ab01f51b3021c8dd703d5996b63dd707f45 | shadown/gogs | /internal/markup/markdown.go | Go | go | 5,190 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package markup
import (
"bytes"
"fmt"
"path"
"path/filepath"
"strings"
"github.com/russross/blackfriday"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs... |
ed22ea1f9375601a39ebf9520a59372f7824d169 | 9b510fdc14c8b8a8f15fcca2a40e67f92a5251ad | jasonmcintosh/terraform-provider-infoblox | /infoblox/resource_ns_record.go | Go | go | 2,880 | permissive | package infoblox
import (
"github.com/CARFAX/skyinfoblox/api/common/v261/model"
"github.com/carfax/terraform-provider-infoblox/infoblox/util"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceNSRecord() *schema.Resource {
return &schema.Resource{
Create: resourceNSRecordCreate,
Read: resourceNSR... |
aab05b2d60b737d033902707af347a65d6b7a637 | 12583826513e333f91573d4e05ac5bd96c30d23f | opencord/voltha-epononu-adapter | /vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/endpoint_manager.go | Go | go | 11,385 | no_license | /*
* Copyright 2020-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 ... |
0cd955f802e7e1462cb3ca1569d325b5f79ba680 | 817f2663d273aff3c3bdbb7cd477a295d074b289 | wangzlei/opentelemetry-collector-contrib | /processor/deltatorateprocessor/doc.go | Go | go | 869 | permissive | // Copyright The OpenTelemetry 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 ag... |
ce2129085a3543c946b4d62521bd8c931f9f391b | cf1cd19c1ce15b330a8591f0212048769b2e57e0 | turbolent/deployd | /vendor/github.com/docker/docker/registry/registry_mock_test.go | Go | go | 14,679 | permissive | // +build !solaris
package registry
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
"net/url"
"strconv"
"strings"
"testing"
"time"
"github.com/docker/distribution/reference"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/gorilla/m... |
699cb711fd0a2d3a08dcf18ed5996b2aac732ee4 | ec5345e896c6733a319172478c2b80eb17e27b84 | abxd39/exchange | /ws_service/rpc/client/client.go | Go | go | 260 | no_license | package client
var InnerService *RPCClient
type RPCClient struct {
UserService *UserRPCCli
}
func NewRPCClient() (c *RPCClient) {
c = &RPCClient{
UserService: NewUserRPCCli(),
}
return c
}
func InitInnerService(){
InnerService = NewRPCClient()
}
|
dcaf5e83cbbdfba09c790ab24c980cf66ac13a72 | 6867d3f72f37cd1ca1990bfcbc6c5cbed8c5ac74 | ThomasNguyenGitHub/talaria | /internal/config/store.go | Go | go | 1,415 | permissive | // Copyright 2019-2020 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
// Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
package config
import (
"log"
"sync/atomic"
"time"
"github.com/grab/async"
"golang.org/x/net/context"
)
// store stores the config a... |
a3cce100b20a58c9b05feae9b68ebb8c4265ec7d | 0ee04ad068ab940a26fdc60278e8b232030abf0b | vmware/vsphere-automation-sdk-go | /services/nsxt-mp/nsx/fabric/virtual_machines/ToolsInfoClient.go | Go | go | 4,679 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Interface file for service: ToolsInfo
// Used by client-side stubs.
package virtual_machines
import (
vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/... |
f73e50d4a318e1bb9207f1cb02935015318a9ed2 | 0e12010e82839d1d464910d7e23cdd88aad7720c | KayX-Org/freja | /middleware/grpc.go | Go | go | 1,101 | permissive | package middleware
import (
"context"
"fmt"
"github.com/kayx-org/freja/component"
"github.com/kayx-org/freja/healthcheck"
"net"
)
type grpcMiddleware struct {
service *component.GRPCServer
listener *net.Listener
status healthcheck.ServiceStatus
}
func NewGRPCMiddleware(service *component.GRPCServer) *grpc... |
7e17632e5a97eccad8f5200c0bee0feba3a3641d | 9767b7983b2f1f0ece11d59f33cd5dca4980e760 | igk1972/caddy-s3tls | /storages3.go | Go | go | 1,322 | no_license | package storages3
import (
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/caddyserver/caddy/caddytls"
"github.com/igk1972/magicstorage"
"github.com/mholt/certmagic"
)
const (
envNameRegion = "AWS_REGION"
envNameEndpoint = "AW... |
534dc062984404f741df0f1a9c3f397a82998add | 117ff90750b865e25c62343653eae3a1ecf43d8c | combchain/go-combchain | /types.go | Go | go | 1,969 | no_license | // Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
c20f707d28e90d660334ebf2b27738297fa3ad7e | 1af9930bc78f7c33fc4a6b513a555c1d5af88dfa | emiliza/pulumi-foo | /sdk/go/xyz/randomString.go | Go | go | 3,718 | 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 xyz
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A string of random characters of a given le... |
1ebcdbc9f89be6bab8d87a14204b5cdd2eb3593c | 2e4d9b3839f82e107667c47006c5c78b06fd53ee | christopherL91/GoInda13 | /Uppgift9/Web/server.go | Go | go | 2,571 | permissive | // Stefan Nilsson 2013-03-17
// This program runs three independent servers at
//
// http://localhost:8080, http://localhost:8081, and http://localhost:8082.
//
// Each server accepts HTTP Get requests and answers with an integer
// indicating the current (fake) temperature at KTH in Stockholm.
//
// The servers are u... |
93a85a8dd3868e111760709eabf9d259d246df69 | 06cd92e04440496b92202d0ff6c98c694d0b6d25 | ales6164/apis | /v5/worker.go | Go | go | 2,352 | no_license | package apis
import (
"cloud.google.com/go/datastore"
"fmt"
"golang.org/x/net/context"
"reflect"
)
type Worker interface {
Init() error
Parse(value interface{}) ([]datastore.Property, error)
Output(ctx context.Context, value interface{}) interface{}
}
func (x *Field) Parse(value interface{}) ([]datastore.Prop... |
786066ec5453164943e12ca703be5f96e3b43676 | 05da287c58b075dd280bbb4ba167ca5b92f55a40 | ytjoe/lotus | /blockstore/mem.go | Go | go | 2,894 | permissive | package blockstore
import (
"context"
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
blocks "github.com/ipfs/go-libipfs/blocks"
)
// NewMemory returns a temporary memory-backed blockstore.
func NewMemory() MemBlockstore {
return make(MemBlockstore)
}
// MemBlockstore is a terminal blockstore th... |
55046e54a134eaf3b23ec495a634954ace2f6c7f | ed082b11cf23379153f1cd73d3a40ce4e9476296 | AvAudioPlayer/garble | /shared.go | Go | go | 7,480 | permissive | package main
import (
"bytes"
"crypto/rand"
"encoding/base64"
"encoding/gob"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
// sharedCache is shared as a read-only cache between the many garble toolexec
// sub-processes.
//
// Note that we fill this cache once from the root process in save... |
b7f31c5e3b1e8c4641b86f9b7f3aa94c6ba02fb8 | 46ec66a904be6c6d8ef50a80203259f4f7c03911 | linuxkit/linuxkit | /pkg/init/vendor/github.com/containerd/containerd/mount/lookup_unsupported.go | Go | go | 861 | permissive | // +build windows
/*
Copyright The containerd 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... |
a6ee5b0220c2746109e92c40da18143bfc006508 | 62ff0eb1ad65a9c30a1916d3bce0b5a9ff67865f | jayvib/ds-algo | /books/go-ds-algo/search/problems/majority_element/sort_and_search/sort_and_search_test.go | Go | go | 465 | no_license | package sort_and_search
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestFindMajority(t *testing.T) {
t.Run("Found", func(t *testing.T){
input := []int{1, 2, 2, 2, 2, 3}
want := 2
got, ok := FindMajority(input)
assert.True(t, ok)
assert.Equal(t, want, got)
})
t.Run("Not Found", func(t... |
c419c7993c21d8f1ac81fac99ee97bcf38f8dec6 | 9b51a44b6bf1d0d94a133be1bd0dd0e12d66d2f2 | talkincode/TeamsACS | /common/aes/aes.go | Go | go | 2,886 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
8a02d340475da2fb37b4163b5e7a831b9d404832 | ab217f53af00749f9f196a3f5e2ff0d389f7a73f | RainbowMango/huaweicloud-sdk-go-v3 | /services/iam/v3/model/model_keystone_remove_user_from_group_response.go | Go | go | 441 | permissive | /*
* IAM
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
*/
package model
import (
"encoding/json"
"strings"
)
// Response Object
type KeystoneRemoveUserFromGroupResponse struct {
}
func (o KeystoneRemoveUserFromGroupResponse) String() string ... |
13938f4da030e1fa076a2b7c847da5ef7e51d1aa | 5ceb9374e47761e6437a4fd1758c363de6d211ee | Tarantiner/monitor | /goods.go | Go | go | 619 | no_license | package main
import (
"bufio"
"log"
"os"
"strings"
"time"
)
func loadGoods() {
var err error
f, err := os.Open("goods.txt")
if err != nil {
log.Println("打开监控表失败", err)
return
}
defer f.Close()
rd := bufio.NewReader(f)
var s string
for {
s, err = rd.ReadString('\n')
data := strings.SplitN(s, "|", ... |
156924d5902612c537ff2ffc170088c70b1cffa2 | 8b7aa0e94fb00bb1f5406bf8c794f508d859306a | mdnix/oauth-proxy-operator | /controllers/helper.go | Go | go | 1,122 | permissive | /*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License... |
293f262a13bb4a4683080d79c75c632a6809b55a | dc8421a804d7d3f1febae13550a1d44cc5ae1209 | hanhiver/gogogo | /goprograming/function/noNameFunc/noNameFunc.go | Go | go | 370 | no_license | package main
import (
"fmt"
)
func main() {
testFunc := selfAdd()
fmt.Println(testFunc())
fmt.Println(testFunc())
fmt.Println(testFunc())
testFunc = selfAdd()
fmt.Println(testFunc())
fmt.Println(testFunc())
}
func selfAdd() func() int {
i := 0
return func () int {
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.