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
1a5d295f99ae925efaf77c010c550895356c77f8
b86674003426040d84e95e41d2f2a0f6ca84def8
Combinations/website
/app.go
Go
go
209
no_license
package main import ( "log" "net/http" "os" ) func main() { fs := http.FileServer(http.Dir("web")) http.Handle("/", fs) log.Println("Listening...") http.ListenAndServe(":"+os.Getenv("PORT"), nil) }
13b85c9fbbd9838f22693e89fe1725214867c4e7
8ed23367c052fd0d8a7cfc51a9a3285eb4c17fa5
CALMBOOM/go-crawel
/parse/parse.go
Go
go
2,555
no_license
package parse import ( "fmt" "net/http" "strings" "github.com/PuerkitoBio/goquery" ) type DoubanMovie struct { Title string Subtitle string Other string Desc string Year string Area string Tag string Star string Comment string Quote string } func G...
1b7e6b1ae53f5632be4a3e0554a7a0cdf59d9d3e
cc514478b611de84a047815ad611d1527cf5c3f8
issacMF/golang_readdoc
/hello.go
Go
go
286
no_license
package main import "fmt" func main(){ var ( name string = "Tran Chi Vi" age int = 23 height float64 = 60.2 ) super_var := "Another way to create Variables of Golang" fmt.Println("Name: ", name, " Age: ", age, " Height: ", height) fmt.Println("Super Var: ", super_var) }
f6ed45ddd7006ced3b0701d18576be67112a8e76
49602fcc50e0ba3d55b3ea2e6ef013de711a8ee2
ferhatelmas/algo
/timus/vol7/1688.go
Go
go
259
permissive
package main import "fmt" func main() { var n, x int64 var m int fmt.Scan(&n) fmt.Scan(&m) n *= 3 for i := 0; i < m; i++ { fmt.Scan(&x) n -= x if n < 0 { fmt.Printf("Free after %d times.\n", i+1) return } } fmt.Println("Team.GOV!") }
86cfbff0f52e8e6d39676ba665e6ea2100ef5a99
12a566eb064b89f82062f41e9a26bd62078098f9
darshanasbg/git-stats
/pull-counter.go
Go
go
3,666
permissive
/* * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you 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....
0aa88a7dc4015a480d150ba5127a6135f35801da
7d0c6144dd436253839490a3c5be24b213716f7e
razzie/raztracer
/ui/util.go
Go
go
553
permissive
package ui import ( "fmt" "strings" ) func colorize(text string) string { normal := currentTheme.TextColor highlight := currentTheme.HighlightTextColor return fmt.Sprintf("[%s]%s[%s]", highlight, text, normal) } func getAutocompleteFunc(words []string) func(string) []string { return func(currentText string) (r...
171b72082e3d01655eee60b47264337c53b7a0f4
70c9159cd517fbbe443844873819d4039852cffa
davidfan75/rancher
/pkg/auth/providers/activedirectory/activedirectory_provider.go
Go
go
7,004
permissive
package activedirectory import ( "context" "crypto/x509" "fmt" "strings" v32 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "github.com/rancher/norman/types" "github.com/rancher/rancher/pkg/auth/providers/common" "github.com/rancher...
7b934d7276a217f68c6a2227279ef627097a08fb
f7963588b4197e835e66db106103f8ae822bd672
stardog-union/stardog-graviton
/vendor/github.com/hashicorp/terraform/builtin/providers/circonus/resource_circonus_check_statsd_test.go
Go
go
2,521
permissive
package circonus import ( "fmt" "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccCirconusCheckStatsd_basic(t *testing.T) { checkName := fmt.Sprintf("statsd test check - %s", acctest.RandString(5)) resource.Test(t, resource.TestCase{ Pre...
bdf192bc017d090586f224d3f57ef55d817889d9
a08db4cd35d8c71ee04d87be836d9db23a6e36ec
codelingo/cayley
/graph/primarykey_test.go
Go
go
2,370
permissive
// Copyright 2015 The Cayley 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 ap...
357d01b5730ef4d856ef67b96c8eed0ead389209
d56e2311ffad6baa6c6963dae61cbad8e67518b2
tchevalleraud/grafana-influxdb-ping
/grafana-influxdb-ping.go
Go
go
4,006
no_license
package main import ( "bufio" "fmt" "github.com/coreos/go-systemd/daemon" "github.com/influxdata/influxdb/client/v2" "github.com/pelletier/go-toml" "log" "os" "os/exec" "strconv" "strings" "time" ) const ( configFile = "/etc/grafana/influxdb/ping/config.toml" ) func aerr(err error){ if err != nil { ...
8ca8689e11ee2fc273a43ab8cd408516d2f25438
1e9a1288c30cd932afa03419f648ef613a79de65
dknlam/vsphere-automation-sdk-go
/services/nsxt/infra/tier_1s/SessionTimerProfileBindingsClient.go
Go
go
11,093
permissive
// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: BSD-2-Clause // Auto generated code. DO NOT EDIT. // Interface file for service: SessionTimerProfileBindings // Used by client-side stubs. package tier_1s import ( "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors...
5178ddc2f55d043d6bb143f48da65dc9bc2f24d9
8ee36b853a001bf4871b3c35b709fe8d8f16ea27
weilaihui/shipyard
/client/client.go
Go
go
11,074
permissive
package client import ( "bytes" "encoding/json" "errors" "fmt" "io" "io/ioutil" "net/http" "net/url" "github.com/weilaihui/citadel" "github.com/weilaihui/shipyard" "github.com/weilaihui/shipyard/dockerhub" ) type ( Manager struct { baseUrl string config *ShipyardConfig } ) func NewManager(cfg *Shi...
ec6a41448c1406558ccd273811bb5b5484ddb880
dcd9b60fb19403215577f2ce14e0d18f4f107ff4
andrew-kireev/2021_1_Noskool_team
/internal/app/middleware/cors_middleware.go
Go
go
1,146
no_license
package middleware import ( "2021_1_Noskool_team/configs" "fmt" "net/http" ) type CORSMiddleware struct { config *configs.Config } func NewCORSMiddleware(config *configs.Config) *CORSMiddleware { return &CORSMiddleware{ config: config, } } func (corsMiddlware *CORSMiddleware) CORS(next http.Handler) http.Han...
173ca7499b91452d1d68a58cd051d2439036ddb7
2cf31ff5390fbe16668dfca78c7b51f45f17e36c
sootma/go-admin
/app/admin/service/sysjob.go
Go
go
1,971
permissive
package service import ( "time" "go-admin/app/admin/models" "go-admin/app/jobs" "go-admin/common/dto" "go-admin/common/log" "go-admin/common/service" "go-admin/tools/app/msg" ) type SysJob struct { service.Service } // RemoveJob 删除job func (e *SysJob) RemoveJob(c *dto.GeneralDelDto) error { var err error ...
4ed1bfe64eab8b847e0ce801251f04513e32c073
5d85570310b96d8f4040350216da94f89d21c397
skondkar/kiali
/business/checkers/destination_rules_checker.go
Go
go
3,206
permissive
package checkers import ( networking_v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" "github.com/kiali/kiali/business/checkers/common" "github.com/kiali/kiali/business/checkers/destinationrules" "github.com/kiali/kiali/kubernetes" "github.com/kiali/kiali/models" ) const DestinationRuleCheckerType = "...
d4aa3e55d63217ac35f384d95320681463ef4976
00df426b5d51ef8f07786335de3749c7c8899362
Dataman-Cloud/harbor
/vendor/github.com/docker/distribution/Godeps/_workspace/src/google.golang.org/api/admin/email_migration/v2/admin-gen.go
Go
go
9,234
permissive
// Package admin provides access to the Email Migration API v2. // // See https://developers.google.com/admin-sdk/email-migration/v2/ // // Usage example: // // import "google.golang.org/api/admin/email_migration/v2" // ... // adminService, err := admin.New(oauthHttpClient) package admin // import "google.golang....
c31c72b64ae335fa2b80b9063f204ac1c9199ad3
baef94466fb122bd815acbc7ddcdb063a5981b72
miles-/kubernetes-ingress-controller
/internal/apis/admin/sni.go
Go
go
1,425
permissive
package admin import ( "encoding/json" "net/url" adminv1 "github.com/kong/ingress-controller/internal/apis/admin/v1" ) type SNIGetter interface { SNI() SNIInterface } type SNIInterface interface { List(params url.Values) (*adminv1.SNIList, error) Get(name string) (*adminv1.SNI, *APIResponse) Create(sni *admi...
a3a99e3e99bc14ac213bc13d158defa84bf198ac
e1e2502c7b12dd1cdca43f50300d8877e7a46db7
jorgeuriarte/kube-metrics-adapter
/pkg/collector/collector.go
Go
go
7,476
permissive
package collector import ( "fmt" "time" log "github.com/sirupsen/logrus" "github.com/zalando-incubator/kube-metrics-adapter/pkg/annotations" autoscalingv2 "k8s.io/api/autoscaling/v2beta2" "k8s.io/metrics/pkg/apis/custom_metrics" "k8s.io/metrics/pkg/apis/external_metrics" ) const ( typeLabelKey = "type" ) ty...
4869c679b8f6353c60eb24e5bb5c0a42551ae502
519426ed1e8e7d403d37b1db5c242c712cbaadb4
qiaojianqj/learnGit
/learngo/gomysql.go
Go
go
1,321
no_license
package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" //"time" ) func main() { db, err := sql.Open("mysql", "astaxie:astaxie@/test?charset=utf8") checkErr(err) //插入数据 stmt, err := db.Prepare("INSERT userinfo SET username=?,departname=?,created=?") checkErr(err) res, err := stmt.Ex...
1e8cd437e697055f68cb66c6daf06015afb5d4bb
7534afb7e893ead8e8b51e05da62e528bda036fc
tmthrgd/httphandlers
/redirect-to-https_test.go
Go
go
2,161
permissive
// Copyright 2017 Tom Thorogood. All rights reserved. // Use of this source code is governed by a // Modified BSD License that can be found in // the LICENSE file. package handlers import ( "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" ) func TestRedirectToHTTPS(t *testing.T) { ...
4f0023d3384c5c53ef5d24e840465452f3ccfc12
3bced2c1648aafb6e3f8ca5d767142b05a051755
zhengyh99/TI
/5/main.go
Go
go
732
no_license
package main import ( "bufio" "fmt" "io" "strings" ) //闭包 func add() func(int) int { sum := 0 return func(v int) int { sum = sum + v return sum } } type intGen func() int //斐波那契 func fabonacci() intGen { a, b := 0, 1 return func() int { a, b = b, b+a return a } } func (ig intGen) Read(p []byte) (...
d083d253f170a583c7d1008bb28c1ac37e51e89e
13bad24026df4d78ba9d3f41d45971fb733ea0cf
abstractmj/bk-bcs
/bcs-services/bcs-api/pkg/server/proxier/upstream.go
Go
go
3,313
permissive
/* * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obta...
0a8ab6bd99334e908f9817e5c4fa9c0aa15fc9a4
9e6614ee16dbfbdf8191dba71cb7685ae7e77292
v3io/sidecar-proxy
/pkg/sidecarproxy/metricshandler/abstract/metricshandler.go
Go
go
1,401
permissive
// Copyright 2019 Iguazio // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
0079749a60b175d988993f887f8cc11e44bcab9a
d97b1e32041cb3fddd5d2ee03dfbdb4cbe1f74fc
4nth0/golem
/services/http/http.go
Go
go
5,159
permissive
package http import ( "context" "math/rand" "net/http" "strconv" "time" "github.com/4nth0/golem/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" log "github.com/sirupsen/logrus" ) // HTTPHandler type HTTPHandler struct { Method string ...
1bdfebaa26081b23902dcaecf01c749efba86418
a7afcf343912e891d15bb2c4804af662773ca4f8
katzchang/nri-redis
/src/metrics_test.go
Go
go
13,949
permissive
package main import ( "fmt" "testing" "github.com/newrelic/infra-integrations-sdk/data/metric" "github.com/newrelic/infra-integrations-sdk/persist" "github.com/stretchr/testify/assert" "io/ioutil" "os" "reflect" sdkArgs "github.com/newrelic/infra-integrations-sdk/args" ) var expectedRawInfoFromSample = m...
141cd830cdd86520ed17113ef614c04f449318af
3f0c2ff5a96d0ac2e348aef2e3b352a3b37b4c3d
SamanShafigh/lambda-go-boilerplate
/app/models.go
Go
go
809
no_license
package app import ( "database/sql" ) // UserModel provides the app structure type UserModel struct { db *sql.DB } // UserQuery defies the User query structure type UserQuery struct { Username string } // User defies the User structure type User struct { Id string `json:"id"` Username string `json:"usern...
9f7790f184815a8b4bd10642ee144f6ddc74fbed
60575af423c12ddb63b1035be94ee6fdf57446e8
iotaledger/goshimmer
/packages/app/blockissuer/blockissuer.go
Go
go
8,640
permissive
package blockissuer import ( "time" "github.com/pkg/errors" "github.com/iotaledger/goshimmer/packages/app/blockissuer/blockfactory" "github.com/iotaledger/goshimmer/packages/app/blockissuer/ratesetter" "github.com/iotaledger/goshimmer/packages/core/commitment" "github.com/iotaledger/goshimmer/packages/protocol...
cae6bf28e83df02d2ecdcb941c270120f8495017
b89cf247db16d3932ef0ad6311ffcc80e7c75394
JinHyukParkk/forYourStock-api
/router/v1.1/v1.1.go
Go
go
230
no_license
package routerv1 import ( v1controller "forYourStock-api/controller/service/v1.1" "github.com/gin-gonic/gin" ) func SetRouter(router *gin.RouterGroup) { v1 := router.Group("/v1") { v1.GET("/ping", v1controller.Ping) } }
356c52611620957d6f4b0842c99a0624f131666f
ba43d3753b7da2145dc3a17814921b20afb9bfc5
asecurityteam/nexpose-vuln-filter
/pkg/filter/stat_mock_test.go
Go
go
636
permissive
package filter import ( "context" "time" "github.com/asecurityteam/nexpose-vuln-filter/pkg/domain" ) type nopStat struct{} func (*nopStat) Gauge(stat string, value float64, tags ...string) {} func (*nopStat) Count(stat string, count float64, tags ...string) {} func (*nopStat) Histogram(stat string,...
ec98318a9555d9faa778abdcb2f2d794e148d548
026d99e720d72d9ca3bf3069534dd9849ea0c869
Zenithar/go-keystore
/key/helpers.go
Go
go
559
no_license
package key import ( "bytes" "encoding/base32" "strings" "golang.org/x/crypto/sha3" ) // copied from docker/libtrust func keyIDEncode(b []byte) string { s := strings.TrimRight(base32.StdEncoding.EncodeToString(b), "=") var buf bytes.Buffer var i int for i = 0; i < len(s)/4-1; i++ { start := i * 4 end := ...
90cb3b0f389ed3c65b420e65d1f14bcd0d36f37d
37fe5bd1ecc4eb4183148ef14e91bf4d6ec4cda1
matheusmf/dictionary
/api/models/related_term.go
Go
go
391
no_license
package models import ( uuid "github.com/satori/go.uuid" ) // RelatedTerm - table name: related_terms type RelatedTerm struct { ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"` Term Term `json:"-"` TermID uuid.UUID `gorm:"type:uuid;not null" json:"term_id"` Related Term `json:"-"...
1450f2a568de1f5a10768c5fe36dc03620d5420d
436cbf47b0bf8d8fa87b7d6586cb8773e0df40f9
kyma-incubator/github-slack-connectors
/github-connector/internal/httperrors/httperrors.go
Go
go
1,943
permissive
package httperrors import ( "encoding/json" "net/http" "github.com/kyma-incubator/github-slack-connectors/github-connector/internal/apperrors" log "github.com/sirupsen/logrus" ) type ErrorResponse struct { Code int `json:"code"` Error string `json:"error"` } func AppErrorToResponse(appError apperrors.AppE...
8b46fdf53f39563f475b098ec1f89affbe5c8a76
9dea995c34f2870967b0c5eb875b62133e1bb962
santhoshkambhampati/example-terraform-project
/modules/tests/ecs_task_definition_test.go
Go
go
2,485
no_license
package test import ( "fmt" "testing" "github.com/gruntwork-io/terratest/modules/aws" "github.com/gruntwork-io/terratest/modules/random" "github.com/gruntwork-io/terratest/modules/terraform" test_structure "github.com/gruntwork-io/terratest/modules/test-structure" "github.com/stretchr/testify/assert" ) const...
09647c9b8e864ffca7e75013dca6d0fd86dc13d1
cc1435cbc795f36fb55325d266fc03670ccdf8c7
TheEshka/UbuntuKiller
/report/internal/handler/author/handler.go
Go
go
3,250
no_license
package author import ( sq "github.com/Masterminds/squirrel" "github.com/go-chi/chi/v5" "github.com/jackc/pgx/v4" "github.com/jmoiron/sqlx" "github.com/pkg/errors" "net/http" "report/internal/common" ) type Book struct { BookUID string `json:"bookUid,omitempty" db:"book_uid"` Name string `json:"name" db:"...
9930411c554cda6485ae98bdbca36dea86d837cd
f020a835e4f30d8f377e61e55692e88b1a7b87dc
nickvanw/docker-proxy
/mapping_test.go
Go
go
3,511
permissive
package dockerproxy import ( "reflect" "testing" "github.com/fsouza/go-dockerclient" ) func TestHosts(t *testing.T) { tt := []struct { m map[string]string want []string ok bool }{ { m: map[string]string{"VIRTUAL_HOST": "www.google.com"}, want: []string{"www.google.com"}, ok: true, }...
1eb3a6e842ed733f7057b3b3ba064fa3cd15e653
3bca764cedc8c12bc4df89a45e639c934914acee
shiccorama/hello-world
/Maps.go
Go
go
275
no_license
package main import "fmt" func main(){ var x=make(map[string]string) x["hamza"]="adel" x["zakaria"]="nasef" x["mohsen"]="elfayoumy" fmt.Println(x) fmt.Println(x["zakaria"]) Names:=[4]string{"here","there","after","before"} fmt.Println(Names[1:2]) }
d24d3e37f606846372397f800827f79d817644cf
0d181652b0f8979e6abacb020c0c28c0df5591cd
cep21/cfmanage
/internal/templatereader/templatefinder.go
Go
go
2,180
permissive
package templatereader import ( "fmt" "io/ioutil" "path" "strings" "github.com/cep21/cfmanage/internal/logger" ) type TemplateFinder struct { BaseDir string Logger *logger.Logger } func (t *TemplateFinder) ValidateTemplate(tmpl string) ([]string, error) { validTemplates, err := t.ListTemplates() if err !=...
df933cfca1be5046e91c187eb4ef1dacb64ed249
d9b4f7f30111543afbe66933f844b89082f172e2
wanglibin1314/sx
/command/log/unique_logger_test.go
Go
go
2,613
permissive
package log import ( "bytes" "context" "net" "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/v-byte-cpu/sx/pkg/scan" ) func TestUniqueLoggerResults(t *testing.T) { t.Parallel() tests := []struct { name string expected []byte resu...
71e06ecfcbc670ecfd05cd955bb149ea3ad0226c
ac5ca324ca0d7313754a7508ede369b335c975a0
Persistencesujith/persistenceSDKpublic
/client/lcd/lcd_test.go
Go
go
42,331
no_license
package lcd import ( "encoding/hex" "encoding/json" "fmt" "net/http" "regexp" "testing" "time" "github.com/commitHub/commitBlockchain/client/tx" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" cryptoKeys "github.com/commitHub/commitBlockchain/crypto/ke...
a665a0c73a437b2605d405245b56a495f36e6961
1fb07c026253b07b3f5b4c4d3fdf184daedeab5f
weshayutin/hypershift
/control-plane-operator/controllers/hostedcontrolplane/oapi/deployment.go
Go
go
8,948
permissive
package oapi import ( "fmt" "github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/konnectivity" "net/url" "path" "strings" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/util...
e56436c594f9661070152dce397114bffe02c1b3
4fa35b9173785c5c938805c2b7a7cc4ed32ce109
mysola/majiang
/majiang/game/controller.go
Go
go
1,916
no_license
package game import ( "github.com/gohouse/converter/majiang/cmd" "github.com/gohouse/converter/majiang/state_machine" ) type Controller struct { stateMachine state_machine.StateMachine id2player map[int64]string cmdInvoker cmd.Invoker } func NewGame(magnification int64, players []string) Controller { id2p...
8fccefd10c5f125530087d42c0df4a1a3dd8d22c
2a400fdf726f23bc1b385063d8e362766fc6d5e9
ttysteale/kubernetes-api
/watch/versioned/decoder_test.go
Go
go
2,820
no_license
/* 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, ...
7bb9b3ce1c03977800b2f582060b82d003ceb1b4
79546738119abe3be39f8fb06b614a7f05001a97
ddipankargogoi/cloud-build-samples
/go-rest-main/src/runtime/pprof/pprof_rusage.go
Go
go
627
permissive
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin linux package pprof import ( "fmt" "io" "runtime" "syscall" ) // Adds MaxRSS to platforms that are supported. func addMaxRSS(w io.Writer...
0ba454bc873b3613628b64cc655037801e341ed3
d3414bd258441aefd0cdaf367988eb6f82d4521d
shwuandwing/vaku
/vaku/path_search.go
Go
go
1,505
permissive
package vaku import ( "encoding/json" "fmt" "strings" ) // PathSearch takes in a PathInput and a search string, reads the path, and searches // the read data for a match on the search string. Returns true if the string is found // in the data. Note that this is a simple search that just checks if the secret // con...
5db646af98606bb12bf9da45fa2e77029d496015
c4ac84bec3d872acf47d1b568a5efaa69f11d76b
Scalingo/godns
/vendor/github.com/miekg/dns/version.go
Go
go
275
permissive
package dns import "fmt" // Version is current version of this library. var Version = v{1, 1, 52} // v holds the version of this library. type v struct { Major, Minor, Patch int } func (v v) String() string { return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) }
4bc47d3fb1cd0f942039980b56b77618e51984e7
b5089dc393cbca413e8501dc65da1eafb5f092fb
kcwiakalski/keycloak-manager
/tools/tools.go
Go
go
914
permissive
package tools import ( "encoding/json" "io/ioutil" "os" ) func LoadConfigFile(fileName string, target interface{}) { jsonFile, err := os.Open(fileName) if err != nil { panic("Something wrong with config file. " + err.Error()) } defer jsonFile.Close() fileContent, _ := ioutil.ReadAll(jsonFile) json.Unmarsha...
6454cecfda6bc8526f0d381cb8bef7b31e4eecd9
98faec8a9ba748186b7fc87878366a45a30b4a9e
huaweicloud/huaweicloud-sdk-go-v3
/services/eip/v2/model/model_update_bandwidth_option.go
Go
go
3,157
permissive
package model import ( "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils" "errors" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter" "strings" ) // UpdateBandwidthOption 更新带宽对象(三个参数不能全为空) type UpdateBandwidthOption struct { // 取值范围:1-64,支持数字、字母、中文、_(下划线)、-(中划线),为空表示不修改名称 功能说明:带宽名称 约束:name...
c73e5d2c98ffe3baf2363e2a1e328bbffeda8e0f
e7a3ceed5b3250c6f01bb40d13f45be2c27ef6e8
Clivern/Rabbit
/pkg/validator.go
Go
go
2,403
permissive
// Copyright 2019 Clivern. All rights reserved. // Use of this source code is governed by the MIT // license that can be found in the LICENSE file. package pkg import ( "encoding/json" "regexp" "strings" ) const ( // UUID3 regex expr UUID3 string = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}...
23184f9ca041d6258e9b9801050526a6645bfae8
0b02da00b145086c932ba9af24d62b39570ffec9
letientai299/leetcode
/go/247.strobogrammatic-number-ii_test.go
Go
go
611
no_license
package main import ( "testing" "github.com/stretchr/testify/assert" ) func Test_findStrobogrammatic(t *testing.T) { tests := []struct { n int want []string }{ {n: 3, want: []string{"111", "101", "181", "808", "818", "888", "609", "906", "619", "916", "689", "986"}}, {n: 2, want: []string{"11", "88", ...
a3a05ab8b960e86258656ba024d73746bf182113
6c8499639ec850df48ec433d4995870877d8bd31
3014zhangshuo/learn-get-programming-with-go
/28/proverbs.go
Go
go
459
no_license
package main import ( "fmt" "os" ) func proverbs(name string) error { f, err := os.Create(name) if err != nil { return err } _, err = fmt.Fprintln(f, "Errors are values.") if err != nil { f.Close() return err } _, err = fmt.Fprintln(f, "Don't just check errors, handle them gracefully."...
5325ceeda8fabc40c3490c28b8a6da9b6ba5dc31
b166e33069a0d449b0d901c0191a6043159072bb
umohnani8/cri-o
/cmd/kpod/wait.go
Go
go
1,327
permissive
package main import ( "fmt" "os" "github.com/kubernetes-incubator/cri-o/libkpod" "github.com/pkg/errors" "github.com/urfave/cli" ) var ( waitDescription = ` kpod wait Block until one or more containers stop and then print their exit codes ` waitCommand = cli.Command{ Name: "wait", Usage: ...
3140b1f3181f56e6565c406d89cc016d19838b19
8fe8b7eb7a75191853e24297dc4590df6b3e2bb2
sailor4242/go-kafka-example
/cmd/worker/main.go
Go
go
2,066
no_license
package main import ( "context" "fmt" "os" "os/signal" "strings" "syscall" "time" "github.com/namsral/flag" "github.com/rs/zerolog/log" "github.com/segmentio/kafka-go" "github.com/segmentio/kafka-go/snappy" ) var ( // kafka kafkaBrokerUrl string kafkaVerbose bool kafkaTopic string k...
f4e087741662fef09db2c7e5b7f26a0e41929cf0
9df5e440f6923afce9ebac09bbc7ead8146ab6c8
gdg-belfast/HowToGoLab
/redirector/interfaces/webservice_test.go
Go
go
2,302
no_license
package interfaces import ( . "github.com/smartystreets/goconvey/convey" "testing" "errors" "net/http" "net/http/httptest" ) func TestWebService(t *testing.T) { Convey(`Given I have a WebService`, t, func() { stubMapper := &stubHostMapper{} ws := &WebService{ MappingInteractor: stubMapper, } Con...
a895b709acd169ae33924e7329b93a11f9940713
cec723ea80b808389936470b9f481f8ee2865248
iBruCe07/tabtoy
/v3/example/protobuf/main.go
Go
go
347
permissive
package main import ( "fmt" "github.com/golang/protobuf/proto" "io/ioutil" "os" ) func main() { data, err := ioutil.ReadFile("./pb.bin") if err != nil { fmt.Println(err) os.Exit(1) } var tab Table err = proto.Unmarshal(data, &tab) if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(proto....
b15ee360d5af5332b7f3aa8928f72c15449878c2
da787d8ee3f91246a6c43db59daeec147c19b20b
ctlabvn/HL-Loyalty
/chaincode/loyalty/vendor/github.com/hyperledger/fabric/orderer/sample_clients/deliver_stdout/client.go
Go
go
4,333
permissive
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package main import ( "flag" "fmt" "math" "os" "github.com/hyperledger/fabric/common/crypto" "github.com/hyperledger/fabric/common/localmsp" genesisconfig "github.com/hyperledger/fabric/common/tools/configtxgen/localconfig" "...
4fca979ede5f2ab64cda17389740d908ee6cd86f
46c37ae09171830b0061fcda5403b2f6ca6c4611
kubernetes-sigs/cluster-api-provider-vsphere
/internal/webhooks/vspheremachine_test.go
Go
go
9,270
permissive
/* Copyright 2021 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, ...
d95fdab2657f61c11cba56cde5c006bfe4b3d605
253cd5c07e19a2e7dfe862eff960ce4db0788588
yeonggyulim/console
/pkg/auth/auth.go
Go
go
14,108
permissive
package auth import ( "context" "crypto/rand" "crypto/subtle" "crypto/tls" "crypto/x509" "encoding/hex" "fmt" "io" "io/ioutil" "net/http" "net/url" "strings" "sync" "time" "github.com/coreos/dex/api" oidc "github.com/coreos/go-oidc" "github.com/coreos/pkg/capnslog" "golang.org/x/oauth2" "google.go...
66d65e098b616a6479d4e06d6b13310297850af8
0c3de1f6fd158eee649e1dd7c45f04868cfb50f5
erikcai/oci-go-sdk
/dataintegration/work_request_resource.go
Go
go
3,371
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...
c443a42bdae8148436dda2579e7e16b803b49fac
3e90e61f7b89e3416c0e9aba2abd8aa4d9621bcb
jindongxia/cari
/discovery/common.go
Go
go
1,769
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 ...
f429c0acb6f8f6fcf6affc71935cb7e5a6c67148
b599f64f828680698035d8cbaff9d94a293ba578
Synthesix/Sia
/modules/host/consts.go
Go
go
11,365
permissive
package host import ( "github.com/Synthesix/Sia/build" "github.com/Synthesix/Sia/modules" "github.com/Synthesix/Sia/types" "time" ) const ( // defaultMaxDuration defines the maximum number of blocks into the future // that the host will accept for the duration of an incoming file contract // obligation. 6 mon...
85442e0810a314bc65da916deeb0fbbf8e985594
29f9ff403249889b89342967b3ff542fb3483c61
akangAnton212/LoundryRest_Golang
/api/api.go
Go
go
220
permissive
package api import ( "github.com/gin-gonic/gin" "gin-rest-api-sample/api/v1.0" ) // ApplyRoutes applies router to gin Router func ApplyRoutes(r *gin.Engine) { api := r.Group("/api") { apiv1.ApplyRoutes(api) } }
22cd3b180484f21db8bb10905bebca156faf51fd
1105696c2bd5589a90ad57f3eafa71644910c696
chrisliu157/sleepwriter-jobs
/main.go
Go
go
955
no_license
package main import ( "os" "strconv" "github.com/chrisliu156/sleepwriter/store" "github.com/chrisliu156/sleepwriter/utils" "github.com/sirupsen/logrus" ) var ( logLevel = utils.GetEnv("log_level", "DEBUG") jobQueueName = utils.GetEnv("job_queue_name", "job_queue") numOfWorkers = utils.GetEnv("num_of_work...
ea502a27cce7feb90b455ba00bd7bc8ab6a1ce4a
a003d22782e36d4ba5246852b4e06c37ef82ed79
ghoneycutt/sensu-go
/backend/cmd/start.go
Go
go
8,553
permissive
package main import ( "fmt" "io/ioutil" "log" "os" "os/signal" "path/filepath" "syscall" "net/http" _ "net/http/pprof" "github.com/sensu/sensu-go/backend" "github.com/sensu/sensu-go/types" "github.com/sensu/sensu-go/util/path" "github.com/sensu/sensu-go/version" "github.com/spf13/cobra" "github.com/sp...
2daf82357c6fbe6632ec5509c28f4237c9e5c59c
c22b525477a023bab415952d85b33fb2cc702622
you06/tidb
/util/chunk/disk_test.go
Go
go
11,785
permissive
// Copyright 2019 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
dfe86a6bd14448edf0de04825a7999065ee43035
90252c5effd9cfd133071a2869eea7e3d4176079
voicecom/ocpp-go
/ocpp2.0_test/get_charging_profiles_test.go
Go
go
8,733
permissive
package ocpp2_test import ( "fmt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/voicecom/ocpp-go/ocpp2.0/smartcharging" "github.com/voicecom/ocpp-go/ocpp2.0/types" ) // Test func (suite *OcppV2TestSuite) TestGetChargingProfilesRequestVa...
013a72eac5788df04bbdef928b225025d33be523
b4593305a2f143c485a5a1185e64624aa7759654
adamenger/rv
/src/rv/actions_test.go
Go
go
1,475
no_license
package main import ( "bufio" "bytes" "flag" "os" "strings" "testing" "github.com/codegangsta/cli" ) func NewContext(args string) *cli.Context { set := flag.NewFlagSet("test", 0) set.Parse([]string{args}) return cli.NewContext(nil, set, nil) } func StubOutput() (*bufio.Writer, *bytes.Buffer) { output :=...
ef4a86a8d7ecf5b6163b341a57451f16d516703e
899c4f584886e0098786388909a1b137c82388f6
raismaulana/rid-apply
/logic-test/jawaban/1-palindrome.go
Go
go
482
no_license
package logic_test import ( "fmt" "strings" ) // Palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward func Palindrome(word string) bool { lowerWord := strings.ToLower(word) var backword string for _, v := range lowerWord { backword = string(v) + backwor...
4d38901122a848d9db7f6980882c01302ce05d17
e77869a678ef7501442140dab91e3a45cf2387c9
gityflow/githorse
/models/login_source.go
Go
go
13,965
permissive
// Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package models import ( "crypto/tls" "encoding/json" "fmt" "net/smtp" "net/textproto" "strings" "time" "github.com/Unknwon/com" "github.com/go-maca...
c770dc0eaccda8e3d9258ce980baeec1fb0dc150
0b6ce77081116ef527714e53e8bf9f6ca80649f7
Jimexist/kubeflow-controller
/pkg/controller/controller.go
Go
go
23,101
permissive
/* Copyright 2018 Caicloud 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, software d...
5e295729393517c96a2c6726c6f349f24fd7ae0d
1ea0ab16e5c079590f85a69eedc3b977b0a48a00
cultureamp/glamplify
/context/context_test.go
Go
go
1,619
no_license
package context_test import ( "context" "testing" gcontext "github.com/cultureamp/glamplify/context" "github.com/stretchr/testify/assert" ) func Test_Context_AddGet(t *testing.T) { ctx := context.Background() ctx = gcontext.AddRequestFields(ctx, gcontext.RequestScopedFields{ TraceID: "trace1", ...
e91ba621bb1b9a604e709f2b4374bb2aa97707ea
e8102531395eefb3269789310709204b9e5a0a6f
Miniand/brdg.me
/game/chess/pawn_test.go
Go
go
2,932
no_license
package chess import ( "testing" ) func TestPawnIsPiecer(t *testing.T) { var p Piecer p = Pawn{} if p == nil { t.Fatal("r is nil") } } func TestPawnAdvanceOne(t *testing.T) { b := Board{} p := Pawn{} p.Team = TEAM_WHITE to := p.AvailableMoves(Location{FILE_B, RANK_4}, b) if !inLocations(Location{FILE_B, ...
6483200e4fe85c68b512d40541228875987b7f29
ff3563b06707edf05c7a742d5aad2cecf336c04d
Thulasi-Das/Go-Language
/GenerateAndFilterUsingChannel.go
Go
go
841
no_license
package main import "fmt" // Send the sequence 2, 3, 4, … to channel 'ch'. func generate(ch chan<- int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch'. } } // Copy the values from channel 'src' to channel 'dst', // removing those divisible by 'prime'. func filter(src <-chan int, dst chan<- int, prime...
370bf7cfba0425c87c173846c9212c4c3d552872
d1d84a620fe38f8b51b0d10b5fe6f0101aaa9574
ekmixon/unpi
/testing/mock_test.go
Go
go
7,975
permissive
package testing import ( . "github.com/shimmeringbee/unpi" "github.com/stretchr/testify/assert" "io" "testing" "time" ) func TestMockAdapter_ReceivingFrames(t *testing.T) { t.Run("written frames have been stored in the mock", func(t *testing.T) { m := NewMockAdapter() defer m.Stop() expectedFrame := Fram...
d19d297031b3ee776e387e046cb1da13105916bc
f427f6ed44ff522e570e61def006d68ccecc796a
lodthe/is-for-me-bot
/tg/state/state.go
Go
go
1,310
permissive
package state import ( "time" "github.com/jinzhu/gorm/dialects/postgres" "github.com/pkg/errors" "github.com/jinzhu/gorm" log "github.com/sirupsen/logrus" ) type State struct { State ID // Conversation state. StateBefore ID // State before handling the current update. TelegramID int Username s...
381f7429ba52c295bf0af2dc76abf07ebc9e7a60
b8a309861d345c5b6fc319b9c670aa94363aac74
pintjuk/LocationBasedAPI
/Player/Data/InMemoryPlayerRepository.go
Go
go
1,230
no_license
package Data import ( "BablarAPI/IdP/Data/Errors" "BablarAPI/Player/Domain" "github.com/google/uuid" ) type inMemoryPlayerRepository struct { data map[uuid.UUID]Domain.Player } func NewInMemoryPlayerRepository() *inMemoryPlayerRepository { return &inMemoryPlayerRepository{data: make(map[uuid.UUID]Domain.Player)...
f5712d1e4f346dad2d8107cd8bc114c388700b6c
2df03d8c293a85d1a1151532099571eebc3858f1
stanxii/imgd
/signals_test.go
Go
go
1,592
permissive
package main import ( "bytes" "os" "strings" "syscall" "testing" "github.com/op/go-logging" ) type StashingWriter struct { buf bytes.Buffer } func (w *StashingWriter) Write(p []byte) (n int, err error) { return w.buf.Write(p) } func (w *StashingWriter) Unstash() string { return w.buf.String() } func test...
56edc55e718f7795e4b2598c0f76762607a3f2a9
735e3fafcb2852c82ec657f9327ab1db46199543
ssmuch/pandora
/utils/utils.go
Go
go
1,145
no_license
package utils import ( "io/ioutil" "math/rand" "net/http" "os" "regexp" "strconv" "strings" "time" "github.com/sirupsen/logrus" ) func GetHTML(url string) string { resp, err := http.Get(url) if err != nil { logrus.Fatalf("Failed to load: %s", url) } defer resp.Body.Close() html, err := ioutil.ReadA...
2464ce163c001bb342ff92ae5d2fc11ccc8ccab1
46165b2714662a760f6eb056e4efcdde1701716d
herrberk/SyntaxGo
/src/Strings.go
Go
go
593
no_license
package main import ("fmt" //"math" "strings" "sort" //"os" //"log" //"io/ioutil" //"strconv" ) func main() { sample := "Hello World" fmt.Println(strings.Contains(sample,"orl")) fmt.Println(strings.Count(sample,"l")) fmt.Println(strings.Index(sample,"llo")) fmt.Println(strings.Replace(sample,"l","x",2)) ...
28e013e774dfb075cea1c5d901c034bf6958a867
77173b4bd84f312b7a5b9d2176805ab2b4f33d54
saika2k/venus
/cmd/miner_actor.go
Go
go
21,695
permissive
package cmd import ( "bytes" "fmt" "strings" "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" ...
a214bc35a931f5be6d7d95c80051aec73f25c83e
567a2b4c13a0e42710a401009b3a08d6482254df
bhysyq/istio
/galley/pkg/source/kube/builtin/source.go
Go
go
4,693
permissive
// Copyright 2019 Istio Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
67dab4bcabb70dc148bde081e13da3863341fdf6
97a457b872ad01dbf645271f060379951ac561ed
harmsm/client
/go/kbfs/libfuse/alias.go
Go
go
1,032
permissive
// Copyright 2016 Keybase Inc. All rights reserved. // Use of this source code is governed by a BSD // license that can be found in the LICENSE file. // // +build !windows package libfuse import ( "os" "bazil.org/fuse" "bazil.org/fuse/fs" "golang.org/x/net/context" ) // Alias represents an alias. A use case for...
f375173704b54d3ed376debdd614bf2cfbf14d1b
2e5eb8561a5e50606297f0c5d03ff30374295a7b
BrunoBog/AprendendoGo
/slices/main.go
Go
go
1,752
no_license
package main import ( "fmt" ) func main() { var ( nums []int ) fmt.Println(nums, len(nums), cap(nums)) //caps é para indicar a capacidade nums = make([]int, 5) //tipos primitivos são sempre inicializados fmt.Println(nums, len(nums), cap(nums)) paises := []string{"Brasil", "França"} fmt.Println(paises, len...
806eae4655ba365847cf0ec35a675d9912088986
05cb4ec4fcbd7a58e5f71626dec6dff7144dba63
hlandau/acmetool
/fdb/fdb.go
Go
go
18,003
permissive
// Package fdb allows for the use of a filesystem directory as a simple // database on UNIX-like systems. package fdb import ( "fmt" deos "github.com/hlandau/goutils/os" "github.com/hlandau/xlog" "gopkg.in/hlandau/svcutils.v1/passwd" "io/ioutil" "os" "path/filepath" "strings" ) var log, Log = xlog.New("fdb") ...
684d69cf800c685697a416d29d7461cb1394a7a6
04647b39679dc636a3abb66e95fd00b479ea5f1f
wata-gh/kinu
/resource.go
Go
go
4,011
permissive
package main import ( "fmt" "github.com/Sirupsen/logrus" "github.com/TakatoshiMaeda/kinu/logger" "github.com/TakatoshiMaeda/kinu/storage" "io" "io/ioutil" "net/http" "regexp" "strconv" "sync" ) var ( validExtensions = []string{"jpg", "jpeg"} middleImageSizes = []string{"original", "1000", "2000", "...
bd1c46c5eac5f6c7282f943ecd60c2ab8a5c5edd
343315fb6da384e446e860002317c69e9b71779b
iesreza/io
/apps/settings/controller.go
Go
go
4,258
permissive
package settings import ( "encoding/json" "github.com/gofiber/fiber" "github.com/iesreza/io" "github.com/iesreza/io/errors" "github.com/iesreza/io/html" "github.com/iesreza/io/i18" "github.com/iesreza/io/lib" "github.com/iesreza/io/lib/constant" "github.com/iesreza/io/lib/ref" "github.com/iesreza/io/lib/text...
9a95f751ca00b921e9d0194b5f4bda72e7452436
621286c4393201cc4ccb3f4799eaada19cc052e0
Slim1222b/google-cloud-go
/spanner/spansql/sql.go
Go
go
11,897
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...
8b112cc23ffcdd0a77e74d38629631230e55d7a2
87c463afaeb270a09fe3fbff1617fd111694e37d
hakib1/sys
/conf/name.go
Go
go
2,678
permissive
/* SPDX-License-Identifier: MIT * * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. */ package conf import ( "regexp" "strconv" "strings" ) var reservedNames = []string{ "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4",...
03ed8c517d76978118f50058d06d23c5a338a2bd
8d281da0c6a7f152da2c68468c9264532c3c4386
zeromake/leetcode
/pkg/strings/reverseWords_test.go
Go
go
332
no_license
package strings import ( "github.com/stretchr/testify/assert" "testing" ) func TestReverseWords(t *testing.T) { words := []string{ "the sky is blue", " hello word! ", } result := []string{ "blue is sky the", "word! hello", } for i, r := range words { rr := ReverseWords(r) assert.Equal(t, rr, resu...
a2e2588968aead94c3324e296c72faaa7d19941d
91c2eec882b42c60b722ae6c6ad91b8886dd1562
Kehaque634/terraform-google-conversion
/google/tags_tag_key.go
Go
go
2,632
permissive
// ---------------------------------------------------------------------------- // // *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** // // ---------------------------------------------------------------------------- // // This file is automatically generated by Magic Modules and manual // ...
038d1f079e50540eb8338986188bbf07b1eeca1f
3e19a2fe632542041fed596ecde81285424cd0a7
zhengsenyc/demo2
/src/zhengsen/demo3.go
Go
go
372
no_license
package zhengsen import "fmt" type Person interface { getName() string Connector } type Connector interface { getPhone() } type Teacher struct { name string age int } func (t Teacher) getName() string{ return t.name } func (t Teacher) getPhone(){ fmt.Println("年龄:",t.age) } func main(){ t := Teacher{ ag...
e4de21025681fa5ee73a320fc5ad795435d062dd
2a00e78768b20e4d2fe47ed4b07ca796347026a2
richardcase/cluster-api-provider-azure
/azure/services/bastionhosts/mocks_bastionhosts/doc.go
Go
go
991
permissive
/* Copyright 2020 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, ...
72d6fecdbf17452697de850df93439b8c90215c0
c5d7d176349d581870efa8d4c3459fd5f89d9b76
deejcoder/spidernet-api
/handlers/servers_get.go
Go
go
594
no_license
/* GetServers returns 20 servers starting at START */ package handlers import ( "net/http" "strconv" "github.com/deejcoder/spidernet-api/storage" "github.com/deejcoder/spidernet-api/helpers" ) func GetServers(w http.ResponseWriter, r *http.Request) { ac := helpers.GetAppContext(r) svrmgr := storage.NewServer...
402c55dc476175f49d4a152cc41c3410f78378df
9e0ea50a733486ef3ff011d935bc65a2fd5ade92
dolzenko/reason
/eval/classification_test.go
Go
go
1,232
permissive
package eval import ( "github.com/bsm/reason/core" "github.com/bsm/reason/testdata" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Classification", func() { var subject *Classification model := testdata.ClassificationModel() BeforeEach(func() { yes := core.Prediction{{Value: 0, Vo...
67409a484e428e3201f73eeb3ca67d8a0e139500
430d6384bcbec5e3662c605c1e7ea287fdadf598
lightstep/opentelemetry-collector-contrib
/receiver/mongodbreceiver/integration_test.go
Go
go
6,436
permissive
// Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agr...
e134ab5e6783f32fe30da193606888271746a311
61665d7a508a8d2b46778639442daa6454e680a2
obase/cmd
/command.go
Go
go
2,121
no_license
package cmd import ( "bytes" "flag" "fmt" "os" "strconv" "strings" ) type Cmd struct { Name string // 命令名字 Init func() int // 初始方法 Exec func() int // 执行方法 Desc string // 描述信息 } type Command struct { Name string cmds []*Cmd } func New(name string) *Command { return &Command{ Name: name, } } ...
39c63c82f5d9f116dba6b196aeb1224eac49329f
f78fbbf77e795538e0c88b9cb04a41ea0ffcd520
allenlkq/go-ipfs
/unixfs/io/dagreader.go
Go
go
7,069
permissive
package io import ( "bytes" "errors" "fmt" "io" "os" "context" proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto" mdag "github.com/ipfs/go-ipfs/merkledag" ft "github.com/ipfs/go-ipfs/unixfs" ftpb "github.com/ipfs/go-ipfs/unixfs/pb" ) var ErrIsDir = errors.New("this dag node...
b26df9a26c76a9e43a2202b0da319cdab5c8c76a
46943cb7cc39983ab537c19dee5d6ed7478b8ca0
liyork/gopiano
/com/wolf/piano/bfbczd/pipeline_test.go
Go
go
1,324
no_license
package bfbczd import ( "fmt" "testing" ) func TestPipeline(t *testing.T) { // 将一组离散值转换为一个通道上的数据流,生成器 generator := func(done <-chan interface{}, integers ...int) <-chan int { intStream := make(chan int) go func() { defer close(intStream) for _, i := range integers { select { case <-done: re...
baae4ad2dc1b81a2a5a6637ca685eb7f0bf29225
93b14145bd08fb220dde4dbd0849ae47f2e72b9c
isgasho/entity-component-system
/internal/system/systems/sprite_renderer.go
Go
go
915
no_license
package systems import ( "github.com/davidsbond/game/internal/component/components" "github.com/davidsbond/game/internal/scene" "github.com/davidsbond/game/pkg/input" "github.com/hajimehoshi/ebiten" "github.com/hashicorp/go-multierror" ) // The SpriteRenderer system finds components of type components.TypeSprite...
75e2b380bcd1ac4cb77718ccf448ea367ffe8310
cdbe093f532f7585981f8239135a555117783aad
Utagai/jasper
/rest_service.go
Go
go
16,724
no_license
package jasper import ( "context" "fmt" "net/http" "os" "strconv" "sync" "syscall" "time" "github.com/evergreen-ci/gimlet" "github.com/mongodb/grip" "github.com/mongodb/grip/message" "github.com/mongodb/grip/send" "github.com/pkg/errors" "github.com/tychoish/lru" ) // Service defines a REST service tha...
f67c481d25ba0e8f5bbd86be45336a938b5f8ca0
4f484a1490fb43d67a3afeefbd827a9d85f2ce5a
frankhang/doppler
/util/docker/event_stream.go
Go
go
3,886
no_license
// Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-2020 Datadog, Inc. // +build docker package docker import ( "context" "go.uber.org/zap" "i...