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
cd78c9f01666b94d4b77a75633ed13c7b6540964
fa58a9cba659c3d15b7612109dfe4681f99b21fe
poveraccio/goose
/tests/e2e/migrations_test.go
Go
go
8,143
permissive
package e2e import ( "database/sql" "errors" "fmt" "path/filepath" "reflect" "testing" "github.com/pressly/goose/v3" "github.com/pressly/goose/v3/internal/check" ) func TestMigrateUpWithReset(t *testing.T) { t.Parallel() db, err := newDockerDB(t) check.NoError(t, err) goose.SetDialect(*dialect) migrati...
4940e321dbcb28e76de8bde25da5b6d31596f351
e22d0ca4146ad79221aca7e8b8bcc47d9d2812c5
vaguilera/advent2020
/23/01/main.go
Go
go
1,640
no_license
package main import ( "fmt" ) var totalcount int var initData = []int{6, 4, 3, 7, 1, 9, 2, 5, 8} const MINVALUE = 1 const MAXVALUE = 9 func main() { init := 6 initData := removeStep1(initData, init) for i := 0; i < 99; i++ { pos := (findPos(initData, init) + 1) % len(initData) init = initData[pos] init...
0569c929e370d79eaec1a0cc878f93b247f268bd
723e89348f2dfb3e2e0839d6df6847880c9340fa
voxadam/rulio
/core/state_indexed.go
Go
go
19,472
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 b...
3bf76ea2edfb9e444910b052d6c4beb6fed44927
48625a56f7973cb46252a52445f49882f132dc96
roberts126/libretro-chtfix
/main.go
Go
go
3,992
permissive
package main import ( "bufio" "flag" "fmt" "io/ioutil" "os" "path/filepath" "strings" ) const ( cheatExtension = ".cht" fixedFileSuffix = "_fixed" keyDesc = "desc" keyCode = "code" keyEnable = "enable" ) type ( Cheat struct { Desc string Code string Enable bool } ) fun...
509184cfdafde922fde1095d51026c7f005fcc9e
45dc1274682edb82c2e7543f9a1f0b413bdd2820
vinlnx/mmark
/render/markdown/include.go
Go
go
814
permissive
package markdown import "github.com/mmarkdown/mmark/mparser" // Almost wholesale copy of parser/include.go - might make sense to make some of that public. func isInclude(data []byte) int { i := 0 if data[i] != '{' || data[i+1] != '{' { return 0 } // find the end delimiter i = mparser.SkipUntilChar(data, i, '}...
c3f297a96b74dca7ba3709eaab8f826da8fa073c
bf26ce00f6a6958dd76375b83fb24c52ba035ee3
aws/aws-sdk-go-v2
/service/internal/integrationtest/sfn/smoke_test.go
Go
go
672
permissive
//go:build integration // +build integration package sfn import ( "context" "testing" "time" "github.com/aws/aws-sdk-go-v2/service/internal/integrationtest" "github.com/aws/aws-sdk-go-v2/service/sfn" ) func TestInteg_00_ListActivities(t *testing.T) { ctx, cancelFn := context.WithTimeout(context.Background(), ...
a652c9dbb92b83ddde68a39b9c22678e30d6a825
7563aa4ee683bf257a59229d1980af87b9faf092
konser/go-pack
/github.com/idealeak/goserver/core/utils/panic.go
Go
go
1,824
permissive
package utils import ( "runtime" "encoding/json" "fmt" "github.com/idealeak/goserver/core/logger" "sync" "sync/atomic" "time" ) var _panicStackMgr = &PanicStackMgr{ items: make(map[string]*PanicStackInfo), } type PanicStackMgr struct { sync.RWMutex items map[string]*PanicStackInfo } type PanicStackInfo s...
31adcdf93f9adf1180fe2cdc733cbfcb81729111
355890ecd26891850029f2c263d25badbc1267fa
joskid/weaviate
/adapters/repos/db/vector/hnsw/config_test.go
Go
go
4,212
permissive
// _ _ // __ _____ __ ___ ___ __ _| |_ ___ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ // \ V V / __/ (_| |\ V /| | (_| | || __/ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| // // Copyright © 2016 - 2021 SeMI Technologies B.V. All rights reserved. // // CONTACT: hello@s...
38a7bc2af46a0611644f68d54c06554a0f962f76
25458f68512d378fb921802658d2e4580ea946e6
lpflpf/go-study
/src/dang/ch1/test_9.go
Go
go
457
no_license
package main import ( "fmt" "net/http" "os" ) func main(){ for _, url := range os.Args[1:] { resp, err := http.Get(url) if err != nil { fmt.Fprintf(os.Stderr, "fetch: %v\n", err); os.Exit(1) } fmt.Printf("%s\t%s\n", url, resp.Status) //b, err := ioutil.ReadAll(resp.Body) resp.Body.Close() //...
80e93166c293af2e689d0a27fe06c2a7ffa0ac51
073d37b081fc70530a6195d66ac39c5e6fc2a637
viannaandreBR/cli
/cf/commands/user/space_users_test.go
Go
go
12,178
permissive
package user_test import ( "errors" "code.cloudfoundry.org/cli/cf/api/apifakes" "code.cloudfoundry.org/cli/cf/api/spaces/spacesfakes" "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/cli/cf/requir...
9267f3d66f5030e8cc15391cd2094d1ac72c4622
b56550d0d4713bd485aa16249ac68039b2ff3825
openshift/cloud-credential-operator
/pkg/ibmcloud/client.go
Go
go
4,985
permissive
package ibmcloud import ( "fmt" "github.com/IBM/go-sdk-core/v5/core" identityv1 "github.com/IBM/platform-services-go-sdk/iamidentityv1" pmv1 "github.com/IBM/platform-services-go-sdk/iampolicymanagementv1" "github.com/IBM/platform-services-go-sdk/resourcemanagerv2" ) //go:generate mockgen -source=./client.go -de...
11f6866996cb58d9ffee68ca800d772fe6968835
c2f23ff2875c5e7f48dd709177961ebc27ec4e08
honorforlee/golang-book-exercises
/chapter7/q4_make_odd_generator.go
Go
go
329
no_license
package main import "fmt" func makeOddGenerator() func() uint { i := uint(1) return func() (ret uint) { ret = i i += 2 return } } func main() { nextOdd := makeOddGenerator() fmt.Println(nextOdd()) // 1 fmt.Println(nextOdd()) // 3 fmt.Println(nextOdd()) ...
6b3f55387f6c7f7f268c5abece6962aa96662eca
888483e7687f7f18ba18c30f7da1aead621e5e97
redspread/localkube
/vendor/github.com/opencontainers/runc/libcontainer/seccomp/seccomp_unsupported.go
Go
go
472
permissive
// +build !linux !cgo !seccomp package seccomp import ( "errors" "github.com/opencontainers/runc/libcontainer/configs" ) var ErrSeccompNotEnabled = errors.New("seccomp: config provided but seccomp not supported") // Seccomp not supported, do nothing func InitSeccomp(config *configs.Seccomp) error { if config !=...
ff811cc09c189491276e79490bdbe332b2bb35c6
da3c9c95cc3be4d721adf5db01d63f1d9db6a142
RTradeLtd/go-ipfs-plugin-i2p-gateway
/vendor/gx/ipfs/QmcxL9MDzSU5Mj1GcWZD8CXkAFuJXjdbjotZ93o371bKSf/go-msgio/msgio/msgio.go
Go
go
1,627
permissive
package main import ( "flag" "fmt" "io" "io/ioutil" "os" "strconv" "strings" msgio "gx/ipfs/QmcxL9MDzSU5Mj1GcWZD8CXkAFuJXjdbjotZ93o371bKSf/go-msgio" ) var Args ArgType type ArgType struct { Command string Args []string } func (a *ArgType) Arg(i int) string { n := i + 1 if len(a.Args) < n { die(fmt...
766082d395a25195ab75ed5e3a836473bfbf7387
30130ac9b7a5b34333e8d508faed3a1f556218ac
as/torgo
/vendor/github.com/as/mute/mute.go
Go
go
485
permissive
// This package was created before "flags" had an option for this package mute import ( "os" "flag" ) // Parse silences the noisy flag package Parse() methods // instead returning errors properly via the error variable func Parse(f *flag.FlagSet, a []string) error { n, err := os.Open(os.DevNull) if err != nil { ...
eb68160aa995d040780ecea2e11ee4b28265adb1
2551af79a6afc5c3ef22101764f4b28cf9181110
dillonchen001/leetcode
/52_totalNQueens.go
Go
go
429
no_license
package main import "fmt" func main() { n := 4 fmt.Println(totalNQueens(n)) } func totalNQueens(n int) int { var ret int dfs(n, 0, 0, 0, 0, &ret) return ret } func dfs(n, row, col, ld, rd int, ret *int) { if row >= n { *ret++ return } var pick int bits := ^(col | ld | rd) & ((1 << n) - 1) for bits > ...
f88338811aa0c8d834995077be78e499719dc31f
40753b61aea527f73933d9edfccc18e4771f7272
mirdhyn/terraform-provider-kops
/pkg/schemas/kops/DataSource_WarmPoolSpec.generated_test.go
Go
go
3,490
permissive
package schemas import ( "testing" "github.com/google/go-cmp/cmp" "k8s.io/kops/pkg/apis/kops" ) func TestExpandDataSourceWarmPoolSpec(t *testing.T) { _default := kops.WarmPoolSpec{} type args struct { in map[string]interface{} } tests := []struct { name string args args want kops.WarmPoolSpec }{ { ...
04fe649840491d9b1250f743e4640183225681e0
2149cc92e9716c0ded07cb8f627f1389b46a6bd4
vaibhavmalave1994/chessboard
/chess/queen.go
Go
go
434
no_license
package chess type Queen struct{ Name string Position *Position } func SetQueen(name string, position string) *Queen{ if name == "" || position == ""{ return nil } return &Queen{Name : name, Position: getPositionCoordinates(position)} } func(queen *Queen)PredictMoves()[]string{ rules := &Rule{Step:8, Direct...
7a4cc5f11d387977f964c17fa274c7fdbf21d064
036a4ce6ff9df9c1b660fa4ee2b262da20dd7e70
flands/cortex
/pkg/querier/remote_read.go
Go
go
2,758
permissive
package querier import ( "net/http" "github.com/go-kit/kit/log/level" "github.com/prometheus/prometheus/storage" "github.com/cortexproject/cortex/pkg/ingester/client" "github.com/cortexproject/cortex/pkg/util" ) // Queries are a set of matchers with time ranges - should not get into megabytes const maxRemoteRe...
c2162800f8ad12b2c8571bd951de7941e1e2ffff
c38fd731d748cbc2df0ae91f92bc305d2b402061
willshang/go-leetcode
/source/offer/面试题14-I_剪绳子/1-动态规划.go
Go
go
431
no_license
package main import "fmt" func main() { fmt.Println(cuttingRope(10)) } func cuttingRope(n int) int { if n < 2 { return 0 } if n == 2 { return 1 } if n == 3 { return 2 } dp := make([]int, n+1) dp[0] = 0 dp[1] = 1 dp[2] = 2 dp[3] = 3 for i := 4; i <= n; i++ { max := 0 for j := 1; j <= i/2; j++ {...
1f55b6f36df35130e2ae57e137b613a7bc573175
7470aa6f4c49920b89074dfc309e4681dff998a2
mthaler/algorithms
/search/binarysearch.go
Go
go
436
permissive
package search func BinarySearch(a []interface{}, comp func(interface{}) int) int { return binarySearch(a, 0, len(a) - 1, comp) } func binarySearch(a []interface{}, l, r int, comp func(interface{}) int) int { if (r >= l) { m := l + (r-l)/2 c := comp(a[m]) if c == 0 { return m } else if c > 0 { return ...
3da4523a18a3f42855a557ebfc4b75be9fccdcf6
d5ec3905adfc97f5ca490e4574ac86883c249822
maxdrib/eks-distro-build-tooling
/release/pkg/assets_registrar.go
Go
go
1,849
permissive
// Copyright Amazon.com Inc. or its affiliates. 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 req...
5126b6c4015555cd9b858d1843b1f2e9f6be6f7b
158186618ff318182ccf77ffff2683241b5839a3
betorvs/sensubot
/usecase/botrequest_usecase_test.go
Go
go
2,459
permissive
package usecase import ( "testing" "github.com/stretchr/testify/assert" ) func TestParseRequest(t *testing.T) { // verb specialWord|resource resouce|name specialWord namespace_name specialWord entity_name var validData1 = string("get checks") config1 := parseRequest(validData1) assert.Equal(t, "get", config1[...
a8efb167a0531bdce403b8a684225e53d6e4ecce
ec91a7f4a2c38c7bd26688aeeea55492439a8cb6
EricZ11/lotus
/cmd/lotus-storage-miner/main.go
Go
go
1,668
permissive
package main import ( "os" logging "github.com/ipfs/go-log/v2" "go.opencensus.io/trace" "gopkg.in/urfave/cli.v2" "github.com/filecoin-project/lotus/build" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/lib/lotuslog" "github.com/filecoin-project/lotus/node/repo" "github.com/f...
c9e16a2a340fc5f66810e22703b699dd5f0a84ec
bcf5844f21bb8d907b480f591a047603398e89e6
bmkessler/grpc-graphql-gateway
/protoc-gen-graphql/spec/package.go
Go
go
1,176
permissive
package spec import ( "path/filepath" "strings" "github.com/iancoleman/strcase" ) const ( mainPackage = "main" ) type PackageGetter interface { Package() string GoPackage() string Filename() string } type Package struct { Name string CamelName string Path string } func NewPackage(g PackageGett...
0ec60a4680d3b3d871b66525d178bdc431ece1d5
337d8ce8fb78f6cfe68350daf12b0da1a966b1bd
ipfs/kubo
/core/commands/dag/export.go
Go
go
3,615
permissive
package dagcmd import ( "context" "errors" "fmt" "io" "os" "time" "github.com/cheggaaa/pb" iface "github.com/ipfs/boxo/coreiface" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" "github.com/ipfs/kubo/core/commands/cmdenv" cmds "github.com/ipfs/...
f52e7aac04d21fcfe0c4d447d7efe4979c73239c
f79648da482f5ca9bcc5a1f58c29a6a49565ac37
shanbumin/go-gin
/xinliangnote/ginDemo2/middleware/sign/sign.go
Go
go
1,755
no_license
package sign import ( "github.com/gin-gonic/gin" "github.com/pkg/errors" . "go-gin/xinliangnote/ginDemo2/common/function" "go-gin/xinliangnote/ginDemo2/config" "go-gin/xinliangnote/ginDemo2/entity" "net/http" "net/url" "strconv" "time" ) func Sign() gin.HandlerFunc { return func(c *gin.Context) { res := e...
29b4729902f311011b5daf8fdbaec3fedee2e069
2fe078ab337fe7f48d268e66435131cee4b90dc8
spooktheducks/file-permutator
/main.go
Go
go
2,550
no_license
package main import ( "fmt" "io" "os" "path/filepath" ) var ( outputDir = "output" fileExtension = ".txt" outputFileExtension = ".7z" ) var MAX_FILES = 1024 var fileSemaphore = make(chan bool, MAX_FILES) func main() { files, err := filepath.Glob("data/*" + fileExtension) if err != nil { p...
df2833d5e8bec65db6c9fdb87748844805e3bdad
a5a13663f5f2f079f5b4f9e86f33b279e05b32ee
mkrautz/grumble
/cmd/grumble/server.go
Go
go
38,654
no_license
// Copyright (c) 2010-2011 The Grumble Authors // The use of this source code is goverened by a BSD-style // license that can be found in the LICENSE-file. package main import ( "bufio" "bytes" "crypto/rand" "crypto/sha1" "crypto/tls" "encoding/binary" "encoding/hex" "errors" "fmt" "github.com/golang/protob...
234449d23d95c65e8a814711936cfdb806c29b3a
7245a77b604aa07f0caa4ab7dfc60acb1aa3f67f
samdsk/lab-go
/181105/Triangolo.go
Go
go
429
permissive
// sl-lab.it:11778 // sdid307-050-49:11778 /* Scrivere un programma che legge un intero positivo n e stampa un triangolo di asterischi di cateto n. caricare su upload.di.unimi.it * ** *** **** ***** */ package main import "fmt" func main() { var n int fmt.Print("Inserire la lunghezza del cateto: ") fmt.Sc...
16a99c8aee29afc0b56e5fa8389f56c2133cf166
9f98781b8b9a1adeeb67772830c94123ef4fc827
WeBankPartners/open-monitor
/monitor-server/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go
Go
go
8,034
permissive
package vm_color_indent import ( "encoding/json" "fmt" "unsafe" "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/runtime" ) const uintptrSize = 4 << (^uintptr(0) >> 63) var ( appendIndent = encoder.AppendIndent appendStructEnd = encoder.AppendStructEndIndent errUnsup...
b3b26a33583ca062cb1503305aa2c3fb343e4210
5ca960ca661dba06b8908b6f88773869c3d41ffa
igsilya/ovn-kubernetes
/go-controller/pkg/ovn/egressfirewall.go
Go
go
23,621
permissive
package ovn import ( "fmt" "net" "strings" "sync" "github.com/pkg/errors" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" egressfirewallapi "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/crd/egressfirewall/v1" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdbops" "github.com/o...
82bfc2bc622af6b2f8655677eb008aee5b29703e
8236d11da48de3176d87f00b040db284d9489a23
Wlademon/vkBot
/file/cache/Cache.go
Go
go
1,856
no_license
package cache import ( "encoding/base64" "path/filepath" "strconv" "strings" defTime "time" "github.com/Wlademon/vkBot/time" fileB "github.com/Wlademon/vkBot/file" ) const CACHE_SEP = "|" var dirCache = "" func InitCache(dir string) { dirCache = dir } type CacheFile struct { Key string Value string ...
107d5d65dbe20615ea8e41b4d662d85f00259c18
acdb02858e594c919ccc8ade76cbc533a011ea9b
amimof/cri-o
/oci/oci_linux.go
Go
go
4,979
permissive
// +build linux package oci import ( "fmt" "os" "path/filepath" "strings" "syscall" "time" "github.com/containerd/cgroups" "github.com/cri-o/cri-o/utils" "github.com/opencontainers/runc/libcontainer" rspec "github.com/opencontainers/runtime-spec/specs-go" "github.com/sirupsen/logrus" "golang.org/x/sys/un...
6f4d9cdfe4c5a55a50b507fd5d3491b6e4d6f9e3
b1b617ed6a6a07bc069c04aac621c1430d27974d
temple-deng/leetcode
/problem-347/main.go
Go
go
2,293
permissive
// leetcode problem 347 // Top K Frequent Elements package main import ( "fmt" ) type HeapNode struct { Num int Fre int } func topKFrequent(nums []int, k int) []int { freMap := make(map[int]int) length := len(nums) for i := 0; i < length; i++ { freMap[nums[i]]++ } nodes := []HeapNode{} ...
44c9ae76a520bd4657560a4e114b2bb3360351e1
0eeaaf1a83ffc9d63ffca54962ec8c30ae31c86e
nya3jp/tast
/src/chromiumos/tast/cmd/tast/run_wrapper_test.go
Go
go
1,253
permissive
// Copyright 2018 The Chromium OS 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 main import ( "context" "chromiumos/tast/cmd/tast/internal/run" ) // stubRunWrapper is a stub implementation of runWrapper used for testin...
19b378b2f219ec58d2d533b9c315e9953b5a1fd0
b5a52707894a39712a3d7bb89f6b46c4bfcef183
aveTakashi/jaeger-operator
/pkg/strategy/streaming.go
Go
go
9,530
permissive
package strategy import ( "context" "fmt" "strings" batchv1beta1 "k8s.io/api/batch/v1beta1" "github.com/spf13/viper" "go.opentelemetry.io/otel/global" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "github.com/jaegertracing/jaeger-operator/pkg/account" v1 "github.com/jaegertracing/jaeger-operator...
5074c936d344d44b7f08d6ec200b947a3f7531be
a7f81df1cc37dc9647e1bbed416868c7e56c1b3f
PetrusHahol/terraform-provider-contrail
/contrail/resources/virtual_ip.go
Go
go
19,122
permissive
// // Automatically generated. DO NOT EDIT. // (Object) // package resources import ( "fmt" "log" "strings" "github.com/Juniper/contrail-go-api" "github.com/davecgh/go-spew/spew" "github.com/hashicorp/terraform/helper/schema" ) var _ = spew.Dump // Avoid import errors if not used func SetVirtualIpFromResourc...
91dd74179041cb14ed333537b36f64975a8a955d
7852a8781404640dc810381a33042d76d4ee3d98
letubert/service-training
/07-logging/cmd/sales-admin/main.go
Go
go
1,973
permissive
package main import ( "encoding/json" "flag" "fmt" "os" "github.com/kelseyhightower/envconfig" "github.com/pkg/errors" "github.com/ardanlabs/service-training/07-logging/internal/platform/database" "github.com/ardanlabs/service-training/07-logging/internal/platform/log" "github.com/ardanlabs/service-training...
4ea21e15c5cb0d17f57a6ce7024bbc17ed7eeced
17af682aa9e21882943746bbeec64e5bda412f36
thuynt707/cue
/internal/internal.go
Go
go
4,979
permissive
// Copyright 2018 The CUE 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...
14ccaea709927cf7201ab6f426d721d3875567af
ee88970c92a090304e6f797ba9ecdd92e5558740
dikPtra/bimbel-golang
/matapena.go/main.go
Go
go
2,704
no_license
package main import ( "app/etc/router" "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" "github.com/spf13/viper" "os" ) func main() { args := os.Args[1:] if len(args) == 1 { if args[0] == "-h" { cmdH() } else if args[0] == "-start" { cmdSt...
82e8e509596fe23f9efe701549215f68efdb19e7
961619072a5325d95a959bfae3b8359b5f406660
mrsrvman/orazabbix
/orametrics/ora.go
Go
go
11,392
permissive
package orametrics import ( "database/sql" "encoding/json" "fmt" "strconv" "time" "github.com/golang/glog" _ "github.com/mattn/go-oci8" //_ "gopkg.in/rana/ora.v4" "strings" "os" "io/ioutil" ) type tsBytes struct { Ts string `json:"TS"` Bytes string `json:"bytes"` } type diskgroups struct { Dg ...
9996d6a397700159fdad0eb1679679c5033260c5
0aea847f36863fb0074a229c4619935ad5da1b42
AaronFlower/All-About-Go
/go-tour/07.2.json/main.go
Go
go
1,297
no_license
package main import ( "encoding/json" "fmt" "io/ioutil" "os" ) // Server defines a server struct. type Server struct { ServerName string `json:"serverName"` ServerIP string `json:"serverIP"` } // Serverslice stores a bucket of servers type Serverslice struct { Servers []Server `json:"servers"` } func parse...
151eb35fff7daf15cf85d666279fbda6db0203cb
d99a96fa0086c3485e61b3241fc820735945a37d
Kalladin/traceExample
/entryServer/vendor/src/github.com/DroiTaipei/jaeger-client-go/zipkin_thrift_span_test.go
Go
go
9,896
permissive
// Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge...
70ac67b5ab053a66bc9f0181ef3588227ab5a719
1fb0b08e4945c3c303439e972717cc5f4ca1db5d
gholib/bank
/pkg/types/types.go
Go
go
815
no_license
package types //Money type Money int64 //Category type Category string //Currency currency code type Currency string //currency codes const ( TJS Currency = "TJS" RUB Currency = "RUB" USD Currency = "USD" ) //PAN card number type PAN string //Card payments card type Card struct { ID int PAN PA...
97c3772049666b898b4650c723bc9e3808b0ace2
c7f9fcad7e102fdf4e6ae90baa0374d7eac8d5e6
leosnow99/algorithrm
/algorithrm/bit/odd_times.go
Go
go
1,432
no_license
package bit /** 在其他数都出现偶数次的数组中找到出现奇数次的数 【题目】 给定一个整型数组arr,其中只有一个数出现了奇数次,其他的数都出现了偶数次,打印这 个数。 进阶问题:有两个数出现了奇数次,其他的数都出现了偶数次,打印这两个数。 【要求】 时间复杂度为O(N),额外空间复杂度为O(1)。 */ func printOddNum(arr []int) int { eO := 0 for _, num := range arr { eO ^= num } return eO } // 如果只有A 和B 出现了奇数次,那么最后的异或结果eO 就是A^B。所以,如果数组中有 // 两个出现了奇数次的...
c83f40ab9575848c1b9902b1230fb1eb1c0bffbf
b3ea0ae2d14a3f0a279cad3eeacad85f1216d293
astonix/lorawan-stack
/pkg/networkserver/errors.go
Go
go
5,298
permissive
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Un...
c3a510be896b32d0b8881c6f20547fbacda4cf7a
285adc244252aaceb438423f6f47af7a20847e1b
RachidP/hackerrank.com
/The Time in Words/main.go
Go
go
1,904
no_license
package main import ( "bufio" "fmt" "io" "os" "strconv" "strings" ) const ( oClock = " o' clock" to = " to " past = " past " minute = " minute" minutes = " minutes" ) var numbers = []string{"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven"...
147c209aa0d951acb0871af7834a5e042055fbd4
e367d3e8d208bb9863647206b15490fd82f8fb58
HappyTobi/autopilot
/vendor/code.cloudfoundry.org/cli/api/uaa/wrapper/request_logger.go
Go
go
3,845
permissive
package wrapper import ( "bytes" "io/ioutil" "net/http" "sort" "time" "code.cloudfoundry.org/cli/api/uaa" ) //go:generate counterfeiter . RequestLoggerOutput // RequestLoggerOutput is the interface for displaying logs type RequestLoggerOutput interface { DisplayBody(body []byte) error DisplayJSONBody(body [...
c1efc32ecf87cc619e0e52cfd7c9d067bde41112
3a61911af82250e2dceb4f7b58af522d5d10a0f2
avbalu/go-ipfs
/p2p/net/conn/interface.go
Go
go
2,513
permissive
package conn import ( "io" "net" "time" key "github.com/ipfs/go-ipfs/blocks/key" ic "github.com/ipfs/go-ipfs/p2p/crypto" filter "github.com/ipfs/go-ipfs/p2p/net/filter" peer "github.com/ipfs/go-ipfs/p2p/peer" msgio "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-msgio" ma "github.com/ipf...
297b89ec7f4af21630b3883276135dbdf3bce088
96c1e3086b3bbbb68cfd061ef0672789cc4353e2
tencentyun/tcecloud-sdk-go
/tcecloud/cloudaudit/v20190304/client.go
Go
go
2,105
permissive
// All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing...
463819a7b2ffdc8629a4dd33fe27745d2d015dae
b725cf96059cc157bbf09ffdae004436cf8a7990
Tumao727/gitea
/services/auth/source/oauth2/providers_openid.go
Go
go
1,618
permissive
// Copyright 2021 The Gitea 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 oauth2 import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "github.com/markbates/goth" "github.com/markbates/goth/...
7f86eafca0bef0a2e09e08e3a979953379e4ba3e
808fdf2f94e128a5bd0aa2dafcdd532518172751
HashCash-Consultants/go
/services/ticker/cmd/generate.go
Go
go
2,175
permissive
package cmd import ( "context" "github.com/lib/pq" "github.com/spf13/cobra" ticker "github.com/hcnet/go/services/ticker/internal" "github.com/hcnet/go/services/ticker/internal/tickerdb" ) var MarketsOutFile string var AssetsOutFile string func init() { rootCmd.AddCommand(cmdGenerate) cmdGenerate.AddCommand(c...
0201cfd9ef8470e6dc315d2ef72695f4d4dad5a9
95bdf0b4a6a2e0ef7e2e35391a6f8bc76a3dab35
openshift/csi-external-snapshotter
/pkg/common-controller/framework_test.go
Go
go
60,637
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, ...
b1e8bffec8c357d22b560af436d56b0f5c77edb9
84938a566231d80dbeb3b77af15528bb26f3d713
fredrik01/ts
/ts.go
Go
go
11,538
no_license
package main import ( "flag" "fmt" "log" "os" "os/exec" "sort" "strings" "time" "github.com/fredrik01/ts/src/csv" "github.com/fredrik01/ts/src/storage" "github.com/fredrik01/ts/src/timezone" ) const ( version = "0.9.2" layoutDateTime = "2006-01-02 15:04:05" minNameColumnWidth = 6 ...
521b3923aa7c2a8faaa65f6a90087c7a54a95601
aeb33b675949b45dd9e04db5bb976c45a47a75aa
Dimple-Kanwar/finalInsurance
/artifacts/src/github.com/chaincodes/Users/Users.go
Go
go
16,660
no_license
package main import ( "bytes" "encoding/json" "fmt" "strconv" "strings" "github.com/hyperledger/fabric/core/chaincode/shim" sc "github.com/hyperledger/fabric/protos/peer" ) //============================================================================================================================== // Users...
94b9aa2122a01dcdb5c9ad8afc9e72fc258a9fdc
7dcaa5c5dec78ae438cf81dd130780782bdf2372
schwarzeni/go-container-network-survey
/container/container_info.go
Go
go
528
no_license
package container import "fmt" // Info 容器信息 type Info struct { ID string // 容器 ID PortMapping []string // 容器端口映射 host_port:container_port Port string // 服务器监听的端口 IP string // 服务器分配到的IP PID string // 容器进程的 ID } func (containerInfo Info) String() string { return fmt.Sprin...
706093e5953b5d9b5a27e0e37236b113fbb95aa3
62d80dfa4dbe9e7f73f8c71d6896ceb2c7d6c077
wheaton5/martian
/martian/core/mrt.go
Go
go
10,154
permissive
// Copyright (c) 2016 10X Genomics, Inc. All rights reserved. package core // Support methods for mrt. Unfortunately, at least for now they need to be in // the core package because they do strange and unnatural things to pipestance // private internals. import ( "errors" "fmt" "io/ioutil" "os" "github.com/ma...
1223810a536278caa8370de2e9610f8e2e1df6c3
60a127373d8f1f9d18c90881a1ceca0ef4779c71
cphrmky/utils
/http/transport/tls/tls.go
Go
go
821
no_license
package tls_transport import ( "crypto/tls" "crypto/x509" "errors" "github.com/cphrmky/utils/http/transport" "net/http" ) func New(caCert, clientCert, clientKey []byte) (*http.Transport, error) { tlsConfig, err := newTLSConfig(caCert, clientCert, clientKey) if err != nil { return nil, err } transport := h...
df8def39473e0ad9543b0681e95a34ccecb9fe8c
c1c444abaa5aa38855870823f8a911b162182e77
ctrees/provision
/backend/dhcpUtils_test.go
Go
go
10,814
permissive
package backend import ( "net" "testing" "time" "github.com/digitalrebar/provision/models" ) type ltf struct { msg string strat, token string req net.IP found, err bool } func (l *ltf) find(t *testing.T, dt *DataTracker) { res, _, _, err := FindLease(dt, l.strat, l.token, l.req) if l.f...
b65f2e955fa50026e6a1354ecd8d6c83110da4f8
bae7003b6c7455474452c91c6e45d63f61c7a697
AmundsenJunior/how-to-go
/section_13/exercise_01.go
Go
go
900
permissive
/* Create your own type “person” which will have an underlying type of “struct” so that it can store the following data: first name last name favorite ice cream flavors Create two VALUES of TYPE person. Print out the values, ranging over the elements in the slice which stores the favorite flavors. solution:...
20d4ad807e94d4073f20ba021c3eefe0ba46e8fc
a7d71d30f79ae65767138be5eede8869ab4e9e65
ctripcloud/cilium
/daemon/cmd/loadbalancer.go
Go
go
6,248
permissive
// SPDX-License-Identifier: Apache-2.0 // Copyright Authors of Cilium package cmd import ( "fmt" "sync" "github.com/go-openapi/runtime/middleware" "github.com/cilium/cilium/api/v1/models" . "github.com/cilium/cilium/api/v1/server/restapi/service" "github.com/cilium/cilium/pkg/api" "github.com/cilium/cilium/p...
4147c5a417b1f341fdafcc089f8818c5e6b0ed5c
59e3af3a9db4745b88dbdefa16cf4c8f48ee0d12
finalversus/doc
/pdf/internal/transform/matrix.go
Go
go
3,712
no_license
package transform import ( "fmt" "math" "github.com/finalversus/doc/common" ) // Matrix is a linear transform matrix in homogenous coordinates. // PDF coordinate transforms are always affine so we only need 6 of these. See newMatrix. type Matrix [9]float64 // IdentityMatrix returns the identity transform. func...
9f77a3643243e1b8d38048cd92bd4d57c72ad727
fc7dba2597602a9df796b114e37b26804087dcd0
dolthub/dolt
/go/libraries/doltcore/sqle/enginetest/testgen_test.go
Go
go
2,497
permissive
// Copyright 2022 Dolthub, 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...
9972204093a0429d36d554b3fce7328939b3ce4b
453368ede5e4a727d0a25109d5be6e03dde811b8
github-0115/go-getui-api
/tool/apns.go
Go
go
1,092
no_license
package tool //open application templates type Apns struct { Alert *Alert `json:"alert"` // AutoBadge string `json:"autoBadge,omitempty"` //用于计算icon上显示的数字,还可以实现显示数字的自动增减,如“+1”、 “-1”、 “1” 等,计算结果将覆盖badge Sound string `json:"sound,omitempty"` //通知铃...
837125f86e3b90ad05f581aeb52d2f8a83505f09
f70bbb6d66bb5c2c040d1c0284e197d4b390fc5d
susimsek/golang-echo-elasticsearch-rest-api-example
/handler/error.go
Go
go
1,163
no_license
package handler import ( "github.com/labstack/echo/v4" "golang-echo-elasticsearch-rest-api-example/util" "net/http" "time" ) // APIError example type APIError struct { Status int `json:"status" xml:"status"` Message string `json:"message" xml:"message"` Path string `json:"path" xml:"path"` Timest...
169706764efa38662c13db8ca32a1111ffb35e27
f8ad1dbfdc18c829563e5e15b74774618b3f7bd1
go-park-mail-ru/2019_1_SleeplessNights
/game_microservice/player/factory/factory_test.go
Go
go
1,004
no_license
package factory_test import ( "github.com/go-park-mail-ru/2019_1_SleeplessNights/game_microservice/message" "github.com/go-park-mail-ru/2019_1_SleeplessNights/game_microservice/player/factory" "github.com/go-park-mail-ru/2019_1_SleeplessNights/game_microservice/router/handlers" "github.com/go-park-mail-ru/2019_1_S...
1b57c16088a432631ff07c122ae203872ce51e1d
0bf2e6fd795092f28a7b77c8d8e4dfd7a96e74dd
GoogleCloudPlatform/k8s-config-connector
/third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/resource_vmwareengine_cluster_test.go
Go
go
5,235
permissive
// Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package google import ( "fmt" "strings" "testing" "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" "github.com/hashicorp/terraform-plugin-sdk/v2...
32cb1484627494619bde6074a5c7dab8c9faac54
9dbe04b26e670c6207f2391a83fcffaeb6ca307b
sk000f/snippetbox
/pkg/models/models.go
Go
go
852
permissive
package models import ( "errors" "time" ) var ( // ErrNoRecord defines an error returned when no matching record is found ErrNoRecord = errors.New("models: no matching record found") // ErrInvalidCredentials indicates a failed authentication attempt ErrInvalidCredentials = errors.New("models: invalid credentia...
5c312df5b9e59ec3c288b5d9b4878030fdd46149
cd048f788ad0358c07106d9759d539564c19918d
benthomasson/playbook-dispatcher
/internal/response-consumer/handler.go
Go
go
2,758
no_license
package responseConsumer import ( "context" "playbook-dispatcher/internal/common/constants" kafkaUtils "playbook-dispatcher/internal/common/kafka" "playbook-dispatcher/internal/common/model/db" "playbook-dispatcher/internal/common/model/message" "playbook-dispatcher/internal/common/utils" "playbook-dispatcher/i...
5188449e25c981192455fd3729e49375ef7d7bcb
37b3db6d24763ef0b648da9fa38a1ed735211b89
KaspariK/url-shortener
/handler.go
Go
go
1,718
no_license
package urlshort import ( "net/http" "gopkg.in/yaml.v2" ) // MapHandler will return an http.HandlerFunc (which also // implements http.Handler) that will attempt to map any // paths (keys in the map) to their corresponding URL (values // that each key in the map points to, in string format). // If the path is not ...
b711377677e211528787173022c565f72ba032e0
b0cca279078ca35b3377ed55e5de3451e80d15d5
OrlandoMurciaAI/higor
/csv/csv.go
Go
go
683
permissive
package csv // CSV struct to parse CSV to DataFrame type CSV struct { Sep rune NaNLayout string LazyQuotes bool DatetimeLayout string } // CSVOptions To apply optionals parameters type CSVOptions func(csv *CSV) // CSVOptions functions // Sep to set custom separator func Sep(sep rune) CSVOpti...
a3b2555dc7bea5f39724e92a30e5ede9523b260a
fb54cfb0fbf9a0243d24c9acd796f6b870b58c9c
p-id/regrep
/internal/regexp/regexp.go
Go
go
1,348
permissive
// Package regexp implements regular expression search tuned for // use in grep-like programs. package regexp import "regexp/syntax" func bug() { panic("regrep/internal/regexp: internal error") } // Regexp is the representation of a compiled regular expression. // A Regexp is NOT SAFE for concurrent use by multiple...
80c52fb02495752dc6b2159dbe56f6320a8b91f7
040634b17259821ee292de45089ba33690f8d40c
yt3liu/knative-gcp
/test/e2e/installer.go
Go
go
3,083
permissive
/* Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
c2e166815f3507b6306a048cd72818e1dd130141
bd3d1ddfcc3254a5a9be4e41d5fc0782a44e33e9
BTCGPU/lnd
/watchtower/lookout/log.go
Go
go
762
permissive
package lookout import ( "github.com/BTCGPU/lnd/build" "github.com/btcsuite/btclog" ) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller // requests it. var log btclog.Logger // The default amount of logging is none. fu...
aba2c91f24f95f2c011a8cd5205e0e9f3d798c8a
a857de625013a70914946609f60ba2d8c475e517
dennypradipta/cariliquid
/controllers/user_controller.go
Go
go
3,476
no_license
package controllers import ( "fmt" "io/ioutil" "time" "encoding/json" "github.com/gorilla/mux" "net/http" "github.com/dennypradipta/cariliquid/models" "github.com/dennypradipta/cariliquid/responses" ) // GetUsers returns all users func (server *Server) GetUsers(w http.ResponseWriter, r *http.Request) { // G...
dda5294a34fec2778b2b7aa5f1ffeb817ef710a1
8f21199dc5b7a9b224d82a9d0ca7392f12cc2a89
jangocheng/gquery
/htmlnode.go
Go
go
9,855
no_license
package gquery import ( "strings" ) type HtmlNode struct { label string id string class []string attr map[string]string text string value string html string parent *HtmlNode children []*HtmlNode isPaired bool } type HtmlNodes []*HtmlNode func (hn *HtmlNode) isFitSelector(sele...
68432896808f279d0ed53e65abe96f85dd1e0eee
893598b3cac3662071da2bf02b3caff3ef911dd3
jvillmer/gaia
/packetreport.go
Go
go
50,223
permissive
package gaia import ( "fmt" "time" "github.com/globalsign/mgo/bson" "github.com/mitchellh/copystructure" "go.aporeto.io/elemental" ) // PacketReportEventValue represents the possible values for attribute "event". type PacketReportEventValue string const ( // PacketReportEventDropped represents the value Dropp...
7788de1063817feca7449d25ea6f44717b6492b8
728c8b80b69ed2216ab0458a5ebe2ab7cd6c159e
byoc-io/gutenberg
/pkg/storage/database/db.go
Go
go
1,084
no_license
package database import ( "github.com/byoc-io/gutenberg/pkg/storage" "gopkg.in/mgo.v2" ) const ( PostsCollection = "posts" UsersCollection = "users" ) // repository is a Mongodb implementation of the Repository. type repository struct { session *mgo.Session name string } func New(db *mgo.Database) storage....
93847ff13a681e42f6f9ec165190ce4b03af35dc
27986681f474fdc89f658d6fa998c85207058fc1
moorle/aries
/log/log.go
Go
go
2,192
no_license
package log import ( "aries/config/setting" "aries/utils" "log" "os" "path/filepath" "time" "github.com/natefinch/lumberjack" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) // Logger 日志 var Logger *zap.Logger // InitLogger 初始化日志 func InitLogger(fileName, level, format string, maxSize, maxBackups, maxAge int...
319a60cbdac6b5b7534623e8a86f6e98501762f9
1baa3b0178bb8a5cbe13684c93691f3849479e77
double12gzh/core
/store/etcdv3/meta/ephemeral.go
Go
go
1,674
permissive
package meta import ( "context" "sync" "time" "github.com/projecteru2/core/log" "github.com/projecteru2/core/types" "github.com/cockroachdb/errors" clientv3 "go.etcd.io/etcd/client/v3" ) // StartEphemeral starts an empheral kv pair. func (e *ETCD) StartEphemeral(ctx context.Context, path string, heartbeat ti...
25440879d06218baa520b248bac8974b651c311c
c3d06a7411bb6a4bee10a395c02020e0b5736406
jinseongbe/golang_study
/src/go_02(Variable)/Variable.go
Go
go
1,066
no_license
package main import "fmt" func main() { var a int var b int // a := 4 // 선업대입문 (a :=4 ) == (var a int = 4) == (var a = 4) a = 3 b = 4 fmt.Println(a + b) } // 32bit/64bit -> 기본연산이 되는 사이즈 // // int : 정수 4/8byte // int8 : 정수 1byte -> (2^7 - 1) -> (-128 ~ 127) // uint8 : 양의 정수 1byte -> (2^8 - 1) -> (0 ~ 2...
312a84b08cf1126e9a6b5349176e44a51e508ba5
4fc6ddaeb59b165ea93ec81a7f881d5298c8f341
freerware/tutor
/infrastructure/module.go
Go
go
2,571
permissive
package infrastructure import ( "database/sql" "fmt" "time" "github.com/avast/retry-go" "github.com/cactus/go-statsd-client/statsd" "github.com/freerware/tutor/config" "github.com/freerware/tutor/domain" "github.com/freerware/work/v4/unit" "github.com/freerware/workfx/v4" _ "github.com/go-sql-driver/mysql" ...
7f24f2c2cde78e99450314fab9a2046c3459592f
bf1e72de28ef7b796ab53ce093abed854f6dba9b
sgtest/monorepo-test-3
/kubernetes-5/pkg/apis/storage/v1/zz_generated.conversion.go
Go
go
3,778
permissive
// +build !ignore_autogenerated /* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applica...
1b5875a60702ae6e5badd0c064d75db546d8089c
d7c50af029af1d2958eee0cb508d8e264e3e28aa
harryge00/istio
/operator/cmd/mesh/uninstall.go
Go
go
10,933
permissive
// Copyright Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wri...
659d92c5b29b37484a090d25e18247f9cb7cdd8b
930b8b3961568f21873263f943d6435f16ff1840
zoutepopcorn/caddy-requestid
/requestid.go
Go
go
1,559
permissive
package requestid import ( "net/http" "strings" "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" "github.com/caddyserver/caddy/v2/modules/caddyhttp" "github.com/google/uuid" ) func init() { caddy.RegisterModu...
a05b0cf9d2910f6ca19ea904d4025ce0e0af3948
04c2893c2352340774b2d8ab308e0d5d69e6f8b0
saucesaft/giu
/imgui/RendererOpenGL3.go
Go
go
15,398
permissive
package imgui import ( "fmt" "image" "math" "runtime" "unsafe" "github.com/go-gl/gl/v3.2-core/gl" ) // OpenGL3 implements a renderer based on github.com/go-gl/gl (v3.2-core). type OpenGL3 struct { imguiIO IO glslVersion string fontTexture uint32 shaderHandle uint32 vertHan...
fdab362c506e22e7d723620533787ff27f02b64e
ee13bd6fd0f0680276148c3025ada5a22bb229b7
sgtest/monorepo-test-3
/kubernetes-1/pkg/proxy/healthcheck/doc.go
Go
go
752
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, ...
87b78cf25bd655bd38eaeea2f8a07f9e89fccefd
c78b5c9bf40cb0126a4fb1432321ec9a3c52f2de
NewAmsterdamLabs/fetch
/checksum.go
Go
go
1,895
permissive
package main import ( "crypto/sha256" "crypto/sha512" "encoding/hex" "fmt" "hash" "io" "os" "reflect" ) func verifyChecksumOfReleaseAsset(assetPath string, checksumMap map[string]bool, algorithm string) *FetchError { computedChecksum, err := computeChecksum(assetPath, algorithm) if err != nil { return new...
42b9a8d2c144bcc0dce14e69ca65615808c056d6
64367757b7f3f8873315b1a9e4faa7f2726bc071
keeferrourke/vitess
/go/vt/binlog/slave_connection.go
Go
go
10,133
permissive
/* Copyright 2019 The Vitess Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
2fafe0400a354109b8021e1962559cd3eba5699a
81fd543cb5fa17534226e1763f62f207ca95fb02
eriknelson/cpma
/pkg/io/io.go
Go
go
589
permissive
package io import ( "io/ioutil" "github.com/fusor/cpma/pkg/io/sftpclient" ) // GetFile first tries to retrieve file from local disk (outputDir/<Hostname>/). // If it fails then connects to Hostname to retrieve file and stores it locally // To force a network connection remove outputDir/... prior to exec. var GetFi...
a5e44cc4da2a4330fdb5e28a7f978d9f980c47c0
f85adadf7717a37ac9343d0bd8d157dbbb9c7ee1
ladydascalie/govim
/cmd/govim/internal/golang_org_x_tools/lsp/fake/sandbox.go
Go
go
8,801
permissive
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package fake import ( "context" "fmt" "io/ioutil" "os" "path/filepath" "strings" "github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/gocomman...
11f4ffa61b0a368206973fca8f890cfb6169f7f9
5c525881af39073f9dc80f02e19aabeaecf8bbb2
OHSY247/Leetcode
/vscode-leetcode/1047.删除字符串中的所有相邻重复项.go
Go
go
1,292
permissive
/* * @lc app=leetcode.cn id=1047 lang=golang * * [1047] 删除字符串中的所有相邻重复项 * * https://leetcode-cn.com/problems/remove-all-adjacent-duplicates-in-string/description/ * * algorithms * Easy (69.76%) * Likes: 244 * Dislikes: 0 * Total Accepted: 82.3K * Total Submissions: 113.7K * Testcase Example: '"abbaca...
799564239c5afcf15ef3338b962d0edbf59bb281
359fa60c915cc5c3941cab9160fc5035bfb6dfb5
aiwantaozi/rke
/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go
Go
go
28,119
permissive
package v3 import ( "context" "sync" "github.com/rancher/norman/controller" "github.com/rancher/norman/objectclient" "github.com/rancher/norman/restwatch" "k8s.io/client-go/dynamic" "k8s.io/client-go/rest" ) type Interface interface { RESTClient() rest.Interface controller.Starter NodePoolsGetter NodesGe...
83f21e2c893e696820bddc78ddd0cf681b56755b
b5ecdf59af4943d9fdba647f985dc9213dcaf8de
harboe/goa
/goagen/gen_app/writers.go
Go
go
20,722
permissive
package genapp import ( "regexp" "strings" "text/template" "github.com/raphael/goa/design" "github.com/raphael/goa/goagen/codegen" ) // WildcardRegex is the regex used to capture path parameters. var WildcardRegex = regexp.MustCompile("(?:[^/]*/:([^/]+))+") type ( // ContextsWriter generate codes for a goa ap...
e1893bf283a428029c4006e0835f286251e914ef
9e0789d222493e64638feed303288b0d1cc69620
open-telemetry/opentelemetry-collector-contrib
/receiver/redisreceiver/config_test.go
Go
go
1,397
permissive
// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 package redisreceiver import ( "path/filepath" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/confignet" "...
1ee9e0b685464ec28f3b03489d7289755b522c74
a6040e68ae1e426665752f2231c5c7497da68515
lightstep/hipster-shop
/src/frontend/main.go
Go
go
5,492
permissive
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
d7aa789a17e92d3fa4b543ec06f59543d00917b1
1e071577a72ba2e4f0fceaac18b57a48681820e8
denson7/iris-12
/datasource/engine.go
Go
go
714
no_license
package datasource import ( _ "github.com/go-sql-driver/mysql" "learnIris/model" "xorm.io/xorm" ) // 数据库 func NewMysqlEngine() *xorm.Engine{ // 创建数据库连接对象 engine, err := xorm.NewEngine("mysql", "root:root@/test?charset=utf8") if err != nil { panic(err.Error()) } // 关闭数据库引擎 defer engine.Close() // 设置名称映射...
04c2ec479e8ad77269c8d20ab845f6105abeda7f
ec7aee1e77ff9297663a2939214f6ebc351b9731
Codeberg-org/gitea
/routers/repo/editor_test.go
Go
go
2,514
permissive
// Copyright 2018 The Gitea 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 repo import ( "testing" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/test" "github.com/stretch...
689b3c4ec6fb3998cb1b16761f39f1641b074172
e2d9d67faca029010d696933680457351a93b374
ligexiao/golangclub
/global/init.go
Go
go
1,012
permissive
/* * Copyright (c) 2019. The StudyGolang Authors. All rights reserved. * Use of this source code is governed by a MIT-style * license that can be found in the LICENSE file. * https://golangclub.com * Author:polaris polaris@studygolang.com */ package global import ( "flag" "fmt" "math/rand" "sync" "time" ...