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
0a7c4d2e53bebe45e45b4a717da324c1ae239430
6cc6775b1f1ed40c5b4c4730fcefa0426542c6bc
SpectoLabs/hoverfly
/functional-tests/testdata/json_payload_v1.go
Go
go
2,877
permissive
package testdata var V5JsonPayload = `{ "data": { "pairs": [ { "request": { "destination": [ { "matcher": "exact", "value": "v1-simulation.com" } ] }, "response": { "status": 200, "body": "v1 match", "encodedBody": false, "templated": false ...
73d2dee90d9bdb6deabc78dab31e06a3a808f242
8e246f3ef456cac8c2ff8f8c4ed7edeece058674
chiheyuanfang/EdgeAPI
/internal/dnsclients/provider_dnspod_test.go
Go
go
2,495
no_license
package dnsclients import ( "encoding/json" "github.com/TeaOSLab/EdgeAPI/internal/dnsclients/dnstypes" "github.com/iwind/TeaGo/dbs" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "testing" ) func TestDNSPodProvider_GetDomains(t *testing.T) { provider, err := testDNSPodProvider() if err != nil { ...
691cf0b2e4cf5a7480d08fb7a20c46a843ae99c8
d5ba778de67371cab6f5a58c71a71f420e9f47d6
morrell/pulumi-azure-native
/sdk/go/azure/web/v20181101/listWebAppBackupStatusSecretsSlot.go
Go
go
3,182
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 v20181101 import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Backup description. func ListWebAppBackupStatusSecretsSlot(ctx *pulumi.Context, args ...
9efcddc96a1ed5bd191fb6b60086f90346f9b8ca
e45cf4097d02e8cf4b30f2e1b3aeba1a6f5deff9
austinjhunt/GoGoGadget
/stringutil/reverse_test.go
Go
go
498
no_license
package stringutil import "testing" // standard library, short import path func TestReverse(t *testing.T) { // all test functions must have func (t *testing.T) signature cases := []struct { in, want string }{ {"Hello, world", "dlrow ,olleH"}, {"Hello, 世界", "界世 ,olleH"}, {"", ""}, } for _, c := range cas...
1565f899a07ed8304cf0e647960f2d056881b311
a6c515aa2ad02e84ce81590aaff6166e804822e8
azhar-azad/golang-learning2
/go-by-example/09_Slices/slices.go
Go
go
2,231
no_license
package main import "fmt" /* Slices are a key data type in Go, giving a more powerful interface to sequences than arrays. */ func main() { // Unlike arrays, slices are typed only by the elements they // contain (not the number of elements). To create an empty // slice with non-zero length, use the builtin make....
f34354d0eef2117a2d3d2c7aee1643e05b33d8ee
e2c6237b74293e649a8debd410608ebf244e96d1
sarboc/mymove
/pkg/models/service_member_rank.go
Go
go
2,559
permissive
package models // ServiceMemberRank represents a service member's rank type ServiceMemberRank string const ( // ServiceMemberRankE1 captures enum value "E_1" ServiceMemberRankE1 ServiceMemberRank = "E_1" // ServiceMemberRankE2 captures enum value "E_2" ServiceMemberRankE2 ServiceMemberRank = "E_2" // ServiceMemb...
686d0e52b6220cbb7991dd8ca1f4951537e8effd
94a8320f29f58d8332d4b54b34988aad08102af1
morsik/azure-service-operator
/pkg/resourcemanager/resourcegroups/reconcile.go
Go
go
2,941
permissive
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. package resourcegroups import ( "context" "fmt" "net/http" "strings" "github.com/Azure/azure-service-operator/api/v1alpha1" azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" "github.com/Azure/azure-service-operator/p...
c5159c527455abc96e17f6eb2ac67bef0f0125f8
2842a010eefe32e2ad8ebf5c0c8163dd9d5bc22d
aguadoenzo/go-dqlite
/driver/integration_test.go
Go
go
9,796
permissive
package driver_test import ( "context" "database/sql" "fmt" "os" "testing" "time" dqlite "github.com/canonical/go-dqlite" "github.com/canonical/go-dqlite/client" "github.com/canonical/go-dqlite/driver" "github.com/canonical/go-dqlite/internal/logging" "github.com/mattn/go-sqlite3" "github.com/stretchr/tes...
ac384546fcfac941e99578f51949d6f829fe4be0
51b4b8b7da05b724996f20baf197527d19fd467b
CN-TU/go-ipfix
/types.go
Go
go
13,106
permissive
package ipfix import ( "encoding/binary" "math" "net" "time" ) // Type is a datatype according to RFC7011 type Type int // DateTimeSeconds represents time in units of seconds from 00:00 UTC, Januray 1, 1970 according to RFC5102. type DateTimeSeconds uint64 // DateTimeMilliseconds represents time in units of mil...
91c60fe3ab131dd92a4305daf78d2a5aa30e8804
be60f667a40cf7e55ad24919d1089983e84e7150
ChorusOne/kava
/app/app.go
Go
go
11,733
permissive
package app import ( "io" "os" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" 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" bam "github.com/cosmos/cosmos-sd...
ddb8e11f260f5956914893be2fe1e24f80bd722a
a311814ec29b84fe05a05b4561451683615e2ab7
godblesss/dh
/client.go
Go
go
976
no_license
package main import ( "DemoTest/dhkh" "fmt" "log" "math/big" "net" ) func main() { //获取udpaddr udpaddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:8080") checkError(err); //连接,返回udpconn udpconn, err2 := net.DialUDP("udp", nil, udpaddr) checkError(err2) //写入数据 //DH Key g,_ := dhkx.GetGroup(0) priv, _ :=...
a7423fae6405bebdf8687100dd909953a346ccaf
e6f0cc0179a147b460faa385e49757f2fd902421
gz-c/teller
/cmd/tool/tool.go
Go
go
6,019
no_license
package main import ( "flag" "log" "os" "os/user" "encoding/json" "fmt" "strconv" "path/filepath" "bytes" "io/ioutil" "math" "github.com/boltdb/bolt" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcrpcclient" "github.com/skycoin/skycoin/src/cipher" ) // lastScanBlock struct i...
62b55612d414ff8b6b06962613bee9c19637821f
d0ca2a41589c66e7b1b4985c97023d63d6525d43
qiangjiyi/fabric-gm
/integration/nwo/orderer_template.go
Go
go
2,974
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package nwo const DefaultOrdererTemplate = `--- {{ with $w := . -}} General: LedgerType: file ListenAddress: 127.0.0.1 ListenPort: {{ .OrdererPort Orderer "Listen" }} TLS: Enabled: true PrivateKey: {{ $w.OrdererLocalTL...
720b621feb58507fb6c92d47366746738fdf330b
edaa36b393bb02cc552225d74d36403093842c58
antonio91capa/go-apirest
/api/middlewares/middleware.go
Go
go
632
no_license
package middlewares import ( "errors" "net/http" "github.com/antonio91capa/go-apirest/api/auth" "github.com/antonio91capa/go-apirest/api/responses" ) func SetMiddlewareJSON(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "applicati...
d0a8485471da14903800b3facf718f2dd951f7ff
7376e49b7bc716c4a8b7c65cf4e1e425595ac694
FLinus/kubernetes
/pkg/volume/cinder/cinder.go
Go
go
20,261
permissive
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
284b6e79d2d950d08d99930d5ac0ed6e0ae048ce
d1039cce610d69f3b63c97a6b622a10960fc81ec
D3luxee/dnscontrol
/providers/axfrddns/axfrddnsProvider.go
Go
go
12,535
permissive
package axfrddns /* axfrddns - Fetch the zone with an AXFR request (RFC5936) to a given primary master, and push Dynamic DNS updates (RFC2136) to the same server. Both the AXFR request and the updates might be authentificated with a TSIG. */ import ( "bytes" "crypto/tls" "encoding/base64" "encoding/jso...
690454aca618098cd2be52b9d2e02e7dd160bfa7
613d95e2cb8f3d13b7da51b706a2135c7c6d1721
hunjixin/hcd
/hcutil/hdkeychain/bench_test.go
Go
go
2,363
permissive
// Copyright (c) 2014 The btcsuite developers // Copyright (c) 2015 The Decred developers // Copyright (c) 2018-2020 The Hcd developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package hdkeychain_test import ( "testing" "github.com/HcashOrg/hcd/hcutil/hdkey...
35c9e23b5d386251e02076a7881c31b44380ade7
efabde29343a25973d25c9848183721c44bce1a7
m-debnath/godev-training-udemy
/test-benchmark/01-test/main.go
Go
go
213
no_license
package main import ( "fmt" ) func main() { x := 42.0 y := 6.0 fmt.Println(subtract(x, y)) } // subtract returns difference between two float64 numbers func subtract(x, y float64) float64 { return x - y }
95212605683b0555e1d3ecd9741381d498dcc7c6
512798521cc2a074b2510549e8961571cb93a534
cordoval/conveyor
/queue_test.go
Go
go
3,684
permissive
package conveyor import ( "testing" "golang.org/x/net/context" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sqs" "github.com/remind101/conveyor/builder" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) func TestBuildQueue(t *testing.T) { q := &buildQueue{ que...
5959621b667db9c0dc2888bb528845c3714990f7
41baef43770352aa4230c674bb91c64483f1d507
gale320/cockroach
/roachpb/batch.go
Go
go
10,173
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...
698083efe18169b5efa670ec2e709723f88c4a3a
8e1aee9f01202116434456c89bd40bdcd6d661b3
ctdk/goiardi
/vendor/github.com/lib/pq/conn.go
Go
go
45,023
permissive
package pq import ( "bufio" "crypto/md5" "crypto/tls" "crypto/x509" "database/sql" "database/sql/driver" "encoding/binary" "errors" "fmt" "io" "io/ioutil" "net" "os" "os/user" "path" "path/filepath" "strconv" "strings" "time" "unicode" "github.com/lib/pq/oid" ) // Common error types var ( ErrNo...
bd1984c51e854c815b422ba2adf94f2f6f3017b3
0090fc7147de9a039896c0837fbd2ebb650eca28
alex-golang/imgtools
/lib/format.go
Go
go
588
permissive
// This file is subject to a 1-clause BSD license. // Its contents can be found in the enclosed LICENSE file. package lib import "strings" // Encoders returns a list of registered image format names. func Formats() []string { list := make([]string, 0, len(Encoders)) for _, f := range Encoders { list = append(li...
a264d433e590fc509d68567e2d011a6f0ff78f54
166f7b6e7d813e15b44c873e99210b486ebbb80c
RecentProgress/awesome-leetcode
/HashTable/500-KeyboardRow/golang/keyboardRow.go
Go
go
613
permissive
package keyboardRow import ( "strings" ) func keyboardRow(words []string) []string { templates := []string{"QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM"} tempHash := make(map[rune]int) for i, template := range templates { runes := []rune(template) for _, char := range runes { tempHash[char] = i } } var result ...
57b0806c7a04283aef1bdd927fd7d0b08c7f289c
1dd15f73e7707016c7bb3465b26a2adfbc3ef187
tellesnobrega/kanister
/pkg/app/postgresql-deploymentconfig.go
Go
go
7,246
permissive
// Copyright 2019 The Kanister 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...
81c2c2eb5ef3a4df0b1726de1d9769aa529d74ef
d5dcb80911e3e16a9ad0c0efc2fbe0bdba3e40c3
Jizishuo/LEETCODE_LOG_BY_PY_AND_GO
/data_2020_08/Hit_the_House_2_213/code.go
Go
go
859
no_license
package Hit_the_House_2_213 func rob(nums []int) int { ll := len(nums) if ll == 0 { return 0 } if ll <=1 { return nums[0] } dd := func(ns []int, s, n int) int { c, p := 0, 0 for i:=s;i<=n;i++ { p, c = c, max(p+ns[i], c) } return c } return max(dd(nums, 0,ll-2), dd(nums, 1, ll-1)) } func max(x, ...
ff6648200a5ccc2407004e74f07ab0127cb1767c
232844b4c9d7cb274b3c8aadf9a1342845e4cf06
rebider/Fgame
/game/marry/entity/wedding.go
Go
go
963
permissive
package entity //婚姻安排数据 type MarryWedEntity struct { Id int64 `gorm:"primary_key;column:id"` ServerId int32 `gorm:"column:serverId"` Period int32 `gorm:"column:period"` Grade int32 `gorm:"column:grade"` HunCheGrade int32 `gorm:"column:hunCheGrade"` SugarGrade int32 `gorm:"column:sug...
9647582902ddce1abe339a95ce3f5e2b85b18732
e6c1f8219e4d20832137bd3c5a25d2b0df3ca63b
general252/EasyDarwinLib
/github.com/gin-gonic/gin/binding/json.go
Go
go
1,062
permissive
// Copyright 2014 Manu Martinez-Almeida. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. package binding import ( "bytes" "io" "net/http" "github.com/general252/EasyDarwinLib/github.com/gin-gonic/gin/json" ) // EnableDecoderUseNumber ...
b37862ed0f4a6273e69b1d8212a969f414c8217a
35387f2613222660427443a8f448d8661738d6d0
TakeANote/takeanote-api
/models/models.go
Go
go
1,022
permissive
package models import ( "fmt" "strings" "github.com/takeanote/takeanote-api/config" "github.com/jinzhu/gorm" _ "github.com/lib/pq" // Postgres Driver for gorm ) func generateDBConnectionString(config *config.Config) (string, error) { switch strings.ToLower(config.DatabaseDriver) { case "postgres...
a2afbd0ccb75cd496248f490948d105bde56875d
80fc3898cfa846b40a2957cb04c516ae4a683122
LongQue/resk-projects
/src/imooc.com/resk/core/envelopes/po_item.go
Go
go
2,091
no_license
package envelopes import ( "database/sql" "github.com/shopspring/decimal" "resk-projects/services" "time" ) type RedEnvelopeItem struct { Id int64 `db:"id,omitempty"` //自增ID ItemNo string `db:"item_no,uni"` //红包订单详情编号 EnvelopeNo string `db:"envel...
f4367f51c17fc97767379518056674c5f822dad9
6373f4f3cb443fb6f6e4729353a994010554f3e4
gavinfish/kubernetes
/cmd/genman/gen_kube_man.go
Go
go
6,526
permissive
/* Copyright 2014 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, ...
07f4043ae602ceb6708ec0180081bfb2af61263a
7c0ec2827c8e8dbc45deb215618745d5478039f9
nyugoh/sagittarius-client
/utils/db.go
Go
go
4,125
permissive
package utils import ( "database/sql" "errors" "fmt" "github.com/go-redis/redis/v7" "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql" "github.com/jamf/go-mysqldump" "github.com/jinzhu/gorm" "os" "strconv" "strings" ) // Returns a connection to db or error // Connects to DB depending on th...
e3a68b69bae6d4ef0a6a8bd1c2b08626acef0e0c
a1bb1eb1ef2f7f48f016312b8f410079f7bc03f0
CptOfEvilMinions/ogen
/test/flood/flood.go
Go
go
1,204
permissive
package main import ( "context" "crypto/tls" "fmt" "github.com/olympus-protocol/ogen/api/proto" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "time" ) var sender = "tlpub1a5v7eu8x3ecmj05pf08edzt9k3x89eu4ugacsr" var receiver = "tlpub1nfq9r4kuzxwc207f4peyx7kz7860vke30wwr8x" var password = "123"...
6ace23413a9e061c59f787d674e0d79e938f1d0e
18d2c98c0aace87749fbd9822636b7f2ab4b6a76
mithro/luci-go
/server/auth/openid/cookie_test.go
Go
go
2,525
permissive
// Copyright 2015 The LUCI Authors. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package openid import ( "net/http" "testing" "time" "golang.org/x/net/context" "github.com/luci/luci-go/common/clock" "github.com/luci...
3ff74ed858ac76bee29725d4ab76d64d79023c95
fbd8dd930716717a98080e8aaff506eab221f9ce
aw-was-here/eve
/pkg/pillar/vendor/github.com/lf-edge/eve/libs/zedUpload/azureutil/azure.go
Go
go
18,893
permissive
// Copyright(c) 2017-2018 Zededa, Inc. // All rights reserved. package azure import ( "context" "encoding/hex" "fmt" "io" "math" "net/http" "net/url" "os" "strings" "sync" "time" "github.com/Azure/azure-pipeline-go/pipeline" "github.com/Azure/azure-storage-blob-go/azblob" "github.com/lf-edge/eve/libs/z...
db7606f73d2bd91868b51556d5c153e0cfb7cc25
1a925819b7ec92bce3bac6fbb170167a9820719b
junxie6/git-go-scalability-talk
/benchmark/inputters/streaming_tcp_listener_benchmark_test.go
Go
go
466
no_license
package benchmark import ( "net" "testing" ) func BenchmarkStreamingTcpListener(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { t.wg.Add(1) streamTcpItem(t.conn) } }) t.wg.Wait() } func BenchmarkStreamingTcpListenerParallel(b *testing.B) { for i := 0; i < b.N; i++ { t.wg.Add(1...
0efb852752f16692f63fffc295ed5b6948b7a902
ea260c5e3718c6bbfdd5a362f7669d5740ecd645
skyyuan/doc
/src/mindoc/converter/converter.go
Go
go
19,308
permissive
//Author:TruthHun //Email:TruthHun@QQ.COM //Date:2018-01-21 package converter import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" "time" "os/exec" "errors" "sync" "html" "mindoc/utils/filetil" "mindoc/utils/ziptil" "mindoc/utils/cryptil" ) type Converter struct { BasePath string OutputPath...
3ba41199692e1c26153ae470ea06f2b4bfc0f9d0
6f930e99aef4ff5d54481d03e19383c499e5db0c
MyPureCloud/platform-client-sdk-go
/platformclientv2/queueconversationvideoeventtopicdialerpreview.go
Go
go
5,463
permissive
package platformclientv2 import ( "github.com/leekchan/timeutil" "reflect" "encoding/json" "strconv" "strings" ) // Queueconversationvideoeventtopicdialerpreview - The preview data to be used when this callback is a Preview. type Queueconversationvideoeventtopicdialerpreview struct { // SetFieldNames defines th...
43ed292cb3df810d2e33edee9bac839ca7c2afe0
19c82eb22b273063a62fc095781cb12497e6dfa8
ozkar99/dnscontrol
/providers/cloudflare/rest.go
Go
go
13,000
permissive
package cloudflare import ( "bytes" "encoding/json" "fmt" "net/http" "strconv" "strings" "time" "github.com/StackExchange/dnscontrol/models" "github.com/pkg/errors" ) const ( baseURL = "https://api.cloudflare.com/client/v4/" zonesURL = baseURL + "zones/" recordsURL = zonesURL + ...
ae4d28945fa655fe70e02bd03e16bdc3fd7451f9
25d10ace83de47cb0f5017781f37e77c5fd7bffb
leaxoy/go-micro
/config/loader/memory/memory.go
Go
go
7,552
permissive
package memory import ( "bytes" "container/list" "errors" "fmt" "strings" "sync" "sync/atomic" "time" "go-micro.dev/v4/config/loader" "go-micro.dev/v4/config/reader" "go-micro.dev/v4/config/reader/json" "go-micro.dev/v4/config/source" ) type memory struct { exit chan bool opts loader.Options sync.RWM...
ce1b5bf9b29b9aa6c6446bb4fc9676e78f332201
60d70381dd04e7cf9d0e27ba297fd44331593024
iammortimer/politeia
/politeiawww/user/cockroachdb/cms.go
Go
go
11,508
permissive
package cockroachdb import ( "fmt" "strings" "github.com/decred/politeia/politeiawww/user" "github.com/google/uuid" "github.com/jinzhu/gorm" ) const ( // CMS plugin table names tableCMSUsers = "cms_users" ) func (c *cockroachdb) convertCMSUserFromDatabase(cu CMSUser) (*user.CMSUser, error) { proposalsOwned ...
ce81a75d377262d11850a84f444c49666c56e196
172f6de35d2acef5b3c18832f90816c14a00ec4e
teruhiky/istio
/pilot/cmd/pilot-agent/status/server.go
Go
go
8,686
permissive
// Copyright 2018 Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
6b9342e196bcf688eb61571af558fedb5486f2fb
9bcd6ee8d2aa0290c9411a2d5dcaf9130e905a87
mdjarv/adventofcode2016
/src/adventofcode2016/day11/main/main.go
Go
go
424
no_license
package main import ( "io/ioutil" "log" "fmt" "strings" "adventofcode2016/day11/tasks" ) func main() { filename := "input/day11.txt" content, err := ioutil.ReadFile(filename) if err != nil { log.Fatalf("Unable to open file %s", filename) return } lines := strings.Split(string(content), "\n") fmt.Print...
08abc2123d7fc8ee3a92e36496e28a08a340f174
c170ea1e978fd6717e77b3a47b62135f0fdc55f3
devintegral/go-lachesis
/src/hash/peer_id.go
Go
go
1,582
permissive
package hash import ( "github.com/Fantom-foundation/go-lachesis/src/common" ) var ( // NodeNameDict is an optional dictionary to make node address human readable in log. NodeNameDict = make(map[Peer]string) ) // Peer is a unique peer identifier. // It is a hash of peer's PubKey. type Peer Hash // EmptyPeer is em...
9ad041cb1abc11504c463e9b765d70149f2089c0
897e1b50772972986116b7dc9d8306a8f0807332
hdhongh/golang_tutorial
/gostudy/LinkedList/main.go
Go
go
1,360
no_license
package main import ( "fmt" ) type Node struct { next *Node // 다음 노드의 주소값 val int // 현재 노드의 값 } func main() { var root *Node var tail *Node // Node struct 의 주소값을 저장 root = &Node{val: 0} tail = root for i := 1; i < 10; i++ { // tail 값을 update tail = AddNode(tail, i) } PrintNodes(root) root, tai...
46ef559219bf7ea6e89968f3d40dab2b1cef7beb
e677dff6d5150dc4adcc9ff1dc94588c463cd2e3
occamshatchet/golang
/constant0.go
Go
go
264
no_license
package main import "fmt" import "math" //const declares a constant value. var s string = "constant" func main() { fmt.Println(s) const n = 500000000 const d = 3e20 / n fmt.Println(d) fmt.Println(int64(d)) fmt.Println(math.Sin(n)) }
dd0c30388cc412b0e3ac4b877db7e4dd59092699
2dda582b62f6afac4e6967d564ad3ad22c2298d4
xCrypt0r/Baekjoon
/src/21/21167.go
Go
go
550
permissive
/** * 21167. Curve Speed * * 작성자: xCrypt0r * 언어: Go * 사용 메모리: 912 KB * 소요 시간: 8 ms * 해결 날짜: 2021년 10월 30일 */ package main import ( "bufio" "fmt" "io" "math" "os" ) func main() { in := bufio.NewReader(os.Stdin) out := bufio.NewWriter(os.Stdout) defer out.Flush() var R, S float64 fo...
02cc70a12fe615afad086bb78be7c279fd5f7493
78e48e65c7dbb39ac2dddbe795b682e690a54e67
jcimafranca/platform-client-sdk-cli
/build/gc/models/learningassignmentuserlisting.go
Go
go
2,972
permissive
package models import ( "encoding/json" "strconv" "strings" ) var ( LearningassignmentuserlistingMarshalled = false ) // This struct is here to use the useless readonly properties so that their required imports don't throw an unused error (time, etc.) type LearningassignmentuserlistingDud struct { ...
31b55714eab92fbda58311fcb3b1d46f3a7c07ad
a77c8ccb18029523b024ed7aa60872b4c878a87d
praveenkumar09/forexample
/005-JsonHandson/exercise5json.go
Go
go
1,548
no_license
package main import ( "fmt" "sort" ) type user struct { First string Last string Age int Sayings []string } type ByAge []user type ByLast []user func (a ByAge) Len() int { return len(a) } func (a ByAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByAge) Less(i, j int) bool { re...
ff62b106b0ef6dd139429df08e825cc93dbf6016
7480b8c7b9167bb8202b9bb8dcd79e7bbcf47144
cpuguy83/dump
/go/mobycore/network_prune_test.go
Go
go
2,805
no_license
package mobycore import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "strings" "testing" "github.com/moby/moby-core/api/types" "github.com/moby/moby-core/api/types/filters" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) func TestNetworksPruneError(t *testing.T) { client := &C...
f0f32f156d28c4b28e8a6c65d4e3c1e654b934f1
1a9de940eafc6ef246b0da981b451b237a599a7d
kevholditch/breakout
/internal/pkg/game/components/control.go
Go
go
405
no_license
package components import "github.com/liamg/ecs" var IsControllable *Controllable type Controllable interface { ControlComponent() *ControlComponent } type ControlComponent struct{} func NewControlComponent() *ControlComponent { return &ControlComponent{} } func (c *ControlComponent) ControlComponent() *Control...
3c909c10676b2a9b4097a1f51a3e77b4a385d22a
aa018bb50133a88a7034d5a8e46aa3d0a17bcb01
cool-rest/cors
/examples/xhandler/server.go
Go
go
510
permissive
package main import ( "net/http" "github.com/cool-rest/cors" "github.com/cool-rest/xhandler" "golang.org/x/net/context" ) func main() { c := xhandler.Chain{} // Use default options c.UseC(cors.Default().HandlerC) mux := http.NewServeMux() mux.Handle("/", c.Handler(xhandler.HandlerFuncC(func(ctx context.Co...
a7b6f8c01f1dd2e85e6b5bb92b0286474059b1da
d76f71cb8abbcb6d86daea74d37d74c3a1e227ea
BugFreeSoftware/wasp
/packages/webapi/model/dkshares.go
Go
go
1,183
permissive
// Copyright 2020 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 package model // DKSharesPostRequest is a POST request for creating new DKShare. type DKSharesPostRequest struct { PeerNetIDs []string `json:"peerNetIDs" swagger:"desc(NetIDs of the nodes sharing the key.)"` PeerPubKeys []string `json:"peerPubK...
a9cedf92a1aba981713e6fa0db67557fa9566447
cccf88a255611bce91509dee42b3521d9a54a641
l0k18/pod-old
/pkg/chain/tx/multisig.go
Go
go
3,318
permissive
package wallettx import ( "errors" txscript "github.com/p9c/pod/pkg/chain/tx/script" "github.com/p9c/pod/pkg/log" "github.com/p9c/pod/pkg/util" waddrmgr "github.com/p9c/pod/pkg/wallet/addrmgr" walletdb "github.com/p9c/pod/pkg/wallet/db" ) // MakeMultiSigScript creates a multi-signature script that can be redee...
bec3b5190e66e5a01ad3925ba9c697e5a204b23b
27eaafc236b4f53b604d5b48b2e254b83d877339
evandbrown/kf
/pkg/apis/kf/v1alpha1/utils.go
Go
go
5,978
permissive
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
c0c97ce3884bd6eebffd07d6fab3afa2f817f0c1
11db6835a254ffb14bf7e3f5b7cec49e38b8fb9b
webx-top/client
/edit/clients.go
Go
go
1,046
no_license
/* Copyright 2016 Wenhui Shen <www.webx.top> 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 ...
853ab99e05000074a9b2c0e8e44e45307cfac621
dce7889d6b43b5d53380dceda8a335275d9f7d69
kajolasabe/busybox-go-operator
/pkg/controller/add_busybox.go
Go
go
271
no_license
package controller import ( "persistent.com/busybox/busybox-go-operator/pkg/controller/busybox" ) func init() { // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. AddToManagerFuncs = append(AddToManagerFuncs, busybox.Add) }
d6fc4035577f3f0396cbf7945dabed4ff05c24cd
bec01fb85513e2ded39ec81b3ff537dc86de0969
acprimer/JVM-in-go
/src/ch06/rtda/heap/string_pool.go
Go
go
753
no_license
package heap import ( "unicode/utf16" ) var internedStrings = map[string]*Object{} func JString(loader *ClassLoader, goStr string) *Object { if internedStr, ok := internedStrings[goStr]; ok { return internedStr } chars := stringToUtf16(goStr) jChars := &Object{loader.LoadClass("[C"), chars, nil} jStr := load...
c1473cec786fb5a72cd83679d4006fc0b59e41d1
ad6741b52d17bffb3b1ba56283deee7a056a41dd
forkkit/aresdb
/memstore/ingestion.go
Go
go
18,915
permissive
// Copyright (c) 2017-2018 Uber Technologies, 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 applicabl...
5ca9b783a61b38ec8141f555c0a6f93c77fd9be1
6c5fe34f361a174aaa02a7053fab2ce7c829478b
wahello/kubefun
/pkg/plugin/server.go
Go
go
548
no_license
package plugin import "github.com/hashicorp/go-plugin" var ( // Handshake is the handshake configuration for plugins. Will // be used the dashboard and the plugin. Handshake = plugin.HandshakeConfig{ ProtocolVersion: 1, MagicCookieKey: "DASHBOARD_PLUGIN", MagicCookieValue: "dashboard", } ) // Serve serv...
9f3e88a82dd68730d035b40103c0ff21d9aa6c5f
7eb22679b12707f1ecacaa8b9b9e2cb352e239f4
avanti-joshi/mymove
/pkg/services/webhook_subscription.go
Go
go
1,278
permissive
package services import ( "github.com/gobuffalo/validate/v3" "github.com/transcom/mymove/pkg/appcontext" "github.com/transcom/mymove/pkg/models" ) // WebhookSubscriptionFetcher is the service object interface for FetchWebhookSubscription //go:generate mockery --name WebhookSubscriptionFetcher --disable-version-st...
45a870e7f477c6c684f72f0eddc392e238171aa9
1748b90c7babb7f9365d05d6040da1902622987c
jessfeng/evergreen
/model/patch/cli_intent.go
Go
go
8,415
permissive
package patch import ( "strings" "time" "github.com/evergreen-ci/evergreen" "github.com/evergreen-ci/evergreen/db" "github.com/evergreen-ci/utility" "github.com/mongodb/anser/bsonutil" "github.com/mongodb/grip" "github.com/pkg/errors" "go.mongodb.org/mongo-driver/bson" mgobson "gopkg.in/mgo.v2/bson" ) cons...
12d325573490a03866c7f690cc17fac498fa1cb1
ede6ca9f6131244062e19eb42185d3e95964bc06
cezarsa/tsuru
/provision/docker/container/container.go
Go
go
16,039
permissive
// Copyright 2013 tsuru 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 container import ( "context" "crypto" "fmt" "io" "math/rand" "net/url" "strings" "time" "github.com/fsouza/go-dockerclient" "github.com/pkg/e...
fa93d7489aaee15d7c926e736cd44055234977d4
947065ff2ce17a08e3b22d8e5313df235d61c8c1
NYULibraries/dlts-finding-aids-zek-generated-code_archived
/sample-set-2-individual-ead-files/tam_517.go
Go
go
10,689
no_license
type Ead struct { XMLName xml.Name `xml:"ead"` Text string `xml:",chardata"` Xmlns string `xml:"xmlns,attr"` Xlink string `xml:"xlink,attr"` Xsi string `xml:"xsi,attr"` SchemaLocation string `xml:"schemaLocation,attr"` Eadheader struct { Text ...
c4973789250543242fe697628e8387a4d0ea9d03
fe6d2a0f66d64ae654beea23751d91dc926422d4
swtch1/effective_testing_strategies
/app_v2/app_test.go
Go
go
2,496
no_license
package main import "testing" type UserRepoStub struct { user *User } func (db *UserRepoStub) GetUserByName(fName, lName string) User { return *db.user } func (db *UserRepoStub) UpdateUser(u *User) { db.user = u return } func TestChangeUserLastName_Stub(t *testing.T) { firstName := "Sarah" lastName := "Smith"...
b46c4f27db8a4e6719e7cc38100bda1a3d3172f2
f473a0b2b37bb9acdb7984f23b9b6a8a99e70bf3
As9530272755/UserManage
/tool/add/add.go
Go
go
815
no_license
package add import ( "encoding/json" "fmt" "os" "usermanagement/inituser" ) var FilePath string = "user.json" func Addr() { file, err := os.Open(FilePath) if err != nil { file, _ = os.Create(FilePath) } else { decode := json.NewDecoder(file) decode.Decode(&inituser.UserList) file, _ = os.OpenFile(File...
be44a4d9783261b5b6640379b57cd3d33bc0054b
0087e5eba117186e8b2d6e98de10940734117b66
eiernaggen/cosmos-sdk
/x/feegrant/simulation/decoder_test.go
Go
go
1,578
permissive
package simulation_test import ( "fmt" "testing" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/x/feegrant/simulation" "github.com/cosmos/cosmos-sdk/x/feegra...
c34f8cdc59096c528dd8776453013751177ebb68
30e21292de3e034d498ea318627a62bccbd0c2d4
RZebec/Sem5_prog
/ticketsystem/webserver/webui/tickets/allTicketsExplorerPageHandler_test.go
Go
go
4,724
no_license
// 5894619, 6720876, 9793350 package tickets import ( "de/vorlesung/projekt/IIIDDD/ticketsystem/webserver/data/mockedForTests" "de/vorlesung/projekt/IIIDDD/ticketsystem/webserver/data/ticketData" "de/vorlesung/projekt/IIIDDD/ticketsystem/webserver/data/userData" "de/vorlesung/projekt/IIIDDD/ticketsystem/webserver/...
eb4962013a1b8d5afbbbbac3a369a379d3c1dc4e
03b9443825dd69813f62b3c89b4d2ccd76e05c8e
gitter-badger/mailchain
/internal/keystore/nacl/filestore.go
Go
go
1,671
permissive
// Copyright 2019 Finobo // // 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 writ...
9e0daa9aed9ae6a18477833a493d8f00ef086c2d
5e17a50e24b264fbedb5ebea6fa320e3f7f437d1
axdotl/kobs
/plugins/clickhouse/pkg/instance/logs_test.go
Go
go
1,253
permissive
package instance import ( "testing" "github.com/stretchr/testify/require" ) func TestParseLogsQuery(t *testing.T) { for _, tc := range []struct { query string where string isInvalid bool }{ {query: "cluster = 'foo' _and_ namespace = 'bar'", where: "cluster='foo' AND namespace='bar'", isInvalid: f...
2bb4af8b97e695b705de96b922e550395698c32f
65f6a5c0cc21db23306836d1affb01bca45b33e4
tharamalai/meichain
/chain/cmd/meid/main.go
Go
go
4,197
permissive
package main import ( "encoding/json" "io" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" codecstd "github.com/cosmos/cosmos-sdk/codec/std" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/store" sdk "github.co...
92a67ebdc39bdaa717581d4660cff495f8bc138f
1fdcbaea56307d25cdc6b38f4bb5b00fed364d36
Lancger/gopay
/alipay/client.go
Go
go
24,359
permissive
package alipay import ( "encoding/json" "errors" "fmt" "strings" "sync" "time" "github.com/iGoogle-ink/gopay" ) type Client struct { AppId string PrivateKey string LocationName string AppCertSN string AliPayPublicCertSN string AliPayRootCertSN string ReturnUrl ...
4d2b1a39bdac4bb1883a41f52e155d0fdfbf6805
d4f9aeba0232c63c73f5ec70b13f28df3881cfb6
simongdavies/porter
/pkg/build/provider/docker.go
Go
go
2,681
permissive
package provider import ( "context" "fmt" "io/ioutil" "get.porter.sh/porter/pkg/build" portercontext "get.porter.sh/porter/pkg/context" "get.porter.sh/porter/pkg/manifest" "github.com/docker/cli/cli/command" clibuild "github.com/docker/cli/cli/command/image/build" cliflags "github.com/docker/cli/cli/flags" ...
9913e2ad173f932d465239e98420fef6456c21fd
b7b695ee763dd14d03013b98b4986e89bdb0727c
sudeeptoroy/kuma
/pkg/util/http/tls.go
Go
go
1,005
permissive
package http import ( "crypto/tls" "crypto/x509" "io/ioutil" "net/http" "github.com/pkg/errors" ) func ConfigureMTLS(httpClient *http.Client, caCert string, clientCert string, clientKey string) error { transport := &http.Transport{ TLSClientConfig: &tls.Config{}, } if caCert == "" { transport.TLSClientC...
540194a0312a9c03e6358c5c00693bab49b638af
075d8a16ed36df7836c61b1901a12c86d7c6704e
mikeshimura/go-dbflute-example
/Godeps/_workspace/src/github.com/mikeshimura/dbflute/df/execution.go
Go
go
41,020
no_license
/* * Copyright 2014-2015 the original author or 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 app...
9103dec64380f8c564296f42940733550661e5e0
55710e10f766a91b98ea6e7caa59292017a9d19e
jottofar/oc
/pkg/cli/admin/mustgather/mustgather.go
Go
go
28,329
permissive
package mustgather import ( "bufio" "context" "fmt" "io" "math/rand" "os" "path" "regexp" "strconv" "strings" "sync" "time" "github.com/spf13/cobra" "k8s.io/klog/v2" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/...
7478580975d0f340de5f1d1eb33ed24ed091d42c
cfc9668e25ea51691f16e0f2db173b98fea25904
f110/heimdallr
/vendor/github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3/doc.go
Go
go
875
permissive
/* Copyright 2020 The cert-manager 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...
7ce75d0f62a04fbbddb87583d6208bce7719adbc
d128805b02c04bf30cda5ba94f428abf4acd05db
yichouchou/mosn
/pkg/streamfilter/chain_test.go
Go
go
2,008
permissive
package streamfilter import ( "testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "mosn.io/api" "mosn.io/mosn/pkg/mock" ) func TestStreamFilterChainPool(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() chain := GetDefaultStreamFilterChain() receiverFilter := m...
3b625fd6782f894a88d6384b77519b99e86ba681
c5d459a3b1df4ee7fdcc743900f4d1a902951380
linkomnia/facebook
/facebook_test.go
Go
go
21,148
permissive
// A facebook graph api client in go. // https://github.com/huandu/facebook/ // // Copyright 2012, Huan Du // Licensed under the MIT license // https://github.com/huandu/facebook/blob/master/LICENSE package facebook import ( "bytes" "encoding/base64" "encoding/json" "testing" ) const ( FB_TEST_A...
4e975efecfd6b317c9604f79482f7775eb158009
0436cd17dadd9f49eb862e1fe541d085b2949a1d
rancher/machine
/libmachine/host/migrate_v1_v2.go
Go
go
2,450
permissive
package host import ( "path/filepath" "github.com/rancher/machine/libmachine/auth" "github.com/rancher/machine/libmachine/drivers" "github.com/rancher/machine/libmachine/engine" "github.com/rancher/machine/libmachine/swarm" ) type AuthOptionsV1 struct { StorePath string CaCertPath string ...
6fc926e912a234ccf62fe4421ad593c70dbf754b
c02e8b19cdf60d433f573cfcb8f697c20224ab1d
totr/godog
/internal/storage/storage_test.go
Go
go
4,290
permissive
package storage_test import ( "testing" "time" "github.com/cucumber/messages-go/v10" "github.com/stretchr/testify/assert" "github.com/cucumber/godog/internal/models" "github.com/cucumber/godog/internal/storage" "github.com/cucumber/godog/internal/testutils" ) func Test_MustGetPickle(t *testing.T) { s := sto...
f3aabc3344423032c7558e4e470a71d8f7d94789
52d0f1c055f053bbb8f74d84c25b27c5c2aee5b1
vdice/porter-helm3
/pkg/helm3/helpers.go
Go
go
817
permissive
package helm3 import ( "testing" "get.porter.sh/porter/pkg/context" "k8s.io/client-go/kubernetes" testclient "k8s.io/client-go/kubernetes/fake" ) const MockHelmClientVersion string = "v3.1.2" type TestMixin struct { *Mixin TestContext *context.TestContext } type testKubernetesFactory struct { } func (t *tes...
e3e5a9d3e57fbe933c694364d04e1eb27841673a
58be3a75940e7e265265128ac4835c79c60f94ae
minmingzhu/daos
/src/control/cmd/daos_server/network.go
Go
go
2,262
permissive
// // (C) Copyright 2019-2022 Intel Corporation. // // SPDX-License-Identifier: BSD-2-Clause-Patent // package main import ( "context" "strings" "github.com/daos-stack/daos/src/control/cmd/dmg/pretty" "github.com/daos-stack/daos/src/control/lib/control" "github.com/daos-stack/daos/src/control/lib/hardware" "gi...
2e899054880ea1ba7b505e19be7f6bbe918ca818
ae1e64d6701ef38f28656356dc5c260017c91344
felipemaia02/202-turma-0x00
/Aula03/se.go
Go
go
233
no_license
package main import ( "fmt" ) func main() { var numero int = 60 if numero > 100 { fmt.Println("O numero", numero, "e maior que 100") } else { fmt.Println("O numero", numero, "e menor que 100") } fmt.Println("Tchau!") }
846f896cdcc1c9691f978e402928a2e5e1729ec7
c29574cca26f67a21ef735b29e11b3e2f43072a1
Skanda-Prasad/AttendanceLogger
/main.go
Go
go
1,505
permissive
package main //Import packages import ( "bufio" "fmt" "log" "os" "time" ) //Funtion for logging errors func errorHandler(err error) { println("Ops, something went wrong:", err) } //Function to get attendance func getStudentInfo() (name, roll, course string) { now:= time.Now() fmt.Println("Day: ", now.Day()...
7a89ffa73a453d0be2e61385f823fc31127a7a36
fe097d98096e5ba8b93fa7154ceb953f4cfc8d3f
wcharczuk/reactor
/pkg/reactor/control_rod.go
Go
go
884
permissive
package reactor import ( "fmt" "time" ) // NewControlRod returns a new control rod. func NewControlRod(cfg Config, index int) *ControlRod { cr := &ControlRod{ Component: NewComponent(cfg), Index: index, Position: PositionMax, Temp: cfg.BaseTempOrDefault(), } cr.TempAlarm = NewThresholdAlarm( ...
b9614c2f1109b062b7d09777b8928538d981ed2d
1d2312012e6ffe87e4cf682fe1b86a8b9a8af018
weidongtoml/mblog_spread_model
/src/simple_spread_model.go
Go
go
1,898
no_license
package main import ( "fmt" "flag" "spread_model" ) func main() { var user_active_rate_file = flag.String("active_rate_file", "active_rate.txt", "File describing the user active rate, each line is of the form QQ<tab>active_rate") var user_interaction_rate_file = flag.String("user_interaction_rate_file", "...
3929d0bd3e66b921214d814fdff8adc8f6cf04bd
5a8f27334a607f29f83efbfe75c8fea2ba11bc69
tinurcity/qumomf
/internal/quorum/smart.go
Go
go
3,124
permissive
package quorum import ( "sort" "github.com/shmel1k/qumomf/internal/vshard" ) // idleDiffDelta represents the max diff between // idle values of the followers after which // they are not treated as almost identical. const idleDiffDelta = 0.5 // in seconds type smartElector struct { opts Options } // NewSmartElec...
ca6cd351c01ea69eef264bd584d6cc8e0ada5482
13b1cf5f38ec5864c456d9d77baede772d73f345
Reidmcc/kelp
/support/monitoring/pagerDuty.go
Go
go
1,029
permissive
package monitoring import ( "fmt" "log" "github.com/PagerDuty/go-pagerduty" "github.com/stellar/kelp/api" ) type pagerDuty struct { serviceKey string } // ensure pagerDuty implements the api.Alert interface var _ api.Alert = &pagerDuty{} func makePagerDuty(serviceKey string) (api.Alert, error) { return &page...
e34b35179b197b87cf45dfa4650a3a7514e6a546
59df82179e541b128c3e0e959e6a526423106427
spectrelb/go-example
/20200713/for.go
Go
go
417
no_license
package main import "fmt" func main() { // 最基础的方式,单个循环条件。 i := 1 for i < 3 { fmt.Println(i) i += 1 } for j := 1; j <= 3; j++ { fmt.Println(j) } // 不带条件的 `for` 循环将一直重复执行,遇到 `break` 或者 `return` 跳出循环。 for { fmt.Println("loop") break } for j := 1; j <= 3; j++ { if j % 2 != 0 { continue } ...
b8a309600e3c5c9f6591795e9dd1e9ed2f56ecf7
9554096ba4ede1cb94f1ba6f2b68d9a3a43fc43a
Riminder/go-riminder-api
/test/profile_test.go
Go
go
7,817
no_license
package rimindertest import ( "math/rand" "strconv" "testing" "github.com/Xalrandion/go-riminder-api" ) func TestProfileAddNoErrorMaxArgs(t *testing.T) { api := riminder.New(GetTestHelper().APIKey) args := map[string]interface{}{ "filepath": GetTestHelper().CvTestPath, "source_id": G...
be9b66e436e2327bd42d46c81b503234d0600ce4
6432a37ac82c1e6bd1d7357a767d3470d3503aef
dancoe77/001-Learning_Go
/010-Grouping_data/07-Slice-make/main.go
Go
go
452
no_license
package main import "fmt" func main() { x := make([]int, 10, 12) fmt.Println(x) fmt.Println(len(x)) fmt.Println(cap(x)) x[0] = 42 x[9] = 999 fmt.Println(x) fmt.Println(len(x)) fmt.Println(cap(x)) x = append(x, 3423) fmt.Println(x) fmt.Println(len(x)) fmt.Println(cap(x)) x = append(x, 3424) fmt.Prin...
53d465d4cd062c8fb457cb1db8126800f80a0546
8f7037fd930af7fd863f945fafd1f155eba60f7d
a1ekaeyVorobyev/otus_go_hw
/hw25/internal/grpc/server.go
Go
go
4,518
no_license
package grpcserver import ( "context" "github.com/a1ekaeyVorobyev/otus_go_hw/hw25/internal/calendar/calendar" "github.com/a1ekaeyVorobyev/otus_go_hw/hw25/internal/calendar/event" proto "github.com/a1ekaeyVorobyev/otus_go_hw/hw22/pkg/calendar" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes...
a24b1092b1e14acd384d2d39aa9564773a46ee37
e8197a7ca8f442c719bdb02f5f220233f88f005a
danielfoehrKn/gardener
/plugin/pkg/utils/networks.go
Go
go
2,505
permissive
// Copyright (c) 2018 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...
51c1c9ab41c79ae57be5b6bffa6ee53672bfafaf
22e7193454e4db1c2f6b6d7f008028e5ccf65d18
anoopengineer/tldr
/vendor/github.com/gizak/termui/events.go
Go
go
5,940
permissive
// Copyright 2015 Zack Guo <gizak@icloud.com>. All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. // // Portions of this file uses [termbox-go](https://github.com/nsf/termbox-go/blob/54b74d087b7c397c402d0e3b66d2ccb6eaf5c2b4/api_common.go) // by [author...
35a1490670be0e29fe0ce639c1b12dfbb6ee45e2
cc35ae11ca0eb91e8ec623e2754a24a0609e7b10
TheCulliganMan/dashboard
/src/app/backend/resource/cronjob/detail.go
Go
go
1,741
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 a...
422338ab49a1475bc7bf13071d1effc5cc6197ca
c3c295cb1b00f0c5352c78a80454c2670e9e0695
zmlcoder/bee
/g_appcode.go
Go
go
39,625
permissive
// Copyright 2013 bee 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 ...
e39c8a564d2774f7b786bf24903947133e76df6c
9da002925b313ad9d8e3d1e3e1c7eff63d156fd7
srgrn/bitbucket-api
/swagger/snippet_commit_links.go
Go
go
588
no_license
/* * Bitbucket API * * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. * * API version: 2.0 * Contact: support@bitbucket.org * Generated by: Swagger Cod...
fb3b1a53ef899c9eb89e6c6a1cd3193cedef8261
18595c3a4cb4e7060555a30ebc47216023cf349f
AshleyDumaine/goreporter
/linters/staticcheck/vrp/int.go
Go
go
10,539
permissive
package vrp import ( "fmt" "go/token" "go/types" "math/big" "github.com/AshleyDumaine/goreporter/linters/simpler/ssa" ) type Zs []Z func (zs Zs) Len() int { return len(zs) } func (zs Zs) Less(i int, j int) bool { return zs[i].Cmp(zs[j]) == -1 } func (zs Zs) Swap(i int, j int) { zs[i], zs[j] = zs[j], zs[i]...
64a85255840426ac92ed931ddccaad93a5dc3d77
2b4c8981f687177d5950d811cbb56ea9d0aecaa8
dian-xh/operand-deployment-lifecycle-manager
/pkg/controller/operandrequest/config_status.go
Go
go
1,664
permissive
// // Copyright 2020 IBM Corporation // // 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 ...
555c8d832d72b2d9b6cd7c0bef40fdfc76ce96e6
1330869d9ecbcab05ce367bdab2568d176500660
jqyxiaoca/AlfheimDB
/raft/snapshot.go
Go
go
426
permissive
/* * @Descripttion: * @version: * @Author: cm.d * @Date: 2021-11-11 12:15:28 * @LastEditors: cm.d * @LastEditTime: 2021-11-12 22:37:19 */ package raft import ( "github.com/hashicorp/raft" ) type AlfheimRaftSnapshot struct { SnapshotBytes []byte } func (s *AlfheimRaftSnapshot) Persist(sink raft.SnapshotSink)...