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
39aa02d78211241df0a3912b1181d55a7112dce9
0094b744ee49f619f791d88de6aa129f90915530
TStarFall/mallBackend
/handler/category.go
Go
go
5,556
no_license
package handler import ( "github.com/gin-gonic/gin" "mall/enum" "mall/model" "mall/query" "mall/resp" "mall/service" "net/http" ) type CategoryHandler struct { CategorySrv service.CategorySrv } func (h *CategoryHandler) CategoryList4BackendHandler(c *gin.Context) { var q query.ListQuery entity := resp.Enti...
99f7741a734d9911183471dda5221a9fa0a8b2a2
89464d4142c9a3df62eba40a7ca328deb436d55f
abduld/decomp
/cmd/go-post/localid.go
Go
go
2,413
permissive
// Copyright 2015 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 main import ( "go/ast" "go/token" "strconv" "strings" ) func init() { register(localidFix) } var localidFix = fix{ "localid", // HACK: Fixes ...
d95636a7eac784074e23210f8bc67ab19647c440
220b15a546a25468ca20e4677293c2dd0f390119
Oneledger/protocol
/data/governance/proposal.go
Go
go
2,804
permissive
package governance import ( "github.com/Oneledger/protocol/data/balance" "github.com/Oneledger/protocol/data/keys" ) const EmptyStr = "" type ProposalOption struct { InitialFunding *balance.Amount `json:"initialFunding"` FundingGoal *balance.Amount `json:"fundingGoal"` Fund...
4e4e947a18a415712b5c972b39d5491d77764cef
f7d3d5a88cbe656bc23d012caa4e6d6e7fc08b77
cdsalmons/vitess
/go/vt/client/rows_test.go
Go
go
4,083
permissive
package client import ( "database/sql/driver" "io" "reflect" "testing" mproto "github.com/youtube/vitess/go/mysql/proto" "github.com/youtube/vitess/go/sqltypes" ) var rowsResult1 = mproto.QueryResult{ Fields: []mproto.Field{ mproto.Field{ Name: "field1", Type: mproto.VT_LONG, }, mproto.Field{ N...
e10e02c732fb533d560589b047262ba3807895b6
d7553da961344c2ed372d152f84c46ae38a71c7f
moriyoshi/yamaha-rt-simulator
/simulator/cmd_ip_interface_intrusion_detection_noticeinterval.go
Go
go
1,749
no_license
package simulator import "context" var CmdIpInterfaceIntrusionDetectionNoticeInterval = &CommandSpec{ []Token{TIp, TL2Interface, TIntrusion, TDetection, TNoticeInterval}, 5, func(_ context.Context, sess *SimulatorSession, tis []TokenInstance) error { if !sess.Enabled { return AdministratorUseOnly } return ...
ff5efe0b2417bf7668280ba2bdade9e4835590d8
d2fdc2d1960ff6c42b9cb962aa21bbe7b64594ab
sleepinging/StudyGolang
/2018DMT/service/job.go
Go
go
4,969
no_license
package service import ( "net/http" "../dao" "../models" "../control/Permission" "encoding/json" "net/url" "strconv" ) func PublishJob(w http.ResponseWriter, r *http.Request) { uid, err := Permission.PublishJob(w, r) if err != nil { models.SendRetJson2(0, "错误", err.Error(), w) return } r.ParseForm() j...
625fc9a84fe22c14009ce1fb2698a09d53759f6b
3eaab6250e336a962f13c9051be2d9231e23e4f0
wangjili/golab
/lang/http/server/server.go
Go
go
253
no_license
package main import ( "io" "log" "net/http" ) func HelloServer(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "Hello, world!\n") } func main() { http.HandleFunc("/hello", HelloServer) log.Fatal(http.ListenAndServe(":8080", nil)) }
512a6fac8dc6ad8e274491d72d3955717d171b40
d33fdd94265de2220c6c3f7b623725dfb3e78860
et7peho/go-debian
/control/control_test.go
Go
go
4,587
permissive
/* {{{ Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2015 * * 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 us...
ece87f1d4eab97aa4930b19a645f3210f89271ca
3dd0cbd2cf52155510b292c67808c3eb91430e0b
TrendingTechnology/dolphin
/platform/plugin/override.go
Go
go
537
permissive
package plugin import ( "strings" "github.com/2637309949/dolphin/packages/gin" ) // Override defined func Override(hc func(c *gin.Context)) gin.HandlerFunc { return func(c *gin.Context) { if c.Request.Method != "POST" { return } method := c.PostForm("_method") if method == "" { return } method =...
fa9dc5e6ea8b5ee507c04d4e2efe1113eb6cf215
ac574d7b3507f4f459a0754cb2e43a916400c156
bgagnon/contour
/internal/envoy/stats_test.go
Go
go
3,283
permissive
// Copyright © 2019 VMware // 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 writin...
1806c0b18f1dadf93e632041f8c9be2826c67639
43f31d48ba9e2ab1a17bf8cf8e310a05fbaf1c20
soominhyunwoo/chain-sdk
/x/ibc/core/04-channel/simulation/genesis.go
Go
go
358
permissive
package simulation import ( "math/rand" simtypes "github.com/soominhyunwoo/chain-sdk/types/simulation" "github.com/soominhyunwoo/chain-sdk/x/ibc/core/04-channel/types" ) // GenChannelGenesis returns the default channel genesis state. func GenChannelGenesis(_ *rand.Rand, _ []simtypes.Account) types.GenesisState { ...
c634ba118793832356304b6eaab8d1cc12e1ca2d
f9e15e7c9599ab32140a7bd82b6f8ad52b22c927
projectriff-archive/go-function-invoker
/vendor/google.golang.org/grpc/balancer/base/balancer.go
Go
go
7,015
permissive
/* * * Copyright 2017 gRPC 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
f3148dc0a41e85e813f2145420de15be72d008f2
1d7cfe88b373ca1f4b11e50f0d7b0b2fdb1e8c7e
sourcegraph/zoekt
/cmd/zoekt-git-index/main.go
Go
go
4,649
permissive
// Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
1b916b4f1f370bbc534e06d37fef76946a858891
adb769b230f5d88eed380fa9db2399df6d1d3936
protochron/cadence
/common/membership/interfaces.go
Go
go
3,566
permissive
// Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge...
35887635a871486d66c95ad09c48db2c81c1fa8b
fcda5fa36dc5c036e4a48b376cad5774c746b8d5
Cepave/open-falcon-backend
/modules/query/http/nqm_it_test.go
Go
go
6,762
permissive
package http import ( "net/http" "net/http/httptest" "time" "github.com/satori/go.uuid" oHttp "github.com/Cepave/open-falcon-backend/common/http/client" ojson "github.com/Cepave/open-falcon-backend/common/json" tg "github.com/Cepave/open-falcon-backend/common/testing/ginkgo" tHttp "github.com/Cepave/open-fal...
3b9c3bfee04ffe81c40433d883ebcdddd93979e6
8964358deed4680b0d881fb166bfe61c4b63d8ee
vladimir4862/thanos-operator
/pkg/sdk/api/v1alpha1/thanos_types.go
Go
go
21,861
permissive
// Copyright 2020 Banzai Cloud // // 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...
3bd62502a4581b6f100fbaf56ff0c8f3e1e9e630
b8a9924d85b8842273b3e080fc7bafa54fbef422
alterround/moneygo
/internal/handlers/imports.go
Go
go
11,103
permissive
package handlers import ( "encoding/json" "github.com/aclindsa/moneygo/internal/models" "github.com/aclindsa/moneygo/internal/store" "github.com/aclindsa/ofxgo" "io" "log" "math/big" "net/http" "strings" "time" ) type OFXDownload struct { OFXPassword string StartDate time.Time EndDate time.Time } ...
2c013a7bef96d142378dac9e83851e5985276f32
26dd0f9171b247d0816533595bcb1d4f5b84a82b
tokend/hgate
/vendor/gitlab.com/tokend/regources/v2/asset_pair.go
Go
go
698
no_license
package regources import "gitlab.com/tokend/go/xdr" type AssetPairResponse struct { Data AssetPair `json:"data"` Included Included `json:"included"` } type AssetPairsResponse struct { Links *Links `json:"links"` Data []AssetPair `json:"data"` Included Included `json:"included"` } type Asset...
e09ff28ec25bfb129ffd914f7057132477e64006
ec64950a67ff0ce8e54f14bee32e02b0746c6248
ActiveState/cli
/vendor/github.com/google/go-github/v45/github/secret_scanning.go
Go
go
9,125
permissive
// Copyright 2022 The go-github 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 github import ( "context" "fmt" ) // SecretScanningService handles communication with the secret scanning related // methods of the GitHub...
0743482544eeaaa8b5bbb46083702cd8a6cb67c5
fdb8f77c5f0ac830d70e6b8eccf8a58d2fa2db9a
bketelsen/backlog
/doc.go
Go
go
1,207
permissive
// Copyright (c) 2016 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge...
4a5077e94f4a2a8860f937307fdb7956e3195209
3b9427f040c1915234b68587f8351e995175082e
prasadkatti/opentelemetry-log-collection
/operator/builtin/parser/severity/severity_test.go
Go
go
8,551
permissive
// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
c9b76842cd49ff1261884266068750f99e278373
f5b4db3e6e11e1fe6fb7297fda122a1cf2cdad70
nicholaswhite752/GoLangCourseExercises
/10_Channels/Ex3/main.go
Go
go
387
no_license
package main import ( "fmt" ) func main() { c := gen() receive(c) fmt.Println("about to exit") } func gen() <-chan int { c := make(chan int) //Need to make go func to run concurrent go func() { for i := 0; i < 100; i++ { c <- i } close(c) }() return c } //prints out channel until close func rec...
a95e0d44c61a42401e7d56c21f8df5ec327299c1
6f0b628f7c6cf9d54c9b51fa8a9631353cfc9a35
zhuanjuan0910/gotest
/example25/main.go
Go
go
453
no_license
package main import "github.com/gin-gonic/gin" type Person struct { ID string `uri:"id" binding:"required"` Name string `uri:"name" binding:"required"` } func main() { route := gin.Default() route.GET("/:name/:id", func(c *gin.Context) { var person Person if err := c.ShouldBindUri(&person); err != nil { ...
007e141c210b4336b4383ce8b5d831c21e989fb8
f6e4e325cc4299a0fda0611b7216224ced8a2329
zlxtqbdgdgd/sailor
/thirdparty/elastic.v5/cluster_state.go
Go
go
9,242
permissive
// Copyright 2012-present Oliver Eilhard. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic import ( "context" "fmt" "net/url" "strings" "github.com/zlxtqbdgdgd/sailor/thirdparty/elastic.v5/uritemplates" )...
fa44f5eb706e415750c52ff010d9f1a83dfa0663
7db5d5f56e3f99e6ff33e7e2c4a14ddf41fba122
valkyra-tech/benthos
/lib/output/docs.go
Go
go
5,144
permissive
package output import ( "bytes" "fmt" "sort" "strings" "github.com/Jeffail/benthos/v3/lib/message/batch" "github.com/Jeffail/benthos/v3/lib/util/config" "gopkg.in/yaml.v3" ) //------------------------------------------------------------------------------ func sanitiseWithBatch( componentConfig interface{}, ...
3cbaecbf166cbacc94569083b7279a0596db7e1e
ef8dcf2edcd3c0caef913a71bbf5bae3d2bbd2a2
arun1705/fbc
/app/app.go
Go
go
8,029
permissive
package app import ( "os" abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/version" "github.com/blockkungpao/fbc/x/ethbridge" "github.com/blockkung...
2e07306afad4e65249a1a448a30123bc89d4955a
4c2c7141c63fd1faee11a22d20342ce2e8e42b43
treinalinux/golang-study
/src/treinaweb/basic/aula_08/recover/main.go
Go
go
466
no_license
package main import "fmt" func main() { fmt.Println("Como usar o recover") // Função anônima defer func() { if ex := recover(); ex != nil { fmt.Printf("Desculpe, ocorreu um erro %s \n", ex) } fmt.Println("Obrigado por user nosso software") }() fmt.Print("Digite um número maior que 10: ") var numero int...
d1a0ef3219db75b39b2133baf73e0f5956f5c95f
8c337644a272098df3e12c57882712a5d0a88fd0
dianler/go-x
/vendor/github.com/fananchong/go-discovery/node.go
Go
go
4,267
permissive
package godiscovery import ( "context" "fmt" "io/ioutil" "net/http" "strconv" "strings" "sync" "time" "github.com/coreos/etcd/clientv3" ) type INode interface { Id() uint32 SetId(id uint32) Init(inst interface{}) Open(hosts []string, whatsmyip string, nodeType int, watchNodeTypes []int, putInterval int6...
83e27348742ec3914ff498f613d8ea7ee5a02dee
b2992f56945253d9d76cdf05682fbcf5e7189ee2
isongjosiah/mastering-go
/Go_Data_structures/Doubly_Linked_list/doublyLList.go
Go
go
1,487
no_license
package main import ( "fmt" ) // Node ... type Node struct { Value int Previous *Node Next *Node } var root = new(Node) func addNode(t *Node, v int) int { if root == nil { t = &Node{v, nil, nil} root = t return 0 } if v == t.Value { fmt.Println("Node already exists:", v) return -1 } if t...
46166b4cecc7e427b4d2eb5b1243917367d4c66c
e07b0ef243f2ba459e662eaaf37a5421b018d8c2
ss56806298/go_socket_server
/lib/router.go
Go
go
6,677
no_license
package lib import ( "encoding/json" "fmt" "github.com/bitly/go-simplejson" "net" "strconv" ) //消息接口 type Msg struct { Code int `json:"code"` Content map[string]interface{} `json:"content"` } //控制器接口 type Controller interface { Excute(message Msg, conn net.Conn) } //路线接口 var routers []...
34b4f8306168dc4e842f17225a0c60666a1fd892
77697399eb74a783c3c65ac5bb6608ca4f525e1a
ckirkendall/glisp
/interpreter/eval.go
Go
go
1,380
no_license
package interpreter import ( "github.com/ckirkendall/glisp/parser" "fmt" ) type Thunk struct { Env Environment Exp interface{} } type GLispError struct { text string } func (e GLispError) Error() string { return e.text } func unrollThunk(th Thunk) (interface{}, error){ for { lth, err := EvalTh(th.Exp, th....
14624ed47a5ea6bdf084fa529a867a6fbf5abc4a
0f03b0d8506e03d054b9baab3c7e6898884f6fa2
rmfarrell/svgr
/hexagons.go
Go
go
928
no_license
package svgr import ( "fmt" ) type hexagon [6]*point func (m *Mosaic) Hexagons() string { return m.render(func() string { var hex hexagon offset := 0 x := m.current.X * shapeSize y := m.current.Y * shapeSize if m.current.X%2 == 0 { offset = 5 } else { offset = 0 } hex = hexagon{ &point...
8584bebc2131af662092af32c468bf9f22829f6f
ead3a839888ec70a4915360ee4b3e744d8d37057
TheAntColony/packet-cli
/cmd/root.go
Go
go
3,239
permissive
// Copyright © 2018 Jasmin Gacic <jasmin@stackpointcloud.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, cop...
5680d961b94a094f95b9379e25292faf0637a2e3
9ed35ca7d17a57b399b95396ea42ece8416fd9c9
ashish-amarnath/test-infra
/prow/config/jobtests/job_config_test.go
Go
go
5,585
permissive
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
789bda33fb7c2360c321b903dc7ed1005b6ac0a8
f28bf498f8156e364e50f6e8054196a44f907189
kuuote/docui
/docker/docker.go
Go
go
7,275
permissive
package docker import ( "fmt" "os" "strings" docker "github.com/fsouza/go-dockerclient" "github.com/skanehira/docui/common" ) type Docker struct { *docker.Client } type ClientConfig struct { endpoint string certPath string keyPath string caPath string } func NewClientConfig(endpoint, cert, key, ca str...
7dd3d53602e01af5f3bfd32c32fdfea46cee2f7d
6d37ad12b94baf5ed84bac28dca824b135a3a31a
danmrichards/learn-golang
/little-go-book/24-shopping/db/db.go
Go
go
576
no_license
package db import ( "learn-golang/little-go-book/24-shopping/models" ) // Note that the Item structure is no longer in this file. If we moved it to // the shopping package we'd get an 'import cycle not allowed' error (as the // shopping package imports db). Instead we've moved it into a new models // package. // Lo...
73c133fe4475186308c0f552ceb79354cace417a
c10aabbdbdfb3fbd95c0c27ae7ff816a270914f5
mihang-laoban/algorithm
/alg/string_test.go
Go
go
8,720
no_license
package alg import ( "bytes" "dp/tools" "fmt" "strings" "testing" "time" ) //allocs/op 表示每个操作(单次迭代)发生了多少个不同的内存分配。 //B/op每个操作分配了多少字节。 // 所以他们的区别就在于 bytes.Buffer 是重新申请了一块空间,存放生成的string变量, 而strings.Builder直接将底层的[]byte转换成了string类型返回了回来,去掉了申请空间的操作。 func TestBytesBuffer(t *testing.T) { loop := 100000 var s string...
0257a7035f08985b7c72ac39510151622646eb7f
f6bd0f1d3821d89bb5318cbca3f8d07b5eff509c
marcqualie/hoard-collector
/src/routes.go
Go
go
395
no_license
package main import "net/http" type Route struct { Pattern string Method string Name string HandlerFunc http.HandlerFunc } type Routes []Route var routes = Routes{ Route{ "/", "GET", "Index", Index, }, Route{ "/data", "POST", "DataCreate", DataCreate, ...
255f32dba6f207bb7c5321008ef9209c71985dee
d7a2a607e3b80bb1ebd2697a84cb74ed09ffe70a
gerins/simpleloginbackend
/backend/domains/user/userRoute.go
Go
go
3,526
no_license
package user import ( "database/sql" "fmt" "login_page_gerin/middleware" "net/http" "github.com/gorilla/mux" ) func InitUserRoute(mainRoute string, db *sql.DB, r *mux.Router) { UserController := NewController(db) p := r.PathPrefix(mainRoute).Subrouter() p.Use(middleware.TokenValidation) r.HandleFunc("/user/...
ffdf91595452a63132261569a16fcf97e2e19095
cb4df93a40fbf6a28b25b3c81b20b1fa8935854f
kevinnguyeneng/vitess
/go/vt/vtgate/vindexes/numeric.go
Go
go
2,657
permissive
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
488cb4eb40f9fe698dd665a61b3877e955c5cd41
1126bbca298327ea50e95ffe825968b3dc1547f1
hanazuki/terraform-provider-conoha
/config.go
Go
go
1,077
no_license
package main import ( "fmt" "github.com/hanazuki/terraform-provider-conoha/conoha" "github.com/rackspace/gophercloud" "github.com/rackspace/gophercloud/openstack" ) type Config struct { Username string Password string TenantName string Region string } func (c *Config) client() (*gophercloud.Provider...
f832fafeead7dfb26ebe2b232527e62406ca697c
64625afd5bf9f4a75665cdcfc00f0aa4fba4e8fe
oylenshpeegul/date_practice
/dates_test.go
Go
go
3,622
permissive
package main /* Fill in the questions and run 'go test'. https://golang.org/src/time/format.go Mon Jan 2 15:04:05 MST 2006 01/02 03:04:05PM '06 -0700 Hint: when parsing difficult dates, you can build up the layout chunk by chunk - time.Parse() will print out the remaining unmatched text. */ import ( "fmt" "st...
c62c171e2d4223ddf616a9b80cfa3c185b39394d
01c2da88baff03b26cd9f9ab12c7140223649e44
theJuan1112/go-practice-programs
/maps/maps.go
Go
go
364
no_license
package main import "fmt" func main() { websites := map[string]string{ "Google": "https//google.com", "Amazon Web Services": "https://aws.com", } fmt.Println(websites) fmt.Println(websites["Amazon Web Services"]) websites["Linkedin"] = "https://linkedin.com" fmt.Println(websites) delete(we...
7f42d08a10e947b5b4e3a6e7f5a2864b96187476
dfd981396014c14c1c587481d302b14ebebb2b01
KellyLSB/demondin
/graphql/postgres/stripe_charge.go
Go
go
352
no_license
package postgres import ( "database/sql/driver" "encoding/json" _ "github.com/lib/pq" "github.com/stripe/stripe-go" ) type StripeCharge struct { stripe.Charge } func (c StripeCharge) Value() (driver.Value, error) { return json.Marshal(c) } func (c *StripeCharge) Scan(value interface{}) error { return json....
fb6b0dec360aafe8f1111e35ec4afed875709640
af7fac5826fcd1786a11bc5eb1d51b2fbe35e91b
sogawa-sps/bitmap-usage
/benchmark/500k-large-groups/bitmap-sroar/helper_test.go
Go
go
989
no_license
package bitmapsroar import ( "bitmap-usage/benchmark/500k-large-groups/sample64" cache64 "bitmap-usage/cache64" indexsroar "bitmap-usage/index-sroar" "github.com/rs/zerolog/log" "github.com/stretchr/testify/assert" "testing" ) func prepareBitmapIndex(b *testing.B) (*cache64.CatalogService, *indexsroar.BitmapInd...
e08a25c5a4c1ca08e7fc550507d4d6fddfe45e4f
3479fc8739bd52e7411a83744f355a304ab27f9f
MeABc/quic-go
/internal/handshake/tls_extension.go
Go
go
3,792
permissive
package handshake import ( "bytes" "encoding/binary" "errors" "fmt" "github.com/bifurcation/mint" "github.com/MeABc/quic-go/internal/protocol" "github.com/MeABc/quic-go/internal/utils" ) type transportParameterID uint16 const quicTLSExtensionType = 0xff5 const ( initialMaxStreamDataParameterID transportPa...
b6cb1e514c89800d3345b1a061b7a0d6312af158
e4f02ee08fff518108bb895f4e8ee5d211274dbc
orange-cloudfoundry/bosh-bootloader
/config/load_state.go
Go
go
4,330
permissive
package config import ( "io/ioutil" "os" "path/filepath" "github.com/cloudfoundry/bosh-bootloader/application" "github.com/cloudfoundry/bosh-bootloader/fileio" "github.com/cloudfoundry/bosh-bootloader/storage" flags "github.com/jessevdk/go-flags" ) type logger interface { Println(string) } type StateBootstr...
33e50bc0980cad3e6242030b4c0482986b55cb22
cdc2e9149f230e80f474a1da9ff1918f4099f1fe
Actinium-project/lnd
/.history/lnwallet/chanfunding/wallet_assembler_20200302203457.go
Go
go
10,874
permissive
package chanfunding import ( "math" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/txsort" "github.com/Actinium-project/lnd/input" "github.com/Actinium-project/lnd/keychain" ) // FullIntent is an ...
565291dccd67b03c231a8a1b3244e02702f6eb36
52fb34aaa2335eb266d30c2db36cb6eeee47bfc8
superlinkx/gravemind2
/api/api.go
Go
go
908
no_license
package api import "github.com/gin-gonic/gin" type action struct { Params string `json:"parameters"` Description string `json:"description"` } func setAllowHeader(allow string, c *gin.Context) { c.Writer.Header().Set("Allow", allow) } // GravemindOptions gives OPTIONS response for entire API, including curr...
cf69d8df9d39d9c49414c492f62c20e4269a6d33
c7e04a20277be91286fd954e0a44be195bc94f11
rathinaganesh/elvish
/parse/pprint.go
Go
go
3,309
permissive
package parse import ( "fmt" "io" "reflect" "strconv" ) const ( maxL int = 10 maxR = 10 indentInc = 2 ) func compactQuote(text string) string { if len(text) > maxL+maxR+3 { text = text[0:maxL] + "..." + text[len(text)-maxR:len(text)] } return strconv.Quote(text) } type field struct { ...
ed9299dfb61ea21d55d21c819153ab46322ccf21
9c462d5bc325a14b4e4f195700b203efc5e98f6e
TrendingTechnology/testza
/testza.go
Go
go
755
permissive
package testza import ( "fmt" "math/rand" "runtime" "time" "github.com/klauspost/cpuid/v2" "github.com/pterm/pterm" ) var randomSeed int64 var infoPrinter = pterm.DefaultSection.WithStyle(pterm.NewStyle(pterm.FgMagenta)).WithLevel(2).WithBottomPadding(0).WithTopPadding(0) var secondary = pterm.LightCyan func ...
75aa80f6586d70a71d41764c0857d233cd8bce3e
1003f1d9b10430fead4c39a6dc2d246e7565fbdd
everdance/recurly-client-go
/subscription_add_on.go
Go
go
5,663
permissive
// This file is automatically created by Recurly's OpenAPI generation process // and thus any edits you make by hand will be lost. If you wish to make a // change to this file, please create a Github issue explaining the changes you // need and we will usher them to the appropriate places. package recurly import ( "c...
0494c03788ab9546b94d5ae59108543753831b05
f29df0f5349da0a4c2a3177eed1a32878f6fc52a
zbanks/co2monitor
/main.go
Go
go
3,292
permissive
package main import ( "log" "net/http" "github.com/zbanks/co2monitor/meter" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "gopkg.in/alecthomas/kingpin.v2" ) var ( device = kingpin.Arg("device", "CO2 Meter device, such as /dev/hidraw2").Required...
a4d6a1bbba12322ec6f9d349380319d7390f112f
5f3d80fe47e2cc32ebfb51e2bf6c931972f8160b
nimrodshn/ocm-sdk-go
/clustersmgmt/v1/cloud_provider_list_reader.go
Go
go
2,313
permissive
/* Copyright (c) 2019 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
20c837bd13594a49e83cd202fd63aa82675b7359
3e119ae73d1894c3430f3133fc5a0366f99052ff
beatlabs/patron
/vendor/github.com/elastic/go-elasticsearch/v8/typedapi/types/clustershardmetrics.go
Go
go
1,431
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 ...
53afea44e811423591bacd909f1bd50f906cf16b
3fbd220868b219c0f858264548ecc0d20965660c
Calimos/gocryptotrader
/engine/fake_exchange_test.go
Go
go
9,027
permissive
package engine import ( "sync" "time" "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/account" "github.com/thrasher-corp/gocryptotrader/exchanges/a...
119bb9c0dd272770f9e639f9709f382683d67c31
e129d083149981a100b17f8b0e03b77e26c34fc9
sgtest/monorepo-test-3
/kubernetes-5/pkg/controller/job/utils.go
Go
go
1,398
permissive
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
a2788cee7ac7e7adfbaaacdfe1fda05e5225b7c0
dad86b170a9cab37364017bddc8739662fe4f33a
Houtmann/ocpp-go
/ocpp2.0/authorization/clear_cache.go
Go
go
2,575
permissive
package authorization import ( "github.com/lorenzodonini/ocpp-go/ocpp2.0/types" "gopkg.in/go-playground/validator.v9" "reflect" ) // -------------------- Clear Cache (CSMS -> CS) -------------------- const ClearCacheFeatureName = "ClearCache" // Status returned in response to ClearCacheRequest. type ClearCacheSt...
74f2101436fa02ef6b44e920e452550b05d17c79
56c83cf573e94b86eb248b9613378b4a977d428a
munnerz/cert-manager
/pkg/acme/webhook/apis/acme/v1alpha1/register.go
Go
go
1,833
permissive
/* Copyright 2019 The Jetstack cert-manager contributors. 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...
bf41d9eaf0cf577182e4e8254917f94dc77e0f75
a5a57fe9028eff181b354a581cb684e44e6cec29
netsec-ethz/scion
/antlr/sequence/sequence_listener.go
Go
go
4,080
permissive
// File generated by ANTLR. DO NOT EDIT. package sequence // Sequence import "github.com/antlr/antlr4/runtime/Go/antlr" // SequenceListener is a complete listener for a parse tree produced by SequenceParser. type SequenceListener interface { antlr.ParseTreeListener // EnterStart is called when entering the start p...
97bb07a49209a875ff96d91d1ced499c29ba3a87
aec9dd1aacc9219c6cb45087669115e2efc65060
jangocheng/go-elasticsearch
/typedapi/ilm/migratetodatatiers/request.go
Go
go
1,864
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 ...
dd1626133b5bb4646477882bb129f7bc63b69b42
24196baea0faa291439ef645b88fe7aa3fbf6002
SplenDidShot/Distributed-Systems-Projects
/MP2/machine.go
Go
go
9,895
no_license
package main import ( "fmt" "strings" "time" "strconv" "net" "sort" "os/exec" "sync" "os" "bufio" ) // the following is a thread safe data structure type SafeMap struct { mux sync.Mutex list map[string]string prev_list map[string]string seen map[string]string left map[string]int } //--------------...
9f52593193f22e324724ee445286ffa735409f92
880ebeef9866a01a8aed6188a26238d8f9713c21
wuyachi/explorer
/tools/update.go
Go
go
1,425
no_license
/* * Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the Lic...
87e484ac82df47640b0b93ab9b37f3719db1ed68
4815752ddb9de6f81ff831989d090b092a2bef5a
Retler/A5-2-known-plaintext-attack
/a52_equation_generation/a52_equation_generator_test.go
Go
go
33,534
no_license
package a52_equation_generation import ( "testing" "github.com/stretchr/testify/assert" "fmt" "os" . "utils" . "a52" ) func TestR1EqMajorityFunction(t *testing.T){ register := make19IdentityMatrix() var values [19]int values[12] = 1 r1 := R1_eg{register,values, make([]int, 0)} r1Input1 := r1.Register[15][:...
865ed4967407a0c33cc5de548b4a5bc850b1f3f1
ff47b6936f96520964bc534d37352a19e052b978
minhlongdo/dgraph
/query/query_test.go
Go
go
79,568
permissive
/* * Copyright 2015 DGraph Labs, 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...
fd51db758e300cfc05ac97c67b8c344314ad928f
026a3a74aa2642e6c356973ff30147a0f3308aa0
ozkatz/logrus-graylog-hook
/graylog_hook_test.go
Go
go
6,671
permissive
package graylog import ( "compress/flate" "encoding/json" "errors" "io/ioutil" "net" "regexp" "strings" "testing" "time" "github.com/Sirupsen/logrus" pkgerrors "github.com/pkg/errors" ) const SyslogInfoLevel = 6 const SyslogErrorLevel = 7 func TestWritingToUDP(t *testing.T) { r, err := NewReader("127.0....
20dd49bdfeda3b0958bcdfbf05db54198136ed5b
e96e2128fa59a7e7b67dbc8fd6627142ba67da89
pixur/pixur
/be/tasks/add_pic_comment_vote_task.go
Go
go
3,477
permissive
package tasks import ( "context" "math" "time" anypb "github.com/golang/protobuf/ptypes/any" "pixur.org/pixur/be/schema" "pixur.org/pixur/be/schema/db" tab "pixur.org/pixur/be/schema/tables" "pixur.org/pixur/be/status" ) type AddPicCommentVoteTask struct { Beg tab.JobBeginner Now func() time.Time PicId ...
c76e982d2802430cdeef8426ffce571a86a22317
7c330af30510267077e1f43f6028056554443942
wdxxs2z/service-broker-helm
/kubernetes/kube_builder.go
Go
go
1,242
no_license
package kubernetes import ( "github.com/wdxxs2z/service-broker-helm/config" k8sclient "k8s.io/client-go/kubernetes" k8sclientcmd "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/rest" "code.cloudfoundry.org/lager" ) type KubeBuilder struct { buildConfig func(string, string) (*rest.Config, error)...
69a796993b4990f0404cdc5e8ae189ad8862403f
31eb8d8f27ccc1d757ee0dd008442928ea86b9fb
vaaho/siteparser
/downloader.go
Go
go
857
no_license
package main import ( "siteparser/core" "siteparser/downloader" ) // Утилита для скачивания сайтов. // // На вход принимает CSV файл `./input.csv` со списком доменов для скачивания. // На выходе формирует папку `./sites/`, где для каждого домена создаётся JSON файл // с результами скачки сайта. В нёмже сохраняется ...
bfb92e2028bc54e37f283c6740033c8fabfdc473
bbf7c87be2135432827bc826ece8c49d4594699c
ryker-w/go-init
/internal/process/amqp.process.go
Go
go
700
no_license
package process import ( "context" "github.com/lishimeng/go-log" mq "github.com/ryker-w/go-init/internal/amqp" "github.com/ryker-w/go-init/internal/etc" ) var MqService mq.Service type Ds struct { } func (ds *Ds) Subscribe(topic string, v interface{}, upstream mq.Upstream) { log.Info("ds receive:" + topic) lo...
acbf95e28b627fe4337bb7e4e27e48c5481fa8d6
a28dddc263bd3e401a00494426b9fa7e0338d53a
giantswarm/test-operator
/service/controller/v8/resource/deployment/desired.go
Go
go
1,177
permissive
package deployment import ( "context" "fmt" "github.com/giantswarm/microerror" "k8s.io/api/extensions/v1beta1" "github.com/giantswarm/kvm-operator/service/controller/v8/key" ) func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error) { customObject, err := key.ToCustomObjec...
5efccc186cc5dd3a1efc0fc141a2a9dcd14d84df
1f09e27de176714c9489f681dd11cf2b7b2bac14
darkcl/captin
/senders/console_sender.go
Go
go
566
permissive
package senders import ( models "github.com/shoplineapp/captin/models" log "github.com/sirupsen/logrus" ) var cLogger = log.WithFields(log.Fields{"class": "ConsoleEventSender"}) // ConsoleEventSender - Present Event in console type ConsoleEventSender struct{} // SendEvent - #ConsoleEventSender SendEvent func (c *...
cebcc005aa00e45041a59a9be749ad84e3c461fc
c6a05e4bc349ac76705ca14608340e4741159b89
dtynn/venus-sealer
/storage-sealing/upgrade_queue.go
Go
go
2,640
no_license
package sealing import ( "context" "github.com/filecoin-project/venus-sealer/types" "github.com/filecoin-project/venus/pkg/specactors/builtin/miner" "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" ) func (m *Sealing) IsMarkedForUpgrade(...
25a93f387741dda742da63a863e1b5e146743973
db31e5c188b4bd6ffdb480ee02f3a9594f013566
ZhengyuanChain/plugin
/plugin/dapp/pokerbull/executor/pokerbull.go
Go
go
4,030
permissive
// Copyright Fuzamei Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package executor import ( "fmt" log "github.com/33cn/chain33/common/log/log15" drivers "github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/types"...
c28c1fc1dcd135a10c9020cf27e8235f0e8abe73
e86953cf208b7eeb4d91dadb1816b1ccc327b244
sapcc/kubernetes-operators
/openstack-seeder/vendor/k8s.io/kubernetes/pkg/client/listers/core/internalversion/endpoints.go
Go
go
3,163
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, ...
b45eb7bc635313891a82eda7573b3652910e7542
8708ff718be71c2cacfda1b49d3f9430ab51b77a
jdcloud-api/jdcloud-sdk-go
/services/smartdba/models/MetricData.go
Go
go
871
permissive
// Copyright 2018 JDCLOUD.COM // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
49590ed0f687c7a86bd8d9c56b9f9a332b3dfa82
5c162452905b5d6a179ab812cf9baf830766b858
satriowicaksn/covid-information-update
/database/data.go
Go
go
2,798
no_license
package database import ( "context" "covid-information-update/config" "covid-information-update/models" "encoding/json" "net/http" "time" "go.mongodb.org/mongo-driver/bson" ) func FetchDataFromApi() ([]models.DataIndonesia, error) { req, err := http.NewRequest("GET", "https://api.kawalcorona.com/indonesia", ...
c833c7c592d4e425e239fc923a2f3b0b19a5b5e7
e123f1a54054b53a325406be204af5e72cee7210
chenbo90/istio
/tests/integration/pilot/istioctl_test.go
Go
go
16,853
permissive
// +build integ // Copyright Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ...
8607ef4ac2c6036e07f21cabbf6e5d022bbaeafa
146a09c5e84f9020cedbd8dd5d2715b00d49b9c2
JoeGruffins/vspd
/database/database.go
Go
go
6,242
permissive
package database import ( "context" "crypto/ed25519" "crypto/rand" "encoding/binary" "fmt" "net/http" "os" "strconv" "sync" "time" bolt "go.etcd.io/bbolt" ) // VspDatabase wraps an instance of bolt.DB and provides VSP specific // convenience functions. type VspDatabase struct { db *bolt.DB } // The keys...
74b0b56b246d1777aaf6f4c29d9cb9ce75291315
92068360ee15d936057652c64ba0afe305b7b404
zhaojingtao/GoMicroStudy
/01practices/basic/01micro-service/timeout/server/server.go
Go
go
822
no_license
package main import ( proto "GoMicroStudy/01practices/basic/01micro-service/proto" "context" "fmt" "github.com/micro/go-micro" "time" ) type Greeter struct{} func (g *Greeter) Hello(ctx context.Context, req *proto.HelloRequest, rsp *proto.HelloResponse) error { time.Sleep(time.Second * 9) rsp.Greeting = "你好,"...
c7bbbdb77e445e202eb672660aba70123484add3
80695b19dfc2ed620b453c0828c80bd221f82e5f
lewis-od/wavelength
/cmd/version.go
Go
go
320
permissive
package cmd import ( "fmt" "github.com/spf13/cobra" ) func init() { rootCmd.AddCommand(versionCmd) } const version string = "v1.1.0" var versionCmd = &cobra.Command{ Use: "version", Short: "Print the version number of wavelength", Run: func(cmd *cobra.Command, args []string) { fmt.Println(version) }, }
a576ba848c3aaea2164b098c730a1e52fccf5ee7
db99cb1f39bee90cd1b073f6e4fe52f7ecf0b812
TalkingPanda0/100-days-of-code
/Month-3/Week-12/day-80/Go/main.go
Go
go
8,912
no_license
package main import ( "fmt" "log" "math/rand" "os" "os/signal" "runtime/pprof" "time" "github.com/davecgh/go-spew/spew" "github.com/gdamore/tcell" "github.com/jessevdk/go-flags" ) var screen tcell.Screen // command line flags variable var opts struct { // display ascii only instead of ascii+kana's Ascii...
f42ddf8ccdce55546024917be21c721e5949782c
1293581cac5fbcac7f7512b9becf71878982500a
fistchain/fistwallet
/rpc/legacyrpc/methods.go
Go
go
106,508
permissive
// Copyright (c) 2013-2016 The btcsuite developers // Copyright (c) 2015-2018 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package legacyrpc import ( "bytes" "context" "encoding/base64" "encoding/binary" "encoding/hex" "encoding/json" ...
58cc26b19d2d56c7490c09472e8819414848bbb3
84439a9ed08a20c621605ec6d2f8da4085353698
parmarsumit/gvisor
/pkg/tcpip/link/fdbased/endpoint.go
Go
go
15,776
permissive
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
3eeaf9553c90939ad413d3c6c51bb349135419ad
40ac5b4e0438458eb6b4b9e91329e99c2252d180
jsbj519/client
/go/utils/vjson/json.go
Go
go
2,117
no_license
// Copyright 2019 The Vearch 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...
5e9e5f2cb7fa1fbf61fbc93e8139d7071e5e4438
445bbc9430b11720837b5aba7184480f9c33c3c3
golint-fixer/fake_validator
/main.go
Go
go
273
no_license
package main import ( "fmt" "github.com/fake_validator/endpoint" "github.com/fake_validator/router" "log" "net/http" ) func main() { router := router.NewRouter(endpoint.EndpointRoutes) fmt.Printf("Running...\n") log.Fatal(http.ListenAndServe(":8080", router)) }
36d25f88a24ea64c6e363a8fd24781235dd57b72
c0b2e37137d09097787ec7969be5be72cf65ab98
alpacahq/quickfix
/fix44/networkcounterpartysystemstatusrequest/NetworkCounterpartySystemStatusRequest.generated.go
Go
go
6,675
permissive
package networkcounterpartysystemstatusrequest import ( "github.com/alpacahq/quickfix" "github.com/alpacahq/quickfix/enum" "github.com/alpacahq/quickfix/field" "github.com/alpacahq/quickfix/fix44" "github.com/alpacahq/quickfix/tag" ) // NetworkCounterpartySystemStatusRequest is the fix44 NetworkCounterpartySyste...
74b8b70c70d9fb3d0c2083ccd134085331d00bb5
7264384573159e385fca7e9978a74f1d91ea1226
fossabot/sdns
/middleware/resolver/utils.go
Go
go
6,442
permissive
package resolver import ( "encoding/base64" "errors" "math/rand" "net" "strings" "time" "github.com/miekg/dns" "github.com/semihalev/log" ) var ( errNoDNSKEY = errors.New("no DNSKEY records found") errMissingKSK = errors.New("no KSK DNSKEY found for DS records") errFailedToConver...
078cacc31315d428c658dd9337a07e02aacfc00e
3a4de22982fdbd602c4f3e87b3178b5fe3f86d41
ProFL/gophercises-urlshort
/handlers/database_handler.go
Go
go
640
no_license
package handlers import ( "log" "net/http" "github.com/ProFL/gophercises-urlshort/repositories" ) func DatabaseHandler(repo *repositories.RedirectRepository, fallback http.Handler) http.HandlerFunc { return func(res http.ResponseWriter, req *http.Request) { spec, err := repo.FindByPath(req.URL.EscapedPath()) ...
0cfe56748a948ce29fed56d56311f939bf7f5fd5
8d5641871356b1749c3216ba79629c7cbbe951c8
dozeo/goutils
/uuid.go
Go
go
236
permissive
package goutils import ( "fmt" "os" ) func UUID() string { f, _ := os.Open("/dev/urandom") b := make([]byte, 16) f.Read(b) f.Close() uuid := fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]) return uuid }
38a69160b040c616f8cfe739993dbb7028b9d16f
0f8ef8dc7cb2145b60f4ad219609c5db3775e9b5
lvliangxiong/alfred_chrome
/history.go
Go
go
2,118
no_license
package main import ( "fmt" "log" "net/url" "os" "time" aw "github.com/deanishe/awgo" "gorm.io/driver/sqlite" "gorm.io/gorm" "github.com/lvliangxiong/alfred_chrome/model" ) var histories []model.History func showAllHistoryItems() { if enableFilter { histories = filter(histories) } for _, h := range ...
9540b4aa87ed0112be8891e75f753265bdb0312e
2ce864b9c1850895a1934a6e9942c986df4a53c1
malejandromorenov/origin
/pkg/scheduler/admission/podnodeconstraints/admission.go
Go
go
9,413
permissive
package podnodeconstraints import ( "fmt" "io" "reflect" "github.com/golang/glog" kapierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/...
183b6246a3ed085654d6ae71ceac9a02294f8c9b
5ec9a7dbe0b5586ce24635df80a3234a835be27f
XiaoMolin/AlgorithmCHUNZHAO
/Week_04/72. 编辑距离.go
Go
go
1,263
no_license
package main //给你两个单词 word1 和 word2,请你计算出将 word1 转换成 word2 所使用的最少操作数 。 // //你可以对一个单词进行如下三种操作: // //插入一个字符 //删除一个字符 //替换一个字符 // // //示例 1: // //输入:word1 = "horse", word2 = "ros" //输出:3 //解释: //horse -> rorse (将 'h' 替换为 'r') //rorse -> rose (删除 'r') //rose -> ros (删除 'e') func main() { } // 二维dp // dp[i][j] 表示单词1前i个字...
6aafbfcf95292c7a597c769eddd0891ddd38471b
b865bad094bf19dcf68a19df71f0371fad8d37ba
mmihic/go-tools
/pkg/path/pkg_path.go
Go
go
1,041
no_license
package path import ( "path/filepath" "strings" ) // A Path is a path. type Path []string // NewPath creates a new path. func NewPath(s string) Path { return strings.Split(s, "/") } // Append extends one path with another. func (p Path) Append(other Path) Path { newPath := append(Path{}, p...) newPath = append...
0ffcb918132cb3bc253932f87a2fd7e52062356b
f3cda99f888dc6d59baa4d1ce38de6663e29554f
zgohr/codeeval
/easy/fib.go
Go
go
538
no_license
package main import ( "os" "bufio" "fmt" "strings" "strconv" "math" ) func fib(n int) (int) { r := (math.Pow(math.Phi, float64(n)) - (math.Pow(-1, float64(n)) / math.Pow(math.Phi, float64(n)))) / math.Sqrt(5) return int(math.Floor(r+0.5)) } func main() { f, _ := os.Open(os...
d693089043d85875d3562a93e7994305eee71834
85becb0657144dd12d48f1d8858332f05bc3fcd7
vimukthi-git/go-centrifuge
/anchors/test_bootstrapper.go
Go
go
539
permissive
// +build integration unit package anchors import ( "errors" "github.com/centrifuge/go-centrifuge/bootstrap" ) func (b *Bootstrapper) TestBootstrap(context map[string]interface{}) error { if _, ok := context[bootstrap.BootstrappedConfig]; !ok { return errors.New("config hasn't been initialized") } if repo, ...
7b95e892cb17ddc5b00705247904e2ba5e83b12e
b81a0b99a41b4aab1fdd18c46971ff60a83193dd
aswaney/quickfix
/fix41/email/Email.go
Go
go
14,186
permissive
package email import ( "time" "github.com/quickfixgo/quickfix" "github.com/quickfixgo/quickfix/field" "github.com/quickfixgo/quickfix/fix41" "github.com/quickfixgo/quickfix/tag" ) //Email is the fix41 Email type, MsgType = C type Email struct { fix41.Header quickfix.Body fix41.Trailer //ReceiveTime is the t...
6296b52c680bc98bcc6ec0c1e63cc07dd5a587e4
c817df375eed8f3eb7d344bfd50c5ed27b601233
HaidyCao/frp_0321
/cmd/macFrp/log.go
Go
go
827
permissive
package main /* #include <stdio.h> typedef void (*LogListener)(const char* log); LogListener logListener; void setLogListener(LogListener l) { logListener = l; } void callback(const char* log) { if (logListener) { logListener(log); } } void cListener(const char* log) { printf("%s", log); } void testLo...
33f771947beb701ee8536a16b002b136f827f7e6
269e4749e7b55a64f43d5950cd6652412d9a795a
fulldump/kip
/kip_test.go
Go
go
2,774
permissive
package kip import ( . "gopkg.in/check.v1" mgo "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) func (w *World) Test_DaoHappyPath(c *C) { john := w.Users.Create() value := john.Value.(*User) value.Id = bson.NewObjectId() value.Name = "John" value.Age = 16 value.Single = true w.Users.Insert(john) // Check i...
57f3df6a589a89e9e0a736950c153f47ce23bd7d
5fc7f7000f856d5c12fd3b9bb3972d31b8610344
raydac/bkbin2wav
/gobkbin2wav/src/bkbin/bkwav.go
Go
go
5,816
permissive
package bkbin import ( "bytes" "encoding/binary" "io" "log" "math" "os" ) var SND_PARTS = [][]byte{ []byte{0x80, 0xbf, 0xbf, 0x80, 0x40, 0x40, 0x80, 0xbf, 0xbf, 0x80, 0x40, 0x40}, []byte{0x80, 0xa0, 0xb7, 0xc0, 0xb7, 0xa0, 0x80, 0x5f, 0x48, 0x3f, 0x48, 0x5f, 0x80, 0xb7, 0xb7, 0x80, 0x48, 0x48}, []byte{0x80, ...