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 |
|---|---|---|---|---|---|---|---|---|
c60d6cdc07abf871dd967e92caec96f7d24dfbc7 | a734db93ecd05eb65c472e09d38481730a74307d | crufter/go-micro | /util/kubernetes/client/watch.go | Go | go | 2,232 | permissive | package client
import (
"bufio"
"context"
"encoding/json"
"errors"
"net/http"
"github.com/micro/go-micro/util/kubernetes/api"
)
const (
// EventTypes used
Added EventType = "ADDED"
Modified EventType = "MODIFIED"
Deleted EventType = "DELETED"
Error EventType = "ERROR"
)
// Watcher is used to watch... |
40b958f77f7d190fa09bdee9b99327b5901df454 | 0e183b2c90cd3607af572c973c40f256b625d5bd | isabella232/go-vitess | /vt/sqlparser/normalizer.go | Go | go | 6,450 | permissive | /*
Copyright 2017 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 writing, software
dis... |
9a68159899fc225d2dd2283438a57344aa7bb9ee | bc9ab136e2f1a3960cc2479a9b2372a66ec4554f | golint-fixer/bmutil | /wire/msggetdata.go | Go | go | 4,380 | permissive | // Originally derived from: btcsuite/btcd/wire/msggetdata.go
// Copyright (c) 2013-2015 Conformal Systems LLC.
// Copyright (c) 2015 Monetas
// Copyright 2016 Daniel Krawisz.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wire
import (
"fmt"
"io"
"githu... |
7fb6b5b65b0bbb7c3e174a21829d9a7fd57b6872 | 074ba739ec739da49acc5f8be5c49221fe2c94ad | KOFLazycat/lazy | /app/mysql/mysql.go | Go | go | 1,535 | permissive | package mysql
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
"lazy/app/conf"
_ "github.com/go-sql-driver/mysql"
"github.com/simplejia/utils"
)
type Conf struct {
ConnMaxLifetime string
MaxIdleConns int
MaxOpenConns int
Dsn string
}
v... |
7a46aa094a61912e8e96c488c6fc40cdccd061dc | a7d35197e1cb62864055a68adb8171f1837c4cbe | kevholditch/terraform-provider-form3 | /form3/config.go | Go | go | 590 | permissive | package form3
import (
"github.com/ewilde/go-form3"
"github.com/ewilde/go-form3/client"
"log"
)
// Config contains form3 provider settings
type Config struct {
ClientId string
ClientSecret string
ApiHost string
OrganisationId string
}
func (c *Config) Client() (*form3.AuthenticatedClient, error... |
92643d4e3bc6cbe81c1e6a91540d35dd2343a5a1 | b1588a16f6c05d674bdbeb5d5d4dd09a13ed112a | tetafro/feed-bot | /internal/storage/fs.go | Go | go | 1,735 | no_license | // Package storage is responsible for storing data.
package storage
import (
"fmt"
"os"
"sync"
"time"
"gopkg.in/yaml.v2"
)
// FileStorage is a storage that uses plain text file for storing data.
type FileStorage struct {
file string
state state
mx *sync.Mutex
}
// state is a representation of applicatio... |
7e6e121b44b5f032b750ed9bd9a29c669a8602d8 | f71b5a6baa850af9a16e64d4a853345835297b85 | mohamedkashifuddin/Web-application-with-golang | /pkg/mod/golang.org/x/tools@v0.0.0-20200226224502-204d844ad48d/internal/lsp/debug/trace.go | Go | go | 4,179 | 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.
package debug
import (
"bytes"
"context"
"fmt"
"html/template"
"net/http"
"sort"
"strings"
"time"
"golang.org/x/tools/internal/telemetry"
)
var trac... |
4ed726734d53067a1cfc1305e03518a01fe4cd4e | 2277525b3945b0675c2194f845bb75948c2e5855 | HashCash-Consultants/Go-CentOS | /services/bifrost/main.go | Go | go | 12,352 | permissive | // Skip this file in Go <1.8 because it's using http.Server.Shutdown
// +build go1.8
package main
import (
"fmt"
"net/http"
"os"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/rpcclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/facebookgo/inject"
"github.com/sirupsen/log... |
71b0dd9c20a97dd39aed108cc2514ab92c8f2edb | 581cfcb2db6b246988a027b1eafcda6c23c20f07 | maleck13/ansible-service-broker | /pkg/apb/client.go | Go | go | 5,646 | permissive | package apb
import (
"encoding/json"
"errors"
"fmt"
"os"
docker "github.com/fsouza/go-dockerclient"
logging "github.com/op/go-logging"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
restclient "k8s.io/client-go/rest"
"github.com/pborman/uuid"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedi... |
bca645fcd2ba606b41163b55b0e0f4a77bb9b4ab | ea81ebddd50a3cf999aa16d4baac64e8b78d8125 | lhrotk/leet_go | /leet_94/solution.go | Go | go | 407 | no_license | package leet_94
func init() {
}
// Definition for a binary tree node.
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func inorderTraversal(root *TreeNode) []int {
if root == nil {
return nil
} else {
return append(append(inorderTraversal(root.Left), root.Val), inorderTraversal(root.Righ... |
450d77b995cca0f8e7e441ba79a0db3ffc437548 | e6d69bbd3c0471c79dce885b08b5a6dc6dcc7954 | ShixiongQi/cilium | /plugins/cilium-cni/interface.go | Go | go | 1,805 | permissive | // Copyright 2019 Authors of Cilium
//
// 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 ... |
45bfecacd62309b46d9be28cbf134794e2e1b931 | 7f9b6f16560ebba4fcb901f0df7cfda8d4819c6c | bububa/opentaobao | /model/util/AlibabaAisAssetsTagGenerateAPIRequest.go | Go | go | 1,602 | permissive | package util
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// AlibabaAisAssetsTagGenerateAPIRequest 基础设施资产标签生成 API请求
// alibaba.ais.assets.tag.generate
//
// 提供浪潮,英业达等厂商供应阿里巴巴基础设施资产的标签QR code生成
type AlibabaAisAssetsTagGenerateAPIRequest struct {
model.Params
// 请求资产信息
_requestParam string
}
// NewA... |
953be9c04e50bde105d4bfe9011ce4c29eb35d65 | 7b0afbc63c73369f6468f2614a88361ad89b5c9d | dolanor/microservices | /services/data/data.go | Go | go | 970 | no_license | package main
import (
"github.com/dolanor/microservices/api"
"github.com/gin-gonic/gin"
"net/http"
"time"
)
func getUserTodoList(c *gin.Context) {
todos := map[string]*api.Todo{
"dolanor": {"Make the bed", "Eat", "Change the world", "Sleep"},
"tanguy": {"Code", "Prepare food", "Read"},
}
var username str... |
1a809e335612f8ae901e005285f441631f2f0d4d | d62fe9ab136b15a17efcb5e2ce1c7c26419efd2b | cloudfoundry-attic/cli-with-i18n | /actor/sharedaction/resource_unix_test.go | Go | go | 10,597 | permissive | // +build !windows
package sharedaction_test
import (
"io/ioutil"
"os"
"path/filepath"
. "code.cloudfoundry.org/cli/actor/sharedaction"
"code.cloudfoundry.org/cli/actor/sharedaction/sharedactionfakes"
"code.cloudfoundry.org/ykk"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Resou... |
eca6e713d51c7186fde82e4cf71a63c7b93fa3b8 | ff8d15f7de76e9a5f8d17882e67b6a28a3a4ab56 | bsarten/aoc2020 | /src/day_19/part_1/19-1.go | Go | go | 1,789 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"regexp"
"strings"
)
func readRule(rules map[string]string, input string) {
colonSplit := strings.Split(input, ": ")
ruleNumber := colonSplit[0]
ruleStr := colonSplit[1]
rules[ruleNumber] = ruleStr
}
func expandRuleNumbers(rules map[string]string, rule string) s... |
219826a00209ad50f2ed36f3054e1cb28f76ed13 | b6c48885ea1675c3b7a6676cb0b6a69db39593d9 | Shachindra/going-serverless | /04_build_tags/internal/toy/server.go | Go | go | 3,598 | permissive | package toy
import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/go-chi/chi"
"github.com/gofrs/uuid"
"github.com/sbogacz/going-serverless/04_build_tags/internal/httperrs"
"gocloud.dev/blob"
"gocloud.dev/gcerrors"
)
// Server represents all of the config and clients
// needed to r... |
0df7173d3b7b8df99495221696de3ef4d973f020 | 975d62291b7222d4b987f459f9450ea5fe07909c | saisai/tutorial | /golang/golangbot_com/methods2.go | Go | go | 517 | no_license | package main
import(
"fmt"
"math"
)
type Rectangle struct {
length int
width int
}
type Circle struct {
radius float64
}
func (r Rectangle) Area() int {
return r.length * r.width
}
func (c Circle) Area() float64 {
return math.Pi * c.radius * c.radius
}
func main() {
r := Rect... |
0620a15740669c80a632596d00bcdd3850b1df0f | 42370e787fab44d4ff7fd87dbc3ff8b5f3f203c7 | johanfleury/cert-manager | /test/unit/gen/certificate.go | Go | go | 7,007 | permissive | /*
Copyright 2020 The cert-manager Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
86c426033cea3b2b993241cde603d5a52e7eaacb | b576793e346df88d16f1e90c870940604a5a860d | arnecls/istio | /galley/pkg/kube/schema_test.go | Go | go | 1,075 | permissive | // Copyright 2018 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
74524bc63f175e0cdd2eda787316bc99aee14d99 | 1e311c8fe63090c6ccd7cfe2333208e4a962d76b | szfrank/gin | /customMiddleware/main.go | Go | go | 647 | no_license | package main
import (
"log"
"time"
"github.com/gin-gonic/gin"
)
// Logger func.
func Logger() gin.HandlerFunc {
return func(c *gin.Context) {
t := time.Now()
// 设置 example 变量
c.Set("example", "12345")
// 请求前
c.Next()
// 请求后
latency := time.Since(t)
log.Print(latency)
// 获取发送的 status
stat... |
afd3defbcbd420def3ca45ed5648d7a5c79894d1 | ba428726bb2f57a3f0d6b0dd00d10037330a9205 | subash68/API-New | /s6_Token/models/errors.go | Go | go | 2,069 | no_license | // Package models ...
package models
import (
"fmt"
"strings"
"gopkg.in/go-playground/validator.v8"
)
// DbModelError for creating custom errors resulting from Database calls
type DbModelError struct {
ErrCode string
ErrTyp string
Err error
SuccessResp map[string]string
}
// DetailedErrModel... |
6090fd04818c05334e290eb7e96ebd9c3ef1f5c7 | d05d9df6d6fce0644a2afcc418ac3c017d390cd5 | cosmos/cosmos-sdk | /store/types/utils_test.go | Go | go | 1,000 | permissive | package types_test
import (
"testing"
"gotest.tools/v3/assert"
"cosmossdk.io/store/types"
)
func TestPrefixEndBytes(t *testing.T) {
t.Parallel()
testCases := []struct {
prefix []byte
expected []byte
}{
{[]byte{byte(55), byte(255), byte(255), byte(0)}, []byte{byte(55), byte(255), byte(255), byte(1)}},
... |
64d20c28b30888332e8a5bbd6930ae9af4c39f31 | d743c4d7abaa56f9a4be1b6e2203c64882ec7f21 | fabianbaier/kryptominer-api | /main.go | Go | go | 726 | permissive | package main
import (
"fmt"
"runtime"
"time"
"github.com/fabianbaier/kryptominer-api/config"
"github.com/fabianbaier/kryptominer-api/core"
log "github.com/sirupsen/logrus"
)
func main() {
fmt.Println("Kryptominer API v0.0.1")
fmt.Println("Copyright 2017")
appConfig := config.Configuration()
if appConfig.V... |
661347512c084eebeef89576e4fff3d7fca6ceac | 0fbde422a32d56d7fb298da88a4498c7a2ad2d79 | wenhuang1003/qiniu-driver | /io.go | Go | go | 444 | no_license | package qiniudriver
import "io"
type countReader struct {
reader io.Reader
counts int
}
func (cr *countReader) Size() int {
return cr.counts
}
func (cr *countReader) Read(p []byte) (n int, err error) {
rs, err := cr.reader.Read(p)
cr.counts += rs
return rs, err
}
// CountReader returns a Reader that's is jus... |
2299c621ba0b17cdcacf690c56b3ea35fe696f18 | 3d4d26a3f4745babc59ebcddf966cc590285123f | karthikperu7/cluster-monitoring-operator | /pkg/tasks/thanos_ruler_user_workload.go | Go | go | 10,158 | permissive | // Copyright 2018 The Cluster Monitoring Operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by app... |
0bb44926bbadda543947ad9067f9812fd1d50552 | 9fe29f470b7c8538fb78dbada550be6376e1bee3 | hkantare/bluemix-go | /api/cf/cfv2/api_service.go | Go | go | 3,333 | permissive | package cfv2
import (
gohttp "net/http"
bluemix "github.com/IBM-Bluemix/bluemix-go"
"github.com/IBM-Bluemix/bluemix-go/authentication"
"github.com/IBM-Bluemix/bluemix-go/client"
"github.com/IBM-Bluemix/bluemix-go/http"
"github.com/IBM-Bluemix/bluemix-go/rest"
"github.com/IBM-Bluemix/bluemix-go/session"
)
//Er... |
a78fd1e8280ff4bc2e75d3d23160b514506c0899 | af076656205955edc51ed90cada329358fda8b6d | JulienGuo/fabric-sdk-go | /pkg/fabric-client/orderer/orderer.go | Go | go | 5,663 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package orderer
import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"github.com/hyperledger/fabric-sdk-go/api/apiconfig"
fab "github.com/hyperledger/fabric-sdk-go/a... |
e7be59954d7e59f7c1c498832d2f855aae279a88 | dda515eb43c07b59b395b70b2f5b038e46b8eab7 | vamsibottu/data_serialization-svc | /Internal/crudapi/fields/placecategory.go | Go | go | 1,681 | permissive | package fields
import "gopkg.in/mgo.v2/bson"
type PlaceCategory struct {
PlaceID bson.ObjectId `xorm:"PlaceId" bson:"placeid" json:"Idplace"`
Name string `xorm:"'name'" bson:"name" json:"name"`
Address string `xorm:"'formatted_address'" bson:"formattedaddress" json:"formatted_address,o... |
8005848d53a2f0f4cd8c78dfcf1ad93d14a86034 | d99576e2ef99abf9f649dd7e551da04ac56c4c5c | renne444/go-example | /crypto-sign-example/rsa.go | Go | go | 833 | no_license | package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"fmt"
)
func main() {
//创建私钥
priv, _ := rsa.GenerateKey(rand.Reader, 512)
priv2, _ := rsa.GenerateKey(rand.Reader, 512)
pub := priv.PublicKey
pub2:= priv2.PublicKey
plainText := []byte("fuckyou")
h := sha256.New()
h.Write(plain... |
e06e03d74d223d7b08405dbf3bbeb7aeb4933262 | 1b8e972ffbb425e6dba3edd57703e4bf352b3c21 | sljeff/protocol-buffers-language-server | /pkg/lsp/server/text_synchronization.go | Go | go | 2,381 | permissive | // Copyright 2019 The Protocol Buffers Language Server 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 ... |
f40a371861a164d552d147d0a3a154f33c67f38c | 4b10673fb412b1a53db9f089e6900ba2d93329d3 | hw3g2008/lotus | /chain/consensus/filcns/filecoin.go | Go | go | 25,826 | permissive | package filcns
import (
"bytes"
"context"
"errors"
"fmt"
"os"
"strings"
"time"
"github.com/hashicorp/go-multierror"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log/v2"
pubsub "github.com/libp2p/go-libp2p-pubsub"
cbg "github.com/whyrusleeping/cbor-gen"
"go.ope... |
bf913797a5caccbce10f46d6da4565f8f62acae9 | cc64ab4980c825f9176c36f8655cc666b5c4da4b | Falco20019/loki | /vendor/github.com/prometheus/prometheus/web/api/v1/api.go | Go | go | 49,660 | permissive | // Copyright 2016 The Prometheus 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... |
05c0157490dcbda6aaa34c4aa5ef2ec71ea88ff9 | 261e089c300cf6c4a5cc31432b2d2f603e0f5377 | LiRonaldo/go-micro-helloworld | /Wrappers/ProdsWrapper.go | Go | go | 1,329 | no_license | package Wrappers
import (
"context"
"github.com/afex/hystrix-go/hystrix"
"github.com/micro/go-micro/client"
"go-micro-helloworld/Services"
"strconv"
)
type ProdsWrapper struct {
client.Client
}
func (this *ProdsWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) e... |
a958fd06785460136aa1bd0b52d0ce188b7081af | 93824a8d36c0bf8cde713398da5134d320567288 | kiminozero/test | /gopl.io/ch1/dup2.go | Go | go | 589 | no_license | package main
import (
"bufio"
"fmt"
"os"
)
func main() {
counts := make(map[string]int)
files := os.Args[1:]
if len(files) == 0 {
countLines(os.Stdin, counts)
} else {
for _, arg := range files {
f, err := os.Open(arg)
if err != nil {
fmt.Fprintf(os.Stderr, "dup2: %v\n", err)
continue
}
... |
8bdb551ec28e2a3c1a13bc1e011b778c27fbb40a | 396179d4fd269097104e2c1ca227d95466aa7f30 | mccxj/GoldenHouse | /spider/redis_manager.go | Go | go | 1,041 | permissive | package spider
import (
"github.com/go-redis/redis"
"time"
)
type RedisManager struct {
Client *redis.Client
Prefix string
}
func (s *RedisManager) allUrlsKey() string {
return s.Prefix + "_all_urls"
}
func (s *RedisManager) todoUrlsKey() string {
return s.Prefix + "_todo_urls"
}
func (s *RedisManager) doing... |
c04427427b6121696120990c4d97dff8a004b54e | 2c6053c8195581961717b147ed42194958a51cbf | ftiannn/go_basic | /if_else/main.go | Go | go | 480 | no_license | package main
import "fmt"
func main() {
price, inStock := 100, true
if price > 80 {
fmt.Println("Too expensive!")
}
if price <= 100 && inStock {
fmt.Println("Buy It")
}
// if price {} --> Not valid in GO
// only one if branch will be executed
if price < 100 {
fmt.Println("It's cheap!")
} else if pri... |
88fd2a3021ca187a7e2794dbfb4b0de24fad2d1b | c43c2dc16448a2e0d4f7262c325f1fe53dc20cac | gotomgo/go2proto | /goconsts.go | Go | go | 352 | permissive | package main
const (
// GoTypeInt is the keyword for int
GoTypeInt = "int"
// GoTypeInt32 is the keyword for int32
GoTypeInt32 = "int32"
// GoTypeInt64 is the keyword for int64
GoTypeInt64 = "int64"
// GoTypeFloat32 is the keyword for float32
GoTypeFloat32 = "float32"
// GoTypeFloat64 is the keyword for float... |
57141b6fbbf62b0dce0d6416cf303b0cbdc76e9f | 9b66d14907f28e779fcf92b8d3a99c74ed52261d | mgrenonville/gotomation | /core/trigger.go | Go | go | 857 | permissive | package core
import (
"fmt"
"github.com/nmaupu/gotomation/logging"
"github.com/nmaupu/gotomation/model/config"
)
var (
_ Triggerable = (*Trigger)(nil)
)
// Trigger triggers an action when a change occurs
type Trigger struct {
Action Actionable
}
// Configure godoc
func (t *Trigger) Configure(data interface{},... |
1d0f6c86e0e5bb0a241f9d74b95472a38d019cad | f90e340220d8356fab10ad25899be5c35fb713b7 | pirsoscom/mcm_install_tec | /tools/cloudforms/ibm-infra-management-install-operator/pkg/helpers/iminstall-components/app-secret.go | Go | go | 608 | no_license | package iminstalltools
import (
iminstallv1alpha1 "github.ibm.com/IBMPrivateCloud/ibm-infra-management-install-operator/pkg/apis/infra/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func AppSecret(cr *iminstallv1alpha1.IMInstall) *corev1.Secret {
labels := map[string]string... |
b4f4b550f0f7477ad40307f4a842c32ccc6161f6 | d523629e999db9cb8ee10c623a4b3231afd5ddcd | yueyue200830/ShopMe | /backend-go/service/banner_service.go | Go | go | 2,009 | no_license | package service
import (
"backend-go/dao"
"backend-go/entity"
"backend-go/utils"
"strings"
)
var bannerService *BannerService
type BannerService struct {
bannerRepository *dao.BannerRepository
}
func init() {
bannerService = &BannerService{dao.GetBannerRepository()}
}
func GetBannerService() *BannerService {... |
a80cfa337b0aecf573fcdc6110a15ee3b7f4f9c0 | 2098ccdbe76a0e3b1b157605e23f85de5b44e0e3 | marun/origin | /vendor/k8s.io/kubernetes/pkg/api/rest/rest.go | Go | go | 14,604 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
371b25f7aa13eac7ce8b6ffe6ded90c6b2e64153 | 5a140e47e1c9afcf12ba88a43d0fb9ab867b331e | mdmarek/pg_listener | /src/pg_listener/cmd/producer.go | Go | go | 2,012 | no_license | package cmd
import (
"fmt"
"github.com/Shopify/sarama"
"strings"
"time"
)
const (
maxProducerRetry = 5
stagingSuffix = "-staging"
productionSuffix = "-production"
)
//ProducerProfile config type of producer's profile - staging/production
type ProducerProfile string
var (
//StagingProfile is profile conf... |
f11b6ae0d32163ea17bf73c4ca3adedefb63c3ce | 1e23ab2153cd8b835f7983b310ea456f0051c45a | langbing/tidb | /ddl/column.go | Go | go | 16,373 | permissive | // Copyright 2015 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... |
d05e2f039c05b301ba36c4b8b467e8f221b22162 | bec11c4205d4c8c703f91e84b890fae2712796a8 | lui1798/wstools | /vendor/github.com/lucas-clemente/quic-go/mint_utils_test.go | Go | go | 5,351 | permissive | package quic
import (
"bytes"
"crypto/tls"
"crypto/x509"
"errors"
"github.com/lucas-clemente/quic-go/internal/crypto"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/testdata"
"github.com/lucas-clemente/quic-go/internal/wire"
. "github.com/onsi/ginkgo"
. "gi... |
d2b301672a0d6a4848fb2326d15bdd34683c4492 | 78569da8630d3329c705132a705713432f8cc849 | perfree/go-fastdfs-web-go | /src/routers/setting.go | Go | go | 1,183 | no_license | package routers
import (
"crypto/md5"
"encoding/hex"
"fmt"
"github.com/gin-gonic/gin"
"go-fastdfs-web-go/src/commons"
"go-fastdfs-web-go/src/form"
"go-fastdfs-web-go/src/models"
"net/http"
)
type SettingRouter struct {
BaseRouter
commons.Response
}
// UserPage 个人资料页
func (s *SettingRouter)UserPage(ctx *gin... |
3d40d687601c8032430b14fc35eebc8f07b90172 | 41a463005fd097f8d9ea127e304d82fa52cfe5a6 | nilslice/recurly | /plans.go | Go | go | 4,459 | permissive | package recurly
import (
"context"
"encoding/xml"
"fmt"
"net/http"
)
// PlansService manages the interactions for plans.
type PlansService interface {
// List returns a pager to paginate plans. PagerOptions are used to optionally
// filter the results.
//
// https://dev.recurly.com/docs/list-plans
List(opts ... |
d48a8a39b003a0960520e324795b423ba75d1011 | 294e84a2427e398ab5e17a4a3d5157352ffdccd5 | chrisfelesoid/go-flif | /internal/wrapper/decoder.go | Go | go | 3,218 | permissive | // Copyright 2016 chrisfelesoid. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wrapper
/*
#include <stdlib.h>
#include <flif.h>
*/
import "C"
import "unsafe"
type CflifDecoder struct {
dec *C.FLIF_DECODER
}
type CflifInfo struct... |
19cd6d2dfcadccfd65a125e93c38e4218315034f | 831798a69698bad2816253778b5a6458d37b96b4 | tiptok/OFAppTest | /src/gitgin/alarmflag.go | Go | go | 2,425 | no_license | package main
import (
"fmt"
"log"
"net/http"
"github.com/gin-gonic/gin"
)
type AlarmFlag struct {
AlarmFlag int `gorm:"column:AlarmFlag"`
AlarmName string `gorm:"column:AlarmName"`
AlarmType int `gorm:"column:AlarmType"`
Remark string `gorm:"column:Remark"`
AlarmOrder int `gorm:"column:Alarm... |
d213e35794699c94d414b49da126aac15a82d0bd | 4b369ac393f45ae2e99b2ac92c6b8dabacff47cd | next-stack/kops | /pkg/model/gcemodel/storageacl.go | Go | go | 3,005 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
6be84954df1edc6153797fc9f3142b508509d708 | 469c28f127293ebfc7f712f7c5e5af188e08b63d | boris7482/chrome | /tests/extension/go/popup_tests.go | Go | go | 5,470 | no_license | package main
import (
"fmt"
"github.com/Archs/chrome/api/alarms"
"github.com/Archs/chrome/api/bookmarks"
"github.com/Archs/chrome/api/browserAction"
"github.com/Archs/chrome/api/browsingData"
"github.com/Archs/chrome/api/cookies"
"github.com/Archs/chrome/api/extension"
"github.com/Archs/chrome/api/fontSettings... |
997146049bc01a2bf95a910fdfa80f4cfcec0fb9 | 266436a8ec21e66059efb1728055abf26db76452 | decentfox/arborist | /arborist/token.go | Go | go | 2,535 | permissive | package arborist
import (
"errors"
"fmt"
"github.com/uc-cdis/go-authutils/authutils"
)
type TokenInfo struct {
username string
clientID string
policies []string
}
func (server *Server) decodeToken(token string, aud []string) (*TokenInfo, error) {
missingRequiredField := func(field string) error {
msg := fm... |
64f1b23b49833dcea7d7ecd3d074452f17c4859e | 198ebd705d5bccf4a37f252f9f97585da5634b09 | glennj/exercism.io | /go/pascals-triangle/pascals_triangle_test.go | Go | go | 2,730 | no_license | package pascal
import (
"fmt"
"reflect"
"testing"
)
var triangleTestCases = [][]int{
{1},
{1, 1},
{1, 2, 1},
{1, 3, 3, 1},
{1, 4, 6, 4, 1},
{1, 5, 10, 10, 5, 1},
{1, 6, 15, 20, 15, 6, 1},
{1, 7, 21, 35, 35, 21, 7, 1},
{1, 8, 28, 56, 70, 56, 28, 8, 1},
{1, 9, 36, 84, 126, 126, 84, 36, 9, 1},
{1, 10, 45, ... |
b118074e0a30a8b1b8513f032e2d89382aede8ad | d2be54c30227eb6b989178f35627523f37c18128 | yefriddavid/golang-api-hello-world | /main.go | Go | go | 435 | no_license | package main
import (
"encoding/json"
"github.com/gorilla/mux"
"log"
"net/http"
)
func GetPeopleEndpoint(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode("hello I am go and this is an api, go luck.")
}
func main() {
router := mux.NewRouter... |
53d4f3b5068d2d9143d024f7d7b21a4fba54af66 | c760c2d650ccb9e6c44601a0f52e7f273171ba99 | ckelsel/go | /src/ch2/mem.go | Go | go | 248 | permissive | package main
var p *int
//2, d := test1()
// 1, test1()
func test1() *int {
var a int
return &a
}
// 2
func test2() {
var b int
p = &b
}
// 1
func test3() {
var c int
c += 1
}
func main() {
d := test1()
test2()
test3()
*d += 1
}
|
ee41f81f4148ff6060a5c7bce57176c2efc2f539 | 6fe3f3cf765cc02f8b5688c9f3b9587ae054c1c8 | isabella232/addons-firebase-testlab | /testreportfiller/test_report_filler.go | Go | go | 6,781 | permissive | package testreportfiller
import (
"bytes"
"encoding/json"
"encoding/xml"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/bitrise-io/addons-firebase-testlab/bitrise"
"github.com/bitrise-io/addons-firebase-testlab/junit"
"github.com/bitrise-io/addons-firebase-testlab/models"
"github.com/gobuffalo/uuid"
juni... |
528bf8e2110603bc77dc2659221de927922bfd1f | 4da466297444765d75c57f597a97acaff52cbb8c | fabriziopandini/test-infra | /prow/github/fakegithub/fakegithub.go | Go | go | 34,860 | 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, ... |
05a06b4bd38299c138af4fddcd7bf5793358add2 | 342facfcdb136a27709dbd907f576bfdcb2b9b7b | vishymails/golangexamples | /DAY2/simpleshape/example/shapedemo.go | Go | go | 295 | no_license | package main
import (
"fmt"
"github.com/vishymails/golangexamples/simpleshape"
)
func main() {
r := simpleshape.NewRectangle(9, 6)
t := simpleshape.NewTriangle(3, 6)
fmt.Println("Area : ", simpleshape.ShapeArea(r))
fmt.Println("Area : ", simpleshape.ShapeArea(t))
}
|
bb5edccb5f9332c619aef7545f5ae15367067935 | 42a3eac2344c0f8eb2a4a9e35da461beb2d45796 | saurabh-zededa/eve | /pkg/pillar/vendor/github.com/lf-edge/edge-containers/pkg/registry/pull.go | Go | go | 2,930 | permissive | package registry
import (
"context"
"fmt"
"io"
ctrcontent "github.com/containerd/containerd/content"
"github.com/containerd/containerd/remotes"
"github.com/deislabs/oras/pkg/oras"
ecresolver "github.com/lf-edge/edge-containers/pkg/resolver"
"github.com/lf-edge/edge-containers/pkg/store"
ocispec "github.com/... |
7a8ca2e2b09fdccc87cd7af51bc41ccbb68018d4 | 3bfcba09d1a6918e44dc4bbed56bf3a9ebe8529d | ilevine/rexray | /rexray/cli/cmds_volume.go | Go | go | 7,307 | permissive | package cli
import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/spf13/cobra"
)
func (c *CLI) initVolumeCmdsAndFlags() {
c.initVolumeCmds()
c.initVolumeFlags()
}
func (c *CLI) initVolumeCmds() {
c.volumeCmd = &cobra.Command{
Use: "volume",
Short: "The volume manager",
Run: func(cmd *cobra.Comm... |
43e0da36e4b58bb87f437d9578d122b88812e12e | 5cde8eae54cf7c108008807a7627bdaaa6c10adb | gcurtis/stripe-go | /creditnote.go | Go | go | 13,037 | permissive | //
//
// File generated from our OpenAPI spec
//
//
package stripe
import "encoding/json"
// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
type CreditNoteReason string
// List of values that CreditNoteReason can take
const (
CreditNoteReasonDupli... |
c7615e3c00b3e4375bce3a49a872727bf46d4ff1 | 16b60fc68310b434fe3f4fa74d792f5e13608eca | miracl/core | /go/CONFIG_CURVE.go | Go | go | 1,808 | permissive | /*
* Copyright (c) 2012-2020 MIRACL UK Ltd.
*
* This file is part of MIRACL Core
* (see https://github.com/miracl/core).
*
* 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... |
325e2e63961e10561cb884c2f89060a4a2d1263a | 50e4fad987814107fabf1661b2a46819a46181c1 | erebos12/cruddy | /src/infrastructure/mongo.go | Go | go | 3,135 | no_license | package infrastructure
import (
. "../configuration"
. "../utils"
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
var initialSession = initMongo()
func initMongo() *mgo.Session {
method := "initMongo"
session, err := mgo.Dial(GetMongoUrl())
if err != nil {
message := fmt.Sprintf("Error connecting to mong... |
1b2f118f4039381306ac9caa3e31fb8e4fb36794 | c3516ad3c5271f1598a6e74ea02001a003807620 | hirose31/peco | /source.go | Go | go | 5,683 | permissive | package peco
import (
"bufio"
"io"
"sync"
"time"
"context"
"github.com/lestrrat/go-pdebug"
"github.com/peco/peco/internal/util"
"github.com/peco/peco/line"
"github.com/peco/peco/pipeline"
)
// Creates a new Source. Does not start processing the input until you
// call Setup()
func NewSource(in io.Reader, i... |
8c13fc85314f30a6e7271196c60f11d3c93abc64 | 5075eff63c9fcdae1d8c1743943f18201dc9c45e | emojify-app/face-detection | /handlers/post.go | Go | go | 2,646 | permissive | package handlers
import (
"bytes"
"encoding/json"
"fmt"
"image"
"io"
"io/ioutil"
"net/http"
"os"
"github.com/emojify-app/face-detection/detection"
"github.com/emojify-app/face-detection/logging"
)
// Request is base64 encoded image
// Response for the function
type Response struct {
Faces []image.Rectan... |
7f026f86a3cc32726e65791bc6517da663708525 | 568619b13bd0e0789b9f07d13dbd3b00611400f6 | cesarkuroiwa/golang | /array/array.go | Go | go | 299 | no_license | package main
import "fmt"
func main() {
a := [5]int{1, 2, 3, 4, 5} // Array with 5 elements
s := a[:3] // s points to the first 3 elements of a
fmt.Println("s: ", s)
fmt.Println("a: ", a)
s[0] = 9 // Change the first element of s2, s1 and a
fmt.Println("s: ", s)
fmt.Println("a: ", a)
} |
4476096d1cd3705cebde440fbfc3faa972399146 | e3ce83b19f08d8ec30d3797a5897d3e9774c2b54 | romeovs/preql | /sql/tx.go | Go | go | 730 | permissive | package sql
import (
"context"
"database/sql"
)
// Tx implements Interface by wrapping a database/sql.Tx.
type Tx sql.Tx
// ExecContext implements Interface.
func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (Result, error) {
return (*sql.Tx)(tx).ExecContext(ctx, query, args...)
}
... |
e3ab403e20c158b4b5e1a4ec0726ae77e9b7de84 | a9cafca58adb052c143ac702a1565aefaf015c56 | alxarch/ksonnet | /pkg/clicmd/env_update_test.go | Go | go | 1,159 | permissive | // Copyright 2018 The ksonnet 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 applica... |
dc850688de21ea668a716df50f13c5587ee78992 | c0432d633a4104c627ccc5981078bdb07a5a18b6 | gokangaroo/Go-Modules | /base_study/4.packages/packages.go | Go | go | 664 | no_license | package main
import (
"fmt"
"log"
"base_study/4.packages/rectangle" // 导入自定义包
)
var _ = rectangle.Area // 错误屏蔽器
/*
* 1. 包级别变量
*/
var rectLen, rectWidth float64 = 6, 7
/*
*2. init 函数会检查长和宽是否大于0
*/
func init() {
println("main package initialized")
if rectLen < 0 {
log.Fatal("length is less than zero")
}
... |
88ba4913d2e37160f40c3c98140e72f1bbfb4643 | cbe4d2491a8324e419caef4fe534285b4af8e4d9 | tanjianfeng/gvisor | /pkg/sentry/fdimport/fdimport.go | Go | go | 2,879 | 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... |
8c97fd9f3408a5873cf1c175d2758e565ab74022 | 586d5fa61c090b950f06533a1b3a104334a97d27 | AppliedGoCourses/mastergo | /5_AdvancedTopics/5-1-4_channels/main_test.go | Go | go | 501 | permissive | package main
import "testing"
func BenchmarkChanZeroLength(b *testing.B) {
for i := 0; i < b.N; i++ {
ints := make(chan int, 0)
go produceSteadily(ints)
consumeInBatches(ints)
}
}
func BenchmarkChanLengthTen(b *testing.B) {
for i := 0; i < b.N; i++ {
ints := make(chan int, 10)
go produceSteadily(ints)
... |
54d537a252614d54e6418fd9dc099b1fe328c596 | 327122c27097d0a7d8b6503bf6c47e3e33267c2c | sudhakar-mnsr/simplilearn | /iosectionrdr.go | Go | go | 241 | no_license | package main
import (
"io"
"os"
"strings"
)
func main() {
str := strings.NewReader("The quick brown"+
"fox jumps over the lazy dog")
section := io.NewSectionReader(str, 19, 23)
io.Copy(os.Stdout, section)
}
|
656e42d79858f0ca23e30c752100ce43d0efa0a7 | d291ce63505215ba0ab3f49ad4e89e1747bf6e85 | BreamIO/breamio | /moduler/beenleigh.go | Go | go | 4,743 | no_license | /*
Business Logic module
Beenleigh handles all business logic of Bream IO Eye Stream
It exposes a interface for interacting with this logic
but not the actual implementation.
*/
package moduler
import (
"fmt"
"github.com/maxnordlund/breamio/briee"
"github.com/maxnordlund/breamio/config"
"path/filepath"
"errors"... |
d3b2336b2756c31899bffecf2c4aa2f392410433 | 1cfaebdb3b2c6a54d30ef1adb50658e01fc2a4b3 | selifm/iris | /vendor/golang.org/x/text/language/maketables.go | Go | go | 47,071 | permissive | // Copyright 2013 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 ignore
// Language tag table generator.
// Data read from the web.
package main
import (
"bufio"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"math"
... |
7de52384853e6b5704a0fd392a9c1178d9bcacd6 | c542c50e3cdf1aa0097057ad2663d9ed1598874b | Bungysheep/chat-app | /server/services/chat/chat_test.go | Go | go | 6,411 | permissive | package chat
import (
"context"
"fmt"
"testing"
"time"
"github.com/bungysheep/chat-app/server/api/chat"
"github.com/bungysheep/chat-app/server/api/chat/mock"
"github.com/golang/mock/gomock"
)
func TestSendNilMessage(t *testing.T) {
ctx := context.Background()
chatSvc := NewChatServiceServer()
sendReq := ... |
3e016b4f6e3586b5d5e99e92190c861950bdbf54 | 2958d3b893ceb68e62606d7a805b9df49bebb76a | tjytlxwxhyzqfw/online-judge | /leetcode/solutions/984/984.go | Go | go | 1,210 | no_license | // 984.go
package main
import "fmt"
// 984 135/201 34% m=_ s=_
func main() {
fmt.Println(strWithout3a3b(0, 0))
fmt.Println(strWithout3a3b(1, 0))
fmt.Println(strWithout3a3b(1, 1))
fmt.Println(strWithout3a3b(1, 2))
fmt.Println(strWithout3a3b(1, 3))
fmt.Println(strWithout3a3b(1, 4))
fmt.Println(strWithout3a3b(2,... |
74f1d948ec18c60de47cdf2f173e5d61514cffd8 | 8ccf4f25ecfb4ff656325a08270a6928001ff34b | neoliv/trexec | /procevents.go | Go | go | 11,519 | no_license | package main
/*
#include "procevents.c"
*/
import "C"
import (
"fmt"
"math"
"os"
"sort"
"strconv"
"sync"
"syscall"
"time"
)
const (
scCount = iota
scTime = iota
)
var scStrings = [2]string{}
var sortCriteria = scCount
var vanishedCount uint64 // number of failed read in /proc/#/stat == vanished proces c... |
31d12cb7bc0b39269a33c691f83064b158dedfc6 | 5ff472a0fc41c6ee6a1b0faf45d82036405314e1 | morrell/pulumi-azure-native | /sdk/go/azure/media/v20180330preview/init.go | Go | go | 1,746 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20180330preview
import (
"fmt"
"github.com/blang/semver"
"github.com/pulumi/pulumi-azure-native/sdk/go/azure"
"github.com/pulumi/pulumi/sdk/v3/go/pul... |
2be1f6daf3162a801e33cfbe920c1d07b3cf283d | a45fd337bf6fc9e2adafda30e018ba70b0619ea5 | yuewko/themis | /pip/client/pipes.go | Go | go | 1,233 | permissive | package client
import (
"errors"
"math"
"sync/atomic"
"time"
)
var (
errTimeout = errors.New("timeout")
errReaderBroken = errors.New("reader has been broken")
)
type pipes struct {
t *int64
d int64
idx chan int
p []pipe
}
func makePipes(n int, d int64) pipes {
idx := make(chan int, n)
for len... |
b7a3c99cea5bc60c66bb3880327187fd2fef2d81 | c934001b249a05801b39a2d00c31d18b7d11e3e4 | isgasho/drummer | /nodehostimage_test.go | Go | go | 2,789 | permissive | // Copyright 2017-2019 Lei Ni (nilei81@gmail.com) and other Dragonboat 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
//
// ... |
d2ab725afbf991578d5953e5a5c4222e9ae0a9b3 | 2fc6444b51fa8d3f200737a1097de8ad78970a0d | codequest-eu/lordcommander | /mock_commander_test.go | Go | go | 780 | permissive | package lordcommander
import (
"bytes"
"testing"
"github.com/stretchr/testify/suite"
)
type mockCommanderSuite struct {
suite.Suite
commander *MockCommander
}
func (s *mockCommanderSuite) SetupTest() {
s.commander = new(MockCommander)
}
func (s *mockCommanderSuite) TestRun() {
s.commander.On("Run", "send", ... |
8203d8be813296d740b89c6b3b16b06db0a205d9 | ec236f66ea00b0bdef7796fa628e2273053631cc | HashCash-Consultants/go | /support/clock/main_test.go | Go | go | 1,230 | permissive | package clock_test
import (
"testing"
"time"
"github.com/hcnet/go/support/clock"
"github.com/hcnet/go/support/clock/clocktest"
"github.com/stretchr/testify/assert"
)
// TestClock_Now_sourceNotSet tests that when the Source field is not set that
// the real time is used when the Clock is asked for the current ti... |
c3527932c71cfd6a34c844612bbefcfe2237631d | 63856c3d085167d9b99cfee6bb9ed015102e1d36 | mosn/istio | /galley/pkg/config/testing/fixtures/listener.go | Go | go | 927 | permissive | // Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
68aff819027943387f01aef11322efe721b74f31 | a3afbc108a605c88afdc3367c26853061d46a6ca | qiaotaizi/zava | /instructions/constants/const.go | Go | go | 2,318 | permissive | package constants
import (
"github.com/qiaotaizi/zava/instructions/base"
"github.com/qiaotaizi/zava/rtda"
)
//将null引用推入栈顶
type ACONST_NULL struct {
base.NoOperandsInstruction
}
func (i *ACONST_NULL) Execute(frame *rtda.Frame) {
frame.OperandStack().PushRef(nil)
}
//将双精度浮点数0退出栈顶
type DCONST_0 struct {
base.NoOp... |
b60bee3f46a92d92ccde5b274bf89df22244d85d | c66226320ad0eef26e0eb497a6489b5b235698da | dickykmrlh/themaze | /creational_pattern/maze_componnent.go | Go | go | 867 | no_license | package creational_pattern
import (
"fmt"
"github.com/dickykmrlh/themaze/common"
)
type MapSite interface {
Enter()
}
// Room
type Room struct {
sides [4]MapSite
RoomNumber int
isEnchanted bool
}
func (r *Room) SetSide(direction common.Direction, site MapSite) {
r.sides[int(direction)] = site
}
func (r *Room... |
2fc6f51523222bb9acb5efb36e1c8da3ffc425de | dc7cbb54cc8d0cdd645f61096efc1a8c29736413 | vsizov/minio | /pkg/madmin/heal-commands.go | Go | go | 4,719 | permissive | /*
* Minio Cloud Storage, (C) 2017 Minio, 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 ... |
143043f17df17f2fc3d217547b8b8f3aad708bba | f77692412191096b0d9c348817a17424d82ba352 | fghosth/dsp | /openrtb/banner.go | Go | go | 4,979 | no_license | package openrtb
// 3.2.6 Object: Banner
//
// This object represents the most general type of impression.
// Although the term “banner” may have very specific meaning in other contexts, here it can be many things including a simple static image, an expandable ad unit, or even in-banner video (refer to the Video object... |
39f0e24dec14b640e4265528dc515ed1e7fe53f8 | eb63c979f7c5f408945184c09b3fd230149661d6 | hesen1/interview | /set_test.go | Go | go | 894 | permissive | package main
import (
"testing"
"sync"
)
func TestSetAdd(t *testing.T) {
set := NewSet()
testValue := 1
set.Add(testValue)
if !set.Has(testValue) {
t.Fatal("Set Add: add方法无效")
}
if set.Len() != 1 {
t.Fatal("Set Add: add方法无效")
}
set.Clear()
if set.Has(testValue) {
t.Fatal("Set Clear: Clear方法无效")
... |
803e5fb3b2e604b07bebfbf8f3264fd0235cd180 | ce2769ca2331d74c96dc2413f81e532c6c04bdc6 | yudaprama/iso20022 | /model/CancellationReason19Choice.go | Go | go | 704 | permissive | package model
// Choice of format for the cancellation reason.
type CancellationReason19Choice struct {
// Specifies the reason why the related instruction is cancelled, or the related cancellation request is executed.
Code *CancelledStatusReason13Code `xml:"Cd"`
// Specifies the reason why the related instructio... |
23ecd93e06349192ee93da458a793bc7aa9c968a | b10ce558b9cbd0ea6ca1ed270308ae6ac3a55038 | nf/ebiten | /examples/wav/main.go | Go | go | 2,234 | permissive | // Copyright 2017 The Ebiten 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... |
57753fa8bd0428348dec3334ccb27dae68f770e7 | af204a5ac9b766cb7b8c426d0c8bfa0b4c2f3cd0 | SolarLune/dlgs | /message_js.go | Go | go | 1,137 | permissive | // +build js
package dlgs
import (
"github.com/gopherjs/gopherjs/js"
)
// Info displays information dialog.
func Info(title, text string) (ret bool, err error) {
return alertDialog(title, text, "\u24d8")
}
// Warning displays warning dialog.
func Warning(title, text string) (ret bool, err error) {
return alertDi... |
c1409969b1ec5bbe73af6d8f3fca4673ec24ecb3 | 0620543659e047f063f2f76f35f13328c7adc840 | paulomorais/concurrentProgramming | /Go/concurrentProgramming/fibonacci/fibonacci_test.go | Go | go | 3,165 | no_license | package threads
import (
"testing"
)
func benchmarkFibonacciThread(n int, b *testing.B) {
for i := 0; i < b.N; i++ {
Run(n)
}
}
func BenchmarkFibonacciThread0(b *testing.B) { benchmarkFibonacciThread(0, b) }
func BenchmarkFibonacciThread1(b *testing.B) { benchmarkFibonacciThread(1, b) }
func BenchmarkFibonacc... |
24a0ed8cf2916dee3c9c8586fe2827d28188484d | b08cacb265e1474fb69d020e1d550bb0917bff77 | fnl-Africa/qlnd | /lnwallet/chanvalidate/validate.go | Go | go | 7,069 | permissive | package chanvalidate
import (
"bytes"
"fmt"
"github.com/qtumproject/qtumsuite/txscript"
"github.com/qtumproject/qtumsuite/wire"
"github.com/qtumproject/qtumsuite"
"github.com/qtumproject/qlnd/lnwire"
)
var (
// ErrInvalidOutPoint is returned when the ChanLocator is unable to
// find the target outpoint.
Err... |
5b14fc7cd4faa739db0f03afc5d694e4ad97d068 | 3029afe8fd86606dbf1d48fa319a8b3315b44c52 | cmendible/components-contrib | /bindings/influx/influx.go | Go | go | 4,524 | permissive | /*
Copyright 2021 The Dapr 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... |
3c37804d19e6bfd70295bc54d474ff8757cc1246 | 0b9611dab8c965572a6d9dc41acb9aa865f157af | go-stomp/stomp | /server/topic/manager.go | Go | go | 605 | permissive | package topic
// Manager is a struct responsible for finding topics. Topics are
// not created by the package user, rather they are created on demand
// by the topic manager.
type Manager struct {
topics map[string]*Topic
}
// NewManager creates a new topic manager.
func NewManager() *Manager {
tm := &Manager{topic... |
3615917e887033f4014b947e0a4102324dd3fa57 | 5ac75a3fe8302750b66e3c3ed355f9a4558aadc7 | ruo91/kubernetes-mesos | /pkg/proc/types.go | Go | go | 1,963 | permissive | package proc
// something that executes in the context of a process
type Action func()
type Context interface {
// end (terminate) the execution context
End() <-chan struct{}
// return a signal chan that will close upon the termination of this process
Done() <-chan struct{}
}
type Doer interface {
// execute s... |
7cbad6f3764c4ece8844c4d5163915893a910264 | e7a6b0f26edb313943efdad7cdb79e6e97450718 | bobvawter/iaido | /pkg/loop/loop.go | Go | go | 2,972 | permissive | // Copyright 2020 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
999376798cdcebceafc32a92c941c9256626f13e | 2b972df6dedc7b5d5cfa6e41718ac24bb8466b5b | icowan/kplcloud | /src/repository/syssubscription/service.go | Go | go | 554 | permissive | /**
* @Time : 2022/9/23 11:21 AM
* @Author : solacowa@gmail.com
* @File : service
* @Software: GoLand
*/
package syssubscription
import (
"context"
"github.com/kplcloud/kplcloud/src/repository/types"
"gorm.io/gorm"
)
type Service interface {
Save(ctx context.Context, data *types.Subscription) (err error)
}
... |
1055b4d859daf3a8537ce1acb245c50714b1cf22 | 38d2bded09b67b71eb961529c8c82d2f78784919 | giraffate/go-practice | /progress-bar/pb.go | Go | go | 609 | no_license | package main
import (
"fmt"
"strings"
"time"
)
func main() {
n := 20
fmt.Print("\x1b[31m")
for i := 0; i < n; i++ {
fmt.Print("\r")
fmt.Print("[")
fmt.Printf("%s", strings.Repeat("=", i))
if i != n-1 {
fmt.Print(">")
fmt.Printf("%s", strings.Repeat(" ", n-2-i))
}
fmt.Print("] ")
fmt.Printf("... |
cbc2ec17652668869e28f026b19b7c63fedc0f69 | 230dfd205770b0911b10c2703f17f112e5956cdf | thetnaingtn/diocforum-service | /post/post.go | Go | go | 672 | permissive | package post
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type Post struct {
Id primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
Body string `json:"body,omitempty" bson:"body,omitempty"`
AvatarURL string `json:"avatarURL,omitempty" bson:"avatar... |
bee337a8a61d0b45e50b6c0daf1e67b51c799e09 | 3f04d6ee50547168e1e6cd88147af3a791fe2209 | harold2111/loans | /client/application/create_client_request.go | Go | go | 527 | no_license | package application
type CreateClientRequest struct {
Identification string `json:"identification"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Telephone1 string `json:"telephone1"`
Tel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.