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 |
|---|---|---|---|---|---|---|---|---|
89657a3fd3a219eba45a94282c43e58c0a8667e9 | 556c40ec4a244bfd4d62d68e5bffed3ab4f93ae1 | PankeshGupta/cadence | /service/history/historyTestBase.go | Go | go | 16,931 | permissive | // Copyright (c) 2017 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... |
2ebc7438a5a9905e9bac951c2f71fc92d886113d | bb63d80b0969d917ca55a85599329e4953416ed1 | Oogy/trek | /types.go | Go | go | 6,418 | permissive | package main
import (
"errors"
"fmt"
"html/template"
"io"
"log"
"sort"
"github.com/hashicorp/nomad/api"
nomad "github.com/hashicorp/nomad/api"
"github.com/jroimartin/gocui"
)
type configuration struct {
Environments *[]environment
}
type environment struct {
Name string
Address string
}
func (config... |
43815c7fb59441cb99f7ccfaaf687b9240a7ed23 | 738fcc12c99319250ef4717190a8fb802d82ab99 | dezza/chroma | /lexers/groovy.go | Go | go | 2,225 | permissive | package lexers
import (
. "github.com/dezza/chroma" // nolint
)
// Groovy lexer.
var Groovy = Register(MustNewLexer(
&Config{
Name: "Groovy",
Aliases: []string{"groovy"},
Filenames: []string{"*.groovy", "*.gradle"},
MimeTypes: []string{"text/x-groovy"},
DotAll: true,
},
Rules{
"root": {
{... |
6d79971815b476fc1eccf60b6a2ba5d2365033c7 | fc7ae6a26a40c55d2d159d2e2e0a6ac30863d730 | PascalNoisette/miniflux | /api/feed.go | Go | go | 3,900 | permissive | // Copyright 2017 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 api // import "miniflux.app/api"
import (
"errors"
"net/http"
"miniflux.app/http/request"
"miniflux.app/http/response/json"
)
func (h *handl... |
aa71d41ff45efb36eb49e05c44e5cbc506896291 | 2d61ef771a89d873d6263d661c7914bce1416f0f | leiyangyou/task | /internal/summary/summary.go | Go | go | 1,982 | permissive | package summary
import (
"strings"
"github.com/leiyangyou/task/v2/internal/logger"
"github.com/leiyangyou/task/v2/internal/taskfile"
)
func PrintTasks(l *logger.Logger, t *taskfile.Taskfile, c []taskfile.Call) {
for i, call := range c {
printSpaceBetweenSummaries(l, i)
PrintTask(l, t.Tasks[call.Task])
}
}
... |
5aa7c94cd3d90da1602e351fb78966b22606497d | b3994052fa2afb3d37aa127cebbd1239f46f966c | AXONVX/goarista | /key/map_test.go | Go | go | 14,558 | permissive | // Copyright (c) 2019 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package key
import (
"errors"
"fmt"
"math/rand"
"strings"
"testing"
)
func (m *Map) debug() string {
var buf strings.Builder
for hash, entry := range m.custom ... |
939f16fbe4a4ceebfae37fe82c7305bc61bac3ad | 08105bf0b60c056446670c891663fdc4aee0832b | pock999/golang-practice | /example/base/printTriangle.go | Go | go | 339 | no_license | package main
import "fmt"
func main() {
var x uint16;
fmt.Println("請輸入一個正整數,:")
fmt.Scanln(&x);
fmt.Printf("x的數值:%d\n",x)
printTri(x);
}
func printTri(x uint16) {
var i uint16;
var j uint16;
for i = 0 ;i<x ; i++ {
str := "";
for j=0 ; j<i ; j++ {
str = str + "*";
}
fmt.Println(str);
}
} |
9feb5f0a8e1a1fece109f55645919d8c90e1f895 | cff5fe10b5b337a56d0b9df1ac200954bbad341c | AdrienneCohea/terraform-provider-nomadutility | /main.go | Go | go | 569 | no_license | package main
import (
"fmt"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/terraform"
)
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: func() terraform.ResourceProvider {
return Provider()
},
})
}
func nomadClient() (*api.Client, er... |
595704e0e5f900110b2885658a9bb89461119424 | c26d8899116f6ffcd587497404c7dd597c1b5f25 | ismilent/fscan | /common/Parse.go | Go | go | 3,770 | permissive | package common
import (
"bufio"
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
)
func Parse(Info *HostInfo) {
ParseScantype(Info)
ParseUser(Info)
ParsePass(Info)
ParseInput(Info)
}
func ParseUser(Info *HostInfo) {
if Info.Username == "" && Userfile == "" {
return
}
if Info.Username... |
9b70b757d01e94b1d894d625e53f6e26f8efc842 | 3b6d4aeb3794d83eb51965f731b5dae8e0536e77 | DirkWillem/0LAUK0-project | /src/main/dosesummaries.go | Go | go | 5,216 | no_license | package main
import (
"main/utils"
)
type (
// DoseSummarySummary contains summary information on a dose summary
DoseSummarySummary struct {
Date string `json:"date"`
DispensedCount int `json:"dispensedCount"`
PendingCount int `json:"pendingCount"`
TotalCount int `json:"totalCount"... |
5a5aad65c7cbb19067b968056fefe097ca5e78fa | 8da27313d1738054665849db0e3110fd1fd64461 | anshulvermapatel/cluster-logging-operator | /pkg/generators/forwarding/fluentd/fluent_conf_test.go | Go | go | 44,552 | permissive | package fluentd
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
logging "github.com/openshift/cluster-logging-operator/pkg/apis/logging/v1alpha1"
test "github.com/openshift/cluster-logging-operator/test"
)
var _ = Describe("Generating fluentd config", func() {
var (
forwarding *logging.Forwardi... |
3d7ee378d2d289e043d696bf98567fca98f55639 | c5f6169aaba49af120fa15b3343a8227fba3381b | magicshui/wechat | /mp/shakearound/statistics/pagelist.go | Go | go | 3,446 | 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), magicshui(shuiyuzhe@gmail.com), Harry Rong(harrykobe@... |
340a30ffc543ab2ca71469c771315f87364b480a | 5f9b03d45d3916286699b0a56030f75ebaa94499 | Kate-DONG/k3s | /pkg/etcd/etcd_test.go | Go | go | 7,489 | permissive | package etcd
import (
"context"
"net"
"net/http"
"os"
"path/filepath"
"testing"
"github.com/rancher/k3s/pkg/clientaccess"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/util/tests"
"github.com/robfig/cron/v3"
etcd "go.etcd.io/etcd/clientv3"
)
func generateTestConfig() *config.Cont... |
f51ca862b48afb67378d77ace867e79c91e3a837 | 9968f40b2edd291a7475366393a1b36b51ee91ae | nikaixuan/gostuff | /pkg/leetcode/math/linkedListRandomNode.go | Go | go | 663 | no_license | package math
import (
"goproject/pkg/leetcode/linkedList"
"math/rand"
)
// 382
// resovior sampling 水塘抽样
type Solution struct {
head *linkedList.ListNode
}
/** @param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at least one node. */
func Constructor(head *linkedL... |
3b29e4d9bca92bdf7188142affd30b1c0f07d19a | c1616b8c4c835e92cfd3befb4facc75f011541a7 | msingle/kubernetes | /pkg/controller/replicaset/replica_set_test.go | Go | go | 59,345 | 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, ... |
1462699996381827f843b7213f492036ef794e36 | 7d4319877b024205ce06c8a37bd4bb143dce8021 | cloudfoundry/system-metrics-release | /src/pkg/collector/processor.go | Go | go | 716 | permissive | package collector
import (
"log"
"time"
)
type InputFunc func() (SystemStat, error)
type Processor struct {
in InputFunc
senders []StatsSender
interval time.Duration
log *log.Logger
}
type StatsSender interface {
Send(SystemStat)
}
func NewProcessor(
in InputFunc,
senders []StatsSender,
inter... |
900d5d23aeb1ccc0f870a775178e0fbff0066d5f | 833d5c22b3a68ca63d1037f30abec8a6d35c3d17 | mewbak/suggest | /pkg/index/posting_list_test.go | Go | go | 6,190 | permissive | package index
import (
"bytes"
"fmt"
"io"
"reflect"
"testing"
"github.com/suggest-go/suggest/pkg/compression"
"github.com/suggest-go/suggest/pkg/store"
)
func TestSkipping(t *testing.T) {
skipEncoder, _ := compression.SkippingEncoder(3)
postings := []struct {
name string
posting PostingList
encode... |
1e6037e3568c6e67705357ac0b39cba477ff17c1 | 8f7529994264767a602c26889ae1c2c21cb83447 | golang-alex-alex2006hw/textile-go | /core/account.go | Go | go | 1,430 | permissive | package core
import (
"github.com/textileio/textile-go/crypto"
"github.com/textileio/textile-go/keypair"
)
// Account returns account keypair
func (t *Textile) Account() (*keypair.Full, error) {
if err := t.touchDatastore(); err != nil {
return nil, err
}
return t.datastore.Config().GetAccount()
}
// Address ... |
b6e944b1ac03582f48cc908dadfe40160a228444 | 8cff08f331b641145612a6f260fbcf25ef0ba176 | diotro/killcord | /vendor/github.com/ipfs/go-ipfs-api/vfs.go | Go | go | 3,552 | permissive | package shell
import (
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"time"
"gopkg.in/errgo.v1"
)
type shellVFS struct {
root string
shell *Shell
}
func (svfs shellVFS) Open(name string) (http.File, error) {
p := filepath.Join(svfs.root, name)
obj, err := svfs.shell.FileList(p)
if err != nil {
return ni... |
1da9807d8ee46a80412278a2086df25a83a82805 | 9a46db1c7ed153806141dc2ed3f0aa707af420a0 | buiminhhai1/golang_simple_store | /api/user.go | Go | go | 5,968 | no_license | package api
import (
"bytes"
"database/sql"
"errors"
"net/http"
"strings"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
db "github.com/thuhangpham/simplestores/db/sqlc"
"github.com/thuhangpham/simplestores/util"
)
type createUserRequest struct {
Username string `json:"username" binding:"... |
9b29a2adc99302b73e5d7a5fc19f29925a645e72 | e41a86ce9366474b62c4bf8b90c5231b9d46bdca | backwardn/fleet | /server/service/client_hosts.go | Go | go | 855 | permissive | package service
import (
"encoding/json"
"net/http"
"github.com/pkg/errors"
)
// GetHosts retrieves the list of all Hosts
func (c *Client) GetHosts() ([]HostResponse, error) {
response, err := c.AuthenticatedDo("GET", "/api/v1/kolide/hosts", nil)
if err != nil {
return nil, errors.Wrap(err, "GET /api/v1/kolid... |
b4fd0c5eb03b793fedf835e518d048478a4acc9a | 7cd59088fb42c173424f7a166a54476760c2927b | AlexeyNovichenko/test-infra | /controllers/loadtest_controller.go | Go | go | 19,201 | permissive | /*
Copyright 2020 gRPC 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, software
d... |
824f36228792a8789bbfe784aa430149eef4f18c | 311f143968342461c1fc13731433d9afb5f9efa9 | xuehanict/simulator | /spider/spider_test.go | Go | go | 547 | no_license | package spider
import (
"github.com/lightningnetwork/simulator/utils"
"testing"
)
const (
tenNodesGraph = "../data/ten_nodes.json"
tenNodesGraphComplex = "../data/ten_nodes_complex.json"
tenNodesGraphHalf = "../data/ten_nodes_half.json"
)
func TestSpider_SendPayment(t *testing.T) {
graph, err := util... |
5e56b10ac7bf4f5d195abf56fdee04c7305c0e7c | 59bdb10d2bcfbdd7a8c50c80a1f079f7623e01c9 | rohitkhatri1st/Golang | /4.3. Slicing a Slice.go | Go | go | 443 | no_license | package main
import (
"fmt"
)
func main() {
s := []int{42, 43, 44, 45, 46, 47, 48, 49, 50, 51}
for i, v := range s {
fmt.Println(i, v)
}
fmt.Println(s[:5]) //slicing s from start to element 4
fmt.Println(s[5:]) //slicing s from element 5 to end.
fmt.Println(s[2:7]) //slicing s from element ... |
ff0c37853d4c8311db87644407f013b933fc04dd | 49fbeef537277dcc00513de2c9206ddd13e82922 | stsully/oci-go-sdk | /datacatalog/import_glossary_request_response.go | Go | go | 3,274 | permissive | // Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
5fee2c7bfb2df7cf2b32505d9a81d8866143eac9 | 72e6a12cce001b67bb519e497d6823fb0ea50212 | caoxuwen/go | /services/horizon/internal/actions_operation_test.go | Go | go | 4,245 | permissive | package horizon
import (
"encoding/json"
"testing"
"time"
"github.com/caoxuwen/go/protocols/horizon/operations"
"github.com/caoxuwen/go/services/horizon/internal/db2/history"
"github.com/caoxuwen/go/services/horizon/internal/test"
)
func TestOperationActions_Index(t *testing.T) {
ht := StartHTTPTest(t, "base"... |
62073b5ed5cccb24440116ed2f2ffad0edc61500 | d2efb0c45badf36b665189add44c8e4e9f4ba5a5 | Mattlk13/oci-go-sdk | /goldengate/license_model.go | Go | go | 1,261 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
59c36926ab7ca70d714deeb3834aec5c184d2e1d | 84df21ca34e1c16c18a80e2a944c4f0dabadc901 | jangocheng/go-elasticsearch | /esapi/api.xpack.security.saml_complete_logout.go | Go | go | 5,214 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
85b431e53a6317eebff623b4b80fdf608fb982ac | d4c66f20cff09a58b0143815e034754d0de33b7c | muharihar/spago | /pkg/nlp/transformers/bart/loader/loader.go | Go | go | 1,760 | permissive | // Copyright 2020 spaGO 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 loader
import (
"fmt"
"github.com/nlpodyssey/spago/pkg/ml/nn"
"github.com/nlpodyssey/spago/pkg/nlp/transformers/bart"
"github.com/nlpodyssey/spago/p... |
d6e45b5aacca3a224296183abd2d7f3a341d4c53 | 6de2b32fe6dee8ef9ba1a01a16d8cbacc05873d0 | nomilious/Simple-Chat | /client.go | Go | go | 962 | no_license | package main
import (
"net"
"fmt"
"bufio"
"os"
"strings"
)
const (
ADDR_SERVER = ":8080"
END_BYTES = "\000\001\002\003\004\005"
)
func main() {
conn, err := net.Dial("tcp", ADDR_SERVER)
if err != nil {
panic("can't connect to server")
}
defer conn.Close()
go ClientOutput(conn)
ClientIn... |
8f8945ff6787a10c8c43202b63ddafa27eb7be39 | 7028899f04ffde481cbadee146f47df9c8c4e908 | Financial-Times/annotations-monitoring-service | /monitoring_service.go | Go | go | 7,760 | permissive | package main
import (
"fmt"
"sort"
"strings"
"time"
"github.com/Financial-Times/go-logger"
)
const (
defaultTimestampFormat = time.RFC3339Nano
contentType = "Annotations"
startEvent = "PublishStart"
completenessCriteriaEvent = "SaveNeo4j"
endEvent = "Publish... |
fb976630b0d8c9c81024c9d254bb4fb87075cce6 | 196d8e2fd38230b85c201404e71cdecde3fe1494 | abieberbach/homie-go | /events.go | Go | go | 629 | no_license | package homie_go
import "fmt"
type eventController struct {
handler map[string]EventHandler
}
func NewEventController() *eventController {
return &eventController{
handler: make(map[string]EventHandler),
}
}
func (controller *eventController) AddEventHandler(eventHandler EventHandler) {
controller.handler[fmt... |
8632f6121c5c09b828b7552a92b3574a2196e36a | e64fcb420f7c431d3fe45e4475bf21c2648e23ce | fedge247/go-config-cameras | /hkvision/digest-auth/authorization.go | Go | go | 4,219 | permissive | package digest_auth
import (
"bytes"
"crypto/md5"
"crypto/sha256"
"encoding/hex"
"fmt"
"hash"
"io"
"net/url"
"strings"
"time"
)
/**
* @author : Donald Trieu
* @created : 8/23/21, Monday
**/
type authorization struct {
Algorithm string // unquoted
Cnonce string // quoted
Nc int // unquoted... |
e9ad5cc21df1e74789d2c1917c5f4216068e4bbf | 9d617ba017e4a1fcb106b5d829c909c389e0e6fa | morlay/goqcloud | /clients/cvm/describe_instance_type_configs.go | Go | go | 1,129 | permissive | package cvm
import (
github_com_morlay_goqcloud "github.com/morlay/goqcloud"
)
// 查询实例机型列表
// https://cloud.tencent.com/document/api/213/15749
type DescribeInstanceTypeConfigsRequest struct {
// 过滤条件。 zone - String - 是否必填:否 -(过滤条件)按照可用区过滤。 instance-family - String - 是否必填:否 -(过滤条件)按照实例机型系列过滤。实例机型系列形如:S1、I1、M1等。每次请求... |
aec46cb6f5c49222530665c3f2e15132ebd6f9f7 | 28dad07a713d2844019ea2ce6058e3e730029499 | zlyzol/tendermint-0.32.3 | /libs/events/events.go | Go | go | 5,790 | permissive | // Package events - Pub-Sub in go with event caching
package events
import (
"fmt"
"sync"
cmn "github.com/zlyzol/tendermint-0.32.3/libs/common"
)
// ErrListenerWasRemoved is returned by AddEvent if the listener was removed.
type ErrListenerWasRemoved struct {
listenerID string
}
// Error implements the error in... |
b82a404a0f892eb4a51b0c14f1f21d31fb4c0318 | fc70cb2235e6f8773a65271d0d410570522102b1 | boplennon/quickfix | /datadictionary/message_def_test.go | Go | go | 3,304 | permissive | package datadictionary_test
import (
"testing"
"github.com/boplennon/quickfix/datadictionary"
"github.com/stretchr/testify/assert"
)
func TestNewMessageDef(t *testing.T) {
ft1 := datadictionary.NewFieldType("type1", 11, "STRING")
ft2 := datadictionary.NewFieldType("type2", 12, "STRING")
ft3 := datadictionary.... |
f36689d63f568cfb316b5469523ab87cd49fae21 | fc9ceb5eb40313168e44e805599a3fae433a2f62 | aws/amazon-cloudwatch-agent | /plugins/outputs/cloudwatch/aggregator.go | Go | go | 5,922 | permissive | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT
package cloudwatch
import (
"fmt"
"log"
"strings"
"sync"
"time"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/amazon-cloudwatch-agent/metric/distribution"
)
const (
aggregationIntervalTagK... |
e76792f2bccf8411dc07de0f6ded3b63893ffb3f | 34a4735efb2b047dce4ec2271ef1268804ebab08 | dgageot/skaffold | /pkg/skaffold/kubernetes/wait.go | Go | go | 4,577 | permissive | /*
Copyright 2019 The Skaffold Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
3a27f8409c06af7ce060af213ea4ea626e397b51 | ffc3c440543fd48dce477e7f97072950ff78fd42 | netww/go-safeweb | /safehttp/plugins/xsrf/xsrf.go | Go | go | 4,575 | 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
c76044b78d6827fe22125a7e63deef4311b92ea3 | 95d7e8738ec0fa9e09f267ca192a992da9b089e0 | huaweicloud/huaweicloud-sdk-go-v3 | /services/dcs/v2/model/model_show_diagnosis_task_details_response.go | Go | go | 835 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ShowDiagnosisTaskDetailsResponse Response Object
type ShowDiagnosisTaskDetailsResponse struct {
// 诊断结果为异常的诊断项总数
AbnormalItemSum *int32 `json:"abnormal_item_sum,omitempty"`
// 诊断失败的诊断项总数
FailedItemSum *int32 `json... |
dd475311eeabeedecb173feae64515f571020545 | a24e6b8a6688a87950dff14c4f858a52bc4dc751 | a-aslani/gament-server | /app/middleware/auth_middleware.go | Go | go | 3,288 | no_license | package middleware
import (
"Server/app/constants"
"Server/app/response"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
const (
HeaderAuthorization = "Authorization"
HeaderRegister = "Register"
)
//Check RS256 token
func UserAccessToken() gin.HandlerFunc {
return func(c... |
724a231e7c1dd1a6670056bda4693d3762d1e5d4 | b0591565e90befefaa3c1a027f738eb06569d1dd | MadsRC/kafkactl | /operations/consumergroupoffsets/consumer-group-offset-operation.go | Go | go | 8,358 | permissive | package consumergroupoffsets
import (
"context"
"github.com/Shopify/sarama"
"github.com/deviceinsight/kafkactl/operations"
"github.com/deviceinsight/kafkactl/output"
"github.com/deviceinsight/kafkactl/util"
"github.com/pkg/errors"
"strconv"
)
type ResetConsumerGroupOffsetFlags struct {
Topic strin... |
71d0a22a2718c05c14224bc9b92e083764724cf9 | 8c4a4cd51919c33f1d8ec16f2cb7f5bcf523689f | pradipvaghasiya/sync_gateway | /channels/sync_runner.go | Go | go | 7,569 | permissive | // Copyright (c) 2012-2013 Couchbase, Inc.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to... |
7591f8683d4caadf7d252563bec4b8fda9de7c11 | 78e0c530b1983cbd5d8f3dd6f17cb1215ccff36d | mensylisir/kmpp | /pkg/service/cluster/adm/phases/initial/worker.go | Go | go | 395 | permissive | package initial
import (
"github.com/kmpp/pkg/service/cluster/adm/phases"
"github.com/kmpp/pkg/util/kobe"
"io"
)
const (
initWorker = "08-kubernetes-worker.yml"
)
type WorkerPhase struct {
}
func (WorkerPhase) Name() string {
return "InitWorker"
}
func (s WorkerPhase) Run(b kobe.Interface, writer io.Writer) e... |
75892b4c5a94f513732540dcc02a1686f7fdec9b | 4c5516273d8d7576780a0b1abd43d2ab7de22bcb | Rajik/workflow-cli | /parser/tags.go | Go | go | 2,405 | permissive | package parser
import (
"github.com/teamhephy/workflow-cli/cmd"
docopt "github.com/docopt/docopt-go"
)
// Tags routes tags commands to their specific function
func Tags(argv []string, cmdr cmd.Commander) error {
usage := `
Valid commands for tags:
tags:list list tags for an app
tags:set set tags fo... |
140e348c981c831001144f1148d4d6ac29102d08 | 70ed5fd69c48d6ce3e8cde0f47df1099471edf14 | dewitt4/jx | /pkg/cmd/opts/pullrequest.go | Go | go | 5,589 | permissive | package opts
import (
"fmt"
"strings"
"github.com/jenkins-x/jx-logging/pkg/log"
"github.com/jenkins-x/jx/v2/pkg/gits"
"github.com/jenkins-x/jx/v2/pkg/util"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/uuid"
)
// PullRequestDetails details to pass in to create a PullRequest if the repository is modifi... |
05d0653c7278db05b764dc49a894ee513fa9f806 | fe1727ce574b2741c4001217a1753efa66fbdbce | rizalgowandy/FastBinaryEncoding | /projects/Go/proto/test/StructMap.go | Go | go | 9,166 | permissive | // Automatically generated by the Fast Binary Encoding compiler, do not modify!
// https://github.com/chronoxor/FastBinaryEncoding
// Source: test.fbe
// Version: 1.7.0.0
package test
import "fmt"
import "strconv"
import "strings"
import "errors"
import "../fbe"
import "../proto"
// Workaround for Go unused imports ... |
1ceb008500557fb764d3df7464fc5e175b863a1b | 9a5829b590dd12bd37cccfbff4fdde0f67cbe96b | djockin/etcd | /raft/log_test.go | Go | go | 18,539 | permissive | /*
Copyright 2014 CoreOS, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... |
dfa6a41a823c34e4c5b7139cded4a53d2e221580 | 3ceb98e6c14f1954f13dd5aac421594835a69d62 | JasonRammoray/ud897-client-server-communication | /utils/http2/server_test.go | Go | go | 62,973 | permissive | // Copyright 2014 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.
// See https://code.google.com/p/go/source/browse/CONTRIBUTORS
// Licensed under the same terms as Go itself:
// https://code.google.com/p/go/source/browse/LICEN... |
f190d988e85a813642a356bf6710c7353c7751b3 | 0ca288dce63156fb21009cd967139ea048fb5d64 | nerg4l/goperiment | /signedurl/url_test.go | Go | go | 6,247 | permissive | package signedurl
import (
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
)
func urlParse(rawurl string) *url.URL {
u, err := url.Parse(rawurl)
if err != nil {
panic(err)
}
return u
}
func TestSign(t *testing.T) {
type args struct {
ref *url.URL
key []byte
}
tests := []... |
d33065e9aed52ad03db6a3361741767258a50de8 | c6e078c00ddb48884c78e5c2106f3b76fab1321b | strogo/pebble | /internal/daemon/ucrednet_test.go | Go | go | 5,453 | no_license | // Copyright (c) 2014-2020 Canonical Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY ... |
45fb76224743f6cf8f74aad77a8c512fae20a6d7 | f91ed9c5286384a99156207d12ccd88a11fa65b5 | rbaderts/spacerace | /core/login.go | Go | go | 5,846 | no_license | package core
import (
"crypto/rand"
"encoding/base64"
"context"
"fmt"
"github.com/coreos/go-oidc"
_ "github.com/gocraft/dbr/v2"
"github.com/rbaderts/spacerace/auth"
"net/http"
"net/url"
"os"
)
type handler struct{}
/*
func AuthRequired() gin.HandlerFunc {
return func(c *gin.Context) {
c.Next()
}
}
*/... |
bef089793d90932a9525db3e4db197c602d5037a | 7b50fc30eef84c13218a4329dace3ec3cff1a19e | portworx/torpedo | /vendor/github.com/oracle/oci-go-sdk/v65/core/create_boot_volume_backup_request_response.go | Go | go | 4,071 | permissive | // Copyright (c) 2016, 2018, 2022, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
b5c87494e11cf1232f9393353e82c2abf9b76bdb | 07d7cd6b9497ae89f4fe9f3a01cc8862cabb3934 | AvrilCurry/Agenda | /TestCobra/cmd/register.go | Go | go | 5,161 | permissive | // Copyright © 2017 NAME HERE <EMAIL ADDRESS>
//
// 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 ... |
2739630e6321167ad69e45d5dc42f8d59d85f194 | 990d778503d8326114617c0266b7cb20365f2c15 | owncloud/ocis | /vendor/github.com/cs3org/reva/v2/pkg/rhttp/rhttp.go | Go | go | 10,291 | permissive | // Copyright 2018-2021 CERN
//
// 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... |
8ad38d314902ef48edb4e648179f9f3668b5ca90 | 272bd7af50a576b01247c7fd036c26ece803b1e4 | T-Manson/meituan-sdk-go | /example/main.go | Go | go | 3,006 | permissive | package main
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"net/http"
"net/url"
"github.com/T-Manson/meituan-sdk-go/meituan"
"github.com/sirupsen/logrus"
)
const (
meiTuanUrl = "https://waimaiopen.meituan.com/api/v1/"
appId = "AppId"
consumerSecret = "Secret"
)
func main() {
// 初始化
m... |
5cddc99d44f3f002c0c084bfb181aa64433a5d07 | 2233bd76962ee2b3de9d4cf27c3dd2f0647c6fe6 | gonutz/ds | /constants_windows.go | Go | go | 38,126 | permissive | package ds
const (
DIRECTSOUND_VERSION = 0x0900
FX_LOCHARDWARE = 0x00000001
FX_LOCSOFTWARE = 0x00000002
CFX_LOCHARDWARE = 0x00000001
CFX_LOCSOFTWARE = 0x00000002
CFX... |
9f24618eb4897192d3b2bbdce5cded5bff97eb77 | 1cf0f4cc6dbc733bdb6c26c30536c30f900530e7 | mewspring/llir-llvm-backup | /ir/constant/asm_test.go | Go | go | 1,548 | permissive | package constant_test
import (
"flag"
"io/ioutil"
"log"
"path/filepath"
"testing"
"github.com/llir/llvm/asm"
"github.com/mewkiz/pkg/diffutil"
"github.com/mewkiz/pkg/osutil"
)
// words specifies whether to colour words in diff output.
var words bool
func init() {
flag.BoolVar(&words, "words", false, "colour... |
3a304efb1c4d71a98047dbdafcb974416b473120 | 2f5605e9474c91f541334b0a7ab4730d12635400 | raymond-wx/android-soong | /genrule/genrule_test.go | Go | go | 18,588 | no_license | // Copyright 2018 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... |
73abdd38347a3a92bd3b0ebfec77d6a5d7424985 | b4336b4faa2f971e72bcfbf6e8569a91feeb7cc8 | xiusj/apiserver | /pkg/apis/cluster/node.go | Go | go | 625 | no_license | // Copyright © 2017 huang jia <449264675@qq.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
//
// Unless required by applicable l... |
a786528b51478daa4cb66577cc3186fb6f590443 | 0115935300a316a5acf864ece567ceecfb8f5ed9 | sanzhuan/6.824 | /shardmaster/util.go | Go | go | 272 | no_license | package shardmaster
type Pair struct {
Key int
Value int
}
type PairList []Pair
func (p PairList) Len() int {
return len(p)
}
func (p PairList) Less(i, j int) bool {
return p[i].Value < p[j].Value
}
func (p PairList) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
|
9c82d9bf91dfc008e709e7b247bd6ecaba4675d3 | 0f65f558498d8800068dbf8d8b365f80914e382c | aufawibowo/go-kit | /transport/encoder.go | Go | go | 235 | no_license | package transport
import (
"context"
"encoding/json"
"net/http"
)
func Encode(_ context.Context, w http.ResponseWriter, response interface{}) func() error {
return func() error{
return json.NewEncoder(w).Encode(response)
}
}
|
2382bcc52b4367d65a1d4ac1c748591ce9d92527 | f4801e84c93bc82beae4e0d5cf4246012b9f8740 | sylvat/mysqldiff | /internal/init.go | Go | go | 923 | no_license | package internal
import (
"fmt"
"github.com/spf13/viper"
"github.com/jmoiron/sqlx"
)
func NewDB(dsn string) (*sqlx.DB, error) {
db, err := sqlx.Open("mysql", dsn)
if err != nil {
return nil, fmt.Errorf("打开mysql链接失败: %w", err)
}
return db, nil
}
type DBData struct {
DB *sqlx.DB
DBName string
}
var D... |
b3ce4bc3fd4e11494f7a44c5a1e46231be27ad07 | ed0fa5ea4c8c79b77006e831ea85b6980dec6c78 | okblockchainlab/cosmos-sdk | /x/gov/params.go | Go | go | 2,222 | permissive | package gov
import (
"fmt"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// Param around deposits for governance
type DepositParams struct {
MinDeposit sdk.Coins `json:"min_deposit"` // Minimum deposit for a proposal to enter voting period.
MaxDepositPeriod time.Duration `json:"max_deposit... |
5f25e6f06200ac40a7f72b2d14e7182e4a3c809d | 0e04d908a3171984ec17e1cc4440f42c13390208 | sgtest/monorepo-test-3 | /kubernetes-8/pkg/client/listers/certificates/internalversion/certificatesigningrequest.go | Go | go | 2,651 | 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, ... |
57a09bc8b085281ec409ec44ca591894c5235e2c | 81ad70913759785b5e6d843c1e296c85565cd8d0 | denghongcai/mesh-agent | /resync/index.go | Go | go | 740 | no_license | package resync
import (
"sync"
"sync/atomic"
)
// Once is an object that will perform exactly one action
// until Reset is called.
// See http://golang.org/pkg/sync/#Once
type Once struct {
m sync.Mutex
done uint32
}
// Do simulates sync.Once.Do by executing the specified function
// only once, until Reset is... |
bd35d6d08ca08593a3a002c60aeb654127ed1712 | 2b427d22b93fc957a1d50bab0fd427f5fa803b1e | jeff2857/Binance-SDK | /test/apikey_test.go | Go | go | 246 | no_license | package main
import "testing"
import "github.com/jeff2857/Binance-SDK/internal/apikey"
func TestApiKey(t *testing.T) {
apiKey, secret, err := apikey.Read()
if err != nil {
t.Error(err)
}
t.Logf("apikey: %s\nsecret: %s", apiKey, secret)
}
|
dbefbe5865895552eab31c81c013ff8c322a5751 | 6db5ce34e75ec717aff8faea00eacc2c89587cfe | SilverRainZ/tools | /gopls/internal/lsp/cmd/references.go | Go | go | 2,289 | permissive | // Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cmd
import (
"context"
"flag"
"fmt"
"sort"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/span"
"golang.or... |
1fd68f6b6ada94d152cfe9fc9ddf821b942aa1cc | 9897b056a1d58f370ff8bd766799c0d4f7cc38e6 | go-various/helper | /queue/priority_queue.go | Go | go | 5,753 | no_license | package queue
import (
"container/heap"
"errors"
"github.com/go-various/helper/structure"
"sync"
)
// ErrEmpty is returned for queues with no items
var ErrEmpty = errors.New("queue is empty")
// ErrDuplicateItem is returned when the queue attmepts to push an item to a key that
// already exists. The queue does n... |
6d6ad899bd3b463dea230efe7858b984569008a3 | fb51ae6fcc757e13c87107af8983d8142e9f4fe3 | todd-a-jacobs/lumogon | /storage/storage.go | Go | go | 3,854 | permissive | package storage
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"github.com/puppetlabs/lumogon/logging"
"github.com/puppetlabs/lumogon/types"
"github.com/puppetlabs/lumogon/version"
)
// Storage submits the captured data an appropriate destination
type Storage struct {
ConsumerUR... |
cd5a25b1e28b0046162bb752d5b696603372c396 | ede4b30ceb94f78a29eb7d381eb123984b1051cf | beebird/jx | /pkg/cloud/iks/helper.go | Go | go | 2,235 | permissive | package iks
import (
"strconv"
"strings"
"github.com/IBM-Cloud/bluemix-go/api/container/containerv1"
)
func GetRegions(regions Regions) ([]string, error) {
regionarr, err := regions.GetRegions()
if err != nil {
return nil, err
}
strregions := make([]string, len(regionarr))
for i, region := range regiona... |
ebe6d0446d014735fa5f4256acdc992e13986792 | 8a1d06f56e583e657ceb86d4b1c90a1febcd7936 | LuXinZ/bookstore_users_api | /domain/users/user_dto.go | Go | go | 702 | no_license | package users
import (
"github.com/LuXinZ/bookstore_users_api/utils/errors"
"strings"
)
type User struct {
Id int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
DateCreated string `json:"date_created"`
}
func Validate(user... |
364b1b65c207b1a4214919c7469da96d529867e9 | 1d1a42fe97bf5aa3e67692fb6dd91b58200785e7 | hyperledger-labs/fabric-block-archiving | /orderer/consensus/etcdraft/initialization_test.go | Go | go | 1,588 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package etcdraft_test
import (
"testing"
"github.com/hyperledger/fabric/bccsp/sw"
"github.com/hyperledger/fabric/common/metrics/disabled"
"github.com/hyperledger/fabric/core/comm"
"github.com/hyperledger/fabric/orderer/common/cl... |
f3ee005cd0d7ed75a198d4223a6a5e7d1f6833c1 | 99965b75c831c2ac57853606b60577f9153d1057 | fsgo/fscache | /mapcache/cache_test.go | Go | go | 1,533 | permissive | // Copyright(C) 2022 github.com/fsgo All Rights Reserved.
// Author: hidu <duv123@gmail.com>
// Date: 2022/6/3
package mapcache
import (
"context"
"errors"
"sync"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestMapCache(t *testing.T) {
newFunc := func(ctx context.Context, key any) (any, er... |
0b72579e49f2d3473b9bda463a482e4ddf11d234 | 91469c15f9221ec814a4ef744cac5987e7a66dfb | djdv/go-ipfs | /core/commands/filesystem/config.go | Go | go | 2,844 | permissive | package fscmds
import (
"context"
"fmt"
config "github.com/ipfs/go-ipfs-config"
"github.com/ipfs/go-ipfs/filesystem"
"github.com/ipfs/go-ipfs/filesystem/manager"
"github.com/ipfs/go-ipfs/filesystem/manager/errors"
"github.com/multiformats/go-multiaddr"
)
// fillFromConfig checks requests against sections in t... |
f0f302a2a9b45cdd0cc0b4f40e30c06a97042605 | 8587e3b0a24d7a5e8df88cc9e9be65000ad257d0 | memememomo/go-smtpserver | /xforward.go | Go | go | 1,970 | permissive | package smtpserver
import (
"fmt"
"regexp"
)
type Xforward struct {
ExtensionBase
XforwardValue map[string]string
}
func (x *Xforward) Init(parent *Esmtp) Extension {
x.Parent = parent
return x
}
func (x *Xforward) Verb() map[string]func(interface{}, ...string) (close bool) {
m := make(map[string]func(interf... |
66d8518c437cf64f0dd06133b7038532b41408cc | 0077e65e16c44b1c580430da0876ae4a343bf152 | se77en/gostrgen | /gostrgen.go | Go | go | 1,072 | no_license | // gostrgen
package gostrgen
import (
"errors"
"math/rand"
"strings"
"time"
)
var Lower = 1 << 0
var Upper = 1 << 1
var Digit = 1 << 2
var Punct = 1 << 3
var LowerUpper = Lower | Upper
var LowerDigit = Lower | Digit
var UpperDigit = Upper | Digit
var LowerUpperDigit = LowerUpper | Digit
var All = LowerUpperDigit... |
5a207494831ddd8f1c6a3a83dec32f76516859b4 | 984890edd156a5b2593a7d10d806ec07e4edbb2a | FinnStutzenstein/OpenSlides | /performance/client/option.go | Go | go | 245 | permissive | package client
// Option is an optional argument for New().
type Option func(*Client)
// WithLoginRetry sets a number that login should retry befor failing.
func WithLoginRetry(n int) Option {
return func(c *Client) {
c.loginRetry = n
}
}
|
c27f8a775d864d6ae8c31bc1d7c21a32fb2f8c98 | 2ef2548f87b07fc5bf156a2a9cecdee8d6a45885 | RoeyMaor/mixer | /adapter/memquota2/memquota_test.go | Go | go | 8,554 | permissive | // Copyright 2017 Istio 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 i... |
9c9fdedc4ee49a37ab18cf541b9b6407e2600bef | 1ddbed17ddb24de899b05bd41ca47ff77042bb37 | johnmshields/skaffold | /pkg/skaffold/build/local/local.go | Go | go | 3,099 | permissive | /*
Copyright 2018 The Skaffold Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
eee9379e7968aa5b06f63bea38cbe93810015d4a | 294e0aebb46e278653b77cc1ba829509b47308af | zgbkny/gox | /src/textp.go | Go | go | 2,937 | no_license | package main
import (
"strings"
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
func write1() {
for i:= 0; i < 100; i++ {
return
}
}
func write2() {
for i:= 0; i < 100; i++ {
return
}
}
func read(data string) {
fmt.Println("read:", data)
}
func checkStatic(oname string) bool {
i... |
88252ff59e0b790d1532bfcb8a39fb83c15aeae3 | a295eced3a2395647b82ec7e167a396b9a6ccd11 | kazu-S-1110/go-lesson211006 | /control/typeSwitch.go | Go | go | 1,365 | no_license | package main
import "fmt"
// 型スイッチ
func anything(a interface{}) {
// fmt.Println(a)
// switch文を使って処理を変えてみる
switch v := a.(type) {
case string:
fmt.Println(v + "!?")
case int:
fmt.Println(v + 10000)
}
}
func main() {
anything("aaa") //interfaceは全てのものを受け入れられるが演算などは不可
anything(1)
// 型アサーションを使用して演算をさせることが... |
eb78129811887a5a0dbc9b0f91249d635975d1aa | c78107bb6597c0ca7133f670fbc9edfa9d88a28e | horryq/study6.824 | /src/main/wc.go | Go | go | 1,762 | no_license | package main
import (
"fmt"
"mapreduce"
"os"
"strconv"
"strings"
"unicode"
)
// The mapping function is called once for each piece of the input.
// In this framework, the key is the name of the file that is being processed,
// and the value is the file's contents. The return value should be a slice of
// key/va... |
51cc0f4611b7a2d106486e98777a70fd0c0743a6 | 12ebe5e85e1b4ba1b8e57018e44847c90e5ea040 | DavidBenko/gateway | /_vendor/src/camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb/filter.go | Go | go | 700 | permissive | // Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package leveldb
import (
"camlistore.org/third_party/github.com/syndtr/goleveldb/leveldb/filter"
)
type iFilter struct {
... |
76ac223943484bf54c8173b831ac1e0ee65bff79 | 0e4089ffdb9be1f098f53b0812f9b25c71bd72b3 | sensecollective/network-poc | /client/client.go | Go | go | 6,230 | permissive | package client
import (
"context"
"crypto/rand"
"fmt"
"io"
"log"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/iryonetwork/network-poc/config"
"github.com/iryonetwork/network-poc/logger"
"github.com/iryonetwork/network-poc/specs"
"github.com/iryonetwork/network-poc/storage/ehr"
"github.com/i... |
90f73bfe359a62c89f33aa3c9b454322fe8b2277 | f95f853c99f50a53113d18df337587dad6dc8540 | jimmykarily/stratosphere | /db.go | Go | go | 2,729 | permissive | package main
import (
"database/sql"
"errors"
_ "github.com/mattn/go-sqlite3"
"os"
"reflect"
"strconv"
"strings"
)
type Db struct {
connection *sql.DB
Path string
}
// Connects to the sqlite database in "path"/
func NewDb(path string) (*Db, error) {
var err error
if !fileExists(path) {
return nil... |
404af42580497aef38f0d6e159996ad72d50b8db | 017a946dc064907a2d05b342e419297f7d35c817 | jessfraz/cri-o | /server/container_stats_test.go | Go | go | 1,998 | permissive | package server_test
import (
"context"
"github.com/cri-o/cri-o/internal/oci"
"github.com/cri-o/cri-o/server/cri/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
// The actual test suite
var _ = t.Describe("ContainerStats", func() {
// Prepare the sut
BeforeEach(func() {
beforeEach()
setupSUT... |
a85d1ae611015bc2938568787ec3e270c4a7e577 | 0d6a3e38998a3cb9b22bc9ac919344125fc247e8 | largesun/beanpay | /apiserver/install.prod.go | Go | go | 2,045 | no_license | // +build prod
package main
//bindConf 绑定启动配置, 启动时检查注册中心配置是否存在,不存在则引导用户输入配置参数并自动创建到注册中心
func (s *apiserver) install() {
//api.port#//
s.Conf.API.SetMainConf(`{"address":":9090"}`)
//#api.port//
//api.appconf#//
//#api.appconf//
//api.cros#//
//#api.cros//
//api.jwt.prod#//
//#api.jwt.prod//
//api.me... |
24660f64b7ce802b3041251fdf27a5e66eccb190 | b99914b6f240cce6f4cc6426481dd60b1c011770 | DenesCs/gomplate | /internal/tests/integration/inputdir_unix_test.go | Go | go | 1,478 | permissive | //+build !windows
package integration
import (
"fmt"
"io/ioutil"
"math"
"os"
"testing"
"golang.org/x/sys/unix"
"gotest.tools/v3/assert"
"gotest.tools/v3/fs"
)
func setFileUlimit(b uint64) error {
ulimit := unix.Rlimit{
Cur: b,
Max: math.MaxInt64,
}
err := unix.Setrlimit(unix.RLIMIT_NOFILE, &ulimit)
... |
e4ebe1d47c50412bb09c0e2904ad19fe666aeaa6 | 0db5527bf3ca63b8c96c6e12fe6eee6e4a1a0933 | makhmutov/gostatsd | /statsd/dispatcher_test.go | Go | go | 5,031 | permissive | package statsd
import (
"fmt"
"math/rand"
"runtime"
"sync"
"testing"
"time"
"github.com/atlassian/gostatsd/types"
"golang.org/x/net/context"
)
type testAggregator struct {
agrNumber int
af *testAggregatorFactory
types.MetricMap
}
func (a *testAggregator) Receive(m *types.Metric, t time.Time) {
a... |
bfadeac9940a7caeca36c98badd8b2b9c0f145ac | 92c204cd1f962846add97d4a18672f963cb88c78 | kgthegreat/golang.zone | /database/mysql.go | Go | go | 634 | permissive | package database
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/steffen25/golang.zone/config"
)
type MySQLDB struct {
*sql.DB
}
func NewMySQLDB(dbCfg config.MySQLConfig) (*MySQLDB, error) {
//DSN := fmt.Sprintf("%s:%s@unix(/tmp/mysql.sock)/%s?parseTime=true", dbCfg.Username, dbCf... |
a39aa891f8eaa5d855c0b2076fee4d656fa890c6 | 8b699c33f7d585ceea7e1a70dc3f345b6c935db3 | cyril-corbon/tfsec | /pkg/result/result.go | Go | go | 3,921 | permissive | package result
import (
"fmt"
"strings"
"github.com/zclconf/go-cty/cty"
"github.com/aquasecurity/tfsec/internal/app/tfsec/block"
"github.com/aquasecurity/tfsec/pkg/provider"
"github.com/aquasecurity/tfsec/pkg/severity"
)
// Result is a positive result for a security check. It encapsulates a code unique to the... |
e67f097d741084226fb77c160977f477b2c09949 | f94fd74fa8352bb6f7522f75d99097d8c2a320c8 | asvoboda/godel | /apps/distgo/cmd/artifacts/artifacts.go | Go | go | 6,670 | permissive | // Copyright 2016 Palantir Technologies, 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 ... |
ce6efcc76765e8d1a18f433be96c2d98e20fac0b | cb4221ed8e7ebdf6ca7703f0ddfae71f1de3e2c2 | midN/datadog-agent | /cmd/agent/api/response/types.go | Go | go | 1,005 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2018 Datadog, Inc.
package response
import (
"github.com/DataDog/datadog-agent/pkg/autodiscovery/i... |
abe91cf69613587fee96b0c76c6c8746b54b8055 | 2d8594f7e95f58a7cc2c242f0df59cef84a39215 | yongcycchen/mall-api | /pkg/util/client.go | Go | go | 319 | no_license | package util
import (
"context"
"github.com/yongcycchen/mall-api/pkg/util/client_conn"
"google.golang.org/grpc"
)
func GetGrpcClient(serverName string) (*grpc.ClientConn, error) {
client, err := client_conn.NewConn(serverName)
if err != nil {
return nil, err
}
return client.GetConn(context.Background())
}
|
92972df19cd722b71517e21394c122385b987d70 | bb84982f881716ba44b859664042de2c4ed7544b | cloustone/macaca | /ast/ast.go | Go | go | 8,315 | permissive | // Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use p 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
// distrib... |
231956e280fda04ae577f1bdddcee9202d9c31d5 | eb5dc7dfacb147736127dcb40630fe23db6a8213 | tomseago/go-eltee | /api_server.go | Go | go | 10,416 | no_license | package eltee
import (
"context"
"fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/peer"
"net"
"github.com/tomseago/go-eltee/api"
)
type cpListener struct {
stream api.ElTee_ControlPointChangesServer
c chan *api.ControlPointList
cleanup func(l *cpListener)
}
func NewCpListener(stream api.ElT... |
50a9cf3729d0b882dd8af7f55481017579d0f0ef | 6a32191fb215c68d048933870d5ba04a7620179e | scibian/singularity-container | /vendor/github.com/opencontainers/umoci/pkg/hardening/verified_reader.go | Go | go | 7,157 | permissive | /*
* umoci: Umoci Modifies Open Containers' Images
* Copyright (C) 2016-2020 SUSE 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... |
e83e8ed5244554fd3aa4a85c6c9a88a8b0ccbddd | a142d1202000e3712d8281c1221b1f3126f45d16 | target/goalert | /auth/identityprovider.go | Go | go | 1,726 | permissive | package auth
import (
"context"
"net/http"
)
// An IdentityProvider provides an option for a user to login (identify themselves).
//
// Examples include user/pass, OIDC, LDAP, etc..
type IdentityProvider interface {
Info(context.Context) ProviderInfo
ExtractIdentity(*RouteInfo, http.ResponseWriter, *http.Request... |
99e1782688823555c8e906e37dca20dac0c2c4e6 | 7839e45256f64a0133d64072d2a514961460c235 | chjlangzi/gophercloud | /openstack/compute/v2/extensions/services/testing/fixtures.go | Go | go | 3,413 | permissive | package testing
import (
"fmt"
"net/http"
"testing"
"time"
"github.com/chjlangzi/gophercloud/openstack/compute/v2/extensions/services"
th "github.com/chjlangzi/gophercloud/testhelper"
"github.com/chjlangzi/gophercloud/testhelper/client"
)
// ServiceListBody is sample response to the List call
const ServiceLis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.