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
2f0298cd1de0f5dfdf10d657716cf479aeed70f7
7126ccedf48d8ae76a5c8f06f37ef7f860d1b395
Balthazar6969/T2K
/highland2/highlandEventModel/v2r19/src/Versioning.hxx
C++
hxx
11,334
no_license
#ifndef VERSIONING_HXX_SEEN #define VERSIONING_HXX_SEEN #include "oaAnalysisReaderProjectHeaders.h" /// This file contains pre-processor directives related to the /// oaAnalysis file format that was used to generate the oaAnalysisReader classes /// Depending on the file format, different bits of highland need to /// ...
762b73cf4c9e15a340b6fe1ba5cd69076c07023d
7ce43d21e066e94e7833fb5ee793787a2b185d53
gost/godata
/example/main.go
Go
go
2,825
permissive
package example import ( . "godata" ) func HelloWorld() { } func CacheMiddleware() { } func AuthorizationMiddleware() { } func main() { provider := &MySQLGoDataProvider{ Hostname: "localhost", Port: "3306", Database: "Coffee", Username: "dev", Password: "dev", } roaster := provider.ExposeEnti...
c0dc36f6dbfebbdf6d56b18917c7d24d7b45d6d2
7edfd85b180879be5a5bd619ee8ba8f7c8cb0c34
xianlimei/acra
/acra-censor/acra-censor_implementation.go
Go
go
3,640
permissive
/* Copyright 2018, Cossack Labs Limited 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, softwa...
9001dc1dbce80b877a2364834a2047721ca56867
fc245c6d31e57d351ce3f4fe19c3fccdec8ad7c5
dhl1402/covidscript
/internal/builtin/iof.go
Go
go
962
no_license
package builtin import ( "fmt" "github.com/dhl1402/covidscript/internal/core" ) func IndexOf() *core.FunctionExpression { return &core.FunctionExpression{ Params: []core.Identifier{{Name: "array"}, {Name: "elem"}}, NativeFunction: func(ec *core.ExecutionContext) (core.Expression, error) { arg1, _ := ec.Get...
5deb873b27809f8408d680d8e6ae545779a43796
7392c4340991cd6d2666b0448b33bed10d4c6ef5
yichouchou/mosn
/vendor/github.com/wasmerio/wasmer-go/wasmer/exports.go
Go
go
5,324
permissive
package wasmer // #include <wasmer_wasm.h> import "C" import ( "fmt" "runtime" "unsafe" ) // Exports is a special kind of map that allows easily unwrapping the // types of instances. type Exports struct { _inner C.wasm_extern_vec_t exports map[string]*Extern instance *C.wasm_instance_t } func newExports(ins...
3026b4d7c9e05817aca60ba0249ed0441ed64108
ab48af2635d6792a7add0e571ed54304a49c2566
qw4990/tidb
/planner/core/exhaust_physical_plans.go
Go
go
146,678
permissive
// Copyright 2017 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
ff05ba3e3be6f97c15e7fadeb464b48cc7b0e0f1
18bd9a77c72ffe0717542f2ca169c172490dd818
NeoFive/micro-go-book
/ch3-basic/Callback.go
Go
go
217
permissive
package main import "fmt" func proc(input string, processor func(str string)) { processor(input) } func main() { proc("王小二", func(str string) { for _, v := range str{ fmt.Printf("%c\n", v) } }) }
fffd68227674193ac1ac4d0c6d60bf49ac398904
c6ddaca3f02d1daa7ff8237e17bb9f204869ee29
arpankundu007/golang-mysql-example
/repository/getAllData.go
Go
go
995
no_license
package repository import ( "mobile-specs-golang/constants" "mobile-specs-golang/models" "mobile-specs-golang/utils" "net/http" ) func GetAllData() http.Handler{ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request){ db := GetDB() defer db.Close() selDB, err := db.Query("SELECT * FROM " + ...
c142dc520dd53916b0522efdd643d0513879208d
63c2faf05f8f771d8725a89d3c6ce31f107d3bd7
shixufei/publication
/column/imooc/go-50tips/sources/method_set_4.go
Go
go
249
permissive
package main type Interface1 interface { M1() } type Interface2 interface { M1() M2() } type Interface3 interface { Interface1 Interface2 } type Interface4 interface { Interface2 M2() } func main() { DumpMethodSet((*Interface3)(nil)) }
695f7236a428344ba988939cfe56458333d51728
db3d60f2189f31c7491ff37d194998042cdc30e1
herneygr11/miscellany-exercises-golang
/01-operators/exercise-01/main.go
Go
go
750
no_license
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { scanner := bufio.NewScanner(os.Stdin) triangle := Triangle{base: 0, height: 0} fmt.Println("Bienvenido: ") for { fmt.Println("\nDigite la base") scanner.Scan() base, err := strconv.ParseFloat(scanner.Text(), 64) if err != nil { fm...
c8e1142346ab5711c57484828436308aade631b0
c4e76f72df074203e7cb9348d448a4cfd03bd812
Phaael/phaael-playground
/cmd/api/handlers/accounts/accounts_test.go
Go
go
8,847
no_license
package accounts_test import ( "context" "fmt" "net/http" "net/http/httptest" "strconv" "strings" "testing" "github.com/gin-gonic/gin" "github.com/phaael/phaael-playground/cmd/api/handlers/accounts" "github.com/phaael/phaael-playground/cmd/api/internal/errors" "github.com/phaael/phaael-playground/cmd/api/i...
d05b16ac7a0b2be66c096854a2c0cb640eb39462
cbbeb500c2629a63b374e8c4b0ecfbeabb75138f
rolsonquadras/sidetree-core-go
/pkg/internal/jws/signature.go
Go
go
3,375
permissive
/* Copyright SecureKey Technologies Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package jws import ( "crypto" "crypto/ecdsa" "crypto/ed25519" "crypto/elliptic" "encoding/json" "errors" "fmt" "math/big" "github.com/btcsuite/btcd/btcec" "github.com/trustbloc/sidetree-core-go/pkg/jws" )...
a39852d9817dd7f38ff0db1211ad373db9db5cb1
663e26b5bfc27e08ae98f9a0cb0de0ed3a15274a
trumanw/rclone
/fs/direntries_test.go
Go
go
615
permissive
package fs_test import ( "sort" "testing" "github.com/trumanw/rclone/fs" "github.com/trumanw/rclone/fstest/mockdir" "github.com/trumanw/rclone/fstest/mockobject" "github.com/stretchr/testify/assert" ) func TestDirEntriesSort(t *testing.T) { a := mockobject.New("a") aDir := mockdir.New("a") b := mockobject.N...
0855c0858ca1ab61ca54008553b133a0caf123ae
e8ec77f6d27994ca6ea53ae5a1c32667b6b5e8ae
wbtvc/gmqs
/topics/topics.go
Go
go
3,569
permissive
// Copyright (c) 2014 The SurgeMQ 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 ...
fe5c052a65df5be56b4326a8f3bf1fdc92b1ee0a
d28c0e7aafbcf533b2f8e1c875e240a5fcb6983f
k90s/go-skel
/config/config.go
Go
go
1,216
no_license
package config import ( "os" "path/filepath" "strconv" "github.com/spf13/pflag" "github.com/spf13/viper" ) var ( C config // Root 项目跟目录 Root string ) func init() { Root = os.Getenv("GOPATH") + "/src/github.com/kai-ding/go-skel" pflag.String("config", filepath.Join(Root, "config/config.yml"), "config file...
003a90c3955e17191b09bd0e8f0f8bc31c58c104
64207c3da25658dec51d8bf728102bba5b66665a
zzh-wisdom/pd
/client/client.go
Go
go
20,010
permissive
// Copyright 2016 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
77b7a89a6df2e5df4c61c366d8ec9cba22ef9c4b
72efd15a7c338e43ec2e5e131e3e0a527a93f5a5
splunk/splunk-operator
/pkg/splunk/enterprise/monitoringconsole_test.go
Go
go
34,594
permissive
// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by app...
60aaf2a130bb3332e6deabedbb636dd50a3588a7
8c6c8b601619012cde3813c79b17b91c9eff0a6c
nailanawshaba/shasthohub
/go/engine/login_load_user_test.go
Go
go
4,958
permissive
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package engine import ( "reflect" "testing" "github.com/keybase/client/go/libkb" keybase1 "github.com/keybase/client/go/protocol/keybase1" ) type luTest struct { name string input string ...
04e98e477f948cfca3368760fd413df8103a4b1a
dd1c1c04881460e7b7ebcc86201f208433437c3f
double12gzh/core
/utils/generics.go
Go
go
2,176
permissive
package utils import ( "golang.org/x/exp/constraints" "golang.org/x/exp/slices" ) type numbers interface { constraints.Integer | constraints.Float | constraints.Complex } // Map like map in Python func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2 { result := make([]T2, len(slice)) for i, v := range slice { ...
092eb1b3c090562b5333eedd09b7096a38024896
cf32c64b1b36d56e5a3368aa465483eb63ff3665
ericklaus-wf/go-rest
/rest/rule_test.go
Go
go
40,525
permissive
/* Copyright 2014 - 2015 Workiva, 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, softwar...
726d58655556f90daf13c01abe492e02a63ad20a
35bcf75d0bb000c494823e7fd10df8e56e2ef83d
190324/liontravel.tech
/backend/cmd/artisan.go
Go
go
3,809
no_license
package main import ( "liontravel.tech/internal/pkg/artisan/migrate" "liontravel.tech/internal/pkg/artisan/template" "bytes" "flag" "fmt" "log" "os" "os/exec" ) var ( cli *flag.FlagSet h bool name string createTableName string alterTableName string modelMigration bool migrateUp bool migrateDown bool ...
a5ee49036af117ec1a421fff5565bccebe7547c6
ee0ff303a56899549be6846599186b47e3733e86
yagihash/cli
/main.go
Go
go
303
permissive
package main import "os" const ( exitOK = iota exitError ) var ( // Version is semantic version of the tool, set by goreleaser Version = "" // Revision is commit hash of the build, set by goreleaser Revision = "" ) func main() { os.Exit(realMain()) } func realMain() int { return exitOK }
dc4756cd899a2cb2eb3ffc97021dfd389cd5f73a
82f9a36126d3ced994ee84497e956ef683f07a05
laudarch/iso20022
/CorporateActionOption102.go
Go
go
3,972
permissive
package iso20022 // Provides information about the corporate action option. type CorporateActionOption102 struct { // Number identifying the available corporate action options. OptionNumber *OptionNumber1Choice `xml:"OptnNb"` // Specifies the corporate action options available to the account owner. OptionType *C...
572b0be380534093081f26341ff7a1498dc09b31
8ffa9d37483679de3a8fe3537ddb63f79571b99a
gtalent/LiberatorAdventures
/Code/posts/web.go
Go
go
5,302
no_license
/* * Copyright 2011 <gtalent2@gmail.com> * This file is released under the BSD license, as defined here: * http://www.opensource.org/licenses/bsd-license.php */ package posts import ( "web" "strings" "strconv" "libadv/util" "libadv/char" "libadv/html" ) //The HTTP get method for getting the page for editin...
bf819457ec6a4841637b0c8fa49f65e1f7fcc01b
9d1f96031c63abbaa1401d5209faa4fcd806fceb
storageos/go-cli
/cmd/delete/delete.go
Go
go
1,404
no_license
package delete import ( "os" "github.com/spf13/cobra" "code.storageos.net/storageos/c2-cli/cmd/interfaces" "code.storageos.net/storageos/c2-cli/output" "code.storageos.net/storageos/c2-cli/output/jsonformat" "code.storageos.net/storageos/c2-cli/output/textformat" "code.storageos.net/storageos/c2-cli/output/ya...
e4f78fb2376780ef4c09785f7899a8b865c9e2bc
543a3ab6250e767d2bff39db1beb3424af8509c1
darshanpandya86/DataStructures
/HashTable/main.go
Go
go
1,134
no_license
package main import "fmt" const ArraySize = 7 //HashTable structure type HashTable struct { array [ArraySize]*bucket } //Insert into Hashtable func (h *HashTable) Insert(key string) { index := hash(key) h.array[index].insert(key) } //Search in hashtable /*func (h *HashTable) Search(key string) bool { index := ...
053977383188991e81a2a20d47af0c1349b184ff
d50126f9e9bb6fcedc2df2cc5245642beed3d7db
lhoward/zfsbackup-go
/backends/backblaze_b2_backend.go
Go
go
5,037
permissive
// Copyright © 2016 Prateek Malhotra (someone1@gmail.com) // // 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, m...
f016ef36d80713dcc619f4b129c7e1fc9b3eccf6
91e2d91882cd69e8ffa03de06e23f1454869a772
yunionio/sdnagent
/vendor/yunion.io/x/s3cli/api-put-object.go
Go
go
8,728
permissive
/* * MinIO Go Library for Amazon S3 Compatible Cloud Storage * Copyright 2015-2017 MinIO, 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/L...
9a3b4f8da1ef6a55b24363591d7ad20a04b5b17b
d228c6b6ad12a0ad57711a1260169e0e27192a39
deild/golog
/golog.go
Go
go
3,774
permissive
package main import ( "fmt" "os" "regexp" "time" "github.com/mitchellh/go-homedir" "github.com/urfave/cli" ) const alphanumericRegex = "^[a-zA-Z0-9_-]*$" const dbFile = "~/.golog" var dbPath, _ = homedir.Expand(dbFile) var repository = TaskCsvRepository{Path: dbPath} var transformer = Transformer{} var comman...
7db236f89ba35b6f695b46fb95ec65ac49d18c4d
df2f53155f216434cbc9f6e7aef31e0cf9132091
yys75477/myLibrary
/go-libary/go/utils/reqID.go
Go
go
950
no_license
package utils import ( "context" "time" "strings" "github.com/satori/go.uuid" ) var reqID struct{} var reqStartTime struct{} const () // SetReqID : 设置一个reqID func SetReqID(ctx context.Context) context.Context { uid, _ := uuid.NewV4() str := strings.Replace(uid.String(), "-", "", -1) c := context.WithValue(...
f100da0e0ee430c06a5ee0e18a64c1db226c98d5
7d9b75bbb12ecb4ef4b0be0cc6b5fe0bdd9138b3
stigsb/kubecd
/pkg/provider/provider.go
Go
go
1,386
permissive
package provider import ( "fmt" "github.com/zedge/kubecd/pkg/model" ) type ClusterProvider interface { GetClusterInitCommands() ([][]string, error) GetClusterName() string GetUserName() string GetNamespace(environment *model.Environment) string } type baseClusterProvider struct { *model.Cluster } func GetClu...
6920c697a04af31af0bc8618af312774103994c4
0281c9a912ef224182c217037ed85c65db7922bd
karim-en/kaspad
/rpc/log.go
Go
go
354
permissive
// Copyright (c) 2013-2016 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package rpc import ( "github.com/kaspanet/kaspad/logger" "github.com/kaspanet/kaspad/util/panics" ) var ( log, _ = logger.Get(logger.SubsystemTags.RPCS) spawn = p...
9d20cf632452bd9625f30c39ae94d79954b63f5c
e0e77120da3cdd83d1235448d960e76769d96735
marc47marc47/notes
/Golang/ringbuffer.go
Go
go
4,213
no_license
/* 声明:本代码来自skoo87,淘宝工程师,非原创 用途:用来替代channel,提高海量数据收发的性能 缺点:暂时只支持一个写 案例: ring := ringbuffer.NewRing(100, 1000) // 一个写端 go func() { var wbuf *ringbuffer.Buffer for i := 0; i < 10000; i++ { wbuf = ring.Write(wbuf, i) } ring.Stop(wbuf) }() // 10个读端 var wg sync.WaitGroup for i := 0; i < 10; i++ ...
399afa86648402665b1f18d2d4f7581d9ea7f41a
bec05ae4e599510e204748ee004e80b812606c33
otakubeam/rice2
/.local/bin/go/pkg/mod/maunium.net/go/tcell@v0.2.0/terminfo/terminfo.go
Go
go
18,587
permissive
// Copyright 2019 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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 ...
602ecc43c225028e3ac400a1aeccf234543779f3
18f15472798be1a9b67e74fc09baba760c39f4db
pRizz/openbazaar-go
/vendor/github.com/cpacia/BitcoinCash-Wallet/config.go
Go
go
2,848
permissive
package bitcoincash import ( "net" "net/url" "os" "path/filepath" "runtime" "time" "github.com/OpenBazaar/wallet-interface" "github.com/btcsuite/btcd/chaincfg" "github.com/mitchellh/go-homedir" "github.com/op/go-logging" "golang.org/x/net/proxy" ) type Config struct { // Network parameters. Set mainnet, ...
40b35654e2448426107ffbc05d818810c2be8bd5
ece9cb319e753e2fb9bd4548c447f481872706d5
raj347/Olivia
/parser/parser_test.go
Go
go
2,203
permissive
package parser import ( "github.com/GrappigPanda/Olivia/network/message_handler" "testing" ) var MESSAGEHANDLER = message_handler.NewMessageHandler() func TestParseFailInvalidCommand(t *testing.T) { parser := NewParser(MESSAGEHANDLER) _, err := parser.Parse("XYZalsdkj", nil) if err == nil { t.Fatalf("Command...
5c4968b3ca01083c94df92906754f771394a4b32
421d75600ef813b345d483265ea0c330b36c7947
wenger67/gin-vue-admin
/server/service/adDeviceConfig.go
Go
go
2,760
permissive
package service import ( "panta/global" "panta/model" "panta/model/request" ) // @title CreateAdDeviceConfig // @description create a AdDeviceConfig // @param adDeviceConfig model.AdDeviceConfig // @auth (2020/04/05 20:22) // @return err error func Create...
d6b91d97d895b0a993be7feb2e5b0cf458ecfb45
022bdbc17aefecf64fe647cccb016dc572930561
bbokorney/dockworker
/job_updater.go
Go
go
3,466
permissive
package dockworker import ( "time" log "github.com/Sirupsen/logrus" ) // JobUpdater handles updating jobs type JobUpdater interface { UpdateStatus(job *Job, status JobStatus) error UpdateStartTime(job *Job, startTime time.Time) error UpdateEndTime(job *Job, endTime time.Time) error AddCmdResult(job *Job, resul...
ecff53a497f3dc8932cb2324b75e167d9fa72b74
6385187460a61e4ade579c4dcf5762ab0495540f
hurner/leetcode-go
/0797-all-paths-from-source-to-target/main.go
Go
go
820
no_license
package main import "fmt" func main() { fmt.Println(allPathsSourceTarget([][]int{[]int{1, 2}, []int{3}, []int{3}, []int{}})) } func traverse(elem, target int, parentPath []int, traversed map[int]bool, res *[][]int, graph [][]int) { currentPath := append([]int{}, parentPath...) currentPath = append(currentPath, ...
9439b6a0c73eacefc36e5637b3dd28cd691d0f16
97e8bc7d903b8162887c7be92c4ab69c8ab302c9
jhand2/quicksync
/watcher.go
Go
go
1,592
permissive
package main import ( "fmt" "log" "os" "path/filepath" "regexp" "github.com/fsnotify/fsnotify" ) type WatchCallback func(e fsnotify.Event) type FileWatcher struct { w *fsnotify.Watcher } func (f *FileWatcher) Init() { var err error f.w, err = fsnotify.NewWatcher() if err != nil { log.Fatal(err) } } f...
38d239ddcc89a7e5bd3efcad61732fccb0b0af58
3c741d2b757d2dc010e392c92f29b913945178ec
rerun1129/hogosuru
/example/routing/view/Hello.go
Go
go
694
permissive
package view import ( "github.com/realPy/hogosuru" "github.com/realPy/hogosuru/document" "github.com/realPy/hogosuru/htmldivelement" "github.com/realPy/hogosuru/node" ) type HelloView struct { view *htmldivelement.HtmlDivElement } func (w *HelloView) Node() node.Node { return w.view.Node } func (w *HelloView...
6fc7fbbfb53eed87bb2a830e52b54d0a01379bd0
d2762a43a84400b88b810c5e4b040becd4175c18
cedricgc/kubernetes
/pkg/cloudprovider/providers/azure/azure_controller_standard.go
Go
go
5,807
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, ...
e910a1f147760a68de604ecc5acf2aa2b9bf8b95
44d8c67a4e3695d56e47d08fccd528f38c7e7b86
sudeepgoyal75/terraform-provider-nuagenetworks
/4.0.10.2/nuagenetworks/data_source_nuagenetworks_bgpprofile.go
Go
go
5,039
no_license
package nuagenetworks import ( "fmt" "github.com/hashicorp/terraform/helper/schema" vspk "github.com/tpretz/vspk-go/vspk/4.0.10.2" "github.com/nuagenetworks/go-bambou/bambou" ) func dataSourceBGPProfile() *schema.Resource { return &schema.Resource{ Read: dataSourceBGPProfileRead, S...
082c0970c478972b2d77637dac1f46366dfe127e
39e8c4b906b07f701d27a4f63bd96287ec0d2703
left2right/redis-port
/pkg/rdb/decoder.go
Go
go
3,017
permissive
// Copyright 2014 Wandoujia Inc. All Rights Reserved. // Licensed under the MIT (MIT-LICENSE.txt) license. package rdb import ( "bytes" "github.com/cupcake/rdb" "github.com/cupcake/rdb/nopdecoder" "github.com/left2right/redis-port/pkg/libs/errors" ) func DecodeDump(p []byte) (interface{}, error) { d := &decode...
a6762d69b41b8889f26a6959d393118c636d2dd8
306799b1a26c4420694d8ec890aad7e24d02e46e
chrisaandes/Zero-GO-Ninja
/Ninja-Level-Nine/exercise-3.go
Go
go
316
no_license
package main import ( "fmt" ) func main() { c := gen() recibir(c) fmt.Println("A punto de finalizar.") } func recibir(c <-chan int) { for v := range c { fmt.Println(v) } } func gen() <-chan int { c := make(chan int) go func() { for i := 0; i < 100; i++ { c <- i } close(c) }() return c }
296362ac63f8b83186328ffc2e01a20958ae7850
ab0736fd47d7b2e8846e2a897d1b355ddbb561ec
favish/argo
/cmd/root.go
Go
go
2,563
no_license
package cmd import ( "fmt" "os" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/favish/argo/cmd/components" "github.com/favish/argo/cmd/project" ) var cfgFile string var RootCmd = &cobra.Command{ Use: "argo", Short: "Argo allows developers to quickly get started developing and configuring Fav...
50e289a7e657d5dfd9fabdf9a5c1241286ff961b
348ab051b8fdf866e28ba97965820e72e2f527d0
goakshit/gogrpc
/main.go
Go
go
6,841
no_license
package main import ( "context" "fmt" "log" "net" "time" "gogrpc/blogpb" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.o...
c8c03064d25dcda3e5102e06bd75f3ba1184c356
959f9b2de6c13b28fd60e54ba4d150126283824c
nahidhasan98/bootcamp
/lecture_20/main.go
Go
go
3,554
no_license
package main import ( "fmt" "html/template" "net/http" "os" "github.com/mateors/mcb" ) //var db *sql.DB var db *mcb.DB func init() { // Open up our database connection. // I've set up a database on my local machine using phpmyadmin. // The database is called testDb //db, err = sql.Open("mysql", "root:test1...
54ca19fc8f58bb99b92eb54ce72eac20fae73870
43742072e6c2f1d824c8a1dea039b0cf9b63f0b7
gitter-badger/wizard
/orm/xorm/xorm_test.go
Go
go
5,712
no_license
package xorm import ( "os" "testing" "time" "github.com/evalphobia/wizard" "github.com/go-xorm/xorm" _ "github.com/mattn/go-sqlite3" "github.com/stretchr/testify/assert" ) var ( dbUser01Master, dbUser01Slave01, dbUser01Slave02 Engine // user A dbUser02Master, dbUser02Slave01, dbUser02Slave02 Engine // user ...
c2fecf19ac7e9cdc87d58f8182a3d8c8270c4852
580d86bb63cb4e194beaf3c4fe18f5e58615e4e9
champly/mosn
/pkg/protocol/xprotocol/dubbothrift/codec.go
Go
go
1,293
permissive
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
4ecee943982266b41f2e1bb48041e97a746fda9d
12ca1f96b5ad52ba5aedd7fe9baa2e044fb3e7ca
rogervaas/aws-operator
/service/controller/legacy/v26/resource/cpi/delete.go
Go
go
3,009
permissive
package cpi import ( "context" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/giantswarm/microerror" "github.com/giantswarm/operatorkit/controller/context/finalizerskeptcontext" "github.com/giantswarm/aws-operator/service/controller/legacy/v26/controllercontext" ...
7a3aa7e8248a66978e6e648b0e2e59eb41589a14
5ad8637a2f2c053f59747d8a46af96ff382cd42e
adrianpk/boletus
/internal/model/user.go
Go
go
5,845
no_license
package model import ( "database/sql" "fmt" "strings" fnd "github.com/adrianpk/foundation" "github.com/adrianpk/foundation/db" uuid "github.com/satori/go.uuid" "golang.org/x/crypto/bcrypt" ) type ( // User model User struct { fnd.Identification Role sql.NullString `db:"role" json:"role" sch...
dce041eb7a3a531841e7b5a9ac7868422ff92504
6b66233b0a2ee649113505c40f65b0d119f04c0c
geodatalake/geom
/encoding/wkb/polygon.go
Go
go
633
permissive
package wkb import ( "encoding/binary" "github.com/geodatalake/geom" "io" ) func polygonReader(r io.Reader, byteOrder binary.ByteOrder) (geom.Geom, error) { var numRings uint32 if err := binary.Read(r, byteOrder, &numRings); err != nil { return nil, err } rings := make([]geom.Path, numRings) for i := uint32...
10b0b1d5430d0de51cdfe9e830321feec0e6c529
0b08d7cdcc0aadcc950afe0cf0ec47e1b985fa27
JazzNetCodingTest/GolangTest
/pkg/odd_digit_finder.go
Go
go
294
no_license
package main import ( "strings" "strconv" ) /* * sticking with simple string.containsany to find the odd digist since we have only 5 odd digits */ func noOdddigits(input int) (a bool) { inputs := strconv.Itoa(input) odddigits := "13579" return !strings.ContainsAny(inputs, odddigits) }
1b366b40a41a93609cf4711e3ed29c5e21e7309a
1073de4a466d5df368e20dd5b88f7dad249e499b
dgoodwin/cluster-operator
/pkg/controller/nodeconfig/nodeconfig_controller_test.go
Go
go
3,709
no_license
/* 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, ...
44bfab4b360f083bce071d79b20dc39bfae6856b
a0d7bb79c14a0b839170836a2694cec6fb399c16
JosiahWitt/go-intro
/part1/code/10/main.go
Go
go
832
permissive
package main import ( "fmt" ) type Todo struct { Title string Done bool } func main() { todos := []*Todo{ { Title: "Write Intro to Go (part 1)", Done: false, }, { Title: "Listen to the Go Time podcast", Done: true, }, { Title: "Read the Golang Weekly email", Done: false, }, { ...
7693970c2e8801e6a99e132aa23a497f92b89ee7
9fcd152043cdd30a8ed76f2367f30353620d1b16
bastelfreak/go-choria
/client/choria_provisionclient/action_release_update.go
Go
go
4,615
permissive
// generated code; DO NOT EDIT" // // Client for Choria RPC Agent 'choria_provision' Version 0.23.0 generated using Choria version 0.23.0 package choria_provisionclient import ( "context" "encoding/json" "fmt" "io" "sync" "github.com/choria-io/go-choria/protocol" rpcclient "github.com/choria-io/go-choria/prov...
17c5aca6030e216100a56def6860a744a1a576e6
7adadc1b1b44f3bdeb9d07ea52985e8cbbd69d21
zhaoxiangchun/onecloud-operator
/pkg/manager/component/component.go
Go
go
32,061
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...
a92c251eafd4d66f10f6cbb2ae32e6663a87760e
6abb627d29f5a06ac757cd8a36560db2193e11a1
test-wiz-sec/pulumi-azure-nextgen
/sdk/go/azure/azuredata/v20190724preview/sqlManagedInstance.go
Go
go
6,495
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 v20190724preview import ( "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) // A SqlManagedInstance. type SqlManagedInst...
9dd5ddc682c609c2f90b6dabf67dd871ddceaf8a
2b1e378a676afdc6c0e8378d16a13550fd1bb9fe
vinocr/angular_sample
/server/rest/microservice_controller.go
Go
go
12,310
permissive
//Copyright 2017 Huawei Technologies Co., Ltd // //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agr...
a1a90dbe11dbbe04b36228ca10bdae356d7cc08a
b9bf220f5e1bd60d622b7b693e9b2dcf554d968e
advanderveer/factory
/engine/agent.go
Go
go
3,934
no_license
package engine import ( "context" "encoding/json" "time" "github.com/advanderveer/factory/model" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" "github.com/pkg/errors" ) var ( //MaxAgentShutdownTime determines how long the agent gets for a shutdown MaxAgentShutdownTime = time...
0f895c4ae1e4c4fd401751dc572b07ae8171164c
c84c30d2ed88d75c16fcfa1f262454620ff315ed
pfista/go-ipfs
/namesys/republisher/repub.go
Go
go
3,276
permissive
package republisher import ( "errors" "sync" "time" key "github.com/ipfs/go-ipfs/blocks/key" namesys "github.com/ipfs/go-ipfs/namesys" pb "github.com/ipfs/go-ipfs/namesys/pb" path "github.com/ipfs/go-ipfs/path" "github.com/ipfs/go-ipfs/routing" dhtpb "github.com/ipfs/go-ipfs/routing/dht/pb" peer "gx/ipfs/Qm...
96557992af78338106bc071bd2c9cca92d463c0c
6b6a4fd6ef06d1103beb322a253926c8af5c3d00
jtremback/althead
/neighborAPI/neighbor-api_test.go
Go
go
3,839
no_license
package neighborAPI import ( "net" "testing" "github.com/agl/ed25519" "github.com/incentivized-mesh-infrastructure/scrooge/types" ) var ( iface = &net.Interface{ Name: "foo0", } account1 = &types.Account{ PublicKey: [ed25519.PublicKeySize]byte{0x3b, 0xee, 0xb8, 0xd0, 0x2, 0x7c, 0x31, 0x38, 0x1a, 0xc2, 0x...
7f006c5079faeb60c6c5375fcc35c8e6a07c9e3c
aee562ccb32b49d141fc192a2e994e1ebdfaf65a
sambasallah/sourcegraph
/enterprise/cmd/frontend/internal/auth/githuboauth/middleware_test.go
Go
go
12,079
permissive
package githuboauth import ( "bytes" "context" "io" "net/http" "net/http/httptest" "net/url" "strings" "testing" "golang.org/x/oauth2" "github.com/sourcegraph/sourcegraph/cmd/frontend/auth/providers" "github.com/sourcegraph/sourcegraph/cmd/frontend/external/session" "github.com/sourcegraph/sourcegraph/en...
8f9e2cdfa454069e5db5ddc8f8ceee052808e3cf
80ac1793bf650c0ed3a9809924720ddbccc88b58
baveltman/golang_react_skeleton
/main/static_asset_handler.go
Go
go
628
no_license
package main import ( "net/http" "os" "fmt" ) func InitStaticAssetServer() http.Handler{ var staticFilesPath string = "" isDocker := os.Getenv(ENV_DOCKER) if isDocker != "" { pwd := os.Getenv(ENV_DIR_ENTRY) if pwd == "" { fmt.Println("Missing ENV " + ENV_DIR_ENTRY) os.Exit(1) } staticFilesPath = p...
c7ab22cc9771f6768f9722e9d724a0fb1d57dea2
e222bfbe0dd62309cca43185a1dff19150b624ca
fengyuwusong/face_score_backend
/src/pkg/config/config.go
Go
go
1,166
no_license
package config import ( "os" "io/ioutil" "gopkg.in/yaml.v2" "github.com/sirupsen/logrus" ) type Config struct { HttpServer HttpServer Mysql Mysql RabbitMQ RabbitMQ } type HttpServer struct { Port int Mode string Tag string } type Mysql struct { Host string Port int Username string Pass...
92fbf59e645e1766dbda4fde414a15f10a55e3b1
71ae81c98c843ff151cacffe06806c10ac1e95a6
kubesphere/kubesphere
/vendor/github.com/elastic/go-elasticsearch/v6/esapi/api.indices.get_mapping.go
Go
go
6,683
permissive
// Code generated from specification version 6.8.2: DO NOT EDIT package esapi import ( "context" "net/http" "strconv" "strings" "time" ) func newIndicesGetMappingFunc(t Transport) IndicesGetMapping { return func(o ...func(*IndicesGetMappingRequest)) (*Response, error) { var r = IndicesGetMappingRequest{} f...
498abca5fc72083b94bfea4573d64511c40c5571
339a189706651b65cf71de847c76756136baf2cf
streamnative/pulsarctl
/pkg/ctl/namespace/set_ns_anti_affinity_group.go
Go
go
3,423
permissive
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
c774271162f56cd06517ab8f5594fce304ea3dc9
aba294318b27c4f70a9d4af71da36099bd0c822e
jorditpuig/gauth
/gauth.go
Go
go
1,801
no_license
package main import ( "bytes" "crypto/aes" "crypto/cipher" "crypto/sha256" "encoding/csv" "fmt" "io/ioutil" "log" "os" "os/user" "path" "strings" "syscall" "text/tabwriter" "github.com/pcarrier/gauth/gauth" "golang.org/x/crypto/ssh/terminal" ) func main() { user, e := user.Current() if e != nil { ...
c478da72ae9b3f769ae536db77741bec74f9fc2d
c6421fe51e9980447bda5202fae1d3b2d71692d3
congweitao/harbor
/src/pkg/scan/scanner/manager.go
Go
go
3,933
permissive
// Copyright Project Harbor Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
d3d67a200314fb1a7e9ab24f0a4861224fc32c7b
3e1e627fd9b712d41163e40bc948a49bbe99b78c
LongJohnCoder/sourcegraph
/enterprise/internal/insights/background/queryrunner/worker.go
Go
go
8,737
permissive
package queryrunner import ( "context" "database/sql" "fmt" "time" "github.com/cockroachdb/errors" "github.com/inconshreveable/log15" "golang.org/x/time/rate" "github.com/sourcegraph/sourcegraph/internal/conf" "github.com/keegancsmith/sqlf" "github.com/lib/pq" "github.com/sourcegraph/sourcegraph/enterp...
c89fe5e655797671c2251dfa301dd2ed5adb32a6
df2c4c57f8a9eba52f4a42ae2af1d618df45daec
oklays/golang-restapi
/main.go
Go
go
5,474
no_license
package main import ( "encoding/json" "fmt" "log" "math/rand" "net/http" "regexp" "strconv" "github.com/dgrijalva/jwt-go" "github.com/gorilla/mux" "github.com/oklays/golang-restapi/config" "github.com/oklays/golang-restapi/src/middleware" "github.com/oklays/golang-restapi/src/modules/user/repository" ) ...
13b7d7becdc644d2f7954d028fa236357f4d6163
19b02e18f7c6fd89a79647653ddfb8c7a516fa8a
jyoshise/fissile
/model/roles.go
Go
go
4,612
permissive
package model import ( "crypto/sha1" "encoding/hex" "fmt" "io/ioutil" "path/filepath" "sort" "gopkg.in/yaml.v2" ) const ( boshTaskType = "bosh-task" boshType = "bosh" ) // RoleManifest represents a collection of roles type RoleManifest struct { Roles []*Role `yaml:"roles"` Configuratio...
76d39c0ec3b62cb2706cdf7ecf2b0624ac43def0
1dc0ef2a729ec89af65d07d765f36317e41f3ed5
buchanae/ink
/sketches/008_boxbox.go
Go
go
905
no_license
package main import ( . "github.com/buchanae/ink/dd" "github.com/buchanae/ink/gfx" "github.com/buchanae/ink/rand" ) const ( GridSize = 20 Boxes = 7 LineWidth = 0.0015 SkipCellChance = 0.05 SkipBoxChance = 0.20 Shrink = 0.0050 Angle = 0.2 ) func Ink(doc gfx.Doc) { rand...
ccdec007d5716d81bf1017e7d7b0a7df9515ff05
9353d94c99915d6a1352840be347838ab076890c
ajbodoc/go-ejemplos
/webServer2.go
Go
go
412
no_license
// Web Server package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", handler) //cada petición manda a llamar un handler log.Fatal(http.ListenAndServe("localhost:8000", nil)) } //handler echoes the Path component of the request URL r. func handler(w ht...
9eecd65492b3b547cb948bc84908a4922677ae8a
f3c1718bfb779d02ba7b472c3ce89b5cf8309e85
freemed/gokogiri
/css/css.go
Go
go
11,421
permissive
package css // package main import ( "fmt" "strings" "github.com/freemed/rubex" ) type Lexeme int const ( SPACES Lexeme = iota COMMA UNIVERSAL TYPE ELEMENT CLASS ID LBRACKET RBRACKET ATTR_NAME ATTR_VALUE EQUALS CONTAINS_CLASS DASH_PREFIXED STARTS_WITH ENDS_WITH CONTAINS MATCH_OP PSEUDO_CLASS ...
2f96b3a7a79c0265e0a001f31a942d5a7775f1a1
5cebff955acf34d01f0d55cb28dd0491cbba73a9
AnchorFree/data-go
/pkg/event_selector/selector_test.go
Go
go
464
no_license
package event_selector import ( "github.com/stretchr/testify/assert" "testing" ) func TestEventSelector_ApplyConfig(t *testing.T) { config := Config{ ConsulAddress: "", ConsulKeyPath: "", } es := NewEventSelector(config) selectors := &Selectors{ Selectors: []Selector{ { TargetTopic: "test", Mat...
fc87a2f7ab58f6993d3b3b7ca48b6ea5ac0642b3
03ad9ad90a9563d20302d33fa0bfa600f22b676a
ziipin-server/niuhe
/svrjs/orm/model.go
Go
go
4,432
no_license
package orm import ( "reflect" "github.com/robertkrimen/otto" "github.com/go-xorm/xorm" ) type model struct { engine **xorm.Engine singleType reflect.Type sliceType reflect.Type } func NewModel(m interface{}, engine **xorm.Engine) *model { t := reflect.TypeOf(m) return &model{ eng...
f0955c892447bd9d1cb3b0153b76ad3197797fb1
c31db8f81a56db08f849fc5eafb7d6daf68c13de
phpscriptsolutions/cli
/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha1/memcached_helpers.go
Go
go
4,622
permissive
package v1alpha1 import ( "fmt" apps "k8s.io/api/apps/v1" apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" crdutils "kmodules.xyz/client-go/apiextensions/v1beta1" meta_util "kmodules.xyz/client-go/meta" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" mona "kmodules....
6ce4f8385862ad084edf786d0d96e2426f64161e
fd69bcc04e1d8ec57965b0c53306b9696ff6aa22
osbuild/osbuild-composer
/vendor/github.com/oracle/oci-go-sdk/v54/core/change_network_security_group_compartment_request_response.go
Go
go
3,915
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
a56a0a6720253991c160230eeff299a0f21fbe85
4c55af5c189184c6e6e5634925bfcd2643c0b28b
GinoLucianoRojo1993/coreos-assembler
/gangplank/vendor/github.com/containers/common/pkg/config/default.go
Go
go
15,612
permissive
package config import ( "bytes" "fmt" "os" "os/exec" "path/filepath" "regexp" "strconv" "github.com/containers/common/pkg/apparmor" "github.com/containers/common/pkg/cgroupv2" "github.com/containers/storage/pkg/homedir" "github.com/containers/storage/pkg/unshare" "github.com/containers/storage/types" "gi...
728f6d65aaa6b74310306b1e0744c05589d31196
8368922752455c27a2867e0473534ef020ac9153
asutosh97/exposure-notifications-server
/internal/admin/exports/form.go
Go
go
1,880
permissive
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
7bbf36275955321b08620ec2b32607167c42a11f
a1686388f74a0a250e50f156bc53632e23a8792e
junjieguo/note_junjie
/golang/src/toposort.go
Go
go
1,230
no_license
package main import ( "fmt" "sort" ) var prereqs = map[string][]string{ "algorithms": {"data structures"}, "calculus": {"linear algebra"}, "compilers": { "data structures", "formal languages", "computer organization", }, "data structures": {"discrete math"}, "databases": {"data struc...
1547cca1bbfd3584dfb1e45606eaf7f6ce8c0e44
551dbf18fe0d72fc19d88e912881605f997cf2ac
MisinformedDNA/pulumi-azure-native
/sdk/go/azure/labservices/v20181015/getEnvironment.go
Go
go
2,936
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 v20181015 import ( "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) // Represents an environment instance func LookupEnvironment(ctx *pulumi.Context, args *...
088e2dd5696a66cb8a98220e67c7e97be543d725
3028283f33163093f5ad14d41d33c447be54ecbd
dapperlabs/kitty-items
/kitty-items-go/config.go
Go
go
1,022
no_license
package main import ( "fmt" "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" ) type Config struct { FlowNode string `default:"localhost:3569"` MinterFlowAddressHex string `required:"true"` MinterPrivateKeyHex string `required:"true"` MinterSigAlgoName string `default:...
2fe63f06faf8b684b01910e35e250a7169d05308
e2600ccade1e47b787164763d6cd4401d25cde26
ryandamour/cobra-example
/cmd/stop.go
Go
go
1,572
permissive
/* Copyright © 2019 Luke Reed 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 dis...
80f3cf4027accaabe270e0283e5936d20e9ae30e
7a4196838aa26359af7d869807c77d279a67b733
crazyrex/starter
/common/service.go
Go
go
275
permissive
package common type Service struct { Name string GitRepo string GitBranch string Command string BuildCommand string DeployCommand string Ports []*PortMapping EnvVars []*EnvVar BuildRoot string Databases []Database }
302c6e5dde026bddf4e165110bb28880420901e4
7bfe08d77a9f0e1db86113be91da6cc802d9030b
twgcode/sparrow
/util/log/loggerconfig_test.go
Go
go
888
permissive
/** @Author: wei-g @Date: 2020/6/29 5:51 下午 @Description: */ package log import ( "testing" ) func TestSimpleFormat(t *testing.T) { logger := &LoggerConfig{ OutputConsole: false, OutputFile: false, SplitWriteFromLevel: false, LowLevel: "LowLevel ", HighLevel: "HighL...
1d332e3eee0318fe1b9a1442fb20e6219a1b58dc
c2719bbb1148470eaea4bb8fd7e49524892afb93
jskelcy/m3db
/persist/fs/clone/cloner.go
Go
go
1,513
permissive
package clone import ( "fmt" "io" "time" "github.com/m3db/m3db/persist/encoding/msgpack" "github.com/m3db/m3db/persist/fs" "github.com/m3db/m3db/ts" ) type cloner struct { opts Options } // New creates a new fileset cloner func New(opts Options) FilesetCloner { return &cloner{ opts: opts, } } func (c *c...
d1ba08deb0d8be8cb5f4eb0bdfcb87c2adada658
e7b9629d12f734c5e6e1fd81220c9a7b1ab88884
99designs/gqlgen
/_examples/starwars/resolvers.go
Go
go
9,226
permissive
//go:generate rm -rf generated //go:generate go run ../../testdata/gqlgen.go package starwars import ( "context" "encoding/base64" "errors" "strconv" "strings" "time" "github.com/99designs/gqlgen/_examples/starwars/generated" "github.com/99designs/gqlgen/_examples/starwars/models" ) type Resolver struct { ...
7a10f4a5389078582b0514b97fa5157ed377e3c4
162895ee2fba9c70960a08dbde68dbc2287e7c72
benjaminbear/docker-ddns-server
/dyndns/ipparser/ipparser_test.go
Go
go
576
permissive
package ipparser import ( "testing" ) func TestValidIP4ToReturnTrueOnValidAddress(t *testing.T) { result := ValidIP4("1.2.3.4") if result != true { t.Fatalf("Expected ValidIP(1.2.3.4) to be true but got false") } } func TestValidIP4ToReturnFalseOnInvalidAddress(t *testing.T) { result := ValidIP4("abcd") if...
bf984085751e980768b0a37088653c2c6363ad48
b7909ebfd3e305834ed756a5d91cf001c78cbbe5
hhhizzz/leetcode_golang
/108/main.go
Go
go
329
no_license
package _108 type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func sortedArrayToBST(nums []int) *TreeNode { if len(nums) == 0 { return nil } mid := len(nums) >> 1 root := &TreeNode{Val: nums[mid]} root.Left = sortedArrayToBST(nums[:mid]) root.Right = sortedArrayToBST(nums[mid+1:]) retur...
bfde5176596df8c6399bb177a67058fdb2a526be
c1c209ffba4761ddb90cca622039b3aee1b88eb6
tom2jack/DistributedCrawler
/src/scrawler/downloader.go
Go
go
545
permissive
/* * 下载器(Downloader) for worker * 用于下载网页内容, 并将网页内容返回给蜘蛛(Scrapy下载器是建立在twisted这个高效的异步模型上的) */ package scrawler import ( "fmt" "time" ) func Downloader(cookie, url string) { fmt.Println(time.Now().Format("2006-01-02 15:04:05") + " scrawler.go Downloader begin url: " + url) resp, _ := DoRequest(`GET`, url, `...
6940b5d138cbef36797024128924baf1476f0642
1c0ae70de7301851d3fc7173b87bb7afb2b7298e
graphprotocol/cosmos-sdk
/x/genutil/types/genesis_state_test.go
Go
go
3,704
permissive
package types_test import ( "encoding/json" "testing" "cosmossdk.io/math" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cos...
944b644db2da86fd8fb15b0c83ef58171b9e55ca
109a193c41bad7612521aa49d6f49dfe3de7c7a2
ryanjdew/go-marklogic-go
/test/testHelper.go
Go
go
2,828
permissive
package test import ( "fmt" "net/http" "net/http/httptest" "reflect" "testing" "github.com/davecgh/go-spew/spew" clients "github.com/ryanjdew/go-marklogic-go/clients" handle "github.com/ryanjdew/go-marklogic-go/handle" testHelper "github.com/ryanjdew/go-marklogic-go/test/text" ) // Client is exported for te...
cb4f1d9a1e250602272b73f1bcff0202dab9e50b
ee6b160b382f8565e9dc73451134dfc51dbf3952
another2one/learn-go
/designPattern/adapter/utils/player.go
Go
go
576
no_license
package utils import "fmt" type MediaPlayerInter interface { Play(fileName string) } type MediaPlayer struct{} func (mediaPlayer MediaPlayer) Play(ext, fileName string) { var media MediaPlayerInter switch ext { case "mp3": media = Mp3{} media.Play(fileName) case "mp4": media = Mp4{} media.Play(fileName...
7948648b5c5f5c15232065267f07e385ade6cc4a
3f7b2645293b94b4e1f7899d395524bc02033322
zhou7069/star-edge-cloud
/edge/rules_engine/bussiness/rule_engine.go
Go
go
1,642
permissive
package bussiness import ( "encoding/xml" "star-edge-cloud/edge/models" "star-edge-cloud/edge/models/constant" "star-edge-cloud/edge/transport/client" "star-edge-cloud/edge/transport/client/configuration" "star-edge-cloud/edge/transport/coding/json" "star-edge-cloud/edge/utils/common" "time" "github.com/caib...
056e3a2d60e546755815c0d040f53298ec1807f8
bf3ca2db3abb4ec4b76c3fcb399f9ebeae54b303
GaoShou012/shop
/mainUsers.go
Go
go
217
no_license
package main import ( _ "github.com/go-sql-driver/mysql" _ "github.com/models" //greeter "github.com/protoBuf" "github.com/routers" ) func main() { r := routers.InitRouterForUsers() r.Run("0.0.0.0:8081") }
799c36de3c915dad5646e761c902d50ad50bd7b1
77de1cab976784724beaf95ba23cccb051956826
test-wiz-sec/pulumi-azure-nextgen
/sdk/go/azure/eventgrid/v20190101/getTopic.go
Go
go
1,186
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 v20190101 import ( "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) func LookupTopic(ctx *pulumi.Context, args *LookupTopicArgs, opts ...pulumi.InvokeOption...
96686f418b1797419033a4a20afab2a482b414a4
1ff1b4713322701681891c642ddd8dbeb5c16059
wudi/sourcegraph
/enterprise/internal/codeintel/api/exists.go
Go
go
2,976
permissive
package api import ( "context" "strings" "github.com/inconshreveable/log15" "github.com/pkg/errors" "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/bundles/client" "github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/store" ) // FindClosestDumps returns the set of dumps that can ...