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
c14d8894b55ffb68d91672560e1ef62a0981413a
f2e2e4e5136cdf9e0849b574dc4eb15a635b77ee
leostudio/kit
/mdb/mongo_test.go
Go
go
2,346
no_license
//+build integration package mdb import ( "context" "github.com/google/uuid" "github.com/leostudio/kit/mdb/test" "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongo...
7eb1f9497becdeafa0422c011820e3f8345f8038
bbea523133169ba517fc287b8d463f3751950798
crscillitoe/sourcegraph
/enterprise/internal/campaigns/service_apply_campaign_test.go
Go
go
40,268
permissive
package campaigns import ( "context" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/sourcegraph/sourcegraph/cmd/frontend/backend" ct "github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns/testing" "github.com/sourcegraph/sourcegraph/internal/actor" "github.com/sourcegraph/sourcegraph/...
8a818988a8e6ff47005a57c697206d71090c9232
2841b901c44a500225c95e0442e8ddcd047350f6
sauravgsh16/go-microservices
/mvc/services/user_services.go
Go
go
225
no_license
package services import ( "github.com/sauravgsh16/microservices/mvc/domain" "github.com/sauravgsh16/microservices/mvc/utils" ) func GetUser(userId int64) (*domain.User, *utils.AppError) { return domain.GetUser(userId) }
5b70c19e665568ecdf40271612139758ae9793fc
5d97f0911d3e114dbdf6969c7d18de0004559057
hl32199/web-go-skeleton
/app/api/models/VoteRecord.go
Go
go
288
no_license
package models import "github.com/jinzhu/gorm" type VoteRecord struct { gorm.Model UserId uint `json:"user_id" gorm:"type:int(10);not null"` CandidateId uint `json:"candidate_id" gorm:"type:int(10);not null"` SeasonId uint `json:"season_id" gorm:"type:int(10);not null"` }
6094278b7373aff17b66f2929219d4190c54be66
004271de558b7c034a2506b5a40e163b37f003b7
harshalhshah/rack
/commands/filescommands/containercommands/common.go
Go
go
2,220
no_license
package containercommands import ( "fmt" "runtime" "sync" "time" "github.com/jrperritt/rack/handler" "github.com/jrperritt/rack/internal/github.com/cenkalti/backoff" "github.com/jrperritt/rack/internal/github.com/dustin/go-humanize" "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstac...
154b46b6a98b1a82d9f714073e8304bb6111cfa0
a82a64775be13efe52a0e5f8afa9afad2f88776b
zicla/leetgo
/101to200/111_Minimum_Depth_of_Binary_Tree/111_Minimum_Depth_of_Binary_Tree.go
Go
go
456
no_license
package main import ( "fmt" "math" ) func minDepth(root *TreeNode) int { if root == nil { return 0 } if root.Left == nil { return 1 + minDepth(root.Right) } if root.Right == nil { return 1 + minDepth(root.Left) } ml := minDepth(root.Left) mr := minDepth(root.Right) if ml < mr { return ml + 1 } ...
c30e781034f1afeca74038322ab899fb08b9aa28
b9c9f713a65f7fe50117a027f6c581a95d9f799c
kpi-exams-2021/ekz-kpi
/tools/http.go
Go
go
996
no_license
package tools import ( "encoding/json" "log" "net/http" ) type errorObject struct { Message string `json:"message"` } // WriteJsonOk sends 400 error response with a JSON object describing the error reason. func WriteJsonBadRequest(rw http.ResponseWriter, message string) { writeJson(rw, http.StatusBadRequest, &e...
18ed38cd83b462de4e352e90c226d679017dc15b
c498b68fda17ee9d9a8c0c76c75be3bb2890e0a0
Sallysjw/luci-go
/dm/appengine/deps/walk_graph_test.go
Go
go
14,533
permissive
// Copyright 2015 The LUCI Authors. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package deps import ( "fmt" "testing" "time" "github.com/luci/gae/service/datastore" "github.com/luci/luci-go/common/clock" "github.com...
45d23d613b9c3d50b7549aec29e8394c59bc4b31
a82471102cceadb28ea6b5468a5851a564058d6b
alphalgo/openmirror
/openmirror.go
Go
go
853
permissive
package openmirror import ( "errors" ) var ErrCannotPaired = errors.New("cannot paired") // Omirror defines a openmirror data structure type Omirror struct { Left Mirror Right Mirror } // Mirror defines a sub mirror type Mirror struct { paired bool setup bool } // Openmirror defines Omirror's interface type...
12b8021f12ad4c2dd24eefe9ef594f192765f3c2
5b6c7e51be65fa75f8535489fdcbfaea2c5485e8
GeoNet/delta
/meta/station.go
Go
go
3,207
permissive
package meta import ( "sort" "strconv" "strings" "time" ) const ( stationCode = iota stationNetwork stationName stationLatitude stationLongitude stationElevation stationDepth stationDatum stationStart stationEnd stationLast ) var stationHeaders Header = map[string]int{ "Station": stationCode, "Ne...
8842f7e0020706f1cddd116083998a1276a16bee
6f060cd750ee79719791d9e4c5f7e591f1885ae6
siddhiparekh11/Questengine
/repository/ProgressRepo_test.go
Go
go
4,945
no_license
package repository_test import ( repo "github.com/siddhiparekh11/GoChallenge/repository" "github.com/siddhiparekh11/GoChallenge/models" "testing" "gopkg.in/DATA-DOG/go-sqlmock.v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "context" "time" ) /* Test file for Progress Repo. Moc...
76c94dc1c654c2fc5122956ad6948aadaabb0372
0547ec13a66bce18b6458a12210bd438a3223492
btrieger/antrea
/pkg/agent/controller/networkpolicy/networkpolicy_controller_test.go
Go
go
26,456
permissive
// Copyright 2019 Antrea 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 ...
099cf51793d61c24fb41034a4f51c5e5ea34a21d
8cc78c01ed46ac18edaddecdfc09e66faa47a762
boshuzhang/goweb
/src/cmd/api/goapi.go
Go
go
21,226
permissive
// Copyright 2011 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. // Binary api computes the exported API of a set of Go packages. package main import ( "bufio" "bytes" "flag" "fmt" "go/ast" "go/build" "go/parser" "go...
03893b4cf4261c84a7159fbfb9e6f7b173b46cd8
af1d67c2d007db3ec995be618ad21a14d3037025
dylanpeng/gopractice
/src/projects/grpcdemo/grpclibdemo/server/main.go
Go
go
754
no_license
package main import ( "gopractice/projects/grpcdemo/grpclibdemo" "os" "os/signal" "syscall" ) func main() { config := &grpclibdemo.Config{ Host: "localhost", Port: "23000", } router := &grpclibdemo.GRouter{} server := grpclibdemo.NewServer(config, router) _ = server.Start() config2 := &grpclibdemo.Co...
c4fc47cc63124b0f9b211aadc854f24ca25164c7
24c5b6ea53f1f7ce28d9cd9094a98dcdb9367275
laashub-soa/aks-engine
/cmd/rotate_certs_test.go
Go
go
11,977
permissive
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. package cmd import ( "context" "io/ioutil" "os" "testing" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/google/uuid" . "github.com/onsi/gomega" "github.com/pkg/errors" "...
d86952ba3ca0fd9625ad3b5997ef9ec83e8102ed
bada6ddd9de7a96a1b8609fe10221e45d845899a
cloudflare/certmgr
/vendor/github.com/cloudflare/cfssl/config/config.go
Go
go
21,951
permissive
// Package config contains the configuration logic for CFSSL. package config import ( "crypto/tls" "crypto/x509" "encoding/asn1" "encoding/json" "errors" "fmt" "io/ioutil" "regexp" "strconv" "strings" "time" "github.com/cloudflare/cfssl/auth" cferr "github.com/cloudflare/cfssl/errors" "github.com/cloudf...
f381a6982bc3e2e42f7a65b4b45a30a34e4591ea
06471b0421211729b887e2f545051d70d0a69e05
mixcm/QRServer
/main.go
Go
go
4,367
permissive
package main import ( "github.com/xtlsoft/router" "net/http" "strconv" "io/ioutil" "os" "bytes" "image/png" "image/jpeg" "fmt" "image/gif" "flag" "github.com/skip2/go-qrcode" "encoding/base64" ) type req struct { writer http.ResponseWriter request *http.Request } func checkCache(r *req, data string, s...
dba376f353a26b3265e46f8a58207164701b71a7
08c5fa81d12c23bb6e4da7e650f479d056302747
sgtest/monorepo-test-3
/kubernetes-2/pkg/kubelet/images/puller.go
Go
go
2,670
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, ...
954fd536ce77b3f663c5000722edcc6698305c0d
c283b2c35348c3df5c61537facc47065ecd151c0
rootsongjc/kubernetes
/cmd/kube-apiserver/app/server.go
Go
go
51,570
permissive
/* Copyright 2014 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, ...
d00f320afb6706b93a2f90e64b28422b659dedbc
c75a8f76314bcf15ba13e3f876cad1f7e15d2e97
PeiranMa/telepathy-poc
/queue_and_grpc_workflow/v2/test/client_frontend/test_client_front.go
Go
go
3,828
no_license
package main import ( "context" "flag" "fmt" "io" "log" "net" "sync" "time" "google.golang.org/grpc" "telepathy.poc/mq" pb "telepathy.poc/protos" ) type TClient struct { serverAddr string client pb.FrontendSvcClient } func (c *TClient) CreateJob(jobID string, reqNum int32) error { _, err := c.clie...
e4ece1766b2343f09ca44edd727732b2e2bc734b
7d8b6ba38357e9060ed39575055a43bf1520c1c9
pandaU/go-baas
/internal/github.com/hyperledger/fabric/common/capabilities/channel.go
Go
go
3,030
no_license
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ /* Notice: This file has been modified for Hyperledger Fabric SDK Go usage. Please review third_party pinning scripts and patches for more details. */ package capabilities import ( "baas-fabric/internal/github.com/hyperledger/fabric/...
b5b3906883a33c7fd4ed65d48d7ee837bf184983
b734c137346e48ab121385703d8cd66a1183997c
goharbor/harbor
/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go
Go
go
1,250
permissive
package common type Credential struct { SecretId string SecretKey string Token string } func NewCredential(secretId, secretKey string) *Credential { return &Credential{ SecretId: secretId, SecretKey: secretKey, } } func NewTokenCredential(secretId, secretKey, token string) *Credential { return &Crede...
7a7c438b485c98b31476813947c8017ce829daae
0c59d0d174f0f66000791bbb443738b953b02741
sergey-zinchenko/gamelink-go
/app/saves.go
Go
go
1,705
no_license
package app import ( C "gamelink-go/common" "gamelink-go/storage" "github.com/kataras/iris" "github.com/kataras/iris/context" "net/http" "time" ) func (a *App) getSave(ctx iris.Context) { var saveID int var err error defer func() { if err != nil { handleError(err, ctx) } }() user := ctx.Values().Ge...
11e941ffba22ff575861f2794bb275b44b3ef827
0f60c6ad0a05c076cd98d4bcc66e89e88dcd34eb
isabella232/tegola
/maths/hitmap/hitmap_test.go
Go
go
7,151
permissive
package hitmap import ( "fmt" "log" "testing" "github.com/gdey/tbltest" "github.com/airmap/tegola/maths" ) func TestSegmentLinesContains(t *testing.T) { type tstPt struct { p maths.Pt contained bool } type testcase struct { lines []maths.Line pts []tstPt desc string } cpt := func(x, y...
8935a76aeb30a980b5c2849e504f7dc659f642a9
c787794467e5385fdf731b7a6feed281220b7bcb
kpolnitz/deadline
/schedule/types.go
Go
go
2,627
permissive
package schedule import ( "encoding/xml" "time" ) type Definition struct { XMLName xml.Name `xml:"schedule"` Handler Handler `json:"handler" xml:"handler,omitempty" db:"handler"` Timing string `xml:"timing,attr,omitempty" db:"timing"` Name string `xml:"name,attr,omitempty" d...
460c40d7e2583f21de22c4d4f99206d7c240c573
6b0e43cc33a4ebd11e6d9e866aa0a86d5ac19224
Wenlong0913/openbazaar3.0
/orders/refund_test.go
Go
go
5,077
no_license
package orders import ( "crypto/rand" "errors" "fmt" "github.com/cpacia/openbazaar3.0/database" "github.com/cpacia/openbazaar3.0/events" "github.com/cpacia/openbazaar3.0/models" npb "github.com/cpacia/openbazaar3.0/net/pb" "github.com/cpacia/openbazaar3.0/orders/pb" "github.com/cpacia/openbazaar3.0/wallet" i...
199350aa181813a849246aaad500a9ef2f511679
4be3f8519352aee0dda621d875fced167b147dbb
BRAVO68WEB/yagpdb
/logs/template_extensions.go
Go
go
1,956
permissive
package logs import ( "context" "time" "emperror.dev/errors" "github.com/botlabs-gg/yagpdb/v2/common/templates" ) func init() { templates.RegisterSetupFunc(func(ctx *templates.Context) { ctx.ContextFuncs["pastUsernames"] = tmplUsernames(ctx) ctx.ContextFuncs["pastNicknames"] = tmplNicknames(ctx...
8a85d11b8163c29ee5fba4cedfdd0a362502740a
82b29e390d83a327e95d1eb9b893f7be0b29d5f2
leolongpy/movie_gozero
/api/cinema/internal/svc/servicecontext.go
Go
go
423
no_license
package svc import ( "github.com/tal-tech/go-zero/zrpc" "movie_gozero/api/cinema/internal/config" "movie_gozero/rpc/cinema/cinemaserviceext" ) type ServiceContext struct { Config config.Config Cinema cinemaserviceext.CinemaServiceExt } func NewServiceContext(c config.Config) *ServiceContext { return &ServiceCo...
eee6cc919482be637363eb2ff4be4185d914d946
ed2e62973eb39e6e36aaa6378db4cb04ae77986e
abhay-krishna/etcd
/proxy/grpcproxy/metrics.go
Go
go
3,470
permissive
// Copyright 2016 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
98e9e842e8f8f0f0b900feee78d0c5236f25beb9
dd70a4eb780e1cadf94e9aa1a54606f05624186b
loft-sh/kiosk
/vendor/k8s.io/apiserver/pkg/registry/rest/create.go
Go
go
7,382
permissive
/* Copyright 2014 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, ...
e3ed7698d4285e23814b212b493f52061d31f16b
22cc5c71e18bfdacd27cfe423269cfbdd7f50088
EColazon/Sara
/src/goredis/goredis_base.go
Go
go
2,323
no_license
package goredis import ( "fmt" "time" "net/http" "runtime" "io" "log" "github.com/garyburd/redigo/redis" ) //连接池大小 var MaxPoolSize = 20 var redisPool chan redis.Conn func GoRedisBase() { conn, err := redis.Dial("tcp", "127.0.0.1:6379") if err != nil { fmt.Println("---> Connect to redis error", err) retu...
7647f542f0fcac58807a424b6796e4c72a4b315f
c789019ddeac2651f930e2c03ab1fde8303964a6
lldra99/drachain
/plugin/store/mpt/db/errors.go
Go
go
1,555
permissive
// Copyright Fuzamei Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copyright 2015 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistri...
b401c9847abee64ee3e774b1e32944ccbd6aa78d
8a9cd95b877215d4a2e6f6b65a879a8dccc9131f
bazhang87/move2kube
/internal/irpreprocessor/ingresspreprocessor.go
Go
go
2,571
permissive
/* * Copyright IBM Corporation 2021 * * 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 o...
0670b091f2318e2cf4d0e8e852afaab5e94f3918
4b51dbbe6ddd0c8d340772647d324cd75add1645
yxie233/Distributed-File-Systems
/server.go
Go
go
10,321
no_license
package main import ( "fmt" "log" "net" "net/rpc" "os" "sync" "time" ) type Chunk [32]byte type Clients struct { ID int LocalIP string LocalPath string Online bool } type MyDFSfile struct { ClientID int FileName string Chunks map[int]int ChunkNum int } // RPC functions for clients type ...
ff26dac25fec0c1e4a3e307004c066f1073d75d9
ef1f8589dfa710af62f8e447d715d94fea3bbb52
ccamel/utask
/engine/values/values.go
Go
go
8,691
permissive
package values import ( "bytes" "encoding/json" "fmt" "text/template" "time" "github.com/Masterminds/sprig" "github.com/juju/errors" "github.com/ovh/utask" "github.com/robertkrimen/otto" ) // keys to store/retrieve data from a Values struct const ( InputKey = "input" ResolverInputKey = "resolver_i...
68eacb0e2c14da3dba7aaf5502b2a7f5c32bc932
eedfb24565a54d3e3451ff2a8754f232d37eeff5
rubinus/mygo
/data-str/07-Set-and-Map/09-Leetcode-Problems-about-Map-and-Set/src/LinkedListMapSolution350/LinkedListMapSolution350.go
Go
go
918
no_license
package main import ( "fmt" "mygo/data-str/07-Set-and-Map/06-LinkedListMap/src/LinkedListMap" ) /// Leetcode 350. Intersection of Two Arrays II /// https://leetcode.com/problems/intersection-of-two-arrays-ii/description/ /// /// 课程中在这里暂时没有介绍这个问题 /// 该代码主要用于使用Leetcode上的问题测试我们的LinkedListMap类 func intersect(nums1 []in...
1fb320f83479c74afa88cb59734878e7b4efcb9c
6c735428502d756902f747e15ff300fc59b3d07d
schallert/temporal
/common/xdc/nDCHistoryResender_test.go
Go
go
11,338
permissive
// The MIT License // // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. // // Copyright (c) 2020 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 Soft...
4f958d45faa6b63b7d44b22a3a65b83179364386
017662d08b7522ab473cea56efe1bb5c471b9586
mixieer/algorithm022
/Week_02/demo6/demo6.go
Go
go
1,494
no_license
package demo6 //144. 二叉树的前序遍历 //输入:root = [1,null,2,3] //输出:[1,2,3] //二叉树的前序遍历:按照访问根节点——左子树——右子树的方式遍历这棵树,而在访问左子树或者右子树的时候, //我们按照同样的方式遍历,直到遍历完整棵树。因此整个遍历过程天然具有递归的性质,我们可以直接用递归函数来模拟这一过程。 type TreeNode struct { Val int Left *TreeNode Right *TreeNode } var vals []int func Run(root *TreeNode) []int { var preorder ...
ddfa325d259ab56db7c5734afd55f08fe65d4f24
c3f1dd98330b9390ec5ee9437cb925deda2b88ea
gatechain/iavl
/mutable_tree.go
Go
go
17,218
permissive
package iavl import ( "bytes" "fmt" "sort" "github.com/pkg/errors" dbm "github.com/tendermint/tm-db" ) // ErrVersionDoesNotExist is returned if a requested version does not exist. var ErrVersionDoesNotExist = fmt.Errorf("version does not exist") // MutableTree is a persistent tree which keeps track of version...
fc10d423889b67a19d75f9c7306642ddab10d1ba
9d0d54fe7302ce6b346c920c7a98ec9313443ae8
tsangint/kubernetes
/pkg/kubectl/cmd/create/create_deployment.go
Go
go
4,954
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, ...
724e94084af3a1f5d7eb2d785ee6b6b5b30aae2d
0881b8e7e12155cc404a625d3716056896f628b5
dennwc/cas
/all_files.go
Go
go
1,560
permissive
package cas import ( "context" "github.com/dennwc/cas/schema" "github.com/dennwc/cas/storage" "github.com/dennwc/cas/types" ) // IterateDataBlobsIn iterates all non-schema blobs in the provided schema blob. func (s *Storage) IterateDataBlobsIn(ctx context.Context, root Ref) storage.Iterator { return &filesInIte...
74df7e2ca2e84572fa63ee2d08264059ab280ded
d812620522225bfb241ae89cb980291df43114a4
samhit-bhogavalli/freshers-bootcamp
/exercises/Day2/q3.go
Go
go
1,952
no_license
package main import ( "errors" "fmt" "math/rand" "strconv" "sync" ) //structure for bank account type bankAccount struct { balance int mutex sync.Mutex } //function for depositing the amount (this function will work without wait group) func (ba *bankAccount) deposit(amount int) { ba.mutex.Lock() ba.balanc...
781bcd5d2d670dba116d2da1bc2f8b32be6afa69
a6bccc604d04225e6d2fd099589b88db91db2d1c
Himangini/pctl
/pkg/catalog/manager.go
Go
go
675
permissive
package catalog import ( profilesv1 "github.com/weaveworks/profiles/api/v1alpha1" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" ) //go:generate counterfeiter -o fakes/fake_catalog_manager.go . CatalogManager // CatalogManager inteface for interacting with catalog API type CatalogManager interface { Sho...
988a93ba153550e47430533dee1b82562c001be0
3ece73b81409fd9b6db562d6367434fc8ecf79d7
orijtech/gvisor
/pkg/sentry/fs/fsutil/file.go
Go
go
12,508
permissive
// Copyright 2018 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
a66ce58e5ea52eec2cccc9fe08364fa96c3a5017
35cecfb45a36e87029afb0112c1f6a11d524ad8d
Slory7/goappex
/src/data/repositories/repositoryReadOnly.go
Go
go
1,764
no_license
package repositories import ( "data" ) type IRepositoryReadOnly interface { List(slicedest interface{}, queryBoolColumns string, queryObject ...interface{}) error ListBy(slicePtr interface{}, query string, params ...interface{}) error Get(dest interface{}) (bool, error) GetByID(ID interface{}, dest interface{}) ...
9b150468c769e03011160162e72a297a3916c44f
7e5671751050925901ffcf8b9d40b929eb7c979f
ashkarin/pizza-shop
/pkg/pizza/pizza.go
Go
go
433
no_license
package pizza import "github.com/ashkarin/ashkarin-pizza-shop/pkg/ingredient" // Pizza represents pizzas from the chef type Pizza struct { ID interface{} `json:"_id,omitempty" bson:"_id,omitempty"` Name string `json:"name" bson:"name"` Price float64 ...
f937c487419779e00742608a8905980cc7eaff32
c93f6d592a0cd270e801fdf5ef9249df00391073
alessio/keyring
/wincred_test.go
Go
go
2,343
permissive
// +build windows package keyring_test import ( "reflect" "testing" "github.com/99designs/keyring" ) func TestSavingCredentialsWithWinCred(t *testing.T) { kr, err := keyring.Open(keyring.Config{ AllowedBackends: []keyring.BackendType{keyring.WinCredBackend}, }) if err != nil { t.Fatal(err) } item1 := k...
39df7eb92ccfc16cd59c8b0f787dd65be21dcc3e
8e58792f44aabbe6017c8bc175911fac3c09db30
DeBankDeFi/cosmos-sdk
/x/auth/module_test.go
Go
go
716
permissive
package auth_test import ( "testing" "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/testutil" "github.com/cosmos/c...
32c453f26141d555ca09af46474e6ca4307304fc
98bfdf598ffce111b34edcf370552ae5c83d58e5
diegomrod95/Project-Euler
/Concorrente/src/euler/pipelines.go
Go
go
690
no_license
package euler import ( "math/big" ) // Junção que filtra os números dvisores de num vindos de um canal e envia para // outro canal. func FilterDivisor( seq <-chan *big.Int, num int64 ) <-chan *big.Int { out := make(chan *big.Int) go func() { m := big.NewInt(num) zero := big.NewInt(0) for { select { cas...
b2903edaf8f3e9b01eca4d4e3248a3eca6b1ffce
b3a1844abb5211e80518d8062cc8c3083849b633
oleksiy-turchanikov/compute-image-tools
/cli_tools_tests/e2e/gce_image_import_export/test_suites/onestep_import/onestep_import_test_suite.go
Go
go
9,955
permissive
// Copyright 2020 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 appl...
6a9da5bac49aa563494c229495bdb5d917778c8e
8407a8ba8128ccf0357ef1c67789b3176bf90f62
Shumpei-Kikuta/practice_go
/cards/main.go
Go
go
555
no_license
package main func main() { // var card string = "Ace of Spades" // var val_name type // bool, string, int, float64 // cards := deck{"Ace of Diamonds", newCard()} // cards := deck{"Ace of Diamonds", newCard()} // cards = append(cards, "Six of Spades") // slice is immutable // cards := newDeck() // cards.saveToF...
8d175b401534cc5f7460089e6340eea2d5bff237
b46eba0ccd0618e0ff0466155e1a28ba920686db
Lauricarge/teleport
/lib/srv/discovery/fetchers/db/aws_elasticache.go
Go
go
8,996
permissive
/* Copyright 2022 Gravitational, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwar...
277456a3390b8de30f30576332a5382bd6c0e491
9fe40ba81dc9bf57395d8792ae0edf3177b86b6c
Sterks/battleship
/internal/app/app.go
Go
go
1,009
no_license
package app import ( "battleship/internal/config" handler "battleship/internal/delivery/http/v1" "battleship/internal/server" "battleship/internal/service" "battleship/pkg/logger" "battleship/pkg/size" "github.com/sirupsen/logrus" "github.com/spf13/viper" "os" "os/signal" "syscall" ) func Run(configPath st...
16908adde0f637fafa045658aeaaba2c2033f430
0ee8c23bb875d5221a0415267b694302b9a428e8
CecileRobertMichon/cluster-api
/bootstrap/kubeadm/types/utils.go
Go
go
10,487
permissive
/* Copyright 2021 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, ...
6c086e7a1669bf019c6f7a381f93b9f4a96da8dc
f41a0bdc84c1d9923de13e34dea8ce1622c6bc31
yinqiwen/gotoolkit
/protoc-gen-shmproto/main.go
Go
go
1,373
no_license
package main import ( "io/ioutil" "log" "os" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) func main() { data, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatalf("reading input:%v", err) } var request plugin.CodeGeneratorRequest // The input. va...
e75207d045aa9509a37fdd6664fc0231a69e4c4d
fb4352163e9dc6ebd310123de74c56a19a1f41f5
Mjolnir42/soma
/internal/stmt/tree.go
Go
go
3,630
permissive
/*- * Copyright (c) 2016, 1&1 Internet SE * Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de> * All rights reserved * * Use of this source code is governed by a 2-clause BSD license * that can be found in the LICENSE file. */ package stmt const ( TreeStatements = `` TreeShowRepository = ` SELECT so...
5f11600e4568be861ac775433ad6294cf7c0286c
0ccda21c4e460789a0aded1642848dbd50e6db53
vinsonzou/subfinder
/main.go
Go
go
7,465
permissive
// subfinder : Subdomain discovery tool in golang // Written By : @codingo // @ice3man // // Distributed Under MIT License // Copyrights (C) 2018 Ice3man // Contains main driver classes for the tool package main import ( "bufio" "encoding/json" "flag" "fmt" "io/ioutil" "os" "path/filepath" "reflect" "string...
618271d157e7516de0108f5ef54b9da190905328
377d6c1d4dbd1819d4a4a6bc3395a4ca9e76e0e6
sullivanchan/tidb
/expression/builtin_math.go
Go
go
43,529
permissive
// Copyright 2013 The ql Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSES/QL-LICENSE file. // Copyright 2015 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in complia...
608fc9f1c3f9814619cdf3ff88bc098025051fcb
ad0f3e28ffa93ea15f66fa8b3d54985083973c0c
mullerrwd/gitlab
/cmd/confirm.go
Go
go
297
permissive
package cmd import ( "log" "github.com/manifoldco/promptui" ) func confirm() bool { prompt := promptui.Select{ Label: "Select[Yes/No]", Items: []string{"Yes", "No"}, } _, result, err := prompt.Run() if err != nil { log.Fatalf("Prompt failed %v\n", err) } return result == "Yes" }
a19aa7303aaa4bf2f65f0da6df34509cc880423a
df6fa009b8704c219c343e2729d695c271fdd72f
cipepser/monkey
/vm/frame.go
Go
go
406
no_license
package vm import ( "github.com/cipepser/monkey/code" "github.com/cipepser/monkey/object" ) type Frame struct { cl *object.Closure ip int basePinter int } func NewFrame(cl *object.Closure, basePointer int) *Frame { return &Frame{ cl: cl, ip: -1, basePinter: basePointer, }...
fa40f21b8d22b03d7e2c1c5ab2133c96fcfd55ff
6276ff792a08694663db6784b7299322cb3b54d2
LucaPaterlini/randomGoExercises
/rotational-cipher/rotation_chiper.go
Go
go
524
no_license
// Package rotationalcipher provides encryption functions by rotation. package rotationalcipher // RotationalCipher convert a string by rotating of rot position // on english alphabet, BE CAREFUL IT WORKS ONLY FOR ENG ALPHABET. func RotationalCipher(s string, rot int) string { rotI32 := int32(rot) resB := []byte(s) ...
bd08c6abc96524102ed74af140336d381d216712
d36ec89b4a665046976e343a152bd725653956f1
Hang91/word-memory
/manage.go
Go
go
2,783
no_license
package main import ( "encoding/json" "log" "net/http" "gopkg.in/mgo.v2/bson" ) func InsertWord(w http.ResponseWriter, r *http.Request) { var word Word decoder := json.NewDecoder(r.Body) err := decoder.Decode(&word) if err != nil { RespondWithError(w, http.StatusBadRequest, "Invalid request!") log.Printl...
63665c6b4905a3d2388cf3e13be2c9959f6f726b
c32ae15b403fa1dd17217acc50ebd63192c26fcf
johnpoth/camel-k
/pkg/util/log/util.go
Go
go
1,259
permissive
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this fi...
d0c1a5fb7cb621648685183c63db9c189279c8df
669d703b5177597e006cdedd9d24b941e1a142a9
jmoiron/euler.go
/031.go
Go
go
1,840
no_license
package main import "fmt" var values = []int{100, 50, 20, 10, 5, 2, 1} func main() { // there's only one way of making it exclusively with one coin of each // value, and we can't use £2 more than this one way, so we'll disregard counts := []int{0, 0, 0, 0, 0, 0, 200} length := len(values) pennies := length - 1...
08dfe4c6b5d458e6bdb8152f1c6c4107171ff672
ead6fa871028ae0b45c400bb1e8e5638603b008a
Insua/database-backup
/app/database/backup.go
Go
go
1,336
no_license
package database import ( "fmt" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/os/gfile" "github.com/gogf/gf/os/gproc" "github.com/gogf/gf/os/gtime" "os" ) func Backup(dir string, dbs []string) { for _, v := range dbs { db(dir, v) } } func db(dir, db string) { path := gfile.Join(dir, db) if err := gf...
1c6fbd8becfaa3b76515064662a549110a360095
1aa00db6c43253712bef9c39f4470411833bd4d2
ryanwalls/workflow-demo
/simulationworkflow/registrator.go
Go
go
3,677
no_license
package simulationworkflow import ( "github.com/3dsim/workflow/config" "github.com/3dsim/workflow/logger" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/swf" "github.com/aws/aws-sdk-go/service/swf/swfiface" ) var log = logger.Log.New("pkg", "simulationw...
7d7eabaf219f14efbbc6b665d2149019e8b0c884
c656741a3a1e3875860297445091652055b25336
liyuan462/bsvd
/txscript/standard.go
Go
go
19,283
permissive
// Copyright (c) 2013-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package txscript import ( "fmt" "github.com/bitcoinsv/bsvd/chaincfg" "github.com/bitcoinsv/bsvutil" ) const ( // MaxDataCarrierSize is the maximum number of bytes...
54d3cbfba0edd6bb4d92d9520bafe36b9b390198
5e51badb65437f6195f888714096c266dcabdf0c
Zygimantass/keep-ecdsa
/cmd/signing_ethereum_test.go
Go
go
4,542
permissive
//+build !celo package cmd import ( "fmt" "reflect" "testing" "github.com/ethereum/go-ethereum/common" "github.com/keep-network/keep-common/pkg/chain/ethereum/ethutil" ) // Signatures should match a signature format on mycrypto.com. A signing/verification // tool available on https://mycrypto.com/sign-and-veri...
081fff8e2444bb8c5a338bdec7d2b48638b1a001
0a9ff916471f98247447201a5754257cf65033a3
daudcanugerah/menekel
/app/cmd/http.go
Go
go
976
permissive
package cmd import ( "net/http" "time" "github.com/spf13/cobra" "github.com/golangid/menekel/article" "github.com/golangid/menekel/internal/database/mysql" delivery "github.com/golangid/menekel/internal/http" "github.com/golangid/menekel/internal/http/middleware" "github.com/labstack/echo/v4" "github.com/sp...
787b34b4a26e94a32c3ea2458f2944e9c051adba
945d0194ad4764fddd9891ec48252400b6288c56
kiyohara/docker_mqtt_client_go
/pub.go
Go
go
1,473
no_license
package main import ( "os" "fmt" "log" "time" "runtime" MQTT "git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git" ) var PUBLISH_CNT int = 1000000 var g_pub_counter int = 0 var g_start_time int64 = 0 var g_end_time int64 = 0 func Publish(client *MQTT.MqttClient, cnt int) error { topic := "m...
8e5bc4629aff152a1e755092168fa480eaa3f7bb
572eb451adc4b9d7105b84946997ffe98f97a9af
hishale/tidb
/executor/admin.go
Go
go
19,631
permissive
// Copyright 2018 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...
c8ddf93de6a1f26cefcddddbc4e91a28c247551f
27d2e5b73f9c2ea05ad238fe6050c2a476e9d357
bryankmorrow/fanal
/analyzer/config/toml/toml_test.go
Go
go
2,116
permissive
package toml import ( "io/ioutil" "testing" "github.com/open-policy-agent/conftest/parser/toml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/BryanKMorrow/fanal/analyzer" "github.com/BryanKMorrow/fanal/analyzer/config" "github.com/BryanKMorrow/fanal/types" ) func Tes...
5eed05c481d4000522c87db21d23c3429400690b
ba045e38f4377fa069fc939782c4c5e69cdfcef0
rcavenaghi/coherence-operator
/pkg/helm_test/host_ipc_test.go
Go
go
3,267
permissive
/* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ package helm_test import ( . "github.com/onsi/gomega" cohv1 "github.com/oracle/coherence-operator/pkg/apis/coherence/v1" "test...
f76f4a7f2811e5dd9c2f3c661a9bebe747cf3a58
b190a8c4f930f529a89f2cb5c3837fabbc63eff9
huangliangjun/vessel
/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet.go
Go
go
141,133
permissive
/* Copyright 2015 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
5abf759523b4ee48b1962a992dc3b657d972b4a9
155d98d9f69e5583d9c9fd1810937cd3b4169208
ipxchain/ipxchain
/scp/mock/simulation/rand_util.go
Go
go
3,341
no_license
package simulation import ( "math/big" "math/rand" "time" sdk "github.com/ipxchain/ipxchain/types" "github.com/ipxchain/ipxchain/scp/mock" ) const ( letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" letterIdxBits = 6 // 6 bits to represent a letter index letterIdxMask ...
d924126da77677bb56dd854d3a84e37ed08dea97
a40519545f9089da1987e56724087d12620e5402
aws-goformation/goformation
/cloudformation/kinesisanalyticsv2/aws-kinesisanalyticsv2-applicationreferencedatasource.go
Go
go
5,210
permissive
package kinesisanalyticsv2 import ( "bytes" "encoding/json" "fmt" "github.com/awslabs/goformation/v3/cloudformation/policies" ) // ApplicationReferenceDataSource AWS CloudFormation Resource (AWS::KinesisAnalyticsV2::ApplicationReferenceDataSource) // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserG...
c5c6d63f96aeba6a4144376a4ef4143f915a43c2
defbd6aeee3e5da9b6670592a0e1f44828555c1a
sohanlaxmicoin/go
/keypair/main_test.go
Go
go
3,037
permissive
package keypair import ( "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/onsi/gomega/types" ) func TestBuild(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Package: github.com/rover/go/keypair") } var ( address = "GBRPYHIL2CI3...
176c69b410c2881fe54fcf99952e6ff3fecfa56e
5829be0ce3cc28257d6c36efbd5b713656b088e2
secondsun/mcp-standalone
/pkg/openshift/authChecker_test.go
Go
go
5,696
permissive
package openshift import ( "bytes" "encoding/json" "errors" "fmt" "github.com/feedhenry/mcp-standalone/pkg/mobile" "github.com/feedhenry/mcp-standalone/pkg/mock" "io/ioutil" "net/http" "testing" ) var ( testHost = "test-host" testUser = &mobile.User{User: "Phil", Groups: []string{"group1", "group...
fa5bcbd74cf64f043e207e3c68b424292dee6ed3
f4514f44ebdf2246c2600ef812f6f04fd5689963
vipentti/pulumi
/sdk/go/pulumi/resource.go
Go
go
13,176
permissive
// Copyright 2016-2020, Pulumi Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
aef1cbde62c9ab93a775419ce9f3bc75356fead6
28fa1e5fb4a26f398f7126af1c98610ca08de60d
evsamsonov/go-learning
/algorithms/quicksort.go
Go
go
606
no_license
package main import ( "fmt" "math/rand" ) func main() { array := []int{2323, 432, 12, 534, 76, 0, 3, 500, 1} fmt.Println(quicksort(array)) } func quicksort(array []int) []int { if len(array) < 2 { return array } pivotIndex := rand.Intn(len(array)) pivot := array[pivotIndex] var less []int var greater [...
8b3a5c0878b5e95231dcc631d20313ba7ca4cefe
21be18919842c1bfb0d2043849b8b545d352e119
skycoin/cx-tracker
/vendor/github.com/skycoin/cx-chains/src/api/spend.go
Go
go
21,247
no_license
package api import ( "encoding/json" "errors" "fmt" "net/http" "strconv" "github.com/shopspring/decimal" "github.com/skycoin/skycoin/src/cipher" "github.com/skycoin/skycoin/src/util/droplet" "github.com/skycoin/skycoin/src/util/fee" wh "github.com/skycoin/skycoin/src/util/http" "github.com/skycoin/skycoi...
7d6f874db7d961e8843d735b9044992271041542
62662a1cb8c507b4a3263284228796541677a279
lei-cao/programming
/code/main.go
Go
go
589
no_license
package main import ( "github.com/gopherjs/gopherjs/js" v2 "github.com/lei-cao/programming/code/v2/play" v1 "github.com/lei-cao/programming/code/v1/visualizer" ) func main() { js.Global.Set("algorithm", map[string]interface{}{ "Algorithm": Algorithm, "Controller": Controller, "ControllerConfig...
32c887baa998f70e693bf97e3064180e81e05df8
6f2fef97e94bdd4ede11639300a488530ea8985a
ChordDict3/ChordDict3
/server.go
Go
go
8,595
no_license
package main import ( "fmt" "net" "encoding/json" "io/ioutil" "os" "github.com/HouzuoGuo/tiedot/db" "strconv" "time" "reflect" ) type Request struct{ Method string `json:"method"` Params interface{} `json:"params"` Id interface{} `json:"id"` } type Response struct{ Result interface{} `json:"result"` E...
f0bee1882ffa4c5260ca0505de6124f54b208c28
a121f5271592cefdb2a68038e3d1602f41a11e4c
ilyash-b/elvish
/pkg/eval/var_parse_test.go
Go
go
1,409
permissive
package eval_test import ( "testing" . "src.elv.sh/pkg/eval" "src.elv.sh/pkg/tt" ) var Args = tt.Args func TestSplitSigil(t *testing.T) { tt.Test(t, tt.Fn("SplitSigil", SplitSigil), tt.Table{ Args("").Rets("", ""), Args("x").Rets("", "x"), Args("@x").Rets("@", "x"), Args("a:b").Rets("", "a:b"), Args(...
213044ca2dd7720b9e59a2026448d4c974eb167b
35daf30b7218664411770d3d9689bd6f569aa540
XXMLP/goTestPerf
/src/pef/suite/suite.go
Go
go
687
no_license
package suite import ( "errors" "flag" "github.com/feiyuw/boomer" ) // SuiteMap is global suites map var SuiteMap = suiteMap{} // Suite is interface used by all test suite type Suite interface { Init(*flag.FlagSet, []string) error GetTask() *boomer.Task } type suiteMap map[string]Suite func (m suiteMap) Add(...
c127ef6fd3a4b5b68491d306a5c58c1a8b54bfeb
aa687e96b9505be34d2133b4b23377deee8a9521
Saruntaey/devcamper-go
/controllers/auth.go
Go
go
11,031
permissive
package controllers import ( "crypto/hmac" "crypto/sha256" "devcamper/models" "devcamper/utils" "encoding/hex" "encoding/json" "errors" "fmt" "net/http" "net/url" "os" "strings" "time" "github.com/julienschmidt/httprouter" "github.com/zebresel-com/mongodm" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) ...
57f0bac1128a1d3f480962f144bc1e8396305381
69f750fb68e738cef800dfb558337f380d6485f1
vishwesh96/Distributed-key-value-Store
/chord.go
Go
go
25,721
no_license
package kvstore import ( "bytes" "crypto/sha1" "errors" "hash" "log" "net" "net/http" "net/rpc" "time" "math/rand" "sync" "strconv" "os" ) type Config struct { HashFunc func() hash.Hash // Hash function to use StabilizeMin time.Duration // Minimum stabilization time StabilizeMax time.Duratio...
aabae0299161c6727d138929ebe1a9b24aa9bfe1
a7f1fc37240117b7c12efee6f2f1475988ac977d
birowo/llvm
/asm/term.go
Go
go
16,638
permissive
package asm import ( "fmt" "github.com/llir/ll/ast" "github.com/llir/llvm/ir" "github.com/llir/llvm/ir/types" "github.com/llir/llvm/ir/value" "github.com/pkg/errors" ) // === [ Create IR ] =========================================================== // newTerm returns a new IR terminator (without body but with...
a1c470d6c6eeb8818146ccba1cd47d9f15eb81a4
db1efc6fe30a0aeb13746970bb768f6320075b06
nikhil264/algo
/dfs/dfs.go
Go
go
720
no_license
package main import "fmt" func main() { var graph map[int][]int var parent map[int]int graph = make(map[int][]int) parent = make(map[int]int) graph[0] = []int{1, 2} graph[1] = []int{0, 3} graph[2] = []int{0} graph[3] = []int{1, 4, 5} graph[4] = []int{3, 5, 6} graph[5] = []int{3, 4, 6, 7} graph[6] = []int{4...
adcf56a67f6e63eaefd0183b2654437908341112
114ef3ca7ae9092ff2e29588350af46e82ceb74f
jiashaokun/gw
/pkg/admin/auth.go
Go
go
801
no_license
package admin import ( "gw/backend" "gw/library" "gw/response" "gw/util" "github.com/gin-gonic/gin" uuid "github.com/satori/go.uuid" "go.mongodb.org/mongo-driver/bson" ) //签名分配秘钥接口 func AddAuth(c *gin.Context) { var res, info backend.MongoAuth info.CreateTime = util.GetTime() info.UpdateTime = util.GetTim...
9393cf9ae4b16720b0a453862e493f21ac3f6869
6d80ad18ef754cdc78b32788798040e6b1ac2dbd
solate/util
/go/gofile/file.go
Go
go
1,497
permissive
package gofile import ( "bufio" "io/ioutil" "os" ) //文件是否存在 //fileName 文件名 func IsExistFile(fileName string) (is bool) { // 文件不存在则返回error _, err := os.Stat(fileName) is = os.IsExist(err) return } //将内容写入文件中,带缓存 //fileName 文件名 //data 写入数据 func WriteFile(fileName, data string) (err error) { // 可写方式打开文件, 每次都清空后...
497ad1539d89a748a146215df81aaccf6780bc02
180b2221612c0d93936573e66a6cfd7ffe538387
stjordanis/cilium
/pkg/fqdn/dnsproxy/proxy_test.go
Go
go
48,743
permissive
// SPDX-License-Identifier: Apache-2.0 // Copyright Authors of Cilium //go:build privileged_tests // +build privileged_tests package dnsproxy import ( "bytes" "context" "encoding/json" "fmt" "io/ioutil" "net" "runtime" "sync" "testing" "time" "github.com/miekg/dns" . "gopkg.in/check.v1" "sigs.k8s.io/ya...
d278f8fdbb833aa803ec70b73b7786e3488ecdc0
839db530caed1f9b9b2c2b498d65b5c14758c040
double12gzh/core
/cluster/calcium/node_test.go
Go
go
10,655
permissive
package calcium import ( "context" "fmt" "testing" "time" "github.com/projecteru2/core/engine/factory" enginemocks "github.com/projecteru2/core/engine/mocks" enginetypes "github.com/projecteru2/core/engine/types" lockmocks "github.com/projecteru2/core/lock/mocks" resourcemocks "github.com/projecteru2/core/re...
9f02f02710d67c2429f1e968d187c13360082e09
3f5b1a052d108555629eafefa8349e4f5d995041
searKing/opentelemetry-go-contrib
/instrumentation/github.com/Shopify/sarama/otelsarama/version.go
Go
go
944
permissive
// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
ed1520e1e0b0f15c8c00929ae0a213ba60f9a10f
7a31145fc15993fbe6ea1cdffef9b014f0bf48f0
changebooks/httpx
/remark.go
Go
go
1,986
permissive
package httpx import ( "github.com/changebooks/http" http2 "net/http" "net/url" "time" ) type Remark struct { Scheme string `json:"scheme"` Proto string `json:"proto"` Host string `json:"host"` Path string `json:"path"` Method string `json:"method"` Header ...
b6a0c1da43449d12cb0d8c279826f4bdb635029b
e4730e064f534289a32b7673e616c3762a598cb1
z-wenlin/009-class01
/Week_04/ladder.go
Go
go
1,792
no_license
package Week_04 import "math" func findLadders(beginWord string, endWord string, wordList []string) [][]string { ids := map[string]int{} for i, word := range wordList { ids[word] = i } if _, ok := ids[beginWord]; !ok { wordList = append(wordList, beginWord) ids[beginWord] = len...
bb1d634e7b537d48716577f05ef699a97d813f42
34e00487629fa63abbf8125265c0e360e2ea2b45
timchunght/go-http-hijack-client
/main.go
Go
go
1,631
no_license
package main import ( "crypto/tls" "fmt" "io" "log" "net" "net/http" "net/http/httputil" "net/url" "os" "strings" ) func main() { if len(os.Args) < 3 { log.Fatalln("usage:", os.Args[0], "<url> <token>") } rawURL := os.Args[1] token := os.Args[2] url, err := url.Parse(rawURL) if err != nil { log.F...
bddbf735c3cb52994191ea99dd7d65c8190f6aa5
b22bb60606c48c29cdeaffa8f36798df07a1c779
danielpuglisi/s3-sync
/main.go
Go
go
688
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 or ...
3e0f60e495f3d171751769a97707ddb92bbc274b
a04e7e57218da1ed91e8a18534980e4285bde8a6
kelvinoenning/go-wails-cpu
/pkg/sys/sys.go
Go
go
894
permissive
package sys import ( "time" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/mem" "github.com/wailsapp/wails" ) type Stats struct { log *wails.CustomLogger } type Machine struct { CPUPercent int `json:"cpuPercent"` MemPercent int `json:"memPercent"` } func (s *Stats) WailsInit(runtime *wails.Run...
133bbe7e518dde99b3275062f5bf09419f7bb6cd
ecd9f7fe0169883435f09f57adcf057bc543aac3
qiniu/logkit
/vendor/gopkg.in/olivere/elastic.v3/search_queries_regexp.go
Go
go
2,188
permissive
// Copyright 2012-2015 Oliver Eilhard. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic // RegexpQuery allows you to use regular expression term queries. // // For more details, see // https://www.elastic.co/gu...