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
bf6cc17339d4a7c04c774d6e19531103d79109cc
64bac9d298427f236666b7322adefd11add7686e
emilva/hydra
/oauth2/oauth2_test.go
Go
go
4,184
permissive
package oauth2_test import ( "fmt" "net/http/httptest" "net/url" "time" "github.com/dgrijalva/jwt-go" "github.com/pkg/errors" "github.com/julienschmidt/httprouter" "github.com/ory-am/fosite" "github.com/ory-am/fosite/compose" "github.com/ory-am/fosite/hash" hc "github.com/ory-am/hydra/client" "github.com/...
85e80386ed2be13caaa1b42e3e8c0df7cb06e007
2d46b8372ab20beb14085b4ebad705a70040f88c
dananjayavr/head-first-go
/chapter_12/files.go
Go
go
621
no_license
package main import ( "fmt" "io/ioutil" "os" "path/filepath" ) func reportPanic() { fmt.Println("Report panic called") p := recover() if p == nil { return // do nothing } err, ok := p.(error) if ok { fmt.Println(err) } else { panic(p) } } func main() { defer reportPanic() scanDirectory(os.Args[1]...
ccca254d5dd7467a525f7cf63f4f2468da9513a1
a4780058b22b156999ee79a0042c1028cbdbecd8
wwjiang007/nuclio
/pkg/processor/build/runtimeconfig/runtimeconfig.go
Go
go
1,524
permissive
/* Copyright 2017 The Nuclio 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...
18277b2bd10539c8072ad4dc3f724ce520ae32f8
57d3714959c714047df1698d6d0fa5b265eb3062
smoya/exploreio
/s26/main.go
Go
go
1,177
permissive
// S26: A slow reader. package main import ( "io" "log" "os" "strings" "time" ) type SlowReader struct { r io.Reader throttle <-chan time.Time } func New(r io.Reader, dur time.Duration) *SlowReader { return &SlowReader{r: r, throttle: time.Tick(dur)} } func (r *SlowReader) Read(p []byte) (n int, err...
253d4845a3f5f86adf3a562d91344846a98f5fbe
3831c3376bddd0527b8926e865093c946c10a25f
GoogleCloudPlatform/cloud-build-local
/vendor/github.com/docker/distribution/vendor/github.com/spf13/cobra/command.go
Go
go
26,619
permissive
// Copyright © 2013 Steve Francia <spf@spf13.com>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
b27383a203e10cf5544595806470923fcddcc560
52db0d6f16c4c6a702bd2b44244bd7a114102a9f
relvacode/rpm-lambda
/storage/objects.go
Go
go
996
permissive
package storage import ( "git.illumina.com/relvacode/rpm-lambda/yum" "time" ) const ( RepoMDXML = "repodata/repomd.xml" PrimaryXML = "repodata/primary.xml.gz" FilelistXML = "repodata/filelists.xml.gz" ) type XMLObject struct { Key string ObjectChecksum yum.Checksum ContentChecksum yum.Checksu...
f9a665ee85832b826b83572603ad9cf83aa43a5e
1bbc6359ca3f3c350d253e3e8be5a3d0d792ba53
bpkgoud/pulumi-azure-native
/sdk/go/azure/documentdb/v20210301preview/init.go
Go
go
2,929
permissive
package v20210301preview import ( "fmt" "github.com/blang/semver" "github.com/pulumi/pulumi-azure-native/sdk/go/azure" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type module struct { version semver.Version } func (m *module) Version() semver.Version { return m.version } func (m *module) Construct(ctx *...
11d8d45c52fd17c8e2fc5716848c8c1a50321c81
ea10750b85791900d2b687662de6a20994534aad
bhbryant/lnd
/invoices/invoiceregistry.go
Go
go
41,701
permissive
package invoices import ( "errors" "fmt" "sync" "sync/atomic" "time" "github.com/davecgh/go-spew/spew" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/clock" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/queu...
8ce7cd83057825577db85dc286ad4c86bb3890cb
262e25e5353ded54409f645cdd50797dae38429c
kzys/opentelemetry-collector
/exporter/prometheusremotewriteexporter/exporter.go
Go
go
11,564
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 agr...
34b4d12ee663b5d0fac1a41e3e20ec49489402f2
b98b058eb28aead56fcda6c93e9976755ab066ff
tiaotiao00/hcashd
/wire/msginv.go
Go
go
4,795
permissive
// Copyright (c) 2013-2015 The btcsuite developers // Copyright (c) 2015-2016 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package wire import ( "fmt" "io" ) // defaultInvListAlloc is the default size used for the backing array for an // i...
c3c42763180650a05f483d72f9d32a5ddd180069
a2baae953b8553d41b5fe162f188c9ff1d82a170
autowp/traffic
/whitelist_test.go
Go
go
1,211
no_license
package traffic import ( "context" "github.com/jackc/pgx/v4/pgxpool" "github.com/stretchr/testify/require" "net" "testing" ) func createWhitelistService(t *testing.T) *Whitelist { config := LoadConfig() pool, err := pgxpool.Connect(context.Background(), config.DSN) require.NoError(t, err) s, err := NewWhit...
5230951e5a9ac3ad1442c4652b378f4efeda0135
a8acad186b538523df8bfa38c6220a87645edb98
epicavic/gocook
/ch04/03-log/log/error.go
Go
go
672
permissive
package log import ( "log" "github.com/pkg/errors" ) // OriginalError returns the error original error func OriginalError() error { return errors.New("error occurred") } // PassThroughError calls OriginalError and forwards the error along after wrapping. func PassThroughError() error { err := OriginalError() //...
e32d4693931ee34a6a3cb957baede9b18178f856
32946b873a6ed29eb56fc80152841b89764b49b8
shawn-hurley/cluster-logging-operator
/pkg/k8shandler/visualization_test.go
Go
go
4,588
permissive
package k8shandler import ( "reflect" "testing" logging "github.com/openshift/cluster-logging-operator/pkg/apis/logging/v1" "github.com/openshift/cluster-logging-operator/pkg/utils" v1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/api/resource" "sigs.k8s.io/controller-runtime/pkg/c...
f68ba89ed0ad3b2d65ec0881e49f5bc0357a6b13
f1e899051618bb210153ab9f14f3c41fcfa1e6e3
krisnova/bjorno
/example/bjorno.go
Go
go
1,360
permissive
// Copyright © 2021 Kris Nóva <kris@nivenly.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
c962be1a9e4336a25dc03bac2d017fa2e9595dbd
7e9acdd3afd4c99baa6ec471c3eb85c552cd0b2b
lfaoro/ion
/vendor/github.com/lfaoro/pkg/encrypto/tls.go
Go
go
1,129
permissive
// Copyright (c) 2019 Leonardo Faoro. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package encrypto import "crypto/tls" func DefaultTLSConfig() *tls.Config { return &tls.Config{ // Avoids most of the memorably-named TLS attacks MinV...
3a3f0cfe214bad8b0ab127eb572d84e2d9634349
61a680e9026e449c500b1e3a08c84a991249d4b5
btnmasher/lumberjack
/printbackend.go
Go
go
871
permissive
package lumberjack import "log" //PrintBackend implements a console printing Backend that currently //offers two predefined formats based on the Verbosity specified. type PrintBackend struct { Verbosity LogLevel } //Log satisfies the Backend interfaces requirements used for accepting //LogEntry objects to print out...
9adc46d6b650568afe97e914f2663a1e629ca8e4
660d0170e87f948d955fe6befab1bc694c23cd8d
wardbekker/loki
/pkg/storage/stores/indexshipper/downloads/index_set_test.go
Go
go
5,603
permissive
package downloads import ( "context" "fmt" "os" "path/filepath" "testing" "github.com/stretchr/testify/require" "github.com/grafana/loki/pkg/storage/chunk/client/util" "github.com/grafana/loki/pkg/storage/stores/indexshipper/index" "github.com/grafana/loki/pkg/storage/stores/indexshipper/storage" util_log ...
033b6c0a6f69d21d3ef516392e9ce116604bc050
5257f871d4048d22cd42561027c7810e3b6711d0
enricoschiattarella/spire
/pkg/agent/attestor/workload/workload.go
Go
go
2,838
permissive
package attestor import ( "context" "fmt" "time" "github.com/sirupsen/logrus" "github.com/spiffe/spire/pkg/agent/catalog" "github.com/spiffe/spire/pkg/common/telemetry" "github.com/spiffe/spire/proto/agent/workloadattestor" "github.com/spiffe/spire/proto/common" ) type attestor struct { c *Config } type At...
679b06a848688a51bf459219ad8c344aa5dcf0d1
bbb198d78ca7366aea18e07aa88c77232d0a9227
rajkrishnamurthy/practicinggo
/Lesson4/main.go
Go
go
372
no_license
package main // Passing by Reference: 15_passing_by_value: 06_REFERENCE-TYPE import "fmt" func main() { m := make([]string, 1, 25) fmt.Println(m) // [ ] fmt.Println(&m[0]) changeMe(m) fmt.Println(m) // [Todd] } func changeMe(z []string) { fmt.Printf("&z[0]: %0x \n", &z[0]) z[0] = "Todd" fmt.Printf("z: %s \n...
a35913168a512b9060ae911ad9e9f4ee7edf4b62
7c4bca9563b55ad602e5cc2de9fe0cd4195a18b5
brandonabear/go-sm-parser
/parser/error_test.go
Go
go
316
no_license
package parser import ( "errors" "testing" ) func TestCheckError(t *testing.T) { var tests = []struct { err error }{ {errors.New("error")}, {nil}, } defer func() { if r := recover(); r == nil { t.Error("The code did not panic.") } }() for _, test := range tests { CheckError(test.err) } }
4b61bed7a2dbca7bdcfcf125e1186fd84f6c488a
8af5d33a49a7593bc5bbfce5e0bf68114f3dd1ac
adjoeio/gosoline
/pkg/test/env/container_runner.go
Go
go
12,967
no_license
package env import ( "errors" "fmt" "net" "regexp" "strings" "sync" "time" "github.com/cenkalti/backoff" "github.com/justtrackio/gosoline/pkg/cfg" "github.com/justtrackio/gosoline/pkg/coffin" "github.com/justtrackio/gosoline/pkg/log" "github.com/justtrackio/gosoline/pkg/uuid" "github.com/ory/dockertest/v...
646903a79571e641d31b2d3ab8e6c4688f649a31
258911962f6ea5708593c077f1107871c3c4b1e7
blockchain-werkstatt/ipfs-network
/core/coreapi/key.go
Go
go
4,957
permissive
package coreapi import ( "context" "crypto/rand" "errors" "fmt" "sort" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ipfspath "gx/ipfs/QmNYPETsdAu2uQ1k9q9S1jYEGURaLHV6cbYRSVFVRftpF8/go-path" crypto "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSj...
db8f64d1b1c80cfa9e34e09886b38de32d95eaa3
d4841f098310429cd06754dab734268cedd99ad3
syllogy/guery
/executor/distinct_local.go
Go
go
3,461
permissive
package executor import ( "fmt" "io" "os" "runtime/pprof" "sync" "time" "github.com/vmihailenco/msgpack" "github.com/xitongsys/guery/eplan" "github.com/xitongsys/guery/gtype" "github.com/xitongsys/guery/metadata" "github.com/xitongsys/guery/pb" "github.com/xitongsys/guery/row" "github.com/xitongsys/guery...
ed29099bbf3a667ac8b1e3c5ebe24135d1f2f651
ba1fa32874a813ebb4de2f6ce33be41c4d41271c
oriongcea/oriongcea
/ledger/validator_app_test.go
Go
go
2,072
no_license
/******************************************************************************* * (c) 2018 ZondaX GmbH * * 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/lic...
9adf42d1eedbb71bafde3613e4b90b8e9d5aca89
08cadba05a30abc7ac4d837212c285f9603318c9
shawnburke/fx
/modules/task/encoding.go
Go
go
2,625
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...
986e3f534473f240130396c10ce341d7c5d34a94
8e04461980a94761d37abda61d077ba64e7ba445
dna2fork/sourcegraph
/cmd/frontend/internal/app/ui/handlers_docs.go
Go
go
4,621
permissive
package ui import ( "encoding/json" "fmt" "net/http" "strings" "github.com/gorilla/mux" "github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend" "github.com/sourcegraph/sourcegraph/internal/database" "github.com/sourcegraph/sourcegraph/lib/codeintel/precise" "github.com/sourcegraph/sourcegraph/lib/e...
6f13d2589832c307e54dcbab249326b1350da5de
7128030e75eef02f3d68de9333741a818a3550de
bnchain/bnchain
/plugin/dapp/multisig/executor/action.go
Go
go
37,780
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. package executor import ( "encoding/hex" "github.com/bnchain/bnchain/account" "github.com/bnchain/bnchain/client" "github.com/bnchain/bnchain/common/address...
416c997634af5d0b527043442519f5896233de7f
cf89e9c9c6af8ad3ea67194b4be4e67c8ca2a724
abitofhelp/pipeline
/pipeline/loadPathsToChannel.go
Go
go
1,920
permissive
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2018 A Bit of Help, Inc. - All Rights Reserved, Worldwide. // Use of this source code is governed by a MIT license that can be found in the LICENSE file. ////////////////////////////...
d4c656a1dbb7490c419e5155abcc2bce7df63adc
e4fc9d50da952144a06f376f609068766168bf47
codacy-badger/juno
/resources/upload/service.go
Go
go
2,715
no_license
package upload import ( "database/sql" "errors" "fmt" "github.com/gin-gonic/gin" "github.com/google/uuid" "github.com/mensurowary/juno/auth" "github.com/mensurowary/juno/config" log "github.com/sirupsen/logrus" "mime/multipart" "net/url" "path/filepath" "strings" ) var FileCouldNotBeUploaded = errors.New(...
9b60a6837712807204b0e5a32eb67f5683784034
c325fc3f4318ef3cabfde79672d4473c0438ed58
discless/cli
/discless/config.go
Go
go
2,172
permissive
package discless import ( "errors" "gopkg.in/yaml.v2" "io/ioutil" "os" ) var ( Host = "localhost" Port = "8443" ) type Config struct { Host string `yaml:"host"` Port string `yaml:"port"` SkipTLS bool `yaml:"skiptls"` Auth struct{ Keys map[string]string `yaml:"keys"` } `yaml:"keys"` } func creatConfig()...
82a5d325ccc1156c8932a6576677088678c04506
3ec81323b4bb4d9c73fc892c827994e0ccb0d3f6
ShigekiKarita/hugo
/hugolib/template_test.go
Go
go
10,640
permissive
// Copyright 2016 The Hugo 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 ...
da927fa0d9727d6c100f5adc1008d074720b3e2d
b71a5c83695b6e396cedcc112eca1a10d6a52c39
adsr/vitess
/go/mysql/fakesqldb/server.go
Go
go
19,526
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...
1ac011fe12efeaa0e6d3bf4925f13f84daec07a6
7c6f60376a2da103fb291f56be205da2e1597bc5
nbtri/prom
/examples/example_pgsql_json.go
Go
go
7,510
permissive
package main import ( "encoding/json" "fmt" "github.com/btnguyen2k/prom" _ "github.com/lib/pq" "math/rand" "reflect" "strconv" "strings" "time" ) // construct an 'prom.SqlConnect' instance func createSqlConnectPgsqlJson() *prom.SqlConnect { driver := "postgres" dsn := "postgres://test:test@localhost:5432/t...
b5d2eefaf85eb8a19a195961d8cb740a9d17a681
4fd5e7e3b1d3ec04957e365bf1304fe064fd9ed9
btccom/TellorMiner
/pkg/db/remoteDataProxy.go
Go
go
8,444
permissive
// Copyright (c) The Tellor Authors. // Licensed under the MIT License. package db import ( "crypto/ecdsa" "fmt" "log" "strconv" "strings" "sync" "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" lru "github.com/hashicorp/golang-lru" "github.com/tellor-io/TellorMiner...
9a0204eb7b343c253b012a63cb9d1f636ba5b137
b110ff3737fde88386ad8cf99ec255b50e6ff1fd
chrsan/shadow
/internal/f2093.go
Go
go
850
permissive
package internal import ( "unsafe" ) func f2093(ctx *Context, l0 int32) int32 { var l1 int32 _ = l1 var l2 int32 _ = l2 var s0i32 int32 _ = s0i32 var s1i32 int32 _ = s1i32 var s2i32 int32 _ = s2i32 s0i32 = l0 s1i32 = 21300 *(*uint32)(unsafe.Pointer(&ctx.Mem[int(s0i32+0)])) = uint32(s1i32) s0i32 = l0 s...
27705ed94bc436d6b023cd22f97b5ad722b677d5
7f72373b1568038db792b81d023dac905091975c
trustbloc/fabric-mod
/core/ledger/kvledger/hashcheck_pvtdata.go
Go
go
6,346
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package kvledger import ( "bytes" "github.com/hyperledger/fabric-protos-go/ledger/rwset" "github.com/hyperledger/fabric/common/util" "github.com/hyperledger/fabric/core/ledger" "github.com/hyperledger/fabric/core/ledger/kvledger...
5b3859a29993ebc3da22ebd9cf420565a591b8c4
fde7d07fde658bcf09555d6e51ddf288ff4a3baa
mjura/stratos
/src/jetstream/plugins/monocular/chartsvc/foundationdb/handler.go
Go
go
17,196
permissive
/* Copyright (c) 2019 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed...
4affef5fbbcf66406b984749aaea33707f965e58
a12c3d02bf385f2b6de34b75a2ab8ff43897aaec
vkkevin/hgoj
/models/share_code.go
Go
go
303
permissive
package models import ( _ "github.com/astaxie/beego/orm" "time" ) type ShareCode struct { ShareId int32 `orm:"auto"` UserId int32 `orm:"null"` Share_code string `orm:"type(text);null"` Language string `orm:"type(32);null"` ShareTime time.Time `orm:"auto_now;type(datetime);null"` }
c175ac635d47449422df1eb852c61fde52307f47
f6ec15ee7bae65d554e4a74428bd78aa545b3f2d
StrongMonkey/webhookinator
/pkg/provider/polling/polling.go
Go
go
2,680
permissive
package polling import ( "context" "net/http" "github.com/drone/go-scm/scm" webhookv1 "github.com/rancher/gitwatcher/pkg/apis/gitwatcher.cattle.io/v1" v1 "github.com/rancher/gitwatcher/pkg/generated/controllers/gitwatcher.cattle.io/v1" "github.com/rancher/gitwatcher/pkg/git" "github.com/rancher/gitwatcher/pkg/...
d0a713deda226ea0f370e9fbd0182412b4f27648
7b98a87c95d935d3520c35f38f573b1a1af859cc
austinskies/docker
/integration-cli/docker_cli_run_unix_test.go
Go
go
45,502
permissive
// +build !windows package main import ( "bufio" "encoding/json" "fmt" "io/ioutil" "os" "os/exec" "path/filepath" "regexp" "strconv" "strings" "sync" "syscall" "time" "github.com/docker/docker/pkg/homedir" "github.com/docker/docker/pkg/integration/checker" "github.com/docker/docker/pkg/mount" "githu...
2ecc1207996eab0f6e5741e3d544d158c137c28e
ca2c6e88bde82f39634d46f20f739fb03643d7ec
TerryLiu/log
/_example/example.go
Go
go
1,417
permissive
package main import "github.com/terryliu/log/v2" func main() { // Init用来初始化设置 // 参数1:设置日志路径 // 参数2:日志输出的级别 // 参数3:是否需要另存请求类型的日志 // 参数4:从这个参数开始,后面的参数都是LogOption结构的回调函数,比如下面的例子为设置是否显示Caller,还可以使用log.SetCallerDeep来设置深度 // 参数5:用log.SetMaxFileSize(2)举例,设置日志大小为2MB,默认是500MB.顺便提一句,最大文件个数默认是5个,最大文件保留天数是7天. // 参数6:参考4.....
f94bab84f52aff5e2b4c01c8fad415f843fcac77
160c3c9c2735937b251987e872aa24baee376a59
bpkgoud/pulumi-azure-native
/sdk/go/azure/securityinsights/v20210301preview/getAwsCloudTrailDataConnector.go
Go
go
1,498
permissive
package v20210301preview import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func LookupAwsCloudTrailDataConnector(ctx *pulumi.Context, args *LookupAwsCloudTrailDataConnectorArgs, opts ...pulumi.InvokeOption) (*LookupAwsCloudTrailDataConnectorResult, error) { var rv LookupAwsCloudTrailDataConnectorResult err...
f716abbcbcf83bb075cbc20c11de4cfeb5a479c2
dccbe9b82cc031dae4ec12547690fe53b010da07
bistuzx/onecloud
/pkg/mcclient/auth/middleware.go
Go
go
2,941
permissive
// Copyright 2019 Yunion // // 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 writi...
a2cf7239f55d519235e2c8373fe97d4d3e9b1a5d
80871845499d9f027f9947bae683e4d398ccabb7
jonatns/opentelemetry-collector-contrib
/receiver/dockerstatsreceiver/receiver_test.go
Go
go
2,976
permissive
// Copyright 2020 OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
23242667b258a8404dcb330d84eaf24eeb880e47
27b388dffd606e65f82008c8a5c7f9df443bff27
Raz0rwire/kalm
/api/handler/nodes_test.go
Go
go
2,074
permissive
package handler import ( "net/http" "testing" "github.com/kalmhq/kalm/api/resources" "github.com/stretchr/testify/suite" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type NodesHandlerTestSuite struct { WithControllerTestSuite } func (suite *NodesHandlerTestSuite) SetupSuite() { su...
2298078a86fc12570678c607a8d120eb173df57f
bcd26b727deba2817b0c05b579b7aa27b3b68cb4
bpkgoud/pulumi-azure-native
/sdk/go/azure/network/v20180101/getExpressRouteCircuit.go
Go
go
2,554
permissive
package v20180101 import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func LookupExpressRouteCircuit(ctx *pulumi.Context, args *LookupExpressRouteCircuitArgs, opts ...pulumi.InvokeOption) (*LookupExpressRouteCircuitResult, error) { var rv LookupExpressRouteCircuitResult err := ctx.Invoke("azure-native:networ...
78535c4ed6cef1bcb955ca0eca954a6211e0e800
df1bf7ad04bad27634dc6ba632fd3828b0d08c5a
infra-whizz/wzcd
/wzcd_pki.go
Go
go
4,084
no_license
package wzcd import ( "fmt" "io/ioutil" wzlib_database "github.com/infra-whizz/wzlib/database" wzlib_database_controller "github.com/infra-whizz/wzlib/database/controller" wzlib_logger "github.com/infra-whizz/wzlib/logger" ) type WzcPKIManager struct { db *wzlib_database.WzDBH wzlib_logger.WzLogger } func Ne...
2f2429f18515fadcb003cfcb9a5c666f43419fa9
c339f5e8b3d488fd3654c28480b824c92c01523d
wssll789/bee
/pkg/soc/testing/soc.go
Go
go
1,655
permissive
// Copyright 2021 The Swarm 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 testing import ( "testing" "github.com/wssll789/bee/pkg/cac" "github.com/wssll789/bee/pkg/crypto" "github.com/wssll789/bee/pkg/soc" "github.co...
259db30ecb0c37a7f04309f1214c8cc116470f20
4bd88a54a2dfd4320512292b581bf9e79acedbfd
phpyandong/opentaobao
/model/wdk/PosSubOrderDo.go
Go
go
1,542
permissive
package wdk // PosSubOrderDo type PosSubOrderDo struct { // 库存单位,必填 StockUnit string `json:"stock_unit,omitempty" xml:"stock_unit,omitempty"` // 库存单位购买数量,必填 BuyAmountStock string `json:"buy_amount_stock,omitempty" xml:"buy_amount_stock,omitempty"` // sku编码,必填 Sk...
7922ef7be66089cad04a0d20f71c7cd9a23ee27f
e07300d825b4e617d48f2d73f3cc620c0edfc1e9
xieshang728/learn-go
/slice/slice.go
Go
go
532
no_license
package main import "fmt" func main(){ months := []string{"","January","February","March","April","May","June","July","August","September","October","November","December"} fmt.Printf("months cap: %d, len: %d\n", cap(months),len(months)) Q2 := months[4:7] fmt.Printf("Q2 cap:%d, len: %d\n",cap(Q2),len(Q2)) sum...
9505fa6df5dff43a0c641a19ccaaae6fe88d1c78
825d16f42a550432fdef99b850eca3049d36bb36
tkforks/mani
/core/dao/dir.go
Go
go
6,285
permissive
package dao import ( "os" "path/filepath" "strings" "github.com/alajmo/mani/core" ) type Dir struct { Name string `yaml:"name"` Path string `yaml:"path"` Desc string `yaml:"desc"` Tags []string `yaml:"tags"` Context string RelPath string } func (d Dir) GetValue(key string) string { switch key { c...
7e44ede253a47363d8437f493776f5167c915502
f1cbb2b01df37ad50a84c3f38aab14d39845d5b4
EXCCoin/exccd
/cmd/promptsecret/promptsecret.go
Go
go
844
permissive
// Copyright (c) 2017 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package main import ( "flag" "fmt" "os" "golang.org/x/crypto/ssh/terminal" ) var n = flag.Int("n", 1, "prompt n times") func zero(b []byte) { for i := 0; i < len(b); i...
0d9bdb1e871cafb60aebbdd6a56cd943a10fc20a
72b3e812db47acc2741667fa83e4af5c7450fd3a
andrew-d/docker-hosts
/Godeps/_workspace/src/github.com/jessevdk/go-flags/help_test.go
Go
go
8,135
permissive
package flags import ( "bytes" "fmt" "io" "io/ioutil" "os" "os/exec" "runtime" "testing" "time" ) func helpDiff(a, b string) (string, error) { atmp, err := ioutil.TempFile("", "help-diff") if err != nil { return "", err } btmp, err := ioutil.TempFile("", "help-diff") if err != nil { return "", er...
e236cf0fbf45a8cb5881c86b4a3f19524e1a4573
68cbfd8cfafd059bf770ef7e132fd4427c32d56c
dinghenc/geerpc
/xclient/xclient.go
Go
go
2,574
no_license
package xclient import ( "context" "geerpc" "io" "reflect" "sync" ) type XClient struct { d Discovery mode SelectMode opt *geerpc.Option mu sync.Mutex clients map[string]*geerpc.Client } var _ io.Closer = (*XClient)(nil) func NewXClient(d Discovery, mode SelectMode, opt *geerpc.Option) *...
b5c73e9bf0977e3b9d9102c07c97c6cf2d96e33e
b083734fe9dd86ad0cddadafd11f762e338028c6
nashirkra/RENTAL-BUKU
/dto/loan-dto.go
Go
go
697
no_license
package dto import ( "time" "gorm.io/gorm" ) type LoanCreate struct { UserID uint64 `json:"user_id" form:"user_id" binding:"required"` BookID uint64 `json:"book_id" form:"book_id" binding:"required"` BorrowedDate *time.Time DueDate *time.Time ReturnDate *time.Time DeletedAt gorm.Deleted...
b3a37d65121946b290ec1dae1bab642747ccd2f7
8cb82699f715b6cea58b5ba6c7991d4511761817
hyberdk/snmpcollector
/pkg/webui/apicfg-measurement.go
Go
go
3,525
permissive
package webui import ( "github.com/go-macaron/binding" "github.com/toni-moreno/snmpcollector/pkg/agent" "github.com/toni-moreno/snmpcollector/pkg/config" "gopkg.in/macaron.v1" ) // NewAPICfgMeasurement Measurement API REST creator func NewAPICfgMeasurement(m *macaron.Macaron) error { bind := binding.Bind m.Gr...
1eeb8d744d1b8850a7875c63843e0a7d560954c0
26057568896cafcb85e8f44dc5a4b5a77d02ecf9
hawx/tw-linkfeed
/store/buckets.go
Go
go
634
permissive
package store import ( "hawx.me/code/tw-stream" ) type bucket []stream.Tweet type buckets struct { list []*bucket curr int } func (b *buckets) Prev() { if b.curr == 0 { b.curr = len(b.list) } b.curr-- } func (b *buckets) Add(tweet stream.Tweet) { *b.list[b.curr] = append(*b.list[b.curr], tweet) } func (b...
e09d52f5ba813dadc0a544179f118a95210969bf
3c7fde41a8e6cb4037f077b278c907e30e900f8a
stefanneuhaus/hugo
/output/layout_test.go
Go
go
7,743
permissive
// Copyright 2017-present The Hugo 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 app...
f5029b4e8c487f02ce220aa98f9f12ac056cbc7d
07c68297c92e76a90e1ceca730a3be88a6cec968
pathcl/VictoriaMetrics
/lib/promscrape/discovery/consul/api.go
Go
go
5,521
permissive
package consul import ( "context" "flag" "fmt" "net/http" "os" "strconv" "strings" "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promauth" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discoveryutils" ) var waitTime = flag.Durat...
3cb8be2b3ec7ce664dc1b499565b3bcc53a89ac3
222bc0df6d535b1238c541d06b0b35143a95124e
zhengyansheng/mygame
/api/v1/game_types.go
Go
go
3,608
no_license
/* Copyright 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 or agreed to in writing, software distributed un...
9214e64b00f40c0e2c5c917db6692bca45b7befa
aca6bb63dddc6536b80055550027516ac570586d
google/gapid
/cmd/robot/stash.go
Go
go
2,428
permissive
// Copyright (C) 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
51161bf7d15e5aea0cd0e5ee92fc774dc6eebd97
1f7d15e477efec73e57656b6b0a26cabbc2db075
DanielMSchmidt/goruby
/repl/repl.go
Go
go
2,619
no_license
package repl import ( "fmt" "io" "github.com/goruby/goruby/interpreter" "github.com/goruby/goruby/object" "github.com/goruby/goruby/parser" "github.com/pkg/errors" ) // Input defines the input interface for the repl type Input interface { // Readline returns the next line of input. When it returns io.EOF, the...
a5479b64abebed5c996e47c69be090875cbb67e6
dabf1b6884dc47bba24d322b9f675feb9f66fd8e
mei-rune/gojs
/stats/influxdb/bench_test.go
Go
go
1,995
no_license
/* * * k6 - a next-generation load testing tool * Copyright (C) 2019 Load Impact * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your o...
6afd37f5d689eb518a7dc9763266d72cc1b6432c
b809270c2ed6a19adf831396057e4f4c4b5a0093
jiangxuewen16/gostudy
/main_signal.go
Go
go
266
no_license
package main import ( "os" "syscall" "os/signal" "fmt" ) func main() { sinrev := make(chan os.Signal, 1) sigs := []os.Signal{syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL} signal.Notify(sinrev,sigs...) for sig := range sinrev { fmt.Println(sig) } }
592da67666e7bda9d15ea8dd92efc3cc994a5975
6d935a82aa53376511e8fc8179eeecd782a073c9
DerTiedemann/cluster-api-provider-hcloud
/controllers/suite_test.go
Go
go
2,779
permissive
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License ...
a2c475388cbaa6c59a470ecbfd314ff80dd51c67
e8bec83b03320272ee88dcf5a00a40e3df7d8367
pablodelarosam/Cloud-master
/backend/server.go
Go
go
1,809
no_license
package main import ( "fmt" "net/http" "encoding/json" "github.com/gorilla/mux" //mux stands for HTTP request multiplexer which matches an incoming //request to against a list of routes (registered) //mux sirve para solicitar router y dispatcher ) type Image struct { ID string `json:"id,omit...
91da4dfc6c9157448aae65489048e5f82206d90e
15c481bffa93acda118d93c853d169893dc17035
kyma-project/kyma
/components/event-publisher-proxy/pkg/sender/jetstream/health.go
Go
go
851
permissive
package jetstream import ( "net/http" "github.com/nats-io/nats.go" "github.com/kyma-project/kyma/components/event-publisher-proxy/pkg/handler/health" ) // ReadinessCheck returns an instance of http.HandlerFunc that checks the readiness of the given NATS Handler. // It checks the NATS server connection status and...
158c09598ecc13d58ac0e75fa0d456b272ef4096
9ba24b091fdd69b4bbcd8722c978fc03791d083f
morrell/pulumi-azure-native
/sdk/go/azure/botservice/listBotConnectionWithSecrets.go
Go
go
1,811
permissive
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package botservice import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Bot channel resource definition // API Version: 2021-03-01. func ListBotConnectionWi...
a70ff3cf3fd8328dd86f24690277f44c1eb4a979
4f05afb9782da997c31969068925ec6bce764723
johnnylee/gtk
/convert.go
Go
go
826
permissive
package gtk // #include <gtk/gtk.h> import "C" func StringToGChar(s string) *C.gchar { return (*C.gchar)(C.CString(s)) } func GCharToString(s *C.gchar) string { if s == nil { return "" } return C.GoString((*C.char)(s)) } func BoolToGBoolean(b bool) C.gboolean { if b { return C.gboolean(1) } return C.gboo...
716e599cfffdf511b7bb44d3e2afd1b13f09ead8
e7a175bc7666e55cf4f428beb6bc331a94c3ef2e
joy999/gf-boost
/net/gbhttp/ghttp_server_service_object_class.go
Go
go
11,364
permissive
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gbhttp import ( "fmt" "reflect" "strings" "time" ...
05183f94fc3035cb46d43d2c5106b39953043912
92775168b509087e1ef38c38d4874962b546b216
golang/pkgsite
/internal/frontend/breadcrumb.go
Go
go
2,636
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 frontend import ( "path" "golang.org/x/pkgsite/internal" "golang.org/x/pkgsite/internal/frontend/versions" "golang.org/x/pkgsite/internal/stdlib" ...
066eba56bf10ee4c01be39114b740524ab84babf
c1e381bafad64bb31df660ea85543902f83ec54c
sp98/cluster-proxy-addon
/vendor/github.com/zmap/zlint/v3/lints/rfc/lint_ext_cert_policy_explicit_text_not_utf8.go
Go
go
2,440
permissive
package rfc /* * ZLint Copyright 2020 Regents of the University of Michigan * * 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 requi...
d5b1abc872eeeed20c751f096743aeb641854fd9
ea8190c084a27a70b510a986d9982c32d337e79c
multiverse-os/codec
/crypto/algorithm.go
Go
go
1,223
no_license
package crypto import ( asymmetric "github.com/multiverse-os/codec/crypto/key/asymmetric" params "github.com/multiverse-os/codec/crypto/key/params" symmetric "github.com/multiverse-os/codec/crypto/key/symmetric" ) //////////////////////////////////////////////////////////////////////////////// const ( RSA = asy...
d2fc238e7b9c7d6cc6065866c838997eca97500c
71a793b1e8cac4b96ca731a35da6570f8ad912c9
sweb/wordcloud
/words/ngram_test.go
Go
go
3,347
no_license
package words import ( "reflect" "testing" ) type nGramKeyTest struct { ng NGram expected string } func TestNGramKey(t *testing.T) { testdata := []nGramKeyTest{ nGramKeyTest{NGram{"dies"}, "dies"}, nGramKeyTest{NGram{"dies", "ist"}, "dies ist"}, nGramKeyTest{NGram{"dies", "ist", "ein", "test"}, "die...
f31f5824c6ae0cdfd95170d2c51d2a0ec26bd034
f3ca245a6ad336197535c7ea380fa75b355a2c4f
Dk2014/GoTools
/src/github.com/lightpaw/male71/config/dianquan/dianquan.go
Go
go
718
no_license
package dianquan import "github.com/lightpaw/male7/util/check" //gogen:config type ExchangeMiscData struct { _ struct{} `singleton:"true"` _ struct{} `file:"点券/点券杂项.txt"` _ struct{} `proto:"shared_proto.DianquanMiscProto"` _ struct{} `protoconfig:"dianquan_misc"` ExchangeBaseYuanbao uint64 `validator:"int>0"` ...
43f077d07afa3422ef206e5bd2f09828d3f58b19
20c0564b01b17c64bb93236166fc725bf9dc46e8
wxw1198/levelDB
/goleveldb/leveldb/version.go
Go
go
15,972
permissive
// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com> // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package leveldb import ( "fmt" "sync/atomic" "time" "unsafe" "github.com/syndtr/goleveldb/leveldb/iterator" "github.c...
82e0906fdb04edd31329728aa79729bdef63d577
5c8f174619d9f2686492b9d58649680c8ba41b90
zeerorg/cron-connector
/vendor/github.com/openfaas/faas/gateway/requests/requests.go
Go
go
3,378
permissive
// Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // Package requests package provides a client SDK or library for // the OpenFaaS gateway REST API package requests // CreateFunctionRequest create a function in ...
f438fd288729d936cb552e862cfbdc1b3e04f374
248c03055a369b87f93804d947792bd4b8021c9b
vikram-donekal/go-rabbitmq
/consumer/app/bin/gorm/model_struct.go
Go
go
24,744
permissive
package gorm import ( "database/sql" "errors" "go/ast" "reflect" "strings" "sync" "time" "../../bin/inflection" ) // DefaultTableNameHandler default table name handler var DefaultTableNameHandler = func(db *DB, defaultTableName string) string { return defaultTableName } var modelStructsMap sync.Map // Mod...
fb30aa490d08b27857bf3dc027a6435658ea8536
3bb01ae385b75097e804a8aeca9d97e183daec78
hoangngth/Alive
/ToDoRestAPI/main.go
Go
go
553
no_license
package main import ( "log" "net/http" "github.com/gorilla/mux" router "Alive/ToDoRestAPI/http/router" ) func main() { r := mux.NewRouter() r.HandleFunc("/user/{userid}", router.GetToDos).Methods("GET") r.HandleFunc("/user/{userid}/{todoid}", router.GetToDo).Methods("GET") r.HandleFunc("/user/{userid}", ro...
cd11eb0e5d3cdda1cfd0bcde67ed6bf1a10a70c1
bda1080783c5b95fae7dfe6fc0c75eb4bd76ff1b
lukasmacko/c-vpp
/vendor/github.com/ligato/vpp-agent/plugins/defaultplugins/aclplugin/vppcalls/compatibility_check_vppcalls.go
Go
go
1,600
permissive
// Copyright (c) 2017 Cisco and/or its affiliates. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicabl...
8a74741ce6337ca8a906487f3d265eeebb758244
473e8d9b9b3ad2a2af2024be68d6cc68e7badd1f
Dynactionize/pgparser
/ast/zone.go
Go
go
3,949
permissive
// Copyright 2017 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
dd8665d2255cc041349dbce85b14c3e08469a351
1b9cad1ab71de7cb5a4681b8039f64bbbfe5be67
hufengfanhdu/LearnGo
/LearnGo/test2.go
Go
go
555
no_license
//控制流程 // defer 执行顺序为 栈式 package main import ( "fmt" ) func main() { /* * Switch 语句 */ // s := "a" // switch s { // case "a": // fmt.Println("Selecta a") // case "b": // fmt.Println("Selecta b") // default: // fmt.Println("Selecta else") // } /* * range */ // numbers := []int{1, 2, 3, 4} ...
05fa8b775964551b3376a14ad2ed47ab3e658d18
336187424fcc37c8baf27b8195a0eb5169f59c95
lasthyphen/paaro
/snow/networking/router/chain_router_test.go
Go
go
9,030
permissive
// (c) 2020 - 2021, Dijets, Inc. All rights reserved. // See the file LICENSE for licensing terms. package router import ( "sync" "testing" "time" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/lasthyphen/paaro/ids" "github.com/lasthyphen/paaro/snow" "githu...
82d84f2768b7397d3cd97acb812ac18176ab0399
75f4c1fbbced5a7ff11c206c242a95f9f3b687dc
dusk-network/dusk-blockchain
/pkg/core/consensus/agreement/store_test.go
Go
go
1,882
permissive
// This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT License was not distributed with this // file, you can obtain one at https://opensource.org/licenses/MIT. // // Copyright (c) DUSK NETWORK. All rights reserved. package agreement import ( "fmt" "testing" "github.com/dusk-...
ade7cd1c1dac5daea81a81431f85223785a48da1
9b4ef610175ccafc843cd82682291cae0cf59693
davidmukiibi/Go-practice-challenges
/isogram/isogram.go
Go
go
425
no_license
package isogram import ( "strings" ) // IsIsogram function takes i a word and checks it if it has any duplicate letters in in order // to determine if the word is an Isogram or not. func IsIsogram(word string) bool { var newMap = map[rune]bool{} word = strings.ToLower(word) for _, i := range word { if i == ' '...
2a5b2f32ae06405816d11edf6a0d54d85deec707
6f944a78b44d424719642d2fc41f37600a11aa3d
yfsuperman/blockchain_learning_go
/main.go
Go
go
228
no_license
package main import ( "github.com/yfsuperman/blockchain_learning_go/core" "github.com/yfsuperman/blockchain_learning_go/cli" ) func main() { bc := core.NewBlockchain() defer bc.Db.Close() cli := cli.CLI{bc} cli.Run() }
68ccb1c95617b82f56eaee7b0ee7b80ad6fb46ee
dc308352703c59c6cae592f679b55f860e060a83
alimy/ignite
/cmd/resume.go
Go
go
596
permissive
// Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved. // Use of this source code is governed by Apache License 2.0 that // can be found in the LICENSE file. package cmd import ( "github.com/spf13/cobra" ) func init() { resumeCmd := &cobra.Command{ Use: "resume", SuggestFor: []string{"sus...
f2e59d5cc92c4c1928acecd3e411d44eb6f7031a
8168b85d6c26ca6df097d2b0d0303a57a44c272b
james-portman/go-mona-lisa-ga
/mona.go
Go
go
8,310
no_license
package main import ( "fmt" "image" "image/color" "image/draw" "log" "os" // _ "image/gif" _ "image/jpeg" "image/png" "math/rand" "runtime" "sort" "time" ) type Point struct { x int y int w int h int } type Gene struct { r uint8 // red 0-255 g uint8 // green 0-255 b uint8 // blue 0...
f908c8298bf4e4233e27ad90e87860d5579717fd
a35cfddafb711ce13b950b13d51da4c86b6d0f6b
Project-XPolaris/YouDownload-Backend
/application/error.go
Go
go
240
permissive
package application import "github.com/allentom/haruka" func Abort500Error(err error,ctx *haruka.Context) { AppLogger.Error(err) ctx.Writer.WriteHeader(500) ctx.JSON(map[string]interface{}{ "success":false, "err":err.Error(), }) }
d154d82af4b45920818f85cfca47e5ddf4085df3
fdd17fb0976f5255a0afdd90cd1f9f69afa0932b
xiangsikai/kubernetes
/test/e2e/framework/kubelet/stats.go
Go
go
1,566
permissive
/* Copyright 2019 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, ...
4923b61b9d8a1915d2a4fd5df824a1924e1ebb79
a58cb77158ab5f37858cbec3eba2a4496df8447a
uberballo/web-scraper
/cmd/util/stringHandler.go
Go
go
803
no_license
package util import ( "regexp" "strings" ) //AppendSuffix appends suffix func AppendSuffix(list []string, suffix string) []string { var res []string for _, n := range list { res = append(res, n+suffix) } return res } //PrependPrefix prepends prefix func PrependPrefix(list []string, prefix string) []string { ...
b2a88fe1fe8521c0c603b5ef71915baadee52cbe
1b7990c80b5f96a08f63d3de0fe5c11924b9ca09
pubgo/uross
/uross/models/example.go
Go
go
1,036
permissive
package models import ( "github.com/jinzhu/gorm" "github.com/pubgo/g/xconfig" "github.com/pubgo/g/xconfig/xconfig_rds" "github.com/pubgo/g/xdi" ) func init() { var _ IExampleModel = (*Example)(nil) xdi.InitProvide(func(rds *xconfig_rds.Rds, cfg *xconfig.Config) IExampleModel { return &Example{db: rds.GetRDS(...
0b6c909eed97c25902afab3d1045f4175c80adbb
7f9e2c9f23bed87abe6169093d5ed18893ab44d3
mayadata-io/kubera-api-testing
/kubera/dmaas/credentials/add_credential_test.go
Go
go
5,216
permissive
package credentials import ( "os" "testing" ) func TestCredentialAddition(t *testing.T) { var ( awsAccessID = os.Getenv("AWS_ACCESS_ID") awsSecretKey = os.Getenv("AWS_SECRET_KEY") cloudianAccessID = os.Getenv("CLOUDIAN_ACCESS_ID") cloudianSecretKey = os.Getenv("CLOUDIAN_SECRET_KEY") minioAcc...
b07fac0ef2775869013a490ca740b893f2052127
d4da0ef99e7eee639debfea460ed1a5dbdfc758b
wanghaoxi3000/leetcode
/tree/preorder_traversal_test.go
Go
go
599
no_license
package tree import ( "reflect" "testing" ) func TestPreorderTraversal(t *testing.T) { testTree := &TreeNode{ Val: 1, Right: &TreeNode{ Val: 2, Right: &TreeNode{Val: 3}, }, } exceptRet := []int{1, 2, 3} var testRet []int testRet = preorderTraversalRecursion(testTree) if !reflect.DeepEqual(excep...
7ca6f197dc0a059cbee055b9b04df489eff8ca57
01b42feb2d83daf89264a570904408855dc0afe3
bitspill/go-ipfs
/core/coreapi/coreapi.go
Go
go
4,129
permissive
package coreapi import ( "context" core "github.com/ipfs/go-ipfs/core" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" namesys "github.com/ipfs/go-ipfs/namesys" ipfspath "github.com/ipfs/go-ipfs/path" resolver "github.com/ipfs/go-ipfs/path/resolver" uio "github.com/ipfs/go-ipfs/unixfs/io" cid "gx/...
e49f036d95960ecc856961addbd675cfa24f59bc
83a8fd492125705bf5321e9ab188f2db9f837268
francoishill/beegowebapp
/models/user_model.go
Go
go
2,630
permissive
package models import ( "fmt" "time" "github.com/astaxie/beego/orm" "./../utils" ) // global settings name -> value type Setting struct { Id int64 Name string `orm:"unique"` Value string `orm:"type(text)"` Updated string `orm:"auto_now"` } // main user table // IsAdmin: user is admininstator // I...
9fc27b0ad19d14b712d59e36b03dd6d388c38159
06796ab5d52b2bbb8d89df49b836dde153ef6042
GoogleCloudPlatform/terraform-google-conversion
/tfplan2cai/converters/google/resources/services/notebooks/iam_notebooks_instance.go
Go
go
7,270
permissive
// ---------------------------------------------------------------------------- // // *** AUTO GENERATED CODE *** Type: MMv1 *** // // ---------------------------------------------------------------------------- // // This file is automatically generated by Magic Modules and manual // changes ...
26c4ab39323084a751873c7bfc850d7b28a4cae1
1ce4235c0408efe49f96bcec31ca57666cd03eb2
tanyeun/go-bbs
/big5.go
Go
go
1,267
permissive
// Copyright 2020 Pichu Chen, The PTT APP 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...
e2022fd71399cd2796cdcb06c5eadfeaf2f1e3e3
a970216b9712cea1f99bf67faf9817d7d17e4e4c
yeqown/cached-repository
/lru/types.go
Go
go
1,229
permissive
package lru // EvictCallback . type EvictCallback func(k, v interface{}) // IterFunc . type IterFunc func(k, v interface{}) type entry struct { Key interface{} Value interface{} } type historyEntry struct { Key interface{} Value interface{} Visited uint } // Cache is the interface for simple LRU cache...
c92fa76348afcd641a34183a1c57112239518838
2faf9b7a22e2c1f2adc0361b25e580ef234b4e69
0daryo/pipe
/pkg/app/pipectl/cmd/event/register.go
Go
go
1,918
permissive
// Copyright 2021 The PipeCD 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...