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
f5081ea79202b950023fe534b33fc8d7056fee18
5b4c9402d6f655d2816f72885bee635e3475e79a
magneticio/kubist-example-ci-integration
/main.go
Go
go
892
permissive
package main import ( "fmt" "net/http" "os" ) var versionEnvVar string func ready(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "ready\n") } func healty(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "healty\n") } func index(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(...
0ad42b3c83f5e3043011d8d131e4d48869e870b0
25fc79bba70033833747be2856cf1e70b2bba4db
swiftycloud/swifty
/src/s3/upload.go
Go
go
10,218
permissive
/* * © 2018 SwiftyCloud OÜ. All rights reserved. * Info: info@swifty.cloud */ package main import ( "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "context" "time" "fmt" "swifty/s3/mgo" "swifty/apis/s3" ) type S3Upload struct { ObjID bson.ObjectId `bson:"_id,omitempty"` IamObjID bson.ObjectId `bson:"iam...
0ad60b1731e98577045ed12009c4e6c49cce01d5
3afaa334dbca518d2410cc48dd150ae719d58fb9
go-gitea/gitea
/modules/git/submodule.go
Go
go
3,038
permissive
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2015 The Gogs Authors. All rights reserved. // SPDX-License-Identifier: MIT package git import ( "fmt" "net" "net/url" "path" "regexp" "strings" ) var scpSyntax = regexp.MustCompile(`^([a-zA-Z0-9_]+@)?([a-zA-Z0-9._-]+):(.*)$`) // SubModule...
e1f06d79d70ab31cbaa2c80058bf8478b7fa0912
8b4cba1a74505f3b1a7f53e8c603ecfe6d59d5c3
eplightning/ddfs
/cmd/ddfs-cli/cmd/volumes.go
Go
go
2,179
no_license
package cmd import ( "context" "time" "github.com/eplightning/ddfs/pkg/api" "github.com/eplightning/ddfs/pkg/client" "github.com/spf13/cobra" "github.com/spf13/viper" ) var volumeCmd = &cobra.Command{ Use: "volume", Short: "Manage volumess", } func init() { watchCmd := &cobra.Command{ Use: "watch", ...
bcc42a8344f54a3172d09cd4df5988cda8cef021
6b02c0efc2e5990a8ba99085a823be0e6a62b991
phiphi282/kubermatic
/pkg/handler/v1/label/label_test.go
Go
go
2,474
permissive
/* Copyright 2020 The Kubermatic Kubernetes Platform contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law ...
15f3365379bd3228b2718b5c2475faf620f99f8d
a628e086e9fab7bec8220883f2eece8278aead60
jeffleon/Mercado_Libre_Mutans
/tests/mutan_validation_test.go
Go
go
967
no_license
package tests import ( "github.com/jeffleon/mutansApi/utils" "testing" ) var mutants = []string{ "ATGCGC", "CAGTGC", "TTATAA", "AGAAGC", "CCCATA", "TTTTCG"} var mutants1 = []string{ "ATGCGC", "CAGTGC", "TTATAA", "AGAGGC", "CCCATA", "TTTACG"} var mu...
b0d03f003d716a9b6a6d4c247df67df2a382bdaa
4853017a25f63654ad4fffcffe315fcbac541bca
n0rig/terraform-provider-openapi
/openapi/openapi_spec_security_definition_apikey_header_bearer.go
Go
go
1,585
permissive
package openapi import ( "fmt" "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" "strings" ) const bearerScheme = "Bearer" type specAPIKeyHeaderBearerSecurityDefinition struct { name string } // newAPIKeyHeaderBearerSecurityDefinition constructs a SpecSecurityDefinition of Header type usi...
e1cd269af8a9889070473f98d376966221fc0447
873cb118a803494b0b49f3dd3df1adb1a38ff39e
enterstudio/fabric8-wit
/workitem/event/event_repository.go
Go
go
5,910
permissive
package event import ( "context" "reflect" "github.com/jinzhu/gorm" errs "github.com/pkg/errors" uuid "github.com/satori/go.uuid" "github.com/fabric8-services/fabric8-wit/account" "github.com/fabric8-services/fabric8-wit/errors" "github.com/fabric8-services/fabric8-wit/rendering" "github.com/fabric8-service...
31bdde0981e99b1367eb12d55b2c75b2c95d0c19
ca8259e54d1cda57a010bef7a0e5a5b2774d268f
tochk/kirino
/memorandums/phone.go
Go
go
2,511
no_license
package memorandums import ( "fmt" "github.com/gorilla/mux" log "github.com/sirupsen/logrus" "github.com/tochk/kirino/auth" "net/http" "strconv" "strings" "github.com/tochk/kirino/pagination" "github.com/tochk/kirino/server" "github.com/tochk/kirino/templates/html" ) func ListPhoneHandler(w http.ResponseW...
847d2cb26e0a0731a654461bd4bf42773990cc32
53468308cb04f6df353cc2fd3b505a7f9a505e01
wwade/gmail-tools
/util/cleanup.go
Go
go
792
permissive
package util import "sync" // Handlers indexed by something, generally the object being cleaned up later. var cleanupHandlers map[interface{}]func() var cleanupMutex sync.Mutex func RegisterCleanupHandler(k interface{}, f func()) { cleanupMutex.Lock() defer cleanupMutex.Unlock() cleanupHandlers[k] = f } func Un...
1474ce5a267bd819566834048f3e7dc6a46b8b51
0b2e2b5a8ea3ab2070a9c7d5aa8db0fbf94725c1
wowucco/go-admin
/tests/tables/user.go
Go
go
9,889
permissive
package tables import ( "fmt" "github.com/wowucco/go-admin/context" "github.com/wowucco/go-admin/modules/config" "github.com/wowucco/go-admin/modules/db" form2 "github.com/wowucco/go-admin/plugins/admin/modules/form" "github.com/wowucco/go-admin/plugins/admin/modules/table" "github.com/wowucco/go-admin/template...
8a11dc79befaf334659a0957a021883586d6b18b
85b6bd814d26276f39ee921eab0455c0de28daea
brentmartin/CodeSchool
/Golang/On_Track_With_Golang/Lesson3/chat/main.go
Go
go
408
no_license
package main import ( "chat/util" "fmt" ) func main() { hostIP := util.GetHostIP() fmt.Println(isIPBlocked(hostIP)) } func isIPBlocked(ip string) bool { blockedIPs := getBlockedIPs() for _, blockedIP := range blockedIPs { if blockedIP == ip { return true } } return false } func getBlockedIPs() []stri...
a808caad2325d228675c76d07c6f4eda461009bf
cb6e522654a1b4e908c68a89c7fb81fb070c820e
Max-Sum/avege
/common/netutil/addr.go
Go
go
826
permissive
package netutil import ( "errors" "io/ioutil" "net/http" "regexp" "github.com/Max-Sum/avege/common" ) func GetExternalIPAddress() (string, error) { client := &http.Client{} u := "https://if.yii.li" req, err := http.NewRequest("GET", u, nil) req.Header.Set("User-Agent", "curl/7.41.0") resp, err := client.Do...
7dfaf0055c8b72193ab48dcf73808ab87639ff52
a0134d39e946cdb32b511bf6b5bd49ed9fa579f2
xchewtoyx/tally-multilingual
/go/counter/counter.go
Go
go
948
no_license
package counter type count struct { Key string Count int } type Counter struct { Counts []count KeyIndex map[string]int } func New() Counter { var self Counter self.KeyIndex = make(map[string]int) return self } func (self *Counter) Tally(key string) { if val, ok := self.KeyIndex[key]...
227e492f12219ccb3428d7abd1064657df589799
b451fe26b1ea952b5f7edcff8bff7499d93785b6
qyzxcswbll/cosmos-sdk
/x/auth/types/amino_signing_test.go
Go
go
1,981
permissive
package types import ( "testing" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth...
c70787a9deb2d3f34096fcf622177528c73db515
467c286e56f882b151d644bdcbd1e72700890f05
gyuho/learn
/doc/recursion/code/05_recursion_reverse_string.go
Go
go
640
permissive
package main import "fmt" func reverse(str string) string { if len(str) == 0 { return str } return reverse(str[1:]) + string(str[0]) } func reverseInRune(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return string(rune...
90f59261259f851cb2749f8eb79486a6fcbcbd9f
1595a957d1e50ad7be05340025708bf459f8dd47
michealchen730/LeetcodeGolang
/main/leetcode/904.go
Go
go
757
no_license
package main import ( "math" ) func totalFruit(tree []int) int { if len(tree) < 3 { return len(tree) } res, f1, f2, e1, e2, j := 0, math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32, 0 for ; j < len(tree); j++ { if f1 == math.MaxInt32 { f1, e1 = j, j continue } if f2 == math.MaxInt32 && tr...
6936e4402510d0c079e50fefdff48b99df354aa4
17171d2763e1a5b0b0b9a25f5c87d962882b40fc
moandy/go-agenda-service
/cli/cmd/register.go
Go
go
2,631
no_license
// Copyright © 2017 NAME HERE <EMAIL ADDRESS> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
c6e95457b9b458b1c37c8facb79782ded232dd54
cacda8a586f3eaed98ff53124fc6f45cb73a76da
kubehippie/database-operator
/cmd/database-operator/setup.go
Go
go
860
permissive
package main import ( "os" "strings" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/kubehippie/database-operator/pkg/config" ) func setupLogger(cfg *config.Config) log.Logger { var logger log.Logger if cfg.Logs.Pretty { logger = log.NewSyncLogger( log.NewLogfmtLogger(os.Stdout...
3c30cd8ab00c6eeab41537622a96f02d9e3f3597
2c3da205c1fdb64156aa166c166be0587c9d8e2c
joshsticks/AdventOfCode2020
/four/part_one.go
Go
go
484
no_license
package four import ( "strings" "github.com/joshsticks/AdventOfCode2020/inputhelper" ) func SolvePart1() int { passports := inputhelper.GetStringsFromFileByDelim("inputs/input4.txt") count := 0 for _, x := range passports { if strings.Contains(x, "byr") && strings.Contains(x, "iyr") && strings.Contains(x, ...
77652843764daf924d5ca3d4bf4aa63efe9e9e0a
f1dfddb3798cc6f64ad99145a9a88ba871f8cb87
pombredanne/siegfried
/pkg/wikidata/wikidata_signature_processing.go
Go
go
11,051
permissive
// Copyright 2020 Ross Spencer, Richard Lehane. 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 requ...
5ab6326e5dbbc072a6b3764390e2e7b3e7e9a5eb
f0da56e851c077efb118da9c2ded9322e574b22f
relistan/go-director
/director.go
Go
go
4,574
permissive
package director import ( // "fmt" "time" ) const ( FOREVER = -1 ONCE = 1 ) // A Looper is used in place of a direct call to "for {}" and implements some // controls over how the loop will be run. The Loop() function is the main call // used by dependant routines. Common patterns like Quit and Done channels a...
a470cfc4a32e659bc98bb2114e8f6c77f961a1ba
84df6d56d7ab3602cd94289c407723c4ec6eafbb
whoiszxl/Monica
/go-yedis/command/set/SrandmemberCommand.go
Go
go
446
no_license
package set import "Monica/go-yedis/core" //随机获取一个元素 func SrandmemberCommand(c *core.YedisClients, s *core.YedisServer) { //搜索key是否存在数据库中 set := core.LookupKey(c.Db.Dict, c.Argv[1]) if set != nil { htTable := set.Ptr.(*core.DictHt).Table //从htTable中随机获取一个元素 key := RandDictMapKey(htTable, false) core.AddRe...
5d560f89fcdff8c8cb71ecd4fb75ac8526527a77
c4df9eeff866626548b8824f30db878163a90956
spintrade/indexer
/version/strings.go
Go
go
1,942
permissive
package version import ( "encoding/base64" "fmt" "regexp" "strings" ) // These are targets for compiling in build information. // See the top level Makefile and cmd/algorand-indexer/main.go var ( // Hash Git commit hash. Output of `git log -n 1 --pretty="%H"` Hash string // Dirty "true" or "" // A release b...
d5504caf5577eecbb17b071162083fe59c1b9e39
40b1fa8adf59e8de67414e27efab68639c975ce4
d3ce1t/areyouin-server
/cqldao/thumbnail_dao.go
Go
go
1,864
permissive
package cqldao import ( "log" "github.com/d3ce1t/areyouin-server/utils" ) type ThumbnailDAO struct { session *GocqlSession } func (dao *ThumbnailDAO) insertOne(id int64, digest []byte, dpi int32, thumbnail []byte, timestamp int64) error { checkSession(dao.session) stmt := `INSERT INTO thumbnails (id, digest,...
e50e4a35290cc2361e55e445a2738a076bd55060
e5cbce41b5fcada1a07b331e5bae15bfdea7feb4
justcherie/singularity
/internal/pkg/build/sources/conveyorPacker_debootstrap.go
Go
go
7,997
permissive
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the // LICENSE.md file distributed with the sources of this project regarding your // rights to use or distribute this software. package sources import ( "bytes" "context" "fmt" "...
6eddbce92280996201a100e406af1e4d07f64172
532ad98a74a27d6c89c0004166b68bd8d3fe5d3b
daviddguedes/go-readCsv-saveMysql
/main.go
Go
go
1,739
no_license
package main import ( "fmt" "strings" "time" "database/sql" "encoding/csv" "os" _ "github.com/go-sql-driver/mysql" "github.com/robbert229/jwt" ) type Blog struct { visitas string cliques string compartilhamentos string } func main() { // Jwt() loadCSV() } func loadCSVsaveMysql(reg...
cb53abff9efbd6ef6652f00f12ce8db3f0a7b52f
e50b123c86dabca1222de746ff891e4bcf478698
train-formula/graphcms
/dataloader/tagbytag/context.go
Go
go
427
no_license
package tagbytag import ( "context" "github.com/gin-gonic/gin" "github.com/train-formula/graphcms/dataloader" "github.com/willtrking/pgxload" ) const contextKey = "tagByTag" func GetContextLoader(ctx context.Context) *TagByTagLoader { return ctx.Value(contextKey).(*TagByTagLoader) } func AddContextLoader(ctx ...
17929234be7c8dcf585670c9bc6a36c60ab3cf9e
cc35409bc97339f301bd7ec4ebafc528b5a4e8c2
thedemodrive/istio
/istioctl/pkg/writer/pilot/status.go
Go
go
7,009
permissive
// Copyright Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wri...
2b432391a3b66813c386c3b2ec0bb5934570d093
9ef6bded85cdbbfcf5d20a8f820c49970418f0ef
dmcgowan/ctr-powertest
/vendor/github.com/containerd/containerd/metrics/cgroups/metrics.go
Go
go
2,861
permissive
// +build linux package cgroups import ( "errors" "fmt" "sync" "github.com/containerd/cgroups" metrics "github.com/docker/go-metrics" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" ) var ( ErrAlreadyCollected = errors.New("cgroup is already being collected") ErrCgroupNotExist...
8081345771c65bcf7aa13d824dc841c8cdd9e182
466af00bcd6b90433f8eb35b8858d0b5a21b1c28
AzureSingularity/azure-service-operator
/pkg/resourcemanager/psql/vnetrule/client.go
Go
go
3,260
permissive
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. package server import ( "context" network "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-09-01/network" psql "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql" "github.com/Azure/azure-service...
932c74e743750203d9beadf49ebb99b6c6905a1a
8b41c2ac9858b1b2b009c80142104dfd79926388
joseph-v/soda-apiserver
/pkg/utils/config/config_define.go
Go
go
6,740
permissive
// Copyright 2017 The OpenSDS Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
ad758a0da365bdb9643084b614cc017c9662347d
516523919aab6a7a180480b7b42133b8cce1f4bb
zhunxun/walk
/declarative/tabpage.go
Go
go
1,553
permissive
// Copyright 2012 The Walk 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 windows package declarative import ( "github.com/lxn/walk" ) type TabPage struct { // Window Background Brush ContextMenuItems []M...
a93b37ed358338c00011493a30d822dd43a442ef
da40ea00c9827a733724a8c72bd8833f79611fc0
aws/amazon-ecs-agent
/agent/api/container/containeroverrides_test.go
Go
go
3,088
permissive
//go:build unit // +build unit // Copyright Amazon.com Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // ...
0d55cc60f91a7e9506d8de99c60d7afb2394297c
c6115f760571e232f0339918842b500459ac7e2d
AmadeusITGroup/kubervisor
/pkg/controller/checks_test.go
Go
go
2,316
permissive
package controller import ( "context" "testing" api "github.com/amadeusitgroup/kubervisor/pkg/api/kubervisor/v1alpha1" "github.com/amadeusitgroup/kubervisor/pkg/controller/item" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" ) type testInterface stru...
c17691f8999563f60dbcc333b4300c4297251f83
ec0f4d0c89270f05be284a2004c6f135fc7ef104
raobystorm/algorithms
/minNumber/algo.go
Go
go
427
no_license
package minnumber import ( "sort" "strconv" "strings" ) type Nums []string func (n Nums) Len() int { return len(n) } func (n Nums) Swap(i, j int) { n[i], n[j] = n[j], n[i] } func (n Nums) Less(i, j int) bool { return n[i]+n[j] < n[j]+n[i] } func minNumber(nums []int) string { strs := Nums{} for i := rang...
50f928fdf6a543df221097e2bd4775b04348e1ef
883fb07f4d98b2b8744651ce1075918f1e2124a6
mind1949/concurrency-in-go
/ex4.5.preventing_goroutine_leaks.go
Go
go
677
no_license
// page: 91 // 预防go协成泄露 // 在本例中因为doWork是在主goroutine中启动的, // 所以会导致死锁. // 但若doWork是在某个子goroutine中 // 启动就会导致goroutine泄露 package main import ( "fmt" "sync" ) func main() { var wg sync.WaitGroup doWork := func(strings <-chan string) <-chan interface{} { completed := make(chan interface{}) go func() { defer wg....
21da9a183779005f2fd4498e083062465fc637ef
93980e108e5c0e50cc083fe256d349952c02f4cd
skyduy/mysocks
/core/server.go
Go
go
5,201
permissive
package core import ( "encoding/binary" "github.com/skyduy/mysocks/cipher" "net" ) type MyServer struct { Cipher *cipher.Cipher ListenAddr *net.TCPAddr } // 新建一个服务端 // 服务端的职责是: // 1. 监听来自本地代理客户端的请求 // 2. 解密本地代理客户端请求的数据,解析 SOCKS5 协议,连接用户浏览器真正想要连接的远程服务器 // 3. 转发用户浏览器真正想要连接的远程服务器返回的数据的加密后的内容到本地代理客户端 func NewSe...
d9dfc2e6af5d924a2a29f6d3f858db152f3bfd36
5d1b825c0e2672641828c650cbbe6122806adce7
cqqccqc/douchain
/chain.go
Go
go
988
no_license
package main import ( "github.com/boltdb/bolt" ) const dbFile = "blockchain_%s.db" const blocksBucket = "blocks" const genesisCoinbaseData = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" // Chain block chain type Chain struct { tip []byte db *bolt.DB } // AddBlock add a block func (bc ...
f711f6f1eb129dcd0110f0452e8492638e517159
7a333df5f9c8cfa2d41f6439cb16755192c49dfb
mnovak1/origin
/pkg/image/importer/importer.go
Go
go
25,885
permissive
package importer import ( "fmt" "net/url" "runtime" "strings" "github.com/docker/distribution" "github.com/docker/distribution/manifest/manifestlist" "github.com/docker/distribution/manifest/schema1" "github.com/docker/distribution/manifest/schema2" "github.com/docker/distribution/reference" "github.com/doc...
d972ea89399f2f35529b38ea4543fb6288e7b3c4
04b143d7200f66daae098a5c402618b2b46805cc
haokw/go-101
/try/concurrent/listing24.go
Go
go
835
no_license
package main import ( "fmt" "math/rand" "sync" "time" ) const ( numberGoroutines = 4 taskLoad = 10 ) var wg sync.WaitGroup func init() { rand.Seed(time.Now().Unix()) } func main() { tasks := make(chan string, taskLoad) wg.Add(numberGoroutines) for gr := 1; gr <= numberGoroutines; gr++ { go wor...
f4a3938c0aea20b5fb4d27dbaf32664f42cd5581
1f83a98fdd5b33ddcea03dec1b6bc01ee8ccca79
amell93/gop
/cl/stmt.go
Go
go
12,482
permissive
/* Copyright 2020 The GoPlus Authors (goplus.org) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed t...
d543fea586716b5087d1af0db47a6f4decf66ca7
6bca51b15a5d47f71ad481a85949cf60c2cc5903
sasquad92/UdemyGolangTraining
/16_parallelism/main.go
Go
go
519
no_license
package main import ( "fmt" "runtime" "sync" ) // init runs before code starts executing // and does some setup func init() { // using all the CPUs // no longer need to include after go 1.5 (by default using more than 1 core) runtime.GOMAXPROCS(runtime.NumCPU()) } var wg sync.WaitGroup func main() { wg.Add(2...
f76f7fbb09b2c5b0a169f46695b02c658dbb62bf
4048162157d45f337aa1ec739925bd76c2150e97
radanalyticsio/oshinko-cli
/vendor/github.com/openshift/origin/pkg/network/generated/internalclientset/fake/clientset_generated.go
Go
go
1,917
permissive
package fake import ( clientset "github.com/openshift/origin/pkg/network/generated/internalclientset" networkinternalversion "github.com/openshift/origin/pkg/network/generated/internalclientset/typed/network/internalversion" fakenetworkinternalversion "github.com/openshift/origin/pkg/network/generated/internalclien...
abd7cc0c4ef2731ed8cfc3c9107df20ff2fd8f1b
84766118d9b99505ce7c7a3be97dffa1ac7ec0ce
tingvarsson/adventofcode
/go/src/2015/day11/day11_test.go
Go
go
442
no_license
package day11 import ( "testing" ) func TestRun(t *testing.T) { var tests = []struct { input string expected string }{ {"abcdefgh", "abcdffaa"}, {"ghijklmn", "ghjaabcc"}, {"cqjxjnds", "cqjxxyzz"}, {"cqjxxyzz", "cqkaabcc"}, } for _, test := range tests { if output := run(test.input); output != te...
2cbe50d5056a14f4f03ad224ead2f5c9c0de08f3
5d8209087c527ab43844b64d0151a9413a2ab049
ThomasHabets/drive-du
/drive-du.go
Go
go
5,047
no_license
// drive-du is a cloud service for listing folder sizes. // // To run you need to change the app name in app.yaml and create config.json, formatted something like: // { // "OAuth": { // "ClientID": "xxxx", // "ClientSecret": "yyyyyy" // } // } package main /* * This file contains all the app e...
261913986f417d925ac81bac6e5e7963dd28a7d3
732ada007f33e4318722901565d8cd634b02a8d1
lightbend/spark-on-k8s-operator
/test/e2e/framework/cluster_role.go
Go
go
2,416
permissive
/* Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
1ab532f18879f90841e6679f6b982e691b6e837a
760ed03ded061e798046b7cee3f5fea7e1a81608
jixianbo/open-monitor
/monitor-agent/node_exporter/collector/log_monitor_linux.go
Go
go
5,289
permissive
package collector import ( "github.com/prometheus/client_golang/prometheus" "sync" "github.com/hpcloud/tail" "fmt" "strings" "net/http" "io/ioutil" "github.com/prometheus/common/log" "encoding/json" "bytes" "encoding/gob" "os" ) type logMonitorCollector struct { logMonitor *prometheus.Desc } const ( l...
b3f23012cf8b65ca476e13f3fea14208fe5d3239
31161c7ff3a05719b51d83e016c13a18c614d03a
jmbarzee/hackerrank
/algorithms/warmUp/staircase.go
Go
go
264
no_license
package main import "fmt" func main() { var count int64 fmt.Scanf("%v", &count) for i := int64(1); i <= count; i++ { for j := int64(0); j < count-i; j++ { fmt.Printf(" ") } for j := int64(0); j < i; j++ { fmt.Printf("#") } fmt.Println() } }
90b7c592fa09b00ee06d24f13cecd64cdebda558
a77f9dfc59c0784e5726f098486393318a431f9b
ViolaOmedaDev/terraform-provider-awsgamelift
/ag/resource_aws_wafv2_web_acl_logging_configuration.go
Go
go
17,718
no_license
package ag import ( "bytes" "fmt" "log" "regexp" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com...
78ffb6e8186b55afc862defaa993d457f2c52754
b4fb84eca3dcb1cb4d2680b386e530406f78a637
nacholupi/go-agent
/_integrations/nrpkgerrors/nrpkgerrors.go
Go
go
1,730
permissive
// Package nrpkgerrors introduces support for github.com/pkg/errors. // // Example: https://github.com/newrelic/go-agent/tree/master/_integrations/nrpkgerrors/example/main.go package nrpkgerrors import ( "fmt" newrelic "github.com/newrelic/go-agent" "github.com/newrelic/go-agent/internal" "github.com/pkg/errors" ...
598a0557f998e25ff4c622fe8c311ebb30f9aa8c
2333c335d1244a6ed061fb360a1a3ae1eb069a44
danilovalente/geolocationexample
/controller/request_mapper.go
Go
go
853
permissive
package controller import "github.com/gorilla/mux" // MapHandlers function does the mapping from the request URLs to the correspondent handler functions func MapHandlers() (*mux.Router, error) { router := mux.NewRouter() context := router.PathPrefix("/geolocation/v1").Subrouter() context.Methods("OPTIONS").Handler...
b47a083d1159cac336dd094ebc9e726b75aa864f
6bbd18332a04d3e814b32bc0548a9c4a7391b647
damemi/symbols-extractor
/pkg/parser/expression/expression_parser.go
Go
go
61,640
permissive
package expression import ( "encoding/json" "fmt" "go/ast" "go/token" "strings" "github.com/gofed/symbols-extractor/pkg/analyzers/type/propagation" "github.com/gofed/symbols-extractor/pkg/parser/contracts" "github.com/gofed/symbols-extractor/pkg/parser/contracts/typevars" "github.com/gofed/symbols-extractor/...
ce62d0efadef6947151a5ff67016a94fb59422ad
b5046387701316648f2ed711ad89c907503f20f4
liuf1358/share
/firebase.go
Go
go
6,933
no_license
package main import ( "context" "encoding/json" "fmt" "log" "time" "firebase.google.com/go/messaging" firebase "firebase.google.com/go" "google.golang.org/api/option" ) var appIns *firebase.App func init() { // Initialize another app with a different config opt := option.WithCredentialsFile("conf/firebas...
5b790e17309ea1a393b919127c67d4477d3bb9a8
3bb68d372dd78550155d80f4fe480cc9616656d7
matthieugouel/sdk
/go/clients/authprofile_client.go
Go
go
3,163
no_license
/*************************************************************************** * * AVI CONFIDENTIAL * __________________ * * [2013] - [2018] Avi Networks Incorporated * All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property * of Avi Networks Incorporated and its suppliers,...
8aeccedd88d7d08aecff7520f43aef6dfa41337a
52208d84ceec8e6122b3497db51ec77a017cef01
HamedSiasi/goRabbit
/goRabbit/receiver.go
Go
go
1,663
no_license
package main import ( "fmt" "github.com/streadway/amqp" "log" ) // Helper function to check the return value for each call func failOnError(err error, msg string) { if err != nil { log.Fatalf("%s: %s", msg, err) panic(fmt.Sprintf("%s: %s", msg, err)) } } func main() { // (1) --- Open con...
857c8954900fd5ca0df342f3ed1080b2cba324a8
5a020ffb042cb0562cea8fd3768ec642413777ca
tranhungt/sous
/vendor/github.com/opentable/go-singularity/api_history_request_requestId_requests.go
Go
go
557
permissive
package singularity import "github.com/opentable/go-singularity/dtos" func (client *Client) GetRequestHistoryForRequest(requestId string, count int32, page int32) (response dtos.SingularityRequestHistoryList, err error) { pathParamMap := map[string]interface{}{ "requestId": requestId, } queryParamMap := map[str...
39f54e8c2124bdf86fd2fc15c43b8b2ee200d26c
52135e05db095fd8a77f4392e7ee7532e7415d1d
wirebase/wire
/project/project_test.go
Go
go
1,586
permissive
package project_test import ( "bytes" "context" "io/ioutil" "os" "path/filepath" "testing" "time" "github.com/wirebase/wire/poller" "github.com/wirebase/wire/project" "github.com/wirebase/wire/runner" ) var _ project.UI = &project.TerseTerminal{} func setupTestProject(tb testing.TB) (dir string, f func())...
dadab427a3bb7fa2470d8ec974a5ad7654106986
aae3c57d4208bd5124c7575519804b6c2dc696a4
rgeorgiev583/sofiatraffic
/stcli/l10n/translator.go
Go
go
524
permissive
package l10n import "github.com/rgeorgiev583/sofiatraffic/i18n" // Translator maps names of terms in the reference language (i.e. English) to their translation in the local language. var Translator map[string]string // InitTranslator initializes the Translator global variable with the appropriate translator for the ...
78c8f6bde6a08c67d557c231b7c0e879c86b9c86
1fb125f6bef248ebdfa9de133ddd64f1881fde88
PhoenixPeca/libdns-route53
/client.go
Go
go
7,107
permissive
package route53 import ( "context" "fmt" "strconv" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" r53 "github.com/aws/aws-sdk-go/service/route53" "github.com/libdns/libdns" ) // NewSession ini...
31450e37d272684ac096a3bafe334bb5a49fc675
776fc29b1c0ae9d04620fceb1ead2346d0915a98
ThomsonTan/opentelemetry-collector
/processor/batchprocessor/batch_processor_test.go
Go
go
17,176
permissive
// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
bb495ae072747b05ffb207485a5bdd2e3f18198e
c29e5b0df9a8ef950a9f67aa677cc63568ba4a3f
liyi-david/reo-learn
/example/expfifo/oracle.go
Go
go
1,695
no_license
package expfifo import "../../lib/sul" import "../../lib/reo" import "time" import "strconv" func GetOracle() *sul.Oracle { o := new(sul.Oracle) o.InPorts = []string{"A"} // dynamically generate the MidPorts o.MidPorts = []string{} for i := 0; i < 11; i++ { o.MidPorts = append(o.MidPorts, "M"+strconv.Itoa(i)) ...
811961c4b0511d37d4b21f08a58bc965dd3259aa
e1a0151772573ab1e8c1339687af5f77249c6c71
tokyomartin/Simplified-Bitcoin
/bitcoin/demo/flagSet.go
Go
go
1,164
no_license
package main import ( "flag" "os" "fmt" ) func Usage() { fmt.Printf("Usage:\n") fmt.Printf("./flagTest person --name Lily --age 20\n") fmt.Printf("./flagTest book --pages 300 --new true\n") } func main() { if len(os.Args) < 2 { Usage() os.Exit(1) } //这两句相当于:var CommandLine = NewFlagSet(os.Args[0], Exit...
6212af7569099e8c2e2383dbcf92fb528791db3f
2b1837bea077087ccc5a3346b0341d0a4983ef09
thinker0/pulsar-beat-output
/vendor/github.com/dop251/goja/tc39_test.go
Go
go
7,786
permissive
package goja import ( "errors" "gopkg.in/yaml.v2" "io/ioutil" "os" "path" "strings" "sync" "testing" ) const ( tc39BASE = "testdata/test262" ) var ( invalidFormatError = errors.New("Invalid file format") ) var ( skipList = map[string]bool{ "test/language/literals/regexp/S7.8.5_A1.1_T2.js": ...
bd8fe85453ba79f5e54c4d6a5c572023f452efb9
98bb66cffa41e2339ff360dadb281cad69e8b686
Mostafatalaat770/Go-Course
/Exercises - Ninja Level 6/5.go
Go
go
473
no_license
package main import ( "fmt" "math" ) type square struct { width float64 length float64 } type circle struct { radius float64 } func (s square) area() float64 { return s.length * s.width } func (c circle) area() float64 { return math.Pi * c.radius * c.radius } type shape interface { area() float64 } func...
5033e458b67629476c866ddf15ed74108058db4c
5e3f11ac5db7d39ee527e5b1c251476c56504800
go-kivik/couchdb
/find_test.go
Go
go
13,233
permissive
// Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed und...
459865a986e12ffbf49cf42d5bcd2f1e98e91d12
a0691c5570b1f6f6e306faa5c121b6d3ef1b244e
arxeiss/go-expression-calculator
/lexer/lexer.go
Go
go
2,982
no_license
package lexer import ( "errors" "regexp" "strconv" ) var ( //nolint:lll tokenRegexp = regexp.MustCompile( `\(|\)|\*\*|\^|//|%|\+|\-|\*|/|=|,|(?P<num>(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)(?:e[+-]?[0-9]+)?)|(?P<id>(?i)[a-z_][a-z0-9_]*)|(?P<ws>\s+)`, ) ) type Lexer struct { expr string } func NewLexer(expression s...
77d8bbeb8dd5bad3b2925d053ff09f98c018f232
4338a89f6962c2493c2e4dd7f6b9468048f7a134
maxshuang/diligent
/pkg/work/select_by_uk_work.go
Go
go
3,411
permissive
package work import ( "github.com/flipkart-incubator/diligent/pkg/intgen" "github.com/flipkart-incubator/diligent/pkg/sqlgen" log "github.com/sirupsen/logrus" "time" ) // SelectByUkRowWork is a CompositeWork that selects one row by unique key each time DoNext is called // This class is Thread Safe. DoNext can be ...
b4e5469eb172eb23c833d067e2d008c404011812
2eac7963f6c6e2bdbfddafd83b07af82ace60347
vivimouret29/pulumi-azure-native
/sdk/go/azure/web/v20200901/webAppAuthSettings.go
Go
go
15,550
permissive
package v20200901 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type WebAppAuthSettings struct { pulumi.CustomResourceState AadClaimsAuthorization pulumi.StringPtrOutput `pulumi:"aadClaimsAuthorization"` AdditionalLoginParams ...
fefa0e85abb6af7692f3112541445eecc6a1e316
da2a4e45014f542a53ecb00c3d7c8c896070fc7d
guanguans/beego-admin
/controllers/base.go
Go
go
630
permissive
package controllers import ( "github.com/astaxie/beego" ) type BaseController struct { beego.Controller } type ErrorJsonData struct { Code int `json:"code"` Message string `json:"message"` Status string `json:"status"` } type SuccessJsonData struct { Code int `json:"code"` Data interface{}...
0838a9cae92e031968684393f5f06ff96305c570
7994e8fee3a59bb2b39317147a047fcbf3191266
codezm/urlooker
/modules/web/http/param/param.go
Go
go
3,227
permissive
package param import ( "fmt" "net/http" "strconv" "strings" "github.com/710leo/urlooker/modules/web/http/errors" ) func String(r *http.Request, key string, defVal string) string { if val, ok := r.URL.Query()[key]; ok { if val[0] == "" { return defVal } return strings.TrimSpace(val[0]) } if r.Form =...
0d0f56d8a4e56ff432312fcd5fda361581fe568f
2538a88cbc4b6360be923b8413ab00fee74175eb
gwoo/hap
/git.go
Go
go
2,174
permissive
// Hap - the simple and effective provisioner // Copyright (c) 2019 GWoo (https://github.com/gwoo) // The BSD License http://opensource.org/licenses/bsd-license.php. package hap import ( "fmt" "os" "os/exec" ) // Git struct type Git struct { Repo string Work string Key string } // Exists checks whether the g...
6b45cbc47a12d557ca6c727c5990ebb47db7aaa1
9ec063511cfbff42fc3182c999fa9f8bfae1c667
opensourcerer-systems/gravity
/lib/utils/error.go
Go
go
14,315
permissive
/* Copyright 2018 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, soft...
b9d5d7b78a2aec1f7c87f6ab021d7901c2542264
ee5989c164ee4e1df0b101d5629db5f28bcbe114
junhuazheng/zjh
/learn/空interface.go
Go
go
1,002
no_license
/* 空interface不包含任何的method,正因为如此,所有的类型都实现了空interface。 空interface对于描述起不到任何的作用,但是空interface在我们需要存储任意类型 的数值的时候相当有用,因为它可以存储任意类型的数值,一个函数吧interface{}作为 参数,那么他可以接受任意类型的值作为参数,如果一个函数返回interface{},那么也就 可以返回任意类型的值。 */ package main import ( "fmt" "reflect" ) func Myecho(a interface{}) { fmt.Printf("变量的值是: \033[31;1m[%v]\033[0...
404d7ceab47bdab2894239f1effa18dbd203dabe
da772f929062a7038cd5ce50bbcf99795efe1b37
JiangtianLi/kubernetes
/staging/src/k8s.io/api/authentication/v1beta1/register.go
Go
go
1,741
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, ...
41a0dbd7e01bdde8a0eba44499f45ae270db445e
2a187856d53d1e888b78639bc10cfaf593961755
Jeffrey511/GoLearn
/object-interface/面向对象/方法.go
Go
go
932
no_license
/** 方法 如果要访问结构体成员,需要使用点号 . 操作符,格式为: 结构体.成员名 方法的定义方法实际上也是函数,只是在声明时,在关键字 func 和方法名之间增加了一个参数 普通的函数定义 func 方法名(入参) 返回值 自定义类型的方法定义 func (接收者) 方法名(入参) 返回值 方法的值传递和指针传递 */ package main import "fmt" type person struct { name string age int } // 普通函数 // 无返回值 func simple(p person) { fmt.Println(p) }...
4ceadb47a46c9cc304c691bd389b72ae4e625906
e2885cbd4e8390185230128795bd84c0cad915eb
Agaetis-IT/imerologio-cli
/internal/ime_generate/workspace_generate.go
Go
go
598
permissive
package ime_generate import ( "os" "github.com/Agaetis-IT/imerologio-cli/pkg/ime_types" "github.com/Agaetis-IT/imerologio-cli/pkg/ime_utils" "github.com/cheggaaa/pb/v3" ) func GenerateWorkspace(bar *pb.ProgressBar, path string) error { mkdirSucceeded := os.Mkdir(path, 0750) if mkdirSucceeded != nil { return ...
cb539934407bf178a801882ab661571105bafd73
1cd29b9aea2e53f2a81450d2bf686dde37da0410
Hamburger1052/Wallet-As-A-Service
/waas_backend/api/models/entity/wallets.go
Go
go
954
no_license
package entity import ( _ "github.com/jinzhu/gorm/dialects/mysql" "time" ) //func (wallets *Wallets) TableName() string { // return "wallets" //} type Wallets struct { ID int64 `gorm:"column:id;primary_key;auto_increment"` UserID string `gorm:"column:user_id;type:varchar(50) NOT NULL"` WalletName ...
8a5a0f34affe1e529d9906169e181099d6a2cc32
c6492fea9330df3f92af36874560b01b364e4317
sequix/grok_exporter
/template/timestamp.go
Go
go
2,634
permissive
// Copyright 2018 The grok_exporter 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 agr...
676f0a81030575162d7f7fbca150e247e5491925
7f5e8f7f9d3d64b99c6c757ff1973d2b900078ad
kazekim/schema-go
/decoder.go
Go
go
14,617
permissive
// Copyright 2012 The Gorilla 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 schema import ( "encoding" "errors" "fmt" "reflect" "strings" ) // NewDecoder returns a new Decoder. func NewDecoder() *Decoder { return &D...
178de91e0556dd8cee619d44c4e17197b02b1274
82418b9c2c1f798622fde57dd11ad07108f42619
iMAJNASHN/terraform-aws-influx
/test/test_helpers.go
Go
go
2,705
permissive
package test import ( "encoding/json" "fmt" "testing" "time" "github.com/gruntwork-io/terratest/modules/logger" "github.com/gruntwork-io/terratest/modules/retry" "github.com/gruntwork-io/terratest/modules/packer" client "github.com/influxdata/influxdb/client/v2" "github.com/stretchr/testify/assert" "github...
7887aeae975c20f5fafcececacd9136371c79636
d0ec25726c4bc4874a9ac44ba5b1d7961189c456
bart0sh/kubernetes
/pkg/apis/networking/validation/validation.go
Go
go
34,113
permissive
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
b15d98a8d9ae3d262bfb57fb1b295a33c7cce580
5c9cc73c38127194f60f0b27dc68f95afb0db90c
justinclayton/mpp
/pkg/selector/selector.go
Go
go
3,691
permissive
package selector import ( "fmt" "net/url" "sync" log "github.com/Sirupsen/logrus" "github.com/matt-deboer/mpp/pkg/locator" ) // Selector is a puggable interface for viable prometheus endpoints type Selector struct { locators []locator.Locator Strategy Strategy } // Result encapsulates a selection result, inc...
292326423a22d65dc9ac1dd6e52f084c01353d58
d5387d25d36e84540580ed6d61a577b56123aed4
renlulu/tendermint
/p2p/trust/store_test.go
Go
go
3,815
permissive
// Copyright 2017 Tendermint. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. package trust import ( "fmt" "io/ioutil" "os" "testing" dbm "github.com/renlulu/tendermint/libs/db" "github.com/renlulu/tendermint/libs/log" "github.com/stretchr...
46c8cf614ce7529294aa6cc3eb77fc028b83880c
e72f466007e7337063e6fef076bd5afbbb1bb235
Kethsar/gform
/rect.go
Go
go
1,381
permissive
package gform import ( "github.com/Kethsar/w32" ) type Rect struct { rect w32.RECT } func NewEmptyRect() *Rect { var newRect Rect w32.SetRectEmpty(&newRect.rect) return &newRect } func NewRect(left, top, right, bottom int) *Rect { var newRect Rect w32.SetRectEmpty(&newRect.rect) newRect.Set(left, top, righ...
a39e492957a13ca9bd69f28ddad9b468c7e5d833
f781b78c8b4d82baaf13077e8ea0a5bb8a9c3bef
geekone/5sdj
/src/site/controllers/admin/movie.go
Go
go
1,421
no_license
package admin import ( "site/models" "strings" ) type MovieController struct { baseController } //视频列表 func (this *MovieController) List(){ var list []*models.Movie var movie models.Movie count,_ := movie.Query().Count() //统计视频数量 if count > 0{ movie.Query().OrderBy("-id").All(&list) } this.Data["count"] ...
214bffb8dea03ca431162b48420c2ef31709170d
4bf07fc2317daa0e3fbeaf5053984946910e86ac
argoproj/argo-cd
/pkg/apis/application/v1alpha1/types.go
Go
go
128,564
permissive
package v1alpha1 import ( "encoding/json" "fmt" "math" "net" "net/http" "os" "path/filepath" "reflect" "regexp" "sort" "strconv" "strings" "time" "unicode" "github.com/argoproj/gitops-engine/pkg/health" synccommon "github.com/argoproj/gitops-engine/pkg/sync/common" "github.com/robfig/cron/v3" log "g...
b4a4a038788c12a0bc991269c01b71fdae4e9039
dee60f99c6f3bff7746acc7c920f06ed94a7d74d
imraghava/scrape
/commits.go
Go
go
1,692
permissive
package scrape import ( "fmt" "log" "os" "sort" "text/tabwriter" "github.com/google/go-github/github" ) func checkAndAddEmail(e string, emails []string) bool { for _, s := range emails { if e == s { return true } } return false } // GetAllCommits prints to stdout a sorted list of all commits to a //...
ce18ec23dd292acd09b967a53ddebc8b50259a88
cd791bbfc5c3b917ff604e294ee7b405e495b53c
murilomothsin/curso_go
/tipos/tipos.go
Go
go
1,018
no_license
package main import ( "fmt" "math" "reflect" ) func main() { // números inteiros fmt.Println(1, 2, 1000) fmt.Println("Literal inteiro é", reflect.TypeOf(32000)) //sem sinal (só positivos)... uint8 uint16 uint32 uint64 var b byte = 255 fmt.Println("O byte é", reflect.TypeOf(b)) //com sinal... int8 int16 in...
6d906c1be4328445cbb3f3402386bda2e6b8b3b7
43c4b9433467079dc882e3ca6bedbb7c938e2c55
alexellis/jaas
/vendor/github.com/docker/docker/integration-cli/docker_cli_history_test.go
Go
go
3,683
permissive
package main import ( "fmt" "regexp" "strconv" "strings" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" ) // This is a heisen-test. Because the created timestamp of images and the behavior of // sort is not predictable it do...
4893796a5c6f55ba50cc763e20005093bd838989
918e7219ac6dd39dae24c2c72108800062f18407
caomengsi/go_practive
/socket/src/rpc/server.go
Go
go
763
no_license
package main import ( "errors" "fmt" // "net" "net/http" "net/rpc" ) type Args struct { A,B int } type Quotient struct { Quo, Rem int } type Arith int func (t *Arith) Multiply(args *Args, reply *int) error { *reply = args.A * args.B return nil } func (t *Arith) Divide(args *Args, quo *Quotient) error { ...
2e4b2e2a1f75b97cd0e2a02f50768b7721eb093b
b9c6942fa253c344087ebce51214333b6e6bba15
Dieler/helm-wait
/pkg/manifest/parse_test.go
Go
go
1,533
permissive
package manifest_test import ( "github.com/dieler/helm-wait/pkg/manifest" "io/ioutil" "sort" "testing" "github.com/stretchr/testify/require" ) func foundObjects(result map[string]*manifest.MappingResult) []string { objs := make([]string, 0, len(result)) for k := range result { objs = append(objs, k) } sor...
dbfb83e5ba9f25a0b1a76f19281dd39259bb859a
d59738b873d4b55252374ab805888e126e13fe0f
qubitdigital/gqlgen
/graphql/playground/apollo_sandbox_playground.go
Go
go
1,890
permissive
package playground import ( "html/template" "net/http" ) var apolloSandboxPage = template.Must(template.New("ApolloSandbox").Parse(`<!doctype html> <html> <head> <meta charset="utf-8"> <title>{{.title}}</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <link rel="icon" href="https...
35cfc9209165ccefddec1690dfc19e130d584faf
e2bd4d96290623304a26415454b98521f43684fe
bparees/cluster-logging-operator
/test/client/client.go
Go
go
8,189
permissive
package client import ( "context" "fmt" testrt "github.com/openshift/cluster-logging-operator/internal/runtime" "sync" "time" "github.com/ViaQ/logerr/log" "github.com/openshift/cluster-logging-operator/test" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/...
2b50e878a02f4df263ddc77df12ccc1ddff6a086
a5fdad0856598ddfbcc4dbce1b643be6212bba98
laminne/traQ
/service/bot/event/payload/ev_joined.go
Go
go
365
permissive
package payload import ( "github.com/traPtitech/traQ/model" "time" ) // Joined JOINEDイベントペイロード type Joined struct { Base Channel Channel `json:"channel"` } func MakeJoined(et time.Time, ch *model.Channel, chPath string, user model.UserInfo) *Joined { return &Joined{ Base: MakeBase(et), Channel: MakeChann...
484baa8064eeee38817d77745b91f767ce029e58
5a74a095d52af295ae9fa17bede0ad2ee6a7c4fe
zcubbs/capsule
/pkg/webhook/router.go
Go
go
1,733
permissive
// Copyright 2020-2021 Clastix Labs // SPDX-License-Identifier: Apache-2.0 package webhook import ( "context" "io/ioutil" admissionv1 "k8s.io/api/admission/v1" "k8s.io/client-go/tools/record" controllerruntime "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller...
a8da806fdaa37f0cb935eba12b6d099bec711f68
2dadc85e7eaed3b2b37ad6633768d203a1ad3aaa
tommycom-sudo/mygobook
/chapter5/des3.go
Go
go
8,946
no_license
package main import ( "bytes" "crypto/cipher" "crypto/des" "encoding/hex" "os" //"encoding/base64" "fmt" ) //DES 和 3DES加密区别 //前者 加密 密钥必须是8byte //后者加密 解密 再加密 密钥必须是24byte /* des3 469D5D3AC6594B979E0B6262B3B38DBA C694E8E2031F7665F8DF78B3C1D4FA88 0 des3.txt 88613818 des3 469D5D3AC6594B979E0B6262B3B38DBA C694E8...
b52db99eed461aac36bec1f21f2d16f4f31369ae
6d15a9894f843ef1750883cb809a8e3c583ce0d8
piodul/cdc-stressor
/main.go
Go
go
21,801
no_license
package main import ( "context" "encoding/binary" "flag" "fmt" "log" "math" "os" "os/signal" "sort" "strings" "sync" "time" "github.com/codahale/hdrhistogram" "golang.org/x/sync/semaphore" "github.com/gocql/gocql" ) const ( cdcTableSuffix string = "_scylla_cdc_log" ) var ( // In Scylla 4.4, two ta...
7d5d7ad1bf658d075cfd95979cab62ce8c642e25
317839fd228a068cdc9019c121623fe107167879
hadoken79/camel-k
/pkg/util/kubernetes/util.go
Go
go
1,204
permissive
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this fi...
2e3882c9b8358aac53b41a592a0f795502eca632
46e861e952c29c2b393a5fffee7430c099bd873c
qinshulei/skia-buildbot
/perf/go/alerts/alertconfigstate_test.go
Go
go
665
permissive
package alerts import ( "encoding/json" "testing" "github.com/stretchr/testify/assert" "go.skia.org/infra/go/testutils" ) type TestStruct struct { State ConfigState } func TestJSON(t *testing.T) { testutils.SmallTest(t) ts := TestStruct{ State: DELETED, } b, err := json.Marshal(ts) assert.NoError(t, err...