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
da5ea65b19df7bf3513b16658cb327ed0ec75fef
8f991bd94498c84ea3f11aafc6da8b9555a09170
dbirchak/Amass
/cmd/amass/output.go
Go
go
5,799
permissive
// Copyright 2017 Jeff Foley. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. package main import ( "bufio" "encoding/json" "fmt" "os" "strconv" "github.com/OWASP/Amass/amass" "github.com/OWASP/Amass/amass/core" "github.com/fatih/color" )...
1dfb019d66b79c1865ec20d8eb7ba812c290203e
84a6477711f14ebcb44cac50289b2d9314eefdbf
ShrewdThingsLtd/free5gc-stage-2
/lib/openapi/models/model_chf_info.go
Go
go
452
permissive
/* * NRF NFManagement Service * * NRF NFManagement Service * * API version: 1.0.0 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package models type ChfInfo struct { SupiRangeList *[]SupiRange `json:"supiRangeList,omitempty" bson:"supiRangeList"` GpsiRangeList *[]IdentityRange `json:"...
a05f60f394f54a34f70f0dff198d222fc887c8e4
17a4824e270e9f8d206dbae46f69c6122bf9c4a0
iamjarvo/eel
/main.go
Go
go
7,766
permissive
/** * Copyright 2015 Comcast Cable Communications Management, 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...
ae94932a1e78179a0819e74e973c96450e8ce206
bacef5937cdaa7d28328194d4d102214a8b2d05f
clywyk/vale
/check/variables.go
Go
go
2,417
permissive
package check import ( "strings" "github.com/errata-ai/vale/core" "github.com/jdkato/prose/transform" "github.com/jdkato/regexp" ) func makeExceptions(ignore []string) *regexp.Regexp { ignore = append(ignore, `[^\s]+`) return regexp.MustCompile(`(?:` + strings.Join(ignore, "|") + `)`) } func lower(s string, i...
b3618050c9154cf81575342b6a2db002870a6b26
3369f322a2da68599e42f92ba2e83bd81479d3b1
shinhwagk/sshed
/keychain/keychain.go
Go
go
3,123
permissive
package keychain import ( "bytes" "encoding/gob" "github.com/boltdb/bolt" "time" ) var Bootstrapped bool var keys = []byte("keys") var meta = []byte("meta") var path string var Password string var Encrypted bool var boltdb *bolt.DB type Record struct { Password string PrivateKey string } func Open(p stri...
6ea10124a5be6d15c905600dfdacb28fb3a57038
a219fbe4c01c0deed930ec436414401d4e2c38fe
fagongzi/docker
/daemon/container_operations.go
Go
go
31,294
permissive
package daemon import ( "errors" "fmt" "net" "os" "path" "runtime" "strings" "time" "github.com/Sirupsen/logrus" derr "github.com/docker/docker/api/errors" containertypes "github.com/docker/docker/api/types/container" networktypes "github.com/docker/docker/api/types/network" "github.com/docker/docker/con...
0710adeba12bf57fd56527dbe4bcfadde3d1e6af
22b013dd2ff7ba77d182a27f229dded5a26ae7fe
timob/ls
/lib/windows.go
Go
go
754
permissive
// +build windows package ls import ( "errors" "os" "os/user" ) type LongInfo struct { UserName, GroupName string HardLinks int Ino uint64 } func GetTermSize() (int, int, error) { return 0, 0, errors.New("not implemented") } var userName, groupName string func init() { userName = os.Getenv(...
bfa57e5ac9bbbfe2277b48fdcbb608bb5c1d726a
5f6f06fa3d251c07208b8a23d545d3c18f45be94
Asana/telegraf
/Godeps/_workspace/src/gopkg.in/dancannon/gorethink.v1/query_control_test.go
Go
go
10,610
permissive
package gorethink import ( "bytes" "testing" "time" test "gopkg.in/check.v1" ) func (s *RethinkSuite) TestControlExprNil(c *test.C) { var response interface{} query := Expr(nil) res, err := query.Run(session) c.Assert(err, test.IsNil) err = res.One(&response) c.Assert(err, test.Equals, ErrEmptyResult) c...
86aef80d31784bcf07805660c9780a165c65c810
42d5072499cf58df179626fd24703089c506610f
reconquest/stats-go
/percentile_duration_test.go
Go
go
675
no_license
package stats import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestPercnetileDuration(t *testing.T) { test := assert.New(t) avg := NewPercentileDuration(0) avg.Push(time.Second * 4) avg.Push(time.Second * 3) avg.Push(time.Second * 2) avg.Push(time.Second * 2) avg.Push(time.Second * 2)...
c074f1d26cfa26dc7ceec62f1f4ecab2bb55d174
26d9c0a9cf0946f30599acc7963ee8f834b500a1
openshift/installer
/vendor/github.com/microsoftgraph/msgraph-sdk-go/deviceappmanagement/mobileappconfigurations/item/assign/assign_request_builder.go
Go
go
3,958
permissive
package assign import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" ) // AssignRequestBuilder provide...
6bfc2b3407a1b66988fe12c4a3c7d3acc7efcf95
40a22f00f69ebf9c6bf3cfec4024d9e529fe3952
IvanCaballero1204/Tarea_2
/main4.go
Go
go
307
no_license
package main import "fmt" func main() { var base float64 var height float64 fmt.Print("Ingrese valor de la base: ") fmt.Scanf("%f", &base) fmt.Print("Ingrese valor de la altura: ") fmt.Scanf("%f", &height) result := (base * height) / 2 fmt.Println("El area del triangulo es igul a:", result) }
4c5b1f39ee243378c667ebc4a7769375710dbd37
5945d9438c170b6961c08b1af491106ea330f239
stjordanis/mono-1
/ocis/pkg/command/revasharing.go
Go
go
1,296
permissive
// +build !simple package command import ( "github.com/micro/cli/v2" "github.com/owncloud/mono/reva/pkg/command" svcconfig "github.com/owncloud/mono/reva/pkg/config" "github.com/owncloud/mono/reva/pkg/flagset" "github.com/owncloud/mono/ocis/pkg/config" "github.com/owncloud/mono/ocis/pkg/register" ) // RevaShar...
9550a0e76d5356ca01a668ecad9b0a8fb798f80c
11f3630dea242740881874224918d90b6d0f0b2b
guanw/go-practice
/tchannel-practice/simple/server/server.go
Go
go
1,344
no_license
package main import ( "fmt" tchannel "github.com/uber/tchannel-go" "github.com/uber/tchannel-go/json" "golang.org/x/net/context" ) var log = tchannel.SimpleLogger type Ping struct { Message string `json:"message"` } // Ping is the response type. type Pong Ping func pingHandler(ctx json.Context, ping *Ping) (...
f65ded27aece1dd5c29abbd63d553a1e2d229a49
6fd517db6480fe4e9154ad4d1432d702215f6133
taiki1288/go-todo
/app/controllers/route_main.go
Go
go
2,140
no_license
package controllers import ( "go-todo/app/models" "log" "net/http" ) func top(w http.ResponseWriter, r *http.Request) { _, err := session(w, r) if err != nil { generateHTML(w, nil, "layout", "public_navbar", "top") } else { http.Redirect(w, r, "/todos", 302) } } func index(w http.ResponseWriter, r *http.R...
e5e6be2f8650499fbd44403c240f4467fd0b5fd4
4df96fb9956a62b8f0c4fe454a2546448250f48d
isabella232/obs-1
/obserr/obserr_test.go
Go
go
1,453
permissive
package obserr import ( "errors" "testing" "github.com/stretchr/testify/assert" ) func TestErrorsNew(t *testing.T) { err := errors.New("lit") e := &Error{ orig: err, err: err, vals: make(map[string]interface{}), } assert.Equal(t, e, New("lit")) assert.Equal(t, e, New(errors.New("lit"))) assert.Equal...
181771c4e3ba40f2bc587b82e938920ff90c150f
85dd79e5e61098825106a1530fef570d86d3e6ae
itaysk/vuln-list-update
/main.go
Go
go
3,893
permissive
package main import ( "flag" "fmt" "log" "os" "strconv" "strings" "time" "github.com/aquasecurity/vuln-list-update/amazon" "github.com/aquasecurity/vuln-list-update/alpine" "github.com/aquasecurity/vuln-list-update/debian" "github.com/aquasecurity/vuln-list-update/git" "github.com/aquasecurity/vuln-list...
dc713106389a708ffa8860a2c22f607aca9eeaae
f59f0051b165e137418b4ad499c764172349848a
wp-jackliu/opentaobao
/model/simba/TaobaoSimbaCampaignAddAPIRequest.go
Go
go
2,129
permissive
package simba import ( "net/url" "github.com/bububa/opentaobao/model" ) // TaobaoSimbaCampaignAddAPIRequest 创建一个推广计划 API请求 // taobao.simba.campaign.add // // 创建一个推广计划 type TaobaoSimbaCampaignAddAPIRequest struct { model.Params // 推广计划名称,不能多余20个汉字,不能和客户其他推广计划同名。 _title string // 主人昵称 _nick string // 计划类型,当前仅支...
ea64e5f7f4bb8dfdd428f12a08cfb5d1b5236cc2
9b7f8dc772ae7628e8d358875c2423574d03fd7b
Waxion/rancher
/vendor/k8s.io/kubernetes/pkg/volume/csi/csi_block.go
Go
go
2,565
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, ...
30424667c30599ddb8396478be4b344bbcf2c550
5b640cfecac9435bc724cefa3dfa208536415dea
ipedrazas/1024apis
/helper.go
Go
go
1,653
no_license
package main import ( "bytes" "encoding/json" "html/template" "io/ioutil" "math/rand" "os" "time" ) func generateMatrix(services []Deployment, baseDir string) { js, err := json.Marshal(services) checkError("Cannot mashal services", err) err = ioutil.WriteFile(baseDir+"/matrix.json", js, 0644) checkError("C...
d8154aab1cbc913a5e3069e015c3fb1fa81c86a2
25d12c2d8f7465da55f7f79461972ca18ef35f15
netsec-ethz/rains
/internal/pkg/datastructures/bitarray/bitarray_test.go
Go
go
1,880
permissive
package bitarray import "testing" func TestSetBit(t *testing.T) { b := make(BitArray, 2) if b.SetBit(16) == nil { t.Errorf("SetBit did not return an error") } b.SetBit(0) if b[0] != 1 { t.Errorf("SetBit did not set bit at position 0 in first block, value=%d", b[0]) } b.SetBit(0) if b[0] != 1 { t.Errorf(...
9c321cea509c83716d9739c5e9150b3c2170a224
e3938c729ca428c858b5e5da9b16338ec6cab4f2
ulovecode/go-algorithm
/leetcode/editor/cn/120.三角形最小路径和_test.go
Go
go
496
no_license
package leetcode import "testing" func Test_minimumTotal(t *testing.T) { type args struct { triangle [][]int } tests := []struct { name string args args want int }{ { "1", struct{ triangle [][]int }{triangle: [][]int{{2}, {3, 4}, {6, 5, 7}, {4, 1, 8, 3}}}, 11, }, } for _, tt := range tests ...
f794df9971904a360dfe10db177d6d42028aa783
1e207838a74119be4feee4c29e1c3da76516b453
cauabernardino/gocomms
/api/src/db/db.go
Go
go
360
permissive
package db import ( "api/src/config" "database/sql" _ "github.com/go-sql-driver/mysql" ) // Connect opens the connection with the database func Connect() (*sql.DB, error) { db, err := sql.Open("mysql", config.DBConnectString) if err != nil { return nil, err } if err = db.Ping(); err != nil { db.Close() ...
f02b68984b5c946a28ea59bb33add15e2ee45839
f6d714a7e7febffe2618fd081340f18cc178e845
ben50106/msgqueue_client
/msgqueue/rabbitmq/send_message.go
Go
go
306
no_license
package rabbitmq // SendMessage send request to send message to the exchange func (q *QueueMethod) SendMessage(name, rKey, mid, payload string, headers map[string]interface{}) (err error) { if err := q.Provider.AMQP.Publish(name, rKey, mid, payload, headers); err != nil { return err } return nil }
100ea1ae5d5d5cd8634cb37ece58652d07b1fccb
cf144f248afbbd416aca8da98cbe4d68b4e257bd
Exabeam/felix
/policysync/server.go
Go
go
4,331
permissive
// Copyright (c) 2018 Tigera, 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 applica...
6857e597752b152234c93a8b36fda4e3c3a14f60
ad68fbc5d1746816cc02310d6f3476fdafdc24fd
jorgelbg/grafana
/pkg/build/gcloud/auth.go
Go
go
1,384
permissive
package gcloud import ( "encoding/base64" "encoding/json" "fmt" "log" "os" "os/exec" "strings" ) func GetDecodedKey() ([]byte, error) { gcpKey := strings.TrimSpace(os.Getenv("GCP_KEY")) if gcpKey == "" { return nil, fmt.Errorf("the environment variable GCP_KEY must be set") } gcpKeyB, err := base64.StdE...
1ced4978fa4a68190137d833550a9648c4e67a78
48a0e77dd54aecbcc96660fdada9945f4e2fa4e3
kyma-project/kyma
/components/eventing-controller/pkg/subscriptionmanager/eventmesh/eventmesh_test.go
Go
go
8,795
permissive
package eventmesh import ( "context" "fmt" "net/http" "testing" "github.com/stretchr/testify/require" eventingv1alpha2 "github.com/kyma-project/kyma/components/eventing-controller/api/v1alpha2" "github.com/kyma-project/kyma/components/eventing-controller/pkg/backend/cleaner" "k8s.io/client-go/dynamic" "sig...
0becdefd86fb9a3d9694e879c1d30bead1b9a51b
08707fa7667e0e80a96e6a8a8c47ccb12de9805a
wonderb0lt/helm
/pkg/kube/client.go
Go
go
24,113
permissive
/* Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
a44cca98d7c4b567edac0dd01e11cdb0e7a603ca
19158d7092ca03b167b90cb9e6802317cbf93be6
wmnsk/go-m3ua
/messages/drst.go
Go
go
6,060
permissive
// Copyright 2018-2023 go-m3ua 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 messages import ( "fmt" "log" "github.com/wmnsk/go-m3ua/messages/params" ) // DestinationRestricted is a DestinationRestricted type of M3UA ...
c1e1c78923d099558da04dca0296665c73b1be0f
89730020153ff25621715fd8be2f0d06dd1dab86
roignpar/iptb
/testbed/spec.go
Go
go
3,645
permissive
package testbed import ( "fmt" "plugin" "github.com/ipfs/iptb/testbed/interfaces" ) // NodeSpec represents a node's specification type NodeSpec struct { Type string Dir string Attrs map[string]string } // IptbPlugin contains exported symbols from loaded plugins type IptbPlugin struct { From string ...
6df14bb3463886880aae1b165ef491e7b25bc3ca
82e91f1a224fde950cf4a797f32c32b8270f2248
HubSpot/vitess
/go/cmd/vtworker/plugin_zk2topo.go
Go
go
672
permissive
/* Copyright 2017 Google 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 agreedto in writing, software dist...
e3bdfa37688a43f23bd1a859173726d3270122f2
90fbba7f7907a12824ce5019bec15571624ea8bf
ssmtariq/swctl
/pkg/action/action.go
Go
go
2,910
permissive
/** * Copyright © 2014-2021 The SiteWhere 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...
848e4fd4ec2e56d9271a191ec5d89f249501eb86
9780adb73812cd8e7cb490ac69141bd86a1488e4
algorithm006-class01/algorithm006-class01
/Week_01/G20200343030383/LeetCode_26_383.go
Go
go
320
no_license
// https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ package leetcode func removeDuplicates(nums []int) int { var delCount int for i := 1; i < len(nums); i++ { if nums[i] == nums[i-1] { delCount++ } else if delCount > 0 { nums[i-delCount] = nums[i] } } return len(nums) - delCount }
7dd9cc13d316f4782ce0ed2a4bccd9a13209c167
5d5efa962be3a2e1ac3ca5906d7d322da1219264
kubevirt/kubevirt
/staging/src/kubevirt.io/client-go/kubecli/streamer.go
Go
go
1,039
permissive
package kubecli import ( "net" "time" "github.com/gorilla/websocket" ) type wsStreamer struct { conn *websocket.Conn done chan struct{} } func (ws *wsStreamer) streamDone() { close(ws.done) } func (ws *wsStreamer) Stream(options StreamOptions) error { copyErr := make(chan error, 1) go func() { _, err :=...
aadb6b64e115bae14e95063812e338eff54ef6a9
f9b75d26ef3ae35f52fbe39ceed89f06e389e1ba
YasunoriMATSUOKA/trycosmoschain
/x/trycosmoschain/client/cli/querySampleType.go
Go
go
1,561
no_license
package cli import ( "context" "strconv" "github.com/YasunoriMATSUOKA/trycosmoschain/x/trycosmoschain/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" ) func CmdListSampleType() *cobra.Command { cmd := &cobra.Command{ Use: "list-sampleType",...
39efaaa73ea8b1aad070bbfa9044e718a2bad071
e71ca9e909030d837cc8ce925c0bb759f71ee166
go-zookeeper/jute
/testdata/fixtures/zookeeper/txn/createtxnv0.go
Go
go
2,255
permissive
// Autogenerated jute compiler // @generated from 'testdata/zookeeper.jute' package txn // github.com/go-zookeeper/zk/internal/txn import ( "fmt" "github.com/go-zookeeper/jute/lib/go/jute" "github.com/go-zookeeper/zk/internal/data" ) type CreateTxnV0 struct { Path string // path Data []byte /...
98f429e15f9cbe827a07016581a5dfe812c3b7c4
eae5dfcff326ebffa9bb82f201ce67a1395574c6
cwaring/lotus
/chain/sync.go
Go
go
50,332
permissive
package chain import ( "bytes" "context" "errors" "fmt" "os" "sort" "strconv" "strings" "time" "github.com/Gurpartap/async" "github.com/hashicorp/go-multierror" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" logging "github.com/ipfs/go-log/v2" "github.com/libp2p/go-libp2p-core/connmgr" "...
e05c61f0b4d1e3fcddc75d056a1c448b45b7a84f
ab352354910a6e97c12d401cfbb3ca5e277811e6
pilotariak/trinquet
/pkg/webdoc/doc.go
Go
go
720
permissive
// Copyright (C) 2016, 2017 Nicolas Lamirault <nicolas.lamirault@gmail.com> // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless req...
a8e54a49accec917027ff1ae6163dd140ff7eda0
57f69449e765cb4bfa371f1fb467db157483355d
jaabberwocky/leetcode
/leetcode/617_MergeBinaryTrees/617_MergeBinaryTrees.go
Go
go
412
no_license
package solution_0617 type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func mergeTrees(t1 *TreeNode, t2 *TreeNode) *TreeNode { if t1 == nil && t2 == nil { return nil } else if t1 == nil { return t2 } else if t2 == nil { return t1 } root := &TreeNode{Val: t1.Val + t2.Val} root.Left =...
b8b5674879e5cb02721abb5611d512254f87f365
1fe84f0c42e1a7772d546c80962940360b2aec0b
mglaman/ddev
/cmd/ddev/cmd/config.go
Go
go
26,689
permissive
package cmd import ( "fmt" "github.com/drud/ddev/pkg/globalconfig" "github.com/drud/ddev/pkg/nodeps" "os" "strings" "path/filepath" "github.com/drud/ddev/pkg/ddevapp" "github.com/drud/ddev/pkg/output" "github.com/drud/ddev/pkg/util" "github.com/spf13/cobra" ) // Define flags for the config command var ( ...
846428c9a47b00570f79c028cad85fe5d671aa0e
16913c30e6a8c92306d9c39612117bc7107eb82f
romanwerpachowski/gonum
/graph/layout/layout_test.go
Go
go
2,738
permissive
// Copyright ©2019 The Gonum 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 layout_test import ( "bytes" "encoding/base64" "image" "image/png" "io/ioutil" "os" "path/filepath" "sort" "strings" "testing" "gonum.o...
83cd1e4d256473221e874d9a647b96877c3073d5
8789b125a5a522d1a25ffc4a628daf0b2c0e2da2
udistrital/api_academica
/models/esquema_identificacion_org.go
Go
go
4,628
no_license
package models import ( "errors" "fmt" "reflect" "strings" "github.com/astaxie/beego/orm" ) type EsquemaIdentificacionOrg struct { Id int `orm:"column(id);pk"` Descripcion string `orm:"column(descripcion);null"` CodigoAbreviacion string ...
68761c88c31f30d322422fbb9bc7fbd9aede91e3
964ff3a6aa5231f4fa0c40b1859837f64a575ae5
PhantomMaa/CloudIaC
/portal/models/variables.go
Go
go
3,270
permissive
// Copyright 2021 CloudJ Company Limited. All rights reserved. package models import ( "cloudiac/portal/libs/db" "database/sql/driver" ) type VariableBody struct { // 继承关系依赖数据创建枚举的顺序,后续新增枚举值时请按照新的继承顺序增加 Options StrSlice `json:"options" gorm:"type:json"` Scope string `json:"scope" gorm:"not null;typ...
2ce117a9ad0ef7bbe9249089c33d9d3a5063d15b
8f8d3cb0d69bcaac02223fa73f7bfce2c1250c66
swetakedia/aurora
/services/bifrost/server/bitcoin_rail_test.go
Go
go
4,968
permissive
// Skip this test file in Go <1.8 because it's using http.Server.Shutdown // +build go1.8 package server import ( "testing" "time" "github.com/blocksafe/go/services/bifrost/bitcoin" "github.com/blocksafe/go/services/bifrost/database" "github.com/blocksafe/go/services/bifrost/queue" "github.com/blocksafe/go/ser...
770ab12316a26b14dfb0bc2d59495cc97d81e243
987e5674275c9952b9bc676b32a2dd179c1c1fe9
vikashkumar18/GoPresentation
/loops.go
Go
go
383
no_license
package main import ( "fmt" "time" ) // For <expression> // // <expression> // 1. Can be blank (infinite loop) // 2. Can be a proper boolean expression // 3. Can be a range // START OMIT func main() { // being idiomatic and initialized timer inside for loop for timer := 3; timer > 0; timer-- { fmt.Println("time ...
33b44154e227fdd50a2d43cf60aacd528ec5aebe
7b2e51bb79abc061e002aca64bcdc2a13d892086
ngurajeka/goa-handlers
/error_handler.go
Go
go
2,814
no_license
package middleware import ( "fmt" "net/http" "github.com/goadesign/goa" "golang.org/x/net/context" ) // ErrorHandler turns a Go error into an HTTP response. It should be placed in the middleware chain // below the logger middleware so the logger properly logs the HTTP response. ErrorHandler // understands instan...
fae6e6630a2826c1e4e629f6a8bc21fea3d176c7
78f319665a0e027718329711cd9c2ec648878183
vipinvkmenon/cli
/util/manifestparser/application_test.go
Go
go
1,910
permissive
package manifestparser_test import ( . "code.cloudfoundry.org/cli/util/manifestparser" "gopkg.in/yaml.v2" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Application", func() { Describe("Unmarshal", func() { var ( rawYAML []byte application Application executeErr error ...
41419a32b816f3161f47130a375da812dc8e37a2
c5dc09540d0b35c7c71125cb5068be534e58e85d
markchipman/iamserver
/api/oauth.go
Go
go
3,781
permissive
package api import ( "encoding/base64" "fmt" "net/http" "strings" ) // AuthRequest is an OAuth2 based request. For more information on the // various grant types that can use this request object: // https://alexbilbie.com/guide-to-oauth-2-grants/ type AuthRequest struct { GrantType string `json:"grant_type"`...
3da110d4a5ef8e5deed2a7b66502bbec7899d77e
295dde20f9c42c1c18baf870d09dce81074dd905
jacobxy/Go-000
/Week04/wiretest/Model.go
Go
go
434
no_license
package main import "fmt" type Message string func NewMessage(text string) Message { return Message(text) } type Speaker struct { Message Message } func (s Speaker) Say() { fmt.Println(s.Message) } func NewSpeaker(m Message) Speaker { return Speaker{ Message: m, } } type MyTest struct { Message Message ...
3512114c9f26c5d0d7b106c52c2f7a116210a79f
4353d985cecdcc9bc2c5c200e2131fa13dca03b8
hien-pd-dac/golang-daily-practice
/hacker-rank/interviewpre/arrays/minimmSwap.go
Go
go
1,025
no_license
package arrays func minimumSwaps(arr []int) int { valToKeyMap := genValToKeyFromArr(arr) alg := algorithm{ arr: arr, valToKeyMap: valToKeyMap, } _, swaps := alg.minimumSwaps(len(arr) - 1) return swaps } type algorithm struct { arr []int valToKeyMap map[int]int } func genValToKeyFromArr(arr...
559c6cfabc7c51accc6f449040cb14a78e7a47a6
7c8f15f8e105fe662e65e24cd0a641e41feba91a
wahello/gin-wire-plate
/internal/app/ratings/grpcservers/rating.go
Go
go
954
permissive
package grpcservers import ( "context" "gin-wire-plate/api/pb" "gin-wire-plate/internal/app/ratings/services" "github.com/golang/protobuf/ptypes" "github.com/pkg/errors" "go.uber.org/zap" ) type RatingsServer struct { logger *zap.Logger service services.RatingsService } func NewRatingsServer(logger *zap.L...
ac09b54b047a719c68c9cce524730775bd6fbe45
635fe8be235bc8eeaf86cd021bae9054f6194ca2
askreet/deployment-waiter
/vendor/src/github.com/awslabs/aws-sdk-go/service/cloudformation/api.go
Go
go
63,084
permissive
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. // Package cloudformation provides a client for AWS CloudFormation. package cloudformation import ( "sync" "time" "github.com/awslabs/aws-sdk-go/aws" ) var oprw sync.Mutex // CancelUpdateStackRequest generates a request for the CancelUpdateStack operation. f...
d545f205ab3dec4d779792577a071a0da0fa0f66
7a657e7f35508dbb14266125200760d18d4c3c05
club203/Gao
/src/modules/monapi/scache/aggr.go
Go
go
2,796
permissive
package scache import ( "strconv" "time" "nightingale-club203/src/models" "github.com/toolkits/pkg/logger" ) func SyncAggrCalcStras() { t1 := time.NewTicker(time.Duration(CHECK_INTERVAL) * time.Second) syncAggrCalcStras() logger.Info("[cron] sync stras start...") for { <-t1.C syncAggrCalcStras() } } ...
cb6dc3abc01f87ff0dcba5ef9591d797f306aaf9
0737bf6cf3ead3ddf4506255072259ac52d1110c
EntropyWorks/driftctl
/pkg/remote/google/google_compute_disk_enumerator.go
Go
go
1,294
permissive
package google import ( remoteerror "github.com/cloudskiff/driftctl/pkg/remote/error" "github.com/cloudskiff/driftctl/pkg/remote/google/repository" "github.com/cloudskiff/driftctl/pkg/resource" "github.com/cloudskiff/driftctl/pkg/resource/google" ) type GoogleComputeDiskEnumerator struct { repository repository....
b9265ef261034c4ebc6bc3d4d27a2a4213ba70b1
adcecc10155b687a4b0e6c7629369d602ca8c056
gliffcheung/sealer
/apply/run_test.go
Go
go
2,459
permissive
// Copyright © 2021 Alibaba Group Holding Ltd. // // 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...
6df419a806c9c2b6f45ef351bc33a6ebc89241d4
38bb6504efc2043fe51f7ef8342819b8ea2f46ed
guiquanz/revel
/samples/validation/app/controllers/sample1.go
Go
go
1,716
permissive
package controllers import ( "github.com/robfig/revel" ) type Sample1 struct { *rev.Controller } func (c Sample1) Index() rev.Result { return c.Render() } func (c Sample1) HandleSubmit( username, firstname, lastname string, age int, password, passwordConfirm, email, emailConfirm string, termsOfUse bool) rev....
34dcbf86ed814b4b7df889e4afd2cebd1775da88
838aab641719f92ac1262f9563c31b52b7cf7e4c
openshift/cloud-credential-operator
/vendor/github.com/microsoftgraph/msgraph-sdk-go/sites/item_term_store_sets_item_terms_item_relations_item_set_request_builder.go
Go
go
5,745
permissive
package sites import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3 "github.com/microsoftgraph/msgraph-sdk-go/models/termstore" ia572726a95efa92ddd544552cd950653...
d7ede4874a6caae68c9a1ba3a72ec2130201494d
63228b113400680d9c42f63ebddda6afbf32dc36
bryan-styra/opa
/cmd/fmt_test.go
Go
go
5,703
permissive
package cmd import ( "bytes" "io/ioutil" "os" "path/filepath" "strings" "testing" "github.com/open-policy-agent/opa/util/test" ) const formatted = `package test p { a == 1 true 1 + 3 } ` const unformatted = ` package test p { a == 1; true 1 + 3 } ` func Test...
6323eaf3af6238d4e8b3029ea1ddd90657b7f69f
104ac5774932bf6924b8f5b1f2887dcfafe8f0db
doubret/citrix-netscaler-nitro-go-client
/nitro/resource_transformpolicylabel.go
Go
go
3,415
no_license
package nitro import ( "fmt" "net/url" "strconv" "strings" ) type Transformpolicylabel struct { Labelname string `json:"labelname,omitempty"` Policylabeltype string `json:"policylabeltype,omitempty"` } type TransformpolicylabelKey struct { Labelname string } func (resource Transformpolicylabel) ToKey()...
a01e9cc75d18ab361dc8c25f9a0b071f9b58ac9b
7211dbb1ade8818426d1948e806df7042dbc2ad9
bomaidea/GoLearn
/methods/pointer-receivers.go
Go
go
386
no_license
package main import ( "fmt" "math" ) type Vertex struct { X, Y float64 } func (v *Vertex) Abs() float64 { return math.Sqrt(v.X*v.X + v.Y*v.Y) } func (v *Vertex) Scale(f float64) { v.X = v.X * f v.Y = v.Y * f } func main() { v := &Vertex{3, 4} fmt.Printf("Before scaling: %+v, Abs: %v\n", v, v.Abs()) v.Sc...
a0a2171c55fcbb9ddfa4de473005522368da7deb
5de48ae47943d440f8022a48a411e833517d8a2a
vlist/void
/voruntime/shadow.go
Go
go
2,116
no_license
package voruntime import ( "io" "void/vokernel" ) type ShadowState struct{ srcStdoutWriter io.WriteCloser destTerminalName string connected bool } var shadowstate=make(map[string]ShadowState) func internal_shadow(pctx *ProcContext) { if len(pctx.Args)==0{ shadow_invalid_argument(pctx.Terminal) return } swi...
7fb6a4b65e3837fae4b1f2708f1df5f8d05d175e
2a6c6f00ccb649458feb61b89ce5a25957767388
joadha/rabbitmq-cli-consumer
/command/builder_argument_test.go
Go
go
2,226
permissive
package command_test import ( "os" "strings" "testing" "github.com/joadha/rabbitmq-cli-consumer/command" "github.com/stretchr/testify/assert" ) var argumentBuilderGetCommandTests = []struct { name string compressed bool withMetadata bool capture bool arg string }{ { "default", ...
8352545ca5b2900af9f391039dcb40874adf47ff
e6e50278096839f8d78e71b980860e1aae59e90f
lf-edge/eve
/pkg/pillar/vendor/github.com/ti-mo/conntrack/filter.go
Go
go
703
permissive
package conntrack import ( "github.com/ti-mo/netfilter" ) // Filter is a structure used in dump operations to filter the response // based on a given connmark and mask. The mask is applied to the Mark field of // all flows in the conntrack table, the result is compared to the filter's Mark. // Each flow that matches...
0fcc97a41ba427d07a88679380081a2b48d05bdc
f8174b79a8356908a12a0b34a1e571181f3815fa
wp-jackliu/opentaobao
/api/fenxiao/TaobaoFenxiaoOrdersGet.go
Go
go
870
permissive
package fenxiao import ( "github.com/bububa/opentaobao/core" "github.com/bububa/opentaobao/model/fenxiao" ) // TaobaoFenxiaoOrdersGet 查询采购单信息 // taobao.fenxiao.orders.get // // 分销商或供应商均可用此接口查询采购单信息(代销); (发货请调用物流API中的发货接口taobao.logistics.offline.send 进行发货,需要注意的是这里是供应商发货,因此调发货接口时需要传人供应商账号对应的sessionkey,tid 需传入供销平台的采购单...
3bd2a13cb10e8dca657a35f15475416ff489a153
23bff55823965d1aa08591cb730af8387cdc8dea
tikv/pd
/pkg/mcs/tso/server/config.go
Go
go
8,931
permissive
// Copyright 2023 TiKV Project 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 agr...
68cc61a6664c673d6c77829b27685a9b36e85994
1ea754a79b98c943b692768adb958cbf9ac3ef62
vpineda1996/blockafile
/shared/datastruct/mrootedtree.go
Go
go
2,944
no_license
package datastruct import ( "errors" "io" "io/ioutil" "log" "math/rand" "strconv" ) type Element interface { Encode() []byte New(r io.Reader) Element // Returns this node unique id Id() string } type EmptyElement struct { } func (EmptyElement) Id() string { return strconv.Itoa(rand.Int()) } func (Empty...
1ab4c18e3720aa2db0821e48b3315b6a0c27ce03
62137dc643c39c8efa5c7ce04a59d413a8d11975
haoqihan/crontabWeb
/master/main/master.go
Go
go
981
no_license
package main import ( "cronWeb/master" "flag" "fmt" "runtime" "time" ) var ( confFile string // 配置文件路径 ) // 解析命令行参数 func initArgs() { flag.StringVar(&confFile, "config", "./master.json", "指定配置文件") flag.Parse() } // 定义线程数,最大线程数和cpu的核数相关 func initEnv() { runtime.GOMAXPROCS(runtime.NumCPU()) } func main() {...
1f5007839a6a33151193202f74d1e617c0708c21
607a14908693dc365036f1b9f4d3d80583100d23
Tarliton/newrelic-client-go
/pkg/apm/application_instances_integration_test.go
Go
go
673
permissive
// +build integration package apm import ( "testing" "github.com/stretchr/testify/require" ) func TestIntegrationApplicationInstances(t *testing.T) { t.Parallel() client := newIntegrationTestClient(t) a, err := client.ListApplications(nil) require.NoError(t, err) _, err = client.GetApplication(a[0].ID) r...
a522bc3cb9d0c86a07019df70cc5650538ffa512
333ed0125187e56d720fd5915250811c25e6745d
MichaelDiBernardo/srl
/lib/game/gen.go
Go
go
1,451
permissive
package game import ( "github.com/MichaelDiBernardo/srl/lib/math" "log" ) // Given the floor # of the level and the "wiggle" (i.e. permissible range // outside the floor), this will generate n "groups" of objects made from specs // that are guaranteed not to be outside [floor - wiggle, floor + wiggle] based // on i...
7565404aaa5a621e04061da25fb434a95bcb8b36
fdc9679fba46ba566d57171e98c088e2df181a9e
ztteng/ants
/pool.go
Go
go
5,401
permissive
package ants import ( "sync" "sync/atomic" "time" ) // Pool accept the tasks from client,it limits the total // of goroutines to a given number by recycling goroutines. type Pool struct { capacity int32 //线程数量 running int32 //正在运行的线程数量 expiryDuration time.Duration //定时清除过期协程时间 wor...
3cae6f12313862b28f85868f3fdeac289d1f86c1
7641225c7df1149cf812101a46527ae0513eece1
WarpCloud/walm
/vendor/k8s.io/helm/pkg/helm/helmpath/helmhome.go
Go
go
2,161
permissive
/* Copyright The Helm 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 distrib...
2462339b3fde3cac1e41c081081e56c9d77da82f
40512c95c5552b4f7910f1c8a0cf355b31676dca
He-who-is-HiM/avege
/src/local/backend_info.go
Go
go
13,975
permissive
package local import ( "errors" "fmt" "math" "net" "net/url" "strconv" "strings" "sync" "time" "common" "github.com/RouterScript/ProxyClient" "outbound/ss" "outbound/ss/obfs" "outbound/ss/protocol" "outbound/ss/ssr" ) var ( ERR_NOT_FILTERED = errors.New("server is not filtered out by firewall") ) ty...
6c86e6f586bbb4789428e7ea7e3364ab220ec878
03f0e8f9034d966954db25741873fb40a9566318
Actinium-project/lnd
/.history/watchtower/wtdb/tower_db_test_20200302203525.go
Go
go
20,303
permissive
package wtdb_test import ( "bytes" "encoding/binary" "io/ioutil" "os" "reflect" "testing" "github.com/Actinium-project/acmd/chaincfg/chainhash" "github.com/Actinium-project/lnd/chainntnfs" "github.com/Actinium-project/lnd/watchtower" "github.com/Actinium-project/lnd/watchtower/blob" "github.com/Actinium-pr...
b55b53548638229b56d24d16ebeddfaca17b034c
0123e7ba1a931501caf693abd676d3e29c44d4df
andrewmelchor/fission
/pkg/publisher/webhookPublisher.go
Go
go
3,692
permissive
/* Copyright 2017 The Fission 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...
74d75af4b7695ac126e2741a333b4233306d2865
6cf66a12556be965862462ddc7c73513819b8715
bryankmorrow/fanal
/analyzer/os/photon/photon_test.go
Go
go
1,323
permissive
package photon import ( "io/ioutil" "testing" "github.com/BryanKMorrow/fanal/analyzer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/BryanKMorrow/fanal/analyzer/os" "github.com/BryanKMorrow/fanal/types" ) func Test_photonOSAnalyzer_Analyze(t *testing.T) { tests := []...
6c168b49c2b4364d102a83e63d07723d62ba4a4e
be48aa09cd47d8c1c6dae5acefc6cf22fea5eafd
Gabitchov/kuma
/pkg/core/xds/types.go
Go
go
2,087
permissive
package xds import ( "fmt" "github.com/Kong/kuma/pkg/core/logs" "github.com/Kong/kuma/pkg/core/permissions" "net" "strings" mesh_core "github.com/Kong/kuma/pkg/core/resources/apis/mesh" core_model "github.com/Kong/kuma/pkg/core/resources/model" envoy_core "github.com/envoyproxy/go-control-plane/envoy/api/v2/...
bc702a7475bd2de4b73d72a41f364ba9809f8298
04b4d2f35af642f6185c38e6a066ab1667c912ff
LiuDianshi/lattigo
/ckks/precision.go
Go
go
4,489
permissive
package ckks import ( "fmt" "math" "sort" ) // PrecisionStats is a struct storing statistic about the precision of a CKKS plaintext type PrecisionStats struct { MaxDelta complex128 MinDelta complex128 MaxPrecision complex128 MinPrecision complex128 MeanDelta complex128 MeanPrecision...
aa8c9fd9529275fb6cd165a7bf72c23609d905f4
9e84fc92532cda51e2ecb982f0884efed5e6f86d
MisinformedDNA/pulumi-azure-native
/sdk/go/azure/media/latest/asset.go
Go
go
7,927
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 latest import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) // An Asset. // Latest API Version: 2020-05...
01bac0b41f4b0b3e2e573fd83f75f10918cc66db
48612359e97b768924dd60ccac4559a436596c2e
randydom/Sia
/client-termbox/input.go
Go
go
6,441
permissive
package main import ( "github.com/nsf/termbox-go" ) const ( ButtonColor = termbox.ColorBlue ButtonHLColor = termbox.ColorRed CheckboxColor = termbox.ColorDefault CheckboxHLColor = termbox.ColorRed FieldColor = termbox.ColorBlue FieldHLColor = termbox.ColorRed ) // An Input is simply an MVC that can be...
0270d4ddce6b999d3ef56fd2eb2273340d56c577
c74467aed1ee9abbd7738a965ca3378af03c7b25
newcontainer/dockerc
/commit.go
Go
go
463
no_license
package main import ( "fmt" "os/exec" log "github.com/Sirupsen/logrus" "github.com/exfly/dockerc/container" ) func commitContainer(containerName, imageName string) { mntURL := fmt.Sprintf(container.MntUrl, containerName) mntURL += "/" imageTar := container.RootUrl + "/" + imageName + ".tar" if _, err := ex...
5f16619a716ea7591a60691c8b8bb5618b5bc6cc
04b59074165313fd2cf3d3118bef8801ecad0eb2
leonelcs/golangprogramming
/packages/apackage/apackage.go
Go
go
257
no_license
package apackage import ( "fmt" ) //PrintPackage method prints the string package func PrintPackage() { fmt.Println("package ", privateConts) } const privateConts = 123 //Myconsts public constant to be available to other packages const Myconsts = 321
dc6c83d92462dc15f6fd3a6a024f957e6a9d88c4
2966ff2ec76868663ea5de680baad1d527488d30
Nixiangyu/donation-service
/models/impl/pub.go
Go
go
12,272
permissive
/* Copyright ArxanChain Ltd. 2020 All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package impl import ( "errors" "fmt" "time" "github.com/csiabb/donation-service/common/rest" "github.com/csiabb/donation-service/models" "github.com/csiabb/donation-service/structs" "github.com/jinzhu/gorm" ) cons...
54a9822277bc05dfeb9abe0d3127f013d23b825c
8d6970793c29320473d83b4410f4eeb81806dccf
peterfang/eve
/pkg/pillar/cmd/downloader/handlers.go
Go
go
2,388
permissive
package downloader import ( "github.com/lf-edge/eve/pkg/pillar/types" log "github.com/sirupsen/logrus" ) // Notify simple struct to pass notification messages type Notify struct{} type downloadHandler struct { // We have one goroutine per provisioned domU object. // Channel is used to send notifications about co...
e0493350474acb6b262b306158542dfa548d8ef3
7d668431e60ea034603b23ec916ee9c8c0446240
bpkgoud/pulumi-azure-native
/sdk/go/azure/authorization/accessReviewScheduleDefinitionById.go
Go
go
9,624
permissive
package authorization import ( "context" "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type AccessReviewScheduleDefinitionById struct { pulumi.CustomResourceState AssignmentState pulumi.StringOutput `pulumi:"assignmentState"` AutoApplyDecisionsEnabled pul...
2d936495ae51dcdaa8ec9a827347b245afb935f9
f6163532499ec9aa2df1b6e7302c44b42789a889
henriqueholanda/photoprism
/pkg/fs/name.go
Go
go
1,273
permissive
package fs import ( "fmt" "os" "path/filepath" "strings" ) // FileName returns the a relative filename with the same base and a given extension in a directory. func FileName(fileName, dirName, baseDir, fileExt string, stripSequence bool) string { fileDir := filepath.Dir(fileName) baseName := Base(fileName, stri...
a32caaaabd6b5dce5c115d253a02c826ee10d0d7
e06a4c030de7d7eefd11a1ebb75eccdf9d386dfa
trimental/sync
/go/examples/election/election.go
Go
go
478
permissive
package main import ( "context" "fmt" "time" "github.com/metaparticle-io/sync/go/sync" ) func main() { lock := mpsync.NewLock("election-lock", mpsync.DEFAULT_INTERVAL) election := mpsync.NewElection(lock, func(c context.Context) error { fmt.Println("LEADER!") time.Sleep(time.Second * 45) return nil ...
c58300795f73c5ea7b477c679997387ce55bd688
7af3ca42d18c4e5a4825cec03144f6b6242c5941
data0x200/go-generate-sample
/cmd/gen-router/main.go
Go
go
973
no_license
package main import ( "bytes" "encoding/json" "flag" "io/ioutil" "text/template" ) const strTmpl = `//generated by gen-router; DO NOT EDIT package main import "github.com/gorilla/mux" func newRouter() *mux.Router { r := mux.NewRouter(){{range .}} r.HandleFunc("{{.Path}}", {{.Handler}}).Methods("{{.Method}}")...
91cab925e1fead1132e319f6029af147a151054c
fd720a3b95310e066fd54f008c4e3a1756382e24
opencord/voltha-epononu-adapter
/vendor/github.com/opencord/omci-lib-go/generated/physicalpathterminationpointxdslunipart1.go
Go
go
9,050
permissive
/* * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) * 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://w...
c28e4201848870ec99af392d12beada69ffb78fd
af0e5d61611830a04d109b78107a05d84adff773
milvus-io/milvus
/internal/proxy/count_reducer.go
Go
go
523
permissive
package proxy import ( "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/internal/util/funcutil" ) type cntReducer struct { } func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.QueryResults, error)...
9618c908595bb7eae9dfd54b6708b1be2f4fe1e0
b6675b8a0dafd8e03a1f3eb96fab926f9f95ae24
valuppo/inmem
/config.go
Go
go
211
no_license
package inmem type InmemConfig struct { IsEnabled bool NSQD string Lookupd string ConnectionNumber int MaximumInFlight int ConcurrentHandler int MaxAttempt int }
2fd31e67a48e18701c42661e11e0e510965b111f
0a8ffa19bbab526d88e38b11e26bdb1cf39f20b5
maxwell92/gopl
/mastering-go-web-services/demo1.go
Go
go
597
no_license
package main import ( "encoding/json" "fmt" "github.com/gorilla/mux" "net/http" "net/http" "sync" "sync/atomic" ) type API struct{ Message string `json:"message"` } func Hello(w http.ResponseWriter, r *http.Request) { urlParams := mux.Vars(r) name := urlParams["user"] HelloMessage := "Hello " + name ...
6aef10339839d2ad8e23832a158da51b1dfc4933
9a5684211419338db58292750f47a911f58a3a63
renovate-testing/test-9748-google-cloud-go
/internal/generated/snippets/channel/apiv1/CloudChannelClient/CheckCloudIdentityAccountsExist/main.go
Go
go
1,378
permissive
// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
877627124bc2a1069ce2694cae4fea570158c547
1cdea57a9c7a594977cc00e3d020c7f49b365d63
leetpy/cactus
/handler/handler.go
Go
go
472
no_license
package handler import ( "net/http" "github.com/gin-gonic/gin" "github.com/leetpy/cactus/pkg/errno" ) type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` } func SendResponse(c *gin.Context, err error, data interface{}) { code, messag...
287443ab59560ee456d852466f636344ea7402f2
22a12be3ca978a6e7b196c8082e43b6254fa13df
opentable/nats-streaming-server
/stores/bench_test.go
Go
go
4,449
permissive
// Copyright 2016 Apcera Inc. All rights reserved. package stores import ( "github.com/nats-io/go-nats-streaming/pb" "github.com/nats-io/nats-streaming-server/spb" "hash/crc32" "math/rand" "os" "sync" "testing" ) func benchCleanupDatastore(b *testing.B, dir string) { if err := os.RemoveAll(dir); err != nil {...
90b281a6bc348be74e3efdd8533e9e5a94faf4df
edfd883fd813d9dbbcab6cbe30731c10cb4dcc5d
sultan8252/dm
/dm/ctl/master/break_ddl_lock.go
Go
go
2,720
permissive
// Copyright 2019 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
263be1a267a03d5fe330ee5ea887fcdc9d23ece0
a4296cb4858e68494351ac65a0fab817ae6cd162
eezz10001/k8s-bakcend
/src/services/PodService.go
Go
go
878
no_license
package services import "k8s-backend/src/models" //@Service type PodService struct { PodMap *PodMapStruct `inject:"-"` Common *CommonService `inject:"-"` EventMap *EventMapStruct `inject:"-"` } func NewPodService() *PodService { return &PodService{} } func(this *PodService) ListByNs(ns string ) interface{}{ pod...
5225d3a950dc8903d23c3014fcdcbc67230f334b
26f2e2834f2276320455f8d04cc3565d2bcbe959
high-moctane/self-pinger
/main.go
Go
go
680
permissive
package main import ( "flag" "log" "net/http" "time" ) var url = flag.String("u", "http://localhost", "target url") var dur = flag.Duration("d", 20*time.Minute, "ping duration") func main() { flag.Parse() p := Pinger{URL: *url, Duration: *dur} p.Run() } // Pinger fetches url with specified interval. type Pin...
9da56a5bb25068f01a4aae516efd9b306532a562
50519745c02b4dabe31c956a91ed68deca1c3407
iCodeIN/lntxbot
/send.go
Go
go
4,184
permissive
package main import ( "context" "strings" "github.com/bwmarrin/discordgo" "github.com/docopt/docopt-go" "github.com/fiatjaf/go-lnurl" "github.com/fiatjaf/lntxbot/t" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" ) func handleSend(ctx context.Context, opts docopt.Opts) { u := ctx.Value("initiator"...
70be933fa86cc08118b0d03c8e3da47c1077780a
cdc1153a1218b9fd78f464acfc2eb767ea9c9966
bruth/sarama-cluster
/consumer.go
Go
go
13,894
permissive
package cluster import ( "sort" "time" "gopkg.in/Shopify/sarama.v1" ) // Consumer is a cluster group consumer type Consumer struct { client *Client csmr sarama.Consumer subs *partitionMap consumerID string generationID int32 groupID string memberID string topics []string dying, dead c...
badd17d1460629ec4bd11660274d8c28efe61355
573881cfe0c2e5e329827ab181a3390c2810c9d5
cosmos/cosmos-sdk
/x/distribution/abci.go
Go
go
1,101
permissive
package distribution import ( "time" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // BeginBlocker sets the proposer for determining distribution during endblock // and ...
306f0dae27b159a1d67255627623a168985fd7bb
ff9ff3e7a916f06bdde1597e4e0284252f11337c
solozyx/go-crawler
/src/crawler/multitask/blocking/zhenai/parser/profile.go
Go
go
3,323
permissive
package parser import ( "regexp" "strconv" "crawler/multitask/blocking/engine" "crawler/multitask/blocking/model" ) //const( // ageRe = `<div class="m-btn purple" [^>]*>([\d]+)岁</div>` // marriageRe = `<div class="m-btn purple" [^>]*>([^<]+)</div>` //) // 预先编译 // <div class="m-btn purple" data-v-bff6f798="">2...