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
a2c7ae636082dbd7a84801cb591f09bc42b108e4
84c14f224949118d3c8dd099e4a1867779662a26
stanxii/go-iprs
/resolver/dht.go
Go
go
1,979
permissive
package iprs_resolver import ( "context" "strings" rsp "github.com/dirkmc/go-iprs/path" rec "github.com/dirkmc/go-iprs/record" path "github.com/ipfs/go-ipfs/path" vs "github.com/dirkmc/go-iprs/vs" ) // DHTResolver implements NSResolver for the main IPFS SFS-like naming type DHTResolver struct { vstore *vs.Cac...
4e0ba4df03a1155b1d648736660e93dec2678c6f
da8dfdb384561a79515c3eb84f831a19c2935019
MountainOutOfADuleHill/rackmanagement
/rackmanagement1auto.go
Go
go
2,279
no_license
/* December 5th, 2016 /r/DailyProgrammer challenge Difficulty: Easy Bonus 1: Complete Bonus 2: Incomplete Bonus 3: Adjusted (built a point system into the game, not a points system into word list) */ package main import ( "fmt" //"bufio" //"os" "math/rand" ) func main(){ //reader := bufio.NewR...
c5d48d84897f4f21dba66deb673e46c2a6964a4b
bc6b3f5875eb8d3ac67eda8cebe3cf46ce111342
gurjeet/baxx
/api/file/util.go
Go
go
886
permissive
package file import ( "path/filepath" "github.com/jinzhu/gorm" ) func split(s string) (string, string) { s = filepath.Clean(s) name := filepath.Base(s) dir := filepath.Dir(s) return dir, name } func CountFilesPerToken(db *gorm.DB, t *Token) (uint64, error) { c := uint64(0) if err := db.Model(&FileVersion{})...
842b94b526ab3559b5d8b9715efdf4d1fc16305e
4391765daa5a7ae8a9c568d716717cf407a01bbf
akraievoy/codejam
/src/hr_ctci_45_connected_cells/solution_test.go
Go
go
237
permissive
package main import ( "testing" ) func TestSimple(t *testing.T) { out := solve(In{2, 2, [][]bool{{true, false}, {false, true}}}) if out.largest != 2 { t.Errorf("sum is not correct, expected %d, returned %d", 2, out.largest) } }
5df219afbbca4a204448ecca27c855e449c79672
b20787adf57c721c8772e1d79c60e18d029c03ef
k0d3d/dcrstakepool
/backend/stakepoold/rpcclient.go
Go
go
6,966
permissive
package main import ( "fmt" "io/ioutil" "time" "github.com/decred/dcrd/chaincfg/chainhash" "github.com/decred/dcrd/rpcclient/v2" "github.com/decred/dcrstakepool/backend/stakepoold/userdata" ) var requiredChainServerAPI = semver{major: 5, minor: 1, patch: 0} var requiredWalletAPI = semver{major: 6, minor: 0, pa...
8bb7d11e9c476f281266f494418535225d0770c0
bb8745e71119b25f832dcf97e19c721f8885d0e3
rutul25/mmmbbb
/oas/spec.go
Go
go
1,784
permissive
// Copyright (c) 2021 6 River Systems // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publis...
d4ce9d2d1dd47634285f846f7304a61419faa4ad
bdc97b4d5625872edebe311056bbfb77fe19c490
francov99/dcrd
/wire/msgreject.go
Go
go
4,936
permissive
// Copyright (c) 2014-2016 The btcsuite developers // Copyright (c) 2015-2016 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package wire import ( "fmt" "io" "github.com/decred/dcrd/chaincfg/chainhash" ) // RejectCode represents a numeric ...
0f23ca952e9c3780b79c1d090259422f2da1c50d
6fc0bf01817f118cbbc749c17d71e91ee8d0449e
amireldor/gowid
/vim/vim.go
Go
go
11,358
permissive
// Copyright 2020 Graham Clark. All rights reserved. Use of this source code is governed by the MIT license // that can be found in the LICENSE file. // Package vim provides utilities for parsing and generating vim-like // keystrokes. This is heavily tailored towards compatibility with key // events constructed by tc...
4756d7188be676ed25559559cd0e993cf034215c
2ab9f7b33c1576aaa7f37dfd241d61ec48567f73
diamanticom/cluster-api
/hack/tools/tools.go
Go
go
1,021
permissive
// +build tools /* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
01e8c3250ff833a7402c0c2573d737b781afecb2
becd762e16b6781b5db626f8a22ae06fb25067fb
yt3liu/knative-gcp
/test/operations/job.go
Go
go
2,098
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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
e01836062c3625db0af89b3c4f3a0184cac58d12
40a6508d2861e2f63d7ff6bb8bfab478e4a13c90
jinlongchen/golang-utilities
/wechat/message.go
Go
go
2,224
permissive
/* * Copyright (c) 2018. Jinlong Chen. */ package wechat import ( "fmt" "github.com/jinlongchen/golang-utilities/errors" "github.com/jinlongchen/golang-utilities/http" "github.com/jinlongchen/golang-utilities/json" "github.com/jinlongchen/golang-utilities/log" ) // SubscribeMessageData 订阅消息模板数...
452fbdff451e74b7119ed2b8bd611d6512fb6a39
4fe061d0ba374d17e3db70663951119866dc2ab1
bernos/go-pipeline
/pipeline/loop.go
Go
go
972
no_license
package pipeline import ( "sync" "github.com/bernos/go-pipeline/pipeline/stream" "golang.org/x/net/context" ) func Loop(p Pipeline) Pipeline { return func(in stream.Stream) stream.Stream { var ( wg sync.WaitGroup feedback = make(chan context.Context) pipeIn, pipeCls = stream.WithVa...
7267ed07b2cc6efb548b3850bba31de30c201c1a
5dde6dd460a7118c28992c0580a2322ef30c8b3d
ghostsquad/slack-off
/slackoff/out/models/params.go
Go
go
437
permissive
package models type Params struct { Template string `json:"template"` TemplateFile string `json:"template_file"` FileVars map[string]string `json:"file_vars"` Vars map[string]string `json:"vars"` Channel string `json:"channel"` ChannelAppend string `json:"channel_append"` Channel...
7d259e1828e797c1e7cc8c630f9762ef2afd0eac
103947bda9be394a72b739b36d0c3063962ea354
sent-hil/learn
/go/interface.go
Go
go
964
no_license
package main import "fmt" import "math" type Point struct { X, Y float64 } type intt int // define method on intt similar to: // class intt // def negative // ... // end // end func (self intt) negative() bool { var result bool = false if self < 0 { result = true } return result } // func name ret...
c49cc98470a755908a121bad0610cc7089888ebe
5b89c956a675f442a0ec43f72867f03477a789fb
sergioifg94/integreatly-operator
/pkg/config/amqStreams.go
Go
go
1,543
permissive
package config import ( integreatlyv1alpha1 "github.com/integr8ly/integreatly-operator/pkg/apis/integreatly/v1alpha1" kafkav1 "github.com/integr8ly/integreatly-operator/pkg/apis/kafka.strimzi.io/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) type AMQStreams struct { c...
e614696e2cf897d19b8167098e80dfac411756c9
e89759095a83792e7c2bc761733197365463917f
zed-0xff/terraform-provider-graylog
/graylog/client/event/notification/client.go
Go
go
1,809
permissive
package notification import ( "context" "errors" "net/http" "github.com/suzuki-shunsuke/go-httpclient/httpclient" ) type Client struct { Client *httpclient.Client } func (cl *Client) Get( ctx context.Context, id string, ) (map[string]interface{}, *http.Response, error) { if id == "" { return nil, nil, erro...
e5281a9a6a8e468931a15f4f7d45aace0fc8d72f
3cfb952f9a7deefa0c61c543e76144f58d980803
renatoriccio/mongocli
/internal/cli/iam/globalwhitelist/list.go
Go
go
2,065
permissive
// Copyright 2020 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
f5b84c93f3b4b96d09f45501bcc35ceedea5466d
fd7ac86b1ba0166e1762afe139f65cdf4acd1da7
qmlab/go-job-scheduler
/queue/queue.go
Go
go
3,931
permissive
package queue import ( "container/list" "sort" "sync" "time" "github.com/jonboulle/clockwork" ) // Concurrent sorted queue type Queue struct { m sync.RWMutex len int ss sortedSet clock clockwork.Clock } type sortedSet []*sortedSetNode func (s sortedSet) Len() int { return len(s) } func...
9b919eaeb35c916df04485acc329a347958aaebc
02c1cf5a6417751da068bf2636f7ac6295bbfd1c
leolongpy/movie_gozero
/rpc/cinema/internal/entity/cinema.go
Go
go
673
no_license
package entity type Cinema struct { CinemaId int64 `json:"cinema_id" db:"cinema_id"` CinemaName string `json:"cinema_name" db:"cinema_name"` CinemaAdd string `json:"cinema_add" db:"cinema_add"` LocationId int64 `json:"location_id" db:"location_id"` CinemaTypes string `json:"cinema_types" d...
6b2aa2fe4e5ef8da293ec1f589d9e7e16fa2dba1
ff3287e82cf74e7acd24a9c87136b16719d39a9f
canfeng/go-algorithm-demos
/basic/2-查找表问题/454. 四数相加 II.go
Go
go
1,064
no_license
package __查找表问题 /* 给定四个包含整数的数组列表 A , B , C , D ,计算有多少个元组 (i, j, k, l) ,使得 A[i] + B[j] + C[k] + D[l] = 0。 为了使问题简单化,所有的 A, B, C, D 具有相同的长度 N,且 0 ≤ N ≤ 500 。所有整数的范围在 -228 到 228 - 1 之间,最终结果不会超过 231 - 1 。 例如: 输入: A = [ 1, 2] B = [-2,-1] C = [-1, 2] D = [ 0, 2] 输出: 2 解释: 两个元组如下: 1. (0, 0, 0, 1) -> A[0] + B[0] + C[0] + ...
9e73817378619f268916f21fb7599e440ac6e8ae
16f41120d05d539a5cf868404050588b6fa7c26a
TrevorEdris/goque
/example_object_test.go
Go
go
911
permissive
package goque_test import ( "fmt" "github.com/TrevorEdris/goque" ) // ExampleObject demonstrates enqueuing a struct object. func Example_object() { // Open/create a queue. q, err := goque.OpenQueue("data_dir") if err != nil { fmt.Println(err) return } defer q.Close() // Define our struct. type object s...
b9019de66b6688150f45f34afdc987588f096c65
73072616c548f2f2e7c858fdfe432f6fdb47b215
cablespaghetti/musicbot
/bot/handlers.go
Go
go
5,620
permissive
package bot import ( "fmt" "strconv" "strings" "github.com/cablespaghetti/musicbot/spotify" ) var usage = ` #help# - Print commands #current# - Show current track #next|skip# - Play next track #pause|resume|stop# - Control playback #play <query># - Play 10 tracks that match query #tracks|list# - Show...
79232256f77eefc48cf3c374c71fc03181cb3a28
a8bda98059fe0b78df92fd97f89d47c6b30119a9
mcclayac/HeadFirstThirteen
/abc2.go
Go
go
481
no_license
package main import "fmt" func abc(channel chan string) { channel <- "a" channel <- "b" channel <- "c" } func def(channel chan string) { channel <- "d" channel <- "e" channel <- "f" } func main() { channel1 := make(chan string) //channel2 := make(chan string) go abc(channel1) go def(channel1) fmt.Prin...
20b613a4e65dbae87ab9125084b61ec7fc05da37
911ac4c0dc7b6d83e9a5c5cb1b4d5ee67d37673e
golang-design/under-the-hood
/gosrc/cmd/compile/internal/gc/bimport.go
Go
go
667
permissive
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gc import ( "cmd/internal/src" ) // numImport tracks how often a package with a given name is imported. // It is used to provide a better error messa...
1d853383eb247a1936539b39680176720bca2cd0
6634dbf19524cb8eddc3495ace500ba276e23092
suryatmodulus/go-lolhtml
/examples/mixed-content-rewriter/main.go
Go
go
1,217
permissive
// Usage: curl -NL https://git.io/JeOSZ | go run main.go package main import ( "io" "log" "os" "strings" "github.com/coolspring8/go-lolhtml" ) func main() { w, err := lolhtml.NewWriter( os.Stdout, &lolhtml.Handlers{ ElementContentHandler: []lolhtml.ElementContentHandler{ { Selector: "a[href], l...
59b4c5e6d4952636208ddc47674105fe0cd05f00
e0ee204bc623520cf7163e2998d2e56931f9ad07
Jaggernaut555/respecbot
/queue/queue_test.go
Go
go
1,888
permissive
package queue import ( "testing" ) func TestQueue(t *testing.T) { var q *ListQueue var node *Node data1 := []interface{}{1, "lol", 1.0} data2 := []interface{}{1, 2, 3} data3String := []string{"a", "b", "c", "d", "e"} data3 := []interface{}{} for _, v := range data3String { data3 = append(data3, v) } q =...
68de0a1c3db67ec92fb925956a59e85a4f495d18
7350af3f75bc8034752f96ab492277e6e126836b
cloudfoundry/metric-store-release
/src/pkg/persistence/store_test.go
Go
go
19,271
permissive
package persistence_test import ( "context" "errors" "io/ioutil" "os" "strings" "time" "github.com/cloudfoundry/metric-store-release/src/internal/metrics" . "github.com/cloudfoundry/metric-store-release/src/pkg/persistence" // TEMP "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prome...
b691152f3b6d68cda88f1947e3474956adaa9958
495a7c9c835d949cf6490b89914fab36ea274512
adecaro/fabric-private-chaincode
/internal/attestation/ias.go
Go
go
4,660
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package attestation import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "github.com/pkg/errors" ) const DefaultIASUrl = "https://api.trustedservices.intel.com/sgx/dev/attestation/v4/report" type IntelAttestationServ...
3b929352503f39beac8ffc70f8a4cad5ee75f8bd
522fe961d66b07a0b47f1ec970295af06c6b71bf
abhijeet-srivastava/little-book-semaphores
/ch4/dining/golang/dining-mutex-only.go
Go
go
1,155
no_license
/* In this version: - try to get both - if can't get both drop any I am holding */ package main import ( "fmt" "sync" ) func main() { var wg sync.WaitGroup var fork []int var mux []sync.Mutex fork = make([]int, 5) mux = make([]sync.Mutex, 5) for i:= 0; i<5; i++ { print(fork[i]) } wg.Add(5) fmt.Prin...
a3121cff29e1fc7bb905ccab0739415adc19bd75
013d0697719e3c76b9fa21b33750aa766bf2382f
skycoin/skywire
/pkg/app/listener.go
Go
go
2,318
no_license
// Package app pkg/app/listener.go package app import ( "errors" "fmt" "net" "sync" "github.com/sirupsen/logrus" "github.com/skycoin/skywire/pkg/app/appnet" "github.com/skycoin/skywire/pkg/app/appserver" "github.com/skycoin/skywire/pkg/app/idmanager" ) // Listener is a listener for app server connections. /...
c9da920b1fa91eecdf6b281ac03ada80f0795a65
ff92877648136a7b95f8d28fa3edc7579878c04f
cloudflare/go
/src/net/internal/socktest/switch_unix.go
Go
go
718
permissive
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build unix || (js && wasm) || wasip1 package socktest // Sockets maps a socket descriptor to the status of socket. type Sockets map[int]Status func (sw ...
e0b13c81c1b6c3093884cfda9403af14945ea0ef
285255e7f35ec5cd7dc509aa188c94b0dc9160c8
maximilien/kn-source-pkg
/vendor/knative.dev/client/pkg/sources/v1alpha2/apiserver_client.go
Go
go
7,080
permissive
// Copyright © 2019 The Knative 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...
ca1301c50564c5d0f7c67d10afeec3c48711b24a
8443734892e0f6a888921052846004fa6eee46df
liu9718214/rancher
/pkg/auth/providers/local/local_auth_provider.go
Go
go
11,339
permissive
package local import ( "context" "fmt" "strings" "github.com/pkg/errors" "github.com/rancher/norman/httperror" "github.com/rancher/norman/types" "github.com/rancher/types/apis/management.cattle.io/v3" "github.com/rancher/types/apis/management.cattle.io/v3public" "github.com/rancher/types/config" "github.com...
2d41ccf588ab6c096245dc2ad7b430ed3d5d03b5
8b6254b5bdc7f1652334d6ca0622a9dc477e9047
luohaha3123/grpc-go
/internal/transport/http2_client.go
Go
go
53,517
permissive
/* * * Copyright 2014 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
225fd3c6074b9597ddb51a76dfdd1b8d716c16d3
f25c04307ea6323ad011a65f51236b231d8ada94
electrocasa/Functions
/storage-product-create/executor_test.go
Go
go
3,509
no_license
package function import ( "errors" "github.com/hecatoncheir/Storage" "testing" ) // ------------------------------------------------------------------------------------------------------ func TestProductCanBeCreated(t *testing.T) { productForCreate := storage.Product{ID: "0x12", Name: "Test product", IsActive: tr...
ab990752e42a8802ce7ac16fb3bd4965d9a8cf36
26fe18514916d4fb016f8fceeb45cfd4430d63a0
nicholascapo/cerebral
/pkg/autoscaling/engines/digitalocean/nodes.go
Go
go
1,550
permissive
package digitalocean import ( "math/rand" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" corelistersv1 "k8s.io/client-go/listers/core/v1" "github.com/containership/cerebral/pkg/nodeutil" ) // returns all nodes that match the passed in node selector func getASGNodes(selector map[string]string, nodeLister...
b980fad96420df7dbbee5a747bca83fcd8e61dcc
6e1804e50fcd30714f950509c12c45bbb5021cc8
Sakura1221/GolangStudy
/11-reflect/test7_json.go
Go
go
669
no_license
package main import ( "encoding/json" "fmt" ) type Movie struct { Title string `json:"title"` Year int `json:"year"` Price int `json:"price"` Actors []string `json:"actors"` } func main() { movie := Movie{"喜剧之王", 2000, 10, []string{"zhouxingchi", "zhangbozhi"}} // 编码的过程 结构体 -> json jsonStr, err := json.Mar...
8ed051fff9a67d9e941d46a0eb02e66ece60af8e
a59d5d507ecb0a440434967aed02544360720ce6
lukitsbrian/poe-sg
/x/poesg/handlerMsgDeleteClaim.go
Go
go
720
no_license
package poesg import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/lukitsbrian/poe-sg/x/poesg/keeper" "github.com/lukitsbrian/poe-sg/x/poesg/types" ) func handleMsgDeleteClaim(ctx sdk.Context, k keeper.Keeper, msg *types.MsgDeleteClaim) (*sdk.Result,...
b2302a85ed3cd7bc517711748ae69c5c4887bbea
4148fc151d7dc72b7e9d3f7c4a527680402fb539
subuser-security/repeatr
/lib/fspatch/utimes_linux.go
Go
go
1,429
permissive
package fspatch import ( "os" "syscall" "time" "unsafe" ) func LUtimesNano(path string, atime time.Time, mtime time.Time) error { var utimes [2]syscall.Timespec utimes[0] = syscall.NsecToTimespec(atime.UnixNano()) utimes[1] = syscall.NsecToTimespec(mtime.UnixNano()) // These are not currently available in sy...
09e9e262ff34bb45c00cf710f42fd9f0827d35fd
d57297fd55cb56e05cd13e0b801aac216c3d4a80
leros321/terraform-provider-xenserver
/xenserver/resource_vlan.go
Go
go
4,935
permissive
/* * The MIT License (MIT) * Copyright (c) 2016 Maksym Borodin <borodin.maksym@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitatio...
a0ede6db2877f3bd7d157db2c98445c73597621b
d1cabe3866eaba78f4e31b86a846b7c3e60569b7
vearutop/glide
/cfg/lock.go
Go
go
6,459
permissive
package cfg import ( "crypto/sha256" "fmt" "io/ioutil" "sort" "strings" "time" "bytes" "gopkg.in/yaml.v2" ) // Lockfile represents a glide.lock file. type Lockfile struct { Hash string `yaml:"hash"` Updated time.Time `yaml:"updated"` Imports Locks `yaml:"imports"` DevImports Locks ...
49930ac99af72d5b561108ed1debce01020b2b2b
d37dd00ec62185d7ca07a46f75274d6d9c1aac77
Randyshu2018/fabric
/core/chaincode/container_runtime.go
Go
go
2,407
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package chaincode import ( "github.com/Randyshu2018/fabric/core/container" "github.com/Randyshu2018/fabric/core/container/ccintf" "github.com/pkg/errors" ) // ContainerRouter is a poor abstraction used for building, and running ch...
f17155f51f6dee3c3e2c2df7b0e3b1958ee14ebd
0f32ece178ae0015d5962f30447dfd63b753a014
andrew-d/keep
/Godeps/_workspace/src/github.com/blevesearch/bleve/analysis/type.go
Go
go
2,019
permissive
// Copyright (c) 2014 Couchbase, 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 w...
a0f64f07a8613a105c33e336a6966b52424174da
7222e8b22841ee77f32c89c2b92d5a086d83ac07
osdrv/yapsi
/pkg/repl/repl.go
Go
go
583
no_license
package repl import ( "bufio" "io" "strings" "yapsi/pkg/lexer" "yapsi/pkg/parser" ) const ( PROMPT = ">> " ) func Run(in io.Reader, out io.Writer) { scanner := bufio.NewScanner(in) for { io.WriteString(out, PROMPT) scanned := scanner.Scan() if !scanned { return } line := scanner.Text() lex ...
73cb5567e3abaf4f46f6b0d32a3f4dd4d7ef4f52
3a1fd51bf64d131dafc5f4e99f2cd66e6995d6ba
wangchen615/k8s-scheduler-extender-example
/k8s_scheduler_extender/predicate.go
Go
go
814
permissive
package k8s_scheduler_extender import ( "k8s.io/api/core/v1" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" ) type Predicate struct { Name string Func func(pod v1.Pod, node v1.Node) (bool, error) } func (p Predicate) Handler(args schedulerapi.ExtenderArgs) *schedulerapi.ExtenderFilterResult { pod := args.Po...
375a20a631b17a7291e9a795e22520d46de482f8
00a08b27f28f4f14e25d50b8e0b1d512b08bdafa
otiai10/marmoset
/example_test.go
Go
go
2,584
permissive
// +build !appengine package marmoset import ( "context" "encoding/json" "fmt" "net/http" "net/http/httptest" "strings" ) type User struct { ID int `json:"id"` Name string `json:"name"` } // AuthFilter can detect request header and define current request user. // For example, you can restore User model...
b8fb1003b8466c0cb29a254b051ee7626ee37ea3
e29f07a9a43952947db20692e7ed9ead2f45f91c
szllzs/go-tools
/test/Encry_test.go
Go
go
981
permissive
package test import ( "fmt" "github.com/Jecced/go-tools/src/commutil" "github.com/Jecced/go-tools/src/encrypt" "testing" ) func TestEncryption(t *testing.T) { seed := int64(2112) fmt.Println("种子:", seed) str := "the weather are very nice, enjoy it." data := []byte(str) fmt.Println("原文", string(data)) { ...
001c1c7ddb98487ab4d3506dfa0a16fcfd77b128
8edd5eac732b367667fd045cfa8a309a0d037f6f
deweya/odo
/tests/integration/cmd_pref_config_test.go
Go
go
9,999
permissive
package integration import ( "os" "path/filepath" "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/odo/tests/helper" ) // TODO: A neater way to provide odo path. Currently we assume \ // odo and oc in $PATH already. var testNamespacedImage = "https://raw.githubusercontent.com/...
5aa16889e630bae551a1b4aa5bcbd9566f3d58c6
7dc49cc5d80180d1984e0570f2448e27a67fff9e
miknoj/cluster-api
/controllers/machineset_status.go
Go
go
6,112
permissive
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
f45223c744f60ad4faecac446c2c3d65d216d5fe
16e08e25c4f25931c5f5e997cca2dba44d345112
nuzumglobal/kubernetes
/pkg/registry/extensions/podsecuritypolicy/storage/storage.go
Go
go
2,051
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, ...
41810c6fea59e67201d95cfba08ee95faf3ea408
f0360fb4839ed464b267e78a74e4e4f30e447d4a
zainokta/inventory_go
/internal/modules/stock/usecase/getLatestProductStock.go
Go
go
523
no_license
package usecase import "muramasa/internal/modules/stock/entity" type GetLatestProductStock struct { stockRepository entity.IStockRepository } func NewGetLatestProductStockUseCase(stockRepository entity.IStockRepository) *GetLatestProductStock { return &GetLatestProductStock{stockRepository: stockRepository} } fun...
14afd4bfea01b9a4c576418e66a0b959e1cff830
77a2b2f91633b66c0d9dd87369c5650636326cd7
MuxiKeStack/muxiK-StackBackend
/handler/search/search.go
Go
go
3,663
no_license
// create at 2019.11.24 by shiina orez // search handlers package search import ( "github.com/MuxiKeStack/muxiK-StackBackend/handler" "github.com/MuxiKeStack/muxiK-StackBackend/pkg/errno" "github.com/MuxiKeStack/muxiK-StackBackend/service" "github.com/gin-gonic/gin" "strconv" ) type searchResponse struct { Cour...
4be79a91a4c16ace55585b2d2276fcdb4266a176
844fb35310101d5131d688a24cf204164e807956
daniel-henderson-ty/udw
/udwNet/udwTapTun/windowsTun_test.go
Go
go
381
permissive
// +build windows package udwTapTun import ( "fmt" "testing" ) func ctlCode(code int) int { return (((0x00000022) << 16) | ((0) << 14) | ((code) << 2) | (0)) } func TestTapCode(t *testing.T) { fmt.Println(ctlCode(2)) fmt.Println(ctlCode(10)) fmt.Println(ctlCode(6)) fmt.Println(ctlCode(3)) fmt.Println(ctlCo...
88c85bf36f65a9b2cb7082d0c67f7116e9ba562f
cc7cc9f35de927e548afa935504cbebf090b7851
MrChampz/fullcycle_arq_hexagonal
/adapters/web/server/server.go
Go
go
899
no_license
package server import ( "log" "net/http" "os" "time" "github.com/MrChampz/arq-hexagonal/adapters/web/handler" "github.com/MrChampz/arq-hexagonal/application" "github.com/codegangsta/negroni" "github.com/gorilla/mux" ) type WebServer struct { Service application.ProductServiceInterface } func NewWebServer(s...
122b7f40ab93ecb6284eeaee119f85dcd607fc6f
902ae76d05f7ee8c916c0c5ad12327aa492c57a5
mvanholsteijn/magic-modules
/mmv1/third_party/terraform/data_sources/data_source_google_compute_ha_vpn_gateway.go
Go
go
1,094
permissive
package google import ( "fmt" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) func DataSourceGoogleComputeHaVpnGateway() *schema.Resource { dsSchema := datasourceSchemaFromResourceSchema(ResourceComputeHaVpnGateway().S...
efaa46573a1af437f7fffcda52481f82fe9afd93
8c127e775e97d6e39d2c314485d43b12938d733e
watanata/s3-cli-mock-sample
/src/example/myaws_test.go
Go
go
546
no_license
package main import ( "testing" "github.com/golang/mock/gomock" mock "./s3_mock" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/aws" ) func TestS3Request(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() s3mock := mock.NewMockS3API(ctrl) expected := &s3.GetObjectInput{ ...
da4637a2b6d0931dd7a12ab0dc1db135bf6f2b95
f22b87e43eeb2e143b0c2417e1444e123ec00490
KeisakuHiga/go-tutorial-webapp
/main.go
Go
go
2,020
no_license
package main import ( _ "fmt" "io/ioutil" "log" "net/http" "regexp" "text/template" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename := p.Title + ".txt" return ioutil.WriteFile(filename, p.Body, 0600) } func loadPage(title string) (*Page, error) { filename := title +...
b9ac399d685b92a246e886da7888dea60c9848b8
0fbe4f2b6687c23556fd04913e2a862e3ace6b1f
Coderlane/go-minecraft-ping
/mcclient/handshake_test.go
Go
go
481
permissive
package mcclient import ( "bytes" "reflect" "testing" ) func TestEncodeDecodeFullHandshake(t *testing.T) { var buf bytes.Buffer input := Handshake{ Version: -1, Address: "test", Port: 25565, State: 1, } err := input.EncodeBinary(&buf) if err != nil { t.Fatal(err) } var output Handshake er...
0f0b690c8d7eecb3e24727d76b485b5b8084272f
fd0018524499acf0dfde834c1353fb9b2bfb67e6
denysaleksandrov/tcactl
/lib/client/printers/printer_node_pools.go
Go
go
2,908
permissive
// Package printer // Copyright 2020-2021 Author. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
0e08ba374aba4bfc4f9f1a4e4071b6b805c037bb
bd384aa8e0d4785e9679351db25fe72d1d4c6c21
Frenchris/go-tests
/tests/flags_test/main.go
Go
go
935
no_license
package main import ( "github.com/01-edu/go-tests/lib/challenge" "github.com/01-edu/go-tests/lib/chars" "github.com/01-edu/go-tests/lib/random" ) func main() { var ( flags = []string{"--insert=", "--order"} flagsShorthand = []string{"-i=", "-o"} randArgFlag = []string{random.Str(chars.Words, 13)...
250e47a92aadb736160434e0a2c549f2cc5ecf62
ca5b324907b9e654c97a9f80f53eb75e1e066c84
polibee/casbin-forum
/controllers/node.go
Go
go
3,723
permissive
// Copyright 2020 The casbin Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by a...
dde7974629b35b4e7b4f16305575b0f5c0c36e9c
1737547006d6393087a668e42cc9af14692a8175
chenpfeisoo/chaos-mesh
/controllers/twophase/types.go
Go
go
4,543
permissive
// Copyright 2019 Chaos Mesh Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
1311cf77cd9391709a17fcf81035af79b2f3fbe9
3e9977efff6ef7b9a04f13c56ff6b5563d35ecbc
ytjohn/provision
/api/content.go
Go
go
5,374
permissive
package api import ( "fmt" "io/ioutil" "os" "path" "strings" "github.com/digitalrebar/provision/models" "github.com/digitalrebar/store" ) func (c *Client) GetContentSummary() ([]*models.ContentSummary, error) { res := []*models.ContentSummary{} return res, c.Req().UrlFor("contents").Do(&res) } func (c *Cli...
ce99769875c6440f454fcfb98234b1834b5654ee
0cc533d3c8e3e44317d60db9ac0d715ae31c1ce6
fi0/grapi
/pkg/excmd/options_test.go
Go
go
961
permissive
package excmd_test import ( "path/filepath" "testing" "github.com/google/go-cmp/cmp" "github.com/izumin5210/grapi/pkg/excmd" ) func TestOption_WithPATH(t *testing.T) { cases := []struct { test string env []string in string out []string }{ { test: "set path", env: []string{"FOO=1", "BAR=baz...
bda3d0cd7a274d8988f760d4632021c138db7d75
f4a45adf2449e743837562e36bb15856228f201d
cmluciano/kubernetes
/staging/src/k8s.io/mount-utils/mount_linux.go
Go
go
23,605
permissive
// +build linux /* 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 agree...
a1364142940423289c1dc79148a4c52ef68db76b
845aa1f32e4fbfec7f5a725af3201e5b54e9f491
volatiletech/abcweb
/abcmiddleware/zap_response_writer_test.go
Go
go
521
permissive
package abcmiddleware import ( "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" ) func TestZapResponseWriter(t *testing.T) { w := httptest.NewRecorder() zw := zapResponseWriter{ ResponseWriter: w, } a := assert.New(t) zw.WriteHeader(http.StatusCreated) a.Equal(http.StatusCr...
1dfa2561a2e2b083acea2f3205e688da77e6f1f1
952a28aafb97aac1fe9e9138795db3bbe39993c4
VonRosenchild/cadence
/service/history/historyCache.go
Go
go
7,009
permissive
// Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge...
3dce284e302f8127a8e9db03ec9cda91a265c4cd
bc6ff4458f26e180e4036a74e6b85da8a1336485
cpusoft/go-study
/src/url/url1.go
Go
go
287
no_license
package main import ( "fmt" "net/url" "strings" ) func main() { s := "rsync://rpki.afrinic.net/repository/AfriNIC.cer" u, err := url.Parse(s) if err != nil { panic(err) } pos := strings.LastIndex(u.Path, "/") fmt.Println(pos) fmt.Println(u.Host + string(u.Path[:pos+1])) }
a043ec246cda564828b9d38c3d404a5564900348
34e3842ad7f4142c3871cca90105d8216182398f
AndreMouche/cherry-bot
/pkg/providers/label/check.go
Go
go
3,566
permissive
package label import ( "context" "github.com/pingcap-incubator/cherry-bot/util" "regexp" "strings" "time" "github.com/google/go-github/v29/github" "github.com/pkg/errors" ) const ( maxHistory = 30 * 24 * time.Hour checkDuration = 3 * time.Hour ) func (l *label) restartJobs() { util.Println(l.owner, l.r...
63416d9d27300bd37ee4c2f3b9d80f8d8bfd5237
601eaca4b8a2161fccfc798e1ff54a3f05c348aa
bpkgoud/pulumi-azure-native
/sdk/go/azure/eventgrid/v20210601preview/partnerNamespace.go
Go
go
5,602
permissive
package v20210601preview import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) type PartnerNamespace struct { pulumi.CustomResourceState DisableLocalAuth pulumi.BoolPtrOutput `pulumi:"disableLocalAuth"` Endpoint ...
663f1e5fa8099013467c48de3477a59ef3501c5e
1e2f9825d470257aede02d3c5c884674297a5bfb
ourobouros/k8s
/pkg/util/k8sutil/k8sutil.go
Go
go
3,508
permissive
package k8sutil import ( "net" "os" log "github.com/golang/glog" tfv1alpha1 "github.com/tensorflow/k8s/pkg/apis/tensorflow/v1alpha1" apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ...
f524955b8bde076ef8edb716978695663a74c031
70c3ce309f0136e46359f43623afaeee385512a2
matthes-me/go-rtmp-web-server
/controllers/rpc.go
Go
go
1,333
no_license
package controllers import ( "context" "fmt" "net" "os" "github.com/praveen001/go-rtmp-grpc/pkg/api/v1" "github.com/praveen001/go-rtmp-web-server/models" "google.golang.org/grpc" ) // UserChannelServiceServer .. type UserChannelServiceServer struct { AppContext *ApplicationContext } // Get .. func (s *UserC...
2e54ae9a862357534b9949f3edbb5c328ef94035
155100cfb3152a82e0b71515f985684b003babb6
kodear/bogo
/spider/bilibili_bangumi_test.go
Go
go
280
permissive
package spider import ( "testing" ) func TestBILIBILIBangUmiClient_Request(t *testing.T) { test := BILIBILIBangUmiClient{} test.SetURL("https://www.bilibili.com/bangumi/play/ep15014") test.Initialization(nil, nil) err := test.Request() if err != nil { t.Error(err) } }
c7e916ad9bfbc289438216687278f693cf71b9fe
e66fa8e07671609e7863697662b2b5f6d5394cc7
adilrizvi/CodeChallenges
/productlist.go
Go
go
401
no_license
package main /* for a given array (of positive numbers), modify the slice such that for each element, we store the product of all elements except the current element */ func productList(data []int) []int { // calculate all product if data == nil { return nil } prod := 1 for _, item := range data { prod *= ...
95bcc600ba128f89de67c90b7c66a1a5d7adcc23
d24219722bf118609cee04d25312d33033d6c090
yutaro1985/compro-source
/AtCoder/Others/vtubercup2021/j/J.go
Go
go
3,007
no_license
package main import ( "bufio" "fmt" "os" "strconv" ) const ( initialBufSize = 1e4 maxBufSize = 1e6 + 7 ) var buf []byte = make([]byte, initialBufSize) var sc = bufio.NewScanner(os.Stdin) func init() { sc.Split(bufio.ScanWords) sc.Buffer(buf, maxBufSize) } // 問題によって値は調整する const ( mod = int(1e9) + 7...
4c5bd2185ae19f492d71990d75cbaa96ecbb6e85
8334150d8f868711dd76ae35f292581f6561fbb7
Regliss/piscine-go
/QUEST-08/boolean/main.go
Go
go
626
no_license
package main import ( "github.com/01-edu/z01" "os" ) func printStr(res bool) { if res == true { for _, letter := range "I have an even number of arguments" { z01.PrintRune(letter) } } else { for _, letter := range "I have an odd number of arguments" { z01.PrintRune(letter) } } z01.PrintRune('\n') ...
db63d13b44da35f46768150e89a21402c10169bc
db071adbd3b0a3e5818b55a0aa030d730fba75c3
zenny/leproxy
/leproxy.go
Go
go
6,407
permissive
// Command leproxy implements https reverse proxy with automatic Letsencrypt usage for multiple // hostnames/backends package main import ( "bytes" "crypto/tls" "fmt" "io" "io/ioutil" "log" "net" "net/http" "net/http/httputil" "net/url" "os" "path/filepath" "runtime" "strings" "sync" "time" "github.c...
f1b5672fdfea7f3390a7abefb366a087e102efea
dc675967fe424126a21ec95312a87d6e1b664445
opentable/go-singularity
/v0.14.1/dtos/singularity_docker_port_mapping.go
Go
go
6,522
permissive
package dtos import ( "fmt" "io" "github.com/opentable/swaggering" ) type SingularityDockerPortMappingSingularityPortMappingType string const ( SingularityDockerPortMappingSingularityPortMappingTypeLITERAL SingularityDockerPortMappingSingularityPortMappingType = "LITERAL" SingularityDockerPortMappingSingula...
e8d968250c1f3cb7fbefeebadc1d1ea567f276eb
00ad5feefb95ebc1b7a77bc01422b4cf6c11eaa3
ardhicaturk/newgate_be
/handler/v1/index.go
Go
go
408
no_license
package v1 import ( "github.com/labstack/echo" "net/http" ) type ResponseSuccess struct { Code string `json:"code" xml:"code"` Payload interface{} `json:"payload" xml:"payload"` } func HandlerIndex(c echo.Context) error { return c.JSON(http.StatusOK, ResponseSuccess{ Code: "200", Payload: struct { Na...
96e3397b20fa5b94cf016a78ca0ba33163ed6bca
a7c0691b75a952074363454e3c4f8b1dd87e321e
jonmorehouse/statsd-nsq-backend
/proxy.go
Go
go
1,492
no_license
package main import ( "log" "net" "sync" "time" ) type Proxier interface { Proxy([]byte) error Stop() error } // MultiProxier is a UDP func NewMultiProxier(addrs []string) Proxier { proxiers := make([]Proxier, len(addrs)) for idx, addr := range addrs { proxiers[idx] = NewProxier(addr) } return &multiPro...
d11f505b8d9e788aff01dd556bd60927d30a2620
9225bb2ccfdc1474e8623cf8435f6d317730876a
psirenny/flynn
/gitreceived/gitreceived.go
Go
go
9,169
permissive
package main import ( "archive/tar" "bytes" "crypto/x509" "encoding/pem" "errors" "flag" "fmt" "io" "io/ioutil" "log" "net" "net/http" "os" "os/exec" "path/filepath" "strings" "sync" "syscall" "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-shlex" "github.com/flynn/flynn/Godeps/_...
bee230ab8d2ac8bbd0ae6cf7da227344aa37bdd0
33d569a92517d8d2c6f32acfb6014c4382b9a58c
b/garden-linux
/old/repository_fetcher/fakes/fake_registry.go
Go
go
8,440
permissive
// This file was generated by counterfeiter package fakes import ( "io" "sync" "github.com/cloudfoundry-incubator/garden-linux/old/repository_fetcher" "github.com/docker/docker/registry" ) type FakeRegistry struct { GetRepositoryDataStub func(repoName string) (*registry.RepositoryData, error) getReposit...
05b6df2f97a92e00b0fde71c8d35213e74533dcb
a6e8b12a46cfb474365a326eab8ea4b8970798d4
montaro/kyma
/tests/integration/logging/test-logging.go
Go
go
2,441
permissive
package main import ( "log" "net/http" "os" "github.com/kyma-project/kyma/tests/integration/logging/pkg/jwt" "github.com/kyma-project/kyma/tests/integration/logging/pkg/logstream" "github.com/pkg/errors" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" ) const namespa...
44bf6a46c0dee97100fae2a393134397bd24f033
b243f7a61517972074d93ce8923be3b3f0b63ffb
rudyredhat/go_GetProgrammingWithGo
/03-Variables_Scope/01/scope.go
Go
go
300
no_license
// print random 10 numbers package main import ( "fmt" "math/rand" ) func main() { var count = 0 for count < 10 { var num = rand.Intn(10) + 1 fmt.Println(num, "->", count) count++ } } // 2 -> 0 // 8 -> 1 // 8 -> 2 // 10 -> 3 // 2 -> 4 // 9 -> 5 // 6 -> 6 // 1 -> 7 // 7 -> 8 // 1 -> 9
9116110d0665acb87a7a5015392bc9b5e56bff46
c2b04c8f6187a8325a86940d04b3a69ae0cd0d5a
kingdonb/minectl
/pgk/template/template_test.go
Go
go
100,697
permissive
package template import ( "testing" "github.com/minectl/pgk/model" "github.com/stretchr/testify/assert" ) var ( bedrock = model.MinecraftServer{ Spec: model.Spec{ Minecraft: model.Minecraft{ Edition: "bedrock", Properties: "level-seed=stackitminecraftrocks\nview-distance=10\nenable-jmx-monitoring...
26756438876bac0b35e91eaa31b49557e72b2f75
691b3cc7de7f5bca572d0c6878a6888e1850d7ee
scorecoin/scorecoind
/blockchain/merkle_test.go
Go
go
730
permissive
// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package blockchain_test import ( "testing" "github.com/PointCoin/pointcoind/blockchain" "github.com/PointCoin/btcutil" ) // TestMerkle tests the BuildMerkleTreeStor...
f25d026fe9ffa59569c401b6227a3dcc5b959217
c0a501dc4492cdf274ee32d9f3b09fd38cf89083
mdouchement/hr
/hr.go
Go
go
1,270
permissive
package main import ( "bufio" "flag" "fmt" hrlib "github.com/dustin/go-humanize" "os" "strconv" "strings" ) const version = "1.0.0" func main() { v := flag.Bool("v", false, "Print out the version") h := flag.Bool("h", false, "Print usage") flag.Parse() if *v { printVersion() os.Exit(1) } if *h { ...
788b3aebfa7b7ef6d2f6b384f63f13dc8e8420e3
966fb13f5f3ac7251a386c4b772cf4dfc3d3ebdc
roldancer/dns-clb-go
/ttlcache/ttlcache.go
Go
go
1,064
no_license
package ttlcache import ( "github.com/benschw/dns-clb-go/dns" "net" "time" ) func NewTtlCache(lib dns.Lookup, ttl int) *TtlCache { c := new(TtlCache) c.lib = lib c.ttl = ttl c.lastUpdate = 0 return c } type TtlCache struct { lib dns.Lookup ttl int lastUpdate int32 srvs []net.SRV as ...
f5e49524f63cf80ef105b8ae29159f425864c033
b9ed1622c4ae973faa9eb843ac8e184c14f144ad
bldy/build
/skylark/rule.go
Go
go
5,753
permissive
package skylark import ( "bytes" "encoding/binary" "fmt" "io" "path/filepath" "sort" "github.com/pkg/errors" "sevki.org/x/debug" "bldy.build/build/executor" "bldy.build/build/label" "bldy.build/build/racy" "bldy.build/build/workspace" "github.com/google/skylark" ) // Rule is a bazel rule that is implem...
052bf6819f85f7be221a0aad418a7201cb995fdf
f0e92764d394d717bfdc2d04ac686b5bd5e7b80d
ian-howell/1build
/testing/utils/test_utils.go
Go
go
819
permissive
package utils import ( "github.com/gopinath-langote/1build/testing/def" "io/ioutil" "os" ) // CreateConfigFile creates a config file func CreateConfigFile(dir string, content string) error { return ioutil.WriteFile(dir+"/"+def.ConfigFileName, []byte(content), 0777) } // CreateTempDir created temporary directory ...
dedb9295b22d76b0e07d0687b75b21a6bfda0042
6a0ffabec4b176f24a940a2e0bd17f4cc5bbeb70
sgtest/monorepo-test-3
/kubernetes-10/federation/pkg/federation-controller/util/secret.go
Go
go
1,099
permissive
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
6994fa0660fdfa3777d71baf1c0b1895728ae5a0
eb9fbab19ea706b0c1ac3e2819fb81658aee1c7e
bfss-storage/bfss_server
/TestCase/pressure/test/async_file_test.go
Go
go
871
no_license
package test import ( "math/rand" "pressure/app" "testing" "time" "github.com/stretchr/testify/assert" ) func Test_newAsyncFile(t *testing.T) { var files []*sliceFile files = append(files, &sliceFile{Name: "test1", Size: 1024, Data: make([]byte, 1024)}) files = append(files, &sliceFile{Name: "test2", Size: 1...
3f01e188a351033110f6239f2bb1f67d97adedd2
c5843090d43b68968df143134d28ebd9f28a7f7a
ataboo/go-metar-blink
/pkg/metarclient/aviationweatherclient.go
Go
go
5,735
permissive
package metarclient import ( "encoding/xml" "errors" "fmt" "io/ioutil" "net/http" "net/url" "sort" "strings" "github.com/ataboo/go-metar-blink/pkg/common" "github.com/ataboo/go-metar-blink/pkg/logger" ) var _ MetarClient = (*aviationWeatherClient)(nil) const AviationWeatherEndPoint = "https://aviationweat...
74bf8f2e85660c296834879595313ea0b2aca609
9a8e96947cdf0a3631ca37464545e5de74222f14
louissaadgo/ds-algo
/main.go
Go
go
785
no_license
package main import ( "fmt" "github.com/louissaadgo/ds-algo/algo" ) func main() { answer := algo.FindFactorialRecursive(10) fmt.Println(answer) answer2 := algo.FindFactorialIterative(10) fmt.Println(answer2) answer3 := algo.FibonnaciIterative(10) fmt.Println(answer3) answer4 := algo.FibonnaciRecursive(10) ...
a0688284ca8e8f9b415cc78f90540050d2783146
586b610abea88f2bf1d61d7d313b2e050dc7af2c
ludweeg/noverify
/src/php/parser/node/expr/cast/n_cast_bool.go
Go
go
1,016
permissive
package cast import ( "github.com/VKCOM/noverify/src/php/parser/freefloating" "github.com/VKCOM/noverify/src/php/parser/node" "github.com/VKCOM/noverify/src/php/parser/position" "github.com/VKCOM/noverify/src/php/parser/walker" ) // Bool node type Bool struct { FreeFloating freefloating.Collection Position ...
ce0f086aa8976214e4a7f059c999be262707ac75
6e176c80d2044c431e98f83c2b7ac181220f3430
joonnna/ifrit
/cauth/cauth_test.go
Go
go
4,878
permissive
package cauth import ( "crypto/rand" "crypto/rsa" "crypto/tls" "crypto/x509" "crypto/x509/pkix" "fmt" "net" "strings" "testing" "time" "github.com/joonnna/ifrit/protobuf" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) type stub struct { } func TestTLSconnect...
5b647d9e554196ad047af2a400c65d994bcff446
a973f9e3c867cd6804bd4ba249ddb19b9fe07315
zachvalenta/endly
/system/cloud/gc/bigquery/service_test.go
Go
go
570
permissive
package bigquery import ( "github.com/stretchr/testify/assert" "github.com/viant/endly" "github.com/viant/toolbox" "os" "path" "testing" ) func TestNew(t *testing.T) { context := endly.New().NewContext(nil) if ! toolbox.FileExists(path.Join(os.Getenv("HOME"), ".secret/am.json")) { return } err := InitReq...
0ed6830b8090a5b227e9e501fd215ffb033f0d9e
64b13bd2efb8feaae3e354efd4e92e6341346e93
iamquang95/grabvn-golang-bootcamp
/week5/GrabGoTrainingWeek5Assignment/httpservice/httpservice.go
Go
go
1,352
permissive
package httpservice import ( pwc "grab/week5/GrabGoTrainingWeek5Assignment/postwithcomment" "log" "net/http" ) type RendererInterface interface { Render(interface{}) ([]byte, string, error) } type PostWithCommentHttpService struct { postWithCommentService pwc.PostWithCommentsInterface renderService Re...
9223b63b74c10a4671e48277ee15043c984bc2db
83d2fe0b7fde0c8f524f5892ecfeb6d463e9f281
fr123k/jenkins-aws-pulumi
/pulumi-bucket/vendor/github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam/policyAttachment.go
Go
go
13,854
permissive
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package iam import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Attaches a Managed IAM Poli...
90c4e059dc3697bd137c526733da59b8e74b549c
5f0a9880ed464bd384f21629475b41042cbe92f6
zhuwh1118/nephele
/util/util.go
Go
go
1,154
permissive
package util import ( "fmt" "io/ioutil" "os" "os/user" "path/filepath" "github.com/BurntSushi/toml" "golang.org/x/text/encoding/unicode" "golang.org/x/text/transform" ) func HomePath() (string, error) { var homeDir string // By default, store image and log files in current users home directory u, err := u...