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
54ae441ee39f3dc03de89ec8c38dba0f5fc4b70e
fbbc22573fa75c86ac43579c22693184994222f9
zpxio/mdsite
/pkg/resource/raw.go
Go
go
1,028
permissive
/* * Copyright 2020 zpxio (Jeff Sharpe) * * 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...
b8231873e1617a9c0043ee100ac182731bee1ebf
146a04f4a2910c8c2a0dc0d1318d5107748c02db
distil/cfssl
/vendor/github.com/lib/pq/encode_test.go
Go
go
21,425
permissive
package pq import ( "bytes" "database/sql" "fmt" "strings" "testing" "time" "github.com/lib/pq/oid" ) func TestScanTimestamp(t *testing.T) { var nt NullTime tn := time.Now() nt.Scan(tn) if !nt.Valid { t.Errorf("Expected Valid=false") } if nt.Time != tn { t.Errorf("Time value mismatch") } } func Te...
a26c729a8906eaa57ee9d261c9a79f3cd51409b8
637f17b46cd28ee7a403a23af698d713e7e5daaa
filecoin-project/lotus
/chain/messagesigner/messagesigner_test.go
Go
go
4,394
permissive
// stm: #unit package messagesigner import ( "context" "sync" "testing" "github.com/ipfs/go-datastore" ds_sync "github.com/ipfs/go-datastore/sync" "github.com/stretchr/testify/require" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/messagepool" "gi...
b017921044130d5d60dbb92fd464edbf397a3d59
6f6561b2edd4b1e45461b1185d5c3a66918b34d5
grafana/agent
/pkg/util/subset/subset.go
Go
go
3,377
permissive
// Package subset implements functions to check if one value is a subset of // another. package subset import ( "fmt" "reflect" "gopkg.in/yaml.v2" ) // Assert checks whether target is a subset of source. source and target must // be the same type. target is a subset of source when: // // - If target and source ...
c7a74d9340d62c59e524aafab5e66abd173ae6db
231bb2b54d4a99e7a7bfc40abb3ce63ebc3e00ae
julieni/ovh-service-contact-change
/utils.go
Go
go
1,053
no_license
package main import ( "os" "os/signal" "regexp" "strings" "syscall" "github.com/pkg/browser" "golang.org/x/crypto/ssh/terminal" ) func createAPIToken() error { err := browser.OpenURL("https://eu.api.ovh.com/createToken/?GET=/me/task/contactChange&GET=/me/task/contactChange/*&POST=/me/task/contactChange/*") ...
6a95e543afa2c0e7b89f78abb9562a29ab7e32cb
caac8a7773251115abb2ef628c1887a269694b31
limen/gotour
/iota_test.go
Go
go
566
no_license
package main import ( "github.com/stretchr/testify/assert" "testing" ) type errorLevel uint func TestIota(t *testing.T) { const ( info errorLevel = 1 << iota warn fatal ) assert.Equal(t, info, errorLevel(1<<0)) assert.Equal(t, warn, errorLevel(1<<1)) assert.Equal(t, fatal, errorLevel(1<<2)) const ( b...
c73fced72a1bfa035fec6e732471b869c1835b3c
a339efe963ae5d5fe412b49482ba5923d59b7a3c
joaowiciuk/juggernaut
/schedule.go
Go
go
1,128
no_license
package main import ( "log" "os" ) // Responsibilities: // * To schedule future relay and infrared operations // ScheduleManager type ScheduleManager struct { DatabaseManager *DatabaseManager LogFile *os.File Logger *log.Logger } const ( ScheduleTypeRelay = "TypeRelay" ScheduleTypeInfrared...
bbf42f4b6cbf262d664f56c07e994e78da5e9e99
3e0cbe1cb3898a0d87830601a60a6d242792e5a0
tastembekov/kuberlogic
/modules/operator/service-operator/mysql/session.go
Go
go
4,451
permissive
/* * CloudLinux Software Inc 2019-2021 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 ap...
078a1a1e89cf17d86e8136619c94575bc77994a4
8d8a907c45680b9e2615c4cd4ee796a20d733100
hemantra/airshipctl
/cmd/bootstrap/bootstrap.go
Go
go
649
no_license
package bootstrap import ( "fmt" "github.com/spf13/cobra" "github.com/ian-howell/airshipctl/pkg/environment" ) // PluginSettingsID is used as a key in the root settings map of plugin settings const PluginSettingsID = "bootstrap" // NewBootstrapCommand creates a new command for bootstrapping airshipctl func NewB...
31148912e076605ff568adfac563af0ef4eccc5a
1eed21ecebb093f35a9137518f8f03083e29a7b9
vivekv96/leetcode-go
/easy/1528-shuffle-string/main.go
Go
go
252
permissive
// Problem: https://leetcode.com/problems/shuffle-string/ package main func restoreString(s string, indices []int) string { output := make([]byte, len(s)) for i := 0; i < len(indices); i++ { output[indices[i]] = s[i] } return string(output) }
a3b541854de0da2918592129cac5ebdeab6f2a32
99e98937f3a428ff3c972fd50c766a4e0e757e78
l-dandelion/yi-ants-go
/core/module/addr_test.go
Go
go
1,344
no_license
package module import ( "strconv" "testing" ) var legalNetworkMap = map[string]struct{}{ "http": struct{}{}, "https": struct{}{}, } var legalIPMap = map[string]struct{}{ "192.0.2.1": struct{}{}, "2001:db8::68": struct{}{}, } func TestAddrNew(t *testing.T) { var network, ip string port := uint64(8080) f...
0f5ed867c9e89f6b47e98456a32015dd65e52ed2
652b525a94203e0b3017d3685bfc83c84be1a4ec
wg001/foundation
/channel2/memory_listener.go
Go
go
2,283
permissive
/* Copyright NetFoundry, 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
d8aeb373116ab272ce888bda829a4d8fa06deb48
b3a816bef60e6b029eee149f0d3636ed6e6d3e98
ClintonKildepstein/venus
/pkg/chain/store.go
Go
go
37,887
permissive
package chain import ( "bytes" "context" "io" "os" "runtime/debug" "sync" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/venus/pkg/state" "github.com/cskr/pubsub" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filec...
0fa74ad907ffeb1caae334eb4b206819dc350500
6b25ce052642ed5ab59ccf4c26d2e17caa77fd4e
chenbh/booklit
/errors.go
Go
go
11,538
permissive
package booklit import ( "bufio" "bytes" "fmt" "html/template" "io" "net/http" "os" "path/filepath" "strings" "github.com/segmentio/textio" "github.com/vito/booklit/ast" "github.com/vito/booklit/errhtml" ) var errorTmpl *template.Template func init() { errorTmpl = template.New("errors").Funcs(template....
0cd34055f992deda55ceb0f29c616f8001f257b6
308e417065cfadee2a13760b6bfe01a9e736e6cd
driskell/log-courier
/lc-lib/grok/grok.go
Go
go
10,208
permissive
/* * Copyright 2012-2020 Jason Woods and 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...
53fbaa7de026111ef98afa036347667359a56a7f
477f583a1d54fa9b88f1a8efdad0b31c6e8fa600
kakhaUrigashvili/go-rest-api
/handler/rate.go
Go
go
3,456
no_license
package handler import ( "encoding/json" "net/http" "strconv" "strings" "time" "github.com/gorilla/schema" "github.com/kakhaUrigashvili/go-rest-api/model" ) var decoder = schema.NewDecoder() var rates model.RateCollection = model.RateCollection{Rates: []model.Rate{}} func dateEqual(date1, date2 time.Time) b...
343b44a0dffcb5c966ad7c1a890a4c98c3287ab8
7ad87c85303bbef63fa5da59609373e83b9d30c8
Jorropo/go-ipfs
/config/experiments.go
Go
go
359
permissive
package config type Experiments struct { FilestoreEnabled bool UrlstoreEnabled bool ShardingEnabled bool `json:",omitempty"` // deprecated by autosharding: https://github.com/ipfs/kubo/pull/8527 GraphsyncEnabled bool Libp2pStreamMounting bool P2pHttpProxy bool //nolint StrategicProvidi...
423c188d136cffc4482dabff24afb0d86312fa99
f16e858361d3a15491b80ad7c577fef0ddde8ae7
thamizhv/tgnutella
/handlers/cmd/open.go
Go
go
2,196
permissive
package cmd import ( "encoding/json" "fmt" "net" "strings" "github.com/thamizhv/tgnutella/cache" "github.com/thamizhv/tgnutella/constants" "github.com/thamizhv/tgnutella/helpers" "github.com/thamizhv/tgnutella/models" ) type openHandler struct { myTCPAddress string myHTTPAddress string peerList cach...
f4d8331ad648cc9d7508f4575bf5517c48ce00b3
afa6323d73094e5aff33c629334b983bae82c9ac
johntdyer/golang-devops-stuff
/src/github.com/mailgun/vulcan/command/forward.go
Go
go
2,777
permissive
package command import ( "fmt" "net/http" ) // Forward reply tells proxy to forward the request to the given upstreams type Forward struct { // Allows proxy to fall back to the next upstream // if the selected upstream failed Failover *Failover // Each rate key represents a resource to limit, e.g. ip address or...
057fdadc4cf1a94b9b3fc3d9a1c999c9fb32a8d3
9a07948abf821f0c7c8a8fdc861893b694c62743
cwl168/awesomeProject
/interface/interface2.go
Go
go
906
no_license
package main import "fmt" func main() { /*values := map[string]interface{}{ "modified_by": 4, "state": 5, } // map 为引用类型 update(values) fmt.Println(values)*/ i := 1 update2(i) fmt.Println(i) ps := new([]string) fmt.Println(*ps) *ps = append(*ps, "aa") fmt.Println(*ps) a := make([]int, 20) b ...
fb3194152fc47de73bc4d8dddea353d6932679bf
2f89b63248aaae57c83eebcc7771886221817e89
zer0se7en/fabric-ca
/vendor/github.com/IBM/mathlib/math.go
Go
go
7,536
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package math import ( "bytes" "encoding/binary" "fmt" "io" "github.com/IBM/mathlib/driver" "github.com/IBM/mathlib/driver/amcl" "github.com/IBM/mathlib/driver/gurvy" "github.com/pkg/errors" ) type CurveID int const ( FP256...
16fb545e5335d51323f6da3b46c229077fab07e8
716078c8e03b9a75ab5b45243cd3b77b12b23600
adammfrank/huffman
/huffman/RunePriorityQueue.go
Go
go
1,220
permissive
package huffman import "container/heap" // RunePriorityQueue wraps a PriorityQueue and turns it into a heap type RunePriorityQueue struct { queue *PriorityQueue } // NewRunePriorityQueue constructs a RunePriorityQueue and optionally takes a PriorityQueue // to use as a base func NewRunePriorityQueue(pq *PriorityQue...
b4c982b85cfa5f9264f0f5395eb30b095801c996
1e6fb20468ff165b7c612df219d82ed4f75f2808
anishmgoyal/calagora
/controllers/image.go
Go
go
2,716
no_license
package controllers import ( "log" "net/http" "strconv" "strings" "github.com/anishmgoyal/calagora/models" "github.com/anishmgoyal/calagora/wsock" ) type imageDelete struct { Media string `json:"media"` MediaID int `json:"media_id"` ID int `json:"id"` } type webAPIImageDeleteResponse struct { ...
278c2a4c8baceea5f8b5a42bb9465d51cb77ebcd
577f7b379d8654935e616a409d46d39c8667adde
mindis/cockroach
/storage/timestamp_cache.go
Go
go
6,061
permissive
// Copyright 2014 The Cockroach Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
617f375130f595f45a2d631a87e34c68f7efebca
d7b837ed60349c8cc25506407b526596e37c85df
zairza-cetb/hacktoberfest-2018
/graph_algorithms/depth_first_search/go/dfs.go
Go
go
241
permissive
package dfs import ( "fmt" "io" ) type tree struct { left *tree value int right *tree } func traverse(t *tree, w io.Writer) { if t == nil { return } fmt.Fprintf(w, " %d ", t.value) traverse(t.left, w) traverse(t.right, w) }
1e937bd988cc47a0e83f87d1350ebd7e76798f4f
d727882ee67a73e4abc1902cc86f2d12fa162079
Danushka96/Sia
/modules/renter/proto/consts.go
Go
go
3,187
permissive
package proto import ( "time" "gitlab.com/NebulousLabs/Sia/build" "gitlab.com/NebulousLabs/Sia/crypto" "gitlab.com/NebulousLabs/Sia/modules" "gitlab.com/NebulousLabs/Sia/types" ) const ( // contractExtension is the extension given to contract files. contractExtension = ".contract" // rootsDiskLoadBulkSize i...
e5dddabdbc361780d1132a67aad3d1ed0f47ba25
38862070616d4e80070bea70049c8ed9922ae5fe
chenxull/MyLeetCode
/2019.7/2019.7.7/64/64.minimum-path-sum.go
Go
go
659
no_license
package problem64 /* * @lc app=leetcode id=64 lang=golang * * [64] Minimum Path Sum */ func minPathSum(grid [][]int) int { m := len(grid) n := len(grid[0]) // 提前构建好二维数组 dp := make([][]int, m) for i := range dp { dp[i] = make([]int, n) } dp[0][0] = grid[0][0] // 处理最左边的一列 for i := 1; i < m; i++ { dp[i]...
74f55bef90d841910d72485ed5273aa790764db9
c7a9566a89fd3d172898b4293f69f6ea2b39e9b8
dla1434/GoTest
/book/best_easy_golang/Unit 19/switch_fallthrough.go
Go
go
620
no_license
package main import "fmt" func main() { i := 3 switch i { // 값을 판단할 변수 설정 case 4: // 각 조건에 일치하는 fmt.Println("4 이상") // 코드를 실행합니다. fallthrough case 3: // 3과 변수의 값이 일치하므로 fmt.Println("3 이상") // 이 부분을 실행 fallthrough // fallthrough를 사용했으므로 아래 case를 모두 실행 case 2: fmt.Println("2 이상") // 실행 fallthr...
c96f2db1c3243d7ef636e80be0a0f81f3093b0a7
f80daaf4b06c9bd09f489a60152a08f589902b99
GolangLovers/go-by-example
/go-concurrency/timeout-select.go
Go
go
1,531
no_license
package main import ( "fmt" "time" ) func main() { go func() { var e int ok := true for { select { case e, ok = <-ch11: // 省略若干代码 case ok = <-func() chan bool { timeout := make(chan bool, 1) go func() { time.Sleep(time.Millisecond) timeout <- false }() return timeout ...
1d3e3a3d8398cf34faacc6ea12981107e5086273
e6da313214b334a76d91dafbbde337009a94be80
maiyama18/dog
/lex/lex_test.go
Go
go
3,155
no_license
package lex import ( "testing" "github.com/maiyama18/dog/token" ) func TestNextToken(t *testing.T) { input := ` let five = 5; let add = fn(x, y) { x + y; }; let result = add(five, 10); !-/*5; 5 < 10 > 5; if (5 < 10) { return true; } else { return false; } 10 == 10; 10 != 9; ` expectedTokens := []token.Tok...
343754fa74f3740a64a5be2ed2471bdab80a42e9
ca66dec5f42fa4d557586e3b6f5daaf1b2dac882
maniacs-satm/saltpack
/const.go
Go
go
3,309
permissive
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package saltpack // MessageType is an int used to describe what "type" of message it is. type MessageType int // packetSeqno is a special int type used to describe which packet in the // sequence ...
4c8ee62e438ed461eaa02b78c325626973031c3f
c62652534f0a681c8b0e8aa53a1c485c544f596d
ahkumar/singularity
/src/cmd/singularity/cli/capability_add.go
Go
go
2,222
permissive
// Copyright (c) 2018, Sylabs Inc. All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the // LICENSE file distributed with the sources of this project regarding your // rights to use or distribute this software. package cli import ( "github.com/singularityware/singularity/...
3aa36b46a7a40b1da99494efc547c7d00515dc38
2660ec6cb6e8205aced4e632835a9757f96a9275
fred15/go-programs
/trial.go
Go
go
11,410
no_license
package main import ( "fmt" "bufio" "os" "strings" "strconv" ) func getYear() int { var inputyear int fmt.Printf("\nyear from 1986-2006: ") fmt.Scanf("%d", &inputyear) if inputyear < 1986 || inputyear > 2006{ fmt.Printf("wrong input, try again: ") inputyear = getYear() } retur...
0fa4054cba02d8b73d67e81d165d9483d3863664
f3418fdb65698ab6667dca8f14d54734ca067d98
jonenxs/gf
/web/server/server.go
Go
go
851
no_license
package main import ( "gitee.com/johng/gf/g" ) //多服务支持 func main() { //在支持多个Web Server的语句中,给g.Server方法传递了不同的参数 //(参数可以为任意类型,常用字符串或者整型识别),该参数为Web Server的名称, // 之前我们提到g.Server方法采用了单例设计模式,该参数用于标识不同的Web Server,因此需要保证唯一性 s1 := g.Server("s1") s1.SetPort(8080) s1.SetIndexFolder(true) s1.SetServerRoot("/home/www/stat...
5f2cdbce63273781d7b0dffe55386e9a7234928e
50a07a3bcf5e977c13d423f12a6412b1a4f23127
njfox/godradis
/issue.go
Go
go
299
permissive
package godradis import "github.com/iancoleman/orderedmap" type Issue struct { Id int `json:"id"` Title string `json:"title"` Fields orderedmap.OrderedMap `json:"fields"` Text string `json:"text"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Project *Project }
91f6a8ee811104c67bafb1b1f1c6d82a64c6a5bb
bec380db46103b91de728b553d21287273369a68
novacloudcz/graphql-orm
/model/model.object-field-aggregations.go
Go
go
1,099
permissive
package model import ( "fmt" "strings" "github.com/graphql-go/graphql/language/ast" ) // ObjectFieldAggregation specifies which aggregation functions are supported for given field type ObjectFieldAggregation struct { Field string Name string Type ast.Type } // FieldName ... func (a *ObjectFieldAggregation) ...
501229992915c3ae96ea8f0302110b1b58980639
4bf304ecdfbc9328a48671163c049f7e3999f71d
sanwishe/leetcode
/src/go/datastructure/circularqueue/queue.go
Go
go
1,962
no_license
package circular type MyCircularQueue struct { queue []int size int header int tail int } /** Initialize your data structure here. Set the size of the queue to be k. **/ func Constructor(k int) MyCircularQueue { return MyCircularQueue{ queue: make([]int, k), size: 0, header: -1, tail: -1, } } ...
a18337ea304887b61374086cefc1460a359a4b6d
1106a63a7ed452d8ed840f8ff71718cf4afce0e2
Corporex/origin
/pkg/apps/strategy/support/acceptor.go
Go
go
3,814
permissive
package support import ( "context" "fmt" "io" "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" corev1client "k8s.io/client-go/kubernetes/typ...
d99aa94f4c5754f9001974ff9389e3d75b14c3ad
f57be679338ef93fc92b1b0dd57fad5aabf9ebed
naqvijafar91/go-workshops
/005-http/02-stdlib-encoding-json/json-decoding-and-decoding/json-encoding-and-decoding.go
Go
go
3,730
no_license
package main import "encoding/json" import "fmt" import "os" type Response1 struct { Page int Fruits []string somePrivateField string } type Response2 struct { Page int `json:"page"` Fruits []string `json:"healthy_fruits"` Color string `json:"color,omitempty"` No...
1575da6b409d71f0a5057084685ad592bbdbb00f
7532c2e37de1efad521c50e9a623eaaa3e1c88f0
gnanaikya/erda
/pkg/jsonstore/etcd/etcd.go
Go
go
12,375
permissive
// Copyright (c) 2021 Terminus, 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 agree...
9d96114b826c94ed7e73f6636604b8f68856792b
7e576f2d5e53dcb57d09d879e6cde8199374ab56
gruntwork-io/cloud-nuke
/aws/types.go
Go
go
6,342
permissive
package aws import ( "fmt" "github.com/aws/aws-sdk-go/aws/session" "github.com/gruntwork-io/cloud-nuke/config" "strings" "time" ) type AwsAccountResources struct { Resources map[string]AwsRegionResource } func (a *AwsAccountResources) GetRegion(region string) AwsRegionResource { if val, ok := a.Resources[regi...
43b1cfd0a17a4c723f7352b9cd49d2e8d4a3fa83
ebc933a3ec9b401c0b84120b7978aaf9231fae07
lizhuqi/node-problem-detector
/pkg/systemstatsmonitor/types/config_test.go
Go
go
4,085
permissive
/* Copyright 2019 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...
cdc684dbf3278c9334180b4de42cb18b0567dbef
c6919216b80893ed135382e8948d53ca6ef78ee4
fuzhengwei/cfs
/vendor/golang.org/x/text/unicode/cldr/resolve.go
Go
go
15,492
permissive
// Copyright 2013 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 cldr // This file implements the various inheritance constructs defined by LDML. // See http://www.unicode.org/reports/tr35/#Inheritance_and_Validity /...
a3b965cf415965846f1546043ebcb877372b150d
0df06965e9f3c02919c551f654c5fb134b90e77b
ipfs/iptb
/commands/metric.go
Go
go
1,922
permissive
package commands import ( "fmt" "path" "strconv" cli "github.com/urfave/cli" "github.com/ipfs/iptb/testbed" testbedi "github.com/ipfs/iptb/testbed/interfaces" ) var MetricCmd = cli.Command{ Category: "METRICS", Name: "metric", Usage: "get metric from node", ArgsUsage: "<node> [metric]", Action:...
f598103497994eb453c35436fdba620e578f3bd9
6e54bd254ffd0481c1ec348dcb3667b72e3507dd
liqotech/linkerd2
/jaeger/cmd/check.go
Go
go
7,699
permissive
package cmd import ( "context" "fmt" "io" "os" "time" pkgcmd "github.com/linkerd/linkerd2/pkg/cmd" "github.com/linkerd/linkerd2/pkg/healthcheck" "github.com/linkerd/linkerd2/pkg/version" "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( // JaegerExtensionName is the name of...
c92eb5b1d68b8ad011577de21c6ba4c53f0f0329
05951bcae7e8d28dfd7e775cb99f8335fca6a9ab
cherdak4/oasis-core
/go/staking/api/api_test.go
Go
go
9,805
permissive
package api import ( "testing" "github.com/stretchr/testify/require" "github.com/oasisprotocol/oasis-core/go/beacon/api" "github.com/oasisprotocol/oasis-core/go/common/quantity" ) func TestConsensusParameters(t *testing.T) { require := require.New(t) // Default consensus parameters. var emptyParams Consensu...
fd1cfb7745084c6b238eadabde2098dc157f4e12
9d2797d3ccc7f7f29ba20c6ba0a4a416f73fdcc4
robot-den/go_pl
/book_go_programming_language/shared/oscilloscope/oscilloscope.go
Go
go
979
no_license
package oscilloscope import ( "image" "image/color" "image/gif" "io" "math" "math/rand" "time" ) var greenColor = color.RGBA{0x00, 0xe6, 0x4d, 99} var palette = []color.Color{color.Black, greenColor} const ( backgroundColor = 0 linesColor = 1 ) func Oscilloscope(out io.Writer, cycles float64) { const...
399f1efdb0c7c47b2e29c84cc85c5903fa4f55aa
d2b32ddbfab66427eb28a45458573ad1e9bf557f
bpkgoud/pulumi-azure-native
/sdk/go/azure/dataprotection/v20210701/backupInstance.go
Go
go
3,858
permissive
package v20210701 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type BackupInstance struct { pulumi.CustomResourceState Name pulumi.StringOutput `pulumi:"name"` Properties BackupInstanceResponseOutput `pulumi:"properties"` SystemData Sys...
0b547c5427840b65e8bc9e3a92db28d74c2148ab
b54f2b8a508f235c66a8fdc2cce4ba50633fd736
doloopwhile/foo
/foo_test.go
Go
go
270
no_license
package foo import ( "github.com/stretchr/testify/assert" "testing" ) type fooTest struct { in, out int } func TestFoo(t *testing.T) { tests := []fooTest{ fooTest{1, 1}, fooTest{2, 2}, } for _, ft := range tests { assert.Equal(t, Foo(ft.in), ft.out) } }
bcc25a99b39ae300f26e974d23b211c62e27f3bf
ec9ab5471d3351221bf56f3ec5b8537d48530022
jmheidly/mmock
/parse/fake_data_parse.go
Go
go
2,745
permissive
package parse import ( "github.com/jmartin82/mmock/definition" "github.com/jmartin82/mmock/parse/fakedata" "log" "reflect" "regexp" "strings" ) type FakeDataParse struct { Fake fakedata.DataFaker } func (this FakeDataParse) getQueryStringParam(req *definition.Request, name string) (string, bool) { if len(re...
5cbe6c64f247d702a2464bf70f3a60999c035ac9
1b08091600c7fcfb25fb50a6d59fcdada625a50d
SlardarDev/facility
/conv/internal/generated/maptests.go
Go
go
111,848
no_license
package generated import ( "time" ) // MapTest represents a single Map conversion test. type MapTest struct { Into interface{} From map[string]string Exp interface{} } // MapTests is a slice of all Map conversion tests. func NewMapTests() (tests []MapTest) { tests = []MapTest{ {make(map[bool]bool), map[st...
ed3f365fb7a3653c3c79d0f855f949ef5a4cfe32
066218f2bbd967ca854b1e2c50fcad3ba01e2c54
SierraSoftworks/heimdall
/stores/store.go
Go
go
1,183
permissive
package stores import ( "github.com/SierraSoftworks/heimdall/models" ) var activeStore Store func GetStore() Store { if activeStore == nil { activeStore = NewMemory() } return activeStore } type Store interface { AddReport(r *models.Report) error GetClients(q *ClientsQuery) ([]models.Cl...
ec456643152a821caf4728e163c614dfbe0f0fd3
214af55db36e1eb0f673b0d809c3d6b63273ab35
ooyala/atlantis-manager
/src/atlantis/manager/datamodel/ipgroup.go
Go
go
1,488
permissive
/* Copyright 2014 Ooyala, Inc. All rights reserved. * * This file is 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 applic...
27c8740ac0e0486e88b322d0e90af49144aae26a
439f925f659f36a0721ae9cf42ca4c118f0b274f
erda-project/erda
/internal/tools/orchestrator/hepa/gateway/dto/consumer_edit_dto.go
Go
go
721
permissive
// Copyright (c) 2021 Terminus, 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 agree...
8d56770ce37708d65b2f73c7259be4a797ee696c
d000ce29d9992923af8a92b805d441ca5dd409c7
m1zzx2/influxdb
/v1/services/storage/series_cursor.go
Go
go
5,721
permissive
package storage import ( "context" "github.com/influxdata/influxdb/v2/influxql/query" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/storage/reads" "github.com/influxdata/influxdb/v2/storage/reads/datatypes" "github.com/influxdata/influxdb/v2/tsdb" "github.com/influxdata/influxql...
95c8f072998ae1ecc0124a1b6f7abfb14fea2e08
7645f8f7ce8f2edeb4d3a5d51b61f46802ed6c14
balpert89/teleport
/lib/client/api.go
Go
go
69,468
permissive
/* Copyright 2016-2019 Gravitational, 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,...
22401007b39e037e173bc7ae770e35102bc122ad
edbea385911c8257ead8371840a6411311ebf8a9
uhdang/introToGoUdemy
/22_go-routines/14_incrementor-challenge/02_solution/main.go
Go
go
526
no_license
package main import ( "fmt" "strconv" ) func main() { c := incrementor(2) var count int for n := range c { count++ fmt.Println(n) } fmt.Println("Final Count:", count) } func incrementor(n int) chan string { c := make(chan string) done := make(chan bool) for i := 0; i < n; i++ { go func(i int) { ...
82828724abd0c3a0e3d4375b3e05b3a2cfb86a9f
17f1560dfbae923bea227e5e8e0c98e986b1302d
FranklinHarry/provider-mongodbatlas-controller
/vendor/go.mongodb.org/atlas/mongodbatlas/cloud_provider_access.go
Go
go
6,745
permissive
// Copyright 2021 MongoDB 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...
ee535a86a7c69b5ede78d17e49514008d376dbd9
f6050761550684a7b6a424ee495e1d6b014af8c5
ganyyy/LeetGo
/1400-1500/lc1418_displayTable.go
Go
go
1,158
no_license
package main import ( "sort" "strconv" ) func displayTable(orders [][]string) [][]string { // 合并同一桌子上的菜品, 和点餐人无关? var m = make(map[string]map[string]int) var foodM = make(map[string]int) var add = func(table, food string) { var tm, ok = m[table] if !ok { tm = make(map[string]int) m[table] = tm } ...
3c42be2924e31c89ef4c9b70ec0a91e350ba5fa5
5ba14bd5b1e111698412959798b9fa11fcf76309
sjatsh/tank
/src/vendor/github.com/pingcap/pd/server/core/resource_kind.go
Go
go
930
permissive
// Copyright 2017 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
f1a6be7dc367862c5b91594a07c9b57c423ab1b7
dbd66069ba52c3c6c8a64ff1e9fa37e7376f3da8
VLaroye/gasso-back
/app/domain/model/account.go
Go
go
265
no_license
package model type Account struct { id string name string } func NewAccount(id, name string) *Account { return &Account{ id: id, name: name, } } func (a *Account) GetId() string { return a.id } func (a *Account) GetName() string { return a.name }
2834934185eb27f19e7174621a3195a2a0f8cc6d
f700c106039008116b7d2712581e17c7e7cd9361
GoldThree/MyBlog
/server/models/users.go
Go
go
1,027
no_license
package models type User struct { UUID string `json:"uuid"` UserName string `json:"username"` Phone string `json:"phone"` Gender string `json:"gender"` PasswordSalt string `json:"password_salt"` PasswordHash string `json:"password_hash"` CreatedAt int64 `json:"created_at"` UpdatedA...
d668d0dde7481edc9d96fa6c0f55e9627326c5cf
132b2edef7b3c808e58b6a6ee85c140555429a87
jonasrosland/cluster-api
/cmd/clusterctl/pkg/client/config_test.go
Go
go
13,564
permissive
/* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
57b5cb3b5c99f26c01f2f00dfc1e3a79ec0c6130
23ffbd2058b776b78506f3094fa877eb3a710a7c
icowan/tank
/code/rest/matter_dao.go
Go
go
12,910
permissive
package rest import ( "github.com/eyebluecn/tank/code/core" "github.com/eyebluecn/tank/code/tool/builder" "github.com/eyebluecn/tank/code/tool/result" "github.com/eyebluecn/tank/code/tool/util" "github.com/jinzhu/gorm" "github.com/nu7hatch/gouuid" "os" "time" ) type MatterDao struct { BaseDao imageCacheDao ...
c96cdf7f11a5055c904ee62bc595f230df91398a
932be83a835f1d9baf08126a7b22007afcd6652b
chccc1994/go_everyday_package
/01ini/main.go
Go
go
722
permissive
package main import ( "fmt" "log" "github.com/go-ini/ini" ) func main() { cfg, err := ini.Load("conf/app.ini") // 加载ini 配置文件 if err != nil { log.Fatalf("配置文件读取错误 'conf/app.ini': %v", err) } // 由 Must 开头的方法名允许接收一个相同类型的参数来作为默认值 // https://ini.unknwon.io/docs/howto/work_with_values fmt.Println("", cfg.Secti...
958a905db9c63255b96b0158b1d1d08f67e797a3
eb28254c7a84f90e2c1cbf193f96f27c67674593
fourside/videoserver
/backend/category.go
Go
go
1,080
no_license
package main import ( "encoding/json" "fmt" "net/http" "os" "path/filepath" "sort" ) func category(w http.ResponseWriter, r *http.Request) { category, err := globCategory() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } res, err := json.Marshal(categoryResponse{ Ca...
d9d8c20b4a66ebd35f65996f467a16d5e5ec58bb
c29b7e9810fae8302625b11b4305cbe7b11047a3
getkin/kin-openapi
/openapi3/issue382_test.go
Go
go
323
permissive
package openapi3 import ( "testing" "github.com/stretchr/testify/require" ) func TestOverridingGlobalParametersValidation(t *testing.T) { loader := NewLoader() doc, err := loader.LoadFromFile("testdata/Test_param_override.yml") require.NoError(t, err) err = doc.Validate(loader.Context) require.NoError(t, err)...
75270becbc87c7ddd8497334a64aae526c09a233
2640b65bdc118d204919e035e3e67cac25dd4daf
TNTM-2022/gogo-conn
/config/config.go
Go
go
693
no_license
package config import ( "fmt" "math" "os" "time" ) var ( _tmp = "" ProtoPath = &_tmp _serverid = fmt.Sprintf("connector-%v", time.Now().Format("200601021504")) //奇葩, 必须是这个时间点 ServerID = &_serverid _serverType = "connector" ServerType = &_serverType _e = "...
4f4e72b54c8f08ce0f76a90bfcdf3a26497abc50
473b5f198659340df8c6e3ec7dcd409a0be58c71
hemkum/chillzone
/build_empty_schedule.go
Go
go
638
no_license
package main import ( "log" "sort" ) func build_empty_schedule(rooms map[string][][]string) [][][]string { empty_sched := [][][]string{} for i := 0; i < 5; i++ { empty_sched = append(empty_sched, [][]string{}) for j := 0; j < 9; j++ { empty_sched[i] = append(empty_sched[i], []string{}) } } for room, ...
02f80f6da6f2d75bd606e0df89c940dcba561e67
d70b2f14b7731963ceddf6b5da5656960f82d6aa
ccamel/fission
/pkg/fission-cli/function.go
Go
go
27,404
permissive
/* Copyright 2016 The Fission 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, sof...
59dd2225f858f226d482225a30162a32ebc522da
ee0315887360007fa2a3f27b3ecff269a1f23c1b
khairulanas/go-fundamental
/main.go
Go
go
3,377
no_license
package main import ( "errors" "fmt" ) //interface type Karakter interface { GetNama() string } //User stric type User struct { ID int firstname string lastName string } type Admin struct { nama string } func (user User) GetNama() string { return "namanya user: " + user.firstname } func (admin Admi...
773bf13bd99396befa9e7d9e2e9949b7d9247f1d
e0c2558844a06de52d6752a882f5979dd000f0c6
yousong/onecloud
/pkg/hostman/hostdeployer/deployserver/deployserver.go
Go
go
11,166
permissive
// Copyright 2019 Yunion // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writi...
612bd1ed4affb1d77fdad8d4470506d760b981f8
b905c02be2c4de90d718ad84e8c601d4254b4b5d
MisinformedDNA/pulumi-azure-native
/sdk/go/azure/desktopvirtualization/v20190924preview/workspace.go
Go
go
7,879
permissive
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package v20190924preview import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) // Represents a Workspace definit...
66b1d504d52988a62ffa30474b691ee7836cc48d
0b53a1e8ac624e5fd613223defc466f843a5645d
shamrickus/trafficcontrol
/lib/go-log/log.go
Go
go
9,217
permissive
// Inspired by https://www.goinggo.net/2013/11/using-log-package-in-go.html package log /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF li...
357971f5cacf80ea705468e7b1cecbd5561ca2bd
0f9a7c7a8212f9475fa4757151fdd20d7ca85aed
alamehor/pachyderm
/src/pfs/drive/drive.go
Go
go
1,672
permissive
/* Package drive provides the definitions for the low-level pfs storage drivers. */ package drive import ( "io" "go.pedge.io/google-protobuf" "github.com/pachyderm/pachyderm/src/pfs" ) // Driver represents a low-level pfs storage driver. type Driver interface { CreateRepo(repo *pfs.Repo, created *google_protobu...
2675ca28c395d94b6681b53591b3833f249dec24
e3d63a95911beeaacf3ffad02fd90a58af2d3729
jpad-freedomfi/magma
/feg/gateway/services/csfb/servicers/decode/message/decoder_test.go
Go
go
46,000
permissive
/* Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR...
1f2a051ce1663b1329c5ea07e1c4a27d3be4ac37
12c3f163869f73fd3f29b133816e1e03edce74ad
butonic/ocis
/extensions/graph-explorer/pkg/tracing/tracing.go
Go
go
581
permissive
package tracing import ( "github.com/owncloud/ocis/v2/extensions/graph-explorer/pkg/config" pkgtrace "github.com/owncloud/ocis/v2/ocis-pkg/tracing" "go.opentelemetry.io/otel/trace" ) var ( // TraceProvider is the global trace provider for the proxy service. TraceProvider = trace.NewNoopTracerProvider() ) func C...
61207c13ee47f3cd14a3b564983cdefc7e6b4539
7db0bc2159473617eed02a1219541e0a56b91bc6
spring-operator/cnab-k8s-installer-base
/main.go
Go
go
2,995
permissive
package main import ( "cnab-k8s-installer-base/pkg/apis/kab/v1alpha1" "cnab-k8s-installer-base/pkg/client/clientset/versioned" "cnab-k8s-installer-base/pkg/kab" "flag" "fmt" apiext "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/cli...
7533393e1577a3275c145c7435e793ab453fb852
98d590a9481428883fb6f31161daaba04537eabf
magicaugust/Golang
/network/src/nettask/server/Gate/GateClient.go
Go
go
1,183
no_license
package main import ( "fmt" packet "nettask/package" tcplib "nettask/tcplib" tcpsession "nettask/tcpsession" "time" ) var session *tcpsession.Tcpsession // send 回调函数 func OnSendFinish(s interface{}, Wpacket *packet.Wpacket) { //session := s.(*tcpsession.Tcpsession) fmt.Printf("数据发送完毕\n") }...
d112fcf6979ab863d9df25912c26c1847796039c
4ea45bce52b0062786b9f521d2a72a2884bed747
open-policy-agent/opa
/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
Go
go
1,637
permissive
// Copyright 2012 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. // +build arm,freebsd package unix import ( "syscall" "unsafe" ) func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: int32(nsec)}...
06ce1872db8af1af788ae97a8e9c233f1eeaa7bd
73aaad3bc722ecd3092bc3ec7487ccef3c10df3f
status-im/matterbridge
/vendor/github.com/d5/tengo/v2/symbol_table.go
Go
go
4,303
permissive
package tengo // SymbolScope represents a symbol scope. type SymbolScope string // List of symbol scopes const ( ScopeGlobal SymbolScope = "GLOBAL" ScopeLocal SymbolScope = "LOCAL" ScopeBuiltin SymbolScope = "BUILTIN" ScopeFree SymbolScope = "FREE" ) // Symbol represents a symbol in the symbol table. type ...
e19e9d62b7f8416aa57d2e89092ae3e5da9455a4
f3557275838ff768f7954d2f6a4434b9e3422c2b
liuxu17/irishub
/modules/gov/errors.go
Go
go
3,640
permissive
//nolint package gov import ( "fmt" sdk "github.com/irisnet/irishub/types" ) const ( DefaultCodespace sdk.CodespaceType = 21 CodeUnknownProposal sdk.CodeType = 1 CodeInactiveProposal sdk.CodeType = 2 CodeAlreadyActiveProposal sdk.CodeType = 3 CodeAlreadyFinishedProposal sdk.CodeType = 4 Cod...
fbaf4f06ad1971f932343eb514978cf980c2b877
1f2dac0fd9009fe45cdee207f45c1e9ffcdec08f
Badamson87/todoGoRepo
/handlers/todo_delete.go
Go
go
513
no_license
package handlers import ( "net/http" "github.com/gin-gonic/gin" "todo/models" "database/sql" ) func TodoDelete(db *sql.DB) gin.HandlerFunc { return func(c *gin.Context) { var ids = c.Query("id"); results := todo.Delete(ids, db) c.JSON(http.StatusOK, results) } } func TodoSoft...
2e078cd3012bf6e0f7e7229823bb26518a078010
e321a37b58d85c5d0fac5a52fc4885d8657bce19
flaviogf/examples
/go-simple-weather/main.go
Go
go
344
permissive
package main import ( "fmt" "log" "github.com/flaviogf/gosimpleweather/fakeweather" "github.com/flaviogf/gosimpleweather/forecast" ) func main() { provider := fakeweather.NewProvider() service := forecast.NewService(provider) outfit, err := service.WhatToWear("Franca") if err != nil { log.Fatal(err) } ...
c7675bb5d0a4a6db2c5806330bd710713e8f1519
4e258fe82b3e384773b8c6fb614ab4fe9f5d76f6
golang-design/under-the-hood
/gosrc/cmd/compile/internal/ssa/check.go
Go
go
14,229
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 ssa import ( "math" "math/bits" ) // checkFunc checks invariants of f. func checkFunc(f *Func) { blockMark := make([]bool, f.NumBlocks()) valueMar...
b415b550410eace2e83beb0e6d065934164496b2
167b3205af01f078fbcd350585363a9b3c407b9a
microsoftgraph/msgraph-beta-sdk-go
/groups/item_sites_item_term_store_sets_item_parent_group_sets_item_terms_item_relations_item_to_term_request_builder.go
Go
go
6,249
permissive
package groups import ( "context" i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors" i45fc41673b99130d86c1854d...
8bee048f5fd60801449244fd5cc13ad174541233
acec02b027867b2da74b7c6748766fd8e88a01fd
cryring/gorocksdb
/sst_file_writer.go
Go
go
3,324
permissive
package gorocksdb // #include <stdlib.h> // #include "rocksdb/c.h" import "C" import ( "errors" "unsafe" ) // SSTFileWriter is used to create sst files that can be added to database later. // All keys in files generated by SstFileWriter will have sequence number = 0. type SSTFileWriter struct { c *C.rocksdb_sstfi...
a002ce9194f3b4c390cdbf41b38a5addbfdd8f39
c271be1259ed4d7892e8c636820a296fc3a47faf
thomasheller/go-examples
/webserver3/main.go
Go
go
455
permissive
package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", RootHandler) http.HandleFunc("/page/", NumbersHandler) log.Fatal(http.ListenAndServe(":8080", nil)) } func RootHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html") fmt.Fprint(w, "Hello w...
fdb1743b6b6f4bbcc4397022f410ec1ecbef37ff
1269425ce960eafc5b0cbe3915673c8ca45c79d1
bstaijen/helper
/util/response.go
Go
go
1,577
permissive
package util import ( "encoding/json" "net/http" "runtime/debug" "github.com/bstaijen/helper/models" "errors" ) // SendOKMessage send http response with header OK and a message. func SendOKMessage(w http.ResponseWriter, message string) { SendOK(w, &models.Error{Message: message}) } // SendOK send http respon...
4d030974d04ec5618704986b2a68123e319a5931
7c0a7575cdedb8349a6c87f0c4ad6dcf4b8c0ea3
evenh/stern
/stern/main.go
Go
go
2,487
permissive
// Copyright 2016 Wercker Holding BV // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
6de77d83807e8ae82a5ef66a9f5fd59e15fa6989
98a8a527c3b0eb28b95581cb76d1982d1a0b9699
MrVWY/LeetCode-Study
/Manachar_algorithm.go
Go
go
1,571
no_license
package main import "strings" var dirt = [][]int{{1,0},{-1,0},{0,1},{0,-1}} //1、预处理 func addBoundaries(s string, add string) string{ S := make([]string, 0) for i := 0 ; i < len(s) ; i++ { S = append(S, string(s[i])) } return strings.Join(S,add) } //2、处理 func longestPalindrome(s string) string { n := len(s) ne...
848df702b8219bd87f4d6650422942aa73148e91
9dae786926c01f6ed9650aa2614603b95a56f315
ksonney/harp
/pkg/bundle/helpers.go
Go
go
5,709
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 ...
16d86008d9641ac5427780d79eef50b7b80b396c
2074fe39ce476dc1a0a4fc9a0380d2f5224fc532
timuthy/gardener-extension-provider-alicloud
/pkg/validator/serialization.go
Go
go
2,312
permissive
// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the Lice...
0a7f9be35a3a512f566f9d11f72a147101b23f93
c89506af2ebb3332f878c4e74c8e824deba3b228
5l1v3r1/agario
/game_client/ws_client.go
Go
go
1,991
no_license
package main import ( "fmt" "log" "net/url" "os" "os/signal" "time" "github.com/gorilla/websocket" ) func (g *Game) startWsClient() { interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt) u := url.URL{Scheme: "ws", Host: "localhost:3000", Path: "/ws", RawQuery: fmt.Sprintf("id=%d&col...
c887a0ea7fec31151f56af8ebd397b92c06bf297
3d6a2a590dae2f4302d74b86fd579f7685a85e84
bdevloed/kubernetes
/test/integration/framework/master_utils.go
Go
go
10,970
permissive
/* Copyright 2014 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...
a6026682fb751acab4f8f8b572e588883f42d333
89499cc415ebe74ff35da5b4b32ada8b2a4c6c33
oulinbao/jdcloud-sdk-go
/services/vod/models/TranscodeTemplate.go
Go
go
1,415
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 ...
828ac917ac6394637dcff7757a5a8f9e4e51abc9
a2599a3a46840fae7b3f48542352aee84b05394c
jwolpert/fabric
/common/ledger/blkstorage/fsblkstorage/blockfile_mgr.go
Go
go
22,808
permissive
/* Copyright IBM Corp. 2016 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
0943691338f7fb3045af303282687d32a1325edd
3d3cccb7dbfd81575295f481b7e08b4ef97f4131
errordeveloper/cilium
/pkg/ipam/allocator/azure/azure.go
Go
go
3,588
permissive
// SPDX-License-Identifier: Apache-2.0 // Copyright 2020 Authors of Cilium package azure import ( "context" "fmt" operatorMetrics "github.com/cilium/cilium/operator/metrics" operatorOption "github.com/cilium/cilium/operator/option" apiMetrics "github.com/cilium/cilium/pkg/api/metrics" azureAPI "github.com/cili...
c62bcad45720f0ffeae45b219dacb53b4d2e8c35
ee4a49be85f70f33a532d3fcbb1e79ff00156626
chenyuanqi/note
/backend/go/reborn/project/mlj/pkg/excel/export.go
Go
go
961
permissive
package excel import ( "fmt" "github.com/xuri/excelize/v2" ) func ExportXlsx(name string, fields []string, header []string, data []map[string]string) { f := excelize.NewFile() defer func() { if err := f.Close(); err != nil { fmt.Println(err) } }() // 创建一个工作表 sheet1, err := f.NewSheet("Sheet1") if err...
fe57555715accba2fd910fb32e9af228db6b7ff8
0f0b70e5dbc7ef2395034cc31d96aed6fcf065d2
FoundationDB/fdb-kubernetes-operator
/api/v1beta1/foundationdbrestore_types.go
Go
go
4,029
permissive
/* * foundationdbbrestore_types.go * * This source file is part of the FoundationDB open source project * * Copyright 2020-2021 Apple Inc. and the FoundationDB project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. ...