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 |
|---|---|---|---|---|---|---|---|---|
e53ed31df80237fd3d544884a8c7a54e064fc943 | 8044ea207bffef582762e3db6e3a088721bce05b | openshift-cherrypick-robot/installer | /pkg/terraform/exec/plugins/vendor/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_redshift_cluster.go | Go | go | 30,639 | permissive | package aws
import (
"fmt"
"log"
"regexp"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/redshift"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/... |
a556ed0ab49ef7e65702f9fd09aa2b1dbfd21f0c | 85ac0879219b76e65316aade98dcdaaa7a008ed4 | firefoxxy8/demistobot | /web/router.go | Go | go | 7,352 | permissive | package web
import (
"crypto/tls"
"encoding/json"
"fmt"
"net"
"net/http"
"os"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/demisto/demistobot/conf"
"github.com/gorilla/context"
"github.com/julienschmidt/httprouter"
"github.com/justinas/alice"
)
// Main handlers
var public string
// Ser... |
e51cc45b08cac4204a84ba3bc9387776394d582e | 68a1028a76dd195d799614d82b874c257b1733a2 | nikolaynag/go-hitstree | /hitstree/hitstree_test.go | Go | go | 1,932 | permissive | package hitstree_test
import (
"strings"
"testing"
"github.com/nikolaynag/go-hitstree/hitstree"
"github.com/stretchr/testify/assert"
)
func TestHitPath(t *testing.T) {
hitstree.Delimiter = "/"
ht := hitstree.NewHitsTree()
ht.HitPath("/")
ht.HitPath("/1/2/3")
for i := 0; i < 100; i++ {
ht.HitPath("/1/2/3/4... |
64fddfcabef150badd8338f12b02556347c3ed5b | c215335eef1a2ad9f0483b77f7dc36c37f5f6d39 | gravitational/teleport | /lib/srv/app/mocks_test.go | Go | go | 1,272 | permissive | /*
Copyright 2022 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
4252c7081571f4a60f07c19e02d49cb890c50a43 | 0ab1f80b8a06dd59bdff4823d28da9728b3b1949 | icloudland/bitshares | /objects/assetfeed.go | Go | go | 1,043 | permissive | package objects
import (
json "encoding/json"
"github.com/denkhaus/bitshares/util"
"github.com/juju/errors"
)
type AssetFeed struct {
ProviderID GrapheneID
DateTime Time
FeedInfo AssetFeedInfo
}
func (p *AssetFeed) UnmarshalJSON(data []byte) error {
if data == nil || len(data) == 0 {
return nil
}
va... |
7707debf5864db9e1c8fc168b64e457b920e0eed | b5f1d76bbfdfd3365c6838f27d9c887ddd37cfc6 | facebookincubator/nvdtools | /cmd/vulndb/vendorcmd.go | Go | go | 4,499 | permissive | // Copyright (c) Facebook, Inc. and its affiliates.
//
// 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 applicabl... |
55603a9bb6f09e308ca99edb81bf4cf86582d7bb | e36b0141554e051a8c21deff37f42835fdda9f6e | yrj2011/my-test-infra | /vendor/github.com/google/go-github/github/repos_forks.go | Go | go | 2,390 | permissive | // Copyright 2013 The go-github 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 github
import (
"context"
"fmt"
)
// RepositoryListForksOptions specifies the optional parameters to the
// RepositoriesService.ListForks ... |
8947872dc657114a53c82855232f2acd9d81d264 | 1eb7c504b48a4c23c9af0564106f6abafd42328b | syogo-yamanouchi/synerex_beta | /gateway/simple/simple-gateway.go | Go | go | 2,636 | permissive | package main
import (
"flag"
"log"
"strings"
"sync"
api "github.com/synerex/synerex_api"
"github.com/synerex/synerex_nodeapi"
sxutil "github.com/synerex/synerex_sxutil"
"golang.org/x/net/context"
)
var (
nodesrv = flag.String("nodesrv", "127.0.0.1:9990", "Node ID Server")
gateway = flag.Str... |
0006c0c572e6df2d97ed8bb315c2d63efb72d139 | 4f87a24c2c323b389d46442545aaf1675900019f | ljb-2000/jobplatform | /src/vendor/k8s.io/client-go/pkg/api/unversioned/time_proto.go | Go | go | 591 | no_license | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
f5091ddd3665bbc059af293d0accd4323f45f7d9 | af29d694a019980c01dd0cd0836777139950513e | a-t-jam/jame | /game/combat/ev.go | Go | go | 730 | no_license | // ev (event) is for separating GUI from the internal state progress
package combat
import (
"fmt"
"github.com/a-t-jam/jame/game/scene"
)
// Event is a change to the combat world
type Event interface {
run()
anim() Anim
}
// TODO: use generational index
// Anim is always a melee attack animation
type Anim str... |
e70ae2c2f6a5c4ef412919ec7e14ae4b0d87cb4e | b84b66bf5380003a70327ef2bc586b3db81951e2 | shiki-tak/connect | /x/nft/handler_test.go | Go | go | 6,940 | no_license | package nft_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/shiki-tak/connect/x/nft"
"github.com/shiki-tak/connect/x/nft/types"
)
const (
module = "module"
denom = "denom"
nftID = "nft-id"
sender = "sender"
recipient =... |
85f6b66f3290b32122193c9bf1e9dff1342c9f2e | ca50b4f3657d79059de48643ddd2cd5cfb2a5ad3 | koron-go/ngram | /ngram_test.go | Go | go | 1,174 | permissive | package ngram_test
import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/koron-go/ngram"
)
func TestNew(t *testing.T) {
for i, tc := range []struct {
n int
s string
exp ngram.Index
}{
{2, "abcde", ngram.Index{
"ab": 1,
"bc": 1,
"cd": 1,
"de": 1,
}},
{3, "abcde", ngram.Index{... |
062adbb2597ccacee2c48c6af1ac5579a9088877 | 4798531f224862178e5d9a54659bd54e72261077 | pot-au-6db/practice_gowiki | /main_file.go | Go | go | 745 | no_license | package main
import (
"io/ioutil"
)
// ファイルをセーブする関数
func (p *Page) save() error {
// 引数struct pのTitle要素と".txt"を結合
filename := p.Title + ".txt"
// ioutilのWriteFileメソッドで、引数struct pのボディを作成したファイル名で書き込む。
return ioutil.WriteFile(filename, p.Body, 0600)
}
// ファイルをロードする
func loadPage(title string) (*Page, error) {
/... |
eb577f83af342adb3e5ba0b74ab73b7c4143ec11 | 08c6e5f30f99362cf383ba46547d490fda34c720 | andysibyl/bk-ci | /src/agent/src/vendor/github.com/influxdata/telegraf/vendor/github.com/influxdata/go-syslog/rfc5424/parser.go | Go | go | 891 | permissive | package rfc5424
import (
"github.com/influxdata/go-syslog"
"sync"
)
// parser represent a RFC5424 parser with mutex capabilities.
type parser struct {
sync.Mutex
*machine
}
// NewParser creates a syslog.Machine that parses RFC5424 syslog messages.
func NewParser(options ...syslog.MachineOption) syslog.Machine {
... |
975b6b5300d6cd7e37082362d52b108c553853bc | ddc1e4df9d50a0868d1c96d5a641d5993f42cbc7 | nianhua110/jvmgo | /src/ch05/instructions/comparisons/fcmp.go | Go | go | 628 | no_license | package comparisons
import (
"ch05/instructions/base"
"ch05/rtda"
)
type FCMPG struct {
base.NoOperandsInstruction
}
func (self *FCMPG) Execute(frame *rtda.Frame) {
_fcmp(frame, true)
}
type FCMPL struct {
base.NoOperandsInstruction
}
func (self *FCMPL) Execute(frame *rtda.Frame) {
_fcmp(frame, false)
}
fun... |
cf6aa0856eaed2b01ad48b35fdce7bc057f1c1b9 | ecd548893ee2b06c1e33cb6ab8944c638ebb659e | LiuzhouChan/go-paxos | /nodehost_test.go | Go | go | 15,741 | permissive | package paxos
import (
"context"
"log"
"os"
"path/filepath"
"sync"
"testing"
"time"
"github.com/LiuzhouChan/go-paxos/config"
"github.com/LiuzhouChan/go-paxos/internal/logdb"
"github.com/LiuzhouChan/go-paxos/internal/tests"
"github.com/LiuzhouChan/go-paxos/internal/transport"
"github.com/LiuzhouChan/go-pax... |
ccc53faebba912ca763c19f62846d6b920150beb | b6082c707826f5859842d99ea04a1a767890eea5 | yamoridon/go | /gobook/ch3/basename/basename_test.go | Go | go | 358 | no_license | package basename
import "testing"
func Test(t *testing.T) {
if basename("a") != "a" {
t.Error(`basename("a") != "a"`)
}
if basename("a.go") != "a" {
t.Error(`basename("a.go") != "a"`)
}
if basename("a/b/c.go") != "c" {
t.Error(`basename("a/b/c.go") != "c"`)
}
if basename("a/b.c.go") != "b.c" {
t.Error(... |
c3a961c31be648d8c76cef30b8f5b7db5c4e68b1 | a1bf065147766f396c0732e29b8bc9d129cac3df | german9304/datastructures-go | /linkedList/__testing__/linkedList.append_test.go | Go | go | 833 | no_license | /**
* Testing file for linked list
**/
package linkedListTesting
import (
"testing"
// "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
ll "linkedList/main.go/linkedlist"
)
type appendSuite struct {
suite.Suite
}
var alr ll.LinkedList
func (s *appendSuite) BeforeTest(suiteName, testN... |
8618f0dbf9b1b8cacb44f86bf360a0416fbdc182 | 4b3a6b52a729d4b18978ceacd95b9a659889a505 | singmyr/othello-client | /main.go | Go | go | 1,340 | no_license | package main
import (
"flag"
"log"
"net/url"
"os"
"os/signal"
"time"
"github.com/gorilla/websocket"
)
var addr = flag.String("addr", "singmyr.dev:8008", "http service address")
func main() {
flag.Parse()
log.SetFlags(0)
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
u := u... |
bc77dafec426a2e99a478782efd039621da8221c | 75a25f6289165263c59909b4584c13352e436a98 | huaweicloud/huaweicloud-sdk-go-v3 | /services/dcs/v2/model/model_show_migration_task_request.go | Go | go | 461 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ShowMigrationTaskRequest Request Object
type ShowMigrationTaskRequest struct {
// 任务ID。
TaskId string `json:"task_id"`
}
func (o ShowMigrationTaskRequest) String() string {
data, err := utils.Marshal(o)
if err != ... |
b59d2b51985a184fcd2a6dfff89272c1cea8ffa6 | ae2b38db28f752eac02e967f628b1e7dc6a6ce88 | freemed/freemed-data | /common/derivative.go | Go | go | 1,502 | no_license | package common
import (
"reflect"
"strconv"
"strings"
)
func Derivatives(values [][]string, idx int, sep string) []string {
out := make([]string, 0)
for _, v := range values {
if strings.Index(v[idx], sep) != -1 {
sub := strings.Split(v[idx], sep)
for _, sv := range sub {
out = append(out, strings.Tr... |
23de147b2da26c53d8588b74b1bef12943ea8160 | 6021f43dcb2da1401398fa3a97675b66b74a6836 | jaegertracing/jaeger-operator | /pkg/inventory/ingress_test.go | Go | go | 2,067 | permissive | package inventory
import (
"testing"
"github.com/stretchr/testify/assert"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestIngressInventory(t *testing.T) {
toCreate := networkingv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "to-create",
},
}
toUpdate :... |
1e6e930b234363686cca3c6b4f7d708f88782058 | eb5c82432fac6e72297d86b5b4a49c868dbc77c6 | liangyuanpeng/pulsarctl | /pkg/ctl/namespace/namespace.go | Go | go | 5,286 | 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... |
1388a6420e14abe71a07fdc362051272becba536 | 6c84628e10f3fc83e126b5555bca03503a44dd97 | CMSgov/bcda-ssas-app | /ssas/rsakeys_test.go | Go | go | 4,460 | permissive | package ssas
import (
"crypto/rsa"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
const badBase64KeyPath = "../shared_files/ssas/bad_base64_test_private_key.pem"
const notRSAKeyPath = "../shared_files/ssas/not_rsa_test_private_key.pem"
const tooSmallKeyPath = "../shared_file... |
81b5c34fb9596a4efce6bb2dadb48acaa06c2e4b | 5ec793e5c480fd1d01035885f2e916164439fa09 | udzura/beforedo | /tasks_test.go | Go | go | 1,479 | permissive | package main
import (
"io/ioutil"
"os"
"testing"
)
func TestParseConfig(t *testing.T) {
conf, _ := ioutil.TempFile("", "beforedo--testing--")
defer os.Remove(conf.Name())
conf.Write([]byte(`
- task: mysql.server start
port: 3306
- task: memcached -p 11211 -m 64m -d
port: 11211
- task: bundle install --path ... |
589393da2d5ad49866e388e9019f45877b623e39 | dfbf52bcad40cd66baadca89ab6f6bc9651a95ef | mayur-tolexo/pg-shifter | /example/createEnum.go | Go | go | 1,670 | permissive | package main
import (
"log"
"time"
"github.com/mayur-tolexo/contour/adapter/psql"
shifter "github.com/mayur-tolexo/pg-shifter"
)
func main() {
if conn, err := psql.Conn(true); err == nil {
s := shifter.NewShifter()
//1. Create enum by passing table model
err = s.CreateEnum(conn, &TestAddress{}, "address_... |
acfcd78169f53e3f35b2060157843628d5984dcd | 6e98059bc61855d82268cfa3d692d378a25a5965 | shuLhan/share | /lib/email/maildir/filename.go | Go | go | 1,584 | permissive | // Copyright 2023, Shulhan <ms@kilabit.info>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package maildir
import (
"fmt"
"syscall"
)
// filename contains information about the format in file name.
type filename struct {
nameTmp strin... |
62598a4f02d3ac5484369593e0bfd423868019cf | 31410d86f4fffe7938dc39ca1168909d75d95761 | rispal/learning | /api/seed/seeder.go | Go | go | 1,324 | no_license | package seed
import (
"log"
"github.com/jinzhu/gorm"
"github.com/rispal/learning/api/models"
)
var users = []models.User{
models.User{
Nickname: "Steven victor",
Email: "steven@gmail.com",
Password: "password",
},
models.User{
Nickname: "Martin Luther",
Email: "luther@gmail.com",
Password: "p... |
fdb9a810877f529f7da44835980657ff87ea6672 | c9897fbacd72d4828ee94973dca044997e3821a4 | genji1037/report-manager | /service/sie_count_sugar.go | Go | go | 3,964 | no_license | package service
import (
"bufio"
"bytes"
"fmt"
"github.com/pkg/errors"
"github.com/shopspring/decimal"
"io"
"os"
"report-manager/alg"
"report-manager/db"
"report-manager/db/open"
"report-manager/logger"
"report-manager/proxy"
"time"
)
type SIECountSugar struct{}
func (s SIECountSugar) Type() string {
r... |
46a0daddbf423912f970a32fc35f686aec8b8d0f | 6651ab27cd18121dfd2fd8f15850b1ba841ea868 | spanghf37/assisted-service | /internal/network/machine_network_cidr.go | Go | go | 13,179 | permissive | package network
import (
"encoding/json"
"net"
"strings"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
func getVIPInterfaceNetwork(vip n... |
5c167ad96179abf90c5e541d0e1d4d636761c035 | c5ed375132f9a012c2da7081cbb8bf1db6e53c5b | gaissmai/go-inet | /inet/netmasks.go | Go | go | 6,240 | permissive | package inet
var maskUint128 = [...]uint128{
0: {0x0000000000000000, 0x0000000000000000},
1: {0x8000000000000000, 0x0000000000000000},
2: {0xc000000000000000, 0x0000000000000000},
3: {0xe000000000000000, 0x0000000000000000},
4: {0xf000000000000000, 0x0000000000000000},
5: {0xf800000000000000, 0x00000... |
591eafb216eadf211e6c602b01710e25219a4300 | e76f54f32e7e7af174052cf6dba5733011e158ce | rawkode/kompose | /pkg/transformer/openshift/openshift.go | Go | go | 21,727 | permissive | /*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
883a6d7a34868d859245be8f2f7d235e6e3beae3 | 348134c0eafd650ccd1b8a4bae906a8c2805a9d9 | mzit/gpwg | /24/24-1.go | Go | go | 619 | no_license | package main
import (
"fmt"
"strings"
)
var t interface {
talk() string
}
type martian struct {
}
func (m martian) talk() string {
return "nack nack"
}
type laser int
func (l laser) talk() string {
return strings.Repeat("pew ", 12)
}
type talker interface {
talk() string
}
func shout(t talker) {
louder :... |
59bc78fb3f1b2eba028c49258a5f4d8f31b9474d | d383dc868d08329afe659b95a5bcf0ed756ac766 | bzz/scholar-alert-digest | /papers/papers_test.go | Go | go | 4,383 | permissive | package papers
import (
"fmt"
"strings"
"testing"
"unicode"
"unicode/utf8"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// UnitTests for paper extraction.
func TestScholarURLExtraction(t *testing.T) {
var testCases = []struct {
name string
scholarURL string
URL ... |
babc547b5262b863e69776a35195ea21637faca9 | 41c8cb1dbc186205dc06d10c5a7958402befcda6 | cdesaintleger/navigator | /pkg/pilot/elasticsearch/v5/probes.go | Go | go | 706 | permissive | package v5
import (
"context"
"time"
"github.com/golang/glog"
"github.com/jetstack/navigator/pkg/pilot/genericpilot/probe"
)
func (p *Pilot) ReadinessCheck() probe.Check {
return probe.CombineChecks(
p.localNodeHealth,
)
}
func (p *Pilot) LivenessCheck() probe.Check {
return probe.CombineChecks(
func() ... |
8b9d093e4f0bde928d42bd4880da8a2330c41300 | 834b0e56c4bf2929b07fccb1227e858e1dfa082b | boltmq/common | /protocol/lang.go | Go | go | 596 | permissive | package protocol
type Language int
const (
JAVA Language = iota
CPP
DOTNET
PYTHON
DELPHI
ERLANG
RUBY
OTHER
HTTP
GOLANG
)
// 消费类型枚举
// Author: yintongqiang
// Since: 2017/8/8
func (language Language) String() string {
switch language {
case JAVA:
return "JAVA"
case CPP:
return "CPP"
case DOTNET:
... |
02fe649ccf57666304942d89b87bdcac4d8705fa | 564af71200254afe05a3e4d95c8b261f8880b424 | hiroksarker/kubernetes | /pkg/scheduler/algorithmprovider/defaults/defaults.go | Go | go | 6,650 | 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, ... |
ea9212bedbd7688bcf076b9951a324a72bf2b6df | f0547f999572422e65a435725313e02268669158 | wanggudlak/vhzuo_uims_http | /pkg/thrift/server/server.go | Go | go | 2,218 | permissive | package thriftserver
import (
"crypto/tls"
"errors"
"fmt"
"github.com/apache/thrift/lib/go/thrift"
"uims/gen-go/uims_rpc_api"
"uims/pkg/color"
"uims/pkg/thrift/common"
)
const BUFFER_SIZE = 8192
// RunningServer
func RunningServer(apiHandler *UIMSRpcAPIHandler, addr, protocol string, framed, buffered, ioMulti... |
cfaac497efd739f49077aabacb35491d852f2680 | dbca5bea9ccad9cad232702e26ca71b6f586945d | runcom/go-unused | /cmd/unused/main.go | Go | go | 1,913 | permissive | package main // import "honnef.co/go/unused/cmd/unused"
import (
"flag"
"fmt"
"go/token"
"log"
"os"
"sort"
"github.com/runcom/go-unused"
"github.com/kisielk/gotool"
)
var (
fConstants bool
fFields bool
fFunctions bool
fTypes bool
fVariables bool
fVerbose bool
)
func init() {
flag.BoolVar(&f... |
cb90caacd63d62b6bff896efc4799e0a33466bbf | 0f54376628c04b6ad7f1a1947d6a6541bd60fb4c | mkowalski/scion | /go/cert_srv/internal/metrics/metrics.go | Go | go | 697 | permissive | // Copyright 2019 Anapaya Systems
//
// 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... |
831226af89d3c460a580b08ade5e0d865bd3cb66 | 1767c2c524773c3622dd83a980da0239bd2c6d3d | singlemonad/SnailKV | /shardkv/internal/app/op.go | Go | go | 1,012 | no_license | package app
import (
"bytes"
"context"
"encoding/gob"
)
type OperationType = int
const (
GetOp = 1
PutOp = 2
AppendOp = 3
DeleteOp = 4
MigrateOp = 5
)
type opRequest struct {
ctx context.Context
typ OperationType
args interface{}
reply interface{}
errorCh chan interface{}
}
func... |
1f56a08876d6019d7e019a21e6d5381a95e2d3bf | 15e0bfbf18e894e28b9f4630eff30f8c91a62dde | hirokikojima/study-algorithms | /design_pattern/iterator/book.go | Go | go | 220 | no_license | package iterator
type Book interface {
GetName() string
}
type book struct {
Name string
}
func NewBook(name string) Book {
return &book{
Name: name,
}
}
func (book *book) GetName() string {
return book.Name
} |
984d00a4a94131e91eb3c5d3936f1f9608928f8b | 55588a0f7819e327215e8ecd362e36761a0fe2be | lj-211/go-test-example | /nettest/grpc_test.go | Go | go | 675 | no_license | package nettest
import (
"context"
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/lj-211/go-test-example/mock"
"github.com/lj-211/go-test-example/nettest/proto"
)
func Test_CallGrpcClient(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockOb... |
fba176b511a8af67608d01d459411debbd936145 | 6a09167785b263dff9704844b00faa32b064737e | vixns/kaf | /cmd/kaf/kaf.go | Go | go | 2,534 | permissive | package main
import (
"fmt"
"crypto/tls"
"crypto/x509"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"
"io/ioutil"
"os"
"github.com/infinimesh/kaf"
)
var cfgFile string
func getConfig() (saramaConfig *sarama.Config) {
saramaConfig = sarama.NewConfig()
saramaConfig.Version = sarama.V1_0_0_0
saramaCo... |
aa41da4ec51568c324f862faf1766eece69153e5 | 763b8c848ac1c3efe88764edb17eb73431a46ed7 | csrwng/installer | /terraform/providers/google/vendor/github.com/hashicorp/terraform-provider-google/google/common_diff_suppress.go | Go | go | 8,179 | permissive | // Contains common diff suppress functions.
package google
import (
"crypto/sha256"
"encoding/hex"
"log"
"net"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func optionalPrefixSuppress(prefix string) schema.SchemaDiffSuppressFunc {
return fun... |
09457c100724d3d3ebc4de90f5980a2de6d98e07 | 23441f0f153d0d981b497a52e825ff09f4e89c58 | marquisthunder/gleam | /instruction/union.go | Go | go | 1,673 | permissive | package instruction
import (
"io"
"strconv"
"sync"
"github.com/marquisthunder/gleam/pb"
"github.com/marquisthunder/gleam/util"
)
func init() {
InstructionRunner.Register(func(m *pb.Instruction) Instruction {
if m.GetUnion() != nil {
return NewUnion(m.GetUnion().GetIsParallel())
}
return nil
})
}
typ... |
f789f7dc5085c0858d9d71abeb7857f7b2ada8ca | 741e2031a513dfc6f15654d9e565b8e4b9f9ce37 | huaweicloud/huaweicloud-sdk-go-v3 | /services/er/v3/model/model_list_availability_zone_request.go | Go | go | 501 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ListAvailabilityZoneRequest Request Object
type ListAvailabilityZoneRequest struct {
// 企业路由器ID
InstanceId *string `json:"instance_id,omitempty"`
}
func (o ListAvailabilityZoneRequest) String() string {
data, err :... |
927dd9fe82eb7ccbb6508a68a972a6cbc71de7e3 | d8d064df9d469742664ee564daecc5eaef235af3 | BlackMetalz/GoLang | /Aerospike/insert.go | Go | go | 880 | no_license | package main
import (
// "fmt"
aero "github.com/aerospike/aerospike-client-go"
)
// This is only for this example.
// Please handle errors properly.
func panicOnError(err error) {
if err != nil {
panic(err)
}
}
func main() {
// define a client to connect to
client, err := aero.NewClient("10.3.48.54", 3000)
... |
96e793c46588633a4550b2cc4b8854409d564786 | bbcec8abd19c66d20a5d2903a8f06c3820bfc5d9 | lapnd/vitess-trasa | /vitess/go/vt/topo/vschema.go | Go | go | 3,959 | no_license | /*
Copyright 2019 The Vitess 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, soft... |
ee8ceddc9775e34f80cfe54aabf7443ca0fe12b8 | 9c546d5c291b85f6d233aee82a52eecf75e6654e | xmidt-org/ears | /internal/pkg/jwt/jwt.go | Go | go | 7,540 | permissive | package jwt
import (
"context"
"crypto/rsa"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"github.com/xmidt-org/ears/pkg/tenant"
"io"
"math/big"
"net/http"
"strings"
"time"
jwt "github.com/golang-jwt/jwt"
)
func (nfe *UnauthorizedError) Error() string {
return nfe.Msg
}
func NewJWTConsumer(publicKe... |
4e04951e5c8fe0f43ba29f01b73e64ae18b99ee5 | 058cc4356c849eabaabb10c617ef26946f1a5c3a | jashwantraj92/brigade | /vendor/github.com/slok/brigadeterm/pkg/model/brigade/brigade.go | Go | go | 308 | permissive | package brigade
import (
"github.com/brigadecore/brigade/pkg/brigade"
)
// Project is a brigade project.
type Project = brigade.Project
// Build is a brigade build.
type Build = brigade.Build
// Job is a brigade job.
type Job = brigade.Job
// State is a jobStatus state.
type State = brigade.JobStatus
|
a63629209b31b3f2066408583ab2c782d99685ef | 4f83c30338a04825c44c64fe96ebf7a8adfcc91b | acejam/Sia | /modules/renter/contractor/contractmaintenance.go | Go | go | 31,966 | permissive | package contractor
// contractmaintenance.go handles forming and renewing contracts for the
// contractor. This includes deciding when new contracts need to be formed, when
// contracts need to be renewed, and if contracts need to be blacklisted.
import (
"fmt"
"math/big"
"github.com/acejam/Sia/build"
"github.co... |
8722b1374a740d05b143e36b9f7dfc375d66756d | 823264879ade6983f72d440fe93d62a27ae19b05 | xujianming2017/skywalking-banyandb | /banyand/tsdb/series_write.go | Go | go | 4,444 | permissive | // Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
65dc237c5b282c027887dd635deaaeb2ff3de2c7 | f435d977c1aa176c25d6f4c6508816dd36198d26 | ahmed-sabbir/go-learnings | /learn_errors/basics/learn_errors.go | Go | go | 663 | no_license | package main
import (
"errors"
"fmt"
"os"
"strconv"
)
func divAndMod(a int, b int) (int, int, error) {
if b == 0 {
return 0, 0, errors.New("Cannot divive by zero")
}
return a / b, a % b, nil
}
func main() {
if len(os.Args) < 3 {
fmt.Println("Expected more params")
os.Exit(1)
}
a, err := strconv.Parse... |
12b4c1a1987df15c2449844c4de39d102210df04 | 555eaf2a66e4ed673683f84ec42aa1badfe2baa0 | jin06/binlogo | /vendor/github.com/siddontang/go-log/log/log.go | Go | go | 3,978 | permissive | package log
import (
"fmt"
"os"
)
var logger = NewDefault(newStdHandler())
// SetDefaultLogger changes the global logger
func SetDefaultLogger(l *Logger) {
logger = l
}
// SetLevel changes the logger level
func SetLevel(level Level) {
logger.SetLevel(level)
}
// SetLevelByName changes the logger level by name
... |
110ce80041c06b2064ac20c92aba527015f0f9ac | c08052a85ba86e8affe0a1112875043eac6d14a8 | insighio/mainflux | /cli/keys.go | Go | go | 1,598 | permissive | // Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package cli
import (
"time"
"github.com/spf13/cobra"
)
var cmdAPIKeys = []cobra.Command{
{
Use: "issue <duration> <user_auth_token>",
Short: "Issue key",
Long: `Issues a new Key`,
Run: func(cmd *cobra.Command, args []string) {
if len(... |
8cd8a51f2a43fd817ec703d95efe31cce393b9cf | 7a4ce00900fc020975ac1e40f6659c1d2b1472f9 | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/datashare/v20200901/dataSet.go | Go | go | 5,591 | 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 v20200901
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A DataSet data transfer object.
type ... |
5cf442b37fbadf3f66e913e9757719b966211b72 | 58483428adb36aef46fd56ca5a1ea754cbadf7fb | frzb/coinboot-plugins | /src/telegraf/upstream/config/config.go | Go | go | 51,308 | permissive | package config
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/models"
"github.com/influxdata/... |
fdeb09d300138b16e7b9a1078624d5e192e76cf7 | 59eb0a51b6a44edd66db2a6757247160c0174568 | naqvijafar91/go-workshops | /002-functions-packages/00-basics-functions/20-multiple-return/multiple-return.go | Go | go | 370 | no_license | package main
import "fmt"
// returning many values definition in brackets
func vals() (int, int) {
return 42, 2
}
func main() {
// we can return 2 values (or more) at a time
a, b := vals()
fmt.Println(a)
fmt.Println(b)
// if we don't want to use any of values we can bypass it with `_` operator
_, c := vals(... |
2c4e631e59c0de1c30a228f8d5b3e68a3b76ff2f | 888fd7c19e6317e5c1c125ee5e8cf6a690c1d6cc | rohitmual/aegis | /internal/implementations/rescanclose.go | Go | go | 41,216 | permissive | package implementations
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"sync"
"time"
"github.com/nortonlifelock/aegis/internal/integrations"
"github.com/nortonlifelock/aegis/pkg/domain"
"github.com/nortonlifelock/aegis/pkg/log"
)
// ScanCloseJob are created by rescan jobs, and do not have to b... |
0748e72a7b5fe4b80b33f8eefe2fe148cba80ce1 | f32c5c8e0eb83e5b8d9db9266a7bb8389a1218bc | AstmDesign/convox | /provider/k8s/k8s.go | Go | go | 4,919 | permissive | package k8s
import (
"context"
"flag"
"fmt"
"os"
"os/exec"
"time"
"github.com/convox/convox/pkg/atom"
"github.com/convox/convox/pkg/common"
"github.com/convox/convox/pkg/metrics"
"github.com/convox/convox/pkg/structs"
"github.com/convox/convox/pkg/templater"
"github.com/convox/logger"
"github.com/gobuffa... |
5ed6574ac783a0f0d0f89f69ffbda392d6d01cdb | 52322de617f70b606e82739317156edcbd2dd570 | Scaloutions/RabbitMQRepo | /app/src/service/configService.go | Go | go | 2,209 | no_license | package service
import (
"fmt"
"github.com/streadway/amqp"
"../config"
"../consumer"
"../producer"
"../util"
)
type (
ConfigService struct {
u *util.Utilities
conn *amqp.Connection
}
)
func GetConfigService() *ConfigService {
return newConfigService()
}
func (configService ConfigService) GetUtilit... |
03c42b6ce01d3f1f5f6b7a1a0277bb15c3c44977 | 6a681dbb2c86b2c66c919a5c8ebc74a094ec4604 | paradian/casbin-forum | /controllers/reply.go | Go | go | 3,221 | permissive | // Copyright 2020 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a... |
a2f946d9b85a57cc7fcc7bc9136b931878e92e3f | a69bb9071ee45e543563ac74c76c66c1fde458fe | glvd/go-media-tool | /cmd/file_server/main.go | Go | go | 417 | permissive | package main
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"net/http"
)
var dir = `D:\workspace\golang\project\go-fftool\video_split_temp`
func main() {
router := gin.Default()
router.Use(cors.Default())
router.Handle(http.MethodGet, "/*path", gin.WrapH(http.FileServer(http.Dir(dir))))
//... |
f40a98d6736ebee5905e84a675f5e124da838d03 | 3f996d3a8d861073990258e25458ef182e0d3566 | bob3000/go-algorithms | /avl/avl.go | Go | go | 5,222 | no_license | package avl
type node struct {
key int
value interface{}
parent, left, right *node
}
// Avl is the basic type of the AVL tree
type Avl struct {
root *node
size int
}
// New creates a new AVL tree
func New() Avl {
return Avl{}
}
// Height recursively measures the hight of the tree... |
b43e7280df13548819f9eead4534f2b14395bbe3 | 738348be7f3e168d744a1f43f5b1251152cd0b4c | wzlove/ggz | /pkg/module/base/base_test.go | Go | go | 323 | permissive | package base
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEncodeMD5(t *testing.T) {
assert.Equal(t,
"3858f62230ac3c915f300c664312c63f",
EncodeMD5("foobar"),
)
}
func TestEncodeSha1(t *testing.T) {
assert.Equal(t,
"8843d7f92416211de9ebb963ff4ce28125932878",
EncodeSha1("foobar"),
)... |
abc9f76cc8b01d78d6d41b8833ad4b3199759805 | b24cd91e89deda8f0a37c3e99c44f75b35bcca81 | mcornea/coredns | /plugin/file/zone.go | Go | go | 4,923 | permissive | package file
import (
"fmt"
"net"
"path/filepath"
"strings"
"sync"
"time"
"github.com/coredns/coredns/plugin/file/tree"
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
)
// Zone defines a structure that contains all data related to a DNS zone.
t... |
003cbe4d282618c40e40ce99fc56597c62161ad5 | 725a63ac36b175ecdd78262707e7c64d66acf2bf | khicago/httpoet | /option.go | Go | go | 2,064 | permissive | package httpoet
import (
"context"
"net/http"
"time"
)
type Option func(req *RequestBuilder) (fnDefer func())
func OBackground() Option {
return func(*RequestBuilder) func() { return func() {} }
}
func OTimeout(d time.Duration) Option {
if d <= 0 {
return OBackground()
}
return func(req *RequestBuilder) fu... |
1e1798ea7ae5b64917f019b4cfbaf42ea9a7a215 | 26937781b8ac51c18c80fe2fbf46a5984029764c | sravanti/adventofcode2018 | /app/main.go | Go | go | 215 | no_license | package main
import (
one "adventofcode2018/1"
two "adventofcode2018/2"
"fmt"
)
func main() {
fmt.Println("part 1")
one.SolveOneA()
one.SolveOneB()
fmt.Println("part 2")
two.SolveTwoA()
two.SolveTwoB()
}
|
478a19eda4221ee5ff2ff62d44b266b6cc5f4394 | 184c12d30e86bea6c4572a984274c776981bc03f | sunny-zyl/Dragonfly | /cmd/dfdaemon/app/root.go | Go | go | 5,545 | permissive | /*
* Copyright The Dragonfly 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... |
a351439c0caf5b7ec70581ba98a392a0c837009c | b837b8c210c26549f93387a3062ec859b483c704 | AleksK1NG/Go-booking-microservices-example | /sessions/internal/interceptors/manager.go | Go | go | 940 | no_license | package interceptors
import (
"context"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.com/AleksK1NG/hotels-mocroservices/sessions/config"
"github.com/AleksK1NG/hotels-mocroservices/sessions/pkg/logger"
)
// InterceptorManager
type InterceptorManager struct {
logger logger.Logger
... |
ecd5178cb0fe386e9efc64d7260238d7357555ad | c9158a03d1269db929500af119e9aed268a67023 | deemount/discogs | /api/controllers/home_controller.go | Go | go | 440 | permissive | package controllers
import (
"net/http"
"github.com/deemount/discogs/api/responses"
)
// Home Controller
// @Summary Get home
// @Description Homepage
// @ID home
// @Accept json
// @Produce json
// @Header 200 {string} Token "ok"
// @Failure 404 {object} utils.HTTPError404
// @Router /home [get]
func (server *Ser... |
1b609ba88d5c71e4aa9f9d71b521b37a658ecc12 | a32039711dce45283c08e45f8a0735f13294c99f | yzhlove/Go | /design.com/src/builder/main.go | Go | go | 2,150 | no_license | package main
import (
"errors"
"fmt"
)
//构建模式
//定义灯的基本信息
//LightColor 灯的颜色
type LightColor string
//LightStatus 灯的状态
type LightStatus bool
//LightBrand 灯的品牌
type LightBrand string
//定义等的颜色常量
const (
//RedColor 红色
RedColor LightColor = "red"
//GreenColor 绿色
GreenColor = "green"
//BlueColor 蓝色
BlueColor = ... |
033772155f5382c3918a765a61244c62463bea96 | bd562d392a9982c4ab35a77ff27b5144cec42564 | skudriavtsev/caddy | /caddyhttp/extensions/ext.go | Go | go | 1,767 | permissive | // Copyright 2015 Light Code Labs, 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 agre... |
ee7152949cba0c9fbd5ff161b7abb3b3a9968e42 | 28ace8971873fea9f6f62d5cf77531e31b327d79 | morrell/pulumi-azure-native | /sdk/go/azure/network/v20190801/getExpressRouteCircuitPeering.go | Go | go | 3,405 | 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 v20190801
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Peering in an ExpressRouteCircuit resource.
func LookupExpressRouteCircuitPeering(ctx... |
b9b3440fc97db808d3269ba143fcf26106dd9f57 | 94619081cadd666ef7f1a5dfe0c7d8906ef7fb7b | ksenobait09/bot-golang | /api_mock.go | Go | go | 4,934 | no_license | package botgolang
import (
"encoding/json"
"net/http"
"github.com/sirupsen/logrus"
)
type MockHandler struct {
http.Handler
logger *logrus.Logger
}
func (h *MockHandler) SendMessage(w http.ResponseWriter) {
encoder := json.NewEncoder(w)
err := encoder.Encode(&Response{
OK: true,
})
if err != nil {
h.l... |
2b32f627e14c4b7313f7bfd9c3a1f8034c24ad5d | df700250e3ad0f9b7190dbfec552e5901cc0e9b2 | apollo-maple/lnd | /contractcourt/contract_resolvers.go | Go | go | 3,970 | permissive | package contractcourt
import (
"encoding/binary"
"errors"
"fmt"
"io"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btclog"
"github.com/monasuite/lnd/build"
"github.com/monasuite/lnd/channeldb"
)
var (
endian = binary.BigEndian
)
const (
// sweepConfTarget is the default number of blocks that we'll ... |
294d77cfc0ea00aeba39e13593c1b839976f4c56 | 0b13a356fa2d28c3e5ff29b7ff4859a56fef83d9 | addy1997/al-Go-rithms | /Conversions/binarytohexadecimal.go | Go | go | 833 | permissive | package main
import "fmt"
func reverse(numbers [20]int) [20]int {
for i := 0; i < len(numbers)/2; i++ {
j := len(numbers) - i - 1
numbers[i], numbers[j] = numbers[j], numbers[i]
}
return numbers
}
func main() {
var Hex_values = []int{0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110... |
13367305da9f2cc5b33cdad68233ab522b95a8de | 807b9afcd61a8a1ce0b8354fe16a96514166e18c | wjimenez5271/migration-tools | /vendor/k8s.io/kubernetes/contrib/mesos/pkg/election/doc.go | Go | go | 711 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
2f639d07e84fbbec9adabec4766bee852ee7cae6 | 173f1b2ad5eea5d18f172e00115015d5d3ad0e86 | flerry/gramework | /app_listenAndServeAutoTLS.go | Go | go | 1,705 | permissive | package gramework
import (
"crypto/tls"
"net"
"strings"
"github.com/valyala/fasthttp"
"golang.org/x/crypto/acme/autocert"
"rsc.io/letsencrypt"
)
func (app *App) ListenAndServeAutoTLS(addr string, cachePath ...string) error {
if portIdx := strings.IndexByte(addr, ':'); portIdx == -1 {
addr += ":443"
}
ln,... |
082ce59e6e17472c8d254fb7bed1ca5e960d7d61 | 0b7de75506014bc850505eb0250eca01a04b19d1 | pedroalvesbatista/scipipe | /port_test.go | Go | go | 5,291 | permissive | package scipipe
import (
"os"
"reflect"
"testing"
)
func TestConnectTo(t *testing.T) {
initTestLogs()
outpName := "test_outport"
outp := NewOutPort(outpName)
inpName := "test_inport"
inp := NewInPort(inpName)
ConnectTo(outp, inp)
if !outp.Connected() {
t.Error("Out-port not connected")
}
if !inp.Conne... |
02b7c5d0bd285b966e7178b70ff85c9769813940 | dd44ec4062689c795858ee6eaec89bb0ca8bd86f | mike1808/adventofcode2020 | /day12/day12.go | Go | go | 3,481 | permissive | package day12
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
)
type Coord [2]int
type Direction int
const (
East Direction = iota
South
West
North
Left
Right
Forward
)
type Entry struct {
distance int
direction Direction
}
func Day12() {
input, err := parseInput()
if err != nil {
panic(err)
}
fmt... |
30e46cf70ac2ce7e4dac29f5672cdece4464d7cb | 492149d210e4e8bf28a247771d12dd61948a572e | kubernetes-sigs/kubebuilder | /pkg/plugins/common/kustomize/v1/plugin.go | Go | go | 2,662 | permissive | /*
Copyright 2022 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, ... |
bafc8aae56ffaa4497cfcfe94a24a0b86a3a5f5d | 67bddca3aec26481c8eee37baa94bd35653fafb8 | leviok/lotus | /extern/sector-storage/sched_worker.go | Go | go | 11,524 | permissive | package sectorstorage
import (
"context"
"time"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
)
type schedWorker struct {
sched *scheduler
worker *workerHandle
wid WorkerID
heartbeatTimer *time.Ticker
scheduledWindows chan *schedWindow
taskDone chan s... |
d4465c44f3cb31c524dcee144eea7e76a45cf573 | 7da4f2e32051a7a1a62230a094ad3e0ede85f11c | AliyunContainerService/docker-machine-driver-aliyunecs | /vendor/github.com/docker/machine/commands/commands.go | Go | go | 12,650 | permissive | package commands
import (
"errors"
"fmt"
"os"
"strings"
"github.com/codegangsta/cli"
"github.com/docker/machine/commands/mcndirs"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/crashreport"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/log"
... |
327f268e038ec30832c57b652893ba71275fea40 | 2ce9e484d3b566ab869407616305de8d7fa3687d | cloudfoundry/python-buildpack | /src/python/requirements/requirements_suite_test.go | Go | go | 201 | permissive | package requirements_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestRequirements(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Reqs Suite")
}
|
9904bb954f01bc8fba5fcbdad2e28687bc3fb8e5 | 90f17c9226f327709f0c342dcc6dbc1fed17c9d3 | sunzhaochang/tracer-demo | /server/server.go | Go | go | 1,728 | no_license | package main
import (
"context"
"fmt"
"log"
"net/http"
_ "strings"
"time"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/tracer-demo/util"
)
func sayhello(w http.ResponseWriter, r *http.Request) {
log.Println("recv request from client: ", r.Host... |
ed0328bf78fe27f62d1ec4dc2934af8a943a9110 | bfcbee74f9d92b0c0812ae0391cd3cc5ef5d14d1 | icemanblues/advent-of-code | /template/dayXX.go | Go | go | 329 | permissive | package main
import (
"fmt"
"github.com/icemanblues/advent-of-code/pkg/util"
)
const (
dayNum = "XX"
dayTitle = "Title"
)
func part1() {
input, _ := util.ReadInput("input.txt")
fmt.Printf("Part 1: %v\n", len(input))
}
func part2() {
}
func main() {
fmt.Printf("Day %v: %v\n", dayNum, dayTitle)
part1()
p... |
8026d25184edbca781c76353f13f87a008345305 | 199eb37e92afd23a468694399a44169143721e91 | ykaseng/articles-library | /api/api.go | Go | go | 1,312 | no_license | // Package api configures an http server for administration and application resources.
package api
import (
"time"
"github.com/ykaseng/articles-library/api/app"
"github.com/ykaseng/articles-library/database"
"github.com/ykaseng/articles-library/logging"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware... |
157b19270f0fe1b0e8f070d5fc5dc07e7076b59b | e9384ed8e499d8a450b95607b9fe855dde0a77e7 | NicolasT/contained-ganesha | /ganesha-config-reload/signalhandler.go | Go | go | 987 | permissive | package main
import (
"context"
"os"
"os/signal"
"github.com/go-logr/logr"
)
type signalHandler struct {
cancel context.CancelFunc
log logr.Logger
sigs []os.Signal
c chan os.Signal
}
func NewSignalHandler(log logr.Logger, cancel context.CancelFunc, sigs ...os.Signal) (*signalHandler, error) {
ret... |
207af4ed11bef034dc9ec31723f5f6752d0eb0da | 37b97943ae0cc2d4e54ec79573ac0d9c58c7a550 | pulcy/vault-monkey | /deps/github.com/hashicorp/vault/command/renew.go | Go | go | 2,164 | permissive | package command
import (
"fmt"
"strconv"
"strings"
"github.com/hashicorp/vault/meta"
)
// RenewCommand is a Command that mounts a new mount.
type RenewCommand struct {
meta.Meta
}
func (c *RenewCommand) Run(args []string) int {
var format string
flags := c.Meta.FlagSet("renew", meta.FlagSetDefault)
flags.St... |
8a297ee181c7df02f97ba065385004b9eab00fb3 | 4d96b54cd10832e6afaa90d29d65c3ffa39cb97b | flowerwedding/myBlog | /internal/routers/router.go | Go | go | 1,987 | no_license | /**
* @Title router
* @Description 路由管理
* @Author 沈来
* @Update 2020/8/3 16:05
**/
package routers
import (
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
_ "myBlog/docs"
"myBlog/global"
"myBlog/internal/middleware"
"myBlog/internal/rou... |
c34c36d748f8fc77351bb2646ef24a061fb1a204 | 84e82b1d469c72bf77df14c179a1c578a07b25b8 | crosslogic/sesiones | /sesiones_test.go | Go | go | 3,638 | no_license | package sesiones
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestToken(t *testing.T) {
h := Handler{}
h.secretKey = []byte("secreto")
// Creo un token
token, err := h.newToken("marcos")
assert.Nil(t, err)
tokenString, err := token.Signe... |
3dc369c08d9c9b63802fe2f297b7a74c6faedb34 | 526e248843e60aa5ea46da7250d7317bc3ab6ce0 | bygui86/go-gorm | /database/postgres/config.go | Go | go | 1,213 | permissive | package postgres
import (
"errors"
"github.com/bygui86/go-gorm/utils"
)
const (
hostEnv = "POSTGRES_HOST"
portEnv = "POSTGRES_PORT"
usernameEnv = "POSTGRES_USERNAME"
passwordEnv = "POSTGRES_PASSWORD"
paramsEnv = "POSTGRES_PARAMS"
hostDefault = ""
portDefault = 0
usernameDefault = ""
pass... |
23facd6ded0d6de6c084deff4ec531ab733fe1ee | 321dd8a05e6a7a1c49a42910955485f6b547a125 | strogo/mulch | /cmd/mulch/client/sftp.go | Go | go | 1,961 | permissive | package client
import (
"bufio"
"io"
"io/ioutil"
"log"
"net/http"
"path/filepath"
"strconv"
"github.com/pkg/sftp"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"
)
var callCountForSFTPCopy = 0
// SFTPCopy is a WIP
func SFTPCopy(vmName string, user string, filename string) error {
// only o... |
5e969c001dd358bf1613e5b68e48a60755450d81 | 51df42708275674c75bfb4880d8b513bb31a87bd | sgtest/monorepo-test-3 | /kubernetes-8/pkg/proxy/config/doc.go | Go | go | 1,406 | 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, ... |
608a40467aa1f954079170615ea7f603f65f42d7 | 275c6e42482570dcdc18e1beb274f43853e1d9f2 | punk1u/jvmgo | /ch08/instructions/references/multianewarray.go | Go | go | 2,157 | no_license | package references
import "jvmgo/ch08/instructions/base"
import "jvmgo/ch08/rtda"
import "jvmgo/ch08/rtda/heap"
// multianewarray指令创建多维数组。
/**
multianewarray指令的第一个操作数是个uint16索引,通过这个
索引可以从运行时常量池中找到一个类符号引用,解析这个引用就
可以得到多维数组类。第二个操作数是个uint8整数,表示数组维
度。这两个操作数在字节码中紧跟在指令操作码后面
multianewarray指令还需要从操作数栈中弹出n个整数,分别代
表每一个维度的数组长度。
*... |
5e92a77ef2a10796d7230977e082a05fe0e7b86c | 2215751159914906666ae0ee86d066ce81b2618e | gurbanli/ProductManagerForTeachingCodeReview | /dto/product.go | Go | go | 880 | no_license | package dto
type CreateProductRequestDTO struct {
Name string `json:"name" binding:"required,min=3,max=255"`
Type string `json:"type" binding:"required,oneof=cl el ha"`
Price float64 `json:"price" binding:"required"`
InStock uint `json:"in_stock" binding:"required"`
}
type UpdateProductRequestDTO str... |
09b0e06710c85b450eaa9db738c709da6aff13df | 7f320ea41af4cae7c3a453f65d2d23e345fe9751 | baiyunwenqi/TheWayToGoCoding | /src/ChangeStructByinterface.go | Go | go | 335 | no_license | package main
import "fmt"
type Cp interface {
ChangeValue(int, int)
}
type complexType struct {
real int
imag int
}
func (c *complexType) ChangeValue(newR int, newI int) {
c.real = newR
c.imag = newI
}
func Change(cp Cp) {
cp.ChangeValue(1, 8)
}
func testChange() {
c := complexType{1, 3}
Change(&c)
fmt.Pri... |
e602e308aeecab1321ac498364725b56563855e4 | 592a4e51f6704f0f86d874a664dda22b92b0b9e7 | davecourtois/GoJavaScript | /Object.go | Go | go | 3,626 | permissive | package GoJavaScript
import "github.com/davecourtois/Utility"
import "reflect"
// The object must be contain entirely in the client a get by the server when he's
// ready to use it with getObjectByUuid... so no channel will dead lock.
/**
* Go representation of a JS object.
*/
type Object struct {
// The the type ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.