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
4bd5216cbd897ee846b9cea2b93aaaaadd35881e
a3351b140d820488cb242eefd6b0ec5efd19af4e
lucastetreault/did-tangaroa
/mvcc/metrics_txn.go
Go
go
1,893
permissive
// Copyright 2017 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
a81296ccf2d4607e29a1043ef98186bce08acf29
d8670c57f799808da00eb4c9f6e82cfb55cd1b58
wangkekekexili/imageland
/simple/contrast.go
Go
go
660
no_license
package simple import ( "image" "image/color" ) const ( minContrast = -255 maxContrast = 255 ) func Contrast(input image.Image, contrast int) image.Image { if contrast < minContrast { contrast = minContrast } if contrast > maxContrast { contrast = maxContrast } factor := 259 * float64(contrast+255) / (2...
26e8c1da0999ba2f30fb966f2802ee709cf9978e
4f9556a4b88645a988d7eab358d0a56297772f28
hashfabric/exchain
/x/stream/market_keeper.go
Go
go
2,374
permissive
package stream import ( "encoding/json" "fmt" "github.com/okex/exchain/x/backend/types" "sort" "strconv" "strings" "time" "github.com/tendermint/tendermint/libs/log" "github.com/okex/exchain/x/backend" "github.com/okex/exchain/x/stream/pushservice/conn" ) type MarketKeeper backend.MarketKeeper type BaseM...
b1dad2b1b305300a731a922e4f58e4d3f2c5cc79
5601b95c10b350cafd704d01a6518d6a30c76593
harryleonardo/go-nats
/shared/nats/nats.go
Go
go
1,235
permissive
package nats import ( // nats "github.com/nats-io/go-nats" SharedConfig "github.com/github-profile/go-nats/shared/config" nats "github.com/nats-io/nats.go" ) type ( // NatsInterface ... NatsInterface interface { GetNatsSession() (ec *nats.EncodedConn, err error) PublishMessage(ec *nats.EncodedConn, NatsSubj...
cff4dd3fc75c3f5ba0297602e95a2b88741a880c
a2bb8c562eacea8cc41a4656d43b2362fa7f9f6b
xiaoquanjie/global_server_fk
/fk/go/src/new_deploy/deploy/deploy.go
Go
go
2,092
no_license
package deploy import ( "common/logger" "fmt" ) type Deploy struct { cmd string pattern string user string passwd string confs []string deployData DeployData } func (d *Deploy) Init(cmd string, pattern string, user string, passwd string, confs []string) bool { d.cmd = cmd d.pattern = pattern d.user = user...
36916e0e630462a78a999f303d62d65a21823c6b
308e09fbdc2dc79eecee448a47e46baf3415e751
cfi2017/drg-go
/pkg/save/util.go
Go
go
244
no_license
package save import "io" func setPos(s io.Seeker, offset int64) (int64, error) { return s.Seek(offset, io.SeekCurrent) } func getPos(s io.Seeker) int64 { pos, err := s.Seek(0, io.SeekCurrent) if err != nil { panic(err) } return pos }
f35c9ed8d8625a934711721a4a661d239d0f78ff
52648af45759fa5b09b321fef5624c6ee0a3d63f
AliyunContainerService/minikube
/pkg/minikube/bootstrapper/bsutil/binaries.go
Go
go
3,090
permissive
/* Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
358f9b985a8e18abfdcb1a8e4e30295d52bd5131
49391a4fe2cbfffa9ff9bd9cde656e3bcb882360
lawliet89/lego
/providers/dns/inwx/inwx.go
Go
go
4,442
permissive
// Package inwx implements a DNS provider for solving the DNS-01 challenge using inwx dom robot package inwx import ( "errors" "fmt" "time" "github.com/go-acme/lego/v3/challenge/dns01" "github.com/go-acme/lego/v3/log" "github.com/go-acme/lego/v3/platform/config/env" "github.com/nrdcg/goinwx" ) // Config is us...
0bc132f98f9c0bfc10466d3ca5eefd65baf9ad5c
36467ace07eb52825577be058c1cce53182ba0a3
drewwells/go-bitpay-client
/key.go
Go
go
3,071
permissive
package go_bitpay_client import ( "math/big" btcaddr "github.com/drewwells/gimme_bitcoin_address" "github.com/drewwells/go-bitpay-client/encoding/base58" ) type PublicKey []byte const ( MAIN = 0x01 TESTNET = 0x11 EPHEMERAL = 0x02 ) // Create a new Bitcoin compliant private and public key // pair. func...
c6d732b40334bc94bab0e6142b5b6a27c6562083
9989a68d66191b14c4d31b7741e313f4084723dc
objecthub/containerkit
/buffers/stack.go
Go
go
1,758
permissive
// Copyright 2014 Matthias Zenger. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by appl...
37257e0fc8ac5a5bf561e6f7ffabc7cc7606686c
f1cebf3455640c715ba4bff6faee6e2237b72f2a
bradberger/myflyingbox-go
/api.go
Go
go
6,708
permissive
// Package myflyingbox implements a Go REST client for the MyFlyingBox API package myflyingbox import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "log" "net/http" "strings" "golang.org/x/net/context" ) const ( // ProductionURL is the production API base endpoint ProductionURL = "https://api.myfly...
9bfa5711e04e5280a88cc407fb650ed56f540a0e
743b59f541a6d804303137872b4ae3d70392923b
abhijitherekar/istio-envoy-sds-plugin
/sds/server.go
Go
go
12,896
no_license
package sds import ( "crypto/x509" "encoding/pem" "fmt" "net" "os" "time" "context" "go.uber.org/zap" "google.golang.org/grpc" v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2" "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth" "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" s...
9df59267ca6c30cfd85fd5c757f0c8784cd5d36b
d3dadefe69e881441a8937bd74fb4b85b522f54e
cgorenflo/fabric
/vendor/github.com/sirupsen/logrus/json_formatter.go
Go
go
2,349
permissive
package logrus import ( "bytes" "encoding/json" "fmt" ) type fieldKey string // FieldMap allows customization of the key names for default fields. type FieldMap map[fieldKey]string // Default key names for the default fields const ( FieldKeyMsg = "msg" FieldKeyLevel = "level" FieldKeyTime = "time" ) func ...
6cb6c27a52c590a6000802d6c402f60b862d3fc3
f315654285632a4426ecca783cde5aa4e70a0053
shzawa/gowebprog
/ch04/03body/server.go
Go
go
439
no_license
// リスト4.3 // http://localhost:8080/body package main import ( "fmt" "net/http" ) func body(w http.ResponseWriter, r *http.Request) { len := r.ContentLength body := make([]byte, len) r.Body.Read(body) fmt.Fprintln(w, string(body)) } func main() { server := http.Server{ Addr: "127.0.0.1:8080", } http.Handle...
67b2ad93cd19d16986c02fc9779787a2cca7ae37
2033fbbf166e61e3c2798217e1abd5d32cf3f39b
doumadou/CrawlSite
/crawl.go
Go
go
5,540
no_license
package main import ( "fmt" "net/url" "net/http" "io/ioutil" "log" "regexp" "time" "strings" "strconv" ) type FileInfo struct { FilePath string FileSize int64 } type TorrentInfo struct { Title string Hashinfo string FileType string CreateTime time.Time FileSize int64 FileCount int FileList []FileInfo } v...
796632008d8c054f1f6a4d7e659a30ce38e3c6de
de2c7da9bddd49463ff958221c98be29fadf6b24
x3d97/goRest
/api/users/deleteUser.go
Go
go
364
permissive
package api import ( "github.com/x3d97/goRest/api" "github.com/x3d97/goRest/db" "net/http" "github.com/gorilla/mux" ) func DeleteUser(w http.ResponseWriter, req *http.Request) { params := mux.Vars(req) id := params["id"] if err := db.Remove(id); err != nil { api.HandleError(err, "Failed to remove item: %v...
415ae249e891a410c5a5bc05724ac96e1148ce57
165526d15b6f3cb6c4262feb75b53ded0402d715
divyanshgaba/go-agent
/v3/newrelic/synthetics_test.go
Go
go
7,689
permissive
// Copyright 2020 New Relic Corporation. All rights reserved. // SPDX-License-Identifier: Apache-2.0 package newrelic import ( "encoding/json" "fmt" "net/http" "testing" "github.com/divyanshgaba/go-agent/v3/internal" "github.com/divyanshgaba/go-agent/v3/internal/cat" "github.com/divyanshgaba/go-agent/v3/inter...
b0c3ed8adfcd5fe2a4a775ee74b1b08a76792044
69b5a034738ab5f9edc4e18fe1433c5f02e6b7c6
devasiajoseph/wemebox
/db/sqlite/connect.go
Go
go
397
no_license
package sqlite import ( "log" "github.com/devasiajoseph/wemebox/core" "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" ) var DB *sqlx.DB func connectSQLiteDB() *sqlx.DB { log.Println(core.AbsolutePath("dbf/wemebox.db")) db, err := sqlx.Open("sqlite3", core.AbsolutePath("dbf/wemebox.db")) if err != n...
248587406b39c8dbb8329a94ff5fb09fbcdd2849
b1bc0a23346e294f181a163ad151dbf4504ca673
freebz/Go-in-Practice
/ch02/ex2-18.regex_handlers.go
Go
go
1,479
no_license
// Listing 2.18 Resolve URLs using regular expressions: regex_handlers.go package main import ( "fmt" "net/http" "regexp" "strings" ) func main() { rr := newPathResolver() rr.Add("GET /hello", hello) rr.Add("(GET|HEAD) /goodbye(/?[A-Za-z0-9]*)?", goodbye) http.ListenAndServe(":8080", rr) } func newPathReso...
721aa4b37912c9d9661088e9b72ce0cd8af131fb
d4a9e19f650b57ad797dbb9ef2061df5fa73b222
autumn0632/autumn
/go/code/es/bulk.go
Go
go
2,460
no_license
package es import ( "context" "fmt" "strconv" "reflect" "github.com/olivere/elastic/v7" ) var ( indexName = "subject" servers = []string{"http://localhost:9200/"} ) type Subject struct { ID int `json:"id"` Title string `json:"title"` Genres []string `json:"genres"` } func main() { ctx := c...
44bdaac3e65686c979c09b5e7a89302932b07d7d
fba048796ed6fbf3d44cf090a519d7b9c82eb267
skupperproject/skupper
/test/utils/constants/constants.go
Go
go
1,162
permissive
package constants import ( "os" "time" "github.com/skupperproject/skupper/api/types" "k8s.io/apimachinery/pkg/util/wait" ) const ( // until this issue: https://github.com/skupperproject/skupper/issues/163 // is fixed, this is the best we can do SkupperServiceReadyPeriod time.Duration = 10 * time....
f48821e5ff1b8e6ace6a260441cca7bba9f9b20a
1b31be76156f0cfebbc78f46d5ec45ca5caaaec3
plinde/elasticsearch-curator-go
/cmd/root.go
Go
go
2,594
permissive
// Copyright © 2017 NAME HERE <EMAIL ADDRESS> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
efc6be0ef5ddb3161dc25f092f4b992cf979f0ea
f87b96bdb4c1b1e95d449a439750b8f63dcb71e8
ryo-kagawa/go-utils
/arrays/reduce_test.go
Go
go
1,727
permissive
package arrays import ( "reflect" "strconv" "testing" ) func Test_reduce_Interface(t *testing.T) { type args struct { list interface{} fn interface{} } tests := []struct { name string r reduce args args want interface{} }{ { name: "func([]int(nil), func(acc string, cur int, i int, src []i...
a4d9a34b2143b1f1d9f3a1346bba0cfea5c3e9f3
e740249440fe05471003d59b71060840b48ee44a
ema-corp/lessonEcho
/3.解説資料/6.静的ファイル/server.go
Go
go
312
no_license
package main import ( "github.com/labstack/echo" "github.com/labstack/echo/middleware" "net/http" ) func hello(c echo.Context) error { return c.String(http.StatusOK, "ok\n") } func main() { e := echo.New() e.Use(middleware.Static("./static")) e.GET("/hello", hello) e.Logger.Fatal(e.Start(":1323")) }
e8f6ed404594682172a5d8d39661d68b02aa1ed1
742b562210ff69d2042535944d0ba3ba2b53e617
jloescher/learn-how-to-code-golang
/Ninja 9 - Concurrency/Exercise3.go
Go
go
1,029
no_license
package main import ( "fmt" "runtime" "sync" ) /* Using goroutines, create an incrementer program - have a variable to hold the incrementer value - launch a bunch of goroutines - each goroutine should - read the incrementer value - store it in a new variable - yield the processor with runtime.Gosched() -...
ca2072ada33b9b789e19235251072cb67098cba9
569b18f0d5377a2cd9888089fa4cf377f8f86aeb
chumga01/sourcegraph
/monitoring/monitoring/monitoring.go
Go
go
27,062
permissive
package monitoring import ( "errors" "fmt" "math/rand" "strings" "time" "github.com/grafana-tools/sdk" ) // Container describes a Docker container to be observed. // // These correspond to dashboards in Grafana. type Container struct { // Name of the Docker container, e.g. "syntect-server". Name string // ...
5b92e58a5bf21db7c6bac8fc14bcb97dfe97c863
1898d327b6443a9698c793b90b0716b35126d676
amwork2020/goLearning
/31zapgo-logger/main.go
Go
go
1,700
no_license
package main import ( "net/http" "go.uber.org/zap" "go.uber.org/zap/zapcore" "gopkg.in/natefinch/lumberjack.v2" ) //zap-go logger日志记录器 var logger *zap.Logger // var sugarlogger *zap.SugaredLogger // func initLogger() { // logger, _ = zap.NewProduction() // sugalogger = logger.Sugar() // } //Encoder:编码器,如何写...
e79471fb4e1ed61255b1b4f41783486ac7ccb6e9
f8c8ae751ef8ba64188271444c7f48cc4b4e50ab
ittw84/pd
/server/join.go
Go
go
6,371
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...
6c683772bcccc9e6e9fe1b1092f0b9a4567ae69e
1aeec93cac67779790295dbad6cff81acbbef74a
lei314121077/novel
/web/conf/logger.go
Go
go
387
no_license
package conf import ( "time" "log" "net/http" ) // 包装http.HandlerFunc,打印日志信息 func LoggerHandlerFunc(inner http.HandlerFunc, handlerFuncName string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { start := time.Now() inner.ServeHTTP(w, r) log.Printf("%s\t%s\t%s\t%s.\n", r.Method, r.R...
202d54a52545938bdcb3ee011b21dc1dafd1a2cc
8a11990b9d76e35ee7f80f08779cf14ff557ae84
yak-labs/chirp-lang
/cli/chirp/main.go
Go
go
317
permissive
package main import ( _ "github.com/yak-labs/chirp-lang/goapi/default" _ "github.com/yak-labs/chirp-lang/http" _ "github.com/yak-labs/chirp-lang/img" _ "github.com/yak-labs/chirp-lang/posix" _ "github.com/yak-labs/chirp-lang/rpc" ) import ( "github.com/yak-labs/chirp-lang/cli" ) func main() { cli.Main() }
44057ca3c5a81313e471baeb753ae3eb5a0f73f0
977a339f473fe167f987538f05f9ac2bbbc8800d
aberic/gnomon
/balance/random.go
Go
go
1,698
permissive
/* * Copyright (c) 2020. aberic - All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law...
041221762f6852c46360418494d4320ee8c23a2f
c54a7adfe613b42b528bca11ca94053635116de0
jankuo/iconv
/iconv.go
Go
go
2,371
no_license
// // iconv.go // package iconv // #cgo darwin LDFLAGS: -liconv // #cgo freebsd LDFLAGS: -liconv // #cgo windows LDFLAGS: -liconv // #cgo linux LDFLAGS: -liconv // #include <iconv.h> // #include <stdlib.h> // #include <errno.h> import "C" import ( "bytes" "io" "syscall" "unsafe" ) var EILSEQ = syscall.Errno(C.E...
cbc938a8f4a59f10949b35cce7760374e712655f
104b3a5b05aa0998233d554fb38c067a95e93944
729535180/beego_weihuaijing
/models/adminuser.go
Go
go
673
no_license
package models import ( "time" ) type AdminUser struct { Id int `json:"id"` Accounts string `json:"accounts"` Password string `json:"password"` Username string `json:"username"` GroupId string `json:"group_id"` Level int `json:"level"` Status int `json:"...
335ec7b72ce98e367767c85d33adc2aa713b9bc7
ce382b95646a69dcffdd1e462c321641306c9cd7
curder/go-gin-demo
/controllers/UserController.go
Go
go
3,710
no_license
package controllers import ( "github.com/curder/go-gin-demo/commons" "github.com/curder/go-gin-demo/models" "github.com/curder/go-gin-demo/resources" "github.com/curder/go-gin-demo/responses" "github.com/curder/go-gin-demo/utils" "github.com/gin-gonic/gin" "golang.org/x/crypto/bcrypt" "log" "net/http" ) // 注...
ff92dc8e4e3d80ada5ac28d4911a9c9d4a7f517d
7558de83b8136e43cae6582513c32c6a5ae3c917
wsoyinka/warewulf
/internal/pkg/warewulfd/kmods.go
Go
go
655
permissive
package warewulfd import ( "github.com/hpcng/warewulf/internal/pkg/kernel" "log" "net/http" ) func KmodsSend(w http.ResponseWriter, req *http.Request) { node, err := getSanity(req) if err != nil { w.WriteHeader(404) log.Println(err) return } if node.KernelVersion.Defined() == true { fileName := kerne...
586adfcd2cbeb3193b3271a2046a711d639588b4
ad62caa4fc49b32a818494304dc33638d0491b38
mihasya/gddo
/doc/builder.go
Go
go
13,445
permissive
// Copyright 2011 Gary Burd // // 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 wr...
f75e58b33fb4a50e1c727241039f2df1470be9b8
ce59d7e58090bb33a0dd2a3d52b776b02be8d43d
kunaaljain/dgraph
/gql/state_test.go
Go
go
1,779
permissive
/* * Copyright 2015 Manish R Jain <manishrjain@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appl...
9bc041af227d83391e9bc3d8e5e46bc8659fec63
20afd1a566817bdf7743b9fc4d41deca3f0296a2
cucy/learnlanguage
/go/learn_go/my/17_interfaces/04_method-sets/01_value-receiver_value-type/main.go
Go
go
320
no_license
package main import ( "fmt" "math" ) type circle struct { radius float64 } type shape interface { area() float64 } func (c circle) area() float64 { return math.Pi * c.radius * c.radius } func info(s shape) { fmt.Println("area", s.area()) } func main() { c := circle{5} info(c) } // area 78.53981633974483
b0e720a76af8b78a1c212b4e4b65ab193dbe8afa
eee95f8d2e715ec3b37f673712167c382e140eec
Florimond/onedev-api
/projects_setting.go
Go
go
4,695
no_license
package onedev_api import ( "bytes" "encoding/json" "fmt" "io/ioutil" "log" ) type ProjectSetting struct { BranchProtections []BranchProtections `json:"branchProtections"` TagProtections []TagProtections `json:"tagProtections"` IssueSetting IssueSetting `j...
f184328b81215121dc94630b470d4b057c0d52d8
d216dc1dd9b525f6bf723d15863466e35a182ef6
suwang48404/antrea
/test/e2e/fixtures.go
Go
go
8,720
permissive
// Copyright 2019 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
2e21cdc3aec43e5aff213ae8a67cdece9c45cf59
839d11a4694471e8d9225fb67db49869e9c188f2
Anaethelion/go-packages
/log/logger/fatals/fatalln/main.go
Go
go
216
no_license
package main import ( "log" "os" ) func main() { logger := log.New(os.Stdout, "Logged: ", log.Lshortfile) // Fatalln is equivalent to l.Println() followed by a call to os.Exit(1). logger.Fatalln("Fatalln") }
6c93c6f9a0d9110312e53e68996a98fbffffa99a
a2f8c9bd9d506bf1bf3757eb90a28cf9d6eb8106
bryanasdev000/postgres_exporter-1
/collector/stat_replication.go
Go
go
2,939
permissive
package collector import ( "context" "net" pgx "github.com/jackc/pgx/v4" "github.com/prometheus/client_golang/prometheus" ) /* When pg_basebackup is running in stream mode, it opens a second connection to the server and starts streaming the transaction log in parallel while running the backup. In both connection...
5a9cfcd9b39112a95386bbc9f62fe57a956479dc
1eba26a04d97693ad49678f001502762003e8266
pigxo/eos-go
/crypto/ecc/pubkey.go
Go
go
4,312
permissive
package ecc import ( "bytes" "encoding/json" "fmt" "strings" "github.com/eosspark/eos-go/crypto/btcsuite/btcd/btcec" "github.com/eosspark/eos-go/crypto/btcsuite/btcutil/base58" "golang.org/x/crypto/ripemd160" ) const PublicKeyPrefix = "PUB_" const PublicKeyPrefixCompat = "EOS" type PublicKey struct { Curve ...
13dac2f12e0ae1bf19fe9e686d4c8fb70ef8af10
8d832c9ccc97bcbbb59ab418efac0d70c01395c7
travisperson/go-ipfs
/commands/http/multifilereader_test.go
Go
go
2,893
permissive
package http import ( "io" "io/ioutil" "mime/multipart" "strings" "testing" files "github.com/jbenet/go-ipfs/commands/files" ) func TestOutput(t *testing.T) { text := "Some text! :)" fileset := []files.File{ &files.ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader(text))}, &files.SliceFile{"boop"...
049a8b8dc2de556706654c6182586b018d240892
f7b27fb1e3820ec96b55f67f0abf2b88ba541ef6
eelcocramer/sockjs-go
/sockjs/session.go
Go
go
5,701
permissive
package sockjs import ( "encoding/gob" "errors" "io" "net/http" "sync" "time" ) // SessionState defines the current state of the session type SessionState uint32 const ( // brand new session, need to send "h" to receiver SessionOpening SessionState = iota // active session SessionActive // session being c...
6ebeb61f1cf375a744700bfac54402e7634b6561
32cc0db36c75439977f53d2ef42275c1039b2239
renithas/gopl.io
/ch05/sum/sum.go
Go
go
390
permissive
package main import "fmt" func main() { fmt.Println(sum()) // 0 fmt.Println(sum(1)) // 1 fmt.Println(sum(1, 2)) // 3 fmt.Println(sum(1, 2, 3)) // 6 fmt.Println(sum(1, 2, 3, 4)) // 10 numbers := []int{1, 2, 3, 4} fmt.Println(sum(numbers...)) // 10 } func sum(vals ...int) int { tot...
56d65e9026386fe900accd30361f46ee4f43fca9
5c30c2cb836c058657463145f0d081de59dbd002
Miss-you/istio
/security/pkg/server/ca/server_test.go
Go
go
16,633
permissive
// Copyright 2017 Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
82ee50eddc9e2162b2d1e3abd6052c9beaf7c9ba
2d8c1a45380bfe391da5605ce1b3d1690110fa67
lanius412/todo_app
/app/controllers/server.go
Go
go
1,875
no_license
package controllers import ( "net/http" "fmt" "html/template" "regexp" "strconv" "os" "todo_app/config" "todo_app/app/models" ) func generateHTML(w http.ResponseWriter, data interface{}, filenames ...string) { var files []string for _, file := range filenames { files = append(files, fmt.Sprintf("app/view...
d706fa2ce4e7d5ad7aedf0035d750280690e8aec
f7e6e6e649200e957a69d26bc0f965c24c76636f
huaweicloud/huaweicloud-sdk-go-v3
/services/ges/v1/model/model_delete_graph_request.go
Go
go
612
permissive
package model import ( "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils" "strings" ) // DeleteGraphRequest Request Object type DeleteGraphRequest struct { // 图ID。 GraphId string `json:"graph_id"` // 删除图后是否保留备份,默认保留1个自动备份和2个手动备份。该查询参数为空时,表示不保留。 KeepBackup *bool `json:"keepBackup,omitempty"` } func (o...
f46379b4a4e1effec3d3f7a23d37fd23a08c4048
cc15c6c9bbf55b18c08bd9b8586480565b95f717
open-domophone/soft-omega2
/network/webrtc.go
Go
go
4,291
no_license
package network import ( "encoding/base64" "github.com/pions/webrtc" "github.com/pions/webrtc/pkg/ice" "../message" ) // Пример // https://github.com/pions/webrtc/issues/209 type WebRTC struct { // Полученные данные от мобильного приложения // (могут быть не только аудиопакеты, но сообщения установки соедине...
8043e3807be4e1d62b515d8c6cb9ab8620a37bdd
8e21558728f78128cab72d301e62abef050f322c
gocircuit/escher
/be/noun.go
Go
go
1,831
permissive
// Written in 2014 by Petar Maymounkov. // // It helps future understanding of past knowledge to save // this notice, so peers of other times and backgrounds can // see history clearly. package be import ( "fmt" "io" "io/ioutil" . "github.com/gocircuit/escher/circuit" ) // Sink func NewSink() Materializer { r...
5832719471581687109e01a253e84936c8897c94
cf3eab2400e5e58fddaf56ee20607e24bc44b722
guangyw/kf
/cmd/controller/main.go
Go
go
2,047
permissive
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
0a6e16f69d07c483feb91128392186164ee2b51c
1507006b4e5fdb12a1745eadac34699094bd8af7
voicihojun/gostudy
/gostudy/src/unit34/exe5/main.go
Go
go
289
no_license
package main import ( "fmt" ) func producer(c chan<- int) { for i:=0; i<5; i++ { c <- i } c <- 100 } func consumer(c <-chan int) { for i:= range c { fmt.Println(i) } fmt.Println(<-c) } func main() { c := make(chan int) go producer(c) go consumer(c) fmt.Scanln() }
aa1f7034439593b6780774a6ffd2c8b2bd4b060d
a74d9e72ef9315aca86d3a76bcf290b21271aebe
223n/terraform-provider-sakuracloud
/sakuracloud/resource_sakuracloud_mobile_gateway_static_route.go
Go
go
5,079
permissive
package sakuracloud import ( "fmt" "bytes" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/sacloud/libsacloud/api" "github.com/sacloud/libsacloud/sacloud" ) func resourceSakuraCloudMobileGatewayStaticRoute() *schema.Resource { return &schema.Resource...
e16d577f4209c422438ca84acaf85541a3cb47c5
06911df8fed20a14cb0712377b8275905cf9f705
cryptnotiq/testapp
/cmd/frakcli/main.go
Go
go
4,781
no_license
package main import ( "fmt" "os" "path" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos...
28a0c675f21ac2f047196a7a9c7070d5f6448d87
9c15b94b22467afee1ba51169315c0b5354168b4
HastingsYoung/gravel
/main.go
Go
go
4,704
no_license
package main import ( "fmt" "github.com/gorilla/websocket" . "github.com/gravel/app" . "github.com/gravel/exchange" . "github.com/gravel/models" "net/http" "os" "time" ) var ( upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, } exchange = NewExchange() ) const ...
c4161a07943670ea9e2401ff5a5c412352afdfaa
9e7fade03da527aef4ae1b0a4cd221f7eb7a7651
drone789/beegoblog
/controllers/base.go
Go
go
604
no_license
package controllers import ( "jikeblog/models/class" "github.com/astaxie/beego" ) type BaseController struct { beego.Controller } func (c *BaseController) Prepare() { if c.IsLogin() { c.Data["user"] = c.GetSession("user").(class.User) } } func (c *BaseController) DoLogin(u class.User) { c.SetSession("user"...
647c407ec8a0ac5a64ac3ab184f858a2c7ee0eb5
ac4ab2391988453586518fed1d3f960bfa997729
mikeqian/beego
/context/context.go
Go
go
4,282
permissive
// Copyright 2014 beego Author. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
fe816d6d0f43ef6a269fbd17999436d5c79530de
3f105dfc0f615f5ce89e975b16df18cc9140a23e
filecoin-project/venus
/pkg/net/network.go
Go
go
5,859
permissive
package net import ( "context" "sort" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/metrics" network2 "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" basichost "github.com/libp2p/go-libp2p/p2p/host/basic...
80949b185cb45a80b163f5bf4687e19c9aabaacd
b9b89282dd64351ebb9458b940b3a2905c5dc3c5
cloudnautique/ci-tool
/report.go
Go
go
2,675
no_license
package main import ( "encoding/xml" "fmt" "io/ioutil" "os" log "github.com/Sirupsen/logrus" ) type TestSuiteReport struct { Errors int Skips int Failures int Tests int Time string Skipped []JUnitTestCase Failed []JUnitTestCase Errored []JUnitTestCase Format *TestSuiteReportFormat } ...
0e9bd8e4887d9e8cf7e9ac3474e49e07f61252f9
d07db3f803d2e0e308d9960bd3246868dd01fc1e
vivimouret29/pulumi-azure-native
/sdk/go/azure/sql/v20200202preview/serverTrustGroup.go
Go
go
4,756
permissive
package v20200202preview import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type ServerTrustGroup struct { pulumi.CustomResourceState GroupMembers ServerInfoResponseArrayOutput `pulumi:"groupMembers"` Name pulumi.StringOutput `pulumi:"name"...
602f010736d688704261669adad329b9720c6ac7
a6d0e75c813666832d5e9c4265e68980194c5e7a
yc-cell/go-core-kit
/library/httpkit/http.go
Go
go
3,107
no_license
package httpkit import ( "bytes" "crypto/tls" "fmt" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/library/jsonkit" "github.com/tidwall/gjson" "io" "net/http" "net/http/cookiejar" "net/url" "os" "strings" "time" ) var client *http.Client func init() { // 忽略证书校验 t...
c67a796cea628190e7c57cf0f51da6374e22687f
818f7f0932644b7fe3c5b9d3ec116648327bc61c
CYL199709/Study_Go
/CYL199709/Study_Go/11_7_map/main.go
Go
go
474
no_license
package main import "fmt" // map func main(){ var m1 map[string]int m1 = make(map[string]int,10) //初始化,要估算好该map容量,避免在程序运行期间再动态扩容 m1["微信"] = 1 m1["支付宝"] = 2 fmt.Println(m1) value, ok := m1["淘宝"] if !ok{ fmt.Println("查无此key") } else{ fmt.Println(value) } //删除 delete(m1,"微信") //看内置函数文档 go doc builtin.del...
ec30d99029239c519867ef2aa73dc53feb56b10b
c56f44976d7287606c9edfd7c9cc7a6a153c4eaa
doytsujin/go-licenser
/main_test.go
Go
go
6,272
permissive
// Licensed to Elasticsearch B.V. under one or more contributor // license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright // ownership. Elasticsearch B.V. licenses this file to you under // the Apache License, Version 2.0 (the "License"); you may // not use ...
ff837484b7d5a2b1ce745ca2a6477b22fa158c77
2ccd3660752bd5bc3262b0a020358abfb90453e3
a-mccarthy/kismatic
/pkg/cli/install.go
Go
go
917
permissive
package cli import ( "io" "github.com/spf13/cobra" "github.com/spf13/pflag" ) type installOpts struct { planFilename string } // NewCmdInstall creates a new install command func NewCmdInstall(in io.Reader, out io.Writer) *cobra.Command { opts := &installOpts{} cmd := &cobra.Command{ Use: "install", Sho...
db535e2f33f236c06dad664d0af2a5fcc91ebeca
ab127b65d1ff43cfba95f00d1910599fabb3e97d
sunlongv520/gospaces
/src/mercury/controller/question/question.go
Go
go
3,339
no_license
package question import ( "strconv" "github.com/gin-gonic/gin" "github.com/pingguoxueyuan/gostudy/logger" "github.com/pingguoxueyuan/gostudy/mercury/common" "github.com/pingguoxueyuan/gostudy/mercury/dal/db" "github.com/pingguoxueyuan/gostudy/mercury/filter" "github.com/pingguoxueyuan/gostudy/mercury/id_gen" ...
6b9b556cb25ea77dce95a4f3a2d7c95230809ff4
5adfffc30f3f2596b8d9adeb4a8a8d4217bd389c
kyleconroy/rickover
/test/server/bench_test.go
Go
go
1,073
permissive
package servertest import ( "bytes" "encoding/json" "net/http" "net/http/httptest" "testing" "time" types "github.com/kevinburke/go-types" "github.com/kevinburke/rickover/server" "github.com/kevinburke/rickover/test" "github.com/kevinburke/rickover/test/factory" ) func BenchmarkEnqueue(b *testing.B) { def...
c9df5ca9f380689627bbad7df56e7155f8baf710
65197bfcc2e0582c12a7c15e3257ad7e425d6a68
chain199/Glass-Chain
/system/p2p/dht/protocol/broadcast/query_test.go
Go
go
4,202
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 broadcast import ( "encoding/hex" "errors" "testing" "github.com/33cn/chain33/common/merkle" "github.com/33cn/chain33/queue" "github.com/33cn/chain...
05ac72c43815163b5eacae29a6b5efc9251e10ba
e8f652e30e3e59da4881e77d5c3e664e6f57e7f3
wardharold/upspin
/cmd/cacheserver/serve.go
Go
go
1,661
permissive
// Copyright 2017 The Upspin Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "net" "net/http" "upspin.io/config" "upspin.io/dir/dircache" "upspin.io/flags" "upspin.io/rpc/dirserver" "upspin.io/r...
e8d3a1c028a44abcf6d7c8b043c1f437d09b5d8a
02e80fb35c9884ab41f5e20bd24a5697435336ed
biuboombiuboom/chubaofs
/blobstore/util/errors/error_info_test.go
Go
go
1,842
permissive
// Copyright 2022 The CubeFS 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...
c2a8995b50df3c3f0770ef09699e3368514c5ca9
47ed9ec8e19c1245936ffe8ef9842386c53573dd
sid-85/m0
/x/wasm/keeper/msg_server_propose_deploy_contract.go
Go
go
1,822
no_license
package keeper import ( "context" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/liubaninc/m0/x/wasm/types" "github.com/tendermint/tendermint/crypto/tmhash" ) func (k msgServer) ProposeDeployContract(goCtx context.Context, msg *types.MsgProposeDe...
4fc01018d5e7fbbfad974b9d139c10b992eaffb3
52b8a2841bc22a285cb873308d4efe718ecc1742
max-f-z/leetcode
/cmd/54_spiral_matrix.go
Go
go
705
no_license
package main //lint:ignore U1000 unused func spiralOrder(matrix [][]int) []int { if len(matrix) == 0 { return []int{} } m := len(matrix) n := len(matrix[0]) res := make([]int, m*n) rowS, rowE, colS, colE := 0, m-1, 0, n-1 for i := 0; i < m*n; { for idx := colS; i < len(res) && idx <= colE; idx++ { re...
c7094134ba523d7c7eba5c2a9379e5e635cafcd2
f49baa8af3eb250a730b23aeaaabd3dadf49457b
dxyinme/LukaClient
/UserOperator/createWindow.go
Go
go
1,227
permissive
package UserOperator import ( "fmt" "github.com/asticode/go-astilectron" "github.com/dxyinme/LukaClient/IpcMsg" "github.com/dxyinme/LukaClient/window" "log" ) func CreateWindow(windowType string) { log.Printf("create window : %s", windowType) if windowType == IpcMsg.TypeWindowGroupWindow { GroupWindowCreate(...
ff87f2a14c212c40bf06bbbd008c5f3d370561ba
75a774be8b1535e65704cb6f5a8941069c66be07
hedzr/logex
/_excluded/logx/zerolog/logx_test.go
Go
go
1,158
permissive
package zerolog_test import ( "testing" "github.com/hedzr/log" "github.com/hedzr/logex/_excluded/logx/zerolog" log3 "github.com/rs/zerolog/log" ) func TestBasic(t *testing.T) { // zerolog3.TimeFieldFormat = zerolog3.TimeFormatUnix log3.Debug(). Str("Scale", "833 cents"). Float64("Interval", 833.09). M...
d0c654b88937da61d6ed78c5d2cddf10463264fa
dc6487e7e716fbe9f699221344b2bebcb25cfa39
daniel-salter-ds/Game-of-Life
/stage4/gol.go
Go
go
6,626
no_license
package main import ( "fmt" "strconv" "strings" "time" ) // distributor divides the work between workers and interacts with other goroutines. func distributor(p golParams, d distributorChans, alive chan []cell) { // Create the 2D slice to store the world. world := make([][]byte, p.imageHeight) for i := range ...
8787c8c5fb7a78e4b5ad25250687270c7703255e
6efa4d48ce07fef940b365c8828a2bea379e60ae
abstractmj/bk-bcs
/bcs-services/cluster-resources/pkg/cache/types.go
Go
go
997
permissive
/* * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obta...
d010214bf760538a12c54b434d2cd2df62710f84
aa0aa27410c3ab80c9947014f38bd751fcb2e8a9
abhinavdahiya/cluster-kube-controller-manager-operator
/pkg/operator/configobservation/cloudprovider/observe_cloudprovider.go
Go
go
3,621
permissive
package cloudprovider import ( "fmt" "github.com/ghodss/yaml" "github.com/golang/glog" "github.com/openshift/library-go/pkg/operator/events" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/con...
ceff173974a029ad8589b6c484095f0abb39ca41
3e87983efd15f7e28332efec8184b7fdce262aad
dvaldivia/minio
/cmd/api-response.go
Go
go
31,051
permissive
// Copyright (c) 2015-2021 MinIO, Inc. // // This file is part of MinIO Object Storage stack // // 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 // (...
de425f050d59f8a8edc5f4accca99bee993c3ecb
63d803bbfa80f131b1a501ab9570d3dcbaf72089
jsign/govim
/cmd/govim/internal/golang_org_x_tools/telemetry/export/ocagent/metrics.go
Go
go
5,604
permissive
// Copyright 2019 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 ocagent import ( "fmt" "time" "github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/telemetry" "github.com/govim/govim/cmd/govim/internal/...
e73e40a08d12d743f27942272973aa0a74e98fa3
83c395679b78975525a689c0c9927cba91a851f0
byxorna/nycmesh-tool
/cmd/meshapi_devices.go
Go
go
2,916
permissive
package cmd import ( "encoding/json" "fmt" "sort" "strconv" "github.com/byxorna/nycmesh-tool/pkg/app" "github.com/byxorna/nycmesh-tool/pkg/meshapi" "github.com/spf13/cobra" "github.com/spf13/viper" ) var filterNodeID int var deviceCmd = &cobra.Command{ Use: "device", Short: "interact with devices", ...
0294cb6c27ab3c0a8278bfcfa88b0ccb2aa9fd71
e90069177eb9e7ada131e9efd43760e96b161dae
moteesh-in2tive/Dragonfly2
/client/daemon/peer/peertask_file.go
Go
go
15,287
permissive
/* * Copyright 2020 The Dragonfly 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 la...
0ae8298e3e8ca7630fa30b5649c61cdfc2cabe13
e9cd8007a36caa0b253012a03fb4b26b6f237be9
smart--petea/go_test_task
/app/app.go
Go
go
2,193
no_license
package app import ( "github.com/jinzhu/gorm" "github.com/smart--petea/go_test_task/route" "github.com/smart--petea/go_test_task/entity" "os" "fmt" "log" "regexp" "net/http" ) type App struct { db *gorm.DB routeTable map[string]map[*regexp.Regexp] *route.RouteInterface } func...
343a1d25b115203313a60d63fa38e268cbe7f312
b6dc8aa49c754ea0af53e295f08cf65bc33f5d8a
clamoriniere/datadog-agent
/pkg/autodiscovery/configresolver/configresolver_test.go
Go
go
30,939
permissive
// Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. package configresolver import ( "context" "fmt" "os" "testing" "gi...
ca44263fbaf96e00bffb35003cb6acc8e198c77c
5e07d0d3b791a438b30026eea717cef295c27593
mewbak/ink
/sketches/sand_stroke_fast.go
Go
go
1,860
no_license
package main import ( "image" colorlib "image/color" . "github.com/buchanae/ink/color" . "github.com/buchanae/ink/dd" . "github.com/buchanae/ink/gfx" "github.com/buchanae/ink/math" "github.com/buchanae/ink/rand" ) const ( Lines = 3 Strokes = 10 N = 300 W = 1 / float32(N) Amp = 1000 // mi...
6ca46d740b36ceecbe7c4f604f2c153e5b17499b
c407713df895df01686b845b768db72562e9c76e
haicaodac/backend-test
/app/models/History.go
Go
go
253
no_license
package models // History in database histories type History struct { Model Type string `json:"type"` Data string `json:"data"` Count uint `json:"count" gorm:"not null;default:1"` IP uint `json:"ip"` UserID uint `json:"user_id"` }
063a13d99ab4ec715a1694db104dc132d6635338
5830183f7f235e464031b18b01795f44d4cabbd6
BTCGPU/lnd
/record/hop.go
Go
go
1,317
permissive
package record import ( "github.com/BTCGPU/lnd/tlv" ) const ( // AmtOnionType is the type used in the onion to refrence the amount to // send to the next hop. AmtOnionType tlv.Type = 2 // LockTimeTLV is the type used in the onion to refenernce the CLTV // value that should be used for the next hop's HTLC. Loc...
6df65e2ee04f681615071cc61cd13732a7e7b71a
d61de3599dc6fdfdef1f04834e6c6b6963cae0af
ampproject/amppackager
/vendor/github.com/liquidweb/liquidweb-go/storage/block_volume_client.go
Go
go
2,511
permissive
package storage import ( liquidweb "github.com/liquidweb/liquidweb-go" ) // BlockVolumeBackend describes the interface for interactions with the API. type BlockVolumeBackend interface { Create(*BlockVolumeParams) (*BlockVolume, error) Details(string) (*BlockVolume, error) List(*BlockVolumeParams) (*BlockVolumeLis...
3ca52610d9ed63b47455c60811dd43ee359a7b72
2dcdf118691b1629d89ffbe369b112c332e91b8b
SchnorcherSepp/splitfuseX
/core/keyfile_test.go
Go
go
6,622
no_license
package core import ( "bytes" "encoding/hex" "io/ioutil" "os" "path" "testing" ) var ( hashSecret []byte cryptSecret []byte testChunkHash []byte chunkKey []byte indexSecret []byte testKeyFile string failKeyFile string ) func init() { // keyfile data data, _ := hex.DecodeString("60a47f...
412b925050f9197f675d60f1b0d1946ed9e811a6
a933abbacd18cefe967ac6d9bf90272b7d295ab1
divan/pdfreader
/svgdraw/svgdraw.go
Go
go
3,198
no_license
// Copyright (c) 2009 Helmar Wodtke. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. // The MIT License is an OSI approved license and can // be found at // http://www.opensource.org/licenses/mit-license.php // SVG driver for graf.go. packa...
2d4cd9d5376fac80e5c4c93e87ef3f01801bc437
c2d8e5d6df3ecb9bfaa9423118d4a9b11a37be29
hulklab/yago
/coms/mgo/mgo.go
Go
go
5,552
permissive
package mgo import ( "context" "log" "github.com/hulklab/yago" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) type Mgo struct { *mongo.Database } type Collection struct { c *mongo.Collection } type Cursor struct { c *mongo.Cursor } // 返回 mongodb 的一个数据库连接 func Ins(id ...s...
d564293c735a2728a856e80eb194d7f6ba220c0a
3a4e454a54e9a4445c594a6c228ed8d5d05cc423
anabiozz/yotunheim
/backend/common/datastore/datastore.go
Go
go
523
permissive
package datastore import "github.com/anabiozz/yotunheim/backend/common/utility" // Datastore ... type Datastore interface{} // Err ... type Err struct { error } const ( // INFLUXDB = iota ) // func NewDatastore(datastoreType int, dbConnectionString string) (Datastore, error) { switch datastoreType { case INFL...
c34014ff8cec76e2a7c6eddb5e47593eb71aae36
45187b3de359442b605c1f2591778ea9601adbbf
kangaloo/cloudcli
/interactive/completion/completer.go
Go
go
3,502
no_license
package completion import ( "github.com/c-bata/go-prompt" "github.com/c-bata/go-prompt/completer" "os" "strings" ) // todo !cd 命令的处理使用 bash -c "cd" 还是 os.ChDir() // !pwd bash -c "pwd" / os.GetWd() // todo 根据cli提供的内容自动生成补全提示 func Completer(d prompt.Document) []prompt.Suggest { if d.TextBeforeCursor() == "" {...
97ad31abc2409dfe2786a1fa26580e000a757dab
18c383a52eeec2404826b533a504b555b21ca62b
afkbrb/jenkins-cli
/app/cmd/plugin_create.go
Go
go
1,269
permissive
package cmd import ( "os" "github.com/jenkins-zh/jenkins-cli/util" "github.com/jenkins-zh/jenkins-cli/app/i18n" "github.com/spf13/cobra" ) // PluginCreateOptions for the plugin create command type PluginCreateOptions struct { CommonOption DebugOutput bool } var pluginCreateOptions PluginCreateOptions func...
1578ad96db15bcc3d9696aca22310d3c82566025
224eef41de85008194829c6133c95e639ddc4baa
shunpeizhang/pd
/server/coordinator_test.go
Go
go
33,284
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 in...
e8e9722e16ed95e2f870c5410bd6d1436bb9ff16
f1b11c1d5dcf1ba6533d3b2dab985c6b6321d416
Honglei-Cong/fabric
/orderer/consensus/tendermint/p2p/peer_set.go
Go
go
3,447
permissive
// Modified for Fabric // Originally Copyright (c) 2013-2018 Tendermint // https://github.com/tendermint/tendermint/blob/master/LICENSE package p2p import ( "net" "sync" ) // IPeerSet has a (immutable) subset of the methods of PeerSet. type IPeerSet interface { Has(key ID) bool HasIP(ip net.IP) bool Get(key ID)...
e4db32ff7ca5a6147760a49d77dcbf50627da1e0
feae369319d1e41d6f71932412f1e0eb2d42b662
c4e8ece0/betting
/enum_group_by.go
Go
go
1,403
permissive
package betting import "errors" var ErrUnknownGroupBy = errors.New("Unknown groupBy value") type GroupBy int const ( GB_EVENT_TYPE GroupBy = iota // A roll up of settled P&L, commission paid and number of bet orders, on a specified event type GB_EVENT // A roll up of settled P&L, commission pa...
6ed31345ea73e4fd1d8896fd2e5da15b8287816c
31343ca894fd7d20a4d749e7e2c65bb65dc07fd2
frankfanslc/sq
/libsq/ast/node.go
Go
go
6,216
permissive
package ast import ( "fmt" "reflect" "github.com/antlr/antlr4/runtime/Go/antlr" ) // Node is an AST node. type Node interface { // Parent returns the node's parent, which may be nil.. Parent() Node // SetParent sets the node's parent, returning an error if illegal. SetParent(n Node) error // Children retu...
9adf65ec1704975b253d207636051d585c8ddc6d
1a61f970175d5cd6d685540c35cefddbf5485ffb
dims/hyperkube
/vendor/k8s.io/kubernetes/pkg/api/pod/util.go
Go
go
33,476
permissive
/* Copyright 2015 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, ...
a9df8fa08cdde0ab14534b4c66f6f955544709c3
1e257ef58c35cfad9b6d87606ae0f0ad63f834a7
keybase/client
/go/client/stream.go
Go
go
407
permissive
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package client import ( "github.com/keybase/client/go/libkb" keybase1 "github.com/keybase/client/go/protocol/keybase1" "github.com/keybase/go-framed-msgpack-rpc/rpc" ) func NewStreamUIProtocol(...
31e122fbbcc16edd7cb5fb604c47a1b659df3f00
267fa5d13d7fdf66c95f2deba4466da818f718ad
decred/politeia
/politeiawww/cmd/cmswww/edituser.go
Go
go
6,255
permissive
// Copyright (c) 2017-2019 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 ( "bufio" "fmt" "os" "strings" cms "github.com/decred/politeia/politeiawww/api/cms/v1" "github.com/decred/politeia/politeiawww/cmd/shared" ) /...