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
7dbc4c001223f556e146e34eed4e60dd1ffd7e13
cee39668ec90e761b348bccb24e103bd9d2a458f
Prashanth684/coreos-assembler
/tools/vendor/github.com/minio/mc/cmd/update-main.go
Go
go
13,805
permissive
// Copyright (c) 2015-2021 MinIO, Inc. // // This file is part of MinIO Object Storage stack // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (...
e636344d6670d2ad4b2b06addaf79bf9fad8f3a3
8c61e757cba74b60bc759c929de465397d03b7ab
pkdevbox/origin
/pkg/auth/ldaputil/url.go
Go
go
6,715
permissive
package ldaputil import ( "fmt" "net" "net/url" "strconv" "strings" "github.com/go-ldap/ldap" ) // Scheme is a valid ldap scheme type Scheme string const ( SchemeLDAP Scheme = "ldap" SchemeLDAPS Scheme = "ldaps" ) // Scope is a valid LDAP search scope type Scope int const ( ScopeWholeSubtree Scope = lda...
f3160fe023b628ad0b29d0d95c2924eaaced7f38
1716e65c3561d79bb309e2d397e7bac78afed00f
tanisman/abot
/core/nlp_test.go
Go
go
2,463
permissive
package core import ( "strconv" "strings" "testing" ) type test struct { Test string Class string Exp []string } func TestClassifyTokens(t *testing.T) { ner, err := buildClassifier() if err != nil { t.Fatal(err) } tests := []test{ { Test: "Where is Jim?", Class: "person", Exp: []string{"...
c6f7a6b1f7b5e7283363112a5303c09333fb7a81
cb7ea75102889404e44e11380610db9129be5b7a
sgtest/monorepo-test-3
/kubernetes-14/pkg/volume/util_test.go
Go
go
17,763
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, ...
f22e1f1b4af6e23b313dea5176cdfebabc551798
0b712aca27a04b42b18fbfbda47783e5a516fed8
andrewjc/threeatesix
/pc/pc.go
Go
go
3,661
no_license
package pc import ( "fmt" "github.com/andrewjc/threeatesix/common" "github.com/andrewjc/threeatesix/devices/bus" "github.com/andrewjc/threeatesix/devices/intel8086" "github.com/andrewjc/threeatesix/devices/intel8259a" "github.com/andrewjc/threeatesix/devices/io" "github.com/andrewjc/threeatesix/devices/memmap" ...
e128c938189bd586d9afdee498e6a0cc306de9ba
fb13f55d0cef0f178f7a1bbe94382436ba512880
vvden/seaweedfs
/weed/server/webdav_server.go
Go
go
13,987
permissive
package weed_server import ( "context" "fmt" "io" "math" "os" "path" "strings" "time" "github.com/chrislusf/seaweedfs/weed/util/grace" "golang.org/x/net/webdav" "google.golang.org/grpc" "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seawee...
448985b7e4e1a98f08613b37a59f7ba14750bbb4
dd12c68c35e3dc9733cf91766fd09efa09bc9d3b
sachinds13/mongocli
/internal/cli/opsmanager/diagnosearchive/diagnose_archive.go
Go
go
932
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...
5a82b1ffaafb8ee4c06aceda5fecc8f932211a9d
2e71fbe5e0295e74fa12ad4b4f5ba50d822bb305
Vorringer/oci-go-sdk
/resourcesearch/search_resources_request_response.go
Go
go
3,508
permissive
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei...
096b822f5bab3bb8044c9900b1b24594580fe178
86f76a539c1424a718212ce072ef16772953bd1d
roketworks/dotnet-core-buildpack
/src/dotnetcore/finalize/finalize_test.go
Go
go
5,573
permissive
package finalize_test import ( "bytes" "io/ioutil" "os" "path/filepath" "github.com/cloudfoundry/dotnet-core-buildpack/src/dotnetcore/config" "github.com/cloudfoundry/dotnet-core-buildpack/src/dotnetcore/finalize" "github.com/cloudfoundry/dotnet-core-buildpack/src/dotnetcore/project" "github.com/cloudfoundry/...
c288c24f611ad938a95d8eef8ef21e0a3c382f04
5e639fb5577c26a129bdcefe12f0a9e6ff0d967b
dylanmorley/azure-sdk-for-go
/sdk/internal/recording/recording_test.go
Go
go
16,162
permissive
//go:build go1.16 // +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package recording import ( "encoding/json" "fmt" "io/ioutil" "net/http" "os" "path/filepath" "strings" "testing" "time" "github.com/Azure/azure-sdk-for-go/sdk/internal/mock" ...
7ef69542969f60a6db8af93da14639cc84f1c7c5
3ecb3609b34584fc9adfc6709f3f5a9c76ff4783
RTradeLtd/go-ipfs-plugin-i2p-gateway
/vendor/gx/ipfs/QmU44KWVkSHno7sNDTeUcL4FBgxgoidkFuTUyTXWJPXXFJ/quic-go/internal/crypto/key_derivation_quic_crypto_test.go
Go
go
6,380
permissive
package crypto import ( "gx/ipfs/QmU44KWVkSHno7sNDTeUcL4FBgxgoidkFuTUyTXWJPXXFJ/quic-go/internal/protocol" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("QUIC Crypto Key Derivation", func() { // Context("chacha20poly1305", func() { // It("derives non-fs keys", func() { // aead, er...
8fe0697c9062d9f4f97d3da85f8bf73dd17bb958
1f9276e2b9e94bc09265642b0a51c56a64d16a0d
JamieOw119/DistributedObjectStorage
/dataServer/versions/deleteOldMetadata.go
Go
go
510
no_license
package versions import ( "lib/es" "log" "time" ) const MIN_VERSION_COUNT = 5 func StartDeleteOldMetadata() { for { buckets, e := es.SearchVersionStatus(MIN_VERSION_COUNT + 1) if e != nil { log.Println(e) return } for i := range buckets { bucket := buckets[i] for v := 0; v < bucket.Doc_count-...
56d0dee4e6b2d9698cb5eb1e7674a1ebad57f36e
1b78887eb9822162d9064cc840a58fe70533188a
openshift/installer
/terraform/providers/ibm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/tfdiags/rpc_friendly.go
Go
go
847
permissive
package tfdiags import ( "encoding/gob" ) type rpcFriendlyDiag struct { Severity_ Severity Summary_ string Detail_ string } // rpcFriendlyDiag transforms a given diagnostic so that is more friendly to // RPC. // // In particular, it currently returns an object that can be serialized and // later re-inflated u...
f0cd8f26fe800738323f939987f5d34077fda573
07396490a80ae59e5cd982b982b9b2da086dab63
ArtReeX/binance-trading-bot
/binance/consts.go
Go
go
799
permissive
package binance const ( // OrderStatusNew - статус "новый" OrderStatusNew OrderStatus = "NEW" // OrderStatusPartiallyFilled - статус "частично выполнен" OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED" // OrderStatusFilled - статус "выполнен" OrderStatusFilled OrderStatus = "FILLED" // OrderStatus...
687551f5dae17ffea346ec1ad2f38edca42ee855
ffee67199c3d097a5abc26296e6cdff339c0b68a
trisberg/task-runtime
/controllers/taskexecution_controller.go
Go
go
4,379
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 under the License ...
2040b93f6446b0b4db671c34ffab9fe979bfe179
1330b8fe3a38e626807c666d528cc98cd10a3dab
ylywyn/nsq
/nsqd/protocol_v2_test.go
Go
go
51,630
permissive
package nsqd import ( "bufio" "bytes" "compress/flate" "crypto/tls" "encoding/json" "errors" "fmt" "io" "io/ioutil" "math" "math/rand" "net" "net/http" "net/http/httptest" "net/url" "os" "runtime" "strconv" "sync" "sync/atomic" "testing" "time" "github.com/golang/snappy" "github.com/nsqio/go-n...
bfc84cdef00c2e9e348643589d2d35e236fb9e95
68322e8759c06f749f75bb8629ded0982d2238ff
gnsalok/algo-ds-golang
/golang-quick-tour/struct_pointer.go
Go
go
405
permissive
package main import "fmt" type User struct { Id int Name string Email string } func (user *User) Get() { // Get all the data of User user.Id = 101 user.Name = "Alok Tripathi" user.Email = "gnsalok@gmail.com" fmt.Println(user.Id, user.Name, user.Email) } func main() { u := User{Id: 110} u.Get() // W...
8ddfd501ac1347db81b8b1fb7cd860b7d67b2802
e8dc07ce31ab30ed496f24c74f93ba2055fc24c1
kdrag0n/nanotap
/vendor/github.com/kdrag0n/golang-evdev/cdefs.go
Go
go
1,128
permissive
package evdev import "syscall" import "unsafe" const MAX_NAME_SIZE = 256 const ( EVIOCGID = 2148025602 EVIOCGVERSION = 2147763457 EVIOCGREP = 2148025603 EVIOCSREP = 1074283779 EVIOCGKEYCODE = 2148025604 EVIOCGKEYCODE_V2 = 2150122756 EVIOCSKEYCODE = 1074283780 EVIOCSKEYCODE_V2 =...
c763ae67e8760594c759f849693179f86bb46525
2b87b83a28f16d7279e4254e8ea91e014996cb63
cha63506/emgo
/egpath/src/stm32/hal/gpio/f1.go
Go
go
1,674
permissive
// +build f10x_ld f10x_ld_vl f10x_md f10x_md_vl f10x_hd f10x_hd_vl f10x_xl f10x_cl package gpio import ( "mmio" "unsafe" "stm32/hal/raw/mmap" "stm32/hal/raw/rcc" ) var ( A = (*Port)(unsafe.Pointer(mmap.GPIOA_BASE)) B = (*Port)(unsafe.Pointer(mmap.GPIOB_BASE)) C = (*Port)(unsafe.Pointer(mmap.GPIOC_BASE)) D =...
84c182a63eafc1033be1e4e0baf236ee0c2d7512
f641142ef0200c4a6500527fcadb8ffde0a699cb
codeloving0/commitizen-go
/cmd/root.go
Go
go
2,432
permissive
package cmd import ( "fmt" "io/ioutil" "log" "os" homedir "github.com/mitchellh/go-homedir" "github.com/qijinzhi/commitizen-go/commit" "github.com/qijinzhi/commitizen-go/git" "github.com/spf13/cobra" "github.com/spf13/viper" ) func Execute() error { return rootCmd.Execute() } var ( all bool debug ...
549d7b8bcfdac84eca3a827a22ba47934a665544
9690de99f42d87580b25eddbe921eb715657638d
yupwei68/azure-sdk-for-go
/profiles/latest/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go
Go
go
825
permissive
// +build go1.9 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // This code was auto-generated by: // github.com/Azure/azure-sdk-for-go/tools/profileBuilder package streamanalyticsapi import original "githu...
b701ea10f8045ea7cb977323b62731b547a98b31
494c95c6acf8a8abfab0ee2347407be14e92cd5c
lat1992/go-api
/pkg/query/query.go
Go
go
382
permissive
package query import ( "strconv" ) type Sql struct { query string table string args []any paramCount int } type ColumnValue struct { Column string Value any } func (s *Sql) Build() string { return s.query } func (s *Sql) Args() []any { return s.args } func (s *Sql) getNextParams() string...
b4aeedcc61934834959453745e7f23c7c3fcf5f9
a15af3d527d44ebd7244dd6f491b21543973a95f
qmutz/singularity
/internal/app/singularity/plugin_uninstall_linux.go
Go
go
606
permissive
// Copyright (c) 2019, 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 singularity import ( "fmt" "github.com/sylabs/si...
c7e571390430959970e4bc6b760ec3c8697f0735
540d31cf4392968ecd3754198a18e6fd130b62fb
sakura-rip/pythonlike-go
/dict.go
Go
go
1,940
no_license
package pythonlikego //Dict is python like object dictionary in Golang type Dict map[interface{}]interface{} func NewDict() Dict { return Dict{} } //Return the number of items in the dictionary d. func (d Dict) Length() int { return len(d) } //Return a new view of the dictionary’s keys func (d Dict) Keys() []inte...
edf709775ac39acbc8199aa8c43b0a4b155f8c70
70e8435c1845bed64efab4c5601884902dba89e2
Akim-Delli/GoConcurrency
/promises/promises.go
Go
go
1,585
no_license
package main import ( "errors" "fmt" ) func main() { po := new(PurchaseOrder) po.Value = 42.27 SavePo(po, false).Then(func(obj interface{}) error { po := obj.(*PurchaseOrder) fmt.Printf("Purchase Order saved with ID: %d\n", po.Number) return nil }, func(err error) { fmt.Printf("Failed to save Purchase ...
7c2b033c79329d10c47f14fce31cef9a9ab803dd
9e3470a0c5ec9551b4194dd0bbaafd318affc709
zehuaiWANG/kubesphere
/pkg/models/devops/project_credential_handler.go
Go
go
17,628
permissive
/* Copyright 2019 The KubeSphere 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, ...
a7f6dff9d66f6e34d83d7c3daead77abbaadb4ea
77c21e32beddf7bf067857f6438ce4f58afee409
rengers/aws-xray-sdk-go
/xray/aws.go
Go
go
11,819
permissive
// Copyright 2017-2017 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/ // // or in the "license" ...
1bf2c74d8672c2141a1da51aceda580982f9b48f
9e8ce00e54f8ba99d4f5bc39aec7d2ebf8849873
bzub/kustomize
/pkg/target/diamondcomposition_test.go
Go
go
11,942
permissive
// Copyright 2019 The Kubernetes Authors. // SPDX-License-Identifier: Apache-2.0 package target_test import ( "fmt" "path/filepath" "strings" "testing" kusttest_test "sigs.k8s.io/kustomize/v3/pkg/kusttest" plugins_test "sigs.k8s.io/kustomize/v3/pkg/plugins/test" ) const patchAddProbe = ` apiVersion: apps/v1 k...
cbf5e7070d89461960073cfeffa83bf9446b3f04
ac91be27141474688e02d3958b2bb2f5dbc4283a
hanzai/healer
/message.go
Go
go
6,139
no_license
package healer import ( "bytes" "compress/gzip" "encoding/binary" "fmt" "hash/crc32" "io" "io/ioutil" lz4 "github.com/bkaradzic/go-lz4" snappy "github.com/eapache/go-xerial-snappy" "github.com/golang/glog" ) /* Message sets One structure common to both the produce and fetch requests is the message set form...
88d8b02b97d4847f64fc659c300e498ddb8ac320
238b8f903fad94cc50b0ea1ebe36e40bd2a9f435
jflam/gophernotes
/vendor/github.com/cosmos72/gomacro/fast/call0ret1.go
Go
go
20,098
permissive
// ------------------------------------------------------------- // DO NOT EDIT! this file was generated automatically by gomacro // Any change will be lost when the file is re-generated // ------------------------------------------------------------- /* * gomacro - A Go interpreter with Lisp-like macros * * Copyri...
f792a16e0a65312f58c5e4336e8911f85e271e58
ec04d46aac7bf7efa8bc966e28c216bc7ba119ce
sora083/go-practice
/main.go
Go
go
3,132
no_license
package main import ( "database/sql" "log" "net/http" _ "github.com/go-sql-driver/mysql" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/thoas/go-funk" _ "github.com/walf443/go-sql-tracer" _ "net/http/pprof" "github.com/felixge/fgprof" "github.com/labstack/echo-contrib...
0890be747a12cf325e31394ead7b1cad26dc0447
e27fbb2468cc0ff13cfcbded8b480bf1b2093d86
wangcmin2064/evcc
/core/site.go
Go
go
10,910
permissive
package core import ( "errors" "fmt" "math" "sync" "time" "github.com/avast/retry-go/v3" "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/core/loadpoint" "github.com/evcc-io/evcc/push" "github.com/evcc-io/evcc/util" ) // Updater abstracts the LoadPoint implementation for testing type Updater interfac...
cf3aa2fb3bb8e6548f95ccd5b14f5923fba91b7a
be41e1d2ebd290c9c0096e2015a6f7005e8190e2
hb-chen/x-stock
/routes/register_test.go
Go
go
724
permissive
package routes import ( "testing" "github.com/axiaoxin-com/goutils" "github.com/axiaoxin-com/x-stock/services" "github.com/gin-gonic/gin" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) func TestRegisterRoutes(t *testing.T) { gin.SetMode(gin.ReleaseMode) r := gin.New() // Register 中的 basic a...
3f8d3658f2fd8baf162864abc34d2abc71896d55
a01278f70931d16d8b7c20615dce06e510be7649
luml6/goexam
/services/cloudbox.go
Go
go
9,130
permissive
package services //七牛云存储上传下载凭证管理 import ( "errors" "fmt" // "io/ioutil" "notepad-api/conf" "notepad-api/model" "notepad-api/utils" "strings" "github.com/astaxie/beego" qiniuConf "qiniupkg.com/api.v7/conf" "qiniupkg.com/api.v7/kodo" ) type CloudBoxService struct { maxUploadExpire int maxDownloadExpire ...
b9d93d3df6ee64c18dcdf6935e8d3aabf875c190
b9efacbfe381849e85e7393818f9e2fdacefa6c2
yuriimakohon/RunecharmsCRUD
/api/storage/inmem/storage.go
Go
go
1,253
no_license
package inmem import ( m "github.com/yuriimakohon/RunecharmsCRUD/api/models" "github.com/yuriimakohon/RunecharmsCRUD/api/storage" ) // In-memory implementation of storage.Storage type Storage struct { Charms []m.Charm LastId int32 } func New() *Storage { return &Storage{make([]m.Charm, 0, 10), 0} } func (s *St...
fca1418eb53a493fce09d81c728029d30f3b97bc
1441be4d57817ce94e05af6fd1542cfee825a4f6
jwendl/custom-commands-terraform-provider
/custom_commands_project.go
Go
go
5,252
no_license
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "time" "github.com/google/uuid" "github.com/hashicorp/terraform/helper/schema" ) func customCommandsProject() *schema.Resource { return &schema.Resource{ Create: customCommandsProjectCreate, Read: customCommandsProjectRead, Upd...
b8e9cddbc8072f233ec4225803ced2270955135c
d21141efe0ead0823bc6ff60ad6bb04cbb90de7e
Shopify/cloudflare-go
/access_ca_certificate_test.go
Go
go
5,498
permissive
package cloudflare import ( "context" "fmt" "net/http" "testing" "github.com/stretchr/testify/assert" ) func TestAcessCACertificate(t *testing.T) { setup() defer teardown() handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", ...
840f36e2eb36186caff19075a15bb895f08ec0cb
54a7f13ae4fef618b74c0e75c2ae3c9a5701d8c7
condensat/bank-api
/sessions/context.go
Go
go
446
permissive
// Copyright 2020 Condensat Tech. All rights reserved. // Use of this source code is governed by a MIT // license that can be found in the LICENSE file. package sessions import ( "context" "errors" ) var ( ErrInternalError = errors.New("Internal Error") ) func ContextSession(ctx context.Context) (*Session, error...
edecde593036fa95082877c0dbf3e25614a0b5c8
8b2f8f5ec8beca62f48fb25c707652a0daedfd7f
gdbelvin/certificate-transparency
/go/fixchain/fix_error_test.go
Go
go
9,303
permissive
package fixchain import ( "errors" "fmt" "testing" "github.com/google/certificate-transparency/go/x509" ) func TestEqual(t *testing.T) { equalTests := []struct { e *FixError f *FixError expEqual bool }{ { &FixError{}, &FixError{}, true, }, { &FixError{Type: PostFailed}, ...
95b653302185ec74565e36e9f65cf4d4604790be
0d46b7a526601e87b90244baaf9dcf47a9500402
lizan/mixer
/pkg/attribute/bag_test.go
Go
go
5,643
permissive
// Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
fab6ac511e100da30255b7a0084fdd6c2035862a
e3faefdd49c4c8655a9af8ee28cd648e3d463750
x-hgg-x/space-invaders-go
/lib/systems/life.go
Go
go
1,471
permissive
package systems import ( "fmt" gc "github.com/x-hgg-x/space-invaders-go/lib/components" "github.com/x-hgg-x/space-invaders-go/lib/resources" ecs "github.com/x-hgg-x/goecs/v2" ec "github.com/x-hgg-x/goecsengine/components" w "github.com/x-hgg-x/goecsengine/world" ) // LifeSystem manages lives func LifeSystem(w...
3802e0106a42379748490fda155f53c01a0adb34
ec18b50e79d9ce026633409886926f1a2715b55e
dlaststark/machine-learning-projects
/Programming Language Detection/Experiment-2/Dataset/Train/Go/extensible-prime-generator-2.go
Go
go
486
no_license
package main import ( "fmt" "github.com/jbarham/primegen.go" ) func main() { p := primegen.New() fmt.Print("First twenty: ") for i := 0; i < 20; i++ { fmt.Print(p.Next(), " ") } fmt.Print("\nBetween 100 and 150: ") p.SkipTo(100) for n := p.Next(); n < 150; n = p.Next() { fmt.Print(n, " ") } p.SkipTo(7...
9da2b5979b9c6b4cc13df23865050724d50bca5a
d3ddb01ead07e602463ec19c2f8200be2f411bff
molnarmark/hackerrank-go
/algorithms/drawingBook/main.go
Go
go
1,134
no_license
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) // utilities func readLine(reader *bufio.Reader) string { text, _, _ := reader.ReadLine() return string(text) } func splitInput(input string) []int { var data []int for _, val := range strings.Split(input, " ") { intVal, _ := strconv.ParseIn...
1c9cde0b6961f3be57c34fe26ee6b457b82c87e1
210293bde7309e8901bec3f6b368009f08de51d6
rockingdice/delay_queue
/main.go
Go
go
605
no_license
package main import ( "delay_queue/api" "delay_queue/daemon" "delay_queue/grpc" "fmt" "github.com/pkg/errors" "google.golang.org/grpc" "net" ) func main() { address := ":9002" l, err := net.Listen("tcp", address) //TODO config_file if err != nil { panic(errors.New("监听" + address + "失败")) } go daemon.Det...
f575865422b3a554abda747d884e269dcf9136c8
92fdc18aff87895d5aabcb0ae7824825c6398599
sacloud/libsacloud
/v2/helper/newsfeed/functions.go
Go
go
1,475
permissive
// Copyright 2016-2022 The Libsacloud 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...
942ad95fd702b81b83e94628e388ac69a3738a46
f91794a2e171785533edbda171a083c5edc07846
linmut/kubernetes-x
/pkg/kubelet/kubelet_node_status.go
Go
go
23,913
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, ...
492bf3912805ee43c150d5b28f33032896d58b11
43ba5400cdd727e8f92930cca27b45d78b371b0d
tmax-cloud/hypercloud-multi-api-server
/client/clientset.go
Go
go
2,152
no_license
package client import ( "fmt" claimsv1alpha1 "github.com/tmax-cloud/hypercloud-multi-api-server/client/typed/claims/v1alpha1" clusterv1alpha1 "github.com/tmax-cloud/hypercloud-multi-api-server/client/typed/cluster/v1alpha1" configv1alpha1 "github.com/tmax-cloud/hypercloud-multi-api-server/client/typed/conf...
723a973afb9db849e3ba94219b57e1b6ad3e96a7
6557181d88a0552d5ba755de4766adc2ceb8d2e0
Perciva/TPA-Web
/Go/src/graphql/Resolver/flight_company_resolver.go
Go
go
561
no_license
package Resolver import ( "errors" "github.com/graphql-go/graphql" "models" ) func AllFlightCompany(p graphql.ResolveParams) (i interface{}, err error) { flightCompany := models.GetAllFlightCompany() if len(flightCompany) == 0 { return nil, errors.New("error: no data found") } return flightCompany, nil } f...
df2e7d277a06459974afc479d4f7bdbbfb467332
82eacb54c85028dd3a003eb92559384da8d23bd1
tgmendes/shakespeare-dex
/web/errors.go
Go
go
270
no_license
package web // HTTPError is used to return http client requests errors. type HTTPError struct { StatusCode int Err error } // Error implements the error interface, returning the http error message. func (e *HTTPError) Error() string { return e.Err.Error() }
fa0eb91fb1bf8cb57972d5da7117f250862be413
5c618a981ee19483112a98d2b02e211683730e61
umangachapagain/rook
/pkg/operator/ceph/object/notification/controller_test.go
Go
go
16,952
permissive
/* Copyright 2021 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to ...
4d26c7c06ccb6eaefd13d7927a331f0b212aba23
b345bca73b84905332b41099452e8b2f857c637d
Navneet923/mattermost-load-test-ng
/coordinator/agent/config.go
Go
go
618
permissive
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. package agent import ( "github.com/mattermost/mattermost-load-test-ng/loadtest" ) // LoadAgentConfig holds information about the load-test agent instance. type LoadAgentConfig struct { // A sring that id...
519ea29b25a5f5707f66ed7dc5df40e03b31a9d4
4f5ab84d88b40c7649d2e48553998decda88127c
bonald/evolution
/backend/time/models/php/plan.go
Go
go
644
no_license
package php import ( "time" ) type Plan struct { Id int `xorm:"not null pk autoincr INT(11)"` FromDate string `xorm:"not null default '' comment('开始日期') VARCHAR(255)"` ToDate string `xorm:"not null default '' comment('结束日期') VARCHAR(255)"` DailyId int `xorm:"not null default 0 comment(...
0765ade9d0756f729e9ce7656d4bd8f4e88d0afa
442f30941462cd9f861ed330a952f684c6ab2b20
TakashiMatsuda/vald
/pkg/agent/core/ngt/service/vqueue/stateful_test.go
Go
go
21,669
permissive
// // Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless requir...
c72fe431ddfeec350de291a1e7662b530f2aa432
be9b6362a57813917ec4ac565b057caf4875e6d4
funnythingz/sandbox-go
/goroutine3.go
Go
go
461
no_license
package main import ( "fmt" "time" ) func main() { task := make(chan string) taskquit := make(chan bool) workerquit := make(chan bool) go func() { loop: for { select { case <-taskquit: workerquit <- true break loop case job := <-task: fmt.Println(job) } } }() go func() { for n...
388086772b563d50fd907ed5f293e20f90bc8e07
db82ddd6f36ccb3cfe9b8802ed3b4a6d680fd7d3
Lzyandwjr/GO
/src/github.com/03zheng/main.go
Go
go
461
no_license
package main import "fmt" func main() { //十进制 var i1 = 101 fmt.Printf("%d \n", i1) fmt.Printf("%b \n", i1) //转2进制 fmt.Printf("%o \n", i1) //十进制 转换成8进制 fmt.Printf("%x \n", i1) //十进制转换成16进制 // 8进制 i2 := 077 fmt.Printf("%d", i2) //16进制 i3 := 0x1234567 fmt.Printf("%d\n", i3) //查看变量类型 fmt.Printf("%T \n", i...
b7bac5e720f7fffa92443a5a288b24395be2f489
30bac419c0eab4791fa8c03f37c87996095faaf3
openziti/edge
/controller/internal/routes/identity_router.go
Go
go
19,625
permissive
/* Copyright NetFoundry Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
94cd72476269e9c46efd825fd22359b2b4185ef0
a1c9a03e9cd201fcce2797581a5b859659ee241b
wuwx/servicecomb-mesher
/proxy/pkg/egress/egress_test.go
Go
go
5,495
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 ...
31f7b66502fe0540059741285c9910b8bc6c5d4a
fdd7a75ccfec28feef18b23efcb8cea2d8bc4e88
aoeu/collision
/md5/md5_test.go
Go
go
1,146
no_license
package md5 import ( "testing" "math/rand" ) type randomDataMaker struct { src rand.Source } func (r *randomDataMaker) Read(p []byte) (n int, err error) { todo := len(p) offset := 0 for { val := int64(r.src.Int63()) for i := 0; i < 8; i++ { p[offset] = byte(val & 0xff) ...
45bcad5d7269bb141fb4395f66ad08a5026215ab
709bb95736f1fe5b970f3d19bafd07e9daeb4938
drichardson/memory-errors
/memory-errors.go
Go
go
822
permissive
package main import ( "flag" "log" "syscall" ) const GB = 1 << 30 var allocationInGB = flag.Uint("size", 2, "allocation size in GB") func main() { flag.Parse() allocationSize := *allocationInGB * GB log.Printf("Allocating 0x%X bytes\n", allocationSize) memory := make([]byte, allocationSize) // mlock preve...
36d0b3abeb76490717c3a08944b930a9e4e47104
b45c9fbd2c363c98365d8dfaab38b5c24c26edeb
simple-tec/kyverno
/pkg/engine/variables/operator/notin.go
Go
go
2,189
permissive
package operator import ( "fmt" "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/engine/context" ) //NewNotInHandler returns handler to manage NotIn operations func NewNotInHandler(log logr.Logger, ctx context.EvalInterface, subHandler VariableSubstitutionHandler) OperatorHandler { return NotInHandler{ ...
76d78aeaababe50ff6f0ff18f662d8785ca5a2df
8ebcea3c073426ab3398b4a004d422ee660a6684
DaveGeneral/proxy_pool-1
/source/re_clarketm.go
Go
go
876
permissive
package source import ( "github.com/phpgao/proxy_pool/model" "regexp" "strings" ) func (s *clarketm) StartUrl() []string { return []string{ "https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list.txt", } } func (s *clarketm) GetReferer() string { return "http://github.com/" } type clarketm ...
910e283e69f2cc62ad9f63d22f1fe83235d367b6
a1ed628a49a85c22997491b7942450abe408009f
bpkgoud/pulumi-azure-native
/sdk/go/azure/network/v20201101/getVirtualHubRouteTableV2.go
Go
go
1,129
permissive
package v20201101 import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func LookupVirtualHubRouteTableV2(ctx *pulumi.Context, args *LookupVirtualHubRouteTableV2Args, opts ...pulumi.InvokeOption) (*LookupVirtualHubRouteTableV2Result, error) { var rv LookupVirtualHubRouteTableV2Result err := ctx.Invoke("azure-n...
c85fbf54a94faf00320cd2ca5a5811d319b6595b
c011b8c0855d3fdef958fade49890047b3656afd
TheStraubulous/gramarr
/handler_addmovie.go
Go
go
4,711
permissive
package main import ( "fmt" "strings" "github.com/drakenot/gramarr/radarr" "path/filepath" tb "gopkg.in/tucnak/telebot.v2" ) func (e *Env) HandleAddMovie(m *tb.Message) { e.CM.StartConversation(NewAddMovieConversation(e), m) } func NewAddMovieConversation(e *Env) *AddMovieConversation { return &AddMovieCon...
ffd58ad7bb354f372cf28eeb210e2f6b6a224834
f62a6b18123f252eff1a372eee45baf13e2f1f87
alexbn71/lorawan-stack
/pkg/gatewayserver/io/io.go
Go
go
14,958
permissive
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. // // 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 // // Un...
85f2b9b6067bff235e33e3e2ccd2e821b9e2ab84
ed970eec998633a3b89bd3ffea1243e3fbfdad5a
Rider-io/kyma
/components/application-connectivity-certs-setup-job/options_test.go
Go
go
2,018
permissive
package main import ( "fmt" "testing" "time" "github.com/stretchr/testify/assert" ) func TestOptions_ParseDuration(t *testing.T) { t.Run("should parse proper duration string", func(t *testing.T) { //given durationString := "30h" //when res, err := parseDuration(durationString) //then assert.NoErro...
a9e2668d2a72404c928d87b5cf8169bfa59d7667
22e8ead8cf660c265be4fea1089e9dcd34719964
chudini93/go-chromecast
/cmd/status.go
Go
go
2,135
permissive
// Copyright © 2018 Jonathan Pentecost <pentecostjonathan@gmail.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
c04f74ebafb84ee2075ce0a33f71bfa953d176c8
6b67e14b26854fcb2e4f0402aeba51d678e9eaae
rl404/mal-db
/vendor/github.com/rl404/go-malscraper/internal/parser/top/top_people.go
Go
go
2,256
permissive
package top import ( "regexp" "strings" "github.com/PuerkitoBio/goquery" "github.com/rl404/go-malscraper/model" "github.com/rl404/go-malscraper/pkg/utils" ) type people struct { area *goquery.Selection cleanImg bool data []model.TopPeople } // GetPeople to get top people list. func (p *parser) GetPe...
0a996e7efd8c20f7a804f2752e97c0630e7df7bf
19406a0bc7dcf69cdbafd01027e320e09d773a15
skyling/pholcus
/common/mgo/find.go
Go
go
1,660
permissive
package mgo import ( "fmt" "gopkg.in/mgo.v2/bson" "github.com/maskwang/pholcus/common/pool" ) // 在指定集合进行条件查询 type Find struct { Database string // 数据库 Collection string // 集合 Query map[string]interface{} // 查询语句 Sort []string // 排序,用法如Sort("firstname...
308eb335e15f408375f97e5380743562ccbdeec5
6131e77d01d50f37122f3f7a5db1eaa0a859854d
crazy2be/fsmon
/fsmon.go
Go
go
873
no_license
// Implements os-independent callbacks for file modification events. Currently only supports inotify (linux) package fsmon import ( "os" "log" ) type Watcher interface { AddWatch(string, Handler) os.Error RemoveWatches(string) os.Error Watch() } var defaultWatcher Watcher func init() { var err os.Error defau...
8b8efd2b91cc342dbb46952847ef24174ca32e66
ed4248ea9ff26a2dc1a06a9d5c23ece1bd718568
swift811111/golangPrac
/api/services/usersServices.go
Go
go
1,161
no_license
package services import ( "net/http" "log" "api/model" "encoding/json" ) func Login(data []byte,w http.ResponseWriter, r *http.Request){ usersData := new(model.UsersInfo) err := json.Unmarshal(data, usersData) //轉為struct if err != nil { panic(err.Error()) } ok, result := usersData.Login(w, r) if ok { Re...
0dfb0ad563ec99b9b92153fb6d3aee802b76a143
3466b25449b4a695ddfaee703907db19e778df23
po3rin/go_playground
/try-git/main.go
Go
go
739
no_license
package main // import "try-git" import ( "fmt" "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing/object" "gopkg.in/src-d/go-git.v4/storage/memory" ) func main() { r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{ URL: "https://github.com/po3rin/go_playground", }) if err != nil {...
c4eb0e8f00fa3660e1a4d62f746111755b0fa641
c79e08c9cdaee0dc3a4f19bbf1c0e07f8e438e2f
detiber/provision
/cli/common_test.go
Go
go
11,662
permissive
package cli import ( "crypto/md5" "fmt" "io" "io/ioutil" "log" "os" "os/exec" "path" "regexp" "strings" "sync" "testing" "time" "github.com/digitalrebar/provision/api" "github.com/digitalrebar/provision/backend" "github.com/digitalrebar/provision/embedded" "github.com/digitalrebar/provision/midlayer"...
daa7bd25ea79d2e1cb137385a8b5dcab4d22b508
e9d3e7bdaab06ecc760da4e7e0dca2f5ddb03cc1
ilhaan/flottbot
/core/matcher_test.go
Go
go
35,160
permissive
package core import ( "fmt" "net/http" "net/http/httptest" "strconv" "testing" "github.com/target/flottbot/models" ) func TestCraftResponse(t *testing.T) { type args struct { rule models.Rule msg models.Message bot *models.Bot } // Init test variables testBot := new(models.Bot) tests := []struct...
be98e6f09cb7f24e1d5a5c754d7dbf14472651eb
fc74071e014c944c115a04932c631025547f2e49
JaminVan/BaiduPCS-Go
/internal/pcscommand/rm_mkdir.go
Go
go
1,019
permissive
package pcscommand import ( "fmt" "github.com/Luis0001/BaiduPCS-Go/pcstable" "os" "strconv" ) // RunRemove 执行 批量删除文件/目录 func RunRemove(paths ...string) { paths, err := matchPathByShellPattern(paths...) if err != nil { fmt.Println(err) return } pnt := func() { tb := pcstable.NewTable(os.Stdout) tb.Set...
af3e4df0f2aa4d50f757bd1092be51555c548a68
753742cb44cbccdea52930fb9477d38c8b6f0eb5
xiaomLee/algorithm-pattern
/src/nums/backtrack_test.go
Go
go
483
no_license
package nums import ( "fmt" "testing" ) func TestSubSets(t *testing.T) { fmt.Println(SubSets([]int{1, 2, 3})) fmt.Println(SubSetsV2([]int{1, 2, 3})) fmt.Println(SubsetsDup([]int{1, 2, 2})) } func TestCombine(t *testing.T) { fmt.Println(Combine(4, 2)) } func TestPermutation(t *testing.T) { fmt.Println(Permuta...
3ecf6be14ccf0fd05d27cec179fec7bc2c4ade0a
688a5437e5450638fff27a11cdee9be22d3fc861
isabella232/locales-2
/yo_BJ/yo_BJ_test.go
Go
go
18,760
permissive
package yo_BJ import ( "testing" "time" "github.com/gohugoio/locales" "github.com/gohugoio/locales/currency" ) func TestLocale(t *testing.T) { trans := New() expected := "yo_BJ" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } } func TestPluralsRange(t *test...
03612423a7a9b56dba73acea6632739c526da5bf
8ecf350ad81f1b097e3bf2c94c5cbea6c47c24a8
divyamenghani/fabric
/protos/utils/blockutils.go
Go
go
5,988
permissive
/* Copyright IBM Corp. 2016 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
2765f78778009960234640eef7124983ff6b85d9
d1b8079a3ac18defee2cfbb5d92c444ccec3b6a6
ystia/yorc
/helper/pathutil/pathutil.go
Go
go
1,106
permissive
// Copyright 2018 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France. // // 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...
ee3cf37fa10f98502dfb4ca68b51e8e7c4cf46ed
c7ca21d2ac41ff5bc14e5f658f6ca56673c42e1b
LukeShortCloud/namespace-operator
/cmd/tanzu-ns-ctl/commands/utils.go
Go
go
1,264
permissive
// Copyright 2006-2021 VMware, Inc. // SPDX-License-Identifier: MIT /* */ package commands import ( "fmt" "io" "io/ioutil" "os" "sigs.k8s.io/yaml" ) // openInput opens a file at the given path or captures stdin. func openInput(path string) (io.ReadCloser, error) { if path == "-" { return os.Stdin, nil } ...
7baacc5b2f3dda2ba18a16784a0aa8a0388da99e
9f36367526c3f2ebae8857f00a3a4a1b89036219
reversTeam/fizzbuzz-golang
/src/endpoint/fizzbuzz/service_test.go
Go
go
6,178
no_license
package fizzbuzz_test import ( "testing" "flag" "log" "os" pbFizzbuzz "github.com/reversTeam/fizzbuzz-golang/src/endpoint/fizzbuzz/protobuf" "google.golang.org/grpc" "golang.org/x/net/context" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" ) func TestGrpcRequest(t *testing.T) { ...
f07434990a0b3fe0dbda4689ae28cfb2b78d8ad4
705437ae3a360b3d7bfeac26b76f62935a61873d
medyagh/minikube
/cmd/minikube/cmd/docker-env_test.go
Go
go
12,161
permissive
/* Copyright 2020 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
17fe67808440268476eabe82eea2d41a75e237d9
823c37008352661c68ba07b0468b3a603ff30c41
timothyhinrichs/opa
/topdown/http_slow_test.go
Go
go
3,929
permissive
// Copyright 2020 The OPA Authors. All rights reserved. // Use of this source code is governed by an Apache2 // license that can be found in the LICENSE file. // +build slow package topdown import ( "context" "net/http" "net/http/httptest" "strings" "sync" "testing" "time" ) func TestHTTPSendTimeout(t *test...
793587db1fa45a28d0d3358f6247868ecaae3e12
c9ea0e17465f08b8476fcc5960fa2af03d63da33
cch123/v2ray-core
/common/protocol/address_test.go
Go
go
3,479
permissive
package protocol_test import ( "bytes" "testing" "v2ray.com/core/common" "v2ray.com/core/common/buf" "v2ray.com/core/common/compare" "v2ray.com/core/common/net" . "v2ray.com/core/common/protocol" ) func TestAddressReading(t *testing.T) { data := []struct { Options []AddressOption Input []byte Address...
abd6772ab6a5f7aac864eed638a30fc64a18e543
ffd4c991dbc956bffaf87f58c28946c662e92f05
rikatz/test-infra
/prow/cmd/tide/main_test.go
Go
go
3,348
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, ...
55884d1cdb4cb185c635984dd5ec57e886c77d9b
b8cad28200d67f0ac685b3bf44892c413b72d4e0
liuchao412/LollipopGo
/vender/src/LollipopGo/LollipopGo/match/match_bak.go
Go
go
3,496
permissive
package match import ( "LollipopGo/LollipopGo/player" "LollipopGo/LollipopGo/util" "cache2go" "fmt" "time" "code.google.com/p/go.net/websocket" ) /* 作者邮箱 : lihaibin@bytedancing.com 有疑问,发邮箱 */ //------------------------------------------------------------------------------ var ( Match_Chan chan *p...
636e260cb4e42aad19273b2ce42a1558f4e4fd21
f08707beab72ae4925922b633f6788459966a1ce
mthssdrbrg/agent
/pkg/integrations/node_exporter/node_exporter_test.go
Go
go
2,998
permissive
// +build !race package node_exporter //nolint:golint import ( "io" "io/ioutil" "net/http" "net/http/httptest" "runtime" "testing" "github.com/go-kit/kit/log" "github.com/gorilla/mux" "github.com/prometheus/prometheus/pkg/textparse" "github.com/stretchr/testify/require" ) // TestNodeExporter runs an integ...
013c67024441585cccac3d72d68536069dd294a2
7b3ccb0e6f8c432df305171b65fef7e50a9bede6
kkirsche/influxdb
/services/opentsdb/handler.go
Go
go
4,505
permissive
package opentsdb import ( "bufio" "compress/gzip" "encoding/json" "errors" "io" "log" "net" "net/http" "sync/atomic" "time" "github.com/influxdata/influxdb" "github.com/influxdata/influxdb/models" ) // Handler is an http.Handler for the service. type Handler struct { Database string RetentionPol...
9b165a291b0c7abd679ed069f9656c21fa6965ac
ab4f1f7ad555250dd4204f96723d684caf234d02
nick-parry/ssh-scum-blocker
/state_test.go
Go
go
2,094
permissive
package main import "testing" // Turn debug off on these tests func init() { DEBUG = false } //func (s *State) stateScumSearch(ip string) (scum *Scum, ok bool) { // test the stateScumSearch method to make sure it is legit func TestStateScumSearch(t *testing.T) { // Lets create a state and put some scum in it to se...
4ac69226e07ccdf3ea0db4ab33e9422cfcc66a13
091e3fad06927bbe0ddaae95bde6f34e56c91b83
siriuscc/go-JVM-single
/go-JVM/src/rtda/heap/method.go
Go
go
4,504
no_license
package heap import ( "classfile" "strings" ) type Method struct { ClassMember constValueIndex uint maxStack uint maxLocal uint code []byte argSlotCount uint exceptionTable ExceptionTable lineNumbers LineNumberTable returnDesc string paramsDesc []string parameterAnnotati...
e5403ae8649fde9b5a530168a4588daa1b2cef47
1df91984d6ac457feee97b13a2d5e157219d51fd
linearregression/luci-go
/logdog/client/cli/subcommandLatest.go
Go
go
3,622
permissive
// Copyright 2016 The LUCI Authors. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package cli import ( "io" "os" "github.com/luci/luci-go/common/clock" "github.com/luci/luci-go/common/errors" log "github.com/luci/luci-...
0ba8e2295e2112cec37dcc0b9d174c43a6bc5e91
97342270c3df4b0b150b17563183f7fb65abed9b
rasen0/coursescheduling
/lib/dao/group.go
Go
go
383
no_license
package dao import ( "coursesheduling/database" "coursesheduling/model" ) func GetGroup() (groups []model.StudentGroup){ groups = database.GetGroup() return } func InsertGroupOne(group model.StudentGroup) { database.InsertGroupOne(group) return } func GetGroups(offset, count int) (groups []model.StudentGroup...
36549cc4f96a37c862ebe79ab89ba940c1e820ef
d672fc1575f0c5936d589c037667ddb3ff1ef93b
avagin/gvisor
/pkg/tcpip/stack/nic_test.go
Go
go
1,933
permissive
// Copyright 2020 The gVisor 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...
573a68b7aeedeeb2edb44e05065ca5e5d8920bee
b837ada1f2f45c966f14ab060bf1cb5eb071f01d
cocoonlife/influxdb
/services/udp/config_test.go
Go
go
1,156
permissive
package udp_test import ( "testing" "time" "github.com/BurntSushi/toml" "github.com/cocoonlife/influxdb/services/udp" ) func TestConfig_Parse(t *testing.T) { // Parse configuration. var c udp.Config if _, err := toml.Decode(` enabled = true bind-address = ":4444" database = "awesomedb" retention-policy = "awe...
3d29f49331f2a546c11e8539a950f8828edee1ab
3eebcda0d7384f19c2cb5c6cf72a171d9da4716b
lambdaxymox/fuchsia
/src/connectivity/network/netstack/dhcp/dhcp_test.go
Go
go
77,534
permissive
// Copyright 2019 The Fuchsia 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 !build_with_native_toolchain package dhcp import ( "context" "errors" "fmt" "math/rand" "testing" stdtime "time" "go.fuchsia.dev/fuchs...
baa4d85f0e84abf24a6b7ad0100260c2e1cffba3
eff302e47bc8e1642f92d4ab319966760802f8e7
zanjs/img
/save.go
Go
go
2,007
permissive
package main import ( "flag" "fmt" "io" "os" "github.com/containerd/containerd/namespaces" "github.com/docker/docker/pkg/term" "github.com/genuinetools/img/client" "github.com/moby/buildkit/identity" "github.com/moby/buildkit/session" "github.com/moby/buildkit/util/appcontext" ) // TODO(AkihiroSuda): suppo...
9363a00bf1373243b7a39f792efc2861686f6649
5cc2f80d39ca3c20063fc1a875368f6aa9621d1e
nya3jp/tast-tests
/src/chromiumos/tast/local/bundles/cros/arc/wm/wm_tablet_helper.go
Go
go
22,520
permissive
// Copyright 2020 The Chromium OS 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 wm provides Window Manager Helper functions. package wm import ( "context" "math" "time" "chromiumos/tast/errors" "chromiumos/tast/lo...
b39b9fba93125ae474495ef5e2213b00bb1cb9ba
a2bc39cc83f30aebf3df730daa3a735f27894893
pavolloffay/opentelemetry-collector-contrib
/receiver/wavefrontreceiver/factory.go
Go
go
3,456
permissive
// Copyright 2019, 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 ag...
83c1b41739799d55a2f889603aae3a3fb6e5eeaa
f126924e6544010448a57696c9c6bacdefd84767
Hanchers/go-demo
/com.hancher.example/43_collection-functions.go
Go
go
2,545
permissive
// 我们经常需要程序在数据集上执行操作,比如选择满足给定条件 // 的所有项,或者将所有的项通过一个自定义函数映射到一个新的 // 集合上。 // 在某些语言中,会习惯使用[泛型](http://zh.wikipedia.org/wiki/%E6%B3%9B%E5%9E%8B)。 // Go 不支持泛型,在 Go 中,当你的程序或者数据类型需要 // 时,通常是通过组合的方式来提供操作函数。 // 这是一些 `strings` 切片的组合函数示例。你可以使用这些例 // 子来构建自己的函数。注意有时候,直接使用内联组合操作代 // 码会更清晰,而不是创建并调用一个帮助函数。 package main import "str...
230d5c1fb60bcab59d8cb8a747e66053b165ed6c
ab8611fa919fb1fb5e095a0d2fbcb781740ce6b9
Gibheer/pkictl
/io.go
Go
go
661
permissive
package main import ( "fmt" "io" "os" ) // Open a path for writing func openOutput(path string) (io.WriteCloser, error) { var ( err error out io.WriteCloser ) if path == "stdout" { out = os.Stdout } else { out, err = os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL|os.O_SYNC, 0640) if err != nil {...
1cc3479340b13d13d96b6ddb73c21b57a29338f7
f7f9e997dd7dabc4bb3bc443ea2282ea4d98cfb0
CPSTL/politeia
/politeiawww/cmsdatabase/database.go
Go
go
5,912
permissive
// Copyright (c) 2018 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package cmsdatabase import ( "errors" cms "github.com/decred/politeia/politeiawww/api/cms/v1" www "github.com/decred/politeia/politeiawww/api/www/v1" ) var ( // ErrNoVer...